/* Darstellung Hell, Dunkel, System (Paket T0). Eine Schicht semantischer Tokens über den bestehenden Familien (Kern/ruhe, Architect, Spiel, Diagramm, SOC, Szenen, PDF).
   Aufbau: 1 Hell (Standard, Werte gleich den bisherigen Kern-Tokens, ein Test hält beide gleich), 2 Dunkel (Marine statt Schwarz), 3 Zuordnung auf die bestehenden Namen,
   4 Kern (Kopf, Navigation, Flächen, Text, Rahmen, Fokus), 5 Logo. Zuordnung alt zu neu: docs/DESIGN_TOKENS_THEME.md.
   Auswahl: data-theme="light" oder "dark" am html-Element (serverseitig, nur bei gewählter Darstellung); ohne Attribut gilt "System" (prefers-color-scheme).
   Dunkel steht deshalb zweimal (Media-Query und data-theme="dark"); ein Test hält beide Blöcke gleich. PDF, Druck und E-Mail bleiben hell (eigene Stylesheets mit color-scheme: light). */

/* ---------- 1 Hell: Vokabular ---------- */
:root {
  color-scheme: light;
  /* Flächen */
  --surface-canvas: #f7f8fc;
  --surface-card: #ffffff;
  --surface-raised: #eef0fb;
  --surface-accent-soft: #eef0ff;
  --surface-inverse: #101334;
  /* Text */
  --text-primary: #101334;
  --text-secondary: #505575;
  --text-on-accent: #ffffff;
  --text-link: #0e24ea;
  /* Rahmen */
  --border-subtle: #e4e7f2;
  /* Management-Bloecke (Mockup): Beschriftungsgrau, Kartenrahmen, Trennlinie */
  --mg-muted: #4a4f7a;
  --mg-line: #d8dbee;
  --mg-hair: #e6e8f4;
  --border-strong: #c9cee3;
  --border-control: #767c9f;
  /* Akzent (Elektro-Blau) */
  --accent-text: #0e24ea;
  --accent-fill: #0e24ea;
  --accent-fill-hover: #0a1bb8;
  --accent-line: #aab2f3;
  /* Zustände: Text, Fläche (Balken, Segmente), Hinweisfläche, Hinweisrand, Hinweistext. Zustand nie nur durch Farbe: Wort, Form oder Muster bleiben Pflicht. */
  --status-ok: #1c7a54;
  --status-warn: #8a5600;
  --status-crit: #b3261e;
  --status-neutral: #4f5472;
  --status-ok-fill: #1c7a54;
  --status-warn-fill: #c98a1b;
  --status-crit-fill: #b3261e;
  --status-ok-bg: #eaf5ef;
  --status-warn-bg: #fbf3dd;
  --status-crit-bg: #fbecea;
  --status-info-bg: #eef0ff;
  --status-ok-line: #bfdccb;
  --status-warn-line: #ecd9a4;
  --status-crit-line: #efc4bf;
  --status-info-line: #d3d8fb;
  --status-ok-ink: #14573c;
  --status-warn-ink: #6b4300;
  --status-crit-ink: #8f1d17;
  --status-info-ink: #101334;
  /* Fokus */
  --focus-ring: #0e24ea;
  --focus-ring-on-shell: #cfd5ff;
  /* Kopfband und Leiste (bleiben in beiden Darstellungen Marine) */
  --shell-a: #0b0f33;
  --shell-b: #121c78;
  --shell-current: #e3e7fd;
  /* Diagramme (Spiegel: src/domain/diagram.ts DG_TOKENS und diagramm.css) */
  --chart-ink: #101334;
  --chart-muted: #484d6b;
  --chart-surface: #ffffff;
  --chart-axis: #767c9f;
  --chart-grid: #e3e7f3;
  --chart-track: #e3e6f3;
  --chart-cat-1: #0e24ea;
  --chart-cat-2: #c77700;
  --chart-cat-3: #00929f;
  --chart-cat-4: #6728c2;
  --chart-cat-5: #d6336c;
  --chart-cat-6: #2f86e0;
  --chart-cat-7: #3f9a2b;
  --chart-cat-other: #6b7194;
  --chart-seq-0: #eef0fb;
  --chart-seq-1: #4f63e7;
  --chart-seq-2: #3a4bd4;
  --chart-seq-3: #2a34b8;
  --chart-seq-4: #1d2394;
  --chart-seq-5: #121a6e;
  --chart-div-neg2: #9c5600;
  --chart-div-neg1: #bf7a10;
  --chart-div-mid: #e3e7f3;
  --chart-div-pos1: #6f82f0;
  --chart-div-pos2: #0e24ea;
  --chart-status-kritisch: #8a1424;
  --chart-status-hoch: #c9460c;
  --chart-status-mittel: #aa8600;
  --chart-status-niedrig: #2f6fd0;
  --chart-status-ok: #1c7a54;
  --chart-status-ne: #6b7194;
  /* Schatten: hell durch Schlagschatten, dunkel durch Flächenabstufung (Schatten fällt weg) */
  --shadow-float: 0 18px 40px rgba(0, 0, 8, 0.35);
}

/* ---------- 2 Dunkel: Marine statt Schwarz, Akzent aufgehellt, Gold eine Stufe abgedunkelt (E11) ---------- */
@media screen and (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    color-scheme: dark;
    --surface-canvas: #0b0f2c;
    --surface-card: #131839;
    --surface-raised: #1b2150;
    --surface-accent-soft: #1c2466;
    --surface-inverse: #070a1f;
    --text-primary: #eceefd;
    --text-secondary: #b3b9e0;
    --text-on-accent: #ffffff;
    --text-link: #aab4ff;
    --border-subtle: #262d63;
    --mg-muted: var(--text-secondary);
    --mg-line: var(--border-subtle);
    --mg-hair: var(--border-subtle);
    --border-strong: #3a4285;
    --border-control: #7e88c4;
    --accent-text: #9aa8ff;
    --accent-fill: #3447e8;
    --accent-fill-hover: #4a5cf0;
    --accent-line: #5360c7;
    --status-ok: #5fd6a0;
    --status-warn: #f0b95c;
    --status-crit: #ff938b;
    --status-neutral: #a7aed6;
    --status-ok-fill: #2fae7a;
    --status-warn-fill: #b0820f;
    --status-crit-fill: #dc3c4a;
    --status-ok-bg: #123629;
    --status-warn-bg: #3a2b0c;
    --status-crit-bg: #44191b;
    --status-info-bg: #1c2466;
    --status-ok-line: #2c6b53;
    --status-warn-line: #7a5f1a;
    --status-crit-line: #8a3a3f;
    --status-info-line: #3d4896;
    --status-ok-ink: #a6ecc9;
    --status-warn-ink: #f6d594;
    --status-crit-ink: #ffc2bd;
    --status-info-ink: #dfe3ff;
    --focus-ring: #b3beff;
    --focus-ring-on-shell: #cfd5ff;
    --shell-a: #070a1f;
    --shell-b: #0e1654;
    --shell-current: #1f2760;
    --chart-ink: #eceefd;
    --chart-muted: #b3b9e0;
    --chart-surface: #131839;
    --chart-axis: #8d93c0;
    --chart-grid: #262d63;
    --chart-track: #262d63;
    --chart-cat-1: #5b70f5;
    --chart-cat-2: #c4820a;
    --chart-cat-3: #1aa5b5;
    --chart-cat-4: #a06be0;
    --chart-cat-5: #e0588a;
    --chart-cat-6: #3f96e6;
    --chart-cat-7: #4fa83e;
    --chart-cat-other: #9aa0c8;
    --chart-seq-0: #1b2150;
    --chart-seq-1: #5266e0;
    --chart-seq-2: #6e81f4;
    --chart-seq-3: #8d9ef9;
    --chart-seq-4: #b0bbfc;
    --chart-seq-5: #d4d9fe;
    --chart-div-neg2: #f0b050;
    --chart-div-neg1: #c98a2e;
    --chart-div-mid: #2b3270;
    --chart-div-pos1: #5a6df0;
    --chart-div-pos2: #9aaaff;
    --chart-status-kritisch: #d9304a;
    --chart-status-hoch: #f08c3a;
    --chart-status-mittel: #f2d058;
    --chart-status-niedrig: #6fa0f2;
    --chart-status-ok: #4cc38f;
    --chart-status-ne: #9aa0c8;
    --shadow-float: none;
  }
}
@media screen {
:root[data-theme="dark"] {
  color-scheme: dark;
  --surface-canvas: #0b0f2c;
  --surface-card: #131839;
  --surface-raised: #1b2150;
  --surface-accent-soft: #1c2466;
  --surface-inverse: #070a1f;
  --text-primary: #eceefd;
  --text-secondary: #b3b9e0;
  --text-on-accent: #ffffff;
  --text-link: #aab4ff;
  --border-subtle: #262d63;
  --mg-muted: var(--text-secondary);
  --mg-line: var(--border-subtle);
  --mg-hair: var(--border-subtle);
  --border-strong: #3a4285;
  --border-control: #7e88c4;
  --accent-text: #9aa8ff;
  --accent-fill: #3447e8;
  --accent-fill-hover: #4a5cf0;
  --accent-line: #5360c7;
  --status-ok: #5fd6a0;
  --status-warn: #f0b95c;
  --status-crit: #ff938b;
  --status-neutral: #a7aed6;
  --status-ok-fill: #2fae7a;
  --status-warn-fill: #b0820f;
  --status-crit-fill: #dc3c4a;
  --status-ok-bg: #123629;
  --status-warn-bg: #3a2b0c;
  --status-crit-bg: #44191b;
  --status-info-bg: #1c2466;
  --status-ok-line: #2c6b53;
  --status-warn-line: #7a5f1a;
  --status-crit-line: #8a3a3f;
  --status-info-line: #3d4896;
  --status-ok-ink: #a6ecc9;
  --status-warn-ink: #f6d594;
  --status-crit-ink: #ffc2bd;
  --status-info-ink: #dfe3ff;
  --focus-ring: #b3beff;
  --focus-ring-on-shell: #cfd5ff;
  --shell-a: #070a1f;
  --shell-b: #0e1654;
  --shell-current: #1f2760;
  --chart-ink: #eceefd;
  --chart-muted: #b3b9e0;
  --chart-surface: #131839;
  --chart-axis: #8d93c0;
  --chart-grid: #262d63;
  --chart-track: #262d63;
  --chart-cat-1: #5b70f5;
  --chart-cat-2: #c4820a;
  --chart-cat-3: #1aa5b5;
  --chart-cat-4: #a06be0;
  --chart-cat-5: #e0588a;
  --chart-cat-6: #3f96e6;
  --chart-cat-7: #4fa83e;
  --chart-cat-other: #9aa0c8;
  --chart-seq-0: #1b2150;
  --chart-seq-1: #5266e0;
  --chart-seq-2: #6e81f4;
  --chart-seq-3: #8d9ef9;
  --chart-seq-4: #b0bbfc;
  --chart-seq-5: #d4d9fe;
  --chart-div-neg2: #f0b050;
  --chart-div-neg1: #c98a2e;
  --chart-div-mid: #2b3270;
  --chart-div-pos1: #5a6df0;
  --chart-div-pos2: #9aaaff;
  --chart-status-kritisch: #d9304a;
  --chart-status-hoch: #f08c3a;
  --chart-status-mittel: #f2d058;
  --chart-status-niedrig: #6fa0f2;
  --chart-status-ok: #4cc38f;
  --chart-status-ne: #9aa0c8;
  --shadow-float: none;
}
:root[data-theme="light"] { color-scheme: light; }
}

/* ---------- 3 Zuordnung auf die bestehenden Namen (nur im Dunkeln; im Hellen gelten die Definitionen in app.css und ruhe.css unverändert) ---------- */
@media screen and (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --ground: var(--surface-canvas); --canvas: var(--surface-canvas);
    --surface: var(--surface-card); --card: var(--surface-card);
    --ink: var(--text-primary); --ink-soft: var(--text-secondary); --muted: var(--text-secondary);
    --rule: var(--border-subtle); --hairline: var(--border-subtle); --line: var(--border-subtle); --line-strong: var(--border-strong);
    --control: var(--border-control);
    --brand: var(--accent-text); --link: var(--text-link); --accent: var(--accent-text); --brand-dark: var(--accent-fill-hover);
    --accent-soft: var(--surface-accent-soft); --focus: var(--focus-ring);
    --ok: var(--status-ok); --warn: var(--status-warn); --crit: var(--status-crit); --ne: var(--status-neutral);
    --pastel-ok: var(--status-ok-bg); --pastel-warn: var(--status-warn-bg); --pastel-crit: var(--status-crit-bg); --pastel-info: var(--status-info-bg);
    --sh-a: var(--shell-a); --sh-b: var(--shell-b); --sh-cur: var(--shell-current); --sh-focus: var(--focus-ring-on-shell);
  }
}
@media screen {
:root[data-theme="dark"] {
  --ground: var(--surface-canvas); --canvas: var(--surface-canvas);
  --surface: var(--surface-card); --card: var(--surface-card);
  --ink: var(--text-primary); --ink-soft: var(--text-secondary); --muted: var(--text-secondary);
  --rule: var(--border-subtle); --hairline: var(--border-subtle); --line: var(--border-subtle); --line-strong: var(--border-strong);
  --control: var(--border-control);
  --brand: var(--accent-text); --link: var(--text-link); --accent: var(--accent-text); --brand-dark: var(--accent-fill-hover);
  --accent-soft: var(--surface-accent-soft); --focus: var(--focus-ring);
  --ok: var(--status-ok); --warn: var(--status-warn); --crit: var(--status-crit); --ne: var(--status-neutral);
  --pastel-ok: var(--status-ok-bg); --pastel-warn: var(--status-warn-bg); --pastel-crit: var(--status-crit-bg); --pastel-info: var(--status-info-bg);
  --sh-a: var(--shell-a); --sh-b: var(--shell-b); --sh-cur: var(--shell-current); --sh-focus: var(--focus-ring-on-shell);
}
}

/* ---------- 4 Kern im Dunkeln: Kopf, Navigation, Flächen, Text, Rahmen, Fokus (nur Stellen mit festen Farben; alles andere folgt den Tokens oben) ---------- */
@media screen and (prefers-color-scheme: dark) {
  :root:not([data-theme]) { scrollbar-color: var(--border-control) var(--surface-canvas); }
  :root:not([data-theme]) body { background: var(--surface-canvas); color: var(--text-primary); }
  :root:not([data-theme]) ::selection { background: var(--accent-line); color: var(--text-primary); }
  :root:not([data-theme]) .btn:hover { background: var(--surface-raised); }
  :root:not([data-theme]) .btn-primary { background: var(--accent-fill); border-color: var(--accent-fill); color: var(--text-on-accent); }
  :root:not([data-theme]) .btn-primary:hover { background: var(--accent-fill-hover); border-color: var(--accent-fill-hover); }
  :root:not([data-theme]) .ledger tbody tr:hover td { background: var(--surface-raised); }
  :root:not([data-theme]) .topbar { background-color: var(--surface-card); }
  :root:not([data-theme]) .rail { background-color: var(--surface-card); }
  :root:not([data-theme]) .notice-ok { background: var(--status-ok-bg); border-color: var(--status-ok-line); color: var(--status-ok-ink); }
  :root:not([data-theme]) .notice-info { background: var(--status-info-bg); border-color: var(--status-info-line); color: var(--status-info-ink); }
  :root:not([data-theme]) .notice-warn { background: var(--status-warn-bg); border-color: var(--status-warn-line); color: var(--status-warn-ink); }
  :root:not([data-theme]) .notice-error { background: var(--status-crit-bg); border-color: var(--status-crit-line); color: var(--status-crit-ink); }
  :root:not([data-theme]) .demo-note { color: var(--status-warn); }
  :root:not([data-theme]) .skip-link { background: var(--surface-card); color: var(--text-primary); }
}
@media screen {
:root[data-theme="dark"] { scrollbar-color: var(--border-control) var(--surface-canvas); }
:root[data-theme="dark"] body { background: var(--surface-canvas); color: var(--text-primary); }
:root[data-theme="dark"] ::selection { background: var(--accent-line); color: var(--text-primary); }
:root[data-theme="dark"] .btn:hover { background: var(--surface-raised); }
:root[data-theme="dark"] .btn-primary { background: var(--accent-fill); border-color: var(--accent-fill); color: var(--text-on-accent); }
:root[data-theme="dark"] .btn-primary:hover { background: var(--accent-fill-hover); border-color: var(--accent-fill-hover); }
:root[data-theme="dark"] .ledger tbody tr:hover td { background: var(--surface-raised); }
:root[data-theme="dark"] .topbar { background-color: var(--surface-card); }
:root[data-theme="dark"] .rail { background-color: var(--surface-card); }
:root[data-theme="dark"] .notice-ok { background: var(--status-ok-bg); border-color: var(--status-ok-line); color: var(--status-ok-ink); }
:root[data-theme="dark"] .notice-info { background: var(--status-info-bg); border-color: var(--status-info-line); color: var(--status-info-ink); }
:root[data-theme="dark"] .notice-warn { background: var(--status-warn-bg); border-color: var(--status-warn-line); color: var(--status-warn-ink); }
:root[data-theme="dark"] .notice-error { background: var(--status-crit-bg); border-color: var(--status-crit-line); color: var(--status-crit-ink); }
:root[data-theme="dark"] .demo-note { color: var(--status-warn); }
:root[data-theme="dark"] .skip-link { background: var(--surface-card); color: var(--text-primary); }
}

/* ---------- 5 Logo: Marke dunkel auf hellem Grund, weiß auf dunklem Grund (Partial logo-marke.ejs, zwei Bilder, eines sichtbar) ---------- */
.logo-fuer-dunkel { display: none; }
@media screen and (prefers-color-scheme: dark) {
  :root:not([data-theme]) .logo-fuer-hell { display: none; }
  :root:not([data-theme]) .logo-fuer-dunkel { display: inline-block; }
}
@media screen {
:root[data-theme="dark"] .logo-fuer-hell { display: none; }
:root[data-theme="dark"] .logo-fuer-dunkel { display: inline-block; }
}

/* ---------- 6 Auswahl "Darstellung wählen" (Partial darstellung-waehlen.ejs) ---------- */
.dst { margin: 0; padding: 0; border: 0; min-width: 0; }
.dst legend { padding: 0 0 8px; font-weight: 600; }
.dst-optionen { display: inline-flex; flex-wrap: wrap; gap: 0; border: 1px solid var(--border-control); border-radius: 10px; overflow: hidden; }
.dst-optionen label { position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; min-width: 44px; padding: 0 16px; cursor: pointer; color: var(--text-primary); font-weight: 500; }
.dst-optionen label + label { border-left: 1px solid var(--border-control); }
.dst-optionen label { scroll-margin-top: 96px; touch-action: manipulation; }
.dst-optionen input { position: absolute; inset: 0; margin: 0; opacity: 0; cursor: pointer; }
.dst-optionen label:has(input:checked) { background: var(--accent-fill); color: var(--text-on-accent); font-weight: 700; }
.dst-optionen label:has(input:checked)::before { content: "\2713"; font-weight: 700; }
.dst-optionen label:has(input:focus-visible) { outline: 3px solid var(--focus-ring); outline-offset: -3px; }
.dst-hinweis { margin: 8px 0 0; color: var(--text-secondary); font-size: 13px; }
.dst-submit { margin-top: 12px; }

