/* Kunden-Leitstand – Oberfläche im TIMO-Admin-Look (Redesign 2026-09-25, Rob).
   Bewusst dieselbe Familie: gleiche Schrift, gleiche Farbwelt (hell, ein Grün
   als Akzent), gleicher Kopfbereich (Marke + Reiter), gleiches Karten-Prinzip.
   Tokens/Grundregeln aus Stempeluhr-Richert/public/css/admin.css kopiert (kein
   Import über Domains hinweg möglich) und auf das schmalere Seitengerüst des
   Leitstands (~1100px, keine Seitenleisten) zugeschnitten. Admin ist wie bei
   TIMO fest hell, kein Umschalter.
   White-Label (Stufe 2, 2026-09-26): die --brand*-Werte unten sind nur der
   Startwert für die lokale Entwicklung (Richert-Salbeigrün) – im Betrieb setzt
   `public/js/marke.js` sie zur Laufzeit aus der Akzentfarbe der jeweiligen
   Installation (/api/marke, aus MARKE_AKZENT). */

/* Selbst gehostete Schriften (kein Google-CDN), identisch zu TIMO. */
@font-face { font-family: 'Source Sans 3'; font-style: normal; font-weight: 300; font-display: swap; src: url('/fonts/source-sans-3-300.woff2') format('woff2'); }
@font-face { font-family: 'Source Sans 3'; font-style: normal; font-weight: 400; font-display: swap; src: url('/fonts/source-sans-3-400.woff2') format('woff2'); }
@font-face { font-family: 'Source Sans 3'; font-style: normal; font-weight: 600; font-display: swap; src: url('/fonts/source-sans-3-600.woff2') format('woff2'); }
@font-face { font-family: 'Source Sans 3'; font-style: normal; font-weight: 700; font-display: swap; src: url('/fonts/source-sans-3-700.woff2') format('woff2'); }
@font-face { font-family: 'Source Sans 3'; font-style: normal; font-weight: 800; font-display: swap; src: url('/fonts/source-sans-3-800.woff2') format('woff2'); }
@font-face { font-family: 'DM Sans'; font-style: normal; font-weight: 700; font-display: swap; src: url('/fonts/dm-sans-700.woff2') format('woff2'); }
@font-face { font-family: 'DM Sans'; font-style: normal; font-weight: 900; font-display: swap; src: url('/fonts/dm-sans-900.woff2') format('woff2'); }

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

:root {
  /* 4pt-Abstandsraster + Z-Index-Stufen, wie admin.css. */
  --space-3xs: 2px; --space-2xs: 4px; --space-xs: 8px; --space-sm: 12px;
  --space-md: 16px; --space-lg: 22px; --space-xl: 28px;
  --z-sticky: 10; --z-dropdown: 20; --z-modal: 100;
  --focus: #2B5FA8;

  /* Richert-Marke, identisch zu TIMO-Admin (Hell-Theme-Werte). */
  --brand: #688868;
  --brand-strong: #4E764E;
  --brand-hover: #3E623E;
  --brand-light: #4E764E;
  --bg: #F4F4F1;
  --surface: #FFFFFF;
  --card: #FFFFFF;
  --card2: #F0F0EC;
  --border: #E5E4DE;
  --border2: #D4D3CB;
  --txt: #1C1C1E;
  --sub: #63636B;
  --muted: #9A9AA0;
  --green: #1E9E4A;
  --green-bg: #DCF5E4;
  --amber: #B7791F;
  --amber-bg: #FBEFD6;
  --red: #D93A2F;
  --red-bg: #FBE0DE;
  --blue: #0A6FD8;
}

html, body {
  background: var(--bg);
  color: var(--txt);
  font-family: 'Source Sans 3', 'Segoe UI', system-ui, -apple-system, Arial, sans-serif;
  min-height: 100dvh;
  font-size: 15px;
  line-height: 1.5;
}
a { color: inherit; }

/* Leitstand-Wortmarke (DM Sans, wie Timo-Wortmarke). */
.ls-wordmark { font-family: 'DM Sans', 'Source Sans 3', system-ui, sans-serif; line-height: 1; letter-spacing: .01em; }

/* ══ HEADER + NAV (1:1 Muster TIMO-Admin) ══ */
.header {
  display: flex; align-items: center; justify-content: space-between;
  height: 56px; padding: 0 22px; background: var(--surface);
  border-bottom: 2px solid var(--brand); position: sticky; top: 0; z-index: var(--z-sticky);
}
.brand { display: flex; align-items: center; gap: 11px; min-width: 0; }
.brand-badge { width: 32px; height: 32px; border-radius: 8px; overflow: hidden; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.brand-badge svg { width: 100%; height: 100%; display: block; }
.brand-label { font-size: 14px; font-weight: 700; letter-spacing: 0.02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-sep { width: 1px; height: 18px; background: var(--border2); margin: 0 4px; flex-shrink: 0; }
.admin-badge {
  font-size: 10px; font-weight: 700; letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--brand-light); background: rgba(78,118,78,0.12); padding: 3px 9px;
  border-radius: 20px; border: 1px solid rgba(78,118,78,0.34); flex-shrink: 0;
}
.header-right { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }

.nav { display: flex; gap: 4px; padding: 0 22px; background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 56px; z-index: calc(var(--z-sticky) - 1); overflow-x: auto; }
.nav button {
  font: inherit; padding: 12px 16px; font-size: 13px; font-weight: 600; color: var(--sub);
  background: none; border: none; border-bottom: 2px solid transparent; letter-spacing: 0.02em;
  cursor: pointer; white-space: nowrap;
}
.nav button:hover { color: var(--txt); }
.nav button.active { color: var(--brand-light); border-bottom-color: var(--brand); }

.wrap { max-width: 1100px; margin: 0 auto; padding: 22px; }

.page-title { font-size: 21px; font-weight: 800; letter-spacing: -0.01em; line-height: 1.2; color: var(--txt); margin-bottom: 4px; }
.page-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }

/* ══ Buttons (1:1 TIMO) ══ */
.btn, button.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 9px 16px; border-radius: 8px; font-size: 13px; font-weight: 700;
  letter-spacing: 0.03em; cursor: pointer; border: 1px solid var(--border2);
  background: var(--card); color: var(--txt); text-decoration: none; font-family: inherit;
}
.btn:hover { background: var(--card2); }
.btn:focus-visible, a:focus-visible, .nav button:focus-visible, .row-cover:focus-visible {
  outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 4px;
}
input[type=checkbox], input[type=radio] { accent-color: var(--brand-strong); }
.btn.primary { background: var(--brand-strong); border-color: var(--brand-strong); color: #fff; }
.btn.primary:hover { background: var(--brand-hover); border-color: var(--brand-hover); }
.btn.primary:disabled { background: var(--muted); border-color: var(--muted); }
.btn.red { background: #fff; color: var(--red); border-color: var(--red); }
.btn.sm { padding: 5px 11px; font-size: 11px; }
.btn.gross { padding: 13px 22px; font-size: 14px; width: 100%; }
.btn:disabled { opacity: 0.55; cursor: default; }

/* ══ Karten (ein Thema = eine Karte, keine Karte-in-Karte) ══ */
.card { background: var(--card); border: 1px solid var(--border); border-radius: 10px; padding: 18px 20px; margin-bottom: 16px; }
.card-liste { display: flex; flex-direction: column; gap: 10px; }
.sec-title { font-size: 10px; font-weight: 700; letter-spacing: 0.2em; text-transform: uppercase; color: var(--muted); margin: 0 0 10px; }
.hinweis { color: var(--sub); font-size: 13px; }

/* ══ Formulare ══ */
.field { margin-bottom: 14px; }
.field:last-child { margin-bottom: 0; }
label { display: block; font-size: 12px; color: var(--sub); margin-bottom: 6px; font-weight: 600; }
input:where(:not([type=checkbox]):not([type=radio]):not([type=file]):not([type=submit]):not([type=button]):not([type=hidden])),
select, textarea {
  background: var(--surface); border: 1px solid var(--border2); border-radius: 7px;
  color: var(--txt); padding: 9px 12px; font-size: 14px; font-family: inherit; width: 100%;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--focus); outline-offset: 1px; border-color: var(--brand); }
.zeile { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
.checkliste { display: flex; flex-wrap: wrap; gap: 10px; }
.checkliste label { display: flex; align-items: center; gap: 6px; color: var(--txt); font-size: 14px; margin: 0; font-weight: 400; }
.checkliste input[type=checkbox] { width: auto; }
.fehler { color: var(--red); font-size: 13px; margin-top: 8px; }
.flash { padding: 11px 16px; border-radius: 8px; margin-bottom: 16px; font-size: 13px; font-weight: 600; }
.flash.ok { background: rgba(30,158,74,0.12); color: var(--green); border: 1px solid rgba(30,158,74,0.3); }
.flash.err { background: rgba(217,58,47,0.12); color: var(--red); border: 1px solid rgba(217,58,47,0.3); }
.versteckt { display: none !important; }

/* ══ Login (1:1 TIMO-Login-Karte) ══ */
.login-wrap { min-height: 100dvh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.login-card { background: var(--card); border: 1px solid var(--border2); border-radius: 16px; padding: 40px; width: 100%; max-width: 380px; }
.login-brand { display: flex; flex-direction: column; align-items: center; gap: 10px; margin-bottom: 28px; text-align: center; }
.login-badge { width: 64px; height: 64px; border-radius: 16px; overflow: hidden; }
.login-badge svg { width: 100%; height: 100%; display: block; }
.login-titel { font-size: 20px; font-weight: 800; }
.login-sub { font-size: 12px; color: var(--sub); letter-spacing: 0.06em; text-transform: uppercase; margin-top: 2px; }
.login-company { font-size: 13px; color: var(--txt); font-weight: 600; letter-spacing: 0.02em; }
.login-card .field { margin-bottom: 14px; }

/* ══ Ampel + Status ══ */
.ampel { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; flex-shrink: 0; }
.ampel.ok { background: var(--green); }
.ampel.fehler { background: var(--red); }
.ampel.aus { background: var(--muted); }
.ampel.warnung { background: var(--amber); }
.ampel.info { background: var(--brand-strong); } /* Stufe 6: "wird verarbeitet" (Worker-Thread läuft) */
.badge-rolle { display: inline-block; font-size: 10px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; padding: 3px 9px; border-radius: 20px; }
.badge-rolle.admin { color: var(--brand-light); background: rgba(78,118,78,0.12); border: 1px solid rgba(78,118,78,0.34); }
.badge-rolle.mitarbeiter { color: var(--blue); background: rgba(10,111,216,0.1); border: 1px solid rgba(10,111,216,0.3); }
.badge-rolle.support { color: var(--amber); background: rgba(183,121,31,0.12); border: 1px solid rgba(183,121,31,0.34); }

/* ══ Bot-Zeile (Übersicht) — eine Zeile je Bot, kein Karten-Raster ══ */
.bot-zeile { display: flex; align-items: center; gap: 16px; background: var(--card); border: 1px solid var(--border); border-radius: 10px; padding: 14px 18px; }
.bot-zeile.status-ok { border-left: 3px solid var(--green); }
.bot-zeile.status-fehler { border-left: 3px solid var(--red); }
.bot-zeile.status-aus { border-left: 3px solid var(--muted); opacity: 0.75; }
.bot-zeile.status-warnung { border-left: 3px solid var(--amber); }
.bot-kennzahlen .achtung { color: var(--amber); font-weight: 700; }
.bot-avatar { width: 38px; height: 38px; border-radius: 50%; background: var(--brand-strong); color: #fff; font-size: 12px; font-weight: 800; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.bot-zeile.status-aus .bot-avatar { background: var(--card2); color: var(--muted); }
.bot-info { flex: 1; min-width: 200px; }
.bot-name { font-size: 14px; font-weight: 700; display: flex; align-items: center; gap: 6px; }
.bot-aufgabe { font-size: 12.5px; color: var(--sub); margin-top: 2px; }
.bot-kennzahlen { display: flex; gap: 18px; flex-wrap: wrap; font-size: 12px; color: var(--sub); margin-top: 6px; }
.bot-kennzahlen .wert { font-weight: 700; color: var(--txt); font-variant-numeric: tabular-nums; }
.bot-aktion { flex-shrink: 0; }

/* ══ Chat ══ */
.chat-auswahl { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.chat-auswahl select { width: auto; min-width: 220px; }
.chat-card { display: flex; flex-direction: column; height: min(640px, calc(100dvh - 260px)); min-height: 420px; padding: 0; overflow: hidden; }
.chat-verlauf { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; padding: 18px 20px; }
.nachricht { max-width: 82%; padding: 10px 14px; border-radius: 12px; font-size: 14px; white-space: pre-wrap; }
.nachricht.user { align-self: flex-end; background: var(--brand-strong); color: #fff; }
.nachricht.assistant { align-self: flex-start; background: var(--card2); color: var(--txt); }
.nachricht .meta { display: block; font-size: 11px; color: var(--sub); margin-top: 5px; }
.nachricht.user .meta { color: rgba(255,255,255,0.75); }
.werkzeuge-chip { display: inline-block; font-size: 10.5px; background: rgba(78,118,78,0.12); color: var(--brand-light); border-radius: 999px; padding: 2px 8px; margin: 4px 4px 0 0; font-weight: 600; }
.quellen-zeile { display: block; font-size: 11px; color: var(--sub); font-style: italic; margin-top: 4px; }
.chat-eingabe { display: flex; gap: 8px; padding: 14px 16px; border-top: 1px solid var(--border); background: var(--surface); flex-shrink: 0; }
.chat-eingabe input { flex: 1; }
.chat-leer { display: flex; align-items: center; justify-content: center; height: 100%; color: var(--sub); font-size: 13px; text-align: center; padding: 0 24px; }

/* ══ Bot-Assistent: Fortschritt + eine Karte je Schritt ══ */
.assist-fortschritt { display: flex; align-items: center; gap: 8px; margin-bottom: 16px; }
.assist-schritt { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--sub); font-weight: 600; }
.assist-punkt { width: 24px; height: 24px; border-radius: 50%; background: var(--card2); border: 1px solid var(--border2); color: var(--sub); display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 800; flex-shrink: 0; }
.assist-schritt.erledigt .assist-punkt { background: var(--brand-strong); border-color: var(--brand-strong); color: #fff; }
.assist-schritt.aktiv .assist-punkt { background: var(--surface); border-color: var(--brand-strong); color: var(--brand-strong); }
.assist-schritt.aktiv { color: var(--txt); }
.assist-linie { flex: 1; height: 1px; background: var(--border2); min-width: 12px; }
.assist-auswahl { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; margin-top: 4px; }
.assist-option { display: block; border: 1px solid var(--border2); border-radius: 10px; padding: 14px; cursor: pointer; background: var(--surface); }
.assist-option input { position: absolute; opacity: 0; pointer-events: none; }
.assist-option.gewaehlt { border-color: var(--brand-strong); background: rgba(78,118,78,0.06); }
.assist-option .titel { font-weight: 700; font-size: 13.5px; }
.assist-option .beschreibung { font-size: 12px; color: var(--sub); margin-top: 4px; }
.assist-nav { display: flex; justify-content: space-between; align-items: center; margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--border); }
.assist-zusammenfassung { display: flex; flex-direction: column; gap: 10px; }
.assist-zusammenfassung .zsf-zeile { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px dashed var(--border); font-size: 13px; }
.assist-zusammenfassung .zsf-zeile:last-child { border-bottom: none; }
.assist-zusammenfassung .zsf-label { color: var(--sub); }
.assist-zusammenfassung .zsf-wert { font-weight: 600; text-align: right; }

/* ══ Feste Speichern-Leiste (Fähigkeiten, Stufe 4c) ══
   Andreas 27.09.2026: PATCH speicherte korrekt, aber die Seite sprang nach dem
   Speichern nach oben und zeigte keine Meldung – wirkte wie "nicht gespeichert".
   Jetzt fest am unteren Bildschirmrand sichtbar, unabhängig von der Scroll-
   Position und vom Karten-Umfang (Regeln, Datenquellen, Dokumente, Modell). */
.speicher-leiste {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: var(--z-sticky);
  background: var(--surface); border-top: 1px solid var(--border);
  box-shadow: 0 -6px 16px rgba(0,0,0,0.08);
}
.speicher-leiste-inner {
  max-width: 1100px; margin: 0 auto; padding: 14px 22px;
  display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap;
}
.speicher-leiste-status { font-size: 13px; font-weight: 600; color: var(--sub); }
.speicher-leiste-status.geaendert { color: var(--amber); }
.speicher-leiste-status.ok { color: var(--green); }
.speicher-leiste-status.err { color: var(--red); }
.speicher-leiste-platzhalter { height: 78px; }

/* ══ Schlüssel-Status ══ */
.schluessel-status { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: 8px; background: var(--card2); font-size: 13px; font-weight: 600; margin: 10px 0 14px; }
.schluessel-status.ok { color: var(--green); }
.schluessel-status.fehlt { color: var(--sub); }
.schluessel-status .punkt { width: 9px; height: 9px; border-radius: 50%; background: currentColor; flex-shrink: 0; }
.schluessel-ergebnis { margin-top: 10px; font-size: 13px; font-weight: 600; }
.schluessel-ergebnis.ok { color: var(--green); }
.schluessel-ergebnis.err { color: var(--red); }

/* ══ Tabellen (Protokoll, Benutzer) ══ */
.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { background: var(--card2); color: var(--muted); font-size: 10px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--border2); }
td { padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--card2); }
.protokoll-filter { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.protokoll-filter select, .protokoll-filter input { width: auto; min-width: 180px; }
.details-zelle { color: var(--sub); font-size: 12px; max-width: 320px; overflow-wrap: anywhere; }

/* ══ Dokumente (Fähigkeiten-Seite, Stufe 3) ══ */
.dokument-zeile { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.dokument-zeile:last-child { border-bottom: none; }
.dokument-name { font-weight: 600; font-size: 13.5px; }

/* ══ Benutzerliste ══ */
.benutzer-zeile { display: flex; align-items: center; gap: 12px; padding: 12px 4px; border-bottom: 1px solid var(--border); }
.benutzer-zeile:last-child { border-bottom: none; }
.benutzer-name { font-weight: 700; font-size: 13.5px; flex: 1; }

/* ══ Konto (Passwort-Modal-artige Seite, volle Breite begrenzt) ══ */
.konto-box { max-width: 420px; }

/* ══ Responsive: 768px (Tablet) und 390px (Handy) ══ */
@media (max-width: 768px) {
  .wrap { padding: 16px; }
  .header { padding: 0 14px; }
  .nav { padding: 0 14px; }
  .bot-zeile { flex-wrap: wrap; }
  .bot-aktion { width: 100%; }
  .bot-aktion .btn { width: 100%; }
  .assist-auswahl { grid-template-columns: 1fr; }
}
@media (max-width: 480px) {
  .header { height: auto; padding: 10px 14px; flex-wrap: wrap; gap: 8px; }
  .brand-label { font-size: 13px; }
  .header-right { flex-wrap: wrap; gap: 6px; }
  .nav { position: static; }
  .card { padding: 14px 16px; }
  .zeile { flex-direction: column; align-items: stretch; }
  .zeile > * { width: 100%; }
  .chat-auswahl { flex-direction: column; align-items: stretch; }
  .chat-auswahl select { width: 100%; }
  .protokoll-filter { flex-direction: column; }
  .protokoll-filter select, .protokoll-filter input { width: 100%; }
  .assist-fortschritt { flex-wrap: wrap; }
  .assist-schritt span.label { display: none; }
  .speicher-leiste-inner { padding: 12px 16px; }
  /* Mobil-Ergänzung (Stufe 6, Andreas 27.09.2026): Touch-Ziele >= 44 px,
     Kamera-/Mikrofon-Knöpfe im Chat und die Tastatur darf die Eingabezeile
     nicht verdecken (chat-eingabe bleibt fixiert am unteren Rand der Karte,
     kein position:fixed auf dem <body> nötig, da .chat-card bereits eine
     eigene Scroll-Höhe hat, s. .chat-verlauf). */
  .btn, button.btn, .chat-anhang-knopf { min-height: 44px; }
  .btn.sm { min-height: 38px; }
  .chat-eingabe { padding: 10px 12px; }
}

/* ══ Bild-/Mikrofon-Anhänge im Chat (Stufe 6, 2026-09-27) ══ */
.chat-anhang-knopf {
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; border-radius: 8px; border: 1px solid var(--border2);
  background: var(--card); cursor: pointer; font-size: 17px; flex-shrink: 0;
}
.chat-anhang-knopf:hover { background: var(--card2); }
.chat-anhang-knopf.aufnahme { background: var(--red); border-color: var(--red); color: #fff; }
.chat-anhang-vorschau { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-top: 1px solid var(--border); }
.chat-anhang-vorschau img { max-height: 60px; border-radius: 6px; }

/* ══ PWA-Installations-Hinweis (Stufe 6) ══ */
.pwa-banner {
  /* Oben statt unten fixiert (Fund beim Screenshot-Test, Stufe 6): unten hätte
     der Hinweis auf dem Handy die Chat-Eingabezeile (Mikrofon/Kamera/Senden)
     verdeckt – oben ist immer frei. */
  position: fixed; left: 12px; right: 12px; top: 12px; z-index: 50;
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  background: var(--txt); color: #fff; padding: 12px 14px; border-radius: 10px;
  box-shadow: 0 6px 20px rgba(0,0,0,.25); font-size: 13px;
}
.pwa-banner span { flex: 1; min-width: 180px; }
