/* Kundenreise — Design-System-Tokens aus ~/.claude/design.md, 1:1 übernommen.
   Grün auf Hell, klare Kante. Komponenten referenzieren ausschließlich Tokens,
   nie feste Hex-Werte — sonst bricht das Mandanten-Branding und der Dark Mode. */

:root {
  --bg: #F5F9F6;
  --surface: #FFFFFF;
  --surface-sunken: #EEF4F0;
  --border: #DBE6DF;
  --border-strong: #C3D3C9;
  --text: #121712;
  --text-secondary: #56635B;
  --text-muted: #8A968E;

  --green-900: #0E3B26;
  --green-700: #176B41;
  --green-600: #1E8A54;
  --green-500: #2AA868;
  --green-100: #E2F1E7;
  --green-050: #EFF7F1;

  --status-ok: #1E8A54;
  --status-ok-bg: #E2F1E7;
  --status-warn: #966A11;
  --status-warn-bg: #FBF0D9;
  --status-crit: #A23B31;
  --status-crit-bg: #FAE4E0;
  --status-off: #6B7670;
  --status-off-bg: #EAEEEB;

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 22px;

  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 48px;
  --space-8: 64px;

  --shadow-card: 0 1px 2px rgba(18, 23, 18, 0.04), 0 4px 16px rgba(18, 23, 18, 0.06);
  --font: Arial, "Helvetica Neue", Helvetica, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0D1310;
    --surface: #141B16;
    --surface-sunken: #101613;
    --border: #263029;
    --border-strong: #354137;
    --text: #E9F1EB;
    --text-secondary: #A3B0A6;
    --text-muted: #77857B;

    --green-900: #B9E7C9;
    --green-700: #4CC886;
    --green-600: #3FBE7C;
    --green-500: #34A96D;
    --green-100: #1B3226;
    --green-050: #16261C;

    --status-ok: #4CC886;
    --status-ok-bg: #16311F;
    --status-warn: #E0B84C;
    --status-warn-bg: #35290F;
    --status-crit: #E48678;
    --status-crit-bg: #3A1712;
    --status-off: #8E9A92;
    --status-off-bg: #1C2521;

    --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.3), 0 4px 16px rgba(0, 0, 0, 0.35);
  }
}

/* Manueller Umschalter übersteuert die Systemeinstellung in beide Richtungen. */
:root[data-theme="dark"] {
  --bg: #0D1310;
  --surface: #141B16;
  --surface-sunken: #101613;
  --border: #263029;
  --border-strong: #354137;
  --text: #E9F1EB;
  --text-secondary: #A3B0A6;
  --text-muted: #77857B;

  --green-900: #B9E7C9;
  --green-700: #4CC886;
  --green-600: #3FBE7C;
  --green-500: #34A96D;
  --green-100: #1B3226;
  --green-050: #16261C;

  --status-ok: #4CC886;
  --status-ok-bg: #16311F;
  --status-warn: #E0B84C;
  --status-warn-bg: #35290F;
  --status-crit: #E48678;
  --status-crit-bg: #3A1712;
  --status-off: #8E9A92;
  --status-off-bg: #1C2521;

  --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.3), 0 4px 16px rgba(0, 0, 0, 0.35);
}

/* ---------- Grundlage ---------- */

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

body {
  margin: 0;
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.55;
  background: var(--bg);
  color: var(--text-secondary);
  -webkit-text-size-adjust: 100%;
}

h1, h2, h3 { color: var(--text); margin: 0; }
h1 { font-size: 34px; font-weight: 900; letter-spacing: -0.01em; }
h2 { font-size: 21px; font-weight: 800; }
h3 { font-size: 16px; font-weight: 700; }

a { color: var(--green-700); }
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 2px solid var(--green-500);
  outline-offset: 2px;
}

.eyebrow {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

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

.skip-link {
  position: absolute;
  left: -9999px;
}
.skip-link:focus {
  left: var(--space-4);
  top: var(--space-4);
  z-index: 10;
  background: var(--surface);
  color: var(--text);
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
}

/* ---------- Layout ---------- */

.page {
  max-width: 1120px;
  margin: 0 auto;
  padding: var(--space-5) var(--space-4) var(--space-8);
}

.site-header {
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.site-header-inner {
  max-width: 1120px;
  margin: 0 auto;
  padding: var(--space-3) var(--space-4);
  display: flex;
  align-items: center;
  gap: var(--space-4);
  flex-wrap: wrap;
}

.brand {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-weight: 800;
  font-size: 16px;
  color: var(--text);
  text-decoration: none;
}
.brand img { height: 28px; width: auto; display: block; }

.header-spacer { flex: 1 1 auto; }

.header-actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.site-footer {
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 12px;
  padding: var(--space-4);
  text-align: center;
}

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: 44px; /* Touch-Ziel */
  padding: 0 var(--space-4);
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-family: var(--font);
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

/* Die Schriftfarbe auf dem Primärbutton ist ein eigenes Token, weil --green-700 im
   Dark Mode ein helles Grün ist — weiße Schrift darauf käme auf rund 2:1 Kontrast. */
:root { --on-accent: #FFFFFF; }
:root[data-theme="dark"] { --on-accent: #0D1310; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --on-accent: #0D1310; }
}

.btn-primary { background: var(--green-700); color: var(--on-accent); }
.btn-primary:hover { background: var(--green-600); }

.btn-secondary {
  background: transparent;
  border-color: var(--border-strong);
  color: var(--text);
}
.btn-secondary:hover { background: var(--green-050); border-color: var(--green-600); }

.btn-ghost { background: transparent; color: var(--text-secondary); }
.btn-ghost:hover { background: var(--green-050); color: var(--text); }

.btn-danger {
  background: transparent;
  border-color: var(--status-crit);
  color: var(--status-crit);
}
.btn-danger:hover { background: var(--status-crit-bg); }

.btn-disabled, .btn:disabled {
  background: var(--surface-sunken);
  color: var(--text-muted);
  border-color: var(--border);
  cursor: not-allowed;
}

.btn-sm { min-height: 32px; padding: 0 var(--space-3); font-size: 12px; }

@media (prefers-reduced-motion: reduce) {
  .btn { transition: none; }
}

/* ---------- Sprach- und Theme-Umschalter ---------- */

.lang-switch {
  display: inline-flex;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.lang-switch a {
  padding: var(--space-2) var(--space-3);
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  text-decoration: none;
  color: var(--text-secondary);
}
.lang-switch a + a { border-left: 1px solid var(--border-strong); }
.lang-switch a:hover { background: var(--green-050); }
.lang-switch a.active { background: var(--green-700); color: var(--on-accent); }

/* ---------- Badges ---------- */

.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}
.badge::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  flex: 0 0 auto;
}
.badge-ok   { color: var(--status-ok);   background: var(--status-ok-bg); }
.badge-warn { color: var(--status-warn); background: var(--status-warn-bg); }
.badge-crit { color: var(--status-crit); background: var(--status-crit-bg); }
.badge-off  { color: var(--status-off);  background: var(--status-off-bg); }

/* ---------- Karten und Kachel-Board ---------- */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  padding: var(--space-5);
}

.hero {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: var(--space-6);
  margin-bottom: var(--space-6);
}
.hero p { max-width: 60ch; margin: var(--space-3) 0 0; }

/* Das Kachel-Board: eine Spalte mobil, zwei ab Tablet, drei am Laptop. */
.tile-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-4);
}
@media (min-width: 640px) {
  .tile-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 1024px) {
  .tile-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

.tile {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  padding: var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  min-height: 132px;
  text-decoration: none;
  color: inherit;
}
.tile:hover { border-color: var(--green-600); }

.tile-head {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
}

.tile-icon {
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  background: var(--green-100);
  color: var(--green-700);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.tile-icon svg { width: 20px; height: 20px; }

.tile-title { font-size: 16px; font-weight: 700; color: var(--text); }
.tile-meta { font-size: 12px; color: var(--text-muted); }

/* Der Beschreibungstext einer Station ist Fließtext, keine Caption. Mit
   --text-muted kam er auf 3,07:1 und lag damit unter der Lesbarkeitsgrenze von
   4,5:1 — ausgerechnet der Text, den der Kunde lesen soll. */
.tile-body { font-size: 13px; color: var(--text-secondary); }
.tile-foot { margin-top: auto; display: flex; align-items: center; gap: var(--space-2); }

/* ---------- Fortschritt ---------- */

.progress {
  height: 6px;
  border-radius: 999px;
  background: var(--surface-sunken);
  overflow: hidden;
}
.progress > span {
  display: block;
  height: 100%;
  background: var(--green-700);
  border-radius: 999px;
}

/* ---------- Formulare ---------- */

.field { display: flex; flex-direction: column; gap: var(--space-2); }
.label {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}
.input, .select {
  min-height: 44px;
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  width: 100%;
}
.input:focus, .select:focus {
  border-color: var(--green-600);
  box-shadow: 0 0 0 3px var(--green-100);
  outline: none;
}

/* ---------- Tabellen ---------- */

.table-wrap { overflow-x: auto; border-radius: var(--radius-md); border: 1px solid var(--border); }
.table { width: 100%; border-collapse: collapse; background: var(--surface); }
.table th {
  background: var(--surface-sunken);
  text-align: left;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  padding: var(--space-3);
}
.table td { padding: var(--space-3); border-top: 1px solid var(--border); }
.table td.mono { font-variant-numeric: tabular-nums; }

/* ---------- Hinweise ---------- */

.alert {
  border-radius: var(--radius-md);
  border: 1px solid;
  padding: var(--space-4);
  margin-bottom: var(--space-4);
}
.alert-title { font-weight: 800; margin-bottom: var(--space-1); }
.alert-ok   { border-color: var(--status-ok);   background: var(--status-ok-bg); }
.alert-ok .alert-title { color: var(--status-ok); }
.alert-warn { border-color: var(--status-warn); background: var(--status-warn-bg); }
.alert-warn .alert-title { color: var(--status-warn); }
.alert-crit { border-color: var(--status-crit); background: var(--status-crit-bg); }
.alert-crit .alert-title { color: var(--status-crit); }

/* ---------- M1: Anmeldung, Verwaltung ---------- */

.narrow { max-width: 480px; margin: 0 auto; }

.mainnav { display: flex; gap: var(--space-1); flex-wrap: wrap; }
.mainnav a {
  padding: var(--space-2) var(--space-3);
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 13px;
  text-decoration: none;
  color: var(--text-secondary);
}
.mainnav a:hover { background: var(--green-050); color: var(--text); }
.mainnav a.active { background: var(--green-100); color: var(--green-700); }

.form-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-4);
}
@media (min-width: 640px) {
  .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .form-grid .field-full { grid-column: 1 / -1; }
}

/* QR-Code der TOTP-Einrichtung. Das SVG kommt ohne feste Größe, deshalb hier. */
.qr {
  margin: var(--space-5) 0 var(--space-4);
  padding: var(--space-4);
  background: #FFFFFF;   /* Scanner brauchen echtes Weiß, auch im Dark Mode */
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  display: flex;
  justify-content: center;
}
.qr svg { width: 200px; height: 200px; display: block; }

/* Startpasswörter und TOTP-Geheimnisse: einmalig sichtbar, gut markiert. */
.secret-block {
  background: var(--surface-sunken);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: var(--space-3);
  margin: var(--space-1) 0 var(--space-4);
  word-break: break-all;
  font-size: 15px;
  color: var(--text);
  user-select: all;
}

.code-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-2);
  margin: var(--space-4) 0;
}
.code-chip {
  background: var(--surface-sunken);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: var(--space-2) var(--space-3);
  text-align: center;
  color: var(--text);
  user-select: all;
}

/* ---------- Hinweisband: Betreiber arbeitet in einem Mandanten ---------- */

/* Warnfarbe, nicht Akzentfarbe: das ist ein Zustand, keine Handlung. Wer
   fremde Kundendaten sieht, soll das auf jeder Seite bemerken. */
.acting-band {
  background: var(--status-warn-bg);
  border-bottom: 1px solid var(--status-warn);
}
.acting-band-inner {
  max-width: 1120px;
  margin: 0 auto;
  padding: var(--space-2) var(--space-4);
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-wrap: wrap;
  color: var(--status-warn);
  font-weight: 700;
  font-size: 13px;
}
.acting-band-inner svg { flex: 0 0 auto; }
.acting-band-inner form { margin-left: auto; }

/* ---------- Aktuelle Station gegen die, die noch kommen ---------- */

/* Die aktuelle Station wird herausgehoben, statt die anderen bis zur
   Unlesbarkeit zu dimmen. Das ist der stärkere Hebel und kostet keinen
   Kontrast: heller Grund, Schatten, Akzentkante links. */
.tile-current {
  border-left: 4px solid var(--green-700);
  box-shadow: 0 2px 4px rgba(18, 23, 18, 0.06), 0 8px 24px rgba(18, 23, 18, 0.10);
}

/* Was noch vor uns liegt, tritt zurück: eingesenkt, flach, gestrichelt.
   Bewusst KEIN opacity auf der ganzen Kachel — das senkt den Kontrast pauschal
   und drückt Text und Status-Badge unter die Lesbarkeitsgrenze. Gedimmt wird
   deshalb nur das Piktogramm, nicht die Schrift. Bearbeitbar bleiben sie voll. */
.tile-upcoming {
  background: var(--surface-sunken);
  border: 1px dashed var(--border-strong);
  box-shadow: none;
}

/* --text-secondary ist hier die Untergrenze: --text-muted käme auf der
   eingesenkten Fläche nur auf rund 2,8:1 und wäre damit nicht mehr lesbar. */
.tile-upcoming .tile-title {
  color: var(--text-secondary);
  font-weight: 600;
}

.tile-upcoming .tile-icon {
  background: transparent;
  border: 1px dashed var(--border-strong);
  color: var(--text-muted);
  opacity: 0.75;
}

/* Beim Überfahren kommt die Kachel nach vorn — sie ist ja bedienbar. */
.tile-upcoming:hover {
  background: var(--surface);
  border-style: solid;
  border-color: var(--green-600);
  box-shadow: var(--shadow-card);
}
.tile-upcoming:hover .tile-icon { opacity: 1; }

/* ---------- Aufgabenliste ---------- */

.task-list {
  list-style: none;
  margin: var(--space-4) 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.task {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
}

/* Abgehakt heißt: durchgestrichen UND gedämpft. Nur eines von beidem ist für
   Menschen mit Farbsehschwäche zu wenig Unterschied. */
.task-done { background: var(--surface-sunken); }
.task-done .task-title { text-decoration: line-through; color: var(--text-secondary); }

.task-check {
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  border: 2px solid var(--border-strong);
  background: var(--surface);
  color: var(--green-700);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}
.task-check:hover { border-color: var(--green-600); }
.task-check svg { width: 18px; height: 18px; }
.task-done .task-check { border-color: var(--green-700); background: var(--green-100); }

.task-body { flex: 1 1 auto; min-width: 0; }
.task-title { font-weight: 700; color: var(--text); }

/* Der Kachel-Titel ist im Board ein Link — er soll wie eine Überschrift wirken. */
.tile-title a { color: inherit; text-decoration: none; }
.tile-title a:hover { color: var(--green-700); text-decoration: underline; }

textarea.input { min-height: 96px; resize: vertical; font-family: var(--font); }

/* ---------- Vertragsdokumente ---------- */

.pruefwert { font-size: 12px; word-break: break-all; }

.checkbox-row {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  cursor: pointer;
  color: var(--text-secondary);
  font-size: 13px;
}
/* Größer als der Browser-Standard: das hier ist die Zustimmung zu einem
   Vertrag, nicht ein Newsletter-Häkchen. */
.checkbox-row input[type="checkbox"] {
  width: 20px;
  height: 20px;
  margin: 0;
  flex: 0 0 auto;
  accent-color: var(--green-700);
}

/* ---------- Bewertung ---------- */

.sterne { font-size: 20px; letter-spacing: 2px; line-height: 1; }
.stern-voll { color: var(--green-700); }
.stern-leer { color: var(--border-strong); }

/* Sternauswahl ohne JavaScript: Radiobuttons, per Tastatur bedienbar, und
   sichtbar auch dann, wenn Skripte blockiert sind. */
.stern-wahl { display: flex; gap: var(--space-2); border: 0; padding: 0; margin: 0; }
.stern-wahl input { position: absolute; opacity: 0; width: 0; height: 0; }
.stern-wahl label {
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 48px;
  min-height: 48px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font-size: 20px;
  color: var(--text-muted);
  background: var(--surface);
}
.stern-wahl input:checked + label,
.stern-wahl label:hover {
  border-color: var(--green-600);
  background: var(--green-100);
  color: var(--green-700);
}
.stern-wahl input:focus-visible + label {
  outline: 2px solid var(--green-500);
  outline-offset: 2px;
}

.nps-wahl { display: flex; flex-wrap: wrap; gap: var(--space-2); border: 0; padding: 0; margin: 0; }
.nps-wahl input { position: absolute; opacity: 0; width: 0; height: 0; }
.nps-wahl label {
  cursor: pointer;
  min-width: 44px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font-weight: 700;
  color: var(--text-secondary);
  background: var(--surface);
}
.nps-wahl input:checked + label {
  border-color: var(--green-700);
  background: var(--green-700);
  color: var(--on-accent);
}
.nps-wahl label:hover { border-color: var(--green-600); }
.nps-wahl input:focus-visible + label {
  outline: 2px solid var(--green-500);
  outline-offset: 2px;
}
.nps-skala {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-muted);
  margin-top: var(--space-2);
}
