:root {
    --b-50:  95.13% 0.023 256.10;
    --b-100: 90.17% 0.048 259.10;
    --b-200: 80.72% 0.097 258.14;
    --b-300: 71.49% 0.149 258.39;
    --b-400: 63.31% 0.198 258.73;
    --b-500: 56.35% 0.241 260.82;
    --b-600: 48.02% 0.201 260.48;
    --b-700: 39.11% 0.161 260.13;
    --b-800: 29.89% 0.116 259.04;
    --b-900: 19.67% 0.068 256.39;
    --b-950: 12.00% 0.042 257.00;
    --g:     80.00% 0.155 78.00;      /* Owl Gold, from Sophia's beak and feet; the same in both themes */
}

/* ── Self-hosted Inter (variable font, SIL Open Font License) ── */
@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 400 800;
    font-display: swap;
    src: url("/static/fonts/inter-latin-ext.01ba6c2a184b.woff2") format('woff2');
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 400 800;
    font-display: swap;
    src: url("/static/fonts/inter-latin.65850a373e25.woff2") format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* ── Global font ── */
/* No overflow-x on body: with it, body becomes a scroll container and position: sticky on the navbar sticks to a
   box that never scrolls; html carries the overflow-x: hidden that guards against horizontal scroll */
body { font-family: 'Inter', sans-serif; font-variant-numeric: tabular-nums; --navbar-h: 3.5rem; }
/* ── Type roles: headings are tight and heavy; card titles keep DaisyUI's 600 as the secondary level ── */
h1, h2:not(.card-title), h3 { font-weight: 700; letter-spacing: -0.02em; }
/* Display: the one hero number per page (the dashboard score) */
.display-number { font-size: clamp(3.5rem, 6vw, 4.5rem); font-weight: 800; letter-spacing: -0.03em; line-height: 1; }
/* Phones (#1066): a seven-digit amount and its symbol at 56px are wider than a 375px card, so the number follows the viewport */
@media (max-width: 639px) { .display-number { font-size: clamp(2.5rem, 12vw, 3.5rem); } }
/* Machine strings the user copies (API keys, TOTP secret, recovery codes); never for numbers or money */
.code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.875em; }
/* DaisyUI overrides dialog UA display:none with display:grid so modals
   can animate. But the opacity:0 "invisible" layer with its opaque
   modal-box child leaks sub-pixel color through GPU compositing. */
dialog:not([open]) { display: none; }

/* ═══════════════════════════════════════════════════════════════════════
   Design tokens: one block per canvas. Components below read only these
   names and never mention a theme. A new colour goes here, in both blocks,
   never in a component rule (docs/design-system.md, "Tokens first").
   ═══════════════════════════════════════════════════════════════════════ */

/* Light canvas (also the no-attribute default) */
:root, [data-theme="light"] {
    color-scheme: light;

    /* DaisyUI roles (channel triplets, composed by daisyui.min.css) */
    --p: var(--b-500);                  /* primary */
    --pc: 100% 0 0;                     /* primary-content */
    --pf: var(--b-600);                 /* primary-focus */
    --s: var(--b-100);                  /* secondary */
    --sc: var(--b-900);                 /* secondary-content */
    --sf: var(--b-200);                 /* secondary-focus */
    --a: var(--b-400);                  /* accent */
    --ac: 100% 0 0;
    --af: var(--b-500);
    --su: 72% 0.14 152;                 /* success */
    --suc: 100% 0 0;
    --er: 68% 0.16 25;                  /* error */
    --er-text: 50% 0.16 25;             /* error text on a light surface, 4.5:1 */
    --erc: 100% 0 0;
    --wa: var(--g);                     /* warning is Owl Gold */
    --wac: var(--b-950);
    --in: 72% 0.12 230;                 /* info */
    --inc: 100% 0 0;
    --rounded-btn: 1.9rem;              /* pill-shaped buttons */
    --b1: 100% 0 0;                     /* card / element bg: white */
    --b2: 97.6% 0.009 258;              /* page bg: faint blue-tinted off-white */
    --b3: var(--b-50);                  /* inset panels */
    --bc: var(--b-950);                 /* base content: ink */
    --g-ink: 50% 0.12 66;               /* gold as text on a light surface */
    --g-soft: 95.5% 0.05 85;            /* gold fill */

    /* Surfaces and text */
    --surface: oklch(var(--b1));
    --surface-2: oklch(var(--b2));
    --surface-3: oklch(var(--b3));
    --field-bg: oklch(98.6% 0.004 260);
    --ink: oklch(var(--bc));
    --muted: oklch(50% 0.03 260);
    --line: oklch(92.5% 0.014 260);
    --line-strong: oklch(var(--b-200));

    /* Blue accent: what you can click */
    --accent: oklch(var(--p));
    --accent-hover: oklch(var(--b-700));
    --accent-active: oklch(var(--b-800));
    --on-accent: oklch(var(--pc));
    --accent-ink: oklch(var(--b-500));
    --accent-strong: oklch(var(--b-700));
    --accent-soft: oklch(var(--b-50));
    --accent-soft-2: oklch(var(--b-100));
    --accent-tint: oklch(var(--b-50) / 0.6);
    --switch-track: oklch(93.5% 0.02 260 / 0.8);  /* page header sibling switch (#1041) */
    --switch-on: oklch(var(--b1));

    /* Owl Gold: look here */
    --gold: oklch(var(--g));
    --gold-ink: oklch(var(--g-ink));
    --gold-soft: oklch(var(--g-soft));

    /* Continue with Google: Google's own button colours (branding guidelines, #1037) */
    --google-bg: oklch(100% 0 0);
    --google-line: oklch(56.6% 0.005 157);
    --google-ink: oklch(23.9% 0 0);

    /* Brand surfaces: navy in both canvases (navbar, night band, Sophia moments) */
    --brand-surface: oklch(var(--b-900));
    --brand-surface-2: oklch(var(--b-950));
    --on-brand: oklch(97% 0.01 260);
    --on-brand-muted: oklch(80% 0.05 258);
    --on-brand-fill: oklch(100% 0 0 / 0.12);
    --on-brand-fill-strong: oklch(100% 0 0 / 0.2);
    --on-brand-edge: oklch(100% 0 0 / 0.18);
    --on-brand-edge-strong: oklch(100% 0 0 / 0.3);
    --brand-glass-rest: oklch(var(--b-900) / 0.22);   /* the hero bar at the top: a faint tint that softens the band's glow */
    --brand-glass-bg: oklch(var(--b-900) / 0.84);
    --brand-glass-sheen: oklch(100% 0 0 / 0.06);
    --drawer-glass-bg: oklch(var(--b-950) / 0.94);
    --drawer-glass-sheen: oklch(100% 0 0 / 0.04);
    --band-glass-bg: oklch(100% 0 0 / 0.08);
    --band-glass-edge: oklch(100% 0 0 / 0.16);
    --band-glass-sheen: oklch(100% 0 0 / 0.12);
    --band-glass-fallback: oklch(25% 0.07 260);
    --band-bg:
        radial-gradient(38% 70% at 22% 35%, oklch(var(--b-500) / 0.75) 0%, transparent 70%),
        radial-gradient(26% 50% at 46% 92%, oklch(var(--g) / 0.38) 0%, transparent 70%),
        radial-gradient(90% 120% at 90% 0%, oklch(42% 0.17 260 / 0.8) 0%, transparent 60%),
        linear-gradient(160deg, oklch(var(--b-900)), oklch(var(--b-950)));
    /* Static glow circles: two over the night band, two behind section page headers (.has-aura, #1013) */
    /* Ceilings at each circle's peak keep --muted at AA: light blue 0.35 (4.68:1), gold 0.2 (4.98:1);
       dark blue b-500 0.38 (about 5.3:1), gold 0.16 (6.23:1) */
    --band-glow-a: radial-gradient(closest-side, oklch(var(--b-400) / 0.3), transparent);
    --band-glow-b: radial-gradient(closest-side, oklch(var(--g) / 0.2), transparent);
    --aura-a: radial-gradient(closest-side, oklch(var(--b-200) / 0.35), transparent);
    --aura-b: radial-gradient(closest-side, oklch(var(--g) / 0.2), transparent);

    /* Value changes with a direction: gain green, loss red (blue stays categorical, #1013) */
    --gain-ink: oklch(48% 0.13 150);
    --loss-ink: oklch(50% 0.16 25);
    --gain-soft: oklch(95.5% 0.045 150);
    --loss-soft: oklch(95.5% 0.03 25);

    /* Feedback surfaces */
    --on-data: oklch(100% 0 0);          /* text on a data-coloured fill (icon circles) */
    --tip-bg: oklch(var(--b-800));
    --tip-ink: oklch(var(--b-50));

    /* Data-coloured icon circles and typed badges: relative-colour channels */
    --ic-border-shift: -0.12;
    --ic-soft-l: 93%;  --ic-soft-c: 0.035;
    --ic-soft-border-l: 78%;  --ic-soft-border-c: 0.08;
    --ic-ink-l: l;  --ic-ink-c: c;
    --badge-bg-l: 93%;  --badge-bg-c: 0.05;
    --badge-border-l: 80%;  --badge-border-c: 0.08;
    --badge-ink-l: 38%;  --badge-ink-c: 0.14;

    /* Depth: rim light, blue-tinted shades, glass */
    --rim: oklch(100% 0 0 / 0.95);
    --shade-near: oklch(25% 0.06 260 / 0.07);
    --shade-far: oklch(40% 0.14 260 / 0.20);
    --glass-bg: oklch(100% 0 0 / 0.58);
    --glass-edge: oklch(100% 0 0 / 0.75);
    --glass-sheen: oklch(100% 0 0 / 0.45);
    --glass-fallback: var(--surface);
    --menu-glass-bg: oklch(100% 0 0 / 0.96);       /* menus open over anything, the navy band included; near-opaque, since a panel inside the glass bar cannot blur the page (the bar is its backdrop root) */
    --elev-1: 0 1px 2px var(--shade-near);
    --elev-2: inset 0 1px 0 var(--rim), 0 1px 2px var(--shade-near), 0 10px 28px -12px var(--shade-far);
    --elev-2-hover: inset 0 1px 0 var(--rim), 0 2px 6px var(--shade-near), 0 18px 36px -14px var(--shade-far);
    --elev-3: inset 0 1px 0 var(--glass-edge), 0 2px 6px var(--shade-near), 0 24px 48px -18px var(--shade-far);
    --elev-ring: 0 0 0 2px oklch(var(--b-100));
    --btn-sheen: oklch(100% 0 0 / 0.24);
    --elev-btn: inset 0 1px 0 oklch(100% 0 0 / 0.32), 0 1px 2px var(--shade-near), 0 8px 16px -8px oklch(var(--b-500) / 0.6);
    --elev-btn-pressed: inset 0 2px 5px oklch(0% 0 0 / 0.22);
}

/* Dark canvas: the same names, other values. No component changes. */
[data-theme="dark"] {
    color-scheme: dark;

    --p: var(--b-400);
    --pc: 0% 0 0;
    --pf: var(--b-300);
    --s: var(--b-900);
    --sc: var(--b-100);
    --sf: var(--b-800);
    --a: var(--b-400);
    --ac: 100% 0 0;
    --af: var(--b-500);
    --su: 72% 0.14 152;
    --suc: 100% 0 0;
    --er: 68% 0.16 25;
    --er-text: 68% 0.16 25;
    --erc: 100% 0 0;
    --wa: var(--g);
    --wac: var(--b-950);
    --in: 72% 0.12 230;
    --inc: 100% 0 0;
    --rounded-btn: 1.9rem;
    --b1: 20.5% 0.038 260;              /* card bg: lifted navy */
    --b2: 14% 0.028 260;                /* page bg: deep navy */
    --b3: 28% 0.04 260;                 /* inset panels */
    --bc: 95% 0.012 260;                /* base content: near-white with a blue tint */
    --g-ink: 83% 0.14 80;
    --g-soft: 28% 0.05 75;

    --surface: oklch(var(--b1));
    --surface-2: oklch(var(--b2));
    --surface-3: oklch(var(--b3));
    --field-bg: oklch(18% 0.04 260);
    --ink: oklch(var(--bc));
    --muted: oklch(72% 0.03 260);
    --line: oklch(28% 0.04 260);
    --line-strong: oklch(var(--b-700));

    --accent: oklch(var(--p));
    --accent-hover: oklch(var(--b-300));
    --accent-active: oklch(var(--b-200));
    --on-accent: oklch(var(--pc));
    --accent-ink: oklch(var(--b-300));
    --accent-strong: oklch(var(--b-200));
    --accent-soft: oklch(var(--b-900));
    --accent-soft-2: oklch(var(--b-800));
    --accent-tint: oklch(var(--b-900) / 0.4);
    --switch-track: oklch(20.5% 0.038 260 / 0.8);
    --switch-on: oklch(30% 0.05 260);

    --gold: oklch(var(--g));
    --gold-ink: oklch(var(--g-ink));
    --gold-soft: oklch(var(--g-soft));

    --google-bg: oklch(18.7% 0.002 286);
    --google-line: oklch(65.4% 0.005 157);
    --google-ink: oklch(91.6% 0 0);

    --brand-surface: oklch(var(--b-900));
    --brand-surface-2: oklch(var(--b-950));
    --on-brand: oklch(97% 0.01 260);
    --on-brand-muted: oklch(80% 0.05 258);
    --on-brand-fill: oklch(100% 0 0 / 0.12);
    --on-brand-fill-strong: oklch(100% 0 0 / 0.2);
    --on-brand-edge: oklch(100% 0 0 / 0.18);
    --on-brand-edge-strong: oklch(100% 0 0 / 0.3);
    --brand-glass-rest: oklch(var(--b-900) / 0.22);   /* the hero bar at the top: a faint tint that softens the band's glow */
    --brand-glass-bg: oklch(var(--b-900) / 0.84);
    --brand-glass-sheen: oklch(100% 0 0 / 0.06);
    --drawer-glass-bg: oklch(var(--b-950) / 0.94);
    --drawer-glass-sheen: oklch(100% 0 0 / 0.04);
    --band-glass-bg: oklch(100% 0 0 / 0.08);
    --band-glass-edge: oklch(100% 0 0 / 0.16);
    --band-glass-sheen: oklch(100% 0 0 / 0.12);
    --band-glass-fallback: oklch(25% 0.07 260);
    --band-bg:
        radial-gradient(38% 70% at 22% 35%, oklch(var(--b-500) / 0.75) 0%, transparent 70%),
        radial-gradient(26% 50% at 46% 92%, oklch(var(--g) / 0.38) 0%, transparent 70%),
        radial-gradient(90% 120% at 90% 0%, oklch(42% 0.17 260 / 0.8) 0%, transparent 60%),
        linear-gradient(160deg, oklch(var(--b-900)), oklch(var(--b-950)));
    --band-glow-a: radial-gradient(closest-side, oklch(var(--b-400) / 0.3), transparent);
    --band-glow-b: radial-gradient(closest-side, oklch(var(--g) / 0.2), transparent);
    --aura-a: radial-gradient(closest-side, oklch(var(--b-500) / 0.38), transparent);
    --aura-b: radial-gradient(closest-side, oklch(var(--g) / 0.16), transparent);

    --gain-ink: oklch(78% 0.15 150);
    --loss-ink: oklch(74% 0.14 25);
    --gain-soft: oklch(28% 0.06 150);
    --loss-soft: oklch(28% 0.06 25);

    --on-data: oklch(100% 0 0);          /* text on a data-coloured fill (icon circles) */
    --tip-bg: oklch(var(--b-100));
    --tip-ink: oklch(var(--b-900));

    --ic-border-shift: 0.12;
    --ic-soft-l: 20%;  --ic-soft-c: 0.06;
    --ic-soft-border-l: 35%;  --ic-soft-border-c: 0.10;
    --ic-ink-l: 72%;  --ic-ink-c: 0.12;
    --badge-bg-l: 30%;  --badge-bg-c: 0.08;
    --badge-border-l: 40%;  --badge-border-c: 0.10;
    --badge-ink-l: 80%;  --badge-ink-c: 0.12;

    --rim: oklch(100% 0 0 / 0.11);
    --shade-near: oklch(0% 0 0 / 0.35);
    --shade-far: oklch(0% 0 0 / 0.55);
    --glass-bg: oklch(24% 0.045 260 / 0.55);
    --glass-edge: oklch(100% 0 0 / 0.12);
    --glass-sheen: oklch(100% 0 0 / 0.06);
    --glass-fallback: var(--surface);
    --menu-glass-bg: oklch(22% 0.045 260 / 0.96);
    --elev-1: 0 1px 2px var(--shade-near);
    --elev-2: inset 0 1px 0 var(--rim), 0 1px 2px var(--shade-near), 0 10px 28px -12px var(--shade-far);
    --elev-2-hover: inset 0 1px 0 var(--rim), 0 2px 6px var(--shade-near), 0 18px 36px -14px var(--shade-far);
    --elev-3: inset 0 1px 0 var(--glass-edge), 0 2px 6px var(--shade-near), 0 24px 48px -18px var(--shade-far);
    --elev-ring: 0 0 0 2px oklch(var(--b-800));
    --btn-sheen: oklch(100% 0 0 / 0.18);
    --elev-btn: inset 0 1px 0 oklch(100% 0 0 / 0.22), 0 1px 2px var(--shade-near), 0 8px 16px -8px oklch(var(--b-500) / 0.5);
    --elev-btn-pressed: inset 0 2px 5px oklch(0% 0 0 / 0.35);
}
/* Ensure every page-level container paints an opaque --b2 background.
   Eliminates GPU compositing artifacts from transparent layers over oklch
   backgrounds, and bypasses DaisyUI's --fallback-b2 hex mismatch. */
[data-theme], .bg-base-200, main, footer { background-color: oklch(var(--b2)); }

/* ── Depth level 3: the only glass rule in the app ──
   Floating layers blur what passes under them; brand surfaces override the glass tokens on
   their own selector (navbar, mobile drawer, night band). Never on cards, tables, inputs,
   charts or long text. Guard: apps/core/tests/test_design_tokens.py. */
.glass, .navbar, .nav-dropdown, .csd-panel, .dp-panel, .modal-box, .flash-alert, .mobile-nav-overlay, .float-card {
    background: linear-gradient(180deg, var(--glass-sheen), transparent 42%) var(--glass-bg);
    border: 1px solid var(--glass-edge);
    box-shadow: var(--elev-3);
    -webkit-backdrop-filter: saturate(1.7) blur(18px);
    backdrop-filter: saturate(1.7) blur(18px);
}
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
    .glass, .navbar, .nav-dropdown, .csd-panel, .dp-panel, .modal-box, .flash-alert, .mobile-nav-overlay, .float-card {
        background: var(--glass-fallback);
    }
}
@media (prefers-reduced-transparency: reduce) {
    .glass, .navbar, .nav-dropdown, .csd-panel, .dp-panel, .modal-box, .flash-alert, .mobile-nav-overlay, .float-card {
        background: var(--glass-fallback);
        -webkit-backdrop-filter: none;
        backdrop-filter: none;
    }
}

/* ── Button base: Inter 500, 14px, padding from Coolors spec ── */
.btn {
    font-family: 'Inter', sans-serif;
    font-weight: 500;
    font-size: 0.875rem;
    padding: 0.9375rem 1.25rem;
    height: auto;
    min-height: auto;
    min-width: 6rem;
}
.btn-xs {
    font-size: 0.8125rem;
    padding: 0.5rem 0.75rem;
    min-width: 4.5rem;
}
@media (max-width: 639px) {
    .btn-xs {
        font-size: 0.75rem;
        padding: 0.35rem 0.5rem;
        min-width: auto;
    }
}
.btn-sm {
    font-size: 0.8125rem;
    padding: 0.625rem 1rem;
    min-width: 5.25rem;
}
.join > .btn-sm {
    min-width: auto;
    padding-inline: 0.625rem;
}
.btn-lg {
    font-size: 1rem;
    padding: 1.125rem 1.75rem;
    min-width: 7.5rem;
}

/* ── Button variants: primary, secondary, outline/tertiary (the tokens flip per canvas) ── */
.btn {
    transition: background-color 150ms ease, border-color 150ms ease, color 150ms ease,
                box-shadow 120ms ease, transform 120ms ease;
}
/* Primary: accent -> accent-hover -> accent-active, with a top sheen and a pressed state */
.btn.btn-primary {
    background-image: linear-gradient(180deg, var(--btn-sheen), transparent 55%);
    box-shadow: var(--elev-btn);
}
.btn.btn-primary:hover {
    background-color: var(--accent-hover);
    border-color: var(--accent-hover);
    color: var(--on-accent);
}
.btn.btn-primary:active,
.btn.btn-primary.btn-active {
    background-color: var(--accent-active);
    border-color: var(--accent-active);
    color: var(--on-accent);
    transform: translateY(1px);
    box-shadow: var(--elev-btn-pressed);
}
/* Secondary: soft fill -> stronger fill -> accent-ink text stays dark on light, light on dark */
.btn.btn-secondary:hover {
    background-color: var(--accent-soft-2);
    border-color: var(--accent-soft-2);
    color: oklch(var(--sc));
}
.btn.btn-secondary:active,
.btn.btn-secondary.btn-active {
    background-color: var(--line-strong);
    border-color: var(--line-strong);
    color: oklch(var(--sc));
}
/* Tertiary alias: .btn-tertiary = .btn-outline. Accent-ink border and text -> soft fill on hover -> stronger fill on active */
.btn.btn-outline,
.btn.btn-tertiary {
    background-color: transparent;
    border-color: var(--accent-ink);
    color: var(--accent-ink);
    outline-color: var(--accent-ink);
    box-shadow: var(--elev-1);
}
.btn.btn-outline:hover,
.btn.btn-tertiary:hover {
    background-color: var(--accent-soft);
    border-color: var(--accent-ink);
    color: var(--accent-ink);
}
.btn.btn-outline:active,
.btn.btn-outline.btn-active,
.btn.btn-tertiary:active,
.btn.btn-tertiary.btn-active {
    background-color: var(--accent-soft-2);
    border-color: var(--accent-strong);
    color: var(--accent-strong);
    box-shadow: none;
}
/* Disabled: keep the variant's colours, fade the whole button */
.btn.btn-primary[disabled], .btn.btn-primary:disabled,
.btn.btn-secondary[disabled], .btn.btn-secondary:disabled {
    background-color: var(--accent);
    border-color: var(--accent);
    color: var(--on-accent);
    opacity: 0.4;
    box-shadow: none;
}
.btn.btn-outline[disabled], .btn.btn-outline:disabled,
.btn.btn-tertiary[disabled], .btn.btn-tertiary:disabled {
    background-color: transparent;
    border-color: var(--accent-ink);
    color: var(--accent-ink);
    opacity: 0.4;
}
/* Destructive action (#1066): the secondary button plus btn-error, never a fifth variant. Written after the
   outline rules because .btn.btn-outline alone made Delete look exactly like Download. Last in its row. */
.btn.btn-outline.btn-error {
    background-color: transparent;
    border-color: var(--loss-ink);
    color: var(--loss-ink);
    outline-color: var(--loss-ink);
}
.btn.btn-outline.btn-error:hover {
    background-color: var(--loss-soft);
    border-color: var(--loss-ink);
    color: var(--loss-ink);
}
.btn.btn-outline.btn-error:active {
    background-color: var(--loss-soft);
    border-color: var(--loss-ink);
    color: var(--loss-ink);
    box-shadow: none;
}
.btn.btn-outline.btn-error[disabled], .btn.btn-outline.btn-error:disabled {
    background-color: transparent;
    border-color: var(--loss-ink);
    color: var(--loss-ink);
    opacity: 0.4;
}
/* Branded horizontal scroll indicator for scrollable widgets.
   Uses a custom track+thumb element below the content because
   native scrollbars auto-hide on macOS/iOS and can't be forced visible. */
.scroll-branded {
    position: relative;
    /* Hide the native scrollbar but keep scrolling */
    scrollbar-width: none;           /* Firefox */
}
.scroll-branded::-webkit-scrollbar {
    display: none;                   /* WebKit */
}
/* Track: thin rounded line */
.scroll-branded-track {
    height: 2px;
    border-radius: 1px;
    margin: 0.75rem 1.5rem;
    background: var(--line-strong);
    position: relative;
}
/* Thumb: rounded pill centered on the line */
.scroll-branded-thumb {
    height: 6px;
    border-radius: 3px;
    background: var(--accent);
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    left: 0;
    min-width: 2rem;
    transition: background-color 150ms ease;
    cursor: grab;
    will-change: transform;
}
.scroll-branded-thumb:active {
    cursor: grabbing;
}
.scroll-branded-thumb:hover {
    background: var(--accent-hover);
}

/* Page-level vertical scroll indicator (replaces native scrollbar) */
html {
    overflow-x: hidden;
    scrollbar-width: none;
}
html::-webkit-scrollbar {
    display: none;
}
.scroll-page-track {
    position: fixed;
    top: 4rem;
    right: 0;
    width: 8px;
    height: calc(100vh - 4rem);
    z-index: 40;
    pointer-events: none;
    opacity: 0;
    transition: opacity 200ms ease;
}
.scroll-page-track::before {
    content: '';
    position: absolute;
    top: 2rem; bottom: 2rem;
    left: 50%;
    width: 2px;
    margin-left: -1px;
    border-radius: 1px;
    background: var(--line-strong);
}
.scroll-page-thumb {
    position: absolute;
    top: 0;
    left: 1px;
    width: 6px;
    border-radius: 3px;
    background: var(--accent);
    min-height: 24px;
    pointer-events: auto;
    cursor: grab;
    transition: background-color 150ms ease;
    will-change: transform;
}
.scroll-page-thumb:active { cursor: grabbing; }
.scroll-page-thumb:hover { background: var(--accent-hover); }
@media (max-width: 1023px) {
    .scroll-page-track { width: 6px; right: 4px; }
    .scroll-page-track::before { width: 1px; }
    .scroll-page-thumb { width: 4px; min-height: 20px; }
}

/* Stats bar: scrollable below lg, full-width on lg+ */
.stats-scroll {
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
    margin-bottom: 0;
}
.stats-scroll::-webkit-scrollbar { display: none; }
.stats-bar {
    min-width: max-content;
    grid-template-columns: repeat(4, 1fr);
}
@media (min-width: 1024px) {
    .stats-scroll { overflow: visible; margin-bottom: 1.5rem; }
    .stats-bar { min-width: 0; width: 100%; }
}

/* Table: scrollable below lg, full-width on lg+ */
.table-scroll {
    overflow-x: auto;
    overflow-y: hidden;
}
.table-scroll > table,
.table-scroll > div {
    min-width: max-content;
}
@media (min-width: 1024px) {
    /* Both axes: `overflow-x: visible` alone computes to `auto` next to the
       `overflow-y: hidden` above, which kept every table a scroll container (#1012). */
    .table-scroll { overflow: visible !important; }
    /* !important: an inline phone minimum (collapsible_category_card's 500px) beats a class
       rule, and with the wrapper no longer scrolling it would spill and be clipped (#1012). */
    .table-scroll > table,
    .table-scroll > div { min-width: 0 !important; width: 100%; }
}

/* Chart container: scrollable on mobile, full-width on sm+ */
.chart-scroll {
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
    margin: 0 -1rem;
    padding: 0 1rem;
}
.chart-scroll::-webkit-scrollbar { display: none; }
@media (min-width: 640px) {
    .chart-scroll {
        overflow: visible;
        margin: 0;
        padding: 0;
    }
    /* The inner min-width (inline, 500px) only exists to scroll on phones; kept here it
       pushed charts past a half-width card at 1024px (#1012). */
    .chart-scroll > * { min-width: 0 !important; }
}

/* Pagination */
.pagination-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2rem;
    height: 2rem;
    padding: 0 0.375rem;
    border-radius: 0.375rem;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--muted);
    text-decoration: none;
    transition: background 0.15s, color 0.15s;
}
.pagination-link:hover:not(.pagination-active):not(.pagination-disabled) {
    background: var(--accent-soft-2);
    color: var(--accent-ink);
}
.pagination-active {
    background: var(--accent);
    color: var(--on-accent);
    font-weight: 600;
}
.pagination-disabled {
    opacity: 0.3;
    cursor: default;
}
.pagination-ellipsis {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.25rem;
    height: 2rem;
    font-size: 0.8125rem;
    color: oklch(var(--bc) / 0.3);
    letter-spacing: 0.1em;
}

/* Mobile-responsive tables: hide extra columns on small screens */
@media (max-width: 767px) {
    .mobile-extra { display: none !important; }
}
/* Top progress bar — auto-triggered by HTMX and form submissions */
#page-loader {
    position: fixed; top: 0; left: 0; height: 3px; z-index: 50;
    background: linear-gradient(90deg, var(--accent), var(--accent-ink), var(--accent));
    background-size: 200% 100%;
    width: 0; opacity: 0;
    transition: width 400ms ease, opacity 200ms ease;
    pointer-events: none;
}
#page-loader.active {
    opacity: 1;
    animation: loader-shimmer 1.5s linear infinite;
}
@keyframes loader-shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
/* HTMX loading indicator: dim content during requests */
.htmx-request { opacity: 0.5; transition: opacity 200ms ease-in; }
.htmx-request.htmx-request { pointer-events: none; }

/* ── Icon circle system ── */
/* Shared SVG icon sizing */
.ic { width: 1.4em; height: 1.4em; display: inline-block; vertical-align: middle; flex-shrink: 0; }
.ic-sized > .ic { width: 100%; height: 100%; display: block; }

/* Circle container — sizes (bumped for better visibility) */
.icon-circle {
    display: inline-flex; align-items: center; justify-content: center;
    border-radius: 9999px; flex-shrink: 0; padding: 0; line-height: 1;
    transition: background-color 150ms ease, border-color 150ms ease, color 150ms ease;
}
.icon-circle > span { display: inline-flex; align-items: center; justify-content: center; }
.icon-circle-xs { width: 1.75rem; height: 1.75rem; font-size: 0.8rem; }   /* 28px */
.icon-circle-sm { width: 2.25rem; height: 2.25rem; font-size: 1rem; }     /* 36px */
.icon-circle-md { width: 3rem; height: 3rem; font-size: 1.25rem; }        /* 48px */
.icon-circle-lg { width: 3.75rem; height: 3.75rem; font-size: 1.5rem; }   /* 60px */

/* The data colour (--ic-color) is the hue; the canvas tokens set lightness and chroma. */
/* PRIMARY: filled circle, white icon, a border one step darker (light) or lighter (dark) */
.icon-circle-primary {
    background-color: var(--ic-color, var(--accent));
    border: 1.5px solid oklch(from var(--ic-color, var(--accent)) calc(l + var(--ic-border-shift)) c h);
    color: var(--on-data);
}
/* SECONDARY: soft fill, icon-coloured, visible border */
.icon-circle-secondary {
    background-color: oklch(from var(--ic-color, var(--accent)) var(--ic-soft-l) var(--ic-soft-c) h);
    border: 1.5px solid oklch(from var(--ic-color, var(--accent)) var(--ic-soft-border-l) var(--ic-soft-border-c) h);
    color: oklch(from var(--ic-color, var(--accent)) var(--ic-ink-l) var(--ic-ink-c) h);
}
/* DATA: solid color bg for data-visualization icons (paragraphs, categories).
   Uses --ic-color as background. Auto-contrasts text: white on dark shades,
   dark brand on light shades. Threshold at ~70% lightness. */
.icon-circle-data {
    background-color: var(--ic-color, var(--accent));
    border: 1.5px solid oklch(from var(--ic-color, var(--accent)) calc(l - 0.08) c h);
    color: var(--on-data);
}
/* TINT: the colour's hue as ink on a soft fill of the same hue, for expense categories (#1026). Same
   channels as .badge-typed, so a category's circle and its badge match and both flip in the token blocks. */
.icon-circle-tint {
    background-color: oklch(from var(--ic-color, var(--accent)) var(--badge-bg-l) var(--badge-bg-c) h);
    border: 1.5px solid oklch(from var(--ic-color, var(--accent)) var(--badge-border-l) var(--badge-border-c) h);
    color: oklch(from var(--ic-color, var(--accent)) var(--badge-ink-l) var(--badge-ink-c) h);
}
/* Light shades (brand-100, brand-200) need dark text */
.icon-circle-data.ic-light {
    color: oklch(var(--b-800));
    border-color: oklch(from var(--ic-color, var(--accent)) calc(l - 0.12) c h);
}
/* GHOST: transparent bg, border + icon coloured */
.icon-circle-ghost {
    background-color: transparent;
    border: 1.5px solid var(--line-strong);
    color: var(--accent-ink);
}
.icon-circle-ghost:hover {
    background-color: var(--accent-soft);
}

/* Interactive icon circles (action buttons) */
.icon-circle-action { cursor: pointer; transition: background-color 150ms ease, border-color 150ms ease; }
.icon-circle-action:disabled,
.icon-circle-action[disabled] { opacity: 0.35; pointer-events: none; }
.icon-circle-action.icon-circle-ghost:hover {
    background-color: var(--accent-soft);
    border-color: var(--accent);
}
.icon-circle-action.icon-circle-ghost:active {
    background-color: var(--accent-soft-2);
}
/* Primary action — hover and active follow btn-primary */
.icon-circle-action.icon-circle-primary:hover {
    background-color: var(--accent-hover);
    border-color: var(--accent-hover);
}
.icon-circle-action.icon-circle-primary:active {
    background-color: var(--accent-active);
    border-color: var(--accent-active);
}
/* Secondary action — stronger fill on hover, deeper on active */
.icon-circle-action.icon-circle-secondary:hover {
    background-color: var(--accent-soft-2);
    border-color: var(--accent);
}
.icon-circle-action.icon-circle-secondary:active {
    background-color: var(--line-strong);
    border-color: var(--accent);
}
/* Delete action — error accent */
.icon-circle-action.icon-circle-danger {
    border-color: oklch(var(--er) / 0.5);
    color: oklch(var(--er));
}
.icon-circle-action.icon-circle-danger:hover {
    background-color: oklch(var(--er) / 0.1);
    border-color: oklch(var(--er));
}

/* ── Move dropdown (subgroup move menu) ── */
.move-dropdown {
    background-color: var(--surface);
    border: 1px solid var(--line);
}
.move-dropdown li button:hover,
.move-dropdown li a:hover {
    background-color: var(--accent-soft);
}

/* ── Bank account fill dropdown items ── */
.bank-fill-item {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
    width: 100%;
    padding: 0.5rem 0.75rem;
    text-align: left;
    cursor: pointer;
    border-radius: 0.5rem;
}
.bank-fill-item:hover { background-color: var(--accent-soft); }
.bank-fill-name { font-weight: 500; font-size: 0.875rem; }
.bank-fill-detail { font-size: 0.75rem; color: var(--accent-ink); }

/* ── Brand notice banners ── */
.notice-brand {
    display: flex; align-items: center; gap: 0.75rem;
    border-radius: 0.75rem; padding: 0.75rem 1.25rem;
    border: 1px solid var(--line-strong);
    background-color: var(--accent-soft);
}
/* A notice whose children stack (text, then a button, then a note), like the trial notice on the subscription card */
.notice-brand.notice-stack { display: block; }

/* ── Filter summary strip (animated appear/disappear) ── */
.filter-summary-wrapper {
    display: grid;
    grid-template-rows: 1fr;
    opacity: 1;
    transition: grid-template-rows 300ms ease-out, opacity 250ms ease-out;
}
.filter-summary-wrapper > * {
    overflow: hidden;
}
.filter-summary-wrapper--hidden {
    grid-template-rows: 0fr;
    opacity: 0;
}
.filter-summary-strip {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    border-radius: 0.5rem;
    padding: 0.5rem 1rem;
    margin-bottom: 1rem;
    border-left: 4px solid var(--accent);
    background-color: var(--accent-tint);
}

/* ── Badge overhaul ── */
.badge, .badge-sm {
    font-size: 0.75rem; padding: 0.2em 0.6em; font-weight: 600;
    border: 1px solid color-mix(in oklch, currentColor 40%, transparent);
    /* A badge has a fixed height: wrapped text spills out of the pill ("ETF / Fond", #1012) */
    white-space: nowrap;
}

/* Asset group tables share column proportions so every portfolio's columns line up (#1012).
   From md only: below it .mobile-extra hides cells and the remaining ones would shift columns. */
@media (min-width: 768px) {
    .asset-table .col-select { width: 2.5rem; }
    .asset-table .col-type { width: 8.5rem; }
    .asset-table .col-money { width: 12%; }
    .asset-table .col-gain { width: 16%; }
    .asset-table .col-date { width: 9%; }
    .asset-table .col-actions { width: 7.5rem; }
}
/* Typed badges: the data colour (--badge-bg, set inline) is the hue; the canvas tokens turn it
   into a soft fill with a readable ink of the same hue (pastel on light, deep on dark), so a
   light data shade never ends up as white text on a pale chip.
   !important beats the inline background-color the template also sets. */
.badge-typed {
    font-weight: 600;
    background-color: oklch(from var(--badge-bg, var(--accent)) var(--badge-bg-l) var(--badge-bg-c) h) !important;
    border-color: oklch(from var(--badge-bg, var(--accent)) var(--badge-border-l) var(--badge-border-c) h) !important;
    color: oklch(from var(--badge-bg, var(--accent)) var(--badge-ink-l) var(--badge-ink-c) h) !important;
}
/* Truncatable badges: ellipsis when space is tight */
.badge-truncate {
    max-width: min(7.5rem, 30vw);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
@media (min-width: 1024px) {
    .badge-truncate { max-width: none; }
}

/* ── Delta badges (stats percentage change) — brand blue palette ── */
.badge-delta {
    display: inline-flex; align-items: center; gap: 0.15em;
    font-size: 0.75rem; font-weight: 700; line-height: 1;
    padding: 0.25em 0.6em; border-radius: 9999px;
    vertical-align: middle;
}
.badge-delta-neutral {
    background-color: var(--accent-soft-2);
    color: var(--accent-strong);
    border: 1px solid var(--accent-strong);
}
.badge-delta-up {
    background-color: var(--accent-soft-2);
    color: var(--accent-ink);
    border: 1px solid var(--accent-ink);
}
.badge-delta-down {
    background-color: var(--accent-soft);
    color: var(--accent-strong);
    border: 1px solid var(--accent-strong);
}

/* ── Gain / loss: value changes with a direction (#1013). Zero and unknown stay muted. ── */
.text-gain { color: var(--gain-ink); }
.text-loss { color: var(--loss-ink); }
.text-flat { color: var(--muted); }
.badge-gain {
    background-color: var(--gain-soft);
    color: var(--gain-ink);
    border: 1px solid var(--gain-ink);
}
.badge-loss {
    background-color: var(--loss-soft);
    color: var(--loss-ink);
    border: 1px solid var(--loss-ink);
}

/* ── Owl Gold: "look here". At most one gold element per card. ── */
.badge-gold {
    background-color: var(--gold-soft);
    color: var(--gold-ink);
    border: 1px solid var(--gold-ink);
}
/* The fourth button: the next recommended action (the dashboard tip) and the upgrade CTAs (components/upgrade_button.html);
   at most one per card (ui-patterns.md). The navbar's .growth-pill (#1093)
   shares the fill, sheen, shadow and pressed declarations through the grouped selectors, so the two cannot drift. */
.btn.btn-gold,
.growth-pill {
    background-color: var(--gold);
    background-image: linear-gradient(180deg, var(--btn-sheen), transparent 55%);
    color: var(--brand-surface-2);
    box-shadow: var(--elev-btn);
}
.btn.btn-gold { border-color: var(--gold); }
.btn.btn-gold:hover,
.growth-pill:hover {
    background-color: var(--gold);
    color: var(--brand-surface-2);
    filter: brightness(1.05);
}
.btn.btn-gold:hover { border-color: var(--gold); }
.btn.btn-gold:active,
.btn.btn-gold.btn-active,
.growth-pill:active {
    background-color: var(--gold);
    color: var(--brand-surface-2);
    transform: translateY(1px);
    box-shadow: var(--elev-btn-pressed);
    filter: none;
}
.btn.btn-gold:active,
.btn.btn-gold.btn-active { border-color: var(--gold); }
/* The Growth chip (#1093): sparkle plus "Growth" beside a paid feature; gold-soft like .badge-gold, readable on
   the canvas and on the night band in both themes. */
.growth-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.0625rem 0.5rem;
    border-radius: 9999px;
    border: 1px solid var(--gold-ink);
    background-color: var(--gold-soft);
    color: var(--gold-ink);
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1.25rem;
    white-space: nowrap;
    vertical-align: middle;
    transition: filter 150ms ease;
}
a.growth-chip:hover { filter: brightness(1.05); }
a.growth-chip:focus-visible { outline: none; box-shadow: var(--elev-ring); }
/* "I want to grow" (#1093): the FREE user's permanent way to Growth. Gold look shared with .btn-gold above; the
   upgrade-CTA scan (test_upgrade_ctas.py) allows the class in templates/components/navbar.html only. The bar copy
   shows from 640px, the drawer copy below it (complementary queries, so no width shows both). The bare class is
   hidden on purpose: it needs growth-pill-bar or growth-pill-drawer. 640px is not the navbar's lg switch: from 640px
   to 1023px the bar holds only the logo, this pill and the hamburger, so the bar copy fits beside it and the drawer
   copy is not needed. */
.growth-pill {
    display: none;
    align-items: center;
    justify-content: center;
    gap: 0.375rem;
    min-height: 2.25rem;
    padding: 0.375rem 0.875rem;
    border-radius: 9999px;
    font-size: 0.875rem;
    font-weight: 600;
    line-height: 1.25;
    white-space: nowrap;
    transition: filter 150ms ease, transform 150ms ease, box-shadow 150ms ease;
}
.growth-pill:focus-visible { outline: none; box-shadow: var(--elev-ring); }
@media (min-width: 640px) {
    .growth-pill-bar { display: inline-flex; margin-inline-end: 0.75rem; }
}
@media not all and (min-width: 640px) {
    .growth-pill-drawer { display: flex; width: 100%; max-width: 280px; margin-bottom: 0.5rem; }
}

/* ── Depth level 2: cards sit on the canvas with a rim light on the top edge and a
   blue-tinted two-layer shadow. No hairline border; --line is for dividers, tables and inputs. ── */
.card,
.stat:not(.stats > .stat),
.stats,
.collapse,
.shadow,
.shadow-md {
    box-shadow: var(--elev-2);
}
.shadow-sm { box-shadow: var(--elev-1); }
/* Clickable cards lift on hover; everything else stays put */
.stat-clickable,
a.stat {
    transition: box-shadow 220ms cubic-bezier(0.16, 1, 0.3, 1), transform 220ms cubic-bezier(0.16, 1, 0.3, 1);
}
.stat-clickable:not(.stats > .stat):hover,
.stat-clickable:not(.stats > .stat):focus-visible,
a.stat:not(.stats > .stat):hover,
a.stat:not(.stats > .stat):focus-visible {
    transform: translateY(-2px);
    box-shadow: var(--elev-2-hover);
}
/* Sticky navbar: glass with only a bottom edge */
.navbar {
    border-width: 0 0 1px;
    border-radius: 0;
}

/* ── Stat values: ink, heavy and tight; blue marks what is clickable, not what is read ── */
.stat-value { color: var(--ink); font-weight: 800; letter-spacing: -0.02em; }

/* ── Navbar: glass over the page canvas (the page tokens, so it reads as part of the page in both themes) ── */
.navbar {
    color: var(--ink);
    min-height: var(--navbar-h);
    padding: 0.5rem 1rem;
}
.navbar .nav-dropdown { color: var(--ink); }
/* Brand mark: Sophia's portrait in a circle and the word mark */
.navbar-brand {
    display: inline-flex; align-items: center; gap: 0.5rem;
    padding: 0.25rem 0.5rem 0.25rem 0.25rem; border-radius: 9999px;
    font-size: 1.0625rem; font-weight: 800; letter-spacing: 0.02em;
    color: var(--ink);
    text-decoration: none;
    flex-shrink: 0;
}
.navbar-brand:hover { background-color: var(--accent-soft); }
.navbar-owl { display: block; width: 30px; height: 30px; }
/* Breathing room between the brand and the first section, so the brand's hover pill never touches it */
.nav-sections { margin-left: 1.25rem; }
/* The sections: plain text pills next to the brand, the active one filled */
.nav-item {
    position: relative;
    display: inline-flex; align-items: center; gap: 0.3rem;
    font-weight: 500; font-size: 0.875rem;
    padding: 0.45rem 0.85rem; border-radius: 9999px;
    border: 0; background: transparent;
    color: var(--muted);
    cursor: pointer;
    transition: background-color 150ms ease, color 150ms ease;
    text-decoration: none;
    white-space: nowrap;
}
.nav-item .nav-icon {
    display: inline-flex; align-items: center; justify-content: center;
    width: 1.25em; height: 1.25em; flex-shrink: 0;
}
.nav-item:hover {
    background-color: var(--accent-soft);
    color: var(--ink);
}
.nav-item:active {
    background-color: var(--accent-soft-2);
}
.nav-chevron { display: inline-flex; }
.nav-chevron .ic { width: 0.8em; height: 0.8em; opacity: 0.6; transition: transform 200ms ease; }
.nav-section.open .nav-chevron .ic { transform: rotate(180deg); }
/* Active section (current page): filled; a link item stops being clickable, a section trigger stays open-able */
.nav-item.nav-active {
    background-color: var(--accent-soft);
    color: var(--accent);
    font-weight: 600;
}
a.nav-item.nav-active {
    cursor: default;
    pointer-events: none;
}
/* Account button: the person's initials; the menu behind it holds Settings, the theme and Logout */
.nav-avatar {
    width: 2.25rem; height: 2.25rem; border-radius: 50%;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 0.75rem; font-weight: 700; letter-spacing: 0.02em;
    background-color: var(--accent-soft);
    color: var(--accent);
    border: 1.5px solid transparent;
    cursor: pointer;
    transition: border-color 150ms ease, background-color 150ms ease;
}
.nav-avatar:hover, .nav-avatar:focus-visible { border-color: var(--accent); }
.nav-dropdown-username { color: var(--accent-ink); font-weight: 600; }
/* Hamburger: below lg only. A dedicated rule, since .icon-circle's display would beat Tailwind's lg:hidden */
.nav-burger { display: inline-flex; margin-left: 0.5rem; }
@media (min-width: 1024px) {
    .nav-burger { display: none; }
}
/* On a hero page (the dashboard with a score) the night band runs up under the bar. The bar starts as a faint
   navy tint over it and darkens with the scroll: GWYM.initNavbar() sets --hero-fade from 0 at the top to 1
   after 200px, and body.scrolled (the shadow) once it reaches 1, so there is no single point where it jumps */
.has-hero .navbar {
    --glass-bg: color-mix(in oklab, var(--brand-glass-bg) calc(var(--hero-fade, 0) * 100%), var(--brand-glass-rest));
    --glass-edge: transparent;
    --glass-sheen: color-mix(in oklab, var(--brand-glass-sheen) calc(var(--hero-fade, 0) * 100%), transparent);
    --glass-fallback: var(--brand-surface);
    border-width: 0;
    box-shadow: none;
    color: var(--on-brand);
}
.has-hero.scrolled .navbar { box-shadow: var(--elev-3); }
@media (prefers-reduced-motion: no-preference) {
    .has-hero .navbar { transition: box-shadow 200ms ease; }
}
.has-hero .navbar-brand { color: var(--on-brand); }
.has-hero .nav-item { color: var(--on-brand-muted); }
.has-hero .navbar-brand:hover,
.has-hero .nav-item:hover,
.has-hero .nav-item.nav-active { background-color: var(--on-brand-fill); color: var(--on-brand); }
.has-hero .nav-item:active { background-color: var(--on-brand-fill-strong); }
.has-hero .nav-avatar { background-color: var(--on-brand-fill); color: var(--on-brand); }
.has-hero .nav-avatar:hover,
.has-hero .nav-avatar:focus-visible { border-color: var(--on-brand-edge-strong); }
.has-hero .navbar .icon-circle-secondary { background-color: var(--on-brand-fill); border-color: var(--on-brand-edge); color: var(--on-brand); }

/* Section dropdown host and panel */
.nav-section {
    position: relative;
    display: inline-flex;
}
.nav-section-menu {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    z-index: 30;
    visibility: hidden;
    opacity: 0;
    transform: translateY(-4px) scale(0.98);
    transform-origin: top left;
    transition: opacity 0.15s ease, transform 0.15s ease, visibility 0.15s;
}
.nav-section.open .nav-section-menu {
    visibility: visible;
    opacity: 1;
    transform: translateY(0) scale(1);
}
/* Bulk action buttons wait invisible so the row does not jump on desktop; on phones their wrapped box left a
   blank band above the table, so they take no space until a row is ticked (#1066) */
@media (max-width: 639px) {
    [data-bulk-actions]:not([data-bulk-on]) { display: none; }
}
/* Page header More menu (#1066): the overflow actions of a detail page, opened by the NAV_HOSTS binding.
   display:none while closed, so the closed panel adds no overflow on phones. */
.page-menu { position: relative; display: inline-flex; }
.page-menu-panel {
    display: none;
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    z-index: 30;
}
@media (min-width: 640px) {
    .page-menu-panel { left: auto; right: 0; }
}
.page-menu.open .page-menu-panel { display: block; }
.page-menu-trigger .ic { transition: transform 0.15s ease; }
.page-menu.open .page-menu-trigger .ic { transform: rotate(180deg); }
.nav-dropdown-item.nav-dropdown-item-danger { color: var(--loss-ink); }
button.nav-dropdown-item.nav-dropdown-item-danger:hover { background-color: var(--loss-soft); }
.nav-dropdown-item.nav-dropdown-current {
    background-color: var(--accent-soft-2);
    color: var(--accent-strong);
    font-weight: 600;
}

/* ── Mobile navbar ── */
@media (max-width: 639px) {
    .navbar-brand span { display: none; }
}
/* Signed-out bar: the inline controls move into .anon-menu (components/anon_menu.html).
   Complementary queries leave no fractional-width gap where both would show. */
@media not all and (min-width: 640px) {
    .navbar-anon .anon-inline { display: none; }
}
@media (min-width: 640px) {
    .navbar-anon .anon-menu { display: none; }
}

.mobile-nav-overlay {
    position: fixed;
    inset: 0;
    z-index: 60; /* above the fixed AI chat button (z-50) */
    display: flex;
    flex-direction: column;
    --glass-bg: var(--drawer-glass-bg);
    --glass-edge: transparent;
    --glass-sheen: var(--drawer-glass-sheen);
    --glass-fallback: var(--brand-surface-2);
    color: var(--on-brand);
    border: 0;
    opacity: 0;
    visibility: hidden;
    transition: opacity 250ms ease 300ms, visibility 250ms ease 300ms;
}
.mobile-nav-overlay.open {
    opacity: 1;
    visibility: visible;
    transition: opacity 300ms ease, visibility 300ms ease;
    touch-action: none;
}
.mobile-nav-header {
    display: flex;
    justify-content: flex-end;
    padding: 0.75rem 1rem;
}
.mobile-nav-links {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: safe center;
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    gap: 0.25rem;
    padding: 0 1.5rem 1rem;
}
/* Section headers in the drawer */
.mobile-nav-group {
    width: 100%;
    max-width: 280px;
    padding: 0.75rem 1rem 0.2rem;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--on-brand-muted);
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 200ms ease, transform 200ms ease;
}
.mobile-nav-overlay.open .mobile-nav-group {
    opacity: 1;
    transform: translateY(0);
    transition: opacity 250ms ease, transform 250ms ease;
    transition-delay: calc(var(--i) * 30ms);
}
.mobile-nav-links .nav-item {
    width: 100%;
    max-width: 280px;
    justify-content: flex-start;
    gap: 0.6rem;
    padding: 0.5rem 1rem;
    font-size: 0.9375rem;
    color: var(--on-brand-muted);
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 200ms ease, transform 200ms ease,
                background-color 150ms ease, color 150ms ease, border-color 150ms ease;
}
/* Opening: top-down stagger (--i set inline on each nav-item, 0-based) */
.mobile-nav-overlay.open .mobile-nav-links .nav-item {
    opacity: 1;
    transform: translateY(0);
    transition: opacity 250ms ease, transform 250ms ease,
                background-color 150ms ease, color 150ms ease, border-color 150ms ease;
    transition-delay: calc(var(--i) * 30ms);
}
.mobile-nav-links .nav-item:hover,
.mobile-nav-links .nav-item.nav-active { background-color: var(--on-brand-fill); color: var(--on-brand); }
.mobile-nav-links .nav-item:active { background-color: var(--on-brand-fill-strong); }
.mobile-nav-utils .nav-avatar { background-color: var(--on-brand-fill); color: var(--on-brand); }
.mobile-nav-utils .nav-dropdown { color: var(--ink); }
/* Closing: bottom-up stagger (reverse of opening) */
.mobile-nav-links .nav-item,
.mobile-nav-group {
    --total: 21;
    transition-delay: calc((var(--total) - var(--i)) * 30ms);
}
.mobile-nav-utils {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    padding: 0.5rem 0 2.5rem;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 200ms ease, transform 200ms ease;
}
.mobile-nav-overlay.open .mobile-nav-utils {
    opacity: 1;
    transform: translateY(0);
    transition: opacity 250ms ease 300ms, transform 250ms ease 300ms;
}
/* Center dropdowns in mobile nav */
.mobile-nav-utils .dropdown,
.mobile-nav-utils .lang-switcher {
    position: static;
}
.mobile-nav-utils .dropdown-content,
.mobile-nav-utils .lang-menu {
    left: 50% !important;
    right: auto !important;
    transform: translateX(-50%);
}
.mobile-nav-utils .lang-switcher.lang-open .lang-menu {
    transform: translateX(-50%) scale(1);
}

/* ── Unified navbar dropdown (user menu + language switcher) ── */
.nav-dropdown {
    --glass-bg: var(--menu-glass-bg); /* denser than the bar: a menu must stay legible over the night band */
    padding: 0.5rem;
    border-radius: var(--rounded-box, 1rem);
    min-width: 11rem;
}
.nav-dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    width: 100%;
    padding: 0.5rem 0.75rem;
    border-radius: var(--rounded-btn, 0.5rem);
    font-size: 0.9375rem;
    white-space: nowrap;
    border: none;
    background: none;
    color: var(--ink);
    text-decoration: none;
    cursor: pointer;
    transition: background-color 0.1s ease;
}
a.nav-dropdown-item:hover,
button.nav-dropdown-item:hover {
    background-color: var(--accent-soft);
}
a.nav-dropdown-item:active,
button.nav-dropdown-item:active {
    background-color: var(--accent-soft-2);
}
.nav-dropdown-header {
    pointer-events: none;
    cursor: default;
}
.nav-dropdown-divider {
    height: 1px;
    background-color: var(--line);
    margin: 0.375rem 0.25rem;
}
.nav-dropdown-icon {
    width: 1.125rem;
    height: 1.125rem;
    color: var(--accent-ink);
    opacity: 0.7;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}
.nav-dropdown-icon .ic {
    display: block;
}
/* Nav icons carry both weights; the current page's icon is bold (#1026). initNavbar() sets the classes. */
.nav-weight > .ic + .ic { display: none; }
.nav-dropdown-current .nav-weight > .ic:first-child,
.nav-item.nav-active .nav-weight > .ic:first-child { display: none; }
.nav-dropdown-current .nav-weight > .ic + .ic,
.nav-item.nav-active .nav-weight > .ic + .ic { display: block; }
.nav-dropdown-label {
    font-size: 0.9375rem;
}

/* Language switcher toggle */
.lang-switcher {
    position: relative;
    display: inline-block;
}
.lang-switcher .lang-menu {
    position: absolute;
    right: 0;
    z-index: 10;
    visibility: hidden;
    opacity: 0;
    transform: scale(0.95);
    transform-origin: top right;
    transition: opacity 0.15s ease, transform 0.15s ease, visibility 0.15s;
}
.lang-menu.dropdown-top {
    bottom: 100%;
    top: auto;
    transform-origin: bottom right;
}
.lang-menu:not(.dropdown-top) {
    top: 100%;
}
.lang-switcher.lang-open .lang-menu {
    visibility: visible;
    opacity: 1;
    transform: scale(1);
}

/* ── Custom select/dropdown: brand themed ── */
/* Hide the native select when enhanced (keep it for form submission) */
.select.select-enhanced { position: absolute; opacity: 0; pointer-events: none; width: 0; height: 0; }

/* Trigger button */
.csd { position: relative; display: inline-flex; }
.csd-trigger {
    display: inline-flex; align-items: center; gap: 0.35rem;
    cursor: pointer; font-weight: 500; white-space: nowrap;
    border: 1px solid var(--line-strong); border-radius: 9999px;
    background-color: var(--field-bg);
    color: var(--ink);
    transition: border-color 150ms ease, box-shadow 150ms ease, background-color 150ms ease;
    user-select: none; max-width: 100%; overflow: hidden;
}
.csd-label { overflow: hidden; text-overflow: ellipsis; }
.csd-trigger-sm { padding: 0.35rem 0.75rem; font-size: 0.875rem; min-height: 2rem; }
.csd-trigger-xs { padding: 0.2rem 0.6rem; font-size: 0.8125rem; min-height: 1.625rem; }
.csd-trigger-md { padding: 0.625rem 1rem; font-size: 0.9375rem; min-height: 3rem; }
.csd-chevron {
    width: 0.875em; height: 0.875em; flex-shrink: 0; opacity: 0.6;
    transition: transform 200ms ease;
}
.csd.open .csd-chevron { transform: rotate(180deg); }
.csd-trigger:hover { border-color: var(--accent); }
.csd.open .csd-trigger {
    border-color: var(--accent);
    box-shadow: var(--elev-ring);
}

/* Filled-primary trigger variant */
.csd-trigger.csd-filled-primary {
    background-color: var(--accent);
    border-color: var(--accent);
    color: var(--on-accent);
}
.csd-trigger.csd-filled-primary:hover {
    background-color: var(--accent-hover);
    border-color: var(--accent-hover);
}
.csd.open .csd-trigger.csd-filled-primary {
    background-color: var(--accent-hover);
    border-color: var(--accent-hover);
    box-shadow: var(--elev-ring);
}
.csd-trigger.csd-filled-primary .csd-chevron { opacity: 0.8; }

/* Disabled trigger (aria-disabled mirrors select.disabled; placed after the hover, open and filled rules so it wins) */
.csd-trigger[aria-disabled="true"],
.csd-trigger[aria-disabled="true"]:hover {
    opacity: 0.5; cursor: not-allowed; box-shadow: none;
    background-color: var(--field-bg);
    border-color: var(--line-strong);
    color: var(--ink);
}

/* Dropdown panel */
.csd-panel {
    position: absolute; top: calc(100% + 4px); left: 0; z-index: 50;
    min-width: 100%; max-width: calc(100vw - 2rem); max-height: 14.5rem; overflow-y: auto;
    border-radius: 1rem;
    /* Closed panels leave the layout: at opacity 0 alone a panel anchored near the right edge
       still widened the page on phones (#1012). allow-discrete keeps the fade out. */
    display: none;
    opacity: 0; transform: translateY(-4px); pointer-events: none;
    transition: opacity 150ms ease, transform 150ms ease, display 150ms allow-discrete;
    scrollbar-width: none;
}
.csd-panel::-webkit-scrollbar { display: none; }
.csd-scroll-track {
    position: absolute; z-index: 51;
    width: 6px; pointer-events: none; display: none;
    opacity: 0; transition: opacity 150ms ease;
}
.csd.open .csd-scroll-track { opacity: 1; }
.csd-scroll-track::before {
    content: ''; position: absolute;
    left: 50%; top: 8px; bottom: 8px;
    width: 2px; margin-left: -1px; border-radius: 1px;
    background: var(--line-strong);
}
.csd-scroll-thumb {
    position: absolute; left: 0; width: 6px;
    border-radius: 3px; background: var(--accent);
    min-height: 24px;
}
.csd.open .csd-panel { display: block; opacity: 1; transform: translateY(0); pointer-events: auto; }
@starting-style { .csd.open .csd-panel { opacity: 0; transform: translateY(-4px); } }
.csd-panel.csd-panel-up { top: auto; bottom: calc(100% + 4px); }

/* Dropdown items */
.csd-item {
    display: flex; align-items: center; gap: 0.5rem;
    padding: 0.45rem 1.25rem 0.45rem 0.75rem; cursor: pointer; font-size: 0.875rem;
    transition: background-color 100ms ease;
    white-space: nowrap;
    color: var(--ink);
}
.csd-item:hover { background-color: var(--accent-soft); }
.csd-item.selected {
    background-color: var(--accent-soft-2);
    color: var(--accent-strong);
    font-weight: 600;
}
.csd-item:first-child { border-radius: 1rem 1rem 0 0; }
.csd-item:last-child { border-radius: 0 0 1rem 1rem; }
.csd-check { width: 1em; height: 1em; opacity: 0; }
.csd-item.selected .csd-check { opacity: 1; }
.csd-item-disabled {
    pointer-events: none; cursor: default;
    font-weight: 600; font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.05em;
    padding-top: 0.75rem; padding-bottom: 0.25rem; opacity: 0.5;
}
.csd-item-disabled:hover { background-color: transparent !important; }
.csd-item-disabled ~ .csd-item:not(.csd-item-disabled) { padding-left: 1.5rem; }
.csd-icon { width: 1.1em; height: 1.1em; flex-shrink: 0; opacity: 0.7; }
.csd-label-icon { width: 1.1em; height: 1.1em; flex-shrink: 0; opacity: 0.7; display: inline-block; vertical-align: -0.15em; margin-right: 0.25em; }

/* Scrollbar styling */
.csd-panel::-webkit-scrollbar { width: 6px; }
.csd-panel::-webkit-scrollbar-track { background: transparent; }
.csd-panel::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 3px; }

/* ── Custom Datepicker (CDP): brand themed ── */
/* Hide the native date input when enhanced (keep it for form submission) */
input.dp-enhanced {
    position: absolute !important; opacity: 0 !important; pointer-events: none !important;
    width: 0 !important; height: 0 !important; overflow: hidden !important;
}

/* Wrapper */
.dp { position: relative; display: inline-flex; }

/* Trigger button */
.dp-trigger {
    display: inline-flex; align-items: center; gap: 0.5rem;
    cursor: pointer; font-weight: 500; white-space: nowrap;
    border: 1px solid var(--line-strong); border-radius: 9999px;
    background-color: var(--field-bg);
    color: var(--ink);
    transition: border-color 150ms ease, box-shadow 150ms ease, background-color 150ms ease;
    user-select: none; text-align: left;
}
.dp-trigger-md { padding: 0.625rem 1rem; font-size: 0.9375rem; min-height: 3rem; }
.dp-trigger-sm { padding: 0.35rem 0.75rem; font-size: 0.875rem; min-height: 2rem; }

/* Trigger icons */
.dp-calendar-icon { width: 1.1em; height: 1.1em; flex-shrink: 0; opacity: 0.5; }
.dp-chevron {
    width: 0.875em; height: 0.875em; flex-shrink: 0; opacity: 0.6; margin-left: auto;
    transition: transform 200ms ease;
}
.dp.open .dp-chevron { transform: rotate(180deg); }
.dp-label { flex: 1; }
.dp-label-placeholder { opacity: 0.5; }
.dp-trigger:hover { border-color: var(--accent); }
.dp.open .dp-trigger {
    border-color: var(--accent);
    box-shadow: var(--elev-ring);
}

/* Error state (required field not filled) */
.dp-trigger.dp-error { border-color: oklch(var(--er)) !important; }
.dp-error-msg {
    margin-top: 0.375rem;
    font-size: 0.75rem;
    line-height: 1.375;
    color: oklch(var(--er-text));
}

/* Disabled state */
.dp-disabled .dp-trigger { opacity: 0.4; cursor: not-allowed; pointer-events: none; }

/* Calendar panel */
.dp-panel {
    position: absolute; top: calc(100% + 4px); left: 0; z-index: 50;
    width: 280px; padding: 0.75rem;
    border-radius: 1rem;
    display: none; /* closed panels leave the layout, as .csd-panel (#1012) */
    opacity: 0; transform: translateY(-4px); pointer-events: none;
    transition: opacity 150ms ease, transform 150ms ease, display 150ms allow-discrete;
}
.dp.open .dp-panel { display: block; opacity: 1; transform: translateY(0); pointer-events: auto; }
@starting-style { .dp.open .dp-panel { opacity: 0; transform: translateY(-4px); } }
.dp-panel.dp-panel-up { top: auto; bottom: calc(100% + 4px); }

/* Header: prev arrow | month/year label | next arrow */
.dp-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 0.5rem;
}
.dp-nav {
    display: inline-flex; align-items: center; justify-content: center;
    width: 2rem; height: 2rem; border-radius: 9999px; border: none;
    cursor: pointer; background: transparent;
    color: var(--accent-ink);
    transition: background-color 150ms ease;
}
.dp-nav svg { width: 1rem; height: 1rem; }
.dp-nav:hover { background-color: var(--accent-soft); }

.dp-header-label {
    font-weight: 600; font-size: 0.9375rem; cursor: pointer;
    border: none; background: transparent; padding: 0.25rem 0.5rem;
    border-radius: 0.5rem;
    color: var(--ink);
    transition: background-color 150ms ease;
}
.dp-header-label:hover { background-color: var(--accent-soft); }

/* Weekday header row */
.dp-weekdays {
    display: grid; grid-template-columns: repeat(7, 1fr);
    text-align: center; font-size: 0.75rem; font-weight: 600;
    margin-bottom: 0.25rem;
    color: var(--accent-ink);
}
.dp-weekdays span { padding: 0.25rem 0; }

/* Day grid */
.dp-days {
    display: grid; grid-template-columns: repeat(7, 1fr);
    gap: 2px; justify-items: center;
}
.dp-day {
    display: inline-flex; align-items: center; justify-content: center;
    width: 2.25rem; height: 2.25rem; border-radius: 9999px;
    font-size: 0.875rem; cursor: pointer; border: 1.5px solid transparent;
    background: transparent;
    color: var(--ink);
    transition: background-color 100ms ease, border-color 100ms ease;
}
.dp-day:hover:not(.dp-day-selected):not(.dp-day-disabled) { background-color: var(--accent-soft); }

.dp-day-other { opacity: 0.35; }
.dp-day-disabled { opacity: 0.2; pointer-events: none; cursor: default; }

/* Today ring */
.dp-day-today:not(.dp-day-selected) { border-color: var(--accent); }

/* Selected day */
.dp-day-selected {
    background-color: var(--accent); color: var(--on-accent); font-weight: 600;
}

/* Month/year grids (drill-down views) */
.dp-months, .dp-years {
    display: grid; grid-template-columns: repeat(3, 1fr);
    gap: 0.375rem; padding: 0.25rem 0;
}
.dp-month, .dp-year {
    display: inline-flex; align-items: center; justify-content: center;
    padding: 0.5rem 0.25rem; border-radius: 9999px;
    font-size: 0.875rem; cursor: pointer; border: none; background: transparent;
    color: var(--ink);
    transition: background-color 100ms ease;
}
.dp-month:hover:not(.dp-month-selected), .dp-year:hover:not(.dp-year-selected) { background-color: var(--accent-soft); }
.dp-month-selected, .dp-year-selected {
    background-color: var(--accent); color: var(--on-accent); font-weight: 600;
}
.dp-month-current, .dp-year-current {
    border: 1.5px solid var(--accent);
}

/* Footer: Clear / Today buttons */
.dp-footer {
    display: flex; justify-content: space-between; align-items: center;
    margin-top: 0.5rem; padding-top: 0.5rem;
    border-top: 1px solid var(--line);
}
.dp-clear-btn, .dp-today-btn {
    font-size: 0.8125rem; font-weight: 500; cursor: pointer;
    border: none; background: transparent; padding: 0.25rem 0.5rem;
    border-radius: 0.375rem;
    color: var(--accent-ink);
    transition: background-color 150ms ease;
}
.dp-today-btn { font-weight: 600; }
.dp-clear-btn:hover, .dp-today-btn:hover { background-color: var(--accent-soft); }

/* Fallback: non-enhanced selects still get brand styling.
   The chevron is a mid-grey that reads on both canvases (a data URI cannot see the tokens). */
.select:not(.select-enhanced) {
    appearance: none; -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 256 256' fill='oklch(60%25 0.03 260)'%3E%3Cpath d='M216.49,104.49l-80,80a12,12,0,0,1-17,0l-80-80a12,12,0,0,1,17-17L128,159l71.51-71.52a12,12,0,0,1,17,17Z'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 0.625rem center; background-size: 1rem;
    padding-right: 2.25rem; cursor: pointer; font-weight: 500; border-radius: 9999px;
    border-color: var(--line-strong); color: var(--ink);
    transition: border-color 150ms ease, box-shadow 150ms ease;
}
.select:not(.select-enhanced):hover { border-color: var(--accent); }
.select:not(.select-enhanced):focus { border-color: var(--accent); outline: none; box-shadow: var(--elev-ring); }

/* Filled primary select — looks like btn-primary */
.select-filled-primary {
    background-color: var(--accent);
    color: var(--on-accent);
    border-color: var(--accent);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 256 256' fill='oklch(60%25 0.03 260)'%3E%3Cpath d='M216.49,104.49l-80,80a12,12,0,0,1-17,0l-80-80a12,12,0,0,1,17-17L128,159l71.51-71.52a12,12,0,0,1,17,17Z'/%3E%3C/svg%3E");
}
.select-filled-primary:hover,
.select-filled-primary:focus {
    background-color: var(--accent-hover);
    border-color: var(--accent-hover);
}
.select-filled-primary:focus {
    box-shadow: var(--elev-ring);
}

/* ── Input fields: brand focus ring ── */
.input:focus,
.textarea:focus {
    border-color: var(--accent);
    outline: none;
    box-shadow: var(--elev-ring);
}

/* ── Unified form field heights ── */
.select { min-height: 3rem; }

/* ── Corners (#1066): DaisyUI rounds these with --rounded-btn, the 1.9rem pill, which turned a small checkbox
   into a circle (it read as a radio) and a textarea into a pill. Single-line inputs stay pills. ── */
.checkbox { border-radius: 0.375rem; }
.textarea { border-radius: var(--rounded-box, 1rem); }

/* ── A value the user has not entered (#1066): muted words instead of "0 Kč" or a dash ── */
.value-not-set { color: var(--muted); font-weight: 600; }

/* ── Clickable table rows ── */
.table tr.row-link:hover td { background-color: var(--accent-tint); }

/* ── Collapse-arrow right padding: 1rem on mobile (two-row layout), 3rem on desktop (single row) ── */
.collapse-arrow > .collapse-title { padding-inline-end: 1rem; }
@media (min-width: 640px) {
    .collapse-arrow > .collapse-title { padding-inline-end: 3rem; }
}

/* ── Lift interactive elements above DaisyUI collapse checkbox overlay (z-index:1) ── */
.collapse-title .btn,
.collapse-title .icon-circle { position: relative; z-index: 2; }

/* ── Branded row hover for non-table elements (divs in collapsible cards) ── */
.row-highlight { transition: background-color 150ms ease; }
.row-highlight:hover { background-color: var(--accent-tint); }

/* ── Size bump: global font/component scaling ── */
.table { font-size: 0.9375rem; }
.stat-title { font-size: 0.875rem; font-weight: 500; color: var(--muted); opacity: 1; }
.stat-value { font-size: 1.5rem; }
.stat-value-auto { font-size: clamp(1rem, 2.5vw, 1.5rem); }

/* ── Collapsible sections: slide + fade toggle ── */
.portfolio-section,
.sold-section {
    display: grid;
    grid-template-rows: 1fr;
    opacity: 1;
    transition: grid-template-rows 300ms ease-out, opacity 250ms ease-out;
}
.portfolio-section > *,
.sold-section > * {
    overflow: hidden;
}
.portfolio-section--collapsed,
.sold-section--collapsed {
    grid-template-rows: 0fr;
    opacity: 0;
    pointer-events: none;
}
.portfolio-section--collapsed {
    margin-bottom: 0 !important;
}

/* ── Dashboard night band: the one brand surface on the canvas (both themes) ── */
.night-band {
    position: relative;
    isolation: isolate;
    overflow: hidden;
    border-radius: var(--rounded-box, 1rem);
    padding: 1.25rem;
    background: var(--band-bg);
    /* DaisyUI base-content utilities inside the band read this triplet, so muted text stays legible on navy */
    --bc: 97% 0.01 260;
    color: var(--on-brand);
}
@media (min-width: 640px) {
    .night-band { padding: 1.5rem; }
}
/* The dashboard hero (templates/dashboard/index.html, block hero): the band runs edge to edge and up under the
   bar; the inner container aligns with main and is the owl's containing block, and the widget's own bottom
   margin is the only space below the tile, so the owl's feet land on the band's edge */
.hero-band {
    border-radius: 0;
    margin-top: calc(-1 * var(--navbar-h));
    padding: calc(var(--navbar-h) + 0.75rem) 0 0;
}
@media (min-width: 640px) {
    .hero-band { padding: calc(var(--navbar-h) + 1.25rem) 0 0; }
}
/* flow-root keeps the widget's bottom margin inside the inner box, so the owl measures from the band's edge */
.hero-band-inner { position: relative; display: flow-root; }
/* Two static glow circles over the --band-bg; the band's overflow: hidden clips them. They sit at
   z-index -1 inside the band's own stacking context (isolation on .night-band), so they paint over the
   band's background and under its content without giving any child a z-index of its own */
.night-band::before,
.night-band::after {
    content: "";
    position: absolute;
    pointer-events: none;
    z-index: -1;
}
.night-band::before {
    top: -20%; left: 2%;
    width: 46%; height: 120%;
    background: var(--band-glow-a);
}
.night-band::after {
    bottom: -35%; left: 30%;
    width: 34%; height: 90%;
    background: var(--band-glow-b);
}
.night-band .glass {
    --glass-bg: var(--band-glass-bg);
    --glass-edge: var(--band-glass-edge);
    --glass-sheen: var(--band-glass-sheen);
    --glass-fallback: var(--band-glass-fallback);
    border-radius: var(--rounded-box, 1rem);
    padding: 1.25rem;
}
.night-band .bg-base-200,
.night-band .hs-track { background-color: var(--on-brand-fill); }
.night-band .hs-row:hover { background-color: var(--on-brand-fill); }
.night-band .btn-outline,
.night-band .btn-tertiary { border-color: var(--on-brand-edge); color: var(--on-brand); box-shadow: none; }
.night-band .btn-outline:hover,
.night-band .btn-tertiary:hover { background-color: var(--on-brand-fill); border-color: var(--on-brand-edge-strong); color: var(--on-brand); }
.night-band .text-primary { color: oklch(var(--b-300)); }
/* The recommendation tile: gold border, the one gold CTA */
.night-band-tip {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-top: 1rem;
    padding: 0.875rem 1.125rem;
    border-radius: var(--rounded-box, 1rem);
    background: var(--on-brand-fill);
    border: 1px solid oklch(var(--g) / 0.35);
}
@media (min-width: 640px) {
    /* The owl canvas (192px wide at size=192, 24px from the edge) is shown from here; the widest pose
       reaches 18/1024 from the canvas edge, so leave 14rem */
    .night-band-tip { margin-right: 14rem; }
}
@media (min-width: 768px) {
    .night-band-tip { flex-direction: row; align-items: center; }
}
.night-band-caption { margin-top: 0.75rem; font-size: 0.8125rem; color: var(--on-brand-muted); }
/* Two classes: the shared .sophia-pose { display: block } rule below would otherwise override display: none */
.sophia-pose.night-band-owl {
    display: none;
    position: absolute;
    right: 1.5rem;
    /* size=192 canvas; the feet sit 52/1024 above its bottom edge, so they land on the band's edge */
    bottom: calc(192px * -52 / 1024);
    pointer-events: none;
}
@media (min-width: 640px) {
    .sophia-pose.night-band-owl { display: block; }
}
.hs-gold { color: var(--gold); }
/* Health card meta text and marks on the band (#1013): /40 and /30 base-content failed AA on navy */
.hs-meta { color: var(--on-brand-muted); }
.hs-up { color: oklch(var(--b-300)); }
.hs-history polyline { stroke: var(--on-brand-muted); }
.hs-history circle { fill: var(--on-brand); }
.hs-history-placeholder polyline { stroke: var(--on-brand-muted); stroke-opacity: 0.5; stroke-dasharray: 3 5; }
/* Weight badge: muted at rest; on row hover it lights up ("this is how much the row counts"), no layout shift */
.hs-weight { background-color: var(--on-brand-fill); color: var(--on-brand-muted); transition: background-color 150ms ease, color 150ms ease; }
.hs-row:hover .hs-weight { background-color: var(--on-brand-fill-strong); color: var(--on-brand); }

/* ── Section page aura (#1013): the night band's light, faint, behind the page header ──
   Drawn inside main so main keeps its opaque background; each circle fades to transparent on its own
   edges, so the viewport edge never shows a seam. Past the left and top edges is
   fine (that overflow never scrolls); on the right every circle stays inside the screen with a margin,
   since html's overflow-x: hidden is not a reliable clip on iOS Safari. The circles sit at z-index -1
   inside main's isolated stacking context: above main's background, under all its content.
   Never lift main's children with a z-index instead: each child
   would become its own stacking context, and an open dropdown in the page header would sit under the
   next section (the CSD panel on Tax and Comparison stopped taking clicks, #1013). */
.has-aura main { position: relative; isolation: isolate; }
.has-aura main::before,
.has-aura main::after {
    content: "";
    position: absolute;
    pointer-events: none;
    z-index: -1;
}
.has-aura main::before {
    top: -12rem;
    left: calc(50% - 50vw - 30vw);
    width: 100vw;
    height: 26rem;
    background: var(--aura-a);
}
.has-aura main::after { display: none; }
@media (min-width: 640px) {
    .has-aura main::before {
        top: -10rem;
        left: calc(50% - 50vw - 12vw);
        width: 70vw;
        height: 30rem;
    }
    .has-aura main::after {
        display: block;
        top: -8rem;
        right: calc(50% - 50vw + 2rem);
        width: 36vw;
        height: 24rem;
        background: var(--aura-b);
    }
}

/* ── Entrance (#1035): the shell of every sign-in page (templates/allauth/layouts/entrance.html) ──
   Below lg: one column, Sophia leaning on the card. Her pose sits in flow above it, the air above her ears
   is pulled up with a negative top margin, and a negative bottom margin lands the card's top edge on
   --owl-cut (the share of the 1024px canvas where the edge goes: in "welcome" her wings meet at y 690 to
   720). The card comes later in the DOM and is positioned, so it paints over everything below the cut with
   no z-index (see the aura note above).
   From lg: one split box, a navy panel beside the card. The same owl element moves into the panel
   (absolute, against .entrance) and stands on its bottom edge at full height, so each page names its pose
   once. Feet are on the canvas baseline at y 972, hence the -5% bottom offset. */
.entrance { position: relative; display: flex; justify-content: center; }
.entrance-column { width: 100%; max-width: 28rem; }
.entrance-panel { display: none; }
.entrance-owl {
    --owl-h: 12.5rem;
    --owl-cut: 0.695;
    display: flex;
    justify-content: center;
    pointer-events: none;
    margin-top: calc(var(--owl-h) * -0.2);
    margin-bottom: calc(var(--owl-h) * (var(--owl-cut) - 1));
}
.entrance-owl .sophia-pose { height: var(--owl-h); width: auto; }
.entrance-owl--key { --owl-cut: 0.752; }
.entrance-owl--success { --owl-cut: 0.86; }
.entrance-owl--score_attention { --owl-cut: 0.742; }
@media (min-width: 640px) {
    .entrance-owl { --owl-h: 16rem; }
}
.entrance-card { position: relative; }
.entrance-title {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.2;
    text-align: center;
    color: var(--ink);
}
.entrance-greeting {
    text-align: center;
    color: var(--muted);
    font-size: 0.9375rem;
    margin: 0.375rem auto 1.5rem;
    max-width: 22rem;
}
/* Read-only demo strip above the navbar (#1036): the one gold "look here" of the page chrome. It scrolls away
   with the page, so the fixed flash alerts sit under the bar plus the part of the strip still on screen
   (GWYM.initNavbar() keeps --demo-strip-h on body) */
.demo-strip ~ #alerts-container { top: calc(4rem + var(--demo-strip-h, 0px)); }
.demo-strip {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 0.5rem 1rem;
    padding: 0.5rem 1rem;
    background: var(--gold-soft);
    color: var(--ink);
    font-size: 0.875rem;
    text-align: center;
}
.entrance-footer { text-align: center; font-size: 0.875rem; color: var(--muted); margin-top: 1.5rem; }
.entrance-greeting:empty, .entrance-footer:empty { display: none; }
.entrance-alt { display: grid; gap: 0.75rem; }
/* Same height as the primary .btn above them (46px): the 16px icon is 2px taller than its text, so 1px less padding each side. */
.entrance-alt .btn { padding: 0.875rem 12px; flex-wrap: nowrap; }
.entrance-terms { text-align: center; font-size: 0.75rem; color: var(--muted); margin-top: 0.75rem; }
/* Continue with Google, drawn to Google's branding guidelines: their colours per theme, the
   unaltered four-colour G at 20px, 12px side padding, 10px between logo and text, Roboto
   Medium 14px where the device has it (no font download), pill shape like our buttons. */
.btn-google {
    display: flex; align-items: center; justify-content: center; gap: 10px;
    width: 100%; padding: 12px;
    border: 1px solid var(--google-line); border-radius: var(--rounded-btn, 1.9rem);
    background: var(--google-bg); color: var(--google-ink);
    font-family: 'Roboto', 'Inter', sans-serif; font-size: 14px; font-weight: 500; line-height: 20px;
    cursor: pointer; transition: box-shadow 0.15s ease;
}
.btn-google:hover { box-shadow: var(--elev-1); }
.btn-google:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn-google-logo { width: 20px; height: 20px; flex: none; }
.entrance-detail { padding: 0.75rem 1rem; border-radius: var(--rounded-box, 1rem); background: var(--surface-2); }
.entrance-detail-label { display: block; font-size: 0.75rem; color: var(--muted); }
.entrance-detail-value { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; font-weight: 600; color: var(--ink); overflow-wrap: anywhere; }
@media (min-width: 1024px) {
    .entrance {
        max-width: 60rem;
        margin: 1.5rem auto 0;
        border-radius: var(--rounded-box, 1rem);
        box-shadow: var(--elev-2);
        overflow: hidden;
        align-items: stretch;
    }
    .entrance-panel {
        display: flex;
        flex-direction: column;
        flex: 1 1 0;
        min-width: 0;
        min-height: 32rem;
        padding: 2.5rem 2.5rem 13rem;
        background: var(--band-bg);
        color: var(--on-brand);
    }
    .entrance-column {
        flex: 0 0 28rem;
        display: flex;
        flex-direction: column;
        justify-content: center;
        background: var(--surface);
    }
    .entrance-card { box-shadow: none; }
    .entrance-owl {
        --owl-h: 16rem;
        position: absolute;
        left: 0;
        right: 28rem;
        bottom: calc(var(--owl-h) * -0.05);
        margin: 0;
    }
    .entrance-panel-kicker { font-size: 0.75rem; font-weight: 700; letter-spacing: 0.12em; color: var(--on-brand-muted); }
    .entrance-panel-lead { font-size: 1.75rem; font-weight: 700; letter-spacing: -0.02em; line-height: 1.2; margin-top: 0.75rem; max-width: 20rem; }
    .entrance-points { display: grid; gap: 0.75rem; margin-top: 1.75rem; font-size: 0.9375rem; }
    .entrance-points li { display: flex; align-items: center; gap: 0.625rem; }
    .entrance-point-icon { flex: none; width: 1.25rem; height: 1.25rem; color: var(--on-brand-muted); }
}

/* ── Health score gauge: arcs in SVG, the number as the page's display role ── */
.hs-gauge { position: relative; width: 14rem; height: 9rem; }
@media (min-width: 1024px) {
    .hs-gauge { width: 16rem; height: 10rem; }
}
.hs-gauge svg { width: 100%; height: 100%; display: block; }
.hs-gauge-track { stroke: var(--on-brand-fill); }
/* The score sits centred inside the arc; the label chip below it says what the number means */
.hs-gauge-number {
    position: absolute;
    left: 0; right: 0; bottom: 14%;
    display: flex; align-items: baseline; justify-content: center;
}
.hs-gauge .display-number { font-size: clamp(3.25rem, 5vw, 4rem); }
.hs-gauge-label {
    display: inline-flex; align-items: center;
    margin-top: 0.25rem;
    padding: 0.2rem 0.7rem;
    border-radius: 9999px;
    font-size: 0.8125rem; font-weight: 600;
    background: var(--on-brand-fill);
    color: var(--on-brand);
}

/* ── Health score widget: the load moment, the bars and the collapsible component rows ── */
/* One load moment per page: the arc sweeps and the bars grow once per render (under 900 ms) */
@keyframes hs-sweep { from { stroke-dashoffset: 251.33; } }
@keyframes hs-grow { from { transform: scaleX(0); } }
.health-gauge-fill {
    animation: hs-sweep 900ms cubic-bezier(0.16, 1, 0.3, 1) both;
}
.hs-track { height: 0.75rem; border-radius: 9999px; overflow: hidden; }
.hs-fill {
    height: 100%;
    border-radius: 9999px;
    background: var(--hs-color, var(--accent));
    transform-origin: left center;
    animation: hs-grow 800ms cubic-bezier(0.16, 1, 0.3, 1) both;
}
.hs-fill-gold { background: var(--gold); }
.hs-row { transition: background-color 150ms ease; }
.hs-row:hover { background-color: var(--accent-tint); }
@media (prefers-reduced-motion: reduce) {
    .health-gauge-fill, .hs-fill { animation: none; }
}
.hs-collapsible {
    display: grid;
    grid-template-rows: 1fr;
    opacity: 1;
    transition: grid-template-rows 300ms ease-out, opacity 250ms ease-out;
}
.hs-collapsible--collapsed {
    grid-template-rows: 0fr;
    opacity: 0;
    pointer-events: none;
}
.hs-collapsible > * {
    overflow: hidden;
}
@keyframes fadeOut {
    0%, 70% { opacity: 1; }
    100% { opacity: 0; }
}
.hs-comp-chevron {
    transition: transform 200ms ease-out;
}
.hs-comp-row--expanded .hs-comp-chevron {
    transform: rotate(180deg);
}

/* ── Page header (components/page_header.html via {% page_header %}, #1041): a muted back link, the title,
   the subtitle, actions on the title row and an optional switch of sibling pages. No icon. ── */
.page-header { margin-bottom: 1.5rem; }
.page-back {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding-block: 0.75rem;     /* a 44px tap target around 13px text ... */
    margin-block: -0.75rem;     /* ... without moving the layout */
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--muted);
    transition: color 150ms ease;
}
.page-back:hover, .page-back:focus-visible { color: var(--accent-ink); }
.page-back + .page-header-row { margin-top: 0.5rem; }
.page-header-row {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1rem 1.5rem;
}
.page-header-text { flex: 1 1 18rem; min-width: 0; }
.page-title { font-size: 1.625rem; line-height: 1.15; font-weight: 700; letter-spacing: -0.02em; }
@media (min-width: 768px) { .page-title { font-size: 2rem; } }
.page-subtitle { margin-top: 0.375rem; font-size: 0.875rem; color: var(--muted); }
.page-meta { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.75rem; }
.page-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; }
.page-switch {
    display: inline-flex;
    gap: 2px;
    max-width: 100%;
    margin-top: 1rem;
    padding: 3px;
    border-radius: 9999px;
    background-color: var(--switch-track);
    overflow-x: auto;
    overflow-y: hidden;   /* one scroll axis: auto on y gave the switch vertical play on touch */
    scrollbar-width: none;
}
.page-switch a {
    padding: 0.4375rem 0.875rem;
    border-radius: 9999px;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--muted);
    white-space: nowrap;
    transition: color 150ms ease, background-color 150ms ease;
}
.page-switch a:hover { color: var(--ink); }
.page-switch a[aria-current="page"] {
    background-color: var(--switch-on);
    color: var(--ink);
    font-weight: 600;
    box-shadow: var(--elev-1);
}
/* On the dashboard night band the header reads in the on-brand colours (navy in both themes). */
.night-band .page-subtitle { color: var(--on-brand-muted); }

/* ── Stacked phone rows (#1041): tables marked .table-stack show each row as two lines below 640px ── */
.row-menu-trigger,
.row-action-label,
.icon-circle > .row-action-label,   /* beats .icon-circle > span (0,1,1), which showed the labels on desktop */
.stack-label {
    display: none;
}
@media (max-width: 639px) {
    /* Stacked phone rows: line one is the name (left) and the amount (right), line two the date and the badge;
       cells carry their role in data-stack (stack_roles in apps/core/templatetags/table_tags.py). The actions cell
       becomes display: contents, so its "more" trigger takes the menu column and the opened actions a third line
       of the row: a floating menu would be clipped by the collapse and scroll wrappers. */
    .table-scroll > table.table-stack { min-width: 0; width: 100%; }
    .table-stack thead { display: none; }
    .table-stack tbody tr,
    .table-stack tfoot tr {
        display: grid;
        grid-template-columns: auto minmax(0, 1fr) auto auto;
        grid-template-areas: "check name amount menu" "check date badge menu";
        align-items: center;
        row-gap: 0.125rem;      /* no column-gap: a table without a checkbox or menu leaves those columns empty, */
        padding: 0.625rem 0.75rem; /* so the items space themselves with margins below */
        border-bottom: 1px solid var(--line);
    }
    .table-stack tbody tr:last-child { border-bottom: 0; }
    .table-stack tfoot tr:first-child { border-top: 1px solid var(--line); }   /* totals under the rows (tax summary) */
    /* A feature matrix (plan comparison) cannot stack: its cells wrap and tighten so all plans fit at 375 px */
    .table-scroll > table.table-compare { min-width: 0; width: 100%; }
    .table-compare th,
    .table-compare td {
        padding: 0.5rem 0.25rem;
        white-space: normal;
        font-size: 0.75rem;
    }
    .table-compare th:first-child,
    .table-compare td:first-child { width: 40%; }
    .table-stack tbody tr[hidden] { display: none; }   /* display: grid would override the hidden attribute (search filter) */
    /* The hover tint covers the whole row: per-cell tints (.table tr.row-link:hover td) left patches in the grid */
    .table-stack tbody tr.row-link:hover { background-color: var(--accent-tint); }
    .table-stack tbody tr.row-link:hover td { background-color: transparent; }
    .table-stack td { display: none; width: auto; padding: 0; border: 0; }   /* width: desktop w-* column widths clipped the amount */
    .table-stack td[data-stack="check"] { display: block; grid-area: check; margin-right: 0.75rem; }
    .table-stack td[data-stack="name"] {
        display: block;
        grid-area: name;
        min-width: 0;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        font-weight: 500;
    }
    .table-stack td[data-stack="amount"] { display: block; grid-area: amount; margin-left: 0.75rem; text-align: right; font-weight: 700; white-space: nowrap; }
    .table-stack td[data-stack="date"] { display: block; grid-area: date; font-size: 0.75rem; color: var(--muted); text-align: left; }
    .table-stack td[data-stack="badge"] { display: block; grid-area: badge; justify-self: end; margin-left: 0.75rem; }
    .table-stack td[data-stack="hide"] { display: none; }
    .table-stack td[data-stack="extra"] { display: block; grid-column: 2 / 4; grid-row: 3; font-size: 0.75rem; color: var(--muted); text-align: left; }   /* an optional third line (tax summary) */
    .table-stack td[data-stack="actions"] { display: contents; }
    .table-stack .row-menu-trigger { display: inline-flex; grid-area: menu; justify-self: end; margin-left: 0.5rem; }
    .table-stack .stack-label { display: inline; }   /* a column header the hidden thead no longer shows (comparison years) */
    .table-stack .row-actions { display: none; }
    .table-stack .row-menu-open .row-actions {
        display: flex;
        grid-column: 1 / -1;
        grid-row: 3;
        flex-wrap: wrap;
        justify-content: flex-end;
        gap: 0.5rem;
        padding-top: 0.5rem;
    }
    .table-stack .row-menu-open .row-actions > * {
        width: auto;
        height: auto;
        gap: 0.375rem;
        padding: 0.375rem 0.75rem;
        border-radius: 9999px;
        box-shadow: var(--elev-1);
    }
    .table-stack .row-menu-open .row-action-label { display: inline; font-size: 0.8125rem; font-weight: 500; }
    /* Cells that keep .mobile-extra for 640 to 767px (asset gain/loss, a rule's next date) still show on phones:
       its !important would otherwise empty line two */
    .table-stack td.mobile-extra[data-stack="badge"],
    .table-stack td.mobile-extra[data-stack="date"],
    .table-stack td.mobile-extra[data-stack="extra"] { display: block !important; }
    /* A name cell holding a menu (the portfolio's "move to subgroup") lets the menu out instead of clipping it */
    .table-stack td[data-stack="name"]:has(.dropdown) { overflow: visible; }
    /* Actions wrapped in a <form> (asset Duplicate, category Delete): the form steps aside so its button is the pill */
    .table-stack .row-menu-open .row-actions > form,
    .category-rows .row-menu-open .row-actions > form { display: contents; }
    .table-stack .row-menu-open .row-actions > form > button,
    .category-rows .row-menu-open .row-actions > a,
    .category-rows .row-menu-open .row-actions > form > button {
        width: auto;
        height: auto;
        gap: 0.375rem;
        padding: 0.375rem 0.75rem;
        border-radius: 9999px;
        box-shadow: var(--elev-1);
    }
    /* Category card rows (components/collapsible_category_card.html) are divs: the same menu, wrapping under the row */
    .category-rows { min-width: 0 !important; }   /* beats the inline 500px that scrolled them sideways */
    .category-rows .row-menu-trigger { display: inline-flex; }
    .category-rows .row-actions { display: none; }
    .category-rows .row-highlight:has(.row-menu-open) { flex-wrap: wrap; }
    .category-rows .row-menu-cell.row-menu-open { display: contents; }
    .category-rows .row-menu-open .row-actions {
        display: flex;
        flex-basis: 100%;
        justify-content: flex-end;
        gap: 0.5rem;
        padding-top: 0.5rem;
    }
    .category-rows .row-menu-open .row-action-label { display: inline; font-size: 0.8125rem; font-weight: 500; }
}

/* ── Settings layout (accounts/settings/base.html, #1041): a grouped side menu with an identity block from lg,
   one grouped section picker below lg, the tab content up to about 760px; the subscription tab takes the full
   width so the three plan cards fit side by side from 1280px ── */
.settings-layout { display: grid; gap: 1.5rem; }
.settings-content { min-width: 0; max-width: 47.5rem; }
.settings-content--wide { max-width: none; }
.settings-aside { display: none; }   /* below lg the section picker replaces it; hidden whole, so no empty grid row */
.settings-identity {
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
    padding: 0 0.75rem 1.25rem;
    border-bottom: 1px solid var(--line);
}
.settings-avatar {
    display: inline-flex;
    flex-shrink: 0;
    align-items: center;
    justify-content: center;
    width: 2.75rem;
    height: 2.75rem;
    border-radius: 9999px;
    background-color: var(--accent-soft);
    color: var(--accent-ink);
    font-size: 0.9375rem;
    font-weight: 700;
}
.settings-identity-name { display: flex; align-items: center; gap: 0.5rem; min-width: 0; font-size: 0.9375rem; font-weight: 600; color: var(--ink); }
.settings-identity-email { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 0.8125rem; color: var(--muted); }
.settings-nav-group {
    margin: 0 0 0.375rem;
    padding: 0 0.75rem;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--muted);
}
.settings-nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    height: 2.5rem;
    padding: 0 0.75rem;
    border-radius: 0.625rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--ink);
    transition: background-color 150ms ease, color 150ms ease;
}
.settings-nav-item .ic-sized { width: 1.125rem; height: 1.125rem; color: var(--muted); }
.settings-nav-item:hover { background-color: var(--surface); }
.settings-nav-item[aria-current="page"] { background-color: var(--accent-soft); color: var(--accent-ink); font-weight: 600; }
.settings-nav-item[aria-current="page"] .ic-sized { color: var(--accent-ink); }
@media (min-width: 1024px) {
    .settings-layout { grid-template-columns: 16rem minmax(0, 1fr); gap: 2.5rem; }
    .settings-aside { display: block; }
    .settings-identity { display: flex; }
    .settings-nav { display: flex; flex-direction: column; gap: 1.25rem; }
    .settings-picker { display: none; }
}

/* ── Section label (#1041): the uppercase heading of a group of cards (export hub groups) ── */
.section-label {
    margin-bottom: 0.75rem;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--muted);
}
/* A download row in the export hub's data list: name and description, the button on the right (below on phones) */
.export-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.75rem 1.5rem; padding: 1rem 1.5rem; }

/* ── Site footer (components/footer.html, #1083): a navy band that closes the page like the navbar and the night band
   open it (--brand-surface in both themes). Columns stack below sm; from sm the brand block takes a row of its own
   above the three link columns, from lg it sits beside them. Sophia waves in flow beside the brand text, so she
   never meets the fixed Q&A button in the bottom right corner. ── */
.app-footer {
    background-color: var(--brand-surface);
    color: var(--on-brand);
    margin-top: 2rem;
}
.app-footer-inner { max-width: 80rem; margin-inline: auto; padding: 2.5rem 1rem 1.5rem; }
.app-footer-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 2rem; }
@media (min-width: 640px) {
    .app-footer-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .app-footer-brand { grid-column: 1 / -1; }
}
@media (min-width: 1024px) {
    .app-footer-grid { grid-template-columns: minmax(0, 2fr) repeat(3, minmax(0, 1fr)); }
    .app-footer-brand { grid-column: auto; }
}
.app-footer-brand { display: flex; align-self: start; align-items: flex-end; gap: 1rem; }
.app-footer-brand-text { flex: 1 1 auto; min-width: 0; max-width: 22rem; }
.app-footer-mark {
    display: inline-flex; align-items: center; gap: 0.5rem;
    font-size: 1.0625rem; font-weight: 800; letter-spacing: 0.02em;
}
.app-footer-logo { display: block; width: 28px; height: 28px; }
.app-footer-tagline { margin-top: 0.5rem; font-size: 0.875rem; color: var(--on-brand-muted); }
.app-footer-disclaimer { margin-top: 0.5rem; font-size: 0.75rem; line-height: 1.5; color: var(--on-brand-muted); }
.sophia-pose.app-footer-owl { flex-shrink: 0; width: 88px; }
.app-footer-heading {
    font-size: 0.75rem; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase;
    color: var(--on-brand-muted);
    margin-bottom: 0.5rem;
}
.app-footer-col a {
    display: inline-block;
    padding-block: 0.3rem;
    font-size: 0.875rem;
    color: var(--on-brand);
    text-decoration: none;
    border-radius: 0.25rem;
}
.app-footer-col a:hover { text-decoration: underline; text-underline-offset: 3px; }
.app-footer a:focus-visible { outline: 2px solid var(--on-brand); outline-offset: 2px; }
.app-footer-bottom {
    display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0.25rem 1rem;
    margin-top: 2rem; padding-top: 1rem;
    border-top: 1px solid var(--on-brand-edge);
    font-size: 0.75rem;
    color: var(--on-brand-muted);
}

/* Phone footer (#1096): the Product column repeats the navigation drawer, so below sm it goes and the footer keeps the
   disclaimer, then Support (with Pricing) and Legal as wrapped rows of links (headings stay for screen readers), then
   the bottom line. */
.app-footer-phone-only { display: none; }
@media (max-width: 639px) {
    .app-footer { margin-top: 1.5rem; }
    .app-footer-inner { padding: 1.5rem 1rem 1rem; }
    .app-footer-grid { gap: 0.75rem; }
    .app-footer .app-footer-owl,
    .app-footer-tagline,
    .app-footer-product { display: none; }
    .app-footer-phone-only { display: list-item; }
    .app-footer-col .app-footer-heading {
        position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
        overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
    }
    .app-footer-col ul { display: flex; flex-wrap: wrap; gap: 0 1rem; }
    .app-footer-bottom { margin-top: 1rem; padding-top: 0.75rem; }
}

/* ── Empty state (components/empty_state.html): Sophia, one line, an optional action ── */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 0.25rem;
    padding: 2rem 1rem;
    color: var(--muted);
}
.empty-state-compact { padding: 1rem 0.5rem; }
.empty-state .sophia-pose { margin-bottom: 0.75rem; }
.empty-state-title { font-weight: 600; color: var(--ink); }
.empty-state-text { font-size: 0.875rem; max-width: 28rem; }
.sophia-pose { display: block; height: auto; }
/* Full-body slots share one 1024px canvas (apps/core/sophia.py): ear tufts at 24.5% from the top, feet on a
   baseline at 95%, the empty-state box down to 98.6%. In flow layouts crop the air above the ears so the figure
   sits where the old tight-trimmed files did; the width stays, since props extend sideways. */
.sophia-pose-body {
    aspect-ratio: 1024 / 759;
    object-fit: cover;
    object-position: 50% 94.6%;
}

/* ── Portfolio cards ── */
.portfolio-card {
    background: var(--surface-3);
    border: 1px solid var(--line);
    transition: box-shadow 150ms ease, border-color 150ms ease, transform 150ms ease;
}
.portfolio-card:hover {
    border-color: var(--accent);
    transform: translateY(-1px);
}
.portfolio-card .portfolio-value { color: var(--accent-strong); }

/* ── Flash notifications ── */
.flash-alert {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 1rem;
    border-radius: 0.75rem;
    margin-bottom: 0.5rem;
    border-left-width: 4px;
    color: var(--ink);
    animation: flash-slide-in 0.3s ease-out;
    transition: opacity 0.3s ease, max-height 0.3s ease, margin 0.3s ease, padding 0.3s ease;
}
@keyframes flash-slide-in {
    from { opacity: 0; transform: translateX(1rem); }
    to { opacity: 1; transform: translateX(0); }
}
.flash-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    flex-shrink: 0;
    color: var(--on-accent);
}
.flash-icon svg { width: 1rem; height: 1rem; }
.chart-tip-arrow { width: 12px; height: 12px; display: block; }
.flash-text { flex: 1; font-size: 0.875rem; font-weight: 500; line-height: 1.4; }
.flash-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 1.5rem;
    height: 1.5rem;
    border-radius: 0.375rem;
    flex-shrink: 0;
    cursor: pointer;
    border: none;
    background: none;
    color: var(--muted);
    opacity: 0.6;
    transition: opacity 0.15s;
}
.flash-close:hover { opacity: 1; }
.flash-close svg { width: 0.875rem; height: 0.875rem; }
.flash-success { border-color: var(--accent); }
.flash-success .flash-icon { background: var(--accent); }
.flash-info { border-color: var(--accent-ink); }
.flash-info .flash-icon { background: var(--accent-ink); }
.flash-error { border-color: oklch(var(--er)); }
.flash-error .flash-icon { background: oklch(var(--er)); color: oklch(var(--erc)); }
.flash-warning { border-color: var(--gold); }
.flash-warning .flash-icon { background: var(--gold); color: oklch(var(--wac)); }

/* Branded tooltips */
.tooltip {
    z-index: 10;
}
.tooltip::before {
    font-size: 0.8125rem;
    line-height: 1.4;
    font-weight: 500;
    padding: 0.5rem 0.75rem;
    border-radius: 0.5rem;
    max-width: 18rem;
    white-space: normal;
    text-align: left;
    box-shadow: var(--elev-3);
    background: var(--tip-bg);
    color: var(--tip-ink);
}
.tooltip::after {
    border-color: var(--tip-bg) transparent transparent transparent;
}
.tooltip-bottom::after {
    border-color: transparent transparent var(--tip-bg) transparent;
}
.tooltip-left::after {
    border-color: transparent transparent transparent var(--tip-bg);
}
.tooltip-right::after {
    border-color: transparent var(--tip-bg) transparent transparent;
}
/* Hidden tooltips leave the layout. DaisyUI only fades them to opacity 0, and an invisible
   bubble next to the right edge still counted as overflow: it showed the scroll indicator
   under desktop tables and widened phone pages by up to 121px (#1012). The states below are
   DaisyUI's own show states; allow-discrete keeps the fade. */
.tooltip::before,
.tooltip::after {
    display: none;
    transition-property: opacity, display;
    transition-behavior: allow-discrete;
}
.tooltip:hover::before, .tooltip:hover::after,
.tooltip.tooltip-open::before, .tooltip.tooltip-open::after,
.tooltip:has(:focus-visible)::before, .tooltip:has(:focus-visible)::after {
    display: block;
}
@starting-style {
    .tooltip:hover::before, .tooltip:hover::after,
    .tooltip.tooltip-open::before, .tooltip.tooltip-open::after,
    .tooltip:has(:focus-visible)::before, .tooltip:has(:focus-visible)::after {
        opacity: 0;
    }
}

/* Collapse containers must not clip tooltips in headers */
.collapse { overflow: visible; }
/* DaisyUI's collapse is a grid with an implicit auto column, which grows to the title's
   min-content width: a long nowrap category name pushed the card 42px past a 375px screen
   instead of truncating (#1012). minmax(0, 1fr) lets the title shrink and truncate. */
.collapse { grid-template-columns: minmax(0, 1fr); }

/* File input: brand-colored button */
.file-input::file-selector-button {
    background-color: var(--accent);
    color: var(--on-accent);
    border: none;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-size: 0.75rem;
}

/* Icon-only button: circular, no DaisyUI min-width bloat */
.btn-icon {
    width: 2rem;
    height: 2rem;
    min-width: 0;
    min-height: 0;
    padding: 0;
    border-radius: 9999px;
}

/* Drop zone */
.drop-zone {
    border: 2px dashed var(--line-strong);
    border-radius: 1rem;
    padding: 2.5rem 1.5rem;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s, background-color 0.2s;
}
.drop-zone-compact {
    padding: 1.5rem 1rem;
}
.drop-zone:hover, .drop-zone.drop-zone-dragover {
    border-color: var(--accent);
    background-color: var(--accent-tint);
}
.drop-zone.drop-zone-dragover {
    border-style: solid;
}
.drop-zone-has-file {
    border-color: var(--accent-ink);
    border-style: solid;
    background-color: var(--accent-tint);
    cursor: default;
}
.drop-zone-error {
    margin-top: 0.75rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: oklch(var(--er-text));
}
/* Placed after the hover rule, which would otherwise turn the border blue under the pointer. */
.drop-zone.drop-zone-invalid,
.drop-zone.drop-zone-invalid:hover {
    border-color: oklch(var(--er));
}

.drop-zone-preview {
    width: 4.5rem;
    height: 3rem;
    flex-shrink: 0;
    object-fit: cover;
    object-position: top left;
    border-radius: 0.5rem;
    box-shadow: var(--elev-1);
}
/* .icon-circle sets display: flex, which would beat Tailwind's .hidden while the preview stands in for it */
.icon-circle.drop-zone-file-icon.hidden { display: none; }

/* ── Choice tiles: a radio group shown as cards (feedback type, #1097) ── */
.choice-tiles {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.75rem;
}
.choice-tile {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    padding: 1rem 0.5rem;
    text-align: center;
    border: 1px solid var(--line-strong);
    border-radius: 1rem;
    color: var(--muted);
    cursor: pointer;
    transition: border-color 150ms ease, background-color 150ms ease, color 150ms ease;
}
.choice-tile:hover { border-color: var(--accent); }
.choice-tile:has(input:checked) {
    border-color: var(--accent);
    background-color: var(--accent-tint);
    color: var(--accent-ink);
}
.choice-tile:has(input:focus-visible) { box-shadow: var(--elev-ring); }
.choice-tile-icon { width: 1.75rem; height: 1.75rem; margin-bottom: 0.25rem; }
.choice-tile-label { font-size: 0.875rem; font-weight: 600; line-height: 1.25; color: var(--ink); }
.choice-tile:has(input:checked) .choice-tile-label { color: var(--accent-ink); }
.choice-tile-hint { font-size: 0.75rem; line-height: 1.375; }
.choice-tiles-two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 639px) {
    .choice-tile { padding: 0.75rem 0.25rem; }
    .choice-tile-hint { display: none; }
}

/* Contact topics (#1084, templates/feedback/contact.html): the five visitor tiles as three over two and the four
   member tiles as two over two, each row filling the width, and below them the example questions of the checked
   topic (:has(), no script; without :has() the examples simply stay hidden). */
.contact-topics { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.contact-topics > .choice-tile { grid-column: span 2; }
.contact-topics > .choice-tile:nth-child(n + 4) { grid-column: span 3; }
.contact-topics-four > .choice-tile,
.contact-topics-four > .choice-tile:nth-child(n + 4) { grid-column: span 3; }
.contact-examples-set {
    display: none;
    padding: 0.75rem 1rem;
    border-radius: var(--rounded-box, 1rem);
    background: var(--surface-2);
    font-size: 0.875rem;
    line-height: 1.45;
    color: var(--muted);
}
.contact-examples-title { font-size: 0.75rem; font-weight: 600; color: var(--ink); margin-bottom: 0.25rem; }
.contact-examples-set li + li { margin-top: 0.25rem; }
.contact-form:has(input[name="topic"][value="presale"]:checked) [data-topic-examples="presale"],
.contact-form:has(input[name="topic"][value="signin"]:checked) [data-topic-examples="signin"],
.contact-form:has(input[name="topic"][value="billing"]:checked) [data-topic-examples="billing"],
.contact-form:has(input[name="topic"][value="privacy"]:checked) [data-topic-examples="privacy"],
.contact-form:has(input[name="topic"][value="advisor"]:checked) [data-topic-examples="advisor"],
.contact-form:has(input[name="topic"][value="press"]:checked) [data-topic-examples="press"],
.contact-form:has(input[name="topic"][value="other"]:checked) [data-topic-examples="other"] { display: block; }
/* The member's Help Center box above the form: how the app works is answered there, not by email */
.contact-help { padding: 0.75rem 1rem; border-radius: var(--rounded-box, 1rem); background: var(--accent-soft); }
/* Phones stack title, field and button; from sm the button sits beside the field, from lg the title too */
.contact-help-search { display: grid; grid-template-columns: minmax(0, 1fr); align-items: center; gap: 0.5rem; }
.contact-help-search .btn { justify-self: start; }
.contact-help-title { font-size: 0.875rem; font-weight: 600; color: var(--ink); }
@media (min-width: 640px) {
    .contact-help-search { grid-template-columns: minmax(0, 1fr) auto; }
    .contact-help-title { grid-column: 1 / -1; }
}
.contact-help-links { display: flex; flex-wrap: wrap; gap: 0.25rem 0.5rem; margin-top: 0.5rem; font-size: 0.75rem; color: var(--muted); }
.contact-send { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0.75rem; }

/* Wide sign-in shell (entrance_class " entrance-wide", the Contact page): from lg a wider card beside a narrower
   panel, so the whole form fits one desktop screen. Inside it the sender is one row, the topics one row, the
   message sits beside its example questions, and Send closes the last row on the right. */
@media (min-width: 1024px) {
    .entrance.entrance-wide { max-width: 76rem; }
    .entrance-wide .entrance-panel { flex: 0 0 24rem; min-height: 0; }
    .entrance-wide .entrance-column { flex: 1 1 0; min-width: 0; max-width: none; }
    .entrance-wide .entrance-owl { right: auto; width: 24rem; }
    .entrance-wide .entrance-card .card-body { padding: 2rem 2.5rem; }
    .entrance-wide .entrance-greeting { max-width: 36rem; margin-bottom: 1.25rem; }
    .entrance-wide .entrance-footer { margin-top: 1rem; }

    .contact-sender { display: flex; flex-wrap: wrap; align-items: baseline; column-gap: 0.75rem; }
    .contact-sender .entrance-detail-label { display: inline; }
    .contact-sender-change { margin-left: auto; }
    .contact-who { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 1rem; }

    .contact-help-search { grid-template-columns: auto minmax(0, 1fr) auto; column-gap: 0.75rem; }
    .contact-help-title { grid-column: auto; }

    .contact-topics { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 0.625rem; }
    .contact-topics-four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
    .contact-topics > .choice-tile,
    .contact-topics > .choice-tile:nth-child(n + 4) { grid-column: auto; padding: 0.75rem 0.375rem; }

    .contact-compose { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); column-gap: 1.25rem; }
    /* The textarea grows to the height of the examples beside it */
    .contact-message { grid-column: 1; grid-row: 1; display: flex; flex-direction: column; }
    .contact-message .form-control { flex: 1; }
    .contact-message textarea { flex: 1; min-height: 8rem; }
    /* Starts level with the textarea: 2.25rem is the height of the field label above it */
    .contact-examples { grid-column: 2; grid-row: 1; display: flex; flex-direction: column; margin-top: 2.25rem; }
    .contact-examples-set { flex: 1; }

    .contact-send { grid-template-columns: minmax(0, 1fr) auto; align-items: center; column-gap: 1.25rem; }
    .contact-submit { grid-column: 2; min-width: 15rem; }
    .contact-submit .entrance-terms { margin-top: 0.5rem; }
}

/* Feedback card header: title and subtitle beside Sophia, who stays outside the form */
.feedback-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.25rem;
}
.feedback-owl { flex-shrink: 0; width: 6rem; }
/* On phones the subtitle needs the width */
@media (max-width: 639px) {
    .feedback-owl { display: none; }
}

/* Rating card (#1084, templates/feedback/rating_card.html): no script, so it works after an HTMX swap
   and under the nonce CSP. Until a star is picked every star is dimmed and the follow-up hidden; then
   1 to 3 stars show "What should we fix?", 4 or 5 the optional comment and the quote checkbox. A browser
   without :has() skips the block and shows the whole form, so Send is never out of reach. */
@supports selector(:has(*)) {
    .rating-card .rating:not(:has(input:checked)) input { --tw-bg-opacity: 0.2; }
    .rating-card .rating-followup,
    .rating-card [data-rating-followup] { display: none; }
    .rating-card:has(.rating input:checked) .rating-followup { display: block; }
    .rating-card:has(.rating input:is([value="1"], [value="2"], [value="3"]):checked) [data-rating-followup="low"],
    .rating-card:has(.rating input:is([value="4"], [value="5"]):checked) [data-rating-followup="high"] { display: inline-flex; }
}

/* ── Error pages (404, 500) ── */
.error-mascot {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
}
.error-mascot-figure {
    position: relative;
    display: inline-flex;
}
/* Sophia stands still; only her speech bubble floats. */
.error-mascot img {
    height: 200px;
    width: auto;
    object-fit: contain;
}
.error-mascot-glow {
    position: absolute;
    inset: -20%;
    border-radius: 50%;
    background: oklch(var(--b-500) / 0.12);
    filter: blur(28px);
    z-index: 0;
}
.error-mascot::after {
    content: "";
    width: 110px;
    height: 16px;
    margin-top: -16px;
    border-radius: 50%;
    background: oklch(var(--b-500) / 0.2);
    filter: blur(6px);
}
/* Beside her head on the side she looks at, anchored outside the figure so it never covers her face
   (inside it, the text wrapped to the image width and the bubble sat over her whole head). */
.error-mascot .error-mascot-bubble {
    position: absolute;
    right: calc(100% - 8px);
    bottom: 80%;
    width: max-content;
    max-width: 12rem;
    text-align: left;
    transform-origin: bottom right;
    animation: mascot-orbit-a 4.5s linear infinite;
}
@media (max-width: 639px) {
    .error-mascot img { height: 140px; max-height: 40vh; }
    .error-mascot::after { width: 80px; height: 12px; }
    /* Too narrow beside her on a phone: centre the bubble above her head. `translate` composes with the animation's transform. */
    .error-mascot .error-mascot-bubble {
        right: auto;
        left: 50%;
        bottom: calc(100% + 4px);
        translate: -50% 0;
        max-width: min(15rem, calc(100vw - 2rem));
        text-align: center;
        transform-origin: bottom center;
        font-size: 0.75rem;
        padding: 0.625rem 0.875rem;
    }
}
@media (prefers-reduced-motion: reduce) {
    .error-mascot .error-mascot-bubble { animation: none; transform: translate(0px, -6px); }
}

/* ── Onboarding mascot ── */
@keyframes mascot-enter {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes mascot-float-left {
    0%, 100% { transform: translateX(-100%) translateY(0); }
    50% { transform: translateX(-100%) translateY(-6px); }
}
@keyframes mascot-orbit-a {
    0%   { transform: translate(0px,    0px)   rotate(1deg); }
    25%  { transform: translate(4px,   -8px)   rotate(2deg); }
    50%  { transform: translate(0px,   -12px)  rotate(0deg); }
    75%  { transform: translate(-4px,  -8px)   rotate(-1deg); }
    100% { transform: translate(0px,    0px)   rotate(1deg); }
}
@keyframes mascot-orbit-b {
    0%   { transform: translate(0px,    0px)   rotate(-1deg); }
    25%  { transform: translate(-3px,  -6px)   rotate(-2deg); }
    50%  { transform: translate(0px,   -10px)  rotate(0deg); }
    75%  { transform: translate(3px,   -6px)   rotate(1deg); }
    100% { transform: translate(0px,    0px)   rotate(-1deg); }
}
@keyframes mascot-orbit-c {
    0%   { transform: translate(0px,    0px)   rotate(0.5deg); }
    25%  { transform: translate(5px,   -5px)   rotate(1.5deg); }
    50%  { transform: translate(0px,   -9px)   rotate(-0.5deg); }
    75%  { transform: translate(-5px,  -5px)   rotate(-1deg); }
    100% { transform: translate(0px,    0px)   rotate(0.5deg); }
}
@keyframes mascot-orbit-d {
    0%   { transform: translate(0px,    0px)   rotate(-0.5deg); }
    25%  { transform: translate(-4px,  -7px)   rotate(0.5deg); }
    50%  { transform: translate(0px,   -11px)  rotate(1deg); }
    75%  { transform: translate(4px,   -7px)   rotate(0deg); }
    100% { transform: translate(0px,    0px)   rotate(-0.5deg); }
}
.onboarding-mascot {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 1rem;
    animation: mascot-enter 0.5s ease-out both;
}
.onboarding-mascot-figure {
    position: relative;
    display: inline-flex;
}
.onboarding-mascot img {
    height: 238px;
    width: auto;
    object-fit: contain;
}
.onboarding-mascot--explaining img { height: 260px; }
.onboarding-mascot--thinking img { height: 262px; }
.onboarding-mascot--celebrating img { height: 260px; }
.onboarding-mascot--complete img { height: 272px; }
.onboarding-mascot::after {
    content: "";
    width: 130px;
    height: 18px;
    margin-top: -20px;
    border-radius: 50%;
    background: oklch(var(--b-500) / 0.2);
    filter: blur(6px);
}
.onboarding-mascot .float-card-left {
    position: absolute;
    left: 8px;
    top: 18%;
    transform: translateX(-100%);
    animation: mascot-float-left 3s ease-in-out infinite;
    animation-delay: 0.5s;
}
.onboarding-mascot .float-card-orbit {
    position: absolute;
    padding: 0.5rem 0.75rem;
    border-radius: 14px;
}
.onboarding-mascot .float-card-orbit:nth-child(1) {
    right: -16px; top: 0%;
    animation: mascot-orbit-a 4.5s linear infinite;
}
.onboarding-mascot .float-card-orbit:nth-child(2) {
    right: -40px; top: 14%;
    animation: mascot-orbit-b 5s linear infinite 0.6s;
}
.onboarding-mascot .float-card-orbit:nth-child(3) {
    right: -8px; top: 26%;
    animation: mascot-orbit-c 4s linear infinite 1.2s;
}
.onboarding-mascot .float-card-orbit:nth-child(4) {
    right: -32px; top: 38%;
    animation: mascot-orbit-d 5.5s linear infinite 0.3s;
}
.onboarding-mascot .float-card-orbit-left {
    position: absolute;
    padding: 0.5rem;
    border-radius: 14px;
}
.onboarding-mascot .float-card-orbit-left:nth-child(1) {
    left: -16px; top: 2%;
    animation: mascot-orbit-b 5s linear infinite;
}
.onboarding-mascot .float-card-orbit-left:nth-child(2) {
    left: -36px; top: 28%;
    animation: mascot-orbit-c 4.5s linear infinite 0.7s;
}
.onboarding-mascot .float-card-orbit-right-solo {
    position: absolute;
    padding: 0.5rem;
    border-radius: 14px;
    right: -32px;
    top: 18%;
    animation: mascot-orbit-d 5s linear infinite 0.4s;
}
.float-card-symbol {
    font-size: 1.125rem;
    font-weight: 800;
    line-height: 1;
}
@media (max-width: 639px) {
    .onboarding-mascot img { height: 154px; }
    .onboarding-mascot--explaining img { height: 168px; }
    .onboarding-mascot--thinking img { height: 170px; }
    .onboarding-mascot--celebrating img { height: 168px; }
    .onboarding-mascot--complete img { height: 176px; }
    .onboarding-mascot::after { width: 88px; height: 12px; }
    .onboarding-mascot .float-card-left { font-size: 0.75rem; padding: 0.625rem 0.875rem; }
    .onboarding-mascot .float-card-orbit { padding: 0.375rem 0.5rem; border-radius: 10px; }
    .onboarding-mascot .float-card-orbit-left { padding: 0.375rem; border-radius: 10px; }
    .onboarding-mascot .float-card-orbit-left svg { width: 1rem; height: 1rem; }
    .onboarding-mascot .float-card-orbit-right-solo { padding: 0.375rem; border-radius: 10px; }
    .onboarding-mascot .float-card-orbit-right-solo svg { width: 1rem; height: 1rem; }
    .float-card-symbol { font-size: 0.875rem; }
}
/* Setup wizard (#1096): a smaller Sophia, so each step's question sits near the top of a phone screen */
.onboarding-mascot.onboarding-mascot--compact img { height: 180px; }
.onboarding-mascot.onboarding-mascot--compact::after { width: 100px; height: 14px; margin-top: -16px; }
@media (max-width: 639px) {
    .onboarding-mascot.onboarding-mascot--compact { margin-bottom: 0.5rem; }
    .onboarding-mascot.onboarding-mascot--compact img { height: 112px; }
    .onboarding-mascot.onboarding-mascot--compact::after { width: 64px; height: 10px; margin-top: -12px; }
}
/* An answer card (a label around a radio, or a submit button) marks the chosen one without any script */
.choice-card:has(input:checked) { border-color: var(--accent); background-color: var(--accent-soft); }
@media (prefers-reduced-motion: reduce) {
    .onboarding-mascot { animation: none; }
    .onboarding-mascot .float-card-left { animation: none; transform: translateX(-100%); }
    .onboarding-mascot .float-card-orbit { animation: none; }
    .onboarding-mascot .float-card-orbit-left { animation: none; }
    .onboarding-mascot .float-card-orbit-right-solo { animation: none; }
}
.onboarding-nav-btn { gap: 0.25rem; padding-inline: 0.75rem; }
.onboarding-nav-btn svg { width: 1rem; height: 1rem; flex-shrink: 0; }

/* ── Floating speech card (mascot bubbles): shape only, the surface comes from the .glass rule ── */
.float-card {
    border-radius: 18px;
    padding: 0.875rem 1.125rem;
    font-size: 0.8125rem;
    z-index: 10;
}
.float-card-text {
    font-weight: 700;
    color: var(--accent-ink);
}

/* ── Pricing page ── */

/* Plan cards: three columns only when the section itself has room for them (a Slovak Advisor card needs about
   300px: a 228px price row plus padding), whatever the viewport, since the settings tab is narrower than the
   pricing page; with less room the cards stack in one centred column. The price row wraps rather than spilling
   out of a card that is still too narrow. */
.pricing-section { container-type: inline-size; }
.pricing-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    max-width: 28rem;
    margin-inline: auto;
}
@container (min-width: 58rem) {
    .pricing-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); max-width: none; }
}
.pricing-price { flex-wrap: wrap; }

/* Billing toggle pill */
.pricing-toggle {
    display: flex;
    align-items: center;
    background: var(--surface-2);
    border: 1px solid var(--line);
    border-radius: 9999px;
    padding: 0.25rem;
    gap: 0.125rem;
}
.pricing-toggle-btn {
    background: transparent;
    border: none;
    border-radius: 9999px;
    padding: 0.4rem 1.125rem;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--muted);
    cursor: pointer;
    transition: background 180ms ease, color 180ms ease;
    line-height: 1;
}
.pricing-toggle-btn.active {
    background: var(--accent);
    color: var(--on-accent);
}
/* Save badge: hidden by default, fades in when annual */
.pricing-save {
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    padding: 0.2rem 0.625rem;
    border-radius: 9999px;
    white-space: nowrap;
    background: var(--accent-soft-2);
    color: var(--accent-strong);
    opacity: 0;
    transition: opacity 200ms ease;
}
.pricing-save--ghost {
    visibility: hidden;
    pointer-events: none;
}
.pricing-toggle.annual ~ .pricing-save {
    opacity: 1;
}
/* On phones the ghost spacer and the badge do not both fit beside the toggle */
@media (max-width: 639px) {
    .pricing-save--ghost {
        display: none;
    }
}

/* Pricing card header: fixed height so feature lists align across cards */
.pricing-card-header {
    min-height: 10.5rem;
    margin-bottom: 0.75rem;
}

/* Pricing card base */
.pricing-card {
    transition: transform 300ms cubic-bezier(0.16, 1, 0.3, 1), box-shadow 300ms ease;
    transform-origin: center top;
}

/* Non-current cards: hover zooms in */
@media (min-width: 768px) {
    .pricing-card:not(.pricing-card--current):hover {
        transform: scale(1.03);
    }
}

/* Featured (recommended) card - subtle border when not current */
.pricing-card-featured:not(.pricing-card--current) {
    border-color: var(--accent);
}

/* Current plan: prominent scale, thick border, blue glow, no hover zoom */
.pricing-card.pricing-card--current {
    border: 3px solid var(--accent);
    box-shadow: var(--elev-2-hover);
}
@media (min-width: 768px) {
    .pricing-card.pricing-card--current {
        transform: scale(1.03);
    }
}

/* Recommended badge: blue, so the Growth card's one gold element is its checkout button (#1093) */
.pricing-badge {
    position: absolute;
    top: -0.75rem;
    left: 50%;
    transform: translateX(-50%);
    background: var(--accent);
    color: var(--on-accent);
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    padding: 0.25rem 0.875rem;
    border-radius: 9999px;
    white-space: nowrap;
}

/* Annual note: hidden by default, fades in */
.pricing-annual-note {
    opacity: 0;
    pointer-events: none;
    transition: opacity 200ms ease;
    min-height: 1.25rem;
}
.pricing-annual-note.visible {
    opacity: 1;
    pointer-events: auto;
}

/* Current plan indicator */
.pricing-current-label {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.375rem;
    font-size: 0.8125rem;
    font-weight: 700;
    color: var(--on-accent);
    background: var(--accent);
    border-radius: 9999px;
    padding: 0.5rem 1.25rem;
    width: 100%;
}
.pricing-status-label {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.375rem;
    font-size: 0.8125rem;
    font-weight: 600;
    border-radius: 9999px;
    padding: 0.5rem 1.25rem;
    width: 100%;
    border: 1.5px solid var(--line-strong);
    color: var(--accent-ink);
    background: var(--accent-soft);
}
a.pricing-status-label {
    transition: border-color 150ms ease, color 150ms ease;
    text-decoration: none;
}
a.pricing-status-label:hover {
    border-color: var(--accent);
    color: var(--accent-ink);
}

/* Wizard steppers on phones (`.steps-wizard`, the import and onboarding steppers): DaisyUI gives each step min-width
   4rem, so six onboarding dots need 384px and four labelled steps overlap. Drop the minimum and keep a label only on
   the current step (the number circles stay). Relies on every step up to the current one carrying `step-primary` and
   on labels being bare text in the `<li>`; `test_page_review_fixes.py` pins both in the templates. */
@media (max-width: 639px) {
    .steps-wizard .step {
        min-width: 0;
        font-size: 0;
    }
    .steps-wizard .step::after {
        font-size: 0.875rem;
    }
    .steps-wizard .step.step-primary:not(:has(~ .step-primary)) {
        font-size: 0.75rem;
        line-height: 1.25;
        overflow-wrap: anywhere;
    }
}

/* AI hub canvas (#1066): below lg the sidebar comes first and carries the new-conversation button, so the canvas card
stays hidden until a conversation is swapped into it, instead of a tall blank card. */
@media (max-width: 1023px) {
    .ai-canvas:has([data-canvas-empty]) { display: none; }
    .ai-canvas { scroll-margin-top: calc(var(--navbar-h, 4rem) + 1rem); }
}

/* Floating Q&A button: a compact circle (the .btn minimum width and padding made it a 96px pill that covered
   the score values on phones). */
.qa-fab {
    width: 2.5rem;
    height: 2.5rem;
    min-width: 0;
    min-height: 0;
    padding: 0;
}
@media (min-width: 640px) {
    .qa-fab {
        width: 3rem;
        height: 3rem;
    }
}
/* Room for the button on the page that carries it: the end of the page clears it everywhere, and from lg the
   content stops short of the button (right-4 plus 3rem wide, so 4rem from the edge, plus a gap), so it covers
   nothing at rest. The reserve shrinks by the margin beside the centred 80rem main column, so wide screens keep the
   content aligned with the header. 100vw includes a classic scrollbar, which makes that margin up to half a
   scrollbar too wide, so 0.5rem is held back from it. */
.qa-gutter {
    padding-bottom: 4.5rem;
}
@media (min-width: 1024px) {
    .qa-gutter {
        padding-inline-end: max(0px, 4.5rem - max(0px, (100vw - 80rem) / 2 - 0.5rem));
    }
}
