/* ── Reset & Base ─────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  /* ── LEGACY (vor TMK Design System v1.2) ──────────────────────────────
     Wird View für View in Phase 3 der Design-Migration abgelöst und dann
     entfernt, sobald keine Datei mehr darauf verweist (siehe
     docs/design-migration-plan.md). Bis dahin unverändert in Benutzung. */
  --blue-600: #2563eb;
  --blue-700: #1d4ed8;
  --blue-50:  #eff6ff;
  --blue-100: #dbeafe;
  --blue-200: #bfdbfe;
  --blue-300: #93c5fd;
  --blue-400: #60a5fa;
  --blue-500: #3b82f6;
  --blue-800: #1e40af;
  --gray-50:  #f8fafc;
  --gray-100: #f1f5f9;
  --gray-200: #e2e8f0;
  --gray-300: #cbd5e1;
  --gray-400: #94a3b8;
  --gray-500: #64748b;
  --gray-600: #475569;
  --gray-700: #334155;
  --gray-800: #1e293b;
  --gray-900: #0f172a;
  --green-50:  #f0fdf4;
  --green-600: #16a34a;
  --red-50:    #fef2f2;
  --red-600:   #dc2626;
  --yellow-50: #fefce8;
  --yellow-600:#ca8a04;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.06);
  --shadow-md: 0 4px 12px rgba(0,0,0,.1), 0 2px 4px rgba(0,0,0,.06);
  --shadow-lg: 0 10px 30px rgba(0,0,0,.12);
  font-size: 16px;

  /* ── TMK Design System v1.2 ────────────────────────────────────────── */
  /* Marke */
  --tmk-blau:#00519E; --tmk-dunkelblau:#00246B; --tmk-blau-2:#507BBB; --tmk-blau-3:#76A0C9;
  --tmk-tuerkis:#2BBECE; --tmk-gruen:#7FBC61; --tmk-gelb:#F1C23D; --tmk-rot:#BC5635;
  --tmk-dunkelgrau:#3B3838; --tmk-grau:#737877; --tmk-hellgrau-1:#F2F2F2;
  --tmk-hellgrau-2:#DBE0E6; --tmk-hellblau:#E3EBF4;
  /* Rollen hell */
  --grund:#FFFFFF; --flaeche:#F2F2F2; --flaeche-akzent:#E3EBF4; --flaeche-invers:#00246B; --band-freigabe:#00519E;
  --linie:#DBE0E6; --linie-stark:#00519E;
  --text:#3B3838; --text-sekundaer:#5F666C; --text-akzent:#00519E; --text-invers:#FFFFFF;
  --akzent:#00519E; --akzent-hover:#00246B;
  --text-auf-akzent:#FFFFFF; /* Schrift auf --akzent-Flächen; bleibt in beiden Modi weiß (--text-invers wäre im Dark Mode zu dunkel: 3,5:1) */
  --status-ok:#7FBC61; --status-warnung:#F1C23D; --status-kritisch:#BC5635;
  --status-ok-text:#3B6A26; --status-warnung-text:#6F5300; --status-kritisch-text:#96411F;
  --serie-1:#00519E; --serie-2:#2BBECE; --serie-3:#BC5635; --serie-4:#7FBC61; --serie-5:#507BBB;
  --chart-grund:#FFFFFF; --chart-raster:#DBE0E6;
  --logo-marke:#00519E; --logo-wort:#737877;
  /* NEXUS-Logo (Sprite static/brand/nexus-sprite.svg) */
  --nexus-marke:#00519E; --nexus-akzent:#2BBECE; --nexus-wort:#00246B;
  --font-sans:"Segoe UI",Frutiger,"Frutiger Linotype","Dejavu Sans","Helvetica Neue",Arial,sans-serif;
  --font-serif:"Lora","Iowan Old Style","Georgia","Times New Roman",serif;
  --font-mono:ui-monospace,"Cascadia Mono",Consolas,"Courier New",monospace;
  --radius-s:2px; --radius-m:4px; --radius-l:8px;
  --schatten:0 1px 2px rgba(0,36,107,.08), 0 4px 12px rgba(0,36,107,.06);
  /* Experimentell (testweise, siehe TMK-Design-Skill v1.3): Verlauf/erhobener Schatten/Glas/Leuchtkante,
     nur sparsam gemäß den dortigen Regeln einsetzen. */
  --schatten-erhoben:0 8px 24px rgba(0,81,158,.16), 0 2px 6px rgba(0,36,107,.10);
  --verlauf-akzent:linear-gradient(135deg, var(--akzent), var(--serie-2));
  --bewegung-schnell:120ms; --bewegung-normal:200ms; --bewegung-kurve:cubic-bezier(.4,0,.2,1);
  --glas-hintergrund:color-mix(in srgb, var(--text-invers) 26%, transparent);
  --glas-rand:1px solid color-mix(in srgb, var(--text-invers) 42%, transparent);
  --glas-blur:blur(14px) saturate(160%) brightness(1.15);
  --leuchtkante:0 0 0 1px var(--akzent), 0 0 20px color-mix(in srgb, var(--akzent) 45%, transparent);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --grund:#131A22; --flaeche:#1C2530; --flaeche-akzent:#1A2C42; --flaeche-invers:#E3EBF4; --band-freigabe:#1A2C42;
    --linie:#2E3A47; --linie-stark:#5A9BD8;
    --text:#E8ECF0; --text-sekundaer:#A7B1BC; --text-akzent:#8DB8E3; --text-invers:#131A22;
    --akzent:#2670C5; --akzent-hover:#5A9BD8;
    --status-ok:#68A648; --status-warnung:#F1C23D; --status-kritisch:#C9633F;
    --status-ok-text:#9BD182; --status-warnung-text:#F1C23D; --status-kritisch-text:#E0876B;
    --serie-1:#2670C5; --serie-2:#00A7B7; --serie-3:#B74B26; --serie-4:#68A648; --serie-5:#5881BE;
    --chart-grund:#1C2530; --chart-raster:#2E3A47;
    --logo-marke:#FFFFFF; --logo-wort:#FFFFFF;
    --nexus-marke:#8DB8E3; --nexus-akzent:#2BBECE; --nexus-wort:#E8ECF0;
    --schatten:0 1px 2px rgba(0,0,0,.5), 0 4px 12px rgba(0,0,0,.35);
    --schatten-erhoben:0 8px 24px rgba(0,0,0,.55), 0 2px 6px rgba(0,0,0,.4);
  }
}
:root[data-theme="dark"] {
  --grund:#131A22; --flaeche:#1C2530; --flaeche-akzent:#1A2C42; --flaeche-invers:#E3EBF4; --band-freigabe:#1A2C42;
  --linie:#2E3A47; --linie-stark:#5A9BD8;
  --text:#E8ECF0; --text-sekundaer:#A7B1BC; --text-akzent:#8DB8E3; --text-invers:#131A22;
  --akzent:#2670C5; --akzent-hover:#5A9BD8;
  --status-ok:#68A648; --status-warnung:#F1C23D; --status-kritisch:#C9633F;
  --status-ok-text:#9BD182; --status-warnung-text:#F1C23D; --status-kritisch-text:#E0876B;
  --serie-1:#2670C5; --serie-2:#00A7B7; --serie-3:#B74B26; --serie-4:#68A648; --serie-5:#5881BE;
  --chart-grund:#1C2530; --chart-raster:#2E3A47;
  --logo-marke:#FFFFFF; --logo-wort:#FFFFFF;
  --nexus-marke:#8DB8E3; --nexus-akzent:#2BBECE; --nexus-wort:#E8ECF0;
  --schatten:0 1px 2px rgba(0,0,0,.5), 0 4px 12px rgba(0,0,0,.35);
  --schatten-erhoben:0 8px 24px rgba(0,0,0,.55), 0 2px 6px rgba(0,0,0,.4);
}

body {
  font-family: var(--font-sans);
  background: var(--flaeche);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── Header ────────────────────────────────────────────────────────────── */
.app-header {
  background: var(--flaeche-invers);
  color: var(--text-invers);
  padding: 0 24px;
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;            /* schmale Breiten: Aktionen rutschen unter das Logo statt über den Rand */
  gap: 10px 16px;
  padding: 18px 0;
}
.header-brand { display: flex; align-items: center; gap: 14px; }

/* ── NEXUS-Logo ────────────────────────────────────────────────────────── */
.nexus-brand-link { display: flex; align-items: center; flex-shrink: 0; border-radius: var(--radius-s); }
.nexus-brand-link:focus-visible { outline: 2px solid currentColor; outline-offset: 4px; }
.nexus-logo { display: block; height: 32px; width: auto; aspect-ratio: 160 / 48; overflow: visible; }
.nexus-logo--gross { height: 44px; }
/* Der Header liegt auf --flaeche-invers (hell: dunkelblau, dunkel: hellblau). Nur dort die
   Logo-Farben umkehren, global bleiben die Tokens unverändert. */
.app-header { --nexus-marke: #8DB8E3; --nexus-akzent: #2BBECE; --nexus-wort: #FFFFFF; }
/* Session-Timer im Header: Farben ebenfalls lokal, weil der Header die Rollen umkehrt
   (hell: dunkelblau, dunkel: hellblau). Warn-/Kritisch-Töne sind je Untergrund gewählt. */
.app-header {
  --timer-ruhe: color-mix(in srgb, var(--text-invers) 75%, transparent);
  --timer-ruhe-text: color-mix(in srgb, var(--text-invers) 85%, transparent);
  --timer-pause: color-mix(in srgb, var(--text-invers) 25%, transparent);
  --timer-pause-text: color-mix(in srgb, var(--text-invers) 40%, transparent);
  --timer-warnung: var(--tmk-gelb);
  --timer-kritisch: color-mix(in srgb, var(--tmk-rot) 60%, var(--text-invers));
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .app-header { --nexus-marke: #00519E; --nexus-akzent: #2BBECE; --nexus-wort: #00246B; --timer-warnung: color-mix(in srgb, var(--tmk-gelb) 35%, var(--tmk-dunkelgrau)); --timer-kritisch: var(--tmk-rot); }
}
:root[data-theme="dark"] .app-header { --nexus-marke: #00519E; --nexus-akzent: #2BBECE; --nexus-wort: #00246B; --timer-warnung: color-mix(in srgb, var(--tmk-gelb) 35%, var(--tmk-dunkelgrau)); --timer-kritisch: var(--tmk-rot); }
.brand-icon { font-size: 32px; line-height: 1; }
.header-brand h1 { font-size: 22px; font-weight: 700; letter-spacing: -.3px; }
.header-brand p { font-size: 13px; opacity: .8; margin-top: 1px; }
/* ── Main Layout ───────────────────────────────────────────────────────── */
.app-main {
  flex: 1;
  max-width: 900px;
  margin: 0 auto;
  padding: 32px 20px 48px;
  width: 100%;
}

/* ── Card ──────────────────────────────────────────────────────────────── */
.card {
  background: var(--grund);
  border-radius: var(--radius-m);
  border: 1px solid var(--linie);
  padding: 28px 32px;
  margin-bottom: 20px;
}
.card-header { margin-bottom: 24px; }
.card-header h2 { font-size: 18px; font-weight: 700; color: var(--text); }
.card-header p { font-size: 14px; color: var(--text-sekundaer); margin-top: 4px; }

/* ── Dropzone ──────────────────────────────────────────────────────────── */
.dropzone {
  border: 2px dashed var(--linie);
  border-radius: var(--radius-m);
  padding: 40px 24px;
  text-align: center;
  cursor: pointer;
  transition: all .2s;
  background: var(--flaeche);
  position: relative;
  margin-bottom: 20px;
}
.dropzone:hover, .dropzone.drag-over {
  border-color: var(--akzent);
  background: var(--flaeche-akzent);
}
.dropzone-icon { margin-bottom: 10px; color: var(--text-sekundaer); }
.dropzone-icon svg { width: 32px; height: 32px; }
.error-icon svg { width: 24px; height: 24px; }
.dropzone-text { font-size: 15px; color: var(--text); margin-bottom: 4px; }
.dropzone-hint { font-size: 13px; color: var(--text-sekundaer); }
.file-selected {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 14px;
  padding: 10px 16px;
  background: var(--flaeche-akzent);
  border: 1px solid var(--linie-stark);
  border-radius: var(--radius-m);
  font-size: 14px;
  font-weight: 500;
  color: var(--text-akzent);
}
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }

/* ── Form ──────────────────────────────────────────────────────────────── */
.form-group { margin-bottom: 20px; }
.form-group label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}
.form-group input[type="text"] {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--linie);
  border-radius: var(--radius-m);
  font-size: 15px;
  color: var(--text);
  background: var(--grund);
  transition: border-color .15s, box-shadow .15s;
  outline: none;
}
.form-group input[type="text"]:focus {
  border-color: var(--akzent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--akzent) 15%, transparent);
}
.form-hint { margin-top: 8px; display: flex; gap: 6px; flex-wrap: wrap; align-items: center; font-size: 13px; color: var(--text-sekundaer); }
.chip {
  background: var(--flaeche);
  border: 1px solid var(--linie);
  border-radius: var(--radius-m);
  padding: 3px 10px;
  font-size: 12px;
  cursor: pointer;
  color: var(--text-sekundaer);
  transition: all .15s;
}
.chip:hover { background: var(--flaeche-akzent); border-color: var(--akzent); color: var(--text-akzent); }

/* ── Buttons ───────────────────────────────────────────────────────────── */
.btn-primary {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 13px 24px;
  background: var(--blue-600);
  color: #fff;
  border: none;
  border-radius: var(--radius-md);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s, transform .1s, opacity .15s;
  margin-top: 4px;
}
.btn-primary:hover:not(:disabled) { background: var(--blue-700); }
.btn-primary:active:not(:disabled) { transform: scale(.98); }
.btn-primary:disabled { opacity: .45; cursor: not-allowed; }
.btn-icon { font-size: 18px; }

.btn-secondary {
  padding: 10px 24px;
  background: #fff;
  color: var(--blue-600);
  border: 1.5px solid var(--blue-600);
  border-radius: var(--radius-md);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all .15s;
}
.btn-secondary:hover { background: var(--blue-50); }

.btn-download {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  background: var(--green-50);
  color: var(--green-600);
  border: 1.5px solid #bbf7d0;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all .15s;
  white-space: nowrap;
}
.btn-download:hover { background: #dcfce7; }

/* ── Progress ──────────────────────────────────────────────────────────── */
.progress-card { border-left: 4px solid var(--akzent); }
.progress-bar-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
}
.progress-bar-bg {
  flex: 1;
  height: 8px;
  background: var(--linie);
  border-radius: 999px;
  overflow: hidden;
}
.progress-bar-fill {
  height: 100%;
  background: var(--akzent);
  border-radius: 999px;
  transition: width .5s ease;
}
.progress-pct { font-size: 13px; font-weight: 600; color: var(--akzent); min-width: 36px; text-align: right; }

.persona-steps { display: flex; flex-direction: column; gap: 8px; }
.persona-step {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: var(--radius-m);
  border: 1.5px solid var(--linie);
  background: var(--flaeche);
  transition: all .25s;
}
.persona-step.active {
  border-color: var(--akzent);
  background: var(--flaeche-akzent);
}
.persona-step.done {
  border-color: var(--status-ok);
  background: var(--flaeche);
}
.step-info { flex: 1; }
.step-name { font-size: 14px; font-weight: 600; color: var(--text); }
.step-sub { font-size: 12px; color: var(--text-sekundaer); }
.step-status { font-size: 0; display: flex; align-items: center; justify-content: center; }
.persona-step.active .step-status::after { content: ''; display: inline-block; width: 16px; height: 16px; border: 2px solid var(--akzent); border-top-color: transparent; border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.persona-step.done .step-status { color: var(--status-ok-text); }

/* ── Report Breakout (nutzt mehr Bildschirmbreite als das Formular) ─────── */
#result-section {
  width: 96vw;
  max-width: 1600px;
  margin-left: 50%;
  transform: translateX(-50%);
}

/* ── Consolidated Report ───────────────────────────────────────────────── */
.consolidated-card {
  border-top: 4px solid var(--akzent);
  background: var(--grund);
}
.consolidated-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}
.consolidated-title { display: flex; align-items: center; gap: 14px; }
.consolidated-title h2 { font-size: 20px; font-weight: 700; }
.consolidated-meta { font-size: 13px; color: var(--text-sekundaer); margin-top: 3px; }

/* ── Accordion ─────────────────────────────────────────────────────────── */
.reviews-grid { display: flex; flex-direction: column; gap: 12px; margin-bottom: 20px; }

.accordion {
  background: var(--grund);
  border: 1.5px solid var(--linie);
  border-radius: var(--radius-m);
  overflow: hidden;
}
.accordion-header {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 24px;
  background: none;
  border: none;
  cursor: pointer;
  text-align: left;
  transition: background .15s;
}
.accordion-header:hover { background: var(--flaeche); }
.accordion-header[aria-expanded="true"] { background: var(--flaeche-akzent); }
.acc-left { display: flex; align-items: center; gap: 14px; }
.acc-name { font-size: 15px; font-weight: 700; color: var(--text); }
.acc-sub { font-size: 12px; color: var(--text-sekundaer); margin-top: 1px; }
.acc-chevron {
  font-size: 20px;
  color: var(--text-sekundaer);
  transition: transform .25s;
  line-height: 1;
}
.accordion-header[aria-expanded="true"] .acc-chevron { transform: rotate(90deg); }

.accordion-body {
  display: none;
  padding: 0 24px 24px;
  border-top: 1px solid var(--linie);
}
.accordion-body.open { display: block; }

/* ── Kritische Sektion (harte Fehler, keine Einschätzung nötig) ─────────── */
.accordion-critical {
  border-color: var(--status-kritisch);
  background: var(--grund);
}
.accordion-critical .accordion-header:hover { background: color-mix(in srgb, var(--status-kritisch) 10%, var(--grund)); }
.accordion-critical .accordion-header[aria-expanded="true"] { background: color-mix(in srgb, var(--status-kritisch) 14%, var(--grund)); }
.accordion-critical .acc-name { color: var(--status-kritisch-text); }
.accordion-critical .accordion-body { border-top-color: var(--status-kritisch); }
.accordion-critical .markdown-body table { border: 1px solid var(--status-kritisch); }
.accordion-critical .markdown-body th { background: color-mix(in srgb, var(--status-kritisch) 16%, var(--grund)); color: var(--status-kritisch-text); }
.accordion-critical .markdown-body tr:nth-child(even) td { background: color-mix(in srgb, var(--status-kritisch) 6%, var(--grund)); }

/* ── Markdown Body ─────────────────────────────────────────────────────── */
.markdown-body, .copy-target { position: relative; }
.markdown-body { font-size: 15px; line-height: 1.75; color: var(--text); }
.copy-btn {
  position: absolute;
  top: 0;
  right: 0;
  width: 28px;
  height: 28px;
  border-radius: var(--radius-m);
  border: 1px solid var(--linie);
  background: var(--grund);
  color: var(--text-sekundaer);
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
  z-index: 5;
}
.copy-btn:hover { background: var(--flaeche-akzent); color: var(--text-akzent); border-color: var(--linie-stark); }
.markdown-body h1, .markdown-body h2 { font-size: 17px; font-weight: 700; margin: 20px 0 10px; color: var(--text); border-bottom: 1px solid var(--linie); padding-bottom: 6px; }
.markdown-body h3 { font-size: 15px; font-weight: 700; margin: 16px 0 8px; color: var(--text); }
.markdown-body p { margin: 0 0 12px; }
.markdown-body ul, .markdown-body ol { padding-left: 22px; margin: 0 0 12px; }
.markdown-body li { margin-bottom: 4px; }
.markdown-body strong { font-weight: 700; }
.markdown-body em { font-style: italic; }
.markdown-body code { background: var(--flaeche); padding: 2px 6px; border-radius: 4px; font-size: 13px; font-family: var(--font-mono); }
.markdown-body pre { background: var(--tmk-dunkelgrau); color: var(--tmk-hellgrau-1); padding: 16px; border-radius: var(--radius-m); overflow-x: auto; margin: 12px 0; }
.markdown-body pre code { background: none; color: inherit; padding: 0; font-size: 13px; }
.markdown-body blockquote { border-left: 3px solid var(--akzent); padding-left: 14px; color: var(--text-sekundaer); margin: 12px 0; font-style: italic; }
.markdown-body table { width: 100%; border-collapse: collapse; margin: 16px 0; font-size: 14px; }
.markdown-body th { background: var(--flaeche); font-weight: 700; padding: 10px 14px; text-align: left; border: 1px solid var(--linie); }
.markdown-body td { padding: 9px 14px; border: 1px solid var(--linie); vertical-align: top; }
.markdown-body tr:nth-child(even) td { background: var(--flaeche); }
.markdown-body hr { border: none; border-top: 1px solid var(--linie); margin: 20px 0; }

/* ── Error Banner ──────────────────────────────────────────────────────── */
.error-banner {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: var(--grund);
  border: 1.5px solid var(--status-kritisch);
  border-left: 4px solid var(--status-kritisch);
  border-radius: var(--radius-m);
  padding: 16px 20px;
  box-shadow: var(--schatten);
  max-width: 520px;
  width: calc(100% - 40px);
  z-index: 1000;
  animation: slideUp .25s ease;
}
@keyframes slideUp { from { opacity: 0; transform: translateX(-50%) translateY(16px); } }
.error-icon { flex-shrink: 0; margin-top: 1px; color: var(--status-kritisch); }
.error-banner strong { font-size: 14px; font-weight: 700; color: var(--status-kritisch-text); }
.error-banner p { font-size: 13px; color: var(--text); margin-top: 2px; }
.error-close { margin-left: auto; background: none; border: none; cursor: pointer; color: var(--text-sekundaer); padding: 2px 6px; flex-shrink: 0; }
.error-close:hover { color: var(--text); }

/* ── New Analysis ──────────────────────────────────────────────────────── */
.new-analysis-wrap { text-align: center; padding: 8px 0 16px; }

/* ── Footer ────────────────────────────────────────────────────────────── */
.app-footer {
  text-align: center;
  padding: 16px;
  font-size: 12px;
  color: var(--text-sekundaer);
  border-top: 1px solid var(--linie);
  background: var(--grund);
}

/* Statusbadge im Fließtext der Fußzeile (z. B. „Prototyp“ beim PPT-QS-Agent) */
.app-footer .tmk-statusbadge { vertical-align: middle; margin: 0 2px; }
.app-footer a { color: var(--text-akzent); text-decoration: underline; text-underline-offset: 2px; }
.app-footer a:hover { color: var(--akzent-hover); }
.app-footer a:focus-visible { outline: 2px solid var(--akzent); outline-offset: 2px; border-radius: var(--radius-s); }

/* Nutzungsstatistik-Banner: eigene Klassen (tmk-stats-*) sind seit der Design-Migration
   lokal in portal.html definiert, siehe docs/design-migration-plan.md Abschnitt 7. */

/* ── Feedback ──────────────────────────────────────────────────────────── */
.feedback-section {
  text-align: center;
  padding: 24px 0 12px;
  border-top: 1px solid var(--linie);
  margin-top: 12px;
}
.feedback-question {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 14px;
}
.feedback-buttons { display: flex; justify-content: center; gap: 12px; }
.feedback-btn {
  padding: 9px 22px;
  border-radius: var(--radius-m);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: 1.5px solid;
  transition: background .15s;
}
.feedback-pos { background: color-mix(in srgb, var(--status-ok) 14%, var(--grund)); color: var(--status-ok-text); border-color: var(--status-ok); }
.feedback-pos:hover { background: color-mix(in srgb, var(--status-ok) 24%, var(--grund)); }
.feedback-neg { background: color-mix(in srgb, var(--status-warnung) 18%, var(--grund)); color: var(--status-warnung-text); border-color: var(--status-warnung); }
.feedback-neg:hover { background: color-mix(in srgb, var(--status-warnung) 28%, var(--grund)); }
.feedback-thanks { font-size: 14px; color: var(--status-ok-text); font-weight: 600; margin-top: 12px; }

/* Changelog: eigene Klassen (tmk-timeline-*) sind seit der Design-Migration lokal in
   changelog.html definiert, siehe docs/design-migration-plan.md Abschnitt 6. */

/* Agenten-Raster (Portal-Startseite): eigene Klassen (tmk-agent-*) sind seit der
   Design-Migration lokal in portal.html definiert, siehe docs/design-migration-plan.md
   Abschnitt 7. Die Statusbadges nutzen die gemeinsame .tmk-statusbadge-Komponente. */

/* ── Model Toggle ──────────────────────────────────────────────────────── */
.model-toggle {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 6px;
}
@media (max-width: 640px) {
  .model-toggle { grid-template-columns: 1fr; }
}

.model-option {
  border: 2px solid var(--linie);
  border-radius: var(--radius-m);
  padding: 14px 16px;
  cursor: pointer;
  transition: border-color .15s, background .15s;
  background: var(--flaeche);
  position: relative;
  user-select: none;
}

.model-option:hover { border-color: var(--tmk-grau); background: var(--grund); }

.model-option.active.model-sonnet {
  border-color: var(--akzent);
  background: var(--flaeche-akzent);
}
.model-option.active.model-opus {
  border-color: var(--tmk-blau-2);
  background: color-mix(in srgb, var(--tmk-blau-2) 14%, var(--grund));
}

.model-option-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.model-icon-name { display: flex; align-items: center; gap: 7px; }
.model-name { font-size: 15px; font-weight: 800; color: var(--text); }

.model-tag {
  border-radius: var(--radius-m);
  padding: 2px 8px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .4px;
  text-transform: uppercase;
}
.model-tag-sonnet { background: var(--flaeche-akzent); color: var(--text-akzent); border: 1px solid var(--linie-stark); }
/* Orange (Premium-Kennzeichnung) hat keine TMK-Entsprechung, siehe design-migration-plan.md
   Entscheidung 5.4 — neutrale tmk-blau-2-Tönung statt Statusfarbe. */
.model-tag-opus   { background: color-mix(in srgb, var(--tmk-blau-2) 22%, var(--grund)); color: var(--akzent-hover); border: 1px solid var(--tmk-blau-2); }

.model-desc { font-size: 12px; color: var(--text-sekundaer); line-height: 1.5; }
.model-option.active .model-desc { color: var(--text); }

/* ── Kriterien Card ────────────────────────────────────────────────────── */
.kriterien-card { border-top: 4px solid var(--akzent); }
.kriterien-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.kriterien-card-title { display: flex; align-items: center; gap: 14px; }
.kriterien-card-title h2 { font-size: 20px; font-weight: 700; }

.running-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: var(--flaeche-akzent);
  border: 1px solid var(--linie-stark);
  border-radius: var(--radius-m);
  font-size: 13px;
  color: var(--text-akzent);
  font-weight: 500;
  margin-bottom: 20px;
}
.running-spinner {
  width: 14px;
  height: 14px;
  border: 2px solid var(--akzent);
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin .8s linear infinite;
  flex-shrink: 0;
}

/* ── Back link ─────────────────────────────────────────────────────────── */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 14px 6px 10px;
  background: color-mix(in srgb, var(--text-invers) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--text-invers) 22%, transparent);
  border-radius: var(--radius-m);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-invers);
  text-decoration: none;
  transition: background .15s, border-color .15s;
  white-space: nowrap;
}
.back-link::before {
  content: '‹';
  font-size: 18px;
  line-height: 1;
  margin-top: -1px;
}
.back-link:hover {
  background: color-mix(in srgb, var(--text-invers) 22%, transparent);
  border-color: color-mix(in srgb, var(--text-invers) 40%, transparent);
}

/* ── Session Timer ─────────────────────────────────────────────────────── */
.session-timer {
  position: relative;
  width: 36px;
  height: 36px;
  cursor: pointer;
  flex-shrink: 0;
  transition: opacity .3s;
}
.session-timer:hover { opacity: .8; }

.timer-svg {
  width: 36px;
  height: 36px;
  transform: rotate(-90deg);
  display: block;
}
.timer-bg {
  fill: none;
  stroke: color-mix(in srgb, var(--text-invers) 18%, transparent);
  stroke-width: 2.5;
}
.timer-fill {
  fill: none;
  stroke: var(--timer-ruhe);
  stroke-width: 2.5;
  stroke-dasharray: 87.96;
  stroke-dashoffset: 0;
  stroke-linecap: round;
  transition: stroke-dashoffset 1s linear, stroke .4s;
}
.timer-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 8.5px;
  font-weight: 700;
  color: var(--timer-ruhe-text);
  white-space: nowrap;
  font-family: var(--font-mono);
  pointer-events: none;
  transition: color .4s;
}

@keyframes timerPulse {
  0%, 100% { transform: scale(1); }
  50%       { transform: scale(1.12); }
}

/* ── Logout link ───────────────────────────────────────────────────────── */
.logout-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  background: color-mix(in srgb, var(--text-invers) 8%, transparent);
  border: 1px solid color-mix(in srgb, var(--text-invers) 18%, transparent);
  border-radius: var(--radius-m);
  font-size: 12px;
  font-weight: 600;
  color: color-mix(in srgb, var(--text-invers) 70%, transparent);
  text-decoration: none;
  transition: background .15s, color .15s;
  white-space: nowrap;
}
.logout-link:hover {
  background: color-mix(in srgb, var(--status-kritisch) 25%, transparent);
  border-color: color-mix(in srgb, var(--status-kritisch) 40%, transparent);
  color: var(--text-invers);
}
/* Angemeldeter Nutzer: Name statt "Abmelden", Umschlag per Hover (siehe auth.js updateUserBadge).
   Ohne bekannten Namen (z. B. PIN-Login) bleibt .logout-link ein einfacher Text-Link wie zuvor. */
.logout-link-swap {
  /* Grid statt Flex/Absolute: beide Ebenen liegen in derselben Grid-Zelle übereinander, die Zelle
     wird dabei automatisch so breit wie die breitere der beiden (Name/„Abmelden") – anders als bei
     rein absolut positionierten Kindern, die dem Elternelement keine eigene Breite mehr liefern und
     es auf 0 kollabieren lassen. */
  display: inline-grid;
  height: 16px;
  overflow: hidden;
}
.logout-link-name,
.logout-link-abmelden {
  grid-area: 1 / 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  white-space: nowrap;
  transition: transform .2s ease, opacity .2s ease;
}
.logout-link-abmelden {
  transform: translateY(100%);
  opacity: 0;
}
.logout-link:hover .logout-link-name {
  transform: translateY(-100%);
  opacity: 0;
}
.logout-link:hover .logout-link-abmelden {
  transform: translateY(0);
  opacity: 1;
}
@media (prefers-reduced-motion: reduce) {
  .logout-link-name, .logout-link-abmelden { transition: none; }
}

/* ── Utility ───────────────────────────────────────────────────────────── */
.hidden { display: none !important; }

/* ── Responsive ────────────────────────────────────────────────────────── */
@media (max-width: 640px) {
  .card { padding: 20px 18px; }
  .header-inner { gap: 12px; }
  .header-brand h1 { font-size: 18px; }
  .consolidated-header { flex-direction: column; }
  .markdown-body table { display: block; overflow-x: auto; }
}

/* ═══════════════════════════════════════════════════════════════════════
   TMK DESIGN SYSTEM v1.2 — GEMEINSAME KOMPONENTEN (Phase 3, Schritt 1)
   ───────────────────────────────────────────────────────────────────────
   Neue, semantische Klassen auf Basis der TMK-Tokens (siehe Kopf dieser
   Datei). Bewusst additiv: keine bestehende View verweist bisher auf diese
   Klassen — jede View wird in ihrem eigenen Commit einzeln umgestellt
   (siehe docs/design-migration-plan.md, Abschnitt 6). Präfix „tmk-",
   damit nichts mit bestehenden Legacy-Klassen kollidiert.
   ═══════════════════════════════════════════════════════════════════════ */

/* ── Typografie ────────────────────────────────────────────────────────── */
.tmk-display  { font-size: 40px; line-height: 46px; font-weight: 600; color: var(--text); }
.tmk-h1       { font-size: 32px; line-height: 38px; font-weight: 600; color: var(--text); }
.tmk-h2       { font-size: 24px; line-height: 30px; font-weight: 600; color: var(--text); }
.tmk-h3       { font-size: 18px; line-height: 24px; font-weight: 600; color: var(--text-akzent); }
.tmk-text     { font-size: 16px; line-height: 23px; color: var(--text); }
.tmk-text-klein { font-size: 14px; line-height: 20px; color: var(--text-sekundaer); }
.tmk-label {
  font-size: 12px; font-weight: 600; color: var(--text-sekundaer);
  text-transform: uppercase; letter-spacing: .06em;
}
.tmk-flusstext { max-width: 65ch; }
.tabular-nums { font-variant-numeric: tabular-nums; }
.tmk-mono { font-family: var(--font-mono); background: var(--flaeche); }

/* ── Icons (siehe static/icons.js) ─────────────────────────────────────── */
.tmk-icon { width: 18px; height: 18px; flex-shrink: 0; vertical-align: -3px; }
.tmk-icon-groß { width: 24px; height: 24px; }

/* ── Schaltflächen ─────────────────────────────────────────────────────── */
.tmk-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 40px; padding: 0 20px;
  border-radius: var(--radius-s); font-size: 14px; font-weight: 600;
  font-family: inherit; cursor: pointer; white-space: nowrap;
  transition: background .15s, color .15s, border-color .15s;
}
.tmk-btn:disabled { opacity: .5; cursor: not-allowed; }
.tmk-btn-primaer {
  background: var(--akzent); color: var(--text-auf-akzent); border: 1.5px solid var(--akzent);
}
.tmk-btn-primaer:hover:not(:disabled) { background: var(--akzent-hover); border-color: var(--akzent-hover); }
.tmk-btn-sekundaer {
  background: transparent; color: var(--akzent); border: 1.5px solid var(--akzent);
}
.tmk-btn-sekundaer:hover:not(:disabled) { background: var(--flaeche-akzent); }

/* ── Kachel ────────────────────────────────────────────────────────────── */
.tmk-kachel {
  background: var(--flaeche); border-radius: var(--radius-m); padding: 20px;
}
.tmk-kachel-akzent { background: var(--flaeche-akzent); }
.tmk-kachel-titel { font-size: 18px; line-height: 24px; font-weight: 600; color: var(--text-akzent); margin-bottom: 8px; }

/* ── Hinweisbox ────────────────────────────────────────────────────────── */
.tmk-hinweis {
  background: var(--flaeche-akzent); border-left: 4px solid var(--akzent);
  padding: 14px 16px; border-radius: 0 var(--radius-m) var(--radius-m) 0;
  font-size: 14px; color: var(--text);
}

/* ── Statusbadge ───────────────────────────────────────────────────────── */
/* Punkt (8 px) und Rahmen in der Statusfarbe, Schrift in der -text-Variante (Kontrast), Grund --grund.
   Farbe allein ist nie ein Status: das Wort steht immer dabei. */
.tmk-statusbadge {
  --badge-farbe: var(--tmk-grau);
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px 3px 8px; border-radius: var(--radius-m);
  border: 1px solid var(--badge-farbe); background: var(--grund);
  font-size: 12px; font-weight: 600; color: var(--text-sekundaer);
}
.tmk-statusbadge::before {
  content: ""; width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; background: var(--badge-farbe);
}
.tmk-statusbadge-aktiv       { --badge-farbe: var(--status-ok);      color: var(--status-ok-text); }
.tmk-statusbadge-prototyp    { --badge-farbe: var(--status-warnung); color: var(--status-warnung-text); }
.tmk-statusbadge-entwicklung { --badge-farbe: var(--tmk-blau-3);     color: var(--text-sekundaer); }
.tmk-statusbadge-gestoert    { --badge-farbe: var(--status-kritisch); color: var(--status-kritisch-text); }
.tmk-statusbadge-deaktiviert { --badge-farbe: var(--tmk-grau);       color: var(--tmk-grau); }
/* Status-Badges mit Blinkpunkt: nur der Punkt blinkt (Verfügbar grün, Prototyp gelb), Fläche und Schrift bleiben ruhig */
@keyframes tmk-punkt-blinken {
  from { opacity: 1; }
  to   { opacity: .25; }
}
.tmk-statusbadge--punkt-blinkt::before, .tmk-statusbadge--blinkt::before { animation: tmk-punkt-blinken 1.2s ease-in-out infinite alternate; }
@media (prefers-reduced-motion: reduce) { .tmk-statusbadge--blinkt::before, .tmk-statusbadge--punkt-blinkt::before { animation: none; } }

/* ── Kennzahl-Kachel ───────────────────────────────────────────────────── */
.tmk-kennzahl {
  background: var(--grund); border: 1px solid var(--linie); border-top: 3px solid var(--akzent);
  border-radius: var(--radius-m); padding: 16px 18px;
}
.tmk-kennzahl-wert { font-size: 30px; line-height: 36px; font-weight: 600; color: var(--text); font-variant-numeric: tabular-nums; }
.tmk-kennzahl-bezeichnung { font-size: 12px; font-weight: 600; color: var(--text-sekundaer); text-transform: uppercase; letter-spacing: .06em; margin-top: 4px; }
.tmk-kennzahl-anker { font-size: 13px; color: var(--text-sekundaer); margin-top: 6px; }
.tmk-kennzahl-anker--fehlend::before { content: "— "; }

/* ── Tabelle ───────────────────────────────────────────────────────────── */
.tmk-tabelle { width: 100%; border-collapse: collapse; }
.tmk-tabelle thead th {
  background: var(--akzent); color: var(--text-auf-akzent);
  padding: 10px 14px; text-align: left; font-size: 13px; font-weight: 600;
}
.tmk-tabelle tbody td { padding: 10px 14px; font-size: 14px; color: var(--text); border-bottom: 1px solid var(--linie); }
.tmk-tabelle tbody tr:nth-child(even) { background: var(--flaeche); }
.tmk-tabelle .tmk-zahl { text-align: right; font-variant-numeric: tabular-nums; }

/* ── Modal-Basis (löst 4 unabhängig kopierte Modal-Varianten ab, siehe
   docs/design-migration-plan.md, Entscheidung 5.1) ─────────────────────── */
.tmk-modal-overlay {
  position: fixed; inset: 0; background: rgba(0,36,107,.45);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 60px 20px; z-index: 800;
}
.tmk-modal-overlay.hidden { display: none; }
.tmk-modal-box {
  background: var(--grund); border-radius: var(--radius-m); box-shadow: var(--schatten);
  max-width: 560px; width: 100%; max-height: 85vh; overflow-y: auto; padding: 22px 24px;
}
.tmk-modal-box--breit { max-width: 860px; }
.tmk-modal-kopf { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.tmk-modal-titel { font-size: 18px; line-height: 24px; font-weight: 600; color: var(--text-akzent); }
.tmk-modal-schliessen {
  border: none; background: none; cursor: pointer; color: var(--text-sekundaer); padding: 4px;
}
.tmk-modal-schliessen:hover { color: var(--text); }

/* ── Prozesskette ──────────────────────────────────────────────────────── */
.tmk-prozesskette { display: flex; align-items: center; gap: 6px; }
.tmk-prozessschritt { display: flex; align-items: center; gap: 8px; }
.tmk-prozessschritt-kreis {
  width: 28px; height: 28px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 600; color: var(--text-invers); background: var(--text-sekundaer);
}
.tmk-prozessschritt-label { font-size: 13px; color: var(--text-sekundaer); white-space: nowrap; }
.tmk-prozessschritt.ist-erledigt .tmk-prozessschritt-kreis { background: var(--tmk-dunkelblau); }
.tmk-prozessschritt.ist-erledigt .tmk-prozessschritt-label { color: var(--text); }
.tmk-prozessschritt.ist-aktuell .tmk-prozessschritt-kreis { background: var(--tmk-tuerkis); }
.tmk-prozessschritt.ist-aktuell .tmk-prozessschritt-label { color: var(--text); font-weight: 600; }
.tmk-prozesskette-chevron { color: var(--tmk-hellgrau-2); flex-shrink: 0; }

/* ── Prototyp-Hinweis mit Feedback-Box (static/prototyp-hinweis.js) ─────── */
/* Leiste direkt unter der Kopfzeile, volle Breite, gelb getönt */
.proto-leiste { background: color-mix(in srgb, var(--status-warnung) 22%, var(--grund)); border-bottom: 2px solid var(--status-warnung); }
.proto-leiste-innen { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; padding: 10px 24px; max-width: 1400px; margin: 0 auto; }
.proto-badge { font-size: 14px; padding: 5px 14px 5px 10px; flex-shrink: 0; }
.proto-badge::before { width: 10px; height: 10px; }
.proto-kurz { flex: 1; min-width: 220px; margin: 0; font-size: 14px; color: var(--text); }
.proto-knopf { flex-shrink: 0; }
.proto-box { max-width: 1400px; margin: 0 auto; padding: 4px 24px 16px; }
.proto-box[hidden] { display: none; }
.proto-titel { font-size: 15px; font-weight: 700; color: var(--text); margin: 0 0 4px; }
.proto-text { font-size: 13px; color: var(--text-sekundaer); margin: 0 0 10px; }
.proto-feld { width: 100%; max-width: 720px; display: block; padding: 9px 12px; border: 1.5px solid var(--linie); border-radius: var(--radius-m); font: inherit; font-size: 14px; color: var(--text); background: var(--grund); resize: vertical; outline: none; }
.proto-feld:focus { border-color: var(--akzent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--akzent) 15%, transparent); }
.proto-aktionen { display: flex; align-items: center; gap: 8px; margin-top: 10px; flex-wrap: wrap; max-width: 720px; justify-content: flex-end; }
.proto-status { flex: 1; font-size: 13px; color: var(--text-sekundaer); }
.proto-status:empty { display: none; }
.proto-ok { color: var(--status-ok-text); font-weight: 600; }
.proto-fehler { color: var(--status-kritisch-text); font-weight: 600; }
@media print { .proto-leiste { display: none; } }
