/* =========================================================================
   4vox — voice-admin  ·  Design-System (zentrale Stylesheet-Struktur)
   -------------------------------------------------------------------------
   Ein einziges Stylesheet, klassenbasiert, ohne Framework, ohne Build-Step,
   ohne externe Fonts/CDNs. 1:1 nach EJS + zentrale CSS-Datei übernehmbar.
   Ersetzt Pico.css + custom.css vollständig.

   Aufbau:
     1  Design-Tokens (:root)          — Farben, Status, Typo, Abstände, Radius
     2  Reset / Basis
     3  Layout-Shell                   — Kopfleiste, Navigation, Mandant, Main
     4  Typografie & Seitenkopf
     5  Karten & KPI-Kacheln
     6  Tabellen (datendicht)
     7  Badges & Status
     8  Buttons
     9  Formulare & Filterleiste
    10  Leerzustände
    11  Flash-Meldungen
    12  Transkript / Gesprächsverlauf
    13  Testkonsole
    14  Utilities
    15  Hilfe-Popup
    16  Hilfe-Seiten (Prosa-Inhalt)
    17  Anmeldeseite
   ========================================================================= */

/* 1 ─────────────────────────────  DESIGN-TOKENS  ───────────────────────── */
:root {
  /* Marke — Steel, Versorger-typisch, vertrauenswürdig */
  --brand-950: #121A26;
  --brand-900: #1D283A;
  --brand-800: #2C3B53;
  --brand-700: #34496A;
  --brand-600: #3B5174;
  --brand-500: #46618B;   /* primäre Aktion */
  --brand-400: #6B81A3;
  --brand-200: #C4CEDE;
  --brand-100: #DDE3EE;
  --brand-050: #EDF1F8;

  /* Gold-Akzent — Marken-Kante (sparsam) */
  --gold-700: #745726;
  --gold-600: #896830;
  --gold-400: #C9A76B;

  /* Neutrale Skala (Slate) */
  --n-900: #17202B;
  --n-800: #1F2937;
  --n-700: #374151;   /* Fließtext */
  --n-600: #4B5563;
  --n-500: #6B7280;   /* gedämpft */
  --n-400: #9AA5B2;
  --n-300: #C3CBD4;
  --n-200: #E2E8F0;   /* Rahmen */
  --n-150: #E9EEF4;
  --n-100: #EFF2F7;
  --n-050: #F4F6FA;   /* App-Hintergrund */
  --white: #ffffff;

  /* Status — Vorgangs-/Anrufzustände (Text / Hintergrund / Rahmen) */
  --st-neu-fg:   #3B5174;  --st-neu-bg:   #DDE3EE;  --st-neu-bd:   #C4CEDE;
  --st-uebr-fg:  #9a5b06;  --st-uebr-bg:  #fbeccd;  --st-uebr-bd:  #f2d69c;
  --st-erl-fg:   #1a6d3a;  --st-erl-bg:   #d9efdf;  --st-erl-bd:   #b4dcc0;
  --st-fehler-fg:#a51f1f;  --st-fehler-bg:#f8dede;  --st-fehler-bd:#eebcbc;
  --st-neutral-fg:#4c5a6a; --st-neutral-bg:#eef1f5; --st-neutral-bd:#dde3ea;

  /* Semantisch */
  --bg: #FAFBFC;
  --surface: var(--white);
  --surface-2: var(--n-050);
  --border: var(--n-200);
  --border-strong: var(--n-300);
  --text: var(--n-800);
  --text-muted: var(--n-500);
  --link: var(--brand-600);
  --link-hover: var(--brand-800);
  --danger: var(--st-fehler-fg);

  /* Typografie — reiner System-Font-Stack (Datenschutz, keine Webfonts) */
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
               "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  --font-mono: "SFMono-Regular", ui-monospace, "Cascadia Mono", Menlo,
               Consolas, "Liberation Mono", monospace;

  --fs-11: 11px; --fs-12: 12px; --fs-13: 13px; --fs-14: 14px;
  --fs-16: 16px; --fs-18: 18px; --fs-22: 22px; --fs-28: 28px; --fs-34: 34px;

  /* Abstände (4er-Raster) */
  --sp-1: 4px;  --sp-2: 8px;  --sp-3: 12px; --sp-4: 16px;
  --sp-5: 24px; --sp-6: 32px; --sp-7: 48px; --sp-8: 64px;

  /* Radius */
  --r-sm: 4px; --r: 6px; --r-lg: 10px; --r-pill: 999px;

  /* Schatten — sparsam, ruhig */
  --shadow-sm: 0 1px 2px rgba(44, 59, 83, .06);
  --shadow:    0 1px 3px rgba(44, 59, 83, .08), 0 1px 2px rgba(44, 59, 83, .04);
  --shadow-md: 0 4px 16px rgba(44, 59, 83, .10);

  --topbar-h: 56px;
  --maxw: 1360px;
}

/* 2 ─────────────────────────────  RESET / BASIS  ──────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: var(--fs-14);
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
h1, h2, h3, h4, p, figure, ul, ol { margin: 0; }
ul, ol { padding: 0; list-style: none; }
a { color: var(--link); text-decoration: none; }
a:hover { color: var(--link-hover); text-decoration: underline; }
code, kbd, .mono { font-family: var(--font-mono); font-size: .92em; }
img, svg { display: block; max-width: 100%; }
:focus-visible { outline: 2px solid var(--brand-600); outline-offset: 2px; }
.stage :focus-visible { outline-color: #fff; }

/* 3 ─────────────────────────────  LAYOUT-SHELL  ───────────────────────── */
.topbar {
  height: var(--topbar-h);
  background: var(--surface);
  color: var(--text);
  display: flex;
  align-items: stretch;
  position: sticky;
  top: 0;
  z-index: 40;
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}
.topbar__inner {
  max-width: var(--maxw);
  width: 100%;
  margin: 0 auto;
  padding: 0 var(--sp-5);
  display: flex;
  align-items: center;
  gap: var(--sp-5);
}

/* Wortmarke */
.brand {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  font-weight: 700;
  font-size: var(--fs-18);
  letter-spacing: -.01em;
  white-space: nowrap;
}
.brand:hover { text-decoration: none; }
.brand__logo { height: 36px; width: auto; }

/* Hamburger — blendet die Sidebar auf schmalen Viewports als Overlay ein
   (nur unter dem Sidebar-Breakpoint sichtbar, s. u.) */
.nav-toggle {
  display: none;
  width: 34px; height: 34px;
  align-items: center; justify-content: center;
  background: transparent;
  border: 1px solid var(--border-strong);
  border-radius: var(--r);
  cursor: pointer; padding: 0; flex: 0 0 auto;
}
.nav-toggle:hover { background: var(--n-050); }
.nav-toggle__bars, .nav-toggle__bars::before, .nav-toggle__bars::after {
  display: block; width: 16px; height: 2px; border-radius: 2px; background: var(--n-700);
}
.nav-toggle__bars { position: relative; }
.nav-toggle__bars::before { content: ""; position: absolute; top: -5px; }
.nav-toggle__bars::after  { content: ""; position: absolute; top: 5px; }

/* Mandanten-Umschalter (rechts in der schmalen Topbar) */
.mandant {
  display: flex; align-items: center; gap: var(--sp-2);
  margin-left: auto; padding-left: var(--sp-3); flex: 0 0 auto;
}
.mandant__dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--gold-600);
  box-shadow: 0 0 0 3px rgba(137,104,48,.22);
}
.mandant__caret { opacity: .6; font-size: 10px; }
.mandant__label { font-size: 10px; text-transform: uppercase; letter-spacing: .06em; color: var(--text-muted); }
.mandant__form { margin: 0; }
.mandant__select {
  appearance: none;
  font: inherit;
  font-size: var(--fs-13);
  font-weight: 500;
  color: var(--text);
  background-color: var(--n-050);
  border: 1px solid var(--border-strong);
  border-radius: var(--r);
  padding: 6px 26px 6px 10px;
  cursor: pointer;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'><path d='M1 1l4 4 4-4' fill='none' stroke='%234B5563' stroke-width='1.5' stroke-linecap='round'/></svg>");
  background-repeat: no-repeat;
  background-position: right 9px center;
}
.mandant__select:hover { background-color: var(--n-100); }
.mandant__select option { color: var(--n-900); }

/* Layout-Shell: linke Sidebar + Inhaltsspalte, zusammen zentriert */
.shell {
  max-width: var(--maxw);
  margin: 0 auto;
  display: flex;
  align-items: flex-start;
}

.sidebar {
  flex: 0 0 224px;
  width: 224px;
  align-self: stretch;
  position: sticky;
  top: var(--topbar-h);
  max-height: calc(100vh - var(--topbar-h));
  overflow-y: auto;
  padding: var(--sp-4) var(--sp-3);
  border-right: 1px solid var(--border);
  background: var(--surface);
}

.nav { display: flex; flex-direction: column; gap: var(--sp-4); }
.navgroup { display: flex; flex-direction: column; }
.navgroup__head {
  display: flex; align-items: center; justify-content: space-between; gap: var(--sp-2);
  width: 100%; background: none; border: 0; cursor: pointer;
  padding: var(--sp-2); font: inherit; border-radius: var(--r-sm);
}
.navgroup__head:hover { background: var(--n-050); }
.navgroup__label {
  font-size: 10px; text-transform: uppercase; letter-spacing: .08em;
  color: var(--text-muted); font-weight: 700;
}
.navgroup__chevron {
  width: 7px; height: 7px; flex: 0 0 auto;
  border-right: 1.5px solid var(--n-400); border-bottom: 1.5px solid var(--n-400);
  transform: rotate(45deg); transition: transform .15s; margin-top: -3px;
}
.navgroup.is-collapsed .navgroup__chevron { transform: rotate(-45deg); margin-top: 2px; }
.navgroup__items { display: flex; flex-direction: column; gap: 1px; margin-top: 2px; }
.navgroup.is-collapsed .navgroup__items { display: none; }
.navgroup__items a {
  color: var(--n-700);
  padding: 7px 10px; border-radius: var(--r-sm);
  font-size: var(--fs-13); font-weight: 500; white-space: nowrap;
}
.navgroup__items a:hover { background: var(--brand-050); color: var(--brand-800); text-decoration: none; }
.navgroup__items a.is-active {
  background: var(--brand-050); color: var(--brand-800); font-weight: 650;
  box-shadow: inset 2px 0 0 var(--gold-600);
}

.sidebar-backdrop { display: none; }

/* Seiten-Container (Inhaltsspalte rechts der Sidebar) */
.page {
  flex: 1; min-width: 0;
  padding: var(--sp-5) var(--sp-5) var(--sp-8);
}

/* Schmale Viewports: Sidebar wird zum Overlay, per Hamburger ein-/ausblendbar
   (§2: eigenes Verhalten statt des frueheren Ausblendens einzelner Nav-Teile) */
@media (max-width: 900px) {
  .nav-toggle { display: inline-flex; }
  .sidebar {
    position: fixed; top: var(--topbar-h); left: 0; bottom: 0;
    max-height: none; z-index: 50;
    transform: translateX(-100%);
    transition: transform .2s ease;
    box-shadow: var(--shadow-md);
  }
  .sidebar.is-open { transform: translateX(0); }
  .sidebar-backdrop.is-open {
    display: block; position: fixed; inset: var(--topbar-h) 0 0 0;
    background: rgba(18,26,38,.45); z-index: 45;
  }
}

/* 4 ─────────────────────────  TYPOGRAFIE & SEITENKOPF  ────────────────── */
.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--sp-4);
  margin-bottom: var(--sp-5);
  flex-wrap: wrap;
}
.page-head__titles { min-width: 0; }
.eyebrow {
  font-size: var(--fs-12);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--gold-600);
  margin-bottom: 4px;
}
h1.page-title {
  font-size: var(--fs-28);
  font-weight: 700;
  letter-spacing: -.02em;
  color: var(--n-900);
  line-height: 1.15;
}
.page-sub { color: var(--text-muted); font-size: var(--fs-14); margin-top: 4px; }
.page-head__actions { display: flex; gap: var(--sp-2); align-items: center; }

.section-title {
  font-size: var(--fs-13);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--n-600);
  margin-bottom: var(--sp-3);
  display: flex; align-items: center; gap: var(--sp-2);
}
.section-title .count {
  font-weight: 600; color: var(--text-muted);
  background: var(--n-100); border-radius: var(--r-pill);
  padding: 1px 8px; font-size: var(--fs-12); letter-spacing: 0;
}

/* Layout-Grids */
.grid { display: grid; gap: var(--sp-4); }
.grid--kpi { grid-template-columns: repeat(4, 1fr); }
.grid--2-1 { grid-template-columns: 1.6fr 1fr; align-items: start; }
.grid--detail { grid-template-columns: 1fr 340px; align-items: start; gap: var(--sp-5); }
@media (max-width: 1080px) {
  .grid--kpi { grid-template-columns: repeat(2, 1fr); }
  .grid--2-1, .grid--detail { grid-template-columns: 1fr; }
}

/* 5 ─────────────────────────  KARTEN & KPI-KACHELN  ───────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
}
.card__head {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--sp-3);
  padding: var(--sp-4) var(--sp-4);
  border-bottom: 1px solid var(--border);
}
.card__head h2, .card__head h3 {
  font-size: var(--fs-16); font-weight: 650; color: var(--n-900);
}
.card__body { padding: var(--sp-4); }
.card__foot {
  padding: var(--sp-3) var(--sp-4);
  border-top: 1px solid var(--border);
  font-size: var(--fs-13);
}
.card--flush .card__body { padding: 0; }

/* KPI-Kachel */
.kpi {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: var(--sp-4);
  box-shadow: var(--shadow-sm);
  display: flex; flex-direction: column; gap: var(--sp-2);
  position: relative;
  overflow: hidden;
}
.kpi::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
  background: var(--brand-500);
}
.kpi--accent::before { background: var(--gold-600); }
.kpi--warn::before   { background: var(--st-uebr-fg); }
.kpi--ok::before     { background: var(--st-erl-fg); }
.kpi__label {
  font-size: var(--fs-12); font-weight: 600; text-transform: uppercase;
  letter-spacing: .05em; color: var(--text-muted);
  display: flex; align-items: center; gap: var(--sp-2);
}
.kpi__value {
  font-size: var(--fs-34); font-weight: 700; letter-spacing: -.02em;
  color: var(--n-900); line-height: 1; font-variant-numeric: tabular-nums;
}
.kpi__value small { font-size: var(--fs-16); font-weight: 600; color: var(--text-muted); }
.kpi__meta { font-size: var(--fs-12); color: var(--text-muted); }
.kpi__delta { font-weight: 600; }
.kpi__delta--up   { color: var(--st-erl-fg); }
.kpi__delta--down { color: var(--st-fehler-fg); }

/* 6 ───────────────────────────  TABELLEN  ─────────────────────────────── */
.table-wrap { width: 100%; overflow-x: auto; }
table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--fs-13);
}
table.data thead th {
  text-align: left;
  font-size: var(--fs-11);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--n-600);
  background: var(--n-050);
  padding: var(--sp-2) var(--sp-3);
  border-bottom: 1px solid var(--border-strong);
  white-space: nowrap;
  position: sticky; top: 0;
}
table.data tbody td {
  padding: var(--sp-3) var(--sp-3);
  border-bottom: 1px solid var(--n-150);
  vertical-align: top;
  color: var(--n-700);
}
table.data tbody tr:last-child td { border-bottom: 0; }
table.data tbody tr:hover td { background: var(--brand-050); }
table.data .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
table.data .nowrap { white-space: nowrap; }
table.data .strong { color: var(--n-900); font-weight: 600; }
table.data .muted { color: var(--text-muted); }
table.data td.mono, table.data .mono { font-family: var(--font-mono); font-size: var(--fs-12); color: var(--n-600); }
.row-link { color: var(--link); font-weight: 600; }
.row-link:hover { text-decoration: underline; }
/* Klickbare Zeile (§3/§6/§8/§9: Auswählen zum Bearbeiten) */
table.data tbody tr.is-selectable { cursor: pointer; }
table.data tbody tr.is-selectable:hover .row-link { text-decoration: underline; }
/* Wissens-Editor: Aktions-Spalte nur im Such-Modus (Tabelle .is-editable) zeigen */
.wissen-akt-col { display: none; }
table.data.is-editable .wissen-akt-col { display: table-cell; }
.table-compact tbody td { padding-top: var(--sp-2); padding-bottom: var(--sp-2); }

/* Schlüssel-Wert-Angaben (Vorgang) */
.kv { display: flex; flex-wrap: wrap; gap: 4px 6px; }
.kv__pair {
  display: inline-flex; align-items: baseline; gap: 4px;
  background: var(--n-050);
  border: 1px solid var(--n-150);
  border-radius: var(--r-sm);
  padding: 2px 7px;
  font-size: var(--fs-12);
  line-height: 1.6;
}
.kv__k { color: var(--text-muted); }
.kv__v { color: var(--n-900); font-weight: 600; font-variant-numeric: tabular-nums; }

/* 7 ───────────────────────────  BADGES & STATUS  ─────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 9px;
  border-radius: var(--r-pill);
  font-size: var(--fs-12);
  font-weight: 600;
  line-height: 1.5;
  border: 1px solid transparent;
  white-space: nowrap;
}
.badge__dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge--neu    { color: var(--st-neu-fg);    background: var(--st-neu-bg);    border-color: var(--st-neu-bd); }
.badge--uebr   { color: var(--st-uebr-fg);   background: var(--st-uebr-bg);   border-color: var(--st-uebr-bd); }
.badge--erl    { color: var(--st-erl-fg);    background: var(--st-erl-bg);    border-color: var(--st-erl-bd); }
.badge--fehler { color: var(--st-fehler-fg); background: var(--st-fehler-bg); border-color: var(--st-fehler-bd); }
.badge--neutral{ color: var(--st-neutral-fg);background: var(--st-neutral-bg);border-color: var(--st-neutral-bd); }
.badge--type   { color: var(--brand-700); background: var(--brand-050); border-color: var(--brand-100); }

/* Aktiv/Inaktiv-Punkt */
.dot-state { display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-12); color: var(--text-muted); }
.dot-state::before { content:""; width: 8px; height: 8px; border-radius: 50%; background: var(--n-300); }
.dot-state.is-on::before  { background: var(--st-erl-fg); }
.dot-state.is-off::before { background: var(--n-400); }

/* Status-Select (direkt umschaltbar in der Liste) */
.status-select {
  font: inherit;
  font-size: var(--fs-12);
  font-weight: 600;
  border-radius: var(--r-pill);
  border: 1px solid var(--st-neu-bd);
  color: var(--st-neu-fg);
  background: var(--st-neu-bg);
  padding: 3px 24px 3px 10px;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'><path d='M1 1l4 4 4-4' fill='none' stroke='%23555' stroke-width='1.5' stroke-linecap='round'/></svg>");
  background-repeat: no-repeat;
  background-position: right 8px center;
}
.status-select[data-status="uebertragen"] { color: var(--st-uebr-fg); background-color: var(--st-uebr-bg); border-color: var(--st-uebr-bd); }
.status-select[data-status="erledigt"]    { color: var(--st-erl-fg);  background-color: var(--st-erl-bg);  border-color: var(--st-erl-bd); }
.status-select[data-status="fehler"]      { color: var(--st-fehler-fg);background-color: var(--st-fehler-bg);border-color: var(--st-fehler-bd); }

/* 8 ───────────────────────────  BUTTONS  ─────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: var(--sp-2);
  font: inherit; font-size: var(--fs-13); font-weight: 600;
  padding: 7px 14px;
  border-radius: var(--r);
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--n-800);
  cursor: pointer;
  line-height: 1.3;
  white-space: nowrap;
  transition: background .12s, border-color .12s, color .12s;
}
.btn:hover { background: var(--n-050); border-color: var(--n-400); text-decoration: none; color: var(--n-900); }
.btn--primary {
  background: var(--brand-600); border-color: var(--brand-600); color: #fff;
}
.btn--primary:hover { background: var(--brand-800); border-color: var(--brand-800); color: #fff; }
.btn--accent {
  background: var(--gold-600); border-color: var(--gold-600); color: #fff;
}
.btn--accent:hover { background: var(--gold-700); border-color: var(--gold-700); color: #fff; }
.btn--ghost { background: transparent; border-color: transparent; color: var(--link); }
.btn--ghost:hover { background: var(--brand-050); color: var(--link-hover); }
.btn--sm { padding: 4px 10px; font-size: var(--fs-12); }
.btn--danger { color: var(--st-fehler-fg); }
.btn--danger:hover { background: var(--st-fehler-bg); border-color: var(--st-fehler-bd); color: var(--st-fehler-fg); }
.btn__icon { font-size: 14px; line-height: 1; }

/* 9 ─────────────────────  FORMULARE & FILTERLEISTE  ──────────────────── */
.field { display: flex; flex-direction: column; gap: 5px; }
.field label { font-size: var(--fs-12); font-weight: 600; color: var(--n-700); }
.field .hint { font-size: var(--fs-12); color: var(--text-muted); }
.hint { font-size: var(--fs-12); color: var(--text-muted); }
.field-error { font-size: var(--fs-12); color: var(--st-fehler-fg); margin: 0; }
.token-warn { font-size: var(--fs-12); color: var(--st-fehler-fg); font-weight: 600; }
.input, .select, textarea.input {
  font: inherit; font-size: var(--fs-14);
  padding: 8px 11px;
  border: 1px solid var(--border-strong);
  border-radius: var(--r);
  background: var(--surface);
  color: var(--text);
  width: 100%;
}
.input:focus, .select:focus, textarea.input:focus {
  outline: none; border-color: var(--brand-500);
  box-shadow: 0 0 0 3px var(--brand-100);
}
.select { appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'><path d='M1 1l4 4 4-4' fill='none' stroke='%235a6779' stroke-width='1.5' stroke-linecap='round'/></svg>");
  background-repeat: no-repeat; background-position: right 11px center; padding-right: 30px;
}

.toolbar {
  display: flex; align-items: center; gap: var(--sp-3);
  flex-wrap: wrap;
  margin-bottom: var(--sp-4);
}
.toolbar__spacer { margin-left: auto; }
.search {
  display: flex; align-items: center; gap: var(--sp-2);
  background: var(--surface); border: 1px solid var(--border-strong);
  border-radius: var(--r); padding: 0 10px; min-width: 260px;
}
.search input { border: 0; outline: 0; padding: 8px 0; font: inherit; font-size: var(--fs-14); background: transparent; width: 100%; }
.search__icon { color: var(--n-400); }

/* Filter-Chips (vorgefilterte Sichten) */
.segmented { display: inline-flex; background: var(--n-100); border: 1px solid var(--border); border-radius: var(--r); padding: 3px; gap: 3px; }
.segmented a, .segmented button {
  font: inherit; font-size: var(--fs-13); font-weight: 600;
  padding: 5px 12px; border-radius: var(--r-sm);
  color: var(--n-600); border: 0; background: transparent; cursor: pointer;
}
.segmented a:hover { text-decoration: none; color: var(--n-900); }
.segmented .is-active { background: var(--surface); color: var(--brand-700); box-shadow: var(--shadow-sm); }

/* 9b ───────────────────  REITER / KARTEIKARTEN (Tabs)  ────────────────── */
/* Generisch, zuerst fuer das UseCase-Formular (§5): ein Formular, ein Submit;
   die Reiter blenden nur clientseitig ein/aus. */
.tabs {
  display: flex; gap: 4px; flex-wrap: wrap;
  border-bottom: 1px solid var(--border);
  margin-bottom: var(--sp-4);
}
.tab {
  font: inherit; font-size: var(--fs-13); font-weight: 600;
  color: var(--n-600); background: none; border: 0; cursor: pointer;
  padding: 9px 14px; border-radius: var(--r-sm) var(--r-sm) 0 0;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
  display: inline-flex; align-items: center; gap: 6px;
}
.tab:hover { color: var(--n-900); background: var(--n-050); }
.tab.is-active { color: var(--brand-700); border-bottom-color: var(--brand-600); }
.tab__dot { width: 7px; height: 7px; border-radius: 50%; background: var(--st-fehler-fg); display: none; }
.tab.has-error .tab__dot { display: inline-block; }
.tab-panel { display: none; }
.tab-panel.is-active { display: block; }

/* 10 ──────────────────────────  LEERZUSTÄNDE  ────────────────────────── */
.empty {
  text-align: center;
  padding: var(--sp-7) var(--sp-5);
  color: var(--text-muted);
}
.empty__icon {
  width: 48px; height: 48px; margin: 0 auto var(--sp-3);
  border-radius: 12px; background: var(--brand-050);
  display: grid; place-items: center; color: var(--brand-400); font-size: 22px;
}
.empty__title { font-size: var(--fs-16); font-weight: 650; color: var(--n-800); margin-bottom: 4px; }
.empty__text { font-size: var(--fs-13); max-width: 380px; margin: 0 auto; }

/* 11 ─────────────────────────  FLASH-MELDUNGEN  ──────────────────────── */
.flash-stack { display: flex; flex-direction: column; gap: var(--sp-2); margin-bottom: var(--sp-4); }
.flash {
  display: flex; align-items: flex-start; gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  border-radius: var(--r);
  border: 1px solid transparent;
  font-size: var(--fs-13);
}
.flash__icon { font-weight: 700; line-height: 1.4; }
.flash__close { margin-left: auto; background: none; border: 0; cursor: pointer; color: inherit; opacity: .5; font-size: 16px; line-height: 1; }
.flash__close:hover { opacity: 1; }
.flash--success { color: var(--st-erl-fg);    background: var(--st-erl-bg);    border-color: var(--st-erl-bd); }
.flash--info    { color: var(--st-neu-fg);     background: var(--st-neu-bg);     border-color: var(--st-neu-bd); }
.flash--warn    { color: var(--st-uebr-fg);    background: var(--st-uebr-bg);    border-color: var(--st-uebr-bd); }
.flash--error   { color: var(--st-fehler-fg);  background: var(--st-fehler-bg);  border-color: var(--st-fehler-bd); }

/* 12 ────────────────────  TRANSKRIPT / GESPRÄCHSVERLAUF  ─────────────── */
.transcript { display: flex; flex-direction: column; gap: var(--sp-3); padding: var(--sp-2) 0; }
.turn { display: flex; gap: var(--sp-3); max-width: 100%; }
.turn__avatar {
  flex: 0 0 32px; width: 32px; height: 32px; border-radius: 50%;
  display: grid; place-items: center; font-size: var(--fs-12); font-weight: 700;
}
.turn--caller  .turn__avatar { background: var(--n-150); color: var(--n-700); }
.turn--assistant .turn__avatar { background: var(--brand-100); color: var(--brand-700); }
.turn__body { min-width: 0; }
.turn__meta { font-size: var(--fs-12); color: var(--text-muted); margin-bottom: 3px; display: flex; gap: var(--sp-2); align-items: center; }
.turn__who { font-weight: 700; color: var(--n-800); }
.turn__bubble {
  border-radius: var(--r-lg);
  padding: var(--sp-3) var(--sp-4);
  font-size: var(--fs-14);
  line-height: 1.55;
}
.turn--caller .turn__bubble { background: var(--n-050); border: 1px solid var(--n-150); color: var(--n-800); border-top-left-radius: var(--r-sm); }
.turn--assistant .turn__bubble { background: var(--brand-050); border: 1px solid var(--brand-100); color: var(--n-800); border-top-left-radius: var(--r-sm); }
/* Laufende Transkription (Testkonsole, M6): noch nicht final erkannter/gesprochener Text. */
.turn.pending .turn__bubble { opacity: .6; font-style: italic; }

/* Tool-/System-Ereignis im Verlauf */
.turn-event {
  display: flex; align-items: center; gap: var(--sp-2);
  font-size: var(--fs-12); color: var(--brand-500);
  padding: 3px 0 3px 44px;
}
.turn-event::before { content: "⚡"; font-size: 12px; }
.turn-event code { background: var(--brand-050); color: var(--brand-600); padding: 1px 6px; border-radius: var(--r-sm); }

/* Definition-Liste für Kopfdaten */
.dl { display: grid; grid-template-columns: auto 1fr; gap: var(--sp-2) var(--sp-4); font-size: var(--fs-13); }
.dl dt { color: var(--text-muted); }
.dl dd { margin: 0; color: var(--n-900); font-weight: 600; text-align: right; font-variant-numeric: tabular-nums; }

/* Zeitleiste (Verbinden-/Weiterleitungs-Historie) */
.timeline { position: relative; padding-left: var(--sp-5); }
.timeline::before { content:""; position: absolute; left: 7px; top: 4px; bottom: 4px; width: 2px; background: var(--border); }
.timeline__item { position: relative; padding-bottom: var(--sp-4); }
.timeline__item:last-child { padding-bottom: 0; }
.timeline__dot { position: absolute; left: calc(-1 * var(--sp-5) + 2px); top: 3px; width: 12px; height: 12px; border-radius: 50%; background: var(--surface); border: 2px solid var(--brand-500); }
.timeline__item--ok .timeline__dot { border-color: var(--st-erl-fg); }
.timeline__time { font-size: var(--fs-12); color: var(--text-muted); font-variant-numeric: tabular-nums; }
.timeline__text { font-size: var(--fs-13); color: var(--n-800); }

/* 13 ───────────────────────────  TESTKONSOLE  ────────────────────────── */
.stage {
  background: radial-gradient(120% 120% at 50% 0%, var(--brand-800), var(--brand-950));
  border-radius: var(--r-lg);
  color: #fff;
  padding: var(--sp-6);
  text-align: center;
  position: relative;
  overflow: hidden;
}
.stage__badge {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: var(--fs-12); font-weight: 600; text-transform: uppercase; letter-spacing: .06em;
  color: var(--brand-100);
  background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.14);
  border-radius: var(--r-pill); padding: 4px 12px; margin-bottom: var(--sp-4);
}
.stage__title { font-size: var(--fs-22); font-weight: 700; margin-bottom: var(--sp-2); }
.stage__sub { color: rgba(255,255,255,.7); font-size: var(--fs-14); margin-bottom: var(--sp-5); }
.mic {
  width: 84px; height: 84px; border-radius: 50%; margin: 0 auto var(--sp-4);
  display: grid; place-items: center; cursor: pointer;
  background: linear-gradient(150deg, var(--gold-400), var(--gold-600));
  color: #fff; font-size: 32px;
  box-shadow: 0 0 0 0 rgba(137,104,48,.45);
  border: 0;
}
.mic.is-live { animation: pulse 1.6s infinite; }
@keyframes pulse {
  0%   { box-shadow: 0 0 0 0 rgba(137,104,48,.45); }
  70%  { box-shadow: 0 0 0 22px rgba(137,104,48,0); }
  100% { box-shadow: 0 0 0 0 rgba(137,104,48,0); }
}
.waveform { display: flex; align-items: center; justify-content: center; gap: 4px; height: 34px; margin-bottom: var(--sp-4); }
.waveform span { width: 4px; border-radius: 2px; background: var(--gold-400); height: 8px; animation: wave 1s infinite ease-in-out; }
.waveform span:nth-child(2){animation-delay:.1s}.waveform span:nth-child(3){animation-delay:.2s}.waveform span:nth-child(4){animation-delay:.3s}.waveform span:nth-child(5){animation-delay:.4s}.waveform span:nth-child(6){animation-delay:.5s}.waveform span:nth-child(7){animation-delay:.6s}
@keyframes wave { 0%,100%{height:8px;opacity:.5} 50%{height:30px;opacity:1} }

/* 13b ─────────────────────  MINI-DIAGRAMM (Balken)  ──────────────────── */
.bars { display: flex; align-items: flex-end; gap: 6px; height: 132px; padding-top: var(--sp-2); }
.bars__col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; }
.bars__bar {
  width: 100%; max-width: 22px; border-radius: 4px 4px 2px 2px;
  background: linear-gradient(180deg, var(--brand-400), var(--brand-600));
  min-height: 3px;
}
.bars__col--peak .bars__bar { background: linear-gradient(180deg, var(--gold-400), var(--gold-600)); }
.bars__x { font-size: 10px; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.legend { display: flex; gap: var(--sp-4); font-size: var(--fs-12); color: var(--text-muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }

/* 14 ───────────────────────────  UTILITIES  ──────────────────────────── */
.stack   { display: flex; flex-direction: column; }
.stack-4 > * + * { margin-top: var(--sp-4); }
.stack-5 > * + * { margin-top: var(--sp-5); }
.row     { display: flex; align-items: center; gap: var(--sp-3); }
.row-2   { display: flex; align-items: center; gap: var(--sp-2); }
.wrap    { flex-wrap: wrap; }
.between { justify-content: space-between; }
.grow    { flex: 1; min-width: 0; }
.muted   { color: var(--text-muted); }
.small   { font-size: var(--fs-12); }
.tnum    { font-variant-numeric: tabular-nums; }
.mt-0 { margin-top: 0; } .mb-0 { margin-bottom: 0; }
.hr { height: 1px; background: var(--border); border: 0; margin: var(--sp-4) 0; }
.note {
  font-size: var(--fs-12); color: var(--text-muted);
  background: var(--n-050); border: 1px solid var(--n-150);
  border-radius: var(--r); padding: var(--sp-2) var(--sp-3);
  display: inline-flex; gap: 6px; align-items: baseline;
}
.hidden { display: none; }

/* 15 ─────────────────────────  HILFE-POPUP  ──────────────────────────── */
.help-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 18px; height: 18px; margin-left: 6px;
  border-radius: var(--r-pill); border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--text-muted);
  font-size: 11px; font-weight: 700; line-height: 1; cursor: pointer;
  vertical-align: middle; padding: 0;
}
.help-btn:hover { background: var(--brand-050); color: var(--brand-800); border-color: var(--brand-200); }

.help-modal-backdrop {
  position: fixed; inset: 0; background: rgba(18,26,38,.45); z-index: 60;
}
.help-modal {
  position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%);
  z-index: 61; width: min(640px, calc(100vw - var(--sp-5) * 2));
  max-height: calc(100vh - var(--sp-7) * 2); overflow: auto;
  background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow-md);
  border: 1px solid var(--border);
}
.help-modal__head {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--sp-3); padding: var(--sp-4) var(--sp-5); border-bottom: 1px solid var(--border);
}
.help-modal__head h3 { margin: 0; font-size: var(--fs-16); }
.help-modal__close {
  border: 0; background: transparent; font-size: var(--fs-16); line-height: 1;
  cursor: pointer; color: var(--text-muted); padding: var(--sp-1);
}
.help-modal__close:hover { color: var(--n-900); }
.help-modal__body { padding: var(--sp-5); display: flex; flex-direction: column; gap: var(--sp-3); }
.help-modal__prompt {
  white-space: pre-wrap; background: var(--n-050); border: 1px solid var(--border);
  border-radius: var(--r); padding: var(--sp-3); font-size: var(--fs-12);
  max-height: 320px; overflow: auto;
}

/* Gesprächstranskript (N1, KONZEPT-NACHBEARBEITUNG-MONITORING §2.2) — Anruf-
   Detailseite. Sprecherwechsel als abwechselnd ausgerichtete Blasen; Bot links
   neutral, Anrufer rechts mit Marken-Kante. Nur Text, kein Audio. */
.transcript { list-style: none; margin: 0; padding: var(--sp-4) var(--sp-5); display: flex; flex-direction: column; gap: var(--sp-3); }
.transcript__turn { max-width: 82%; display: flex; flex-direction: column; gap: 2px; }
.transcript__turn--bot { align-self: flex-start; align-items: flex-start; }
.transcript__turn--anrufer { align-self: flex-end; align-items: flex-end; }
.transcript__meta { display: flex; gap: var(--sp-2); align-items: baseline; font-size: var(--fs-11); }
.transcript__who { font-weight: 650; color: var(--text-muted); text-transform: uppercase; letter-spacing: .02em; }
.transcript__turn--anrufer .transcript__who { color: var(--brand-700); }
.transcript__ts { color: var(--n-400); font-size: var(--fs-11); }
.transcript__text {
  padding: var(--sp-2) var(--sp-3); border-radius: var(--r-lg);
  font-size: var(--fs-13); line-height: 1.5; color: var(--text);
  border: 1px solid var(--border); background: var(--surface-2);
  white-space: pre-wrap; overflow-wrap: anywhere;
}
.transcript__turn--anrufer .transcript__text { background: var(--brand-050); border-color: var(--brand-100); }

/* 16 ─────────────────────────  HILFE-SEITEN (PROSA)  ──────────────────── */
/* Statische Hilfetexte aus admin-ui/hilfe/*.md (KONZEPT-HILFE.md §2) — Reset
   in §2 setzt Ueberschriften/Absaetze auf margin:0, hier gezielt wieder
   Lese-Abstaende fuer den vom Mini-Renderer erzeugten Fliesstext. */
.hilfe-content > * + * { margin-top: var(--sp-4); }
.hilfe-content h2 { font-size: var(--fs-18); font-weight: 700; color: var(--n-900); margin-top: var(--sp-6); }
.hilfe-content h2:first-child { margin-top: 0; }
.hilfe-content h3 { font-size: var(--fs-16); font-weight: 650; color: var(--n-900); margin-top: var(--sp-5); }
.hilfe-content p { line-height: 1.6; color: var(--text); }
.hilfe-content ul, .hilfe-content ol { padding-left: 1.4em; line-height: 1.6; }
.hilfe-content li + li { margin-top: var(--sp-2); }
.hilfe-content hr { border: 0; height: 1px; background: var(--border); margin: var(--sp-5) 0; }
.hilfe-content a { text-decoration: underline; }
.hilfe-content code { background: var(--n-100); border-radius: var(--r-sm); padding: 1px 5px; }

/* 17 ─────────────────────────  ANMELDESEITE  ─────────────────────────── */
/* views/login/login.ejs (FEINKONZEPT-BENUTZER-BERECHTIGUNGEN.md §3.3) —
   eigenes, schlichtes Layout ohne Shell/Navigation, gleiche Tokens wie der
   Rest. Bewusst wenige Regeln: Karte, Wortmarke, Ueberschrift, Vollbreiten-
   Button. */
.login-body { background: var(--n-050); }
.login {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  padding: var(--sp-5);
}
.login__card { width: 100%; max-width: 380px; padding: var(--sp-6) var(--sp-5); }
.login__brand { margin-bottom: var(--sp-5); }
.login__logo { height: 28px; width: auto; display: block; }
.login__title { font-size: var(--fs-22); font-weight: 700; color: var(--n-900); margin-bottom: var(--sp-2); }
.login__sub { font-size: var(--fs-13); color: var(--text-muted); line-height: 1.5; margin-bottom: var(--sp-5); }
.login__zurueck { margin-top: var(--sp-4); font-size: var(--fs-13); }
.login__zurueck a { text-decoration: underline; }
.btn--block { width: 100%; justify-content: center; }
/* Konto-Block der Topbar (header.ejs, B1): steht rechts NEBEN dem Mandanten-
   Umschalter — ohne diese Regel wuerden sich zwei margin-left:auto den freien
   Platz teilen und auseinanderlaufen. Ohne Umschalter (Nicht-Betreiber, ab B2)
   uebernimmt der Konto-Block das margin-left:auto selbst. */
.mandant--konto { margin-left: var(--sp-4); }
.mandant--konto:first-of-type { margin-left: auto; }
