/* ==================== APP CONTAINER ==================== */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* ==================== SIDEBAR - macOS Sequoia Floating Panel ==================== */
.sidebar {
    position: fixed;
    top: 12px;
    left: 12px;
    width: var(--sidebar-width);
    height: calc(100vh - 24px);
    background: rgba(255, 255, 255, 0.82);
    backdrop-filter: blur(60px) saturate(180%);
    -webkit-backdrop-filter: blur(60px) saturate(180%);
    border: 0.5px solid rgba(0, 0, 0, 0.05);
    border-radius: 20px;
    corner-shape: squircle;
    box-shadow: 
        0 0 0 0.5px rgba(0, 0, 0, 0.04),
        0 4px 20px rgba(0, 0, 0, 0.07),
        0 16px 48px -8px rgba(0, 0, 0, 0.10);
    display: flex;
    flex-direction: column;
    z-index: 100;
    transition: width var(--duration-slow) var(--ease-out-expo),
                border-radius var(--duration-normal) var(--ease-default);
    overflow: visible;
}

.sidebar.collapsed {
    width: var(--sidebar-collapsed);
}

.sidebar-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    padding: 16px 14px 8px;
    position: relative;
}

/* ── Sidebar Personal Hero ── */
.sidebar-hero {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    padding: 8px 0 4px;
    overflow: visible;
}

.sidebar-hero-avatar {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(145deg, #1a1a1a, #333);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    cursor: pointer;
    margin-bottom: 14px;
    position: relative;
    box-shadow: 0 2px 8px rgba(0,0,0,0.12);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    flex-shrink: 0;
}

.sidebar-hero-avatar:hover {
    transform: scale(1.04);
    box-shadow: 0 4px 16px rgba(0,0,0,0.18);
}

.sidebar-hero-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.sidebar-hero-avatar-fallback {
    font-size: 28px;
    color: rgba(255,255,255,0.7);
}

.sidebar-hero-avatar.has-photo .sidebar-hero-avatar-fallback {
    display: none;
}

.sidebar-hero-hello {
    font-family: var(--font-sf);
    font-size: 22px;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text-primary);
    margin: 0 0 2px;
    line-height: 1.15;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-hero-sub {
    font-family: var(--font-sf);
    font-size: 14px;
    font-weight: 400;
    color: var(--text-tertiary);
    margin: 0;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
}

/* Collapsed sidebar state */
.sidebar.collapsed .sidebar-hero-hello,
.sidebar.collapsed .sidebar-hero-sub {
    display: none;
}

.sidebar.collapsed .sidebar-hero {
    align-items: center;
}

.sidebar.collapsed .sidebar-hero-avatar {
    width: 36px;
    height: 36px;
    margin-bottom: 8px;
}

.sidebar.collapsed .sidebar-header {
    padding: 16px 0 10px;
    align-items: center;
    justify-content: center;
}

.sidebar.collapsed .sidebar-toggle {
    position: absolute;
    right: -14px;
    top: 28px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: rgba(255,255,255,0.95);
    box-shadow: 0 1px 4px rgba(0,0,0,0.12);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    z-index: 101;
}

.sidebar.collapsed:hover .sidebar-toggle {
    opacity: 1;
    pointer-events: auto;
}

.sidebar-toggle {
    width: 28px;
    height: 28px;
    border: none;
    background: rgba(0, 0, 0, 0.05);
    border-radius: var(--radius-sm);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-tertiary);
    transition: all var(--duration-fast) var(--ease-default);
    flex-shrink: 0;
}

.sidebar-toggle:hover {
    background: rgba(0, 0, 0, 0.08);
    color: var(--text-secondary);
}

.sidebar-toggle i {
    transition: transform var(--duration-normal) var(--ease-default);
}

.sidebar.collapsed .sidebar-toggle i {
    transform: rotate(180deg);
}

.sidebar-nav {
    flex: 1;
    padding: 4px 8px;
    display: flex;
    flex-direction: column;
    gap: 1px;
    overflow-y: auto;
    overflow-x: clip;
    /* Custom scrollbar — Firefox */
    scrollbar-width: thin;
    scrollbar-color: transparent transparent;
}
/* Custom scrollbar — Webkit */
.sidebar-nav::-webkit-scrollbar {
    width: 6px;
}
.sidebar-nav::-webkit-scrollbar-track {
    background: transparent;
}
.sidebar-nav::-webkit-scrollbar-thumb {
    background: rgba(0,0,0,0.0);
    border-radius: 999px;
    border: 1px solid transparent;
    background-clip: content-box;
    transition: background 0.3s ease;
}
/* Show scrollbar on hover / scroll */
.sidebar-nav:hover::-webkit-scrollbar-thumb {
    background: rgba(0,0,0,0.1);
    border: 1px solid transparent;
    background-clip: content-box;
}
.sidebar-nav:hover::-webkit-scrollbar-thumb:hover {
    background: rgba(0,0,0,0.22);
    border: 1px solid transparent;
    background-clip: content-box;
}
.sidebar-nav:hover {
    scrollbar-color: rgba(0,0,0,0.12) transparent;
}

.sidebar-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 7px 10px;
    border: none;
    background: transparent;
    border-radius: 10px;
    corner-shape: squircle;
    cursor: pointer;
    font-family: var(--font-system);
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
    transition: background 0.15s ease, color 0.15s ease;
    white-space: nowrap;
    overflow: visible;
    box-sizing: border-box;
    min-height: 34px;
    text-align: left;
    text-decoration: none;
}

.sidebar-item i,
.sidebar-item > .material-symbols-outlined {
    font-size: 18px;
    color: var(--text-tertiary);
    font-variation-settings: 'FILL' 0;
    flex-shrink: 0;
    transition: color 0.15s ease;
    background: none !important;
    -webkit-background-clip: unset !important;
    -webkit-text-fill-color: unset !important;
    filter: none;
}

.sidebar-item.active > .material-symbols-outlined,
.sidebar-item.active i {
    color: var(--sidebar-active-color, var(--apple-blue));
}

.sidebar-item:hover {
    background: rgba(0, 0, 0, 0.03);
}

.sidebar-item.active {
    background: var(--sidebar-active-bg, rgba(0, 122, 255, 0.1));
    color: var(--sidebar-active-color, var(--apple-blue));
    font-weight: 600;
}

.sidebar-item:active {
    transform: scale(0.97);
    transition: transform 80ms var(--ease-spring);
}

.sidebar-item-muted {
    opacity: 0.65;
}
.sidebar-item-muted:hover { opacity: 0.85; }

/* ==================== NAV REORDER — Long-Press Drag (No Visible Handles) ==================== */

/* Sidebar items need relative positioning */
.sidebar-item:not(.sidebar-item-pinned) {
    position: relative;
    touch-action: none; /* required for pointer capture on touch */
}

/* --- Long-press drag states --- */

/* The item being dragged: placeholder left behind */
.sidebar-item.nav-dragging {
    opacity: 0.15;
    background: rgba(0,122,255,0.04);
    border-radius: 8px;
    pointer-events: none;
}
.sidebar-section.nav-dragging {
    opacity: 0.12;
    pointer-events: none;
}

/* Siblings dim while reordering */
.sidebar-nav.nav-reorder-active .sidebar-item:not(.nav-dragging),
.sidebar-nav.nav-reorder-active .sidebar-section:not(.nav-dragging) {
    opacity: 0.85;
    transition: opacity 0.15s ease, transform 0.18s cubic-bezier(0.4,0,0.2,1);
}
.sidebar-nav.nav-reorder-active .sidebar-item.nav-dragging,
.sidebar-nav.nav-reorder-active .sidebar-section.nav-dragging {
    transition: none;
}

/* Lift pulse: applied briefly on long-press trigger */
@keyframes navLiftPulse {
    0% { transform: scale(1); }
    40% { transform: scale(1.015); }
    100% { transform: scale(1); }
}

/* Drag ghost overlay (floating card) */
.nav-drag-ghost {
    position: fixed;
    pointer-events: none;
    z-index: 9999;
    background: rgba(255,255,255,0.97);
    backdrop-filter: blur(24px) saturate(180%);
    -webkit-backdrop-filter: blur(24px) saturate(180%);
    border-radius: 8px;
    border: 0.5px solid rgba(0,0,0,0.06);
    box-shadow:
        0 0 0 0.5px rgba(0,0,0,0.03),
        0 4px 12px rgba(0,0,0,0.08),
        0 12px 36px -4px rgba(0,0,0,0.14);
    padding: 7px 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: var(--font-system);
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    transform: scale(1.02);
    white-space: nowrap;
    max-width: 220px;
    overflow: hidden;
    animation: navLiftPulse 0.25s cubic-bezier(0.4,0,0.2,1);
}
.nav-drag-ghost .material-symbols-outlined {
    font-size: 17px;
    flex-shrink: 0;
}
.nav-drag-ghost.section-ghost {
    background: rgba(248,248,250,0.97);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-tertiary);
    padding: 8px 14px;
    border-radius: 8px;
}

/* Insertion indicator line */
.nav-insert-line {
    position: absolute;
    left: 8px;
    right: 8px;
    height: 2px;
    background: var(--system-blue);
    border-radius: 1px;
    pointer-events: none;
    z-index: 50;
    box-shadow: 0 0 8px rgba(0,122,255,0.35);
    transition: top 0.12s cubic-bezier(0.4,0,0.2,1);
}
.nav-insert-line::before {
    content: '';
    position: absolute;
    left: -3px;
    top: -3px;
    width: 8px;
    height: 8px;
    background: var(--system-blue);
    border-radius: 50%;
}

/* Push/shift animation for items during drag */
.sidebar-item.nav-shift-down {
    transform: translateY(6px);
    transition: transform 0.18s cubic-bezier(0.4,0,0.2,1);
}
.sidebar-item.nav-shift-up {
    transform: translateY(-6px);
    transition: transform 0.18s cubic-bezier(0.4,0,0.2,1);
}
.sidebar-section.nav-shift-down {
    transform: translateY(8px);
    transition: transform 0.18s cubic-bezier(0.4,0,0.2,1);
}

/* Drop settle animation */
.sidebar-item.nav-settling,
.sidebar-section.nav-settling {
    transition: transform 0.25s cubic-bezier(0.4,0,0.2,1), opacity 0.25s ease;
}

/* ==================== SIDEBAR SECTIONS (Wrappers + Collapsible) ==================== */
.sidebar-section {
    position: relative;
    width: 100%;
    margin-bottom: 16px;
}

/* Separator line above each section (Finder-style) */
.sidebar-section::before {
    content: '';
    display: block;
    height: 0.5px;
    background: rgba(0,0,0,0.07);
    margin: 6px 12px 0;
}
/* No separator above the first section */
.sidebar-nav > .sidebar-section:first-of-type::before,
.sidebar-item-home + .sidebar-section::before {
    display: none;
}

/* Sidebar Section Labels — <button> for accessibility */
.sidebar-section-label {
    display: flex;
    align-items: center;
    gap: 4px;
    width: 100%;
    border: none;
    background: transparent;
    font-family: var(--font-sf);
    font-size: 11px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-tertiary);
    padding: 6px 10px 4px;
    height: auto;
    margin-top: 2px;
    opacity: 1;
    line-height: 1;
    white-space: nowrap;
    overflow: hidden;
    cursor: pointer;
    position: relative;
    border-radius: 6px;
    transition: opacity 0.12s ease, background 0.12s ease;
    text-align: left;
    touch-action: none;
}
.sidebar-section-label:hover {
    opacity: 0.9;
    background: rgba(0,0,0,0.025);
}
.sidebar-section-label:focus-visible {
    outline: 2px solid var(--system-blue);
    outline-offset: -2px;
}

.sidebar-section-text { flex: 1; }

/* Chevron: always visible, left of text, same column as nav icons */
.sidebar-section-chevron {
    font-size: 15px;
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: transform 0.18s cubic-bezier(0.4,0,0.2,1);
    color: inherit;
    opacity: 0.65;
}

/* Collapsed state */
.sidebar-section.collapsed .sidebar-section-chevron {
    transform: rotate(-90deg);
}
.sidebar-section.collapsed .sidebar-section-items {
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    pointer-events: none;
}
.sidebar-section-items {
    max-height: 600px;
    opacity: 1;
    overflow: visible;
    transition: max-height 0.22s cubic-bezier(0.4,0,0.2,1), opacity 0.18s ease;
    padding-bottom: 1px;
}
.sidebar-section.collapsed .sidebar-section-label[aria-expanded="false"] ~ .sidebar-section-items {
    max-height: 0;
}

/* Collapsed sidebar (icon-only) — override section collapse */
.sidebar.collapsed .sidebar-section.collapsed .sidebar-section-items {
    max-height: 600px;
    opacity: 1;
    pointer-events: auto;
}
.sidebar.collapsed .sidebar-section-label {
    font-size: 0;
    padding: var(--space-xs);
    border-bottom: 0.5px solid rgba(0,0,0,0.05);
    margin: 0 var(--space-md);
}
.sidebar.collapsed .sidebar-section-chevron {
    display: none;
}

/* In collapsed mode, keep icon colors visible */
.sidebar.collapsed .sidebar-item > .material-symbols-outlined,
.sidebar.collapsed .sidebar-item i {
    color: var(--text-tertiary);
}
.sidebar.collapsed .sidebar-item.active > .material-symbols-outlined,
.sidebar.collapsed .sidebar-item.active i {
    filter: grayscale(0) opacity(1);
}

.sidebar.collapsed .sidebar-item {
    justify-content: center;
    padding: var(--space-md);
}

.sidebar.collapsed .sidebar-label {
    display: none;
}

.sidebar-footer {
    padding: 8px 8px 6px;
    border-top: 0.5px solid rgba(0,0,0,0.06);
}

.sidebar-logout {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 7px 10px;
    border: none;
    background: transparent;
    border-radius: 8px;
    cursor: pointer;
    font-family: var(--font-system);
    font-size: 13px;
    font-weight: 500;
    color: var(--text-tertiary);
    transition: all var(--duration-fast) var(--ease-default);
    text-align: left;
}

.sidebar-logout .material-symbols-outlined {
    font-size: 18px;
    flex-shrink: 0;
}

.sidebar-logout:hover {
    background: rgba(255,59,48,0.06);
    color: var(--system-red);
}

.sidebar-version {
    display: block;
    text-align: center;
    font-size: 10px;
    color: var(--text-quaternary);
    letter-spacing: 0.04em;
    padding-top: var(--space-xs);
}

.sidebar.collapsed .sidebar-logout .sidebar-label {
    display: none;
}

.sidebar.collapsed .sidebar-logout {
    justify-content: center;
    padding: var(--space-sm);
}

.sidebar.collapsed .sidebar-version {
    display: none;
}

/* ==================== MAIN WRAPPER ==================== */
.main-wrapper {
    flex: 1;
    margin-left: calc(var(--sidebar-width) + 24px);
    padding: 12px 12px 12px 0;
    position: relative;
    min-height: 100vh;
    transition: margin-left var(--duration-normal) var(--ease-default);
}

.sidebar.collapsed ~ .main-wrapper {
    margin-left: calc(var(--sidebar-collapsed) + 24px);
}

/* macOS Desktop Wallpaper — full-bleed ambient photograph */
.wallpaper {
    position: fixed;
    top: 0;
    left: calc(var(--sidebar-width) + 24px);
    right: 0;
    bottom: 0;
    z-index: -2;
    overflow: hidden;
    background: var(--bg-base);
}
.sidebar.collapsed ~ .main-wrapper .wallpaper {
    left: calc(var(--sidebar-collapsed) + 24px);
}
.wallpaper-photo {
    position: absolute;
    inset: -20px;
    background-size: cover;
    background-position: center;
    filter: saturate(0.7) brightness(1.1);
    will-change: transform;
    animation: wallpaperDrift 60s ease-in-out infinite alternate;
}
.wallpaper-scrim {
    position: absolute;
    inset: 0;
    background: linear-gradient(
        180deg,
        rgba(242, 242, 247, 0.55) 0%,
        rgba(242, 242, 247, 0.65) 40%,
        rgba(242, 242, 247, 0.75) 100%
    );
}
@keyframes wallpaperDrift {
    0%   { transform: translate(0, 0) scale(1); }
    100% { transform: translate(-10px, -5px) scale(1.04); }
}

/* Living gradient mesh — subtle animated color wash on top of wallpaper */
.main-wrapper::before {
    content: '';
    position: fixed;
    top: 0;
    left: calc(var(--sidebar-width) + 24px);
    right: 0;
    bottom: 0;
    z-index: -1;
    background:
        radial-gradient(ellipse 700px 700px at 25% 15%, rgba(52,199,89,0.035), transparent),
        radial-gradient(ellipse 600px 600px at 75% 35%, rgba(0,122,255,0.03), transparent),
        radial-gradient(ellipse 500px 500px at 60% 80%, rgba(175,82,222,0.02), transparent),
        radial-gradient(ellipse 400px 400px at 15% 70%, rgba(90,200,250,0.025), transparent);
    animation: meshDrift 30s ease-in-out infinite alternate;
    pointer-events: none;
}
.sidebar.collapsed ~ .main-wrapper::before {
    left: calc(var(--sidebar-collapsed) + 24px);
}
@keyframes meshDrift {
    0%   { transform: translate(0, 0) scale(1); }
    50%  { transform: translate(12px, -8px) scale(1.015); }
    100% { transform: translate(-8px, 6px) scale(0.985); }
}

/* ═══════════════════════════════════════════════════
   SECTION BAR — Apple News-style color header
   Full-width background that bleeds behind sidebar
   ═══════════════════════════════════════════════════ */

.section-bar {
    position: relative;
    margin: -12px -24px 24px -24px;
    padding: 0;
    overflow: visible;
    min-height: 156px;
}

/* The color background — full viewport width, body has overflow-x: clip */
.section-bar-bg {
    position: absolute;
    top: 0;
    height: 100%;
    z-index: 0;
    left: calc(-1 * (var(--sidebar-width) + 48px));
    width: 100vw;
    transition: background-color 0.3s ease;
}
.sidebar.collapsed ~ .main-wrapper .section-bar-bg {
    left: calc(-1 * (var(--sidebar-collapsed) + 48px));
}
.sidebar.collapsed ~ .main-wrapper .section-bar-photo {
    left: calc(-1 * (var(--sidebar-collapsed) + 48px));
}
.sidebar.collapsed ~ .main-wrapper .section-bar-photo-scrim {
    left: calc(-1 * (var(--sidebar-collapsed) + 48px));
}

/* Content sits on top of the color */
.section-bar-content {
    position: relative;
    z-index: 1;
    padding: 28px 0 24px 24px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: inherit;
}

.section-bar-eyebrow {
    display: flex;
    align-items: center;
    gap: 6px;
    font-family: var(--font-sf);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: rgba(255,255,255,0.7);
    margin-bottom: 6px;
}
.section-bar-eyebrow .material-symbols-outlined {
    font-size: 14px;
    font-variation-settings: 'FILL' 1;
}

.section-bar-title {
    font-family: var(--font-sf);
    font-size: 34px;
    font-weight: 800;
    letter-spacing: -0.03em;
    line-height: 1.05;
    color: #fff;
    margin: 0;
}

.section-bar-sub {
    font-family: var(--font-sf);
    font-size: 14px;
    font-weight: 500;
    color: rgba(255,255,255,0.6);
    margin-top: 3px;
}

/* ── Section Bar Row (title + actions) ── */
.section-bar-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    position: relative;
}
.section-bar-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}
.section-bar-btn {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 7px 14px;
    border: 1.5px solid rgba(255,255,255,0.3);
    border-radius: 10px;
    corner-shape: squircle;
    background: rgba(255,255,255,0.15);
    color: #fff;
    font-family: var(--font-sf);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}
.section-bar-btn:hover { background: rgba(255,255,255,0.25); }
.section-bar-btn:active { transform: scale(0.96); }
.section-bar-btn .material-symbols-outlined { font-size: 16px; }

/* ── Section Colors ── */
.section-bar[data-section="money"] .section-bar-bg,
.section-bar[data-section="income"] .section-bar-bg,
.section-bar[data-section="bills"] .section-bar-bg,
.section-bar[data-section="debt"] .section-bar-bg,
.section-bar[data-section="taxes"] .section-bar-bg,
.section-bar[data-section="transactions"] .section-bar-bg {
    background: linear-gradient(135deg, #248A3D 0%, #34C759 100%);
}
.section-bar[data-section="calendar"] .section-bar-bg {
    background: linear-gradient(135deg, #0051A8 0%, #007AFF 100%);
}
.section-bar[data-section="planned"] .section-bar-bg,
.section-bar[data-section="goals"] .section-bar-bg,
.section-bar[data-section="scenarios"] .section-bar-bg {
    background: linear-gradient(135deg, #5856D6 0%, #7375E6 100%);
}
.section-bar[data-section="family"] .section-bar-bg,
.section-bar[data-section="pets"] .section-bar-bg,
.section-bar[data-section="medical"] .section-bar-bg,
.section-bar[data-section="vehicles"] .section-bar-bg,
.section-bar[data-section="maintenance"] .section-bar-bg,
.section-bar[data-section="accounts"] .section-bar-bg,
.section-bar[data-section="emergency"] .section-bar-bg {
    background: linear-gradient(135deg, #C77800 0%, #FF9500 100%);
}
.section-bar[data-section="biz-ptuc"] .section-bar-bg,
.section-bar[data-section="biz-jwd"] .section-bar-bg {
    background: linear-gradient(135deg, #8E44AD 0%, #AF52DE 100%);
}
.section-bar[data-section="settings"] .section-bar-bg,
.section-bar[data-section="releasenotes"] .section-bar-bg,
.section-bar[data-section="ideas"] .section-bar-bg {
    background: linear-gradient(135deg, #48484A 0%, #636366 100%);
}

/* ═══ Sky Variant (Home Hub) ═══ */
.section-bar--sky {
    min-height: 156px;
}

.section-bar--sky .section-bar-bg {
    /* JS sets the gradient via renderHomeSky() */
    transition: background 2s ease;
}

.sky-stars {
    position: absolute;
    top: 0;
    left: calc(-1 * (var(--sidebar-width) + 48px));
    width: 100vw;
    height: 100%;
    z-index: 1;
    pointer-events: none;
    opacity: 0.9;
    display: none;
}
.sidebar.collapsed ~ .main-wrapper .sky-stars {
    left: calc(-1 * (var(--sidebar-collapsed) + 48px));
}

.sky-orb {
    position: absolute;
    z-index: 1;
    border-radius: 50%;
    filter: blur(24px);
    pointer-events: none;
    display: none;
    animation: skyOrbPulse 8s ease-in-out infinite;
}

@keyframes skyOrbPulse {
    0%, 100% { opacity: 0.85; transform: translateX(-50%) scale(1); }
    50% { opacity: 1; transform: translateX(-50%) scale(1.06); }
}

/* Ensure content sits above sky layers */
.section-bar--sky .section-bar-content {
    position: relative;
    z-index: 2;
}

/* ── Photo Hero Variant ── */
.section-bar--photo {
    min-height: 184px;
}
.section-bar-photo {
    position: absolute;
    top: 0;
    left: calc(-1 * (var(--sidebar-width) + 48px));
    width: 100vw;
    height: 100%;
    object-fit: cover;
    object-position: center 40%;
    z-index: 1;
}
.section-bar-photo-scrim {
    position: absolute;
    top: 0;
    left: calc(-1 * (var(--sidebar-width) + 48px));
    width: 100vw;
    height: 100%;
    z-index: 2;
    background: linear-gradient(
        to top,
        rgba(0,0,0,0.55) 0%,
        rgba(0,0,0,0.25) 40%,
        rgba(0,0,0,0.10) 100%
    );
}
.section-bar--photo .section-bar-content {
    z-index: 3;
    padding: 28px 0 24px 24px;
}
.section-bar-photo.error {
    display: none;
}

/* ── Insight Pill (inside section bar) ── */
.section-bar-insight {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: 100px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.01em;
    line-height: 1;
    background: rgba(255,255,255,0.18);
    color: rgba(255,255,255,0.85);
    margin-top: 10px;
    white-space: nowrap;
}
.section-bar-insight:empty {
    display: none;
}
.section-bar-insight .material-symbols-outlined {
    font-size: 14px;
    line-height: 1;
    display: flex;
    align-items: center;
}

/* ── Navigation controls inside section bar — white-on-color overrides ── */
.section-bar .cal-nav-btn,
.section-bar .mo-nav-arrow {
    background: rgba(255,255,255,0.2);
    color: white;
    border: none;
}
.section-bar .cal-nav-btn:hover,
.section-bar .mo-nav-arrow:hover {
    background: rgba(255,255,255,0.35);
}
.section-bar .cal-month-label,
.section-bar .mo-nav-label {
    color: white;
    font-weight: 700;
}
.section-bar .doc-editorial-stats {
    display: flex;
    gap: 8px;
}

/* ── Section Bar Responsive ── */
@media (max-width: 768px) {
    .section-bar {
        margin: -12px -12px 20px -12px;
        min-height: 120px;
    }
    .section-bar-bg {
        left: 0;
        width: 100vw;
    }
    .section-bar-title { font-size: 28px; }
    .section-bar-content { padding: 20px 16px 18px; }
    .section-bar-row { flex-direction: column; align-items: flex-start; gap: 12px; }
    .section-bar-photo {
        left: 0;
        width: 100vw;
    }
    .section-bar-photo-scrim {
        left: 0;
        width: 100vw;
    }
    .section-bar--photo .section-bar-content {
        padding: 20px 16px 18px;
    }
    .sky-stars,
    .sky-orb {
        left: 0;
        width: 100vw;
    }
}

/* ==================== HOUSEHOLD PLACEHOLDER PAGES ==================== */
.household-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 340px;
    padding: 40px 24px;
}
.household-placeholder-inner {
    text-align: center;
    max-width: 380px;
}
.household-placeholder-icon {
    font-size: 48px;
    margin-bottom: 20px;
    opacity: 0.25;
}
.household-placeholder-title {
    font-size: 18px;
    font-weight: 660;
    font-family: var(--font-display);
    color: var(--text-primary);
    margin: 0 0 8px;
    letter-spacing: -0.02em;
}
.household-placeholder-desc {
    font-size: 14px;
    font-weight: 450;
    color: var(--text-secondary);
    line-height: 1.55;
    margin: 0;
}

/* ==================== SIDEBAR HOME BUTTON ==================== */
.sidebar-item-home {
    margin-bottom: 4px;
    position: relative;
}
/* Home icon always colored — it's the fixed landmark */
.sidebar-item-home > .material-symbols-outlined,
.sidebar-item-home i {
    filter: grayscale(0) opacity(0.85) !important;
}
.sidebar-item-home.active > .material-symbols-outlined,
.sidebar-item-home.active i {
    filter: grayscale(0) opacity(1) !important;
}
.sidebar-item-home::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 10px;
    right: 10px;
    height: 0.5px;
    background: var(--separator);
}
.sidebar.collapsed .sidebar-item-home::after {
    left: 8px;
    right: 8px;
}

/* ==================== MAIN CONTENT ==================== */
.main-content {
    flex: 1;
    max-width: 960px;
    margin: 0;
    padding: 0 24px 60px;
    overflow: visible; /* allow section-bar-bg to extend */
    position: relative; /* positioning context for overlay transitions */
}

.page {
    display: none;
    opacity: 0;
}

.page.active {
    display: block;
    opacity: 1; /* no page-level animation — children handle their own entrance */
}

/* ── Section bar → content spacing ── */
.page > .section-bar + * {
    margin-top: 20px;
}
#page-homehub > .section-bar + * {
    margin-top: 0; /* Home Hub has its own layout */
}

/* ════════════════════════════════════════
   CROSS-SECTION: Full dramatic transition
   Color bar leads in, content follows
   ════════════════════════════════════════ */

/* Section bar container — NO animation on the container itself.
   Only the bg and individual text children animate.
   This prevents compound opacity/transform double-fire. */
.page.active .section-bar {
    opacity: 1;
}

/* Color bar bg fades in quickly.
   fill-mode: backwards (not both) — applies 'from' during delay,
   but releases GPU compositing layer after completion to prevent
   blurry subpixel text rendering. */
.page.active .section-bar-bg {
    animation: sectionBgIn 0.25s ease backwards;
}

/* Text elements stagger in independently */
.page.active .section-bar-eyebrow {
    animation: sectionFadeIn 0.28s ease backwards;
    animation-delay: 0.06s;
}
.page.active .section-bar-title {
    animation: sectionFadeIn 0.28s ease backwards;
    animation-delay: 0.10s;
}
.page.active .section-bar-sub {
    animation: sectionFadeIn 0.28s ease backwards;
    animation-delay: 0.13s;
}
.page.active .section-bar-actions {
    animation: sectionFadeIn 0.28s ease backwards;
    animation-delay: 0.13s;
}

/* Sky hero elements (Home Hub) */
.page.active .sky-stars {
    animation: sectionBgIn 0.3s ease backwards;
}
.page.active .sky-orb {
    animation: sectionBgIn 0.3s ease backwards;
}

@keyframes sectionBgIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}
@keyframes sectionFadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* Content staggers in after the bar */
.page.active > *:not(.section-bar) {
    animation: cardIn 0.45s cubic-bezier(0.32, 0.72, 0, 1) backwards;
}

/* Stagger delays — content starts after bar animation */
.page.active > *:nth-child(2)  { animation-delay: 0.12s; }
.page.active > *:nth-child(3)  { animation-delay: 0.16s; }
.page.active > *:nth-child(4)  { animation-delay: 0.20s; }
.page.active > *:nth-child(5)  { animation-delay: 0.24s; }
.page.active > *:nth-child(6)  { animation-delay: 0.28s; }
.page.active > *:nth-child(7)  { animation-delay: 0.32s; }
.page.active > *:nth-child(8)  { animation-delay: 0.36s; }
.page.active > *:nth-child(9)  { animation-delay: 0.40s; }
.page.active > *:nth-child(10) { animation-delay: 0.44s; }

@keyframes cardIn {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* Cross-section exit — absolute overlay crossfade.
   Old page fades out on top while new page enters underneath.
   No individual element animations — entire page fades as a unit. */
.page.section-exit {
    display: block;
    pointer-events: none;
    position: absolute;
    top: 0;
    left: 24px;
    right: 24px;
    z-index: 10;
    animation: pageOverlayOut 0.3s ease-out both;
}
.page.section-exit .section-bar-eyebrow,
.page.section-exit .section-bar-title,
.page.section-exit .section-bar-sub,
.page.section-exit .section-bar-actions,
.page.section-exit .section-bar-bg,
.page.section-exit .sky-stars,
.page.section-exit .sky-orb,
.page.section-exit > *:not(.section-bar) {
    animation: none !important;
}

@keyframes pageOverlayOut {
    from { opacity: 1; }
    to   { opacity: 0; }
}
@keyframes sectionFadeOut {
    from { opacity: 1; transform: translateY(0); }
    to   { opacity: 0; transform: translateY(-6px); }
}
@keyframes sectionBarOut {
    from { opacity: 1; }
    to   { opacity: 0; }
}
@keyframes cardOut {
    from { opacity: 1; transform: translateY(0); }
    to   { opacity: 0; transform: translateY(-8px); }
}

/* Legacy exiting class (fallback for non-section pages like Home Hub) */
.page.exiting {
    display: block;
    opacity: 1;
    pointer-events: none;
    animation: pageExit 0.18s ease-out forwards;
}
@keyframes pageExit {
    from { opacity: 1; transform: translateY(0) scale(1); }
    to   { opacity: 0; transform: translateY(-6px) scale(0.995); }
}
.page.exiting > * {
    animation: cardOut 0.15s ease-out both;
}
.page.exiting > *:nth-child(1) { animation-delay: 0ms; }
.page.exiting > *:nth-child(2) { animation-delay: 15ms; }
.page.exiting > *:nth-child(3) { animation-delay: 30ms; }
.page.exiting > *:nth-child(4) { animation-delay: 45ms; }
.page.exiting > *:nth-child(5) { animation-delay: 60ms; }
.page.exiting > *:nth-child(6) { animation-delay: 75ms; }


/* ════════════════════════════════════════
   SAME-SECTION: Content-only cross-fade
   Header bar stays, content swaps
   ════════════════════════════════════════ */

/* Same-section enter: bar has NO animation */
.page.same-section-enter .section-bar,
.page.same-section-enter .section-bar-bg,
.page.same-section-enter .section-bar-eyebrow,
.page.same-section-enter .section-bar-title,
.page.same-section-enter .section-bar-sub,
.page.same-section-enter .section-bar-actions,
.page.same-section-enter .sky-stars,
.page.same-section-enter .sky-orb {
    animation: none !important;
    opacity: 1;
}

/* Only content below the bar animates */
.page.same-section-enter > *:not(.section-bar) {
    animation: contentSwapIn 0.25s ease backwards;
}
@keyframes contentSwapIn {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* Same-section exit: just fade content */
.page.content-exit {
    display: block;
    opacity: 1;
    pointer-events: none;
}
.page.content-exit .section-bar,
.page.content-exit .section-bar-bg,
.page.content-exit .section-bar-eyebrow,
.page.content-exit .section-bar-title,
.page.content-exit .section-bar-sub,
.page.content-exit .section-bar-actions,
.page.content-exit .sky-stars,
.page.content-exit .sky-orb {
    opacity: 1 !important;
    animation: none !important;
}
.page.content-exit > *:not(.section-bar) {
    animation: contentSwapOut 0.12s ease-out both;
}
@keyframes contentSwapOut {
    from { opacity: 1; }
    to   { opacity: 0; }
}

/* ==================== SCROLL REVEAL (v35) ==================== */
.scroll-reveal {
    opacity: 0;
    transform: translateY(16px);
    transition: opacity 0.5s var(--spring-tight), transform 0.5s var(--spring-tight);
}
.scroll-reveal.revealed {
    opacity: 1;
    transform: none;
}
/* Stagger siblings by 40ms each */
.scroll-reveal:nth-child(2) { transition-delay: 40ms; }
.scroll-reveal:nth-child(3) { transition-delay: 80ms; }

/* ==================== PERFORMANCE (v35) ==================== */
/* Off-screen pages: skip rendering entirely (exclude exit states) */
.page:not(.active):not(.exiting):not(.section-exit):not(.content-exit) {
    content-visibility: hidden;
}

/* Cards: layout containment for paint optimization */
/* Glass pill: hint for fixed-position compositing */
.glass-pill {
    will-change: transform;
}

/* ==================== SIDEBAR WIZARD/RESET BUTTONS ==================== */
.sidebar-spacer {
    flex: 1;
    min-height: 16px;
}

.sidebar-item.wizard-btn i { color: var(--system-purple); }
.sidebar-item.tour-btn i { color: var(--system-orange); }
.sidebar-item.danger-btn i { color: var(--system-red); opacity: 0.7; }

/* ==================== MOBILE NAV ==================== */
/* ==================== MOBILE BOTTOM NAV — Floating Pill ==================== */
.mobile-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 200;
    padding: 0 12px 10px;
    pointer-events: none;
}

.mobile-nav-pill {
    display: flex;
    align-items: center;
    justify-content: space-around;
    height: 56px;
    background: rgba(255, 255, 255, 0.72);
    backdrop-filter: blur(40px) saturate(180%);
    -webkit-backdrop-filter: blur(40px) saturate(180%);
    border-radius: 22px;
    border: 0.5px solid rgba(0, 0, 0, 0.04);
    box-shadow:
        0 0 0 0.5px rgba(0, 0, 0, 0.04),
        0 2px 8px rgba(0, 0, 0, 0.06),
        0 8px 24px rgba(0, 0, 0, 0.08),
        inset 0 0.5px 0 rgba(255, 255, 255, 0.6);
    padding: 0 6px;
    pointer-events: auto;
    max-width: 440px;
    margin: 0 auto;
    padding: 0 4px;
}

.mobile-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    flex: 1;
    height: 48px;
    min-width: 0;
    background: transparent;
    border: none;
    border-radius: 14px;
    color: rgba(60, 60, 67, 0.5);
    font-size: 10px;
    font-weight: 600;
    font-family: var(--font-system);
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    -webkit-tap-highlight-color: transparent;
    position: relative;
    padding: 0 2px;
}

.mobile-nav-item .material-symbols-outlined {
    font-size: 22px;
    font-variation-settings: 'FILL' 0, 'wght' 400, 'opsz' 24;
    transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.mobile-nav-item span {
    letter-spacing: 0.01em;
    line-height: 1;
}

.mobile-nav-item.active {
    color: var(--system-blue);
}

.mobile-nav-item.active .material-symbols-outlined {
    font-variation-settings: 'FILL' 1, 'wght' 500, 'opsz' 24;
    transform: scale(1.1);
}

.mobile-nav-item:active {
    transform: scale(0.92);
    transition: transform 80ms var(--ease-spring);
}

.mobile-nav-item:active .material-symbols-outlined {
    transform: scale(0.85);
}

/* ==================== PAGE HEADER ==================== */
.page-header {
    margin-bottom: var(--space-xl);
}

.page-title {
    font-size: 28px;
    font-weight: 700;
    font-family: var(--font-display);
    color: var(--text-primary);
    margin-bottom: 4px;
}

.page-title i {
    margin-right: 10px;
    color: var(--system-blue);
}

.page-subtitle {
    font-size: 14px;
    color: var(--text-tertiary);
}

/* Legacy page-hero removed — replaced by section bar system (.section-bar) */

/* ==================== APP FOOTER ==================== */
.app-footer {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 48px 0 24px;
    color: var(--text-quaternary);
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.02em;
    user-select: none;
}
.app-footer-wordmark {
    font-family: var(--font-sf);
    font-weight: 700;
    font-size: 13px;
    letter-spacing: -0.02em;
    opacity: 0.5;
}
.app-footer-version {
    font-family: var(--font-mono);
    font-size: 10px;
    opacity: 0.4;
}
.app-footer-love {
    font-style: italic;
    opacity: 0.35;
}

/* ==================== RESPONSIVE ==================== */
@media (max-width: 1200px) {
    .sidebar {
        width: var(--sidebar-collapsed);
    }
    
    .sidebar .sidebar-label,
    .sidebar .sidebar-hero-hello,
    .sidebar .sidebar-hero-sub,
    .sidebar .sidebar-version {
        display: none;
    }

    .sidebar .sidebar-hero {
        align-items: center;
    }

    .sidebar .sidebar-hero-avatar {
        width: 36px;
        height: 36px;
        margin-bottom: 8px;
    }

    .sidebar .sidebar-logout .sidebar-label {
        display: none;
    }

    .sidebar .sidebar-logout {
        justify-content: center;
    }
    
    .sidebar .sidebar-item {
        justify-content: center;
        padding: var(--space-md);
    }
    
    /* Collapsed icon colors */
    .sidebar .sidebar-item > .material-symbols-outlined,
    .sidebar .sidebar-item i {
        color: var(--text-tertiary);
    }
    .sidebar .sidebar-item.active > .material-symbols-outlined,
    .sidebar .sidebar-item.active i {
        color: var(--sidebar-active-color, var(--apple-blue));
    }
    
    .sidebar .sidebar-section-label {
        font-size: 0;
        height: auto;
        padding: 2px;
        border-bottom: 0.5px solid rgba(0,0,0,0.05);
        margin: 0 8px;
    }
    .sidebar .sidebar-section-chevron { display: none; }
    .sidebar .sidebar-section::before { display: none; }
    
    .sidebar-header {
        justify-content: center;
        padding: 16px 0 10px;
    }
    
    .sidebar-toggle {
        position: absolute;
        right: -14px;
        top: 50%;
        transform: translateY(-50%);
        width: 28px;
        height: 28px;
        border-radius: 50%;
        background: rgba(255,255,255,0.95);
        box-shadow: 0 1px 4px rgba(0,0,0,0.12);
        opacity: 0;
        pointer-events: none;
    }
    
    .sidebar:hover .sidebar-toggle {
        opacity: 1;
        pointer-events: auto;
    }
    
    .main-wrapper {
        margin-left: calc(var(--sidebar-collapsed) + 24px);
    }
    .main-wrapper::before {
        left: calc(var(--sidebar-collapsed) + 24px);
    }

    .summary-strip {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .grid-3 {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .stat-cards {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .home-docs-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Section bar bg — tablet only (sidebar collapsed but visible) */
@media (max-width: 1200px) and (min-width: 769px) {
    .section-bar-bg {
        left: calc(-1 * (var(--sidebar-collapsed) + 24px));
        width: 100vw;
    }
    .section-bar-photo {
        left: calc(-1 * (var(--sidebar-collapsed) + 24px));
        width: 100vw;
    }
    .section-bar-photo-scrim {
        left: calc(-1 * (var(--sidebar-collapsed) + 24px));
        width: 100vw;
    }
    .sky-stars {
        left: calc(-1 * (var(--sidebar-collapsed) + 24px));
        width: 100vw;
    }
}

@media (max-width: 900px) {

    .grid-2,
    .grid-2-1,
    .grid-3 {
        grid-template-columns: 1fr;
    }
    
    .home-attention-grid {
        grid-template-columns: 1fr;
    }
    
    .be-main-grid {
        grid-template-columns: 1fr;
    }
    
    .home-hero {
        padding: 28px 24px 22px;
    }
    .home-hero-hello { font-size: 16px; }
    .home-hero-photo { width: 42px; height: 42px; }
    .home-hero-actions { display: none; }
    .home-hero-headline { font-size: 26px; }
    
    .home-stats-row {
        flex-wrap: wrap;
    }
    .home-stat-item { flex: 1 1 45%; padding: 8px 14px; }
    .home-stat-divider { display: none; }
    .home-stat-value { font-size: 20px; }
    
    .home-nav-grid { grid-template-columns: 1fr 1fr; }
    
    .hub-lists {
        grid-template-columns: 1fr;
    }
    
    .mch-columns {
        grid-template-columns: 1fr 1fr;
    }
    
    .contrib-row {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .contrib-amounts {
        width: 100%;
        justify-content: space-between;
        margin-top: 8px;
        padding-top: 8px;
        border-top: 1px solid var(--separator);
    }
    
    /* Editorial illustrations — tablet scale */
    .editorial-3d-icon { width: 140px; height: 140px; }
    .editorial-illust { left: 16px; }
    .be-editorial-inner,
    .inc-editorial-inner { padding-left: 175px; }
    .be-editorial,
    .inc-editorial { margin-top: 28px; }
}

/* ═══ Font Standardization — SF Pro on Goals & Docs pages ═══ */
#page-family *,
#page-goals * {
    font-family: var(--font-sf), -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
}
/* Preserve icon font */
#page-family .material-symbols-outlined,
#page-goals .material-symbols-outlined {
    font-family: 'Material Symbols Outlined' !important;
}
