/* ── Hoppe.home Portal — Shared Frame CSS ──────────────────── */

/* ── Cascade layer ─────────────────────────────────────────────────────────
   Everything below is in the `hh.frame` layer. portal-ui.css is NOT layered,
   and unlayered normal declarations beat layered ones at ANY specificity, so
   the precedence is now a stated fact rather than an accident of which file
   the browser happened to read second:

       hh.frame  (this file)   the shell
       unlayered (portal-ui)   the components   -- always wins over the frame
       unlayered (page <style>)                 -- wins by source order, last

   This is why this file no longer needs a single `!important`. Thirteen of
   them existed to beat page-local copies of the sidebar; those copies were
   removed on 2026-09-05 and the layer makes sure the frame can never
   out-specify the component layer again.

   The page tier is deliberately NOT a third layer yet. Making it one would
   promote every page-local rule above portal-ui.css at any specificity, and
   34 pages still carry their own `.card`-family rules -- some would silently
   restyle. That is the next step, after those are swept, not this one. */
/* Declared here, in the file the browser reads first, so the order is a fact
   rather than a consequence of which stylesheet happened to load second. */
/* Three layers, in this order. hh.page is where every page's own <style>
   block now lives -- see the wrap in each page. Before 2026-09-06 those
   blocks were UNLAYERED, and an unlayered declaration beats every layer at
   any specificity: fourteen pages carried `* { margin:0; padding:0 }`, which
   is specificity ZERO and still stripped the padding off every sidebar row
   that portal-ui.css had set. That is the ~21px menu Joern kept seeing on
   some pages and not others -- the difference was simply whether the page
   had a reset. Layered, the reset loses to `.sidebar .nav-item` on
   specificity, which is the behaviour everyone assumes CSS already has. */
@layer hh.frame, hh.components, hh.page;

@layer hh.frame {

/* One template, all pages. Do NOT add page-specific rules here. */


:root {
    --bg:#0d1014; --surface:#151a20; --card:#1a2027; --card-hover:#222932;
    --topbar:#0d1014; --page-grad-start:#12161b; --page-grad-end:#0d1014;
    --text:#e9eef4; --strong:#ffffff; --muted:#a4afbc;
    --accent:#4a9eff; --accent-lt:rgba(74,158,255,0.15); --accent-hov:#2e86eb;
    --border:#2d3641;
    --ok:#3fb950; --warn:#f0b429; --err:#ff5a64;
    --ok-bg:rgba(63,185,80,0.13); --warn-bg:rgba(240,180,41,0.13); --err-bg:rgba(255,90,100,0.15);
    --shadow:0 4px 16px rgba(0,0,0,0.5); --shadow-sm:0 1px 6px rgba(0,0,0,0.4);
    --shadow-md:0 10px 28px rgba(0,0,0,0.55); --radius:12px;
}
[data-theme="light"] {
    --bg:#e4e9ef; --surface:#edf1f5; --card:#fafbfd; --card-hover:#f0f3f8;
    --topbar:#d4dce6; --page-grad-start:#e9edf2; --page-grad-end:#e4e9ef;
    --text:#16202b; --strong:#0a1118; --muted:#46556a;
    --accent:#176cc8; --accent-lt:rgba(23,108,200,0.12); --accent-hov:#0e59a7;
    --border:#c3ccd8;
    --ok:#187a37; --warn:#9a6100; --err:#c43831;
    --ok-bg:rgba(24,122,55,0.12); --warn-bg:rgba(154,97,0,0.12); --err-bg:rgba(196,56,49,0.12);
    --shadow:0 4px 16px rgba(18,44,80,0.14); --shadow-sm:0 1px 6px rgba(18,44,80,0.1);
    --shadow-md:0 10px 28px rgba(18,44,80,0.14);
}
[data-theme="horde"] {
    --bg:#120d0e; --surface:#1b1415; --card:#201819; --card-hover:#2a2022;
    --topbar:#120d0e; --page-grad-start:#181112; --page-grad-end:#120d0e;
    --text:#f1eaea; --strong:#ffffff; --muted:#b3a6a7;
    --accent:#e24444; --accent-lt:rgba(226,68,68,0.2); --accent-hov:#ff5c5c;
    --border:#3f3033;
    --ok:#7ed957; --warn:#ff9e2c; --err:#ff5a5a;
    --ok-bg:rgba(126,217,87,0.13); --warn-bg:rgba(255,158,44,0.13); --err-bg:rgba(255,90,90,0.15);
    --shadow:0 4px 16px rgba(0,0,0,0.5); --shadow-sm:0 1px 6px rgba(0,0,0,0.4);
    --shadow-md:0 10px 28px rgba(0,0,0,0.55);
}
[data-theme="horde-light"] {
    --bg:#efe7e7; --surface:#f6f0f0; --card:#fffcfc; --card-hover:#fff3f3;
    --topbar:#e6dcdc; --page-grad-start:#f3ecec; --page-grad-end:#efe7e7;
    --text:#2a1618; --strong:#150a0b; --muted:#6b4a4d;
    --accent:#d63030; --accent-lt:rgba(214,48,48,0.15); --accent-hov:#b91e1e;
    --border:#d9c4c5;
    --ok:#187a37; --warn:#9a6100; --err:#c43831;
    --ok-bg:rgba(24,122,55,0.12); --warn-bg:rgba(154,97,0,0.12); --err-bg:rgba(196,56,49,0.12);
    --shadow:0 4px 16px rgba(120,10,10,0.12); --shadow-sm:0 1px 6px rgba(120,10,10,0.08);
    --shadow-md:0 10px 28px rgba(120,10,10,0.14);
}
[data-theme="fusion"] {
    --bg:#1d2230; --surface:#222b3d; --card:#202a3a; --card-hover:#28354a;
    --topbar:#1a2232; --page-grad-start:#1f283a; --page-grad-end:#231724;
    --text:#dbe6f4; --strong:#ffffff; --muted:#8fa1ba;
    --accent:#7653ff; --accent-lt:rgba(118,83,255,.18); --accent-hov:#6240ec;
    --border:#3b3f66;
    --ok:#3fb950; --warn:#f0b429; --err:#ff6a62;
    --ok-bg:rgba(63,185,80,.13); --warn-bg:rgba(240,180,41,.13); --err-bg:rgba(248,81,73,.13);
    --shadow:0 4px 16px rgba(20,10,30,.42); --shadow-sm:0 1px 6px rgba(20,10,30,.36);
    --shadow-md:0 10px 28px rgba(20,10,30,.45);
}

/* Personal themes (Joern, 2026-10-20): private to one person each, never offered to anyone else.
   Colours come from the e-mail kit THEMES (hoppe_email_kit.py ceo / cfo / gamer) so Portal and mail match.
   The same values live in auth-gate.js CANONICAL_THEME_TOKENS; tests/person-themes.test.mjs keeps the two in step. */
[data-theme="ceo"] {
    --bg:#0d0d0f; --surface:#161619; --card:#1a1a1e; --card-hover:#222227;
    --topbar:#0d0d0f; --page-grad-start:#141417; --page-grad-end:#0d0d0f;
    --text:#ececf0; --strong:#ffffff; --muted:#a4a4ae;
    --accent:#e11d2a; --accent-lt:rgba(225,29,42,0.18); --accent-hov:#c4161f;
    --border:#33333a;
    --ok:#3fb950; --warn:#f0b429; --err:#ff5a64;
    --ok-bg:rgba(63,185,80,0.13); --warn-bg:rgba(240,180,41,0.13); --err-bg:rgba(255,90,100,0.15);
    --shadow:0 4px 16px rgba(0,0,0,0.55); --shadow-sm:0 1px 6px rgba(0,0,0,.45);
    --shadow-md:0 10px 28px rgba(0,0,0,.6);
}
[data-theme="cfo"] {
    --bg:#0d1118; --surface:#141a24; --card:#18202c; --card-hover:#1e2836;
    --topbar:#0d1118; --page-grad-start:#111823; --page-grad-end:#0d1118;
    --text:#e4ebf4; --strong:#ffffff; --muted:#a0adbf;
    --accent:#2e86eb; --accent-lt:rgba(46,134,235,0.18); --accent-hov:#4a9eff;
    --border:#2b3849;
    --ok:#3fb950; --warn:#f0b429; --err:#f85149;
    --ok-bg:rgba(63,185,80,0.13); --warn-bg:rgba(240,180,41,0.13); --err-bg:rgba(248,81,73,0.15);
    --shadow:0 4px 16px rgba(0,0,0,0.5); --shadow-sm:0 1px 6px rgba(0,0,0,0.4);
    --shadow-md:0 10px 28px rgba(0,0,0,0.55);
}
[data-theme="modern"] {
    --bg:#0e0c15; --surface:#171420; --card:#1c1926; --card-hover:#252132;
    --topbar:#0e0c15; --page-grad-start:#15121e; --page-grad-end:#0e0c15;
    --text:#ece9f5; --strong:#ffffff; --muted:#aba5c4;
    --accent:#7c3aed; --accent-lt:rgba(124,58,237,0.22); --accent-hov:#6d28d9;
    --border:#362f4f;
    --ok:#3fd98a; --warn:#f0b429; --err:#ff6b7a;
    --ok-bg:rgba(63,217,138,0.13); --warn-bg:rgba(240,180,41,0.13); --err-bg:rgba(255,107,122,0.15);
    --shadow:0 4px 16px rgba(10,5,30,0.55); --shadow-sm:0 1px 6px rgba(10,5,30,0.45);
    --shadow-md:0 10px 28px rgba(10,5,30,0.6);
}
/* Donny's second personal theme (Joern, 2026-11-02): the Morning Picks pink -- accent #d6336c is hoppe_email_kit.py THEMES["pink"], on the CEO ladder. */
[data-theme="pink"] {
    --bg:#140d11; --surface:#1d1419; --card:#221820; --card-hover:#2b1e26;
    --topbar:#140d11; --page-grad-start:#1a1015; --page-grad-end:#140d11;
    --text:#f3eaef; --strong:#ffffff; --muted:#b9a5af;
    --accent:#d6336c; --accent-lt:rgba(214,51,108,0.2); --accent-hov:#a02255;
    --border:#412e38;
    --ok:#3fb950; --warn:#f0b429; --err:#ff5a64;
    --ok-bg:rgba(63,185,80,0.13); --warn-bg:rgba(240,180,41,0.13); --err-bg:rgba(255,90,100,0.15);
    --shadow:0 4px 16px rgba(0,0,0,0.5); --shadow-sm:0 1px 6px rgba(0,0,0,0.4);
    --shadow-md:0 10px 28px rgba(0,0,0,0.55);
}

/* ══ DESIGN TOKENS v2 (portal-core, 2026-10-21) ══════════════════════════════
   The one place shared semantic tokens are defined. Every page, in every theme
   (dark light horde horde-light fusion ceo cfo modern pink), may rely on these; do
   not redefine them per page. Derived tokens use color-mix() on the theme's
   own base tokens, so a new theme inherits them with no extra work and
   auth-gate.js (which only sets the base tokens) needs no change.

   Base (per theme)   --bg --surface --card --card-hover --topbar --text --strong --muted
                      --accent --accent-lt --accent-hov --border --ok --warn --err
                      --ok-bg --warn-bg --err-bg --shadow --shadow-sm --shadow-md
   Ink on accent      --on-accent        text/icon colour for a filled --accent area (AA where possible)
                      --on-status        ink for a filled --err/--warn/--ok area;  --lit  pure highlight (same in all themes)
   Surfaces           --surface-raised   a step above --card (menus, popovers, hovered cards)
                      --surface-sunk     a step below --card (inputs, code, wells)
                      --overlay          dialog backdrop
   Glass              --glass-pane --glass-solid --glass-sunk --glass-edge --glass-edge-strong
                      --glass-hair --glass-blur --glass-blur-soft --glass-blur-chrome --glass-sat
                      --glass-lift --glass-lift-hi
   Elevation          --elev-0 (none) --elev-1 --elev-2 --elev-3 --elev-4
   Focus              --focus-ring (full outline shorthand) --focus-color --focus-offset
   Status             --ok --warn --err (alias --crit, legacy --danger)   foreground, use on --card / --surface
                      --ok-bg --warn-bg --err-bg (--crit-bg) --info --info-bg  tinted chip fills
                      --ok-line --warn-line --err-line (--crit-line) --info-line  tinted borders
   Type               --font-sans --font-mono  --fs-2xs --fs-xs --fs-sm --fs-base --fs-md --fs-lg
                      --fs-xl --fs-2xl (fluid)  --lh-tight --lh-base --lh-loose  --fw-regular/-medium/-bold
   Radius             --radius (12px, legacy) --radius-xs --radius-sm --radius-md --radius-lg --radius-xl --radius-pill
   Space              --space-1 .. --space-8 (4px steps, rem)
   Motion             --dur-fast --dur --dur-slow --ease --ease-out   (all collapse to ~0 under prefers-reduced-motion)
   Layout             --content-max (readable max width for centred pages)
   Media stage        --stage --stage-2 (always-dark surfaces) --stage-ink --stage-ink-muted (their text) --scrim
   Text-safe (AA) text  --accent-text --ok-text --warn-text --err-text --muted-text  (+ chip aliases --accent-ink --ok-ink --warn-ink --err-ink)
   Charts             --grid --chart-grid --chart-axis   --cat-1..--cat-8 (series)   Misc  --glass --shade --shadow-ink
   Text safety        --link --link-visited --link-hover  (global `a` rule below: no browser-default purple, any theme)
   Categorical        --cat-blue --cat-green --cat-amber --cat-red --cat-violet --cat-cyan --cat-slate  (legends, section identity, chart series; never status)
   Hard-coded colours belong in this block and in the theme blocks above, nowhere else. */
:root {
    color-scheme: dark;
    --on-accent:#06101e; --on-status:#06101e; --lit:#ffffff;
    --surface-raised:color-mix(in srgb,var(--card) 86%,white);
    --surface-sunk:color-mix(in srgb,var(--surface) 70%,black);
    --overlay:color-mix(in srgb,black 62%,transparent);

    --elev-0:none; --elev-1:var(--shadow-sm); --elev-2:var(--shadow); --elev-3:var(--shadow-md);
    --elev-4:0 22px 60px color-mix(in srgb,black 48%,transparent);

    --focus-color:var(--accent); --focus-offset:2px;
    --focus-ring:2px solid var(--focus-color);

    --crit:var(--err); --crit-bg:var(--err-bg);
    --danger:var(--err); --danger-bg:var(--err-bg);   /* legacy alias used by older pages */
    --info:var(--accent); --info-bg:var(--accent-lt);
    --ok-line:color-mix(in srgb,var(--ok) 38%,transparent);
    --warn-line:color-mix(in srgb,var(--warn) 42%,transparent);
    --err-line:color-mix(in srgb,var(--err) 42%,transparent);
    --crit-line:var(--err-line);
    --info-line:color-mix(in srgb,var(--accent) 42%,transparent);

    /* Media stage (lightbox, theatre, hero banners): always dark whatever the theme, so photos/video read true. */
    --stage:color-mix(in srgb,var(--bg) 14%,black);
    --stage-2:color-mix(in srgb,var(--accent) 16%,var(--stage));
    --stage-ink:#e8f0f9; --stage-ink-muted:#9db3cc;
    --scrim:color-mix(in srgb,black 55%,transparent);
    /* Text-safe variants: use these (not the raw colour) for small TEXT on --card/--surface/tinted chips. */
    --accent-text:color-mix(in srgb,var(--accent) 65%,var(--text));
    --ok-text:color-mix(in srgb,var(--ok) 60%,var(--text));
    --warn-text:color-mix(in srgb,var(--warn) 55%,var(--text));
    --err-text:color-mix(in srgb,var(--err) 60%,var(--text));
    --muted-text:color-mix(in srgb,var(--muted) 80%,var(--text));
    --accent-ink:var(--accent-text); --ok-ink:var(--ok-text); --warn-ink:var(--warn-text); --err-ink:var(--err-text);
    /* Charts */
    --grid:color-mix(in srgb,var(--border) 60%,transparent);
    --chart-grid:var(--grid); --chart-axis:var(--muted-text);
    /* Categorical series 1..8 (explicit hues; the light themes get darker variants below). */
    --cat-1:var(--accent); --cat-2:var(--ok); --cat-3:var(--warn); --cat-4:var(--err);
    --cat-5:#a78bfa; --cat-6:#22d3ee; --cat-7:#f472b6; --cat-8:#8fa3bf;
    /* Misc */
    --glass:var(--glass-pane); --shade:color-mix(in srgb,black 30%,transparent); --shadow-ink:black;
    --link:color-mix(in srgb,var(--accent) 62%,var(--strong));   /* AA on --card/--bg in all themes (same formula portal-ui.css proved) */
    --link-visited:color-mix(in srgb,var(--link) 78%,var(--muted));
    --link-hover:var(--strong);

    /* Categorical hues for legends, section identity and chart series. Meaning-free (never use for status). */
    --cat-blue:var(--accent); --cat-green:var(--ok); --cat-amber:var(--warn); --cat-red:var(--err);
    --cat-violet:#a78bfa; --cat-cyan:#22d3ee; --cat-slate:#8fa3bf;

    --font-sans:"Segoe UI",-apple-system,Helvetica,Arial,sans-serif;
    --font-mono:ui-monospace,"Cascadia Mono","Cascadia Code",Consolas,"SFMono-Regular",monospace;
    --fs-2xs:.6875rem; --fs-xs:.75rem; --fs-sm:.8125rem; --fs-base:.875rem; --fs-md:1rem;
    --fs-lg:clamp(1.0625rem,1rem + .3vw,1.25rem);
    --fs-xl:clamp(1.25rem,1.05rem + .9vw,1.75rem);
    --fs-2xl:clamp(1.5rem,1.15rem + 1.6vw,2.375rem);
    --lh-tight:1.2; --lh-base:1.5; --lh-loose:1.7;
    --fw-regular:400; --fw-medium:500; --fw-bold:700;

    --radius-xs:4px; --radius-sm:7px; --radius-md:10px; --radius-lg:14px; --radius-xl:20px; --radius-pill:999px;
    --space-1:.25rem; --space-2:.5rem; --space-3:.75rem; --space-4:1rem;
    --space-5:1.5rem; --space-6:2rem; --space-7:3rem; --space-8:4rem;

    --dur-fast:120ms; --dur:200ms; --dur-slow:320ms;
    --ease:cubic-bezier(.2,.7,.2,1); --ease-out:cubic-bezier(.16,1,.3,1);
    --content-max:min(100%,1440px);

    /* Glass: derived from the theme, moved here from portal-ui.css so every
       Portal-family page can use it with this file alone. */
    --glass-blur:18px; --glass-blur-soft:10px; --glass-blur-chrome:24px; --glass-sat:155%;
    --glass-pane:color-mix(in srgb,var(--card) 72%,transparent);
    --glass-solid:color-mix(in srgb,var(--card) 90%,transparent);
    --glass-sunk:color-mix(in srgb,var(--surface) 66%,transparent);
    --glass-edge:color-mix(in srgb,white 16%,transparent);
    --glass-edge-strong:color-mix(in srgb,white 24%,transparent);
    --glass-hair:color-mix(in srgb,var(--border) 82%,transparent);
    --glass-lift:0 12px 38px color-mix(in srgb,black 38%,transparent),0 2px 6px color-mix(in srgb,black 24%,transparent);
    --glass-lift-hi:var(--elev-4);
}
[data-theme="light"],[data-theme="horde-light"] {
    color-scheme:light;
    --surface-raised:color-mix(in srgb,var(--card) 70%,white);
    --surface-sunk:color-mix(in srgb,var(--surface) 88%,black);
    --overlay:color-mix(in srgb,var(--text) 45%,transparent);
    --elev-4:0 16px 44px color-mix(in srgb,var(--text) 20%,transparent);
    --glass-pane:color-mix(in srgb,var(--card) 62%,transparent);
    --glass-solid:color-mix(in srgb,var(--card) 88%,transparent);
    --glass-sunk:color-mix(in srgb,var(--surface) 60%,transparent);
    --glass-edge:color-mix(in srgb,white 72%,transparent);
    --glass-edge-strong:color-mix(in srgb,white 92%,transparent);
    --glass-lift:0 8px 28px color-mix(in srgb,var(--text) 14%,transparent),0 1px 2px color-mix(in srgb,var(--text) 8%,transparent);
    --on-accent:#ffffff; --on-status:#ffffff;
    --cat-violet:#6d4fd6; --cat-cyan:#0e7490; --cat-slate:#51647f;
    --cat-5:#6d4fd6; --cat-6:#0e7490; --cat-7:#be185d; --cat-8:#51647f;
    --shadow-ink:color-mix(in srgb,var(--text) 70%,black);
}
[data-theme="fusion"],[data-theme="ceo"],[data-theme="modern"],[data-theme="pink"] { --on-accent:#ffffff; }
[data-theme="dark"],[data-theme="horde"],[data-theme="cfo"] { --on-accent:#06101e; }

@media (prefers-reduced-motion:reduce) {
    :root { --dur-fast:.01ms; --dur:.01ms; --dur-slow:.01ms; }
    *,*::before,*::after { animation-duration:.01ms !important; animation-iteration-count:1 !important;
        transition-duration:.01ms !important; scroll-behavior:auto !important; }
}

/* Links: tokenised unvisited / visited / hover for every page and theme. :where() keeps specificity at zero,
   so every component class (.btn, .nav-item, .chip, ...) still wins. Fixes the browser-default visited purple
   (e.g. wiki.html intro link on dark themes, 2026-10-21). */
:where(a:link){color:var(--link);}
:where(a:visited){color:var(--link-visited);}
:where(a:link:hover,a:visited:hover){color:var(--link-hover);}
:where(a){text-underline-offset:2px;}

/* One focus ring for every interactive element, in every theme. */
:where(a,button,input,select,textarea,summary,[tabindex]):focus-visible {
    outline:var(--focus-ring); outline-offset:var(--focus-offset);
}
@media (forced-colors:active) {
    :where(a,button,input,select,textarea,summary,[tabindex]):focus-visible { outline:2px solid Highlight; }
    .card,.kpi,.banner,.btn,.menu-panel,.user-chip { border:1px solid CanvasText; }
}

/* Skip link (first tab stop of every page) and the visually-hidden helper. Moved here from portal-ui.css
   2026-10-21 so pages that load only the frame (media, music, speech) get them too. */
.skip-to-main {
    position:absolute; left:12px; top:-60px; z-index:4000;
    padding:10px 16px; border-radius:var(--radius-md);
    background:var(--card); color:var(--strong); border:1px solid var(--accent);
    font-size:var(--fs-sm); font-weight:var(--fw-bold); text-decoration:none;
    box-shadow:var(--glass-lift); transition:top var(--dur) var(--ease);
}
.skip-to-main:focus { top:12px; }
.sr-only {
    position:absolute !important; width:1px; height:1px;
    padding:0; margin:-1px; overflow:hidden;
    clip:rect(0 0 0 0); clip-path:inset(50%); white-space:nowrap; border:0;
}

*{box-sizing:border-box;margin:0;padding:0;}
body{font-family:var(--font-sans);font-size:var(--fs-base);
    background:linear-gradient(160deg,var(--page-grad-start) 0%,var(--page-grad-end) 100%) fixed;
    color:var(--text);min-height:100vh;display:flex;}

/* ── Sidebar ─── */
/* Tokens, not hex. These four rules hard-coded the August pale-blue panel, so
   the frame's own fallback looked wrong on four of the five themes whenever
   portal-ui.css was slow, cached out, or (as happened) not being served at all.
   portal-ui.css still owns the glass treatment on top. */
.sidebar{background:var(--surface);border-right:1px solid var(--border);width:292px;
    height:100vh;min-height:100vh;flex-shrink:0;display:flex;flex-direction:column;
    position:fixed;left:0;top:0;z-index:3000;box-shadow:2px 0 18px color-mix(in srgb,black 14%,transparent);overflow:hidden;}
.brand-block{display:flex;align-items:center;gap:12px;padding:11px 12px;margin:12px;
    border-radius:10px;border:1px solid var(--border);
    background:linear-gradient(180deg,color-mix(in srgb,var(--card) 92%,transparent),color-mix(in srgb,var(--surface) 92%,transparent));
    box-shadow:inset 0 1px 0 var(--glass-edge),0 8px 20px color-mix(in srgb,black 18%,transparent);}
.brand-text{line-height:1.1;}
.brand-name{font-size:20px;font-weight:800;color:var(--strong);}
.brand-name span{color:var(--accent);}
.brand-sub{font-size:12px;text-transform:uppercase;letter-spacing:.10em;color:var(--muted);margin-top:4px;}
.sidebar-nav{flex:1;min-height:0;max-height:100%;overflow-y:auto;overflow-x:hidden;padding:8px 0 16px;overscroll-behavior:contain;scrollbar-width:thin;scrollbar-color:var(--border) transparent;}
.sidebar-nav::-webkit-scrollbar{width:11px}
.sidebar-nav::-webkit-scrollbar-track{background:transparent}
.sidebar-nav::-webkit-scrollbar-thumb{background:color-mix(in srgb,var(--border) 75%,transparent);border:2px solid transparent;background-clip:padding-box;border-radius:999px}
.sidebar-nav::-webkit-scrollbar-thumb:hover{background:color-mix(in srgb,var(--accent) 60%,var(--border));border:2px solid transparent;background-clip:padding-box}
.nav-grp-hd{padding:12px 16px 4px;font-size:10px;text-transform:uppercase;letter-spacing:.10em;font-weight:700;color:var(--muted);}
.nav-item{display:flex;align-items:center;gap:9px;padding:9px 16px;margin:1px 8px;border-radius:7px;
    font-size:15px;font-weight:500;color:var(--text);text-decoration:none;border:1px solid transparent;cursor:pointer;
    transition:background .15s ease,color .15s ease;}
.nav-item:hover{background:transparent;color:var(--strong);}
.nav-item.active{background:var(--accent-lt);color:var(--strong);border-left:3px solid var(--accent);padding-left:13px;font-weight:700;}
.nav-item.sub-item{padding-left:32px;font-size:14px;}
.nav-main{justify-content:space-between;font-weight:700;color:var(--text);}
.menu-section.expanded > .nav-main{color:var(--strong);}
.menu-section > .nav-main:hover{color:var(--strong);}
.nav-main .nav-main-left{display:inline-flex;align-items:center;gap:9px;}
.nav-chevron{display:inline-block;transition:transform .2s ease;color:var(--muted);font-size:12px;}
.menu-section.expanded > .nav-main:not(.nav-direct) .nav-chevron{transform:rotate(90deg);color:var(--strong);}
.menu-submenu{display:none;}
.menu-section.expanded > .menu-submenu{display:block;}
.nav-icon{font-size:18px;width:22px;text-align:center;flex-shrink:0;}

/* The canonical sidebar lock lived here: thirteen !important rules whose only
   job was to beat page-local copies of the sidebar. 2026-09-05 removed the
   copies instead -- 184 shell rules across 11 pages -- so the lock has nothing
   left to fight, and portal-ui.css now owns how the sidebar looks.

   It had to go for a second reason. With cascade layers, an !important
   declaration in an EARLIER layer beats one in a later layer. Leaving these
   here would have inverted the whole design system the moment @layer was
   introduced: the frame would have won every contested sidebar rule against
   portal-ui.css, silently.

   The .hoppe-h-icon rules went with it -- that class has no users left; the
   mark is the brick-built <svg><use href="#pi-hmark"> now. */

.sidebar-footer{padding:12px 16px;margin-top:auto;border-top:1px solid var(--border);}
.env-badge{width:8px;height:8px;border-radius:50%;background:var(--muted);display:inline-block;margin:4px 8px;box-shadow:0 0 6px var(--accent);transition:background .3s;}
.theme-btn{margin-top:10px;width:100%;padding:7px 12px;background:transparent;border:1px solid var(--border);
    border-radius:7px;color:var(--muted);font-size:12px;font-family:inherit;cursor:pointer;text-align:left;
    transition:border-color .15s,color .15s;}
.theme-btn:hover{border-color:var(--accent);color:var(--strong);}

/* ── Main ─── */
.main{margin-left:292px;flex:1;display:flex;flex-direction:column;min-height:100vh;}
.page-header{padding:56px 36px 0;}
.page-title{font-size:28px;font-weight:800;color:var(--strong);}
.page-subtitle{margin-top:6px;font-size:14px;color:var(--muted);}
.tile-actions{display:flex;align-items:center;gap:8px;margin-bottom:12px;flex-wrap:wrap;}
.shell-tools:not(.topbar){position:fixed;top:10px;right:16px;z-index:200;display:flex;align-items:center;justify-content:flex-end;gap:8px;}
.shell-tools:not(.topbar) .back-btn{order:1;}
.shell-tools:not(.topbar) .user-menu{order:2;}
.topbar.shell-tools{position:static;top:auto;right:auto;z-index:auto;}
.back-btn{padding:7px 12px;}
.user-menu{position:relative;}
.user-chip{display:inline-flex;align-items:center;gap:7px;padding:7px 12px;background:var(--surface);
    color:var(--text);border:1px solid var(--border);border-radius:8px;cursor:pointer;font-size:12px;font-weight:600;box-shadow:var(--shadow-sm);white-space:nowrap;}
.user-chip:hover{border-color:var(--accent);background:var(--accent-lt);color:var(--strong);}
.menu-panel{display:none;position:absolute;right:0;top:calc(100% + 6px);width:240px;background:var(--card);
    border:1px solid var(--border);border-radius:10px;box-shadow:var(--shadow-md);padding:8px;z-index:210;}
.menu-section-divider{font-size:9px;font-weight:800;text-transform:uppercase;letter-spacing:.10em;color:var(--muted);padding:10px 8px 4px;border-top:1px solid var(--border);margin-top:4px;}
.menu-section-divider:first-of-type{border-top:none;margin-top:0;padding-top:4px;}
.menu-panel.open{display:block;}
.menu-user{font-size:12px;color:var(--strong);padding:8px 8px 10px;border-bottom:1px solid var(--border);margin-bottom:6px;}
.menu-item{display:block;width:100%;text-align:left;background:transparent;color:var(--text);border:1px solid transparent;
    border-radius:7px;padding:8px;font-size:12px;cursor:pointer;text-decoration:none;}
.menu-item:hover{background:var(--accent-lt);border-color:var(--border);}
.content{padding:24px 36px 108px;flex:1;}

/* ── Shared utilities ──────────────────────────────────────── */
.btn{display:inline-flex;align-items:center;gap:6px;padding:8px 12px;background:var(--accent);color:var(--on-accent);
  border-radius:7px;text-decoration:none;font-size:13px;font-weight:600;font-family:inherit;border:0;cursor:pointer}
.btn:hover{background:var(--accent-hov)}
.btn.secondary{background:transparent;border:1px solid var(--border);color:var(--text)}
.btn.secondary:hover{border-color:var(--accent);background:var(--accent-lt);color:var(--strong)}
.banner{margin:0 0 14px;padding:10px 14px;border:1px solid var(--border);border-radius:10px;
  background:var(--surface);font-size:12px;line-height:1.5}
.banner.ok{border-color:var(--ok-line);color:var(--ok)}
.banner.warn{border-color:var(--warn-line);color:var(--warn)}
.banner.err{border-color:var(--err-line);color:var(--err)}
.hamburger{display:none;position:fixed;top:12px;left:12px;z-index:3010;background:var(--topbar);
    border:1px solid var(--border);border-radius:8px;padding:8px 10px;cursor:pointer;font-size:18px;color:var(--text);}
.sidebar-backdrop{display:none;position:fixed;inset:0;background:var(--overlay);z-index:2990;}
@media(max-width:780px){
    .sidebar{transform:translateX(-100%);transition:transform .25s ease;}
    .sidebar.open{transform:translateX(0);}.sidebar-backdrop.open{display:block;}
    .hamburger{display:flex;align-items:center;}.main{margin-left:0;}
    .page-header,.content,footer{padding-left:20px;padding-right:20px;}
    footer{position:static;left:auto;right:auto;bottom:auto;margin-top:20px;}
    .content{padding-bottom:24px;}
}
/* — 640px: large phones / small tablets portrait — */
@media(max-width:640px){
    .page-header{padding-left:16px;padding-right:16px;}
    .page-title{font-size:23px;}
    .content{padding-left:16px;padding-right:16px;}
    .tile-actions{flex-wrap:wrap;gap:6px;}
}
/* — 480px: small phones — */
@media(max-width:480px){
    .page-header{padding-top:48px;padding-left:12px;padding-right:12px;}
    .page-title{font-size:19px;}
    .page-subtitle{font-size:12px;}
    .content{padding-left:12px;padding-right:12px;padding-bottom:16px;}
    .tile-actions{gap:4px;}
    .btn{padding:7px 10px;font-size:12px;}
    footer{padding:5px 12px;font-size:10px;}
}
/* — 1400px: wide desktop — */
@media(min-width:1400px){
    .sidebar{width:308px;}
    .main{margin-left:308px;}
    footer{left:308px;}
    .page-header{padding-left:52px;padding-right:52px;}
    .content{padding-left:52px;padding-right:52px;}
}
/* — 1800px: ultrawide — */
@media(min-width:1800px){
    .page-header{padding-left:80px;padding-right:80px;}
    .content{padding-left:80px;padding-right:80px;}
}

footer{position:fixed;bottom:0;left:292px;right:0;padding:6px 20px;font-size:11px;color:var(--muted);border-top:1px solid var(--border);background:color-mix(in srgb,var(--topbar) 92%,transparent);backdrop-filter:blur(4px);display:flex;justify-content:space-between;align-items:center;flex-wrap:wrap;gap:8px;z-index:55;}
.footer-brand{display:inline-flex;align-items:center;gap:8px;}
.footer-brand svg{width:20px;height:20px;flex:0 0 auto;}
/* Pages that declare data-portal-shell="none" (the front door, the public
   /home//joern//joanna/ pages, download pages, standalone widgets — the same
   set stale-code-monitor.sh's is_standalone_page() exempts from shell checks)
   have no sidebar to reserve 292px for and are plain scrolling documents, not
   an app shell with a fixed status bar. The bare footer{} rule above still
   matched their <footer> element regardless — an element selector has no
   idea which page it landed on — so it pinned itself to the viewport bottom
   over whatever content was scrolled underneath, with the reserved 292px gap
   on the left (meant for a sidebar that was never rendered) showing the page
   behind straight through. Found 2026-09-18 on /home/, still visible after
   the footer's own content was fixed, because the actual bug was position,
   not content. Every standalone page defines its OWN local footer{...} for
   padding/spacing (see e.g. home/index.html's footer.site-footer) but none
   of them reset position, because nothing told them they needed to. */
html[data-portal-shell="none"] footer{
  position:static;left:auto;right:auto;bottom:auto;
  backdrop-filter:none;
}

/* Opt-in: <html data-footer="flow">. The standard footer flows as the last
   row of the document instead of being a fixed status bar. For pages with no
   sidebar to reserve 292px for (redirect stubs, "moved" notes, documents) and
   for pages that scroll as long documents. body is a flex row in this frame, so
   it becomes a column here, otherwise the footer would sit BESIDE the content.
   Pages without the attribute are untouched (fixed bar above 1000px). */
html[data-footer="flow"] body{flex-direction:column;}
html[data-footer="flow"] footer{
  position:static;left:auto;right:auto;bottom:auto;
  backdrop-filter:none;margin-top:24px;align-self:stretch;
}

/* ── Network section tab bar ──────────────────────────────────────────
   2026-08-16: was defined inline in network/index.html only (and twice
   in that one file, so the second block silently won). The four Network
   sub-pages carried no tab bar at all, which meant clicking a tab
   stranded you with no way across the section except the sidebar. Moved
   here so all five Network pages share one definition and the section
   reads as a single tabbed surface. */
.network-submenu { display: flex; gap: 4px; margin: 0 0 18px; flex-wrap: wrap; }
.network-submenu .sub-link {
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    color: var(--muted);
    text-decoration: none;
    border: 1px solid transparent;
    transition: background .12s, color .12s;
}
.network-submenu .sub-link:hover { background: var(--accent-lt); color: var(--strong); }
.network-submenu .sub-link.active {
    background: var(--accent-lt);
    border-color: var(--accent);
    color: var(--strong);
}

}
