/* =============================================================================
   CI-KIT — Portfolio Corporate Identity
   Eine einheitliche UI-Sprache für alle Apps des Portfolios.

   Sprache: „Werkbank" (v2) — siehe werkbank/SPEC.md. Flächen-Architektur statt
           Grau-in-Grau, Marken-Rot #c2143f als Identität (nie als Werturteil),
           Typo-Skala über der Norm (nichts unter 12 px), Dichte als eigene Achse,
           Performance-Budget: keine Web-Fonts, kein Blur, KEINE Schatten.
   Themes: Light (DEFAULT, G4) + Dark via  <html data-theme="dark">
   Dichte: <html data-density="dicht|ruhig">  — ändert NUR Abstände (G9)
   Stack:  Framework-agnostisch. Funktioniert in React (var(--brand)),
           Jinja2/HTML, Svelte, plain HTML — überall wo CSS geladen wird.

   Aufbau:  1) Tokens   2) Base/Reset   3) Komponenten   4) Utilities
   Version: 2.1.1
   ========================================================================== */

/* =============================================================================
   1) TOKENS
   ========================================================================== */

/* -- HELL ist der Standard (G4, Beschluss Micha 2026-07-07). ----------------- */
:root,
html[data-theme="light"] {
  color-scheme: light;            /* native Controls (Scrollbar, Inputs) hell */

  /* -- Flächen-Architektur (G3): drei echte Helligkeits-Ebenen --------------- */
  --canvas:       #e9ebe9;   /* mattes Grau — fasst die Inhaltsflächen ein     */
  --surface:      #ffffff;   /* Inhalt: Zeilen, Karten, Panel                  */
  --gruppe:       #e0e3e0;   /* Gruppen-/Tages-Band — die dritte Ebene         */
  --hover:        #d6dad6;   /* Hover-/Aktiv-Fläche (abgedunkelte 3. Ebene)    */
  --border:       #d6d9d5;
  --border-strong:#b4b8b2;

  /* -- Inverse Struktur-Fläche (Tabellen-Header, Sidebar): in BEIDEN Themes dunkel */
  --surface-inv:  #26272c;
  --text-inv:     #ececee;

  /* -- Text ----------------------------------------------------------------- */
  --text:         #17181a;   /* 17,8:1 auf surface · 14,8:1 auf canvas         */
  --muted:        #5b6067;   /* 6,3:1 auf surface · 4,9:1 auf gruppe           */

  /* -- Marke (G1): trägt Identität, Rahmen, Navigation, Fokus, aktives ------- */
  /*    Element — sie fällt NIE ein Werturteil über einen Song.                 */
  --brand:         #c2143f;                  /* Weiß darauf 6,06:1 (bewusst)   */
  --brand-hover:   #a51034;                  /* Weiß darauf 7,7:1 · textsicher */
  --brand-soft:    rgba(194, 20, 63, .10);
  --brand-contrast:#ffffff;

  /* -- Semantik (eigene Familie, NICHT aus der Marke abgeleitet — G1/G2) ----- */
  /*    Immer redundant mit Zeichen (▲▼⚠✓★). „danger" ist KEIN eigener Ton:     */
  /*    Destruktives nutzt --warning, damit Rot nie zweideutig wird.            */
  --success:      #1c7a52;  --success-soft: rgba(28, 122, 82, .12);
  --warning:      #b34a20;  --warning-soft: rgba(179, 74, 32, .12);
  --star:         #6b5008;  --star-soft:    rgba(107, 80, 8, .14);

  /* -- Overlay -------------------------------------------------------------- */
  --overlay:      rgba(20, 24, 40, .35);
  --overlay-bd:   rgba(0, 0, 0, .18);
}

html[data-theme="dark"] {
  color-scheme: dark;

  --canvas:       #0e0f12;
  --surface:      #1b1c20;
  --gruppe:       #26272c;
  --hover:        #303138;
  --border:       #2e2f34;
  --border-strong:#474950;

  --surface-inv:  #26272c;
  --text-inv:     #ececee;

  --text:         #ececee;   /* 14,4:1 auf surface · 16,3:1 auf canvas         */
  --muted:        #a2a6ae;   /* 7,0:1 auf surface · 6,1:1 auf gruppe           */

  /* Marke im Dunkeln: helles Rot. Weiß darauf reicht NICHT (4,07:1) — darum
     trägt die Markenfläche hier dunkle Schrift (5,6:1). Braucht eine Fläche
     zwingend weiße Schrift (z. B. Kopfband), nimmt sie --brand-deep. */
  --brand:         #e63b60;
  --brand-hover:   #ff6a88;                  /* auch: Marke als Text (6,2:1)   */
  --brand-soft:    rgba(230, 59, 96, .18);
  --brand-contrast:#0e0f12;

  --success:      #5ad19a;  --success-soft: rgba(90, 209, 154, .16);
  --warning:      #ff6b5e;  --warning-soft: rgba(255, 107, 94, .16);
  --star:         #ffcf5c;  --star-soft:    rgba(255, 207, 92, .18);

  --overlay:      rgba(0, 0, 0, .55);
  --overlay-bd:   rgba(255, 255, 255, .28);
}

:root {
  /* -- Typografie (theme-unabhängig) ---------------------------------------- */
  /* Die ROLLE bestimmt die Größe, nie die Dichte (G9). Untergrenze 12 px. */
  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;

  --fs-xs:  0.75rem;    /* 12px — absolute Untergrenze, Mikro-Labels          */
  --fs-sm:  0.875rem;   /* 14px — Sekundärtext, Spaltenkopf, Buttons          */
  --fs-md:  1rem;       /* 16px — Zellen/Fließtext (Default)                  */
  --fs-num: 1.0625rem;  /* 17px — tragende Zahlen, tabular-nums, rechtsbündig */
  --fs-lg:  1.25rem;    /* 20px — Titel klein                                 */
  --fs-xl:  1.5rem;     /* 24px — Seiten-/Brand-Titel                         */
  --fs-2xl: 1.75rem;    /* 28px — Display                                     */

  --fw-regular:  400;
  --fw-medium:   500;
  --fw-semibold: 600;
  --fw-bold:     700;

  --lh-tight: 1.25;
  --lh-base:  1.5;

  /* -- Dichte-Achse (G9): NUR Abstände & Höhen, nie Schriftgrade ------------- */
  --zeile: 40px;   /* Zeilenhöhe Tabelle/Liste */
  --pad-y: 14px;   /* vertikale Luft in Blöcken */
  --luft:  14px;   /* Abstand zwischen Flächen */

  /* -- Spacing (8px-Basis) ------------------------------------------------- */
  --space-1: 0.25rem;  /*  4px */
  --space-2: 0.5rem;   /*  8px */
  --space-3: 0.75rem;  /* 12px */
  --space-4: 1rem;     /* 16px */
  --space-5: 1.5rem;   /* 24px */
  --space-6: 2rem;     /* 32px */
  --space-7: 2.5rem;   /* 40px */

  /* -- Radius --------------------------------------------------------------- */
  --radius-xs:   6px;
  --radius-sm:   8px;
  --radius-md:   10px;
  --radius-lg:   14px;
  --radius-xl:   18px;   /* Cards */
  --radius-pill: 999px;

  /* -- Bewegung ------------------------------------------------------------- */
  --transition-fast:  .12s ease;
  --transition:       .15s ease;
  --transition-theme: .25s ease;

  /* -- Layout --------------------------------------------------------------- */
  --sidebar-width: 300px;
  --panel-width:   416px;   /* Seitenpanel rechts (SPEC §4) */
  --container-max: 1200px;

  /* -- Ebenen --------------------------------------------------------------- */
  --z-dropdown: 100;
  --z-modal:    200;
  --z-toast:    300;

  /* -- Effekte: G10 — keine Schattenflächen. Tiefe entsteht über Rahmen ------ */
  /*    und die Flächen-Architektur (G3). Tokens bleiben als no-op bestehen,    */
  /*    damit vendorte Apps nicht auf undefinierte var()-Referenzen laufen.     */
  --shadow-sm: none;
  --shadow:    none;
  --shadow-lg: none;

  /* -- Kategorische Palette (Charts, Serien, Datenflächen) ------------------ */
  --cat-red:    #ef4444;
  --cat-orange: #f97316;
  --cat-amber:  #eab308;
  --cat-green:  #22c55e;
  --cat-cyan:   #06b6d4;
  --cat-blue:   #3b82f6;
  --cat-violet: #8b5cf6;
  --cat-gray:   #6b7280;

  /* -- Kategorie-Pastelle (P5): Sender-Kategorien als Badge/Kante ----------- */
  /*    NIE als Datenfläche. Ein Wert für hell UND dunkel; tragen immer dunkle  */
  /*    Schrift (--text hell, ≥ 9,8:1 auf jedem Ton).                           */
  --pastel-rose:       #f2b0ac;
  --pastel-terracotta: #f2c1a0;
  --pastel-sand:       #f0d9a3;
  --pastel-olive:      #d8e3a8;
  --pastel-gruen:      #b8e0c2;
  --pastel-petrol:     #a8dcd8;
  --pastel-himmel:     #aecfeb;
  --pastel-indigo:     #b9bfe8;
  --pastel-violett:    #d3bde8;
  --pastel-pflaume:    #ecb8d8;
  --pastel-neutral:    #d3d7d4;
  --pastel-text:       #17181a;   /* Schriftfarbe AUF jedem Pastellton */

  /* -- Marken-Fläche, die zwingend weiße Schrift trägt (10,5:1 in beiden) --- */
  --brand-deep: #7d1330;

  /* == Kompatibilitäts-Aliasse (v1 → v2) ==================================== */
  /* Die v1-Namen zeigen auf die neuen Rollen, damit vendorte Apps beim Umstieg
     nicht auf undefinierte Variablen laufen. NEUER Code nutzt die Werkbank-
     Namen (--canvas/--surface/--gruppe/--brand). Die Aliasse verschwinden in
     v3, sobald alle Apps auf die Werkbank-Sprache gehoben sind. */
  --bg:             var(--canvas);
  --surface-2:      var(--gruppe);
  --surface-3:      var(--hover);
  --accent:         var(--brand);
  --accent-hover:   var(--brand-hover);
  --accent-soft:    var(--brand-soft);
  --accent-contrast:var(--brand-contrast);
  --info:           var(--brand);
  --info-soft:      var(--brand-soft);
  /* danger ≠ Marke (G1): Destruktives trägt den Warn-Ton, nie das Marken-Rot. */
  --danger:         var(--warning);
  --danger-soft:    var(--warning-soft);
  --fs-3xl:         var(--fs-2xl);
}

/* Dichte-Achse — ändert ausschließlich Abstände/Höhen (G9). */
html[data-density="dicht"] { --zeile: 40px; --pad-y: 14px; --luft: 14px; }
html[data-density="ruhig"] { --zeile: 52px; --pad-y: 20px; --luft: 20px; }

/* =============================================================================
   2) BASE / RESET
   ========================================================================== */

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

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: var(--fs-md);
  line-height: var(--lh-base);
  color: var(--text);
  background: var(--canvas);
  transition: background var(--transition-theme), color var(--transition-theme);
}

h1, h2, h3, h4 { margin: 0; font-weight: var(--fw-semibold); line-height: var(--lh-tight); }
h1 { font-size: var(--fs-xl);  font-weight: var(--fw-bold); letter-spacing: -.2px; }
h2 { font-size: var(--fs-lg);  margin-bottom: var(--space-4); }
h3 { font-size: var(--fs-sm);  color: var(--muted); letter-spacing: .2px; margin: var(--space-5) 0 var(--space-1); }
h4 { font-size: var(--fs-md); }

a { color: var(--brand-hover); text-decoration: none; }
a:visited { color: var(--brand-hover); }
a:hover { text-decoration: underline; }
/* Kein `html[data-theme] a` — das schlägt .btn/.btn-primary (0,1,2 > 0,1,0)
   und malt Marken-Rot über die Button-Schrift. --brand-hover ist schon theme-fähig. */

code, kbd, pre { font-family: var(--font-mono); font-size: .9em; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--hover); border-radius: var(--radius-pill); border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: var(--muted); background-clip: padding-box; }

/* Fokus trägt die Marke (G1) — kräftig genug fürs Arbeiten mit der Tastatur. */
:focus-visible { outline: 3px solid var(--brand); outline-offset: 2px; }

/* Helfer-Klassen, die quer in beiden Referenzprojekten vorkamen */
.muted  { color: var(--muted); font-size: var(--fs-sm); }
.right  { text-align: right; }
.center { text-align: center; }
.ok     { color: var(--success); font-size: var(--fs-sm); }

/* =============================================================================
   3) KOMPONENTEN
   ========================================================================== */

/* -- Card ------------------------------------------------------------------ */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: var(--space-5);
}
.card + .card { margin-top: var(--luft); }
.card-flush { padding: 0; overflow: hidden; }

/* -- Buttons --------------------------------------------------------------- */
/* Doppelt selektiert: canonical .btn (React, auch <a class="btn">) UND
   bare <button> (Jinja/HTML). Link-Buttons: class="btn" plus Variante. */
.btn,
button:not(.unstyled) {
  font: inherit;
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  text-decoration: none;
  border-radius: var(--radius-md);
  padding: var(--space-2) var(--space-4);
  cursor: pointer;
  white-space: nowrap;
  transition: background var(--transition), border-color var(--transition), transform .05s, filter var(--transition);
}
.btn:hover,
button:not(.unstyled):hover { background: var(--hover); }
.btn:active,
button:not(.unstyled):active { transform: translateY(1px); }
.btn:disabled,
button:not(.unstyled):disabled { opacity: .45; cursor: not-allowed; transform: none; }

.btn-primary, button.btn-primary, button.primary {
  background: var(--brand);
  border-color: var(--brand);
  color: var(--brand-contrast);
  text-decoration: none;
}
.btn-primary:hover, button.btn-primary:hover, button.primary:hover {
  background: var(--brand-hover);
  border-color: var(--brand-hover);
}

.btn-ghost, button.btn-ghost, button.ghost {
  background: transparent;
  border-color: var(--border);
  color: var(--muted);
  text-decoration: none;
}
.btn-ghost:hover, button.btn-ghost:hover, button.ghost:hover { background: var(--gruppe); color: var(--text); }

.btn-accent-soft, button.btn-accent-soft, button.ghost-accent {
  background: var(--brand-soft);
  border-color: transparent;
  color: var(--brand-hover);
  text-decoration: none;
}
.btn-accent-soft:hover, button.btn-accent-soft:hover, button.ghost-accent:hover { border-color: var(--brand); }

/* Destruktiv trägt den Warn-Ton, nie das Marken-Rot (G1). */
.btn-danger, button.btn-danger, button.danger {
  background: var(--warning);
  border-color: var(--warning);
  color: #fff;
  text-decoration: none;
}
.btn-danger:hover, button.btn-danger:hover, button.danger:hover { filter: brightness(1.08); }

.btn-sm, button.sm { padding: var(--space-1) var(--space-3); font-size: var(--fs-xs); }
.btn-lg, button.lg { padding: var(--space-3) var(--space-5); font-size: var(--fs-md); }

.btn-icon, button.icon {
  border: none;
  background: none;
  color: inherit;
  opacity: .7;
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-sm);
}
.btn-icon:hover, button.icon:hover { opacity: 1; background: var(--hover); }
.btn-icon:disabled, button.icon:disabled { opacity: .25; }

/* -- Segment-Leiste (SPEC §4): alle Optionen sichtbar, Taste angeschrieben -- */
.segment { display: inline-flex; gap: 2px; }
.segment > button, .segment > .seg {
  font: inherit; font-size: var(--fs-sm); font-weight: var(--fw-semibold);
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  border-radius: var(--radius-xs); padding: var(--space-1) var(--space-3);
  cursor: pointer; white-space: nowrap;
}
.segment > button:hover, .segment > .seg:hover { background: var(--hover); }
.segment > button.active, .segment > .seg.active {
  background: var(--brand); border-color: var(--brand); color: var(--brand-contrast);
}
/* Die angeschriebene Taste — nie ausblenden (G5). */
.segment .key { font-size: var(--fs-xs); opacity: .8; margin-left: var(--space-1); }

/* -- Pill (Toggle / Tag-Button) -------------------------------------------- */
.pill {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  border-radius: var(--radius-pill);
  padding: var(--space-2) var(--space-4);
  font-size: var(--fs-sm);
  cursor: pointer;
  transition: background var(--transition);
}
.pill:hover { background: var(--hover); }
.pill.active { background: var(--brand); border-color: var(--brand); color: var(--brand-contrast); }

/* -- Formfelder ------------------------------------------------------------ */
.input, .select, .textarea,
input:not([type="checkbox"]):not([type="radio"]):not([type="color"]):not([type="range"]),
select, textarea {
  font: inherit;
  font-size: var(--fs-sm);
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  padding: var(--space-2) var(--space-3);
  transition: border-color var(--transition), background var(--transition);
}
textarea { line-height: var(--lh-base); resize: vertical; }
.input:focus, .select:focus, .textarea:focus,
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); }
input::placeholder, textarea::placeholder { color: var(--muted); }

input[type="color"] { padding: 2px; width: 42px; height: 34px; cursor: pointer; border: 1px solid var(--border-strong); border-radius: var(--radius-xs); background: var(--surface); }
input[type="checkbox"], input[type="radio"] { width: 16px; height: 16px; accent-color: var(--brand); cursor: pointer; vertical-align: middle; }

.field-label { display: block; font-size: var(--fs-sm); color: var(--muted); margin-bottom: var(--space-1); font-weight: var(--fw-medium); }

/* -- Badge & Chip ---------------------------------------------------------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  font-size: var(--fs-xs);
  font-weight: var(--fw-bold);
  padding: 2px var(--space-2);
  border-radius: var(--radius-xs);
  background: var(--gruppe);
  color: var(--text);
  line-height: 1.4;
}
.badge-success { background: var(--success-soft); color: var(--success); }
.badge-danger  { background: var(--warning-soft); color: var(--warning); }
.badge-warning { background: var(--warning-soft); color: var(--warning); }
.badge-star    { background: var(--star-soft);    color: var(--star); }
.badge-accent  { background: var(--brand-soft);   color: var(--brand-hover); }
/* Größere, prominente Badge (z. B. farbige Kategorie-Codes in Tabellen). Solide
   Farbe + Kontrast-Text setzt das Projekt via Inline-Style (tokens.js contrastText). */
.badge-lg { font-size: var(--fs-sm); padding: var(--space-1) var(--space-3); border-radius: var(--radius-sm); }
/* Kategorie-Badge auf einem Pastellton — trägt immer dunkle Schrift (P5). */
.badge-pastel { color: var(--pastel-text); background: var(--pastel-neutral); }

.chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-pill);
  background: var(--surface);
  font-size: var(--fs-sm);
  cursor: pointer;
  transition: background var(--transition-fast);
}
.chip:hover { background: var(--hover); }
.chip.active { background: var(--brand); border-color: var(--brand); color: var(--brand-contrast); }

.swatch { display: inline-block; width: 22px; height: 22px; border-radius: var(--radius-xs); border: 1px solid var(--border-strong); vertical-align: middle; }

/* -- Tabelle --------------------------------------------------------------- */
.table, table { width: 100%; border-collapse: collapse; background: var(--surface); }
.table th, .table td, table th, table td {
  text-align: left;
  height: var(--zeile);              /* Dichte-Achse (G9) */
  padding: 0 var(--space-3);
  border-bottom: 1px solid var(--border);
  font-size: var(--fs-md);
  vertical-align: middle;
}
/* Spaltenkopf: 14 px / 600, KEIN Uppercase (SPEC §3). */
.table th, table th {
  color: var(--muted);
  font-weight: var(--fw-semibold);
  font-size: var(--fs-sm);
  text-transform: none;
  letter-spacing: 0;
}
.table tbody tr:last-child td, table tbody tr:last-child td { border-bottom: none; }
.table tbody tr:hover, table.hoverable tbody tr:hover { background: var(--hover); }
/* Gruppen-Band (SPEC §4): die dritte Helligkeits-Ebene, kein Zebra (G3). */
.table tr.gruppe td, tr.gruppe td {
  background: var(--gruppe);
  font-weight: var(--fw-semibold);
  font-size: var(--fs-sm);
}
/* Fokus-Anker: kräftiger Marken-Balken links an der fokussierten Zeile (SPEC §4).
   `inset … 0 0` ist KEINE Schattenfläche (kein Blur, kein Spread) — es ist der
   Rahmen-Ersatz, der die Zeile nicht um 3 px verschiebt (G7 „Zeilen springen nicht"). */
.table tr.fokus td:first-child, tr.fokus td:first-child { box-shadow: inset 3px 0 0 var(--brand); }

/* -- List (Nav / Sidebar items) ------------------------------------------- */
.list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: var(--space-1); }
.list-item {
  padding: var(--space-3);
  border-radius: var(--radius-lg);
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: background var(--transition-fast);
}
.list-item:hover { background: var(--hover); }
.list-item.active { background: var(--brand-soft); color: var(--brand-hover); font-weight: var(--fw-semibold); }

/* -- Seitenpanel (SPEC §4): fester Platz rechts, folgt dem Fokus (G6) ------ */
.panel {
  width: var(--panel-width);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  align-self: start;
}
.buehne { display: grid; grid-template-columns: minmax(0, 1fr) var(--panel-width); gap: var(--luft); align-items: start; }
[data-panel="zu"] .buehne { grid-template-columns: minmax(0, 1fr); }
[data-panel="zu"] .panel { display: none; }

/* -- Undo-Leiste (SPEC §4): Undo statt Bestätigungsdialog (G5) ------------- */
.undo-bar {
  display: flex; align-items: center; gap: var(--space-3);
  background: var(--gruppe);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: var(--space-2) var(--space-3);
  font-size: var(--fs-sm);
}

/* -- Modal ----------------------------------------------------------------- */
/* G5: im Arbeitstakt keine Modals — bleibt für Einstellungen/Setup bestehen.  */
.overlay {
  position: fixed; inset: 0;
  background: var(--overlay);
  display: flex; align-items: center; justify-content: center;
  z-index: var(--z-modal);
  padding: var(--space-4);
}
.modal {
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-xl);
  padding: var(--space-5);
  width: 440px;
  max-width: 100%;
  max-height: 90vh;
  overflow: auto;
}
.modal-lg { width: 720px; }
.modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: var(--space-4); }

/* -- Toast ----------------------------------------------------------------- */
.toast {
  position: fixed; bottom: var(--space-5); right: var(--space-5);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4);
  font-size: var(--fs-sm);
  z-index: var(--z-toast);
  animation: ci-fade-in .2s ease;
}
.toast-success { border-left: 3px solid var(--success); }
.toast-danger  { border-left: 3px solid var(--warning); }

/* -- Feedback (Spinner, Empty) -------------------------------------------- */
.spinner {
  width: 20px; height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: ci-spin .7s linear infinite;
}
.empty-state { padding: var(--space-7) var(--space-5); text-align: center; color: var(--muted); font-size: var(--fs-sm); }

/* -- Brand-Mark (Marken-Dot + Titel) -------------------------------------- */
.brand { display: flex; align-items: center; gap: var(--space-3); }
.brand .dot {
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--brand);
}
.brand .sub { font-size: var(--fs-sm); color: var(--muted); }
/* Kopfband in der Markenfarbe — trägt weiße Schrift, darum --brand-deep. */
.brand-band { background: var(--brand-deep); color: #fff; padding: var(--pad-y) var(--space-5); }

/* -- Dashboard-Bausteine (KPI, Meter, Verteilung, Section-Header) ---------- */
/* Card-Kopf: Titel links, Meta/Aktionen rechts. h2/h3 darin ohne Eigenabstand. */
.card-head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); margin-bottom: var(--space-4); }
.card-head > h2, .card-head > h3, .card-head > h4 { margin: 0; }
.card-meta { font-size: var(--fs-sm); color: var(--muted); }

/* KPI-Karte: große Zahl + Label + optional Sub/Trend. Auto-Grid via .kpi-grid. */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: var(--space-4); }
.kpi {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: var(--space-4) var(--space-5);
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}
.kpi-label { font-size: var(--fs-sm); color: var(--muted); font-weight: var(--fw-semibold); }
.kpi-value { font-size: var(--fs-2xl); font-weight: var(--fw-bold); line-height: 1.1; font-variant-numeric: tabular-nums; }
.kpi-sub   { font-size: var(--fs-sm); color: var(--muted); }
.kpi-trend { display: inline-flex; align-items: center; gap: var(--space-1); font-size: var(--fs-sm); font-weight: var(--fw-medium); }
.kpi-trend.up   { color: var(--success); }
.kpi-trend.down { color: var(--warning); }
/* Status-Akzent (linke Kante) für „Kritisch/Warnung/OK"-KPIs. */
.kpi-accent  { border-left: 3px solid var(--brand); }
.kpi-success { border-left: 3px solid var(--success); }
.kpi-warning { border-left: 3px solid var(--warning); }
.kpi-danger  { border-left: 3px solid var(--warning); }

/* Meter: einzelner horizontaler Wert-Balken (z. B. Bekanntheit %, Kat-Anzahl).
   Fill-Farbe per Inline-Style überschreibbar, z. B. background:var(--cat-blue). */
.meter { display: flex; align-items: center; gap: var(--space-2); }
.meter-track { flex: 1; height: 8px; background: var(--gruppe); border-radius: var(--radius-pill); overflow: hidden; }
.meter-fill  { height: 100%; background: var(--brand); border-radius: inherit; transition: width var(--transition); }
.meter-value { font-size: var(--fs-xs); color: var(--muted); font-variant-numeric: tabular-nums; min-width: 2.5em; text-align: right; }

/* Verteilungs-Balken: segmentiert/gestapelt (Kategorie- oder Ära-Anteile in einem
   Balken). Segmente = <span> mit Inline width % + background:var(--cat-blue) usw. */
.dist-bar { display: flex; height: 10px; border-radius: var(--radius-pill); overflow: hidden; background: var(--gruppe); }
.dist-bar > span { display: block; height: 100%; }

/* -- Layout-Bausteine ------------------------------------------------------ */
.topbar { display: flex; align-items: center; justify-content: space-between; padding: var(--pad-y) var(--space-5); }
.row     { display: flex; gap: var(--space-2); flex-wrap: wrap; }
.actions { display: flex; gap: var(--space-2); align-items: center; flex-wrap: wrap; margin-top: var(--space-4); }

@keyframes ci-spin    { to { transform: rotate(360deg); } }
@keyframes ci-fade-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* =============================================================================
   4) UTILITIES (sparsam — die meiste Gestaltung läuft über Komponenten)
   ========================================================================== */

.text-xs { font-size: var(--fs-xs); }  .text-sm { font-size: var(--fs-sm); }
.text-lg { font-size: var(--fs-lg); }  .text-muted { color: var(--muted); }
.fw-medium { font-weight: var(--fw-medium); } .fw-semibold { font-weight: var(--fw-semibold); } .fw-bold { font-weight: var(--fw-bold); }

/* Tragende Zahlen: gleiche Ziffernbreite, rechtsbündig, konstante Dezimalstellen. */
.tabular-nums { font-variant-numeric: tabular-nums; }
.num { font-size: var(--fs-num); font-variant-numeric: tabular-nums; text-align: right; }

.flex { display: flex; } .flex-col { flex-direction: column; } .items-center { align-items: center; }
.justify-between { justify-content: space-between; } .gap-2 { gap: var(--space-2); } .gap-4 { gap: var(--space-4); }
.flex-1 { flex: 1; } .mt-4 { margin-top: var(--space-4); } .mt-5 { margin-top: var(--space-5); }

/* Respektiert das System-Setting „Bewegung reduzieren" (a11y). */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
    scroll-behavior: auto !important;
  }
}

@media print {
  body { background: #fff; color: #000; }
  .card { border-color: #ddd; }
  .no-print { display: none !important; }
}

/* =============================================================================
   5) FORMAT-KOMPASS (geteilte Komponente)
   Kanonisch hier in ci-kit — gehört zur Komponente `components/FormatKompass.jsx`.
   In die Tools vendored (song-datenbank, berater-dashboard). Lokale Kopien NICHT
   editieren: hier ändern + neu vendoren. Schlanke Dauer-Header-Karte (NUR Current-
   Fokus: Zielgruppe · Soll-Sound · Tertiär). Design: pitch/assets/mockup-songs.png.
   Nur Tokens (var(--…)), kein Hex.
   ========================================================================== */
.kompass-bar {
  margin: 0 0 18px; flex-shrink: 0; overflow: hidden;
  display: flex; align-items: stretch;
  background: var(--brand-soft); border: 1px solid var(--border); border-radius: var(--radius-lg);
}
.kompass-bar.empty { align-items: center; padding: 11px 16px; }
.kb-badge {
  display: inline-flex; align-items: center; flex-shrink: 0; padding: 0 16px;
  font-size: var(--fs-sm); font-weight: 800; color: var(--brand-hover); white-space: nowrap;
}
.kb-hint { font-size: var(--fs-xs); color: var(--muted); }
/* 3 Panels NEBENEINANDER, gleich breit, füllen die Fläche; durch Trennlinien getrennt. */
.kb-panel {
  flex: 1; min-width: 0; display: flex; align-items: center; gap: 11px;
  padding: 11px 18px; border-left: 1px solid var(--border);
}
.kb-e { font-size: var(--fs-lg); line-height: 1; flex-shrink: 0; }
.kb-v { font-size: var(--fs-sm); color: var(--text); font-weight: 700; line-height: 1.25; min-width: 0; }
.kb-v.ok { color: var(--success); }
.kb-v.ter { color: var(--muted); font-weight: 600; }

/* ── Shell-Komfort (ci-shell.js, v1.6.0): Sidebar-Einklappen + App-Zoom ──────────
   Sidebar-Zustand steuert <html data-sidebar="closed"> (setzt ci-shell.js);
   die Knöpfe rendern die Apps mit diesen Klassen. */
[data-sidebar="closed"] .sidebar { display: none; }

/* Sidebar bleibt viewport-hoch und scrollt INTERN — sonst rutschen die side-foot-Controls
   (Theme/Zoom/☰) beim App-Zoom unter die Falz (Befund Micha 2026-07-04: „1× plus →
   Toggle verschwindet"). sticky hält sie stehen, während der Inhalt scrollt. */
:root { --ci-zoom: 1; }   /* wird von ci-shell.js beim Zoomen überschrieben (vh skaliert nicht mit) */
.sidebar { position: sticky; top: 0; max-height: calc(100vh / var(--ci-zoom)); overflow-y: auto; }

.ci-burger {
  background: none; border: 1px solid transparent; color: var(--muted);
  font-size: var(--fs-md); line-height: 1; padding: 5px 8px; border-radius: 7px; cursor: pointer;
}
.ci-burger:hover { color: var(--text); border-color: var(--border-strong); background: var(--gruppe); }
/* Schwebender Öffner, sichtbar NUR bei eingeklappter Sidebar */
.ci-burger-floating { display: none; }
[data-sidebar="closed"] .ci-burger-floating {
  display: block; position: fixed; top: 10px; left: 10px; z-index: 60;
  background: var(--surface); border: 1px solid var(--border-strong);
}

.ci-zoom { display: inline-flex; align-items: center; gap: 2px;
  border: 1px solid var(--border-strong); border-radius: 8px; background: var(--surface); }
.ci-zoom button { background: none; border: none; color: var(--text); cursor: pointer;
  font-size: var(--fs-sm); font-weight: 700; padding: 3px 8px; border-radius: 7px; }
.ci-zoom button:hover { background: var(--hover); color: var(--brand-hover); }
.ci-zoom .ci-zoom-pct { font-size: var(--fs-xs); color: var(--muted); min-width: 34px;
  text-align: center; cursor: pointer; }

/* ← Apps (AppsLink in components/ShellControls.jsx) — Rückweg zur Portal-App-Auswahl.
   Auf hellen/dunklen Flächen: gedämpfter Text mit Rand; im Marken-Kopfband (mm .app > .header,
   sd .brand-band) weiß auf Marken-Rot wie die übrigen Kopf-Buttons. */
.ci-apps { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap;
  font-size: 13px; font-weight: 650; line-height: 1.2; color: var(--muted); text-decoration: none;
  border: 1px solid var(--border-strong); border-radius: 7px; padding: 4px 10px; }
/* Abmelden (AbmeldenKnopf) = derselbe Stil als <button> — Browser-Standardfläche/-schrift neutralisieren. */
button.ci-apps { background: transparent; font-family: inherit; cursor: pointer; }
.ci-apps:hover { color: var(--text); background: var(--surface-2, transparent); }
.ci-apps:focus-visible { outline: 2px solid var(--accent, currentColor); outline-offset: 2px; }
.app > .header .ci-apps, .brand-band .ci-apps { color: #fff; border-color: rgba(255, 255, 255, .55); background: transparent; }
.app > .header .ci-apps:hover, .brand-band .ci-apps:hover { background: rgba(255, 255, 255, .14); border-color: #fff; color: #fff; }
.app > .header .ci-apps:focus-visible, .brand-band .ci-apps:focus-visible { outline: 3px solid #fff; }
