:root {
    --shell-header: 64px; --shell-nav: 0px; --shell-border: #e4e8ef;
    --shell-text: #263349; --shell-muted: #738197; --shell-accent: #255ee8; --shell-surface: #fff;
}
.app-shell { padding-top: calc(var(--shell-header) + var(--shell-nav)); height: 100dvh; }
.app-content { min-width: 0; width: 100%; background: #f6f8fc; }
.workspace-switcher {
    position: fixed; inset: 0 0 auto; z-index: 65; height: var(--shell-header); padding: 0 32px !important;
    display: flex; align-items: center; justify-content: flex-end; gap: 24px;
    background: var(--shell-surface); border-bottom: 1px solid var(--shell-border);
}
.workspace-switcher a {
    position: relative; display: flex; align-items: center; gap: 10px; height: var(--shell-header);
    padding: 0 20px; border-radius: 0; font-size: 17px; font-weight: 600; color: var(--shell-muted);
    background: transparent; box-shadow: none; --tw-ring-shadow: 0 0 transparent;
}
.workspace-switcher a::before { font-family: 'Font Awesome 6 Free'; font-weight: 900; font-size: 16px; }
.workspace-switcher a[href='/']::before { content: '\f201'; }
.workspace-switcher a[href^='/groceries']::before { content: '\f291'; }
.workspace-switcher a.shadow-sm { color: var(--shell-accent); }
.workspace-switcher a.shadow-sm::after { content: ''; position: absolute; bottom: 0; left: 20px; right: 20px; height: 3px; border-radius: 3px 3px 0 0; background: currentColor; }
.workspace-switcher a[href^='/groceries'].shadow-sm { color: #008568; }
.workspace-switcher a:hover { color: var(--shell-text); background: #f7f9fc; }
.workspace-switcher .sidebar-footer { position: static; margin: 0; width: auto; padding: 0; display: flex; align-items: center; gap: 16px; border: 0; background: transparent; }
.workspace-switcher .sidebar-footer > div { margin: 0; min-width: 148px; padding-right: 20px; border-right: 1px solid var(--shell-border); }
.workspace-switcher .sidebar-footer > div > div { display: flex; flex-direction: row; gap: 12px; justify-content: space-between; }
.workspace-switcher .sidebar-footer > div > div:first-child { font-size: 10px; }
#versionDate { white-space: nowrap; }
.workspace-switcher .sidebar-footer > button { width: auto; margin: 0; padding: 8px 12px; display: flex; align-items: center; border-radius: 6px; font-size: 12px; font-weight: 500; background: transparent; color: var(--shell-text); }
.workspace-switcher .sidebar-footer > button:hover { background: #f0f3f8; }
.workspace-switcher .sidebar-footer > button:last-child { color: #b53b4e; }
#sidebar {
    position: fixed; left: 0; right: auto; top: 0; z-index: 66;
    width: calc(100% - 285px); height: var(--shell-header); flex: none; transform: none; padding: 0; overflow: visible;
    box-shadow: 0 3px 8px #1a315008; background: var(--shell-surface); border-bottom: 1px solid var(--shell-border);
}
#sidebar .sidebar-nav { flex: none; overflow: visible; padding: 0; margin: 0; visibility: hidden; }
#sidebar.navigation-ready .sidebar-nav { visibility: visible; }
#sidebar > .sidebar-footer { display: none; }
.section-index { height: var(--shell-header); display: flex; align-items: stretch; gap: 0; padding: 0 20px; }
.section-selector { position: relative; display: flex; align-items: center; justify-content: center; gap: 7px; padding: 0 10px; border: 0; border-radius: 0; margin: 0; white-space: nowrap; color: #52617a; font-size: 12px; font-weight: 500; line-height: 1.5; }
.section-selector > i:first-child { font-size: 13px; color: #8391a6; }
.section-chevron { font-size: 8px; opacity: .65; transition: transform .15s; }
.section-selector.selected { color: var(--shell-accent); font-weight: 600; }
.section-selector.selected::after { position: absolute; content: ''; bottom: 0; left: 16px; right: 16px; height: 2px; background: var(--shell-accent); }
.section-selector.selected > i:first-child { color: var(--shell-accent); }
.section-selector:hover, .section-selector[aria-expanded='true'] { background: #f2f5fb; color: var(--shell-accent); }
.section-selector[aria-expanded='true'] .section-chevron { transform: rotate(180deg); }
.section-selector:focus-visible, .workspace-switcher button:focus-visible, #sidebar a:focus-visible { outline: 2px solid var(--shell-accent); outline-offset: -2px; }
#sidebar .section-links {
    position: fixed; left: var(--panel-left, 32px); top: calc(var(--shell-header) + var(--shell-nav) + 8px);
    width: var(--panel-width, 640px); margin: 0; padding: 20px;
    max-height: calc(100dvh - var(--shell-header) - var(--shell-nav) - 32px);
    overflow-y: auto; border: 1px solid var(--shell-border); border-radius: 8px;
    background: var(--shell-surface); box-shadow: 0 16px 48px #18304c26, 0 2px 8px #18304c0a;
}
#sidebar .section-links[hidden] { display: none; }
#sidebar .section-links h2 { padding: 0 10px 14px; color: var(--shell-muted); font-size: 11px; font-weight: 600; letter-spacing: 0; }
#sidebar .section-links > div { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px 12px; margin: 0; }
#sidebar .section-links a { display: flex; align-items: center; min-width: 0; margin: 0; padding: 12px 10px; border-radius: 6px; color: var(--shell-text); font-size: 14px; font-weight: 500; line-height: 1.5; }
#sidebar .section-links a > i { display: flex; align-items: center; justify-content: center; width: 36px; height: 36px; margin-right: 12px; flex-shrink: 0; background: #f2f5fb; border-radius: 6px; color: #587399; }
#sidebar .section-links a:hover { background: #f4f7fc; color: var(--shell-accent); }
#sidebar .section-links a.current-page { background: #edf3ff; color: var(--shell-accent); }
#sidebar .nav-label { overflow-wrap: anywhere; }
#sidebar .grocery-nav-link { display: flex; align-items: center; gap: 9px; margin: 0; color: #52617a; }
#sidebar .grocery-section > div > div { grid-column: 1 / -1; color: var(--shell-muted); padding: 12px 10px 4px; font-size: 11px; letter-spacing: 0; }
#sidebar .grocery-nav-link i { color: #008568; }
#sidebar .grocery-nav-link.current-page { color: #008568; background: #f0faf6; box-shadow: inset 0 -2px #008568; }
#sidebar .grocery-nav-link:hover { background: #f0faf6; }
.grocery-navigation .sidebar-nav > div:first-child { display: flex; align-items: center; padding: 0 32px; gap: 2px; }
.grocery-navigation .sidebar-nav > div:first-child > div { padding: 0; margin: 0 8px; width: 1px; height: 20px; background: var(--shell-border); color: transparent; overflow: hidden; }
.dark { --shell-border: #363d48; --shell-text: #e1e6ef; --shell-muted: #a2adc0; --shell-accent: #96b8ff; --shell-surface: #242a34; }
.dark .workspace-switcher a, .dark .section-selector, .dark #sidebar .grocery-nav-link { color: var(--shell-muted); }
.dark .workspace-switcher a.shadow-sm, .dark .section-selector.selected { color: var(--shell-accent); }
.dark .workspace-switcher a:hover, .dark .workspace-switcher .sidebar-footer > button:hover, .dark .section-selector:hover, .dark .section-selector[aria-expanded='true'] { background: #303a4a; }
.dark #sidebar nav a:hover, .dark #sidebar nav a.current-page { background: #303a4a !important; color: #b4cbff !important; }
.dark #sidebar .section-links a > i { background: #303a4a; color: #b4cbff !important; }
.dark .workspace-switcher .sidebar-footer > button:last-child { color: #ffafb9; }
.dark .app-content { background: #1d232c; }
.tax-planner-page #overviewCards { grid-template-columns: repeat(auto-fit, minmax(min(170px, 100%), 1fr)); }
.tax-planner-page #overviewCards > div { min-width: 0; }
.tax-navigation { margin-bottom: 20px; }
.tax-controls { align-items: center; justify-content: flex-end; }
@media (min-width: 1281px) and (max-width: 1700px) {
    .section-index { gap: 0; padding: 0 16px; }
    .section-selector { padding: 0 8px; gap: 6px; font-size: 12px; }
}
@media (min-width: 1281px) and (max-width: 1500px) {
    .section-selector > i:first-child { display: none; }
    .section-selector { font-size: 11px; }
}
@media (max-width: 1280px) {
    .app-shell { padding-top: var(--shell-header); height: 100dvh; min-height: 0; }
    .workspace-switcher { padding: 0 12px 0 60px !important; gap: 8px; }
    .workspace-switcher a { padding: 0 12px; font-size: 15px; }
    .workspace-switcher .sidebar-footer { gap: 8px; }
    .workspace-switcher .sidebar-footer > div { min-width: 148px; }
    .workspace-switcher .sidebar-footer > button { height: 36px; padding: 0 8px; justify-content: center; }
    .workspace-switcher .sidebar-footer > button i { font-size: 14px; margin: 0; }
    #sidebar { top: var(--shell-header); right: auto; width: min(420px, 100vw); height: calc(100dvh - var(--shell-header)); overflow-y: auto; transform: translateX(-110%); box-shadow: 8px 0 40px #162e4c24; border-right: 1px solid var(--shell-border); }
    #sidebar.open { transform: translateX(0); }
    #sidebar .sidebar-nav { min-height: 100%; }
    .section-index { height: auto; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; padding: 16px; }
    .section-selector { justify-content: flex-start; white-space: normal; text-align: left; height: 64px; padding: 10px; border: 1px solid var(--shell-border); border-radius: 6px; font-size: 12px; }
    .section-selector span { flex: 1; }
    .section-selector.selected::after { display: none; }
    .section-selector.selected { background: #edf3ff; border-color: #cbdafa; }
    #sidebar .section-links { position: static; width: auto; margin: 0 16px 16px; border-radius: 0; border-width: 1px 0 0; padding: 20px 0; max-height: none; box-shadow: none; overflow: visible; }
    #sidebar .section-links > div { grid-template-columns: 1fr; }
    #sidebar .section-links h2 { padding-left: 10px; }
    .app-content { margin: 0; overflow-y: auto; padding: 0 12px 24px; flex: 1; }
    .mobile-sidebar-toggle { display: flex; top: 12px; left: 12px; height: 40px; width: 36px; border-radius: 6px; box-shadow: none; z-index: 70; background: #f0f4fb; color: #52617a; }
    .sidebar-overlay.active { z-index: 64; }
    .grocery-navigation .sidebar-nav > div:first-child { flex-direction: column; align-items: stretch; padding: 16px; gap: 4px; }
    #sidebar .grocery-nav-link { border-radius: 6px; }
    .grocery-navigation .sidebar-nav > div:first-child > div { width: auto; height: auto; margin: 16px 12px 4px; background: none; color: var(--shell-muted); }
    .dark .mobile-sidebar-toggle { background: #303a4a; color: #ced7e7; }
    .dark .section-selector.selected { background: #303a4a; border-color: #43516a; }
}
@media (max-width: 480px) {
    .workspace-switcher a { font-size: 13px; gap: 6px; padding: 0 8px; }
    .workspace-switcher .sidebar-footer { gap: 0; }
    .workspace-switcher .sidebar-footer > div { min-width: 130px; padding-right: 10px; }
}
