/* Shared navigation treatment across the three portals and all themes. */
:root[data-theme] .app-shell { grid-template-columns: 228px minmax(0, 1fr); }
:root[data-theme] .workspace { padding-top: 0; }
:root[data-theme] .sidebar {
  top: 0;
  height: 100vh;
  height: 100dvh;
  margin: 0;
  border: 0;
  border-right: 1px solid var(--line);
  border-radius: 0;
  background: var(--nav);
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}
:root[data-theme="petalglass"] .sidebar { background: #fcf8fd; }
:root[data-theme] .sidebar-brand { height: 68px; padding: 0 16px; border-bottom: 1px solid var(--line); }
:root[data-theme] .sidebar-brand strong { font-size: 15px; font-weight: 700; }
:root[data-theme] .sidebar-brand-copy { display: grid; gap: 2px; min-width: 0; }
:root[data-theme] .sidebar-brand-copy strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
:root[data-theme] .sidebar-brand-copy small { color: var(--nav-muted); font-size: 10px; line-height: 1.3; }
:root[data-theme] .sidebar-brand .brand-mark.small { width: 34px; height: 34px; font-size: 16px; }
:root[data-theme] #nav { align-content: start; gap: 4px; padding: 16px 10px; }
:root[data-theme] .nav-button {
  position: relative;
  min-height: 48px;
  gap: 10px;
  border: 1px solid transparent;
  border-radius: 7px;
  padding: 7px 10px;
  color: var(--nav-muted);
  font-size: 13px;
  font-weight: 550;
  line-height: 1.3;
  transition: color .15s ease, background-color .15s ease;
}
:root[data-theme] .nav-button:hover { color: var(--ink); background: var(--surface-muted); }
:root[data-theme] .nav-button.active {
  color: var(--ink);
  border-color: var(--line);
  background: var(--surface);
  box-shadow: none;
  font-weight: 700;
}
:root[data-theme] .nav-button.active::before {
  content: '';
  position: absolute;
  top: 10px;
  bottom: 10px;
  left: 0;
  width: 3px;
  border-radius: 3px;
  background: var(--accent);
}
:root[data-theme] .nav-icon { width: 30px; height: 30px; flex: 0 0 30px; display: grid; place-items: center; border-radius: 6px; color: var(--nav-muted); background: var(--surface-muted); }
:root[data-theme] .nav-icon svg { width: 18px; height: 18px; }
:root[data-theme] .nav-button.active .nav-icon { color: var(--accent); background: var(--accent-soft); }
:root[data-theme] .sidebar-foot { display: grid; padding: 8px 10px; border-top: 1px solid var(--line); }
:root[data-theme] .topbar {
  top: 0;
  min-height: 68px;
  margin: 0;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: var(--surface);
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

/* The same account menu lives in the sidebar on desktop and in the topbar on mobile. */
:root[data-theme] .account-tools { position: relative; width: 100%; min-width: 0; }
:root[data-theme] .account-tools > summary {
  min-height: 56px;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid transparent;
  border-radius: 7px;
  padding: 7px 9px;
  color: var(--ink);
  background: transparent;
  font-size: 12px;
  font-weight: 650;
  cursor: pointer;
  list-style: none;
}
:root[data-theme] .account-tools > summary:hover,
:root[data-theme] .account-tools[open] > summary { border-color: var(--line-strong); background: var(--accent-soft); }
:root[data-theme] .account-tools > summary::-webkit-details-marker { display: none; }
:root[data-theme] .account-avatar { width: 34px; height: 34px; display: grid; flex: 0 0 34px; place-items: center; border-radius: 50%; color: var(--accent); background: var(--accent-soft); font-size: 14px; font-weight: 750; }
:root[data-theme] .account-summary-copy { display: grid; flex: 1; gap: 3px; min-width: 0; text-align: left; }
:root[data-theme] .account-summary-copy strong { overflow: hidden; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
:root[data-theme] .account-summary-copy small { color: var(--muted); font-size: 10px; font-weight: 500; }
:root[data-theme] .account-tools > summary .account-summary-icon { width: 17px; height: 17px; flex: 0 0 17px; color: var(--nav-muted); }
:root[data-theme] .account-tools[open] > summary .account-summary-icon { color: var(--accent); }
:root[data-theme] .account-tools:not([open]) > .account-tools-panel { display: none; }
:root[data-theme] .account-tools-panel {
  position: absolute;
  z-index: 35;
  right: 0;
  bottom: calc(100% + 8px);
  left: 0;
  display: grid;
  gap: 10px;
  min-width: 224px;
  padding: 12px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--canvas);
  box-shadow: 0 12px 28px var(--shadow);
}
:root[data-theme] .account-menu-action {
  min-height: 40px;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 0;
  border-radius: 6px;
  padding: 8px 10px;
  color: var(--ink);
  background: transparent;
  text-align: left;
  font-size: 12px;
}
:root[data-theme] .account-menu-action:hover { background: var(--surface-muted); }
:root[data-theme] .account-menu-action svg { width: 17px; height: 17px; flex: 0 0 17px; color: var(--muted); }
:root[data-theme] .account-tools-panel .theme-picker { width: 100%; min-height: 40px; margin: 0; justify-content: space-between; }
:root[data-theme] .account-tools-panel .theme-picker select { flex: 0 1 110px; width: 110px; }
:root[data-theme] .account-tools-panel .account-theme-label { display: inline; white-space: nowrap; }
:root[data-theme] .account-tools-panel .tenant-expiry { max-width: none; white-space: normal; overflow-wrap: anywhere; }
:root[data-theme] .account-tools-panel .sync-state { display: flex; align-items: center; min-height: 24px; white-space: normal; }
:root[data-theme] #mobile-account-slot { display: none; }

:root[data-theme] .announcement-message-button {
  width: 42px;
  height: 42px;
  min-height: 42px;
  justify-content: center;
  gap: 0;
  padding: 0;
  border-radius: 7px;
  background: var(--surface-muted);
}
:root[data-theme] .announcement-bell-icon { width: 20px; height: 20px; flex: 0 0 20px; fill: none; stroke: var(--accent); }
:root[data-theme] .announcement-button-label,
:root[data-theme] .announcement-button-arrow { display: none; }
:root[data-theme] .announcement-unread-count { top: -5px; right: -5px; }

@media (max-width: 720px) {
  :root[data-theme] .app-shell { grid-template-columns: minmax(0, 1fr); }
  :root[data-theme] .sidebar-foot { display: none; }
  :root[data-theme] .sidebar {
    position: fixed;
    z-index: 30;
    top: 0;
    width: min(280px, calc(100vw - 44px));
    height: 100vh;
    height: 100dvh;
    margin: 0;
    border-radius: 0 8px 8px 0;
  }
  :root[data-theme] .workspace { padding-top: 0; }
  :root[data-theme] .topbar {
    top: 0;
    min-height: 60px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    margin: 0;
    padding: 9px 12px;
    border-radius: 0;
  }
  :root[data-theme] .topbar > div:nth-child(2) { grid-column: 1; min-width: 0; }
  :root[data-theme] .topbar-actions { grid-column: 2; grid-row: 1; width: auto; margin: 0; justify-content: flex-end; flex-wrap: nowrap; gap: 8px; }
  :root[data-theme] #mobile-account-slot { display: block; }
  :root[data-theme] .account-tools { width: 42px; }
  :root[data-theme] .account-tools > summary { width: 42px; min-height: 42px; justify-content: center; padding: 0; }
  :root[data-theme] .account-avatar { width: 32px; height: 32px; flex-basis: 32px; }
  :root[data-theme] .account-summary-copy,
  :root[data-theme] .account-tools > summary .account-summary-icon { display: none; }
  :root[data-theme] .account-tools-panel {
    top: calc(100% + 8px);
    right: 0;
    bottom: auto;
    left: auto;
    width: min(280px, calc(100vw - 24px));
    max-height: calc(100dvh - 78px);
    overflow-y: auto;
  }
  :root[data-theme] .topbar-actions .announcement-message-button { width: 42px; min-height: 42px; padding: 0; }
  :root[data-theme] .announcement-inbox { top: 62px; right: 8px; }
}

@media (prefers-reduced-motion: reduce) {
  :root[data-theme] .nav-button { transition: none; }
}
