@import url('https://fonts.googleapis.com/css2?family=Inter+Tight:wght@400;500;600;700&display=swap');

/* ─────────────────────────────────────────────────────────────────────────────
   Tradability's visual identity - "Swiss Ledger Brutalism" (Design-MVP V3,
   bestätigte Gewinnrichtung, siehe docs/brand/BRAND.md)

   Der Markt, protokolliert wie ein Befund: eine einzige Mono-Schrift für
   alles (Überschrift, Fließtext, Zahl, UI), harte 1px-Linien statt Schatten
   als tragendes Strukturelement, keine gerundete Ecke irgendwo, gefüllte/
   hohle Quadrate als Status-Anzeige (● verfügbar / ○ geplant). Kein Glas,
   kein Foto, keine Collage - das Protokoll selbst ist der Auftritt.

   Regeln:
   - FARBE IST DATEN. Grün und Rot in Charts bedeuten gemessene Bewegung, sonst
     nichts. Der Akzent ist getrennt davon: ein Live-Punkt, eine Auswahl, ein
     Wort - nie ein Kurswert.
   - HARTE LINIE STATT SCHATTEN. Jede Fläche ist ein Rahmen mit 1px-Kante, nie
     ein Schlagschatten; jede Ecke ist eckig (--radius: 0).
   - KEINE DEKORATION OHNE FUNKTION. Kein Bild, das nur schmückt - Typografie,
     echte Daten und die Linie selbst tragen die Seite.

   Hell ist die Standardansicht. Dunkel ist dieselbe Fläche invertiert.
   [data-accent] tauscht nur die Akzentfarbe.
   ───────────────────────────────────────────────────────────────────────── */

:root,
:root[data-theme="light"] {
    --paper: #EEF1FB;
    --paper-raised: #FFFFFF;
    --paper-sunk: #E3E8F8;
    --ink: #0A1230;

    /* Drei Ebenen statt Schatten: Seite, Kachel, Unterfläche. */
    --surface-1: var(--paper);
    --surface-2: #E8ECFA;
    --surface-3: #E3E8F8;
    --hairline: 1px solid var(--border-subtle);
    --t-display: 600;
    --t-label-size: .6875rem;
    --t-label-track: .08em;
    --t-1: clamp(2.5rem, 5.5vw, 4.5rem);
    --dur-slow: 420ms;
    --ease-out: cubic-bezier(.16, 1, .3, 1);

    --app-background: var(--paper);
    --sidebar-background: var(--paper);
    --surface-base: var(--paper);
    --surface-raised: var(--paper-raised);
    --surface-hover: rgb(10 18 48 / 5%);
    --surface-inset: var(--paper-sunk);
    --border-subtle: #DCE2F4;
    --border-strong: #CBD3EE;
    --glass-edge: transparent;
    --text-primary: var(--ink);
    --text-secondary: #2B3763;
    --text-muted: #56628C;
    --text-faint: rgb(10 18 48 / 24%);
    --text-quiet: rgb(10 18 48 / 62%);
    --positive: #32734C;
    --negative: #AF453B;
    --warning: #B26B00;
    --info: #2F5BD9;
    --violet: #5B7CE0;
    --tan: var(--accent);
    --on-tan: var(--on-accent);
    --chart-grid: rgb(10 18 48 / 8%);
    --shadow-card: none;
    --shadow-glass: none;
    --shadow-paper: none;
    --glass-blur: none;
    --glow-1: transparent;
    --glow-2: transparent;
    --grid-line: rgb(10 18 48 / 7%);
    --brand-cobalt: var(--accent);
    --brand-ink: #0A1230;
    --brand-counter: var(--app-background);
    color-scheme: light;
}

:root[data-theme="dark"] {
    --paper: #0A1230;
    --paper-raised: #111C45;
    --paper-sunk: #1A2A63;
    --ink: #EEF2FF;

    /* Drei Ebenen statt Schatten: Seite, Kachel, Unterfläche. */
    --surface-1: var(--paper);
    --surface-2: #0E1838;
    --surface-3: #1A2A63;
    --hairline: 1px solid var(--border-subtle);
    --t-display: 600;
    --t-label-size: .6875rem;
    --t-label-track: .08em;
    --t-1: clamp(2.5rem, 5.5vw, 4.5rem);
    --dur-slow: 420ms;
    --ease-out: cubic-bezier(.16, 1, .3, 1);

    --app-background: var(--paper);
    --sidebar-background: var(--paper);
    --surface-base: var(--paper);
    --surface-raised: var(--paper-raised);
    --surface-hover: rgb(238 242 255 / 7%);
    --surface-inset: var(--paper-sunk);
    --border-subtle: #1B2860;
    --border-strong: #2A3A82;
    --glass-edge: transparent;
    --text-primary: var(--ink);
    --text-secondary: #C3CCEE;
    --text-muted: #9AA8D6;
    --text-faint: rgb(238 242 255 / 26%);
    --text-quiet: rgb(238 242 255 / 58%);
    --positive: #80C69B;
    --negative: #ED8E7A;
    --warning: #FFB340;
    --info: #6C9BFF;
    --violet: #8FA9FF;
    --tan: var(--accent);
    --on-tan: var(--on-accent);
    --chart-grid: rgb(238 242 255 / 9%);
    --shadow-card: none;
    --shadow-glass: none;
    --shadow-paper: none;
    --glass-blur: none;
    --glow-1: transparent;
    --glow-2: transparent;
    --grid-line: rgb(238 242 255 / 8%);
    --brand-cobalt: var(--accent);
    --brand-ink: #EEF2FF;
    --brand-counter: var(--app-background);
    color-scheme: dark;
}

/* Eine Akzentfarbe: Neon-Pink, dezent eingesetzt (Auswahl, Ziel, Hauptaktion). Der
   data-accent-Schlüssel "olive" ist historisch und bleibt, weil er so in Profilen und im
   localStorage steht - ein neuer Schlüssel würde jede gespeicherte Wahl verwerfen. */
:root,
:root[data-theme="light"][data-accent="olive"] {
    --accent: #E0127D;
    --accent-bright: #C4126B;
    --accent-soft: rgb(224 18 125 / 10%);
    --on-accent: #FFFFFF;
}

/* Im Dunkeln leuchtet das Pink, im Hellen ist es dunkler, damit Text lesbar bleibt. */
:root[data-theme="dark"],
:root[data-theme="dark"][data-accent="olive"] {
    --accent: #FF2E93;
    --accent-bright: #FF5BAA;
    --accent-soft: rgb(255 46 147 / 16%);
    --on-accent: #0A1230;
}

:root {
    /* Depot-Ring: vier Stufen derselben Akzentfarbe, gegen den Grund gemischt. */
    --alloc-1: var(--accent);
    --alloc-2: color-mix(in oklab, var(--accent), var(--app-background) 30%);
    --alloc-3: color-mix(in oklab, var(--accent), var(--app-background) 52%);
    --alloc-4: color-mix(in oklab, var(--accent), var(--app-background) 70%);
    --accent-2: var(--accent);
    --accent-2-soft: var(--accent-soft);

    /* Chart-Tokens (Namen wie bei bklit-ui/shadcn). --chart-1 ist die Serie, die zählt;
       Bewegung ist Tinte, nicht Grün/Rot: Anstieg bleibt Ink, Rückgang ist der Akzent. */
    --chart-1: var(--ink);
    --chart-2: var(--text-primary);
    --chart-3: var(--info);
    --chart-4: var(--warning);
    --chart-5: var(--violet);
    --chart-up: var(--positive);
    --chart-down: var(--negative);
    --chart-crosshair: var(--border-strong);
    --chart-label: var(--text-muted);

    /* Weiche Kanten: Kacheln 20px, kleine Elemente 12px, Aktionen als Pille. */
    --radius: 20px;
    --radius-sm: 12px;
    --radius-pill: 999px;

    /* Eine Schrift für alles: Inter Tight. Zahlen laufen mit gleich breiten Ziffern (tabular-nums),
       dafür braucht es keine zweite Familie. --font-mono bleibt als Name bestehen, zeigt aber auf
       dieselbe Schrift; nur die ASCII-Bilder setzen ihre eigene Monospace. */
    --font-display: 'Inter Tight', system-ui, sans-serif;
    --font-body: 'Inter Tight', system-ui, sans-serif;
    --font-mono: 'Inter Tight', system-ui, sans-serif;

    /* Ebenen: nur diese Werte, nirgends eine erfundene Zahl. */
    --z-base: 1;
    --z-sticky: 20;
    --z-overlay: 40;
    --z-modal: 60;
    --z-grain: 90;
    --z-toast: 1000;

    --ease-out: cubic-bezier(.16, 1, .3, 1);
    --ease-spring: cubic-bezier(.2, 1.1, .3, 1);
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    background: var(--app-background);
    min-width: 20rem;
    scroll-behavior: smooth;
}

body {
    background: var(--app-background);
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 16px;
    font-weight: 400;
    line-height: 1.55;
    margin: 0;
    min-height: 100vh;
    text-rendering: optimizeLegibility;
    transition: background-color .3s ease, color .3s ease;
    -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3 {
    font-family: var(--font-display);
    font-variant-numeric: lining-nums;
    font-weight: 700;
    letter-spacing: -.012em;
    line-height: 1.08;
    text-wrap: balance;
}

h2 {
    line-height: 1.16;
}

h3 {
    font-weight: 600;
    line-height: 1.24;
}

h1 {
    font-size: clamp(2rem, 3.6vw, 2.9rem);
}

h2 {
    font-size: 1.25rem;
}

h3 {
    font-size: .98rem;
}

/* Hervorhebung in einer Überschrift: derselbe Schnitt, nur der Akzent - keine Kursive,
   keine zweite Schriftfamilie. */
h1 em,
h2 em {
    font-style: normal;
    text-decoration: underline;
    text-decoration-color: var(--accent);
    text-decoration-thickness: 3px;
    text-underline-offset: .14em;
}

h1,
h2,
h3,
p {
    margin-top: 0;
}

p {
    text-wrap: pretty;
}

h1:focus,
h2:focus,
h3:focus {
    outline: none;
}

button,
input,
select,
textarea {
    font: inherit;
}

button,
a {
    -webkit-tap-highlight-color: transparent;
}

a {
    color: var(--text-primary);
    text-decoration-color: var(--accent);
    text-decoration-thickness: 1px;
    text-underline-offset: .2em;
}

a:hover {
    color: var(--text-primary);
    text-decoration-color: var(--accent);
    text-decoration-thickness: 2px;
}

/* Sichtbarer Fokus überall, nur für die Tastatur. */
:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

::selection {
    background: var(--accent);
    color: var(--on-accent);
}

.visually-hidden {
    border: 0 !important;
    clip: rect(0, 0, 0, 0) !important;
    height: 1px !important;
    margin: -1px !important;
    overflow: hidden !important;
    padding: 0 !important;
    position: absolute !important;
    white-space: nowrap !important;
    width: 1px !important;
}

.skip-link {
    background: var(--ink);
    color: var(--paper);
    font-size: .85rem;
    font-weight: 600;
    left: 1rem;
    border-radius: var(--radius-pill);
    padding: .6rem 1rem;
    position: fixed;
    text-decoration: none;
    top: -4rem;
    transition: top .2s var(--ease-out);
    z-index: var(--z-toast);
}

.skip-link:focus {
    color: var(--paper);
    top: 1rem;
}

/* Die eine Kachel, aus der jedes Panel besteht: weiche 20px-Ecke, feine Kante, kein
   Schatten. Die Ebene (heller als der Grund) trägt die Fläche. */
.dashboard-card,
.glass {
    background: var(--surface-raised);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius);
    box-shadow: var(--shadow-card);
    transition: background-color .25s var(--ease-out), border-color .25s var(--ease-out), transform .25s var(--ease-out), box-shadow .25s var(--ease-out);
}

/* Rubrik: kleines Label in Mono, ohne Zeichen davor. */
.eyebrow {
    align-items: baseline;
    color: var(--text-muted);
    display: flex;
    font-family: var(--font-body);
    font-size: .8rem;
    font-weight: 600;
    gap: .55rem;
    letter-spacing: 0;
    margin: 0;
}

.eyebrow::before {
    content: none;
}

.mono-number {
    font-family: var(--font-mono);
    font-size: .93em;
    font-variant-numeric: tabular-nums slashed-zero;
    letter-spacing: -.01em;
}

.positive {
    color: var(--positive) !important;
}

.negative {
    color: var(--negative) !important;
}

.neutral {
    color: var(--text-secondary) !important;
}

/* ── Protokoll-Bausteine (Swiss Ledger Brutalism) ─────────────────────────────
   Der gefüllte/hohle Quadrat-Status und die Index-Nummer sind das immer
   wiederkehrende Vokabular: "verfügbar" vs. "geplant", "01" vs. "02". Beide
   sind reine Utility-Klassen, damit jede Seite sie gleich benutzt. */
.sq {
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
    height: 8px;
    width: 8px;
}

.sq-live {
    background: var(--positive);
}

.sq-warn {
    background: var(--warning);
}

.sq-info {
    background: var(--info);
}

.sq-off {
    background: transparent;
    border: 1px solid var(--text-faint);
}

.sq-delay {
    background: linear-gradient(90deg, var(--text-muted) 50%, transparent 50%);
    border: 1px solid var(--text-muted);
}

.sq-synth {
    background: repeating-linear-gradient(45deg, var(--text-muted) 0 1.5px, transparent 1.5px 4px);
    border: 1px solid var(--text-muted);
}

/* Herkunftszeile (Premium-Kit 02) und Premium-Kurs (04) - beide nutzen dieselben
   Mono-/Label-Tokens wie der Rest des Protokolls, keine neue Schrift. */
.prov-line {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .25rem 1.1rem;
    font-family: var(--font-body);
    font-size: .8rem;
    letter-spacing: 0;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
}

.prov-line > span {
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    white-space: nowrap;
}

.quote-premium__value {
    font-size: var(--t-1);
    font-weight: var(--t-display);
    letter-spacing: -.03em;
    line-height: .95;
    font-variant-numeric: tabular-nums;
}

.quote-premium__unit {
    font-size: .28em;
    font-weight: 400;
    letter-spacing: .1em;
    color: var(--text-muted);
    vertical-align: .9em;
    margin-left: .4em;
}

.quote-premium__rule {
    width: 56px;
    border-top: var(--hairline);
    margin-block: .5rem .25rem;
}

.status {
    align-items: center;
    color: var(--text-muted);
    display: inline-flex;
    font-family: var(--font-body);
    font-size: .8rem;
    gap: .45rem;
    letter-spacing: 0;
}

.idx {
    color: var(--text-muted);
    font-weight: 700;
}

.label {
    color: var(--text-muted);
    font-size: .8rem;
    letter-spacing: 0;
}

.tnum {
    font-variant-numeric: tabular-nums;
}

/* Eine Abschnittszeile wie über einer Kurstabelle: Index links, Kontext rechts,
   eine harte Regel darüber trennt vom vorherigen Abschnitt. */
.section-index {
    align-items: baseline;
    border-top: 1px solid var(--border-subtle);
    color: var(--text-muted);
    display: flex;
    font-family: var(--font-body);
    font-size: .8rem;
    justify-content: space-between;
    letter-spacing: 0;
    margin-bottom: 1.6rem;
    padding-top: 1.4rem;
}

/* ── Bedienelemente ───────────────────────────────────────────────────────── */

.btn {
    align-items: center;
    background: var(--surface-raised);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-pill);
    color: var(--text-primary);
    cursor: pointer;
    display: inline-flex;
    font-family: var(--font-body);
    font-size: .9rem;
    font-weight: 600;
    gap: .5rem;
    justify-content: center;
    letter-spacing: 0;
    line-height: 1;
    min-height: 2.75rem;
    padding: .8rem 1.4rem;
    text-decoration: none;
    transition: background-color .2s var(--ease-out), border-color .2s var(--ease-out), color .2s var(--ease-out), transform .15s var(--ease-out);
    white-space: nowrap;
}

.btn:hover {
    background: var(--surface-3);
    color: var(--text-primary);
}

.btn:active:not(:disabled) {
    transform: scale(.98);
}

/* Die Hauptaktion: Pille in der Akzentfarbe. Pro Ansicht höchstens eine. */
.btn-primary {
    background: var(--accent);
    border-color: transparent;
    color: var(--on-accent);
}

.btn-primary:hover {
    background: var(--accent-bright);
    border-color: transparent;
    color: var(--on-accent);
}

.btn-outline {
    background: transparent;
}

/* Die zweite Aktion daneben: ohne Rand, nur Text auf der Ebene. */
.btn-ghost {
    background: transparent;
    border-color: transparent;
    color: var(--text-secondary);
    padding: .8rem 1.1rem;
}

.btn-ghost:hover {
    background: var(--surface-hover);
    color: var(--text-primary);
}

.btn:disabled {
    cursor: not-allowed;
    opacity: .45;
}

.valid.modified:not([type=checkbox]) {
    outline: 1px solid var(--positive);
}

.invalid {
    outline: 1px solid var(--negative);
}

.validation-message {
    color: var(--negative);
    font-size: .76rem;
}

.blazor-error-boundary {
    background: var(--surface-raised);
    border: 1px solid color-mix(in srgb, var(--negative) 45%, var(--border-subtle));
    border-radius: var(--radius-sm);
    color: var(--negative);
    padding: 1rem;
}

.blazor-error-boundary::after {
    content: "Dieser Bereich konnte nicht geladen werden.";
}

/* Entrances are finite Web Animations in js/motion.js. Content remains visible
   without JavaScript, observers or animation support; no persistent hidden state. */

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

/* ---- Gleit-Pille (js/pill.js) ----
   [data-pill] markiert eine Optionsgruppe. Der Hintergrund der aktiven Option liegt als
   ::before auf dem Container und fährt mit einer leichten Federung unter die neue Option.
   Die Buttons selbst bleiben transparent. Varianten: (leer) Pille, "soft" eckiger mit Rahmen,
   "line" Unterstrich. */
[data-pill] {
    --pill-x: 0px;
    --pill-y: 0px;
    --pill-w: 0px;
    --pill-h: 0px;
    --pill-bg: var(--surface-raised);
    --pill-ring: transparent;
    --pill-radius: var(--radius-pill);
    position: relative;
}

[data-pill]::before {
    background: var(--pill-bg);
    border-radius: var(--pill-radius);
    box-shadow: inset 0 0 0 1px var(--pill-ring);
    content: "";
    height: var(--pill-h);
    left: 0;
    opacity: 0;
    pointer-events: none;
    position: absolute;
    top: 0;
    transform: translate(var(--pill-x), var(--pill-y));
    transition:
        transform .42s var(--ease-spring),
        width .42s var(--ease-spring),
        height .3s var(--ease-out),
        opacity .2s ease;
    width: var(--pill-w);
    will-change: transform, width;
}

[data-pill].is-ready::before {
    opacity: 1;
}

[data-pill] > * {
    position: relative;
    z-index: 1;
}

[data-pill] > :is(.active, .is-on, .is-active, [aria-pressed="true"], [aria-selected="true"]) {
    background: transparent !important;
    border-color: transparent !important;
    box-shadow: none !important;
}

[data-pill].is-ready > button {
    transition: color .25s var(--ease-out), transform .15s var(--ease-out);
}

[data-pill].is-ready > button:active:not(:disabled) {
    transform: scale(.96);
}

/* Hauptnavigation: der Gleiter liegt auf --surface-3, liegt die aktive Seite im Dropdown,
   steht er unter dem Oberbegriff. */
.primary-nav[data-pill] {
    --pill-bg: var(--surface-3);
}

.primary-nav[data-pill] > .nav-more:has(.nav-more-panel.is-open) {
    z-index: 3;
}

.nav-more:has(.nav-item.active) > .nav-more-toggle {
    color: var(--text-primary);
    font-weight: 600;
}

[data-pill="soft"] {
    --pill-bg: var(--surface-3);
    --pill-radius: var(--radius-sm);
    --pill-ring: var(--border-strong);
}

[data-pill="line"] {
    --pill-bg: var(--accent);
    --pill-radius: 2px;
}

[data-pill="line"]::before {
    height: 2px;
    top: auto;
    bottom: -1px;
    transform: translateX(var(--pill-x));
}

/* .nav-item lives here, not in MainLayout.razor.css: NavLink does not forward
   Blazor's CSS-isolation scope attribute to its rendered <a>, so a scoped rule
   here would silently never match a real nav link. Pille: die aktive Seite liegt
   auf --surface-3, kein Unterstrich, keine Nummern. */
.nav-item {
    align-items: center;
    background: transparent;
    border: 0;
    border-radius: var(--radius-pill);
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    font-family: var(--font-body);
    font-size: .9rem;
    font-weight: 500;
    gap: .4rem;
    letter-spacing: 0;
    padding: .5rem .95rem;
    position: relative;
    text-decoration: none;
    transition: color .2s var(--ease-out), background-color .2s var(--ease-out);
    white-space: nowrap;
}

.nav-item:hover:not(:disabled) {
    background: var(--surface-hover);
    color: var(--text-primary);
}

.nav-item.active {
    background: var(--surface-3);
    color: var(--text-primary);
    font-weight: 600;
}

.nav-item.planned {
    cursor: not-allowed;
    opacity: .6;
}

/* Im "Mehr"-Dropdown und im mobilen Menü füllt jeder Punkt die volle Breite. */
.nav-more-panel .nav-item,
.primary-nav.is-open .nav-item {
    border-radius: var(--radius-sm);
    justify-content: space-between;
    padding: .65rem .85rem;
    width: 100%;
}

.nav-item .n {
    display: none;
}

.nav-item small {
    background: var(--surface-3);
    border: 0;
    border-radius: var(--radius-pill);
    color: var(--text-muted);
    font-family: var(--font-mono);
    font-size: .62rem;
    font-weight: 500;
    letter-spacing: .04em;
    line-height: 1;
    margin-left: auto;
    padding: .28rem .5rem;
    text-transform: uppercase;
}

/* Blazor WASM's own crash banner - hidden by default (Blazor's runtime clears this
   `display: none` when an unhandled exception/render error actually happens). Without
   this rule the element is visible from first paint, since nothing else sets it. */
#blazor-error-ui {
    background: var(--surface-raised);
    border-radius: var(--radius) var(--radius) 0 0;
    border-top: 2px solid var(--negative);
    bottom: 0;
    box-shadow: none;
    color: var(--text-primary);
    display: none;
    font-size: .84rem;
    left: 0;
    padding: .8rem 3rem .8rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: var(--z-toast);
}

#blazor-error-ui .reload {
    color: var(--accent);
    margin-left: .6rem;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 1rem;
    top: .75rem;
}

/* Login.razor.css/Register.razor.css use InputText/ValidationMessage (framework
   built-in components) for these - like NavLink (see the .nav-item rule above),
   their rendered <input>/<div> never receives the calling component's CSS
   isolation scope attribute, so a scoped rule targeting them silently never
   matches. Verified by inspecting the live DOM: the <input> from <InputText>
   carries no b-xxxxxxxxxx attribute, only its plain-HTML siblings do. */
.field input {
    background: var(--surface-inset);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font: inherit;
    font-size: .95rem;
    padding: .72rem .8rem;
    transition: border-color .18s ease, box-shadow .18s ease;
    width: 100%;
}

.field input:hover {
    border-color: var(--text-muted);
}

.field input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px var(--accent-soft);
    outline: none;
}

/* Shared across every page using the "auth-page" layout (Login, Register, Profile,
   WalletPair, WalletConfirm) - lives here rather than in one of those components'
   scoped .razor.css files because Blazor's CSS isolation means a scoped rule only
   ever applies to markup the OWNING component renders. */
.auth-page {
    margin: 0 auto;
    max-width: 27rem;
    padding: clamp(2rem, 7vh, 4rem) 1.4rem 3rem;
}

.auth-page header a {
    color: var(--text-muted);
    font-size: .82rem;
    font-weight: 500;
    letter-spacing: 0;
    text-decoration: none;
}

.auth-page header a:hover {
    color: var(--text-primary);
}

.auth-page h1 {
    font-size: clamp(2rem, 4.4vw, 2.7rem);
    margin: 1.1rem 0 .6rem;
}

.auth-page header p {
    color: var(--text-muted);
    font-size: .9rem;
    line-height: 1.6;
    margin: 0 0 1.6rem;
}

/* Kein Kasten, kein Rand: das Formular liegt flach auf demselben Blatt wie alles
   andere - erst die Felder selbst (siehe .field input) markieren eine Fläche. */
.auth-panel {
    padding: 0;
}

.auth-panel .field {
    display: flex;
    flex-direction: column;
    gap: .4rem;
    margin-bottom: 1.15rem;
}

.auth-panel .field label {
    color: var(--text-primary);
    font-size: .8rem;
    font-weight: 600;
    letter-spacing: 0;
    text-transform: none;
}

.auth-error {
    background: color-mix(in srgb, var(--negative) 12%, transparent);
    border-radius: var(--radius-sm);
    color: var(--negative);
    font-size: .82rem;
    line-height: 1.55;
    list-style: none;
    margin: 0 0 1.1rem;
    padding: .6rem .7rem;
}

.auth-switch {
    color: var(--text-muted);
    font-size: .86rem;
    margin-top: 1.3rem;
}

.auth-panel button {
    background: var(--accent);
    border: 0;
    border-radius: var(--radius-pill);
    color: var(--on-accent);
    cursor: pointer;
    font-size: .9rem;
    font-weight: 600;
    padding: .95rem 1.2rem;
    transition: background-color .18s ease, transform .12s ease;
    width: 100%;
}

.auth-panel button:hover {
    background: var(--accent-bright);
    color: var(--on-accent);
}

.auth-panel button:active {
    transform: translateY(1px);
}

/* Same cross-component scoping gap as above. */
.page-state {
    color: var(--text-muted);
    font-size: .88rem;
}

/* ── Seitenkopf ──────────────────────────────────────────────────────────────
   Überschrift und Absatz, keine Bildmarke: das Protokoll trägt sich selbst. */
.page-header-row {
    align-items: flex-start;
    display: flex;
    gap: 1.6rem;
    justify-content: space-between;
}

.page-header-text {
    min-width: 0;
}

/* Opt-in ASCII identities: illustration beside the introduction, never on a chart. */
.page-header-row.has-ascii { align-items: center; }
.page-header-row.has-ascii .page-header-text { flex: 1 1 0; }
@media (max-width: 700px) {
    .page-header-row.has-ascii { flex-direction: column; gap: .75rem; }
    .page-header-row.has-ascii .page-header-text { flex-basis: auto; }
}

/* ── Höhenlinien ─────────────────────────────────────────────────────────────
   Muster unter dem Mauszeiger (Einstellungen → Hintergrund), im Ruhezustand
   unsichtbar. Die Linien sind nur Maske; die Farbe kommt aus der Akzentfarbe.
   Liegt fest hinter der ganzen Seite; die Hüllen der Layouts liegen darüber und
   haben dafür einen transparenten Grund. */
.topo {
    inset: 0;
    opacity: 0;
    pointer-events: none;
    position: fixed;
    transition: opacity .8s ease;
    z-index: 0;
    --ax: -9999px;
    --ay: -9999px;
    --bx: -9999px;
    --by: -9999px;
    -webkit-mask-image:
        radial-gradient(circle 60px at var(--ax) var(--ay),
            #000 0%, rgb(0 0 0 / 82%) 20%, rgb(0 0 0 / 52%) 42%, rgb(0 0 0 / 24%) 66%, rgb(0 0 0 / 7%) 86%, transparent 100%),
        radial-gradient(circle 90px at var(--bx) var(--by),
            rgb(0 0 0 / 55%) 0%, rgb(0 0 0 / 30%) 38%, rgb(0 0 0 / 10%) 70%, transparent 100%);
    mask-image:
        radial-gradient(circle 60px at var(--ax) var(--ay),
            #000 0%, rgb(0 0 0 / 82%) 20%, rgb(0 0 0 / 52%) 42%, rgb(0 0 0 / 24%) 66%, rgb(0 0 0 / 7%) 86%, transparent 100%),
        radial-gradient(circle 90px at var(--bx) var(--by),
            rgb(0 0 0 / 55%) 0%, rgb(0 0 0 / 30%) 38%, rgb(0 0 0 / 10%) 70%, transparent 100%);
}

.topo.is-on {
    opacity: 1;
}

.topo-lines {
    background: var(--text-muted);
    inset: 0;
    opacity: .2;
    position: absolute;
    -webkit-mask: url("img/topo.svg") center / cover no-repeat;
    mask: url("img/topo.svg") center / cover no-repeat;
}

:root[data-bg="stroemung"] .topo-lines {
    -webkit-mask-image: url("img/pattern-stroemung.svg");
    mask-image: url("img/pattern-stroemung.svg");
}

:root[data-bg="raster"] .topo-lines {
    -webkit-mask-image: url("img/pattern-raster.svg");
    mask-image: url("img/pattern-raster.svg");
}

:root[data-bg="kurslinien"] .topo-lines {
    -webkit-mask-image: url("img/pattern-kurslinien.svg");
    mask-image: url("img/pattern-kurslinien.svg");
}

:root[data-bg="aus"] .topo {
    display: none;
}

:root[data-theme="dark"] .topo-lines {
    opacity: .32;
}

/* Kein Hovern auf Touch: dort bleibt die Ebene schlicht aus. */
@media (hover: none) {
    .topo {
        display: none;
    }
}

/* Zähler für ungelesene Nachrichten: Navigation und Freundesliste teilen sich denselben. */
.unread-badge {
    background: var(--surface-3);
    border-radius: 999px;
    color: var(--text-primary);
    display: inline-block;
    font-size: .68rem;
    font-weight: 700;
    line-height: 1;
    margin-left: .45rem;
    min-width: 1.15rem;
    padding: .2rem .38rem;
    text-align: center;
    vertical-align: middle;
}

/* Seitenköpfe mit ASCII-Hintergrund: eigener Stapel, Bild ragt nicht über den Kopf hinaus. */
.has-ascii {
    min-height: 11rem;
    position: relative;
}

.page-note { color: var(--text-muted); font-size: .85rem; margin-top: .6rem; }
.page-note > summary { cursor: pointer; width: fit-content; }
.page-note > p { margin: .5rem 0 0; max-width: 40rem; }

/* Icons in der Navigation: im Dropdown und im mobilen Menü immer, in der Kopfzeile erst, wenn
   genug Platz ist (sonst läuft sie über). */
.nav-item > .icon { color: var(--text-muted); flex: none; }
.nav-item:hover > .icon,
.nav-item.active > .icon,
.nav-more:has(.nav-item.active) > .nav-more-toggle > .icon { color: var(--accent); }
.primary-nav:not(.is-open) > .nav-item > .icon,
.primary-nav:not(.is-open) > .nav-more > .nav-more-toggle > .icon { display: none; }
@media (min-width: 1560px) {
    .primary-nav:not(.is-open) > .nav-item > .icon,
    .primary-nav:not(.is-open) > .nav-more > .nav-more-toggle > .icon { display: inline-block; }
}
.nav-more-panel .nav-item,
.primary-nav.is-open .nav-item { gap: .65rem; justify-content: flex-start; }
.nav-more-panel .nav-item small,
.primary-nav.is-open .nav-item small { margin-left: auto; }

/* Kopfzeilen-Rollen: eigene Fläche, Schrift und aktive Fläche, damit Paletten mit dunkler Kopfzeile
   im Hellmodus (z. B. Crème & Navy) funktionieren. Pinktuell: Hell weiß, Dunkel wie der Grund. */
:root {
    --header-background: var(--paper-raised);
    --header-foreground: var(--ink);
    --header-active-background: var(--paper-sunk);
}

:root[data-theme="dark"] {
    --header-background: var(--paper);
    --header-foreground: var(--ink);
    --header-active-background: var(--paper-sunk);
}

body { font-variant-numeric: tabular-nums; }

/* Breite Tabellen scrollen in ihrer Hülle, statt die Seite zu verbreitern. */
.table-scroll { max-width: 100%; overflow-x: auto; }
