/* App navigation is independent of the ledger and works with native details. */
.app-sidebar { position: fixed; z-index: 15; top: 68px; bottom: 0; left: 0; width: 230px; background: var(--surface); border-right: 1px solid var(--line); overflow-y: auto; padding: 12px 10px; }
.sidebar-toggle, .sidebar-group > summary, .account-menu > summary { display: flex; align-items: center; gap: 10px; min-height: 44px; cursor: pointer; list-style: none; border-radius: 9px; }
.sidebar-toggle::-webkit-details-marker, .sidebar-group > summary::-webkit-details-marker, .account-menu > summary::-webkit-details-marker { display: none; }
.sidebar-toggle { padding: 8px 10px; color: var(--muted); margin-bottom: 12px; font-weight: 650; }
.sidebar-toggle-icon { width: 24px; text-align: center; flex-shrink: 0; }
.sidebar-toggle:focus-visible { outline: 3px solid var(--brand); }
.sidebar-collapse-icon, .group-chevron { margin-left: auto; }
.sidebar-nav { display: flex; flex-direction: column; gap: 8px; }
.sidebar-dashboard, .sidebar-group > summary { padding: 10px; color: var(--text); font-weight: 650; }
.sidebar-dashboard { display: flex; gap: 10px; align-items: center; min-height: 44px; border-radius: 9px; }
.nav-icon { width: 22px; height: 22px; flex-shrink: 0; }
.sidebar-label { overflow-wrap: anywhere; }
.sidebar-group[open] > summary .group-chevron { transform: rotate(90deg); }
.sidebar-links { display: flex; flex-direction: column; margin: 4px 0 8px 20px; padding-left: 12px; border-left: 1px solid var(--line); }
.sidebar-links a { display: flex; align-items: center; min-height: 44px; padding: 8px 10px; border-radius: 8px; color: var(--muted); overflow-wrap: anywhere; }
.sidebar-links a:hover, .sidebar-dashboard:hover, .sidebar-group > summary:hover { background: var(--surface-2); color: var(--text); }
.sidebar-nav [aria-current="page"], .sidebar-group.active-group > summary { background: var(--brand-soft); color: var(--brand-strong); }
.sidebar-nav [aria-current="page"] { font-weight: 750; }
.authenticated-shell .page-shell { width: auto; max-width: 1240px; margin: 32px 32px 80px 262px; min-width: 0; }
.authenticated-shell .topbar { height: 68px; min-height: 68px; padding: 10px 24px; flex-wrap: nowrap; backdrop-filter: none; }
.app-sidebar:not([open]), [data-sidebar-collapsed="true"] .app-sidebar { width: 64px; }
.authenticated-shell:has(.app-sidebar:not([open])) .page-shell, [data-sidebar-collapsed="true"] .authenticated-shell .page-shell { margin-left: 96px; }
.app-sidebar:not([open]) .sidebar-label, .app-sidebar:not([open]) .sidebar-collapse-icon, [data-sidebar-collapsed="true"] .sidebar-label, [data-sidebar-collapsed="true"] .group-chevron, [data-sidebar-collapsed="true"] .sidebar-collapse-icon, [data-sidebar-collapsed="true"] .sidebar-links { display: none; }
.account-menu { position: relative; z-index: 25; }
.account-menu > summary { gap: 8px; padding: 6px 12px 6px 6px; border: 1px solid var(--line-strong); background: var(--surface); max-width: min(240px, 42vw); }
.account-menu .user-name { display: block; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-panel { position: absolute; right: 0; top: calc(100% + 8px); width: min(280px, calc(100vw - 32px)); max-height: calc(100dvh - 90px); overflow-y: auto; padding: 10px; background: var(--surface); border: 1px solid var(--line-strong); border-radius: 12px; box-shadow: var(--shadow); }
.account-panel > a { display: flex; align-items: center; min-height: 44px; padding: 8px 12px; color: var(--text); border-radius: 8px; }
.account-panel > a:hover { background: var(--surface-2); }
.top-actions .icon-button { min-width: 44px; min-height: 44px; }
.sidebar-toggle:focus-visible, .sidebar-group > summary:focus-visible, .account-menu > summary:focus-visible, .sidebar-nav a:focus-visible, .account-panel a:focus-visible { outline: 3px solid var(--brand); outline-offset: -3px; }
@media (max-width: 850px) {
  .authenticated-shell .topbar { padding: 10px 16px 10px 68px; }
  .app-sidebar, .app-sidebar:not([open]), [data-sidebar-collapsed="true"] .app-sidebar { top: 0; bottom: auto; width: auto; padding: 0; border: 0; overflow: visible; background: transparent; }
  .app-sidebar > .sidebar-toggle { position: fixed; top: 12px; left: 16px; margin: 0; width: 44px; padding: 10px; border: 1px solid var(--line-strong); background: var(--surface); }
  .sidebar-toggle .sidebar-label, .sidebar-collapse-icon { display: none; }
  .app-sidebar[open] > .sidebar-nav { position: fixed; top: 68px; bottom: 0; left: 0; width: min(280px, calc(100vw - 48px)); overflow-y: auto; padding: 16px 12px; background: var(--surface); border-right: 1px solid var(--line-strong); box-shadow: var(--shadow); }
  [data-sidebar-collapsed="true"] .sidebar-nav .sidebar-label { display: block; }
  [data-sidebar-collapsed="true"] .sidebar-nav .group-chevron { display: block; }
  [data-sidebar-collapsed="true"] .sidebar-links { display: flex; }
  .authenticated-shell .page-shell, .authenticated-shell:has(.app-sidebar:not([open])) .page-shell, [data-sidebar-collapsed="true"] .authenticated-shell .page-shell { margin: 24px 16px 60px; width: auto; }
}
@media (max-width: 560px) { .authenticated-shell .brand .brand-logo { display: none !important; } .authenticated-shell .brand .brand-mark { display: block; } }
@media print { .app-sidebar, .topbar { display: none; } .authenticated-shell .page-shell, .authenticated-shell:has(.app-sidebar:not([open])) .page-shell, [data-sidebar-collapsed="true"] .authenticated-shell .page-shell { margin: 0; max-width: none; } }
/* D-151: the account menu reads as one list: who is signed in, the two account pages,
   language as two buttons, and sign-out aligned with the rest. */
.avatar { display: inline-grid; place-items: center; flex: none; width: 30px; height: 30px; border-radius: 50%; overflow: hidden; }
.avatar img { width: 64%; height: 64%; }
.avatar-none { background: var(--surface-2); color: var(--muted); }
.avatar-none svg { width: 60%; height: 60%; }
.avatar-lg { width: 38px; height: 38px; }
.avatar-xl { width: 56px; height: 56px; }
.account-who { display: flex; gap: 10px; align-items: center; padding: 6px 12px 12px; margin-bottom: 6px; border-bottom: 1px solid var(--line); min-width: 0; }
.account-who > span:last-child { display: grid; min-width: 0; }
.account-who strong, .account-who small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-who small { color: var(--muted); font-size: 12.5px; }
.account-panel > a { justify-content: space-between; gap: 10px; }
.menu-badge { padding: 1px 8px; border-radius: 999px; background: color-mix(in srgb, #b7791f 16%, transparent); color: #9a6412; font-size: 11.5px; font-weight: 750; white-space: nowrap; }
html[data-theme="dark"] .menu-badge { color: #f3c77a; }
.account-panel .language-form.in-menu { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 44px; padding: 6px 12px; margin: 6px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.language-label { color: var(--text); }
.language-switch { display: inline-flex; border: 1px solid var(--line-strong); border-radius: 9px; overflow: hidden; }
.language-switch button { min-width: 44px; min-height: 36px; padding: 0 10px; border: 0; border-left: 1px solid var(--line-strong); background: var(--surface); color: var(--text); font: inherit; font-size: 13px; font-weight: 700; cursor: pointer; }
.language-switch button:first-child { border-left: 0; }
.language-switch button[aria-pressed="true"] { background: var(--brand-soft); color: var(--brand-strong); }
.language-switch button:focus-visible { outline: 3px solid var(--brand); outline-offset: -3px; }
.menu-logout { margin: 0; }
.menu-logout button { display: flex; align-items: center; width: 100%; min-height: 44px; padding: 8px 12px; border: 0; border-radius: 8px; background: none; color: var(--danger); font: inherit; text-align: left; cursor: pointer; }
.menu-logout button:hover, .menu-logout button:focus-visible { background: color-mix(in srgb, var(--danger) 8%, transparent); }

/* Guide in focus mode (D-156): no sidebar, one centred column of a fixed width. */
.authenticated-shell.focus-shell .page-shell { width: calc(100% - 32px); max-width: 720px; margin: 28px auto 80px; }
.focus-shell .topbar { padding-left: 24px; }
.focus-shell .ob-skip { margin: 0 12px 0 auto; }
.focus-shell .top-actions { margin-left: 0; }
.authenticated-shell.focus-shell.focus-wide .page-shell { max-width: 980px; }
