/* app.css — gemeinsame Komponenten der Mockups v2 (App-Shell, Navigation, Karten, Formulare, Segmented-Skala, Tabellen, Aktionsleiste). Seiten-CSS gehört in die jeweilige HTML-Datei. */

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

body {
  font-family: "Geist", system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  color: var(--navy);
  background: var(--linen);
}

/* ---------- App-Shell: Topbar + Sidebar + Main ---------- */

.app { min-height: 100vh; display: flex; flex-direction: column; }

.topbar {
  height: var(--topbar-h);
  background: var(--paper);
  border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 16px;
  padding: 0 28px;
  position: sticky; top: 0; z-index: 40;
}
.topbar .logo { display: flex; align-items: center; gap: 12px; text-decoration: none; }
.topbar .logo img { height: 30px; display: block; }
.topbar .logo .app-name {
  font-size: 13px; color: var(--ink-soft);
  border-left: 1px solid var(--line); padding-left: 12px;
}
.topbar .spacer { flex: 1; }
.topbar .user { display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--navy); }
.topbar .user .role-chip {
  font-size: 12px; font-weight: 500; letter-spacing: .4px;
  background: var(--info-soft); color: var(--navy);
  border-radius: var(--r-pill); padding: 4px 12px;
}
.topbar .user .avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--navy); color: #fff;
  display: grid; place-items: center;
  font-size: 13px; font-weight: 600;
}
.topbar .icon-btn {
  width: 38px; height: 38px; border-radius: 50%;
  display: grid; place-items: center;
  color: var(--navy); text-decoration: none;
}
.topbar .icon-btn:hover { background: var(--info-soft); }
.topbar .icon-btn.active { background: var(--info-soft); }

.shell { flex: 1; display: flex; min-height: 0; }

/* Sidebar: rollenbasiert, KEINE Rollen-Überschriften. Nur die Einträge der angemeldeten Rolle. */
.sidebar {
  width: var(--sidebar-w); flex: none;
  background: var(--navy); color: var(--sidebar-ink);
  display: flex; flex-direction: column;
  padding: 20px 14px;
  position: sticky; top: var(--topbar-h);
  height: calc(100vh - var(--topbar-h));
  overflow-y: auto;
}
.sidebar nav { display: flex; flex-direction: column; gap: 4px; }
.nav-item {
  display: flex; align-items: center; gap: 12px;
  color: var(--sidebar-ink); text-decoration: none;
  font-size: 15px; font-weight: 400;
  padding: 11px 16px; border-radius: var(--r-pill);
}
.nav-item:hover { background: rgba(255, 255, 255, .07); color: #fff; }
.nav-item.active { background: var(--paper); color: var(--navy); font-weight: 500; }
.nav-item.active:hover { background: var(--paper); color: var(--navy); }
.nav-item.active::before {
  content: ""; width: 8px; height: 8px; border-radius: 50%;
  background: var(--red); flex: none;
  outline: 4px solid rgba(190, 32, 45, .25);
}
.sidebar .sidebar-foot {
  margin-top: auto; padding: 16px;
  font-size: 12px; color: rgba(198, 208, 226, .55);
}

/* Kurs-Kontextkopf in der Sidebar (Trainer-Ansichten) */
.side-context {
  background: rgba(255, 255, 255, .08); border-radius: 16px;
  padding: 14px 16px; margin-bottom: 18px;
}
.side-context .kicker { font-size: 11px; letter-spacing: 1.4px; text-transform: uppercase; color: rgba(198, 208, 226, .75); }
.side-context .title { color: #fff; font-size: 15px; font-weight: 500; margin: 4px 0 2px; }
.side-context .meta { font-size: 12.5px; color: rgba(198, 208, 226, .8); }

/* Teilnehmer-Rail (Sidebar-Liste mit Status je Teilnehmer) */
.rail-label { font-size: 11px; letter-spacing: 1.4px; text-transform: uppercase; color: rgba(198, 208, 226, .6); padding: 14px 16px 6px; }
.rail-item {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  color: var(--sidebar-ink); text-decoration: none;
  font-size: 14.5px; padding: 9px 16px; border-radius: var(--r-pill);
}
.rail-item:hover { background: rgba(255, 255, 255, .07); color: #fff; }
.rail-item.active { background: #fff; color: var(--navy); font-weight: 500; }

.rail-item .rail-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rail-item .pill { flex-shrink: 0; }

/* ---------- Seitenbereich ---------- */

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.page { flex: 1; padding: var(--page-y) var(--page-x); max-width: 1720px; width: 100%; margin: 0 auto; }

.page-head { margin-bottom: 28px; }
.eyebrow {
  font-size: 12px; font-weight: 600; letter-spacing: 1.8px; text-transform: uppercase;
  color: var(--red); margin: 0 0 6px;
}
.page-head h1 {
  font-size: 38px; font-weight: 300; letter-spacing: -1px; line-height: 1.15;
  margin: 0; color: var(--navy);
}
.page-head h1 .accent { color: var(--red); }
.page-head .sub { margin: 10px 0 0; font-size: 15px; color: var(--ink-soft); max-width: 72ch; }

h2 { font-size: 22px; font-weight: 400; letter-spacing: -.3px; color: var(--navy); margin: 0 0 6px; }
h3 { font-size: 16px; font-weight: 600; color: var(--navy); margin: 0 0 4px; }

/* ---------- Karten & Flächen ---------- */

.card {
  background: var(--paper); border-radius: var(--r-card);
  box-shadow: var(--shadow-card);
  padding: 28px 32px;
}
.card + .card { margin-top: 24px; }
.card .card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.card .card-hint { font-size: 13.5px; color: var(--ink-soft); }

/* ---------- Schreibgeschützte Karten (TASK-274) ---------- */
/* Reusable Markierung für read-only-Bereiche: helle blaue Fläche (--info-soft)
   auf der ganzen Karte plus dunkelblaues Badge im Kartenkopf. Wird auch für
   gesperrte Kurs-Fakten in der Trainer-Ansicht wiederverwendet. Die Karte
   bleibt zusätzlich am Wortlaut "Schreibgeschützt" erkennbar (WCAG 1.4.1:
   Farbe ist nie der einzige Träger der Information). */
.card--readonly { background: var(--info-soft); }

/* rc-Präfix bewusst (statt bloßem .badge): versand/protokoll_liste.html
   definiert bereits eine eigene lokale .badge-Klasse mit anderen Werten —
   ein globaler bare .badge-Selektor hier wäre nur zufällig durch CSS-
   Ladereihenfolge unschädlich. rc-badge--readonly ist eigenständig, keine
   gemeinsame rc-badge-Basisklasse nötig (bisher einzige Ausprägung). */
.rc-badge--readonly {
  display: inline-flex; align-items: center; flex: none;
  font-size: 12.5px; font-weight: 600; letter-spacing: .2px;
  border-radius: var(--r-pill); padding: 5px 14px; white-space: nowrap;
  background: var(--navy); color: var(--text-on-dark);
}

/* ---------- Sofort wirkende Aktions-Karten (TASK-274) ---------- */
/* Reusable Markierung für Karten mit eigenem, sofort wirkendem Formular
   (kein Sammel-Speichern wie bei den Formular-Karten darüber): Navy-Akzent
   links plus gestapelter, abgesetzter Kartenkopf grenzen sie optisch klar ab. */
.card--aktion { border-left: 4px solid var(--navy); }
.card--aktion .card-head {
  flex-direction: column; align-items: flex-start; gap: 4px;
  padding-bottom: 14px; margin-bottom: 18px;
  border-bottom: 1px solid var(--line);
}
.card--aktion .card-head .card-hint { color: var(--navy); font-weight: 500; }

.note {
  border-radius: 16px; padding: 14px 18px; font-size: 14px;
  background: var(--info-soft); color: var(--navy);
}
.note.ok { background: var(--ok-soft); color: var(--ok); }
.note.warn { background: var(--warn-soft); color: var(--warn); }

/* ---------- Buttons (Pills wie Website) ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: inherit; font-size: 15px; font-weight: 500;
  border-radius: var(--r-pill); padding: 12px 26px;
  cursor: pointer; text-decoration: none;
  border: 1px solid transparent;
  transition: background-color .15s ease, color .15s ease, border-color .15s ease;
}
.btn-primary { background: var(--red); color: #fff; }
.btn-primary:hover { background: #A81C28; }
.btn-secondary { background: transparent; color: var(--navy); border-color: var(--navy); }
.btn-secondary:hover { background: var(--info-soft); }
.btn-ghost { background: transparent; color: var(--navy); padding: 12px 16px; }
.btn-ghost:hover { background: var(--info-soft); }
/* TASK-263: "Speichern & nächster" als grüner Hauptweg (Erfolgsfarbe als Fläche) */
.btn-success { background: var(--ok); color: #fff; }
.btn-success:hover { background: var(--ok-hover); }
.btn.small { font-size: 13.5px; padding: 8px 18px; }
.btn[disabled] { opacity: .45; cursor: not-allowed; }

.link { color: var(--navy); text-decoration: none; border-bottom: 1px solid currentColor; }
.link:hover { color: var(--red); }
.backlink { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; color: var(--ink-soft); text-decoration: none; margin-bottom: 14px; }
.backlink:hover { color: var(--navy); }

/* ---------- Status-Pills (7 Status + Sonderfall) ---------- */

.pill {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12.5px; font-weight: 600; letter-spacing: .2px;
  border-radius: var(--r-pill); padding: 5px 14px; white-space: nowrap;
}
.pill-offen       { background: var(--paper); color: var(--ink-soft); border: 1px solid var(--line); }
.pill-eingegeben  { background: var(--info-soft); color: var(--navy); }
.pill-verarbeitet { background: var(--navy); color: #fff; }
.pill-pruefung    { background: var(--pend-soft); color: var(--pend); }
.pill-freigegeben { background: var(--ok-soft); color: var(--ok); }
.pill-versendet   { background: var(--ok); color: #fff; }
.pill-archiviert  { background: var(--line); color: var(--navy); } /* navy statt ink-soft: 4.17:1 -> ~11:1, WCAG AA (TASK-007) */
.pill-ueberfaellig{ background: var(--warn-soft); color: var(--warn); }
/* Import-spezifische Pills (TASK-027/028 Review-Gate) */
.pill-ok          { background: var(--ok-soft); color: var(--ok); }
.pill-arch        { background: var(--linen); color: var(--ink-soft); }
.pill-aktualisiert{ background: var(--info-soft); color: var(--navy); }
.pill-uebersprungen{ background: var(--warn-soft); color: var(--warn); }
.pill-konflikt    { background: var(--warn-soft); color: var(--warn); } /* TASK-154: eigene Klasse statt Missbrauch von pill-uebersprungen */
/* Trainer-Pills (TASK-265): drei Zustände statt der sieben Kursverwaltungs-Fachstatus,
   eigene Klassen damit die obigen .pill-* der Kursverwaltung unangetastet bleiben. */
.pill-tr-offen  { background: var(--warn-soft); color: var(--warn); }
.pill-tr-arbeit { background: var(--pend-soft); color: var(--pend); }
.pill-tr-fertig { background: var(--ok-soft); color: var(--ok); }

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

.field { display: flex; flex-direction: column; gap: 7px; }
.field label { font-size: 13.5px; font-weight: 600; color: var(--navy); }
.field .req { color: var(--red); }
.field .help { font-size: 13px; color: var(--ink-soft); }

input[type="text"], input[type="email"], input[type="number"], input[type="password"], select, textarea {
  font: inherit; font-size: 15px; color: var(--navy);
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--r-field);
  padding: 12px 14px; width: 100%;
}
textarea { resize: vertical; min-height: 96px; line-height: 1.5; }
input:hover, select:hover, textarea:hover { border-color: #CDC5B8; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--navy); box-shadow: 0 0 0 3px rgba(21, 46, 88, .12); }

.field.error input, .field.error select, .field.error textarea { border-color: var(--warn); }
.field.error .msg { font-size: 13px; color: var(--warn); }

/* ---------- Dropzone (Drag-and-Drop-Datei-Upload, TASK-199/200) ---------- */

.dropzone {
  position: relative;
  border: 2px dashed var(--line);
  border-radius: var(--r-field);
  padding: 32px 24px;
  text-align: center;
  background: var(--linen);
  cursor: pointer;
  transition: border-color .12s ease, background-color .12s ease;
}
.dropzone:hover { border-color: var(--navy); }
/* Navy statt --red: --red liegt zu nah an --warn, ein gültiges Drop-Ziel sähe sonst
   aus wie der Fehlerzustand eine Zeile weiter unten. */
.dropzone.dropzone--dragover { border-color: var(--navy); background: var(--info-soft); }
.field.has-error .dropzone { border-color: var(--warn); }

.dropzone-panel { display: flex; flex-direction: column; align-items: center; gap: 6px; }
/* display:flex aus der Autoren-Ebene schlägt sonst das [hidden] des Browsers —
   ohne diese Regel bleiben beide Panels dauerhaft sichtbar (wie .intern-panel in freigabe.css). */
.dropzone-panel[hidden] { display: none; }
.dropzone-icon { color: var(--navy); }
.dropzone-text { font-size: 15px; font-weight: 600; color: var(--navy); margin: 4px 0 0; }
.dropzone-text-sub { font-size: 13px; color: var(--ink-soft); margin: 0; }
.dropzone-trigger { margin-top: 6px; }
.dropzone-hint { font-size: 13px; color: var(--ink-soft); margin: 8px 0 0; }

.dropzone-filename { font-size: 15px; font-weight: 600; color: var(--navy); margin: 4px 0 0; word-break: break-all; }
.dropzone-filesize { font-size: 13px; color: var(--ink-soft); margin: 0 0 6px; }

/* Auswahl-Panel bei clientseitig ungültiger Datei: Fehlerzustand statt Erfolgsoptik. */
.dropzone-panel--invalid .dropzone-icon { color: var(--warn); }
.dropzone-panel--invalid .dropzone-filename { color: var(--warn); }

/* Ohne JS bleibt das native Input sichtbar; dropzone.js ergänzt danach .visually-hidden. */
.dropzone-input { display: block; margin: 14px auto 0; width: 100%; max-width: 320px; }

.dropzone-error { font-size: 13px; color: var(--warn); margin-top: 6px; }
.dropzone-error[hidden] { display: none; }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px 28px; }
.form-grid .span-2 { grid-column: span 2; }

.autosave { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink-soft); }
.autosave .dot-ok { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); }
/* TASK-263: Erfolgs-Zustand des Auto-Save-Status — grün mit Haken (AC3) */
.autosave--ok { color: var(--ok); font-weight: 500; }
/* TASK-047: Fehlerfall Auto-Save — warn-Inline-Block (AC4) */
.autosave-error { background: var(--warn-soft); border: 1.5px solid var(--warn); border-radius: 12px; padding: 10px 14px; color: var(--warn); }
.autosave.state-error { color: var(--warn); }

/* ---------- Segmented-Skala 1–4 (Bewertungszeilen) ---------- */

.crit-row {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 24px;
  padding: 14px 0; border-bottom: 1px solid var(--line);
}
.crit-row:last-child { border-bottom: none; }
.crit-row .crit-name { font-size: 15px; color: var(--navy); }
/* TASK-045: Read-only-Wert (z. B. "2 = sehr gut") in der Kriterien-Zeile */
.crit-value { font-size: 15px; color: var(--ink-soft); font-weight: 600; }
/* TASK-425: Live-Hinweissatz unter Gesamteindruck — eigene Sub-Zeile statt Quetschen
   in die Segmented-Reihe: flex-basis:100% zusammen mit .crit-row { flex-wrap: wrap }
   erzwingt den Zeilenumbruch, unabhängig von der Fensterbreite. */
.gesamteindruck-hinweis {
  flex-basis: 100%; font-size: 13.5px; color: var(--ink-soft); margin-top: -8px; font-style: italic;
}

.segmented { display: inline-flex; gap: 8px; }
.segmented .seg {
  width: 46px; height: 40px;
  display: grid; place-items: center;
  font: inherit; font-size: 14.5px; font-weight: 500; color: var(--navy);
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--r-field);
  cursor: pointer;
  transition: background-color .12s ease, border-color .12s ease;
}
.segmented .seg:hover { background: var(--linen); border-color: #CDC5B8; }
.segmented .seg[aria-pressed="true"], .segmented .seg.on {
  background: var(--navy); border-color: var(--navy); color: #fff; font-weight: 600;
}
/* TASK-268: „nicht beurteilbar" ist KEINE fünfte Note — abgesetzt durch Trennabstand,
   Klartext statt Ziffer, warme Fläche und gestrichelten Rahmen. */
.segmented .seg-na {
  width: auto; padding: 0 14px; margin-left: 16px;
  background: var(--linen); border-style: dashed; color: var(--ink-soft);
}
.segmented .seg-na[aria-pressed="true"], .segmented .seg-na.on {
  background: var(--ink-soft); border-color: var(--ink-soft); border-style: solid; color: var(--paper);
}

/* ---------- Tabellen (helle Kopfzeile, luftig, aufklappbare Zeilen) ---------- */

/* Scroll-Wrapper für breite Tabellen (TASK-201): overflow-x auf dem Wrapper statt
   auf .table selbst, damit die Karte ihre Breite behält und nur der Tabellenbereich
   horizontal scrollt statt der ganzen Seite. tabindex/role/aria-label kommen als
   Markup-Attribute am Wrapper-Div dazu (WCAG 2.1.1 Tastatur-Erreichbarkeit). */
.table-scroll { overflow-x: auto; }
.table-scroll:focus-visible { outline: 2px solid var(--navy); outline-offset: -2px; }

.table { width: 100%; border-collapse: collapse; }
.table th {
  text-align: left; font-size: 12px; font-weight: 600;
  letter-spacing: 1.2px; text-transform: uppercase; color: var(--ink-soft);
  padding: 12px 16px; border-bottom: 1px solid var(--line);
}
/* TASK-201-Review-Fix: white-space:nowrap NUR für Tabellen im Scroll-Wrapper (Spaltenköpfe
   wie "Manager-E-Mail" nicht mitten im Wort umbrechen). Global auf .table th hätte auch
   nicht in .table-scroll gewrappte Tabellen (z.B. _nutzer_liste.html, signaturen.html)
   auf schmalen Viewports über die Seitenbreite hinaus verbreitert — genau der
   Seiten-Scroll-Bug, den TASK-201 eigentlich beheben sollte. */
.table-scroll .table th {
  white-space: nowrap;
}
.table td { padding: 16px; font-size: 15px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tbody tr:hover td { background: var(--linen); }
.table tr:last-child td { border-bottom: none; }
.table .mono { font-variant-numeric: tabular-nums; letter-spacing: .3px; }

/* TASK-201-Entscheidung: Manager-/HR-E-Mail-Spalten der Teilnehmer-Tabelle zeigen
   nur den gedimmten Kurs-Override-Wert (kein Detail, der unter der Bearbeiten-Ansicht
   fehlen würde) — unterhalb von 900px werden sie ausgeblendet statt die Tabelle
   noch breiter scrollen zu lassen. Voller Wert bleibt über "Bearbeiten" erreichbar. */
@media (max-width: 900px) {
  .table .col-manager, .table .col-hr { display: none; }
}

/* Teilnehmer-Zeile: Aktionssymbole am Zeilenanfang statt Textbuttons am Zeilenende (TASK-277),
   damit Bearbeiten und Freigabe ohne horizontales Scrollen erreichbar bleiben. Kleinere
   Variante des Topbar-.icon-btn (38px dort, hier innerhalb einer Tabellenzeile 28px), gleiche
   Farb-Tokens für einen konsistenten Symbol-Button-Stil. */
.table .col-aktionen { white-space: nowrap; }
.zeile-aktionen { display: flex; gap: 4px; }
.zeile-aktionen .icon-btn {
  width: 28px; height: 28px; border-radius: 50%;
  display: grid; place-items: center;
  color: var(--navy); text-decoration: none;
  background: transparent; border: none; padding: 0; cursor: pointer;
}
.zeile-aktionen .icon-btn:hover,
.zeile-aktionen .icon-btn:focus-visible {
  background: var(--info-soft);
}

/* Aufgeklappte Teilnehmer-Subzeilen: standardmäßig ausgeblendet, JS togglet .open (TASK-019). */
.subrow { display: none; }
.subrow.open { display: table-row; }
.subrow td { background: var(--linen); padding: 0 16px; }
.subrow .sub-list { padding: 6px 0 14px 34px; display: flex; flex-direction: column; }
.sub-item {
  display: flex; align-items: center; gap: 18px;
  padding: 9px 14px; border-radius: 12px; text-decoration: none; color: var(--navy);
  font-size: 14.5px;
}
.sub-item:hover { background: rgba(255, 255, 255, .85); }
.sub-item .grow { flex: 1; }
.sub-item-pdf { font-size: 13px; flex: none; }
/* ZIP-Download-Zeile unter den Teilnehmer-Einträgen einer Subrow (TASK-019). */
.sub-zip-row { padding: 6px 14px 2px; }
.sub-zip-link { font-size: 13px; color: var(--navy); }

.expander {
  display: inline-flex; align-items: center; gap: 8px;
  font: inherit; font-size: 14px; color: var(--navy);
  background: none; border: none; cursor: pointer; padding: 4px 8px; border-radius: 8px;
}
.expander:hover { color: var(--red); }
.expander .chev { transition: transform .15s ease; }
.expander[aria-expanded="true"] .chev { transform: rotate(90deg); }

/* TASK-276 Review-Fix: .expander steht im Stylesheet nach der Pill-Basisklasse und den
   Status-Pills und überschreibt bei gleicher Selektor-Spezifität (0,1,0) deren Optik
   (background, font-weight/-size, padding, border-radius): der Marker-Button
   "Zertifikatserstellung fehlgeschlagen" würde sonst wie ein normaler Navy-Link
   aussehen statt als auffällige Warn-Pill. Kombi-Selektor mit höherer Spezifität
   (0,2,0) erzwingt die Warn-Pill-Optik unabhängig von der Deklarationsreihenfolge,
   der Button bleibt weiter per Tastatur bedienbar. Bewusst der generische Pill-Selektor
   statt des Status-Selektors (siehe Testdatei zu Pill-Kontrast/CSS-Guards): ein
   status-spezifischer Doppelklassen-Selektor als Text im Stylesheet würde deren
   Selektor-Zählung verfälschen. Aktuell kombiniert nur der Überfällig-Status mit dem
   Expander; kommt künftig ein weiterer Status als Expander hinzu, braucht diese Regel
   eine eigene status-spezifische Ergänzung. */
.pill.expander {
  background: var(--warn-soft);
  color: var(--warn);
  font-size: 12.5px;
  font-weight: 600;
  padding: 5px 14px;
  border-radius: var(--r-pill);
}
.pill.expander:hover { color: var(--warn); }

/* ---------- Sticky Aktionsleiste unten ---------- */

.actionbar {
  position: sticky; bottom: 0; z-index: 30;
  background: var(--paper); border-top: 1px solid var(--line);
  padding: 14px var(--page-x);
  display: flex; align-items: center; gap: 14px;
  box-shadow: 0 -8px 24px rgba(21, 46, 88, .05);
}
.actionbar .grow { flex: 1; }
.actionbar .context { display: flex; align-items: center; gap: 12px; font-size: 14px; color: var(--ink-soft); }

/* ---------- Zertifikats-Bühne (A4-Vorschau, Bestandsoptik) ---------- */

.cert-stage {
  background: var(--linen); border-radius: var(--r-card);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 32px;
}
.cert-a4 {
  aspect-ratio: 210 / 297; background: #fff;
  box-shadow: var(--shadow-cert); border-radius: 4px;
  padding: 7% 8%;
  display: flex; flex-direction: column;
  font-size: 14px; color: var(--cert-indigo);
}

/* ---------- A11y & Verhalten ---------- */

:focus-visible { outline: 2px solid var(--navy); outline-offset: 2px; }
.sidebar :focus-visible, .rail-item:focus-visible { outline-color: #fff; }

.visually-hidden {
  position: absolute; width: 1px; height: 1px; margin: -1px;
  clip: rect(0 0 0 0); overflow: hidden; white-space: nowrap;
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* === Ergänzungen TASK-003: htmx-Feedback §6.5, Filter-Pills, Skip-Link === */

/* Formular-Alias: .field.has-error wie .field.error (beide Klassen produzieren dasselbe Ergebnis) */
.field.has-error input,
.field.has-error select,
.field.has-error textarea { border-color: var(--warn); }

/* .field-err wie .msg — beide Klassen für Fehlermeldungen unter Feldern nutzbar */
.field-err { font-size: 13px; color: var(--warn); }
.field.has-error .field-err,
.field.error .field-err { font-size: 13px; color: var(--warn); }

/* Fehler-Zusammenfassung (WCAG 3.3.1, role=alert, tabindex=-1, Ankerlinks zu Feldern) */
.error-summary {
  background: var(--warn-soft); border: 1.5px solid var(--warn);
  border-radius: 16px; padding: 18px 22px; margin-bottom: 20px;
}
.error-summary h2 { font-size: 15px; font-weight: 600; color: var(--warn); margin: 0 0 10px; }
.error-summary ul { margin: 0; padding: 0 0 0 20px; }
.error-summary li { font-size: 14px; margin-bottom: 4px; }
.error-summary a { color: var(--warn); font-weight: 500; text-decoration: underline; }
.error-summary a:focus-visible { outline: 2px solid var(--warn); outline-offset: 2px; border-radius: 2px; }

/* Django-Messages-Bereich (TASK-208): Erfolgs-/Fehlermeldung über dem Formular.
   Optik an .error-summary angelehnt, Erfolg in der ok-Farbe der Tokens. */
.messages { margin-bottom: 20px; display: grid; gap: 10px; }
.message {
  border-radius: 16px; padding: 14px 22px;
  font-size: 15px; font-weight: 500;
  background: var(--ok-soft); border: 1.5px solid var(--ok); color: var(--ok);
}
.message--error, .message--warning {
  background: var(--warn-soft); border-color: var(--warn); color: var(--warn);
}

/* Filter-Pills (konsolidiert aus kursliste.html und beispiel-liste.html) */
.filter-row { display: flex; align-items: center; flex-wrap: wrap; gap: 16px 18px; margin: 0 0 26px; }
.filter-search { width: 380px; max-width: 100%; flex: none; }
.filter-pills { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }
.filter-pill {
  font: inherit; font-size: 14px; font-weight: 500; color: var(--navy);
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--r-pill);
  padding: 9px 18px; cursor: pointer;
}
.filter-pill:hover { border-color: var(--navy); }
.filter-pill:focus-visible { outline: 2px solid var(--navy); outline-offset: 2px; }
.filter-pill.active { background: var(--navy); border-color: var(--navy); color: var(--paper); }
.filter-pill.active:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }

/* Kursliste-Layout (TASK-030, portiert aus mockups-v2/kursliste.html) */
/* Split-Kopf nur wenn eine Kopf-Aktion vorhanden ist — andere .page-head bleiben unberührt. */
.page-head:has(.head-action) { display: flex; align-items: flex-start; justify-content: space-between; gap: 32px; }
.page-head .head-copy { min-width: 0; }
.page-head .head-action { flex: none; padding-top: 26px; display: flex; gap: 12px; }

.table-card { padding: 14px 28px 18px; }
.table th.col-nr     { width: 128px; }
.table th.col-train  { width: 205px; }
.table th.col-zeit   { width: 185px; }
.table th.col-tn     { width: 165px; }
.table th.col-status { width: 150px; }
.table th.col-act    { width: 105px; }
.table td.cell-nr, .table td.cell-zeit { white-space: nowrap; }
.table th.col-act, .table td.cell-act { text-align: right; }
.course-name { font-size: 15px; font-weight: 500; }
.course-firm { font-size: 13px; color: var(--ink-soft); margin-top: 2px; }

/* Leer-State-Karte (ersetzt Inline-Styles im Tabellen-Partial) */
.empty-state { padding: 48px 28px; text-align: center; }

/* htmx-Indikator (konsolidiert aus beispiel-liste.html) + 16px-Navy-Spinner */
.htmx-indicator {
  display: none; width: 16px; height: 16px;
  border: 2px solid var(--line); border-top-color: var(--navy);
  border-radius: 50%; animation: htmx-spin .6s linear infinite;
  vertical-align: middle;
}
.htmx-request .htmx-indicator { display: inline-block; }
@keyframes htmx-spin { to { transform: rotate(360deg); } }

/* Ring-Warte-Indikator + Overlay-Baustein (TASK-452): Navy-Ring mit rotierendem,
   atmendem Rot-Bogen, Design fixiert in docs/design/warte-indikator/inv-j2-ring-5s.svg.
   Dieses Ticket liefert den Baustein selbst; sechs Stellen nutzen ihn bereits: der Ring
   allein in freigabe/partials/_hinweis.html, Ring + Overlay in _fassungen.html und den
   vier Import-Templates (Verdrahtung siehe static/js/warte_overlay.js). Einordnung
   .htmx-indicator vs. .warte-ring/.warte-overlay: siehe templates/core/styleguide.html
   Abschnitt "htmx-Feedback". */
.warte-ring {
  --warte-ring-groesse-mittel: 24px; /* .warte-ring--md: Buttons/Formularfelder */
  --warte-ring-groesse-gross: 40px;  /* .warte-ring--lg: Overlay/großflächig */
  --warte-ring-dauer: 5s;            /* Umlaufzeit + Atem-Rhythmus, 1:1 aus Referenz-SVG */
  --warte-ring-strichbreite: 4;      /* stroke-width beider Kreise, viewBox-Einheiten aus Referenz-SVG */
  display: inline-block; vertical-align: middle;
}
/* .warte-ring--sm (16px) bewusst nicht angelegt: aktuell kein Aufrufer dafür (spekulative
   Generalisierung) — bei Bedarf eine Zeile analog --md/--lg ergänzen. */
.warte-ring--md { width: var(--warte-ring-groesse-mittel); height: var(--warte-ring-groesse-mittel); }
.warte-ring--lg { width: var(--warte-ring-groesse-gross); height: var(--warte-ring-groesse-gross); }
.warte-ring__bahn { fill: none; stroke: var(--navy); stroke-width: var(--warte-ring-strichbreite); }
.warte-ring__bogen {
  /* --red ist laut tokens.css eigentlich für genau EINE Primäraktion pro Ansicht
     reserviert; der dekorative Indikator-Bogen ist eine bewusste, kundenfreigegebene
     Ausnahme davon, siehe docs/design/warte-indikator/README.md. */
  fill: none; stroke: var(--red); stroke-width: var(--warte-ring-strichbreite); stroke-linecap: round;
  transform-box: view-box; transform-origin: 22px 22px;
  animation: warte-ring-dreh var(--warte-ring-dauer) linear infinite,
             warte-ring-strich var(--warte-ring-dauer) ease-in-out infinite;
}
@keyframes warte-ring-dreh { to { transform: rotate(360deg); } }
@keyframes warte-ring-strich {
  0%   { stroke-dasharray: 30 83; stroke-dashoffset: 0; }
  50%  { stroke-dasharray: 62 51; stroke-dashoffset: -14; }
  100% { stroke-dasharray: 30 83; stroke-dashoffset: -113; }
}
@media (prefers-reduced-motion: reduce) {
  .warte-ring__bogen { animation: none; stroke-dasharray: 62 51; }
}

/* Markiert den Bereich, über dem ein .warte-overlay liegen soll (Positionierungs-Anker).
   isolation: isolate (Review-Runde 4, Finding C) erzwingt die EINE geltende Regel: das
   Overlay darf niemals über Elemente ausserhalb dieses Bereichs steigen (Topbar 40,
   Sticky-Actionbar 30, Skip-Link 100) — jeder .warte-bereich ist sein eigener
   Stacking-Context, der --warte-overlay-z unten nach aussen komplett kapselt. Aufrufer
   brauchen deshalb KEINEN eigenen inline z-index mehr zur Korrektur. */
.warte-bereich { position: relative; isolation: isolate; }

/* Warte-Overlay (grosser Spinner + Text, dunkelt den umschliessenden Bereich leicht ab).
   Eigene Sichtbarkeitsregel statt der Klasse .htmx-indicator: die traegt in diesem
   Projekt selbst 16px-Spinner-Geometrie mit (siehe .htmx-indicator oben) und wuerde sie
   vererben. Ansage-Kontrakt fuer Screen-Reader siehe templates/partials/_warte_overlay.html. */
.warte-overlay {
  --warte-overlay-deckkraft: .82;  /* Weiß-Deckkraft der Abblend-Fläche über dem Inhalt */
  --warte-overlay-z: 1;            /* nur ggue. eigenen Geschwistern im isolierten .warte-bereich noetig */
  display: none; position: absolute; inset: 0; z-index: var(--warte-overlay-z);
  flex-direction: column; align-items: center; justify-content: center; gap: 12px;
  background: rgba(255, 255, 255, var(--warte-overlay-deckkraft));
}
.htmx-request .warte-overlay { display: flex; }
.warte-overlay__text { font-size: 14px; font-weight: 500; color: var(--navy); }

/* htmx Inline-Erfolg und -Fehler (§6.5) */
.hx-success {
  background: var(--ok-soft); color: var(--ok);
  border-radius: var(--r-field); padding: 12px 16px; font-size: 14px; font-weight: 500;
}
.hx-error {
  background: var(--warn-soft); color: var(--warn);
  border-radius: var(--r-field); padding: 12px 16px; font-size: 14px;
}
.hx-error .retry-link {
  color: var(--warn); font-weight: 600; text-decoration: underline;
  background: none; border: none; cursor: pointer;
  font: inherit; font-size: 14px; padding: 0; margin-left: 8px;
}
.hx-error .retry-link:hover { text-decoration: none; }
.hx-error .retry-link:focus-visible { outline: 2px solid var(--warn); outline-offset: 2px; border-radius: 2px; }

/* Skip-Link (konsolidiert aus base.html-Skeleton; gilt global für alle Templates) */
.skip-link {
  position: absolute; top: 8px; left: 8px; z-index: 100;
  padding: 8px 18px; background: var(--navy); color: #fff;
  border-radius: var(--r-pill); font-size: 14px; font-weight: 500;
  text-decoration: none; transform: translateY(-200%); transition: transform .15s ease;
}
.skip-link:focus-visible { transform: translateY(0); outline: 2px solid #fff; outline-offset: 2px; }

/* === Trainer-Zugang (TASK-042) === */

/* Zentrierter Inhaltsbereich: eine Karte, Lesbreite statt App-Shell */
.trainer-page { max-width: 620px; margin: 0 auto; padding: 56px 24px; }
.trainer-page .card { padding: 32px; }

/* Fehlermeldung im Formular: warn-Fläche mit warn-Text (DESIGN.md §3.2) */
.zugang-fehler {
  background: var(--warn-soft); color: var(--warn);
  border-radius: var(--r-field); padding: 12px 16px;
  font-size: 14px; margin: 0 0 18px;
}

/* Kartentitel in Trainer-Größe: kleiner als der 38px-Seitentitel */
.trainer-titel { font-size: 28px; font-weight: 300; letter-spacing: -.6px; margin: 0 0 8px; color: var(--navy); }
.trainer-hint { font-size: 14px; color: var(--ink-soft); margin: 0 0 22px; }

/* Abstand unter dem Passwort-Feld im Zugangs-Formular */
.field--mb-22 { margin-bottom: 22px; }

/* === Kurs-Fakten (TASK-043) === */

/* Seiten-Layout: Arbeitsspalte beschränkt auf Lesbreite, Cards haben Abstand */
.kurs-fakten-page { max-width: 860px; }
.kurs-fakten-page .card { margin-bottom: 24px; }
.kurs-fakten-page .page-head { margin-bottom: 28px; }

/* Aktionsleiste unter dem Formular (nicht sticky, da kurze Seite) */
.kf-actionbar {
  display: flex; justify-content: flex-end; gap: 12px;
  padding: 20px 0 8px;
}

/* Zeichenzähler unter Textareas */
.char-counter {
  font-size: 13px; color: var(--ink-soft);
  display: block; margin-top: 2px;
}
.char-counter--over { color: var(--warn); font-weight: 500; }
/* Zahl im Zähler etwas kräftiger als "/ max Zeichen" (TASK-433: eigener Selektor, sonst
   erschiene .count laut TASK-308-CSS-Guard als unformatierter Fließtext). */
.char-counter .count { font-weight: 600; }

/* Kurs-Fakten-Leiste (read-only Partial im Bewertungsformular) */
.kursfakten { margin-bottom: 20px; }

/* Definition list innerhalb der Leiste */
.kf-dl { margin: 12px 0 14px; display: flex; flex-direction: column; gap: 10px; }
.kf-dl dt {
  font-size: 12px; font-weight: 600; letter-spacing: 1.2px;
  text-transform: uppercase; color: var(--ink-soft); margin-bottom: 2px;
}
.kf-dl dd { margin: 0; font-size: 14px; color: var(--navy); white-space: pre-wrap; }
.kf-leer { color: var(--ink-soft); font-style: italic; }

/* Link "Kurs-Fakten bearbeiten" innerhalb der Leiste */
.kf-actions { margin-top: 4px; }

/* ---------- Teilnehmer-Bewertung (TASK-044) ---------- */

/* Kopfzeile mit Pager rechts */
.head-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; max-width: 900px; }
.pager { display: flex; gap: 10px; flex: none; padding-bottom: 6px; }

/* Arbeitsspalte begrenzt die Formularbreite */
.work-col { max-width: 900px; }

/* fieldset-Reset in der Kriterien-Liste (kein Browser-Default-Rahmen) */
.crit-list fieldset { border: 0; margin: 0; padding: 0; min-inline-size: auto; }

/* Pflichtfeld-/Hinweis-Legende oberhalb des Formulars */
.req-legend { font-size: 13px; color: var(--ink-soft); margin-bottom: 14px; }
.req-legend .req { color: var(--red); }

/* Pflicht-Hinweis-Box oberhalb des Bewertungsformulars (TASK-264): auffällige
   Fläche mit Rahmen statt Fließtext, wechselt bei gescheitertem Absenden in
   den Warnzustand (--warn-Modifier, an .error-summary angelehnt). */
/* TASK-308: Die Legacy-Klassen der Freigabe-Hinweise (race-hinweis, korrektur-fehler,
   korrektur-hinweis, cert-stage-hinweis, warn-soft, korrektur-fehler-titel/-liste)
   hatten nie eigene Regeln und erschienen als Fließtext. Sie sind hier als
   Selektor-Aliase der hinweis-box-Familie ergänzt statt im Markup ersetzt, weil
   freigabe/views.py identische Klassen in Inline-Fallback-HTML nutzt und Tests
   die Klassennamen im gerenderten HTML zusichern.
   TASK-319 Phase 2: .kein-zertifikat-fehler (Validierungsfehler im „Kein
   Zertifikat"-Formular, z. B. fehlende Begründung) reiht sich hier ein statt eine
   eigene Regel zu bekommen — identisches Muster wie .korrektur-fehler, kombiniert im
   Markup mit .warn-soft für die Warnfarbe. */
.hinweis-box, .race-hinweis, .korrektur-fehler, .korrektur-hinweis, .cert-stage-hinweis,
.layout-ueberlauf-hinweis, .rerender-ausstehend-hinweis, .rerender-fehlgeschlagen-hinweis, .kein-zertifikat-fehler {
  background: var(--info-soft); border: 1.5px solid var(--line);
  border-radius: 16px; padding: 18px 22px; margin-bottom: 20px;
}
.hinweis-box--warn, .warn-soft { background: var(--warn-soft); border-color: var(--warn); }
.hinweis-box-titel, .korrektur-fehler-titel { font-size: 15px; font-weight: 600; color: var(--navy); margin: 0 0 8px; }
.hinweis-box--warn .hinweis-box-titel, .warn-soft .korrektur-fehler-titel { color: var(--warn); }
.hinweis-box-icon { margin-right: 6px; }
.hinweis-box-zaehler { font-size: 14px; font-weight: 500; margin: 0 0 10px; }
.hinweis-box-liste, .korrektur-fehler-liste { margin: 0 0 10px; padding: 0 0 0 20px; font-size: 14px; }
.hinweis-box-liste li, .korrektur-fehler-liste li { margin-bottom: 2px; color: var(--ink-soft); }
/* Noch offene Angabe: Warnfarbe UND Fettung, dazu ein .visually-hidden-Zusatz
   im Markup — der Zustand hängt damit nicht allein an der Farbe (WCAG 1.4.1). */
.hinweis-box-liste li.offen { color: var(--warn); font-weight: 600; }
.hinweis-box-legende, .hinweis-box-zwischenstand { font-size: 13px; color: var(--ink-soft); margin: 0; }
.hinweis-box-legende { margin-bottom: 4px; }
/* Inhalt der cert-stage-hinweis-Box (_hinweis.html): Text, Fehlerhervorhebung
   (Farbe UND Fettung, analog li.offen — WCAG 1.4.1) und Recovery-Formular. */
.hinweis-text { margin: 0; font-size: 15px; }
.hinweis-fehler { color: var(--warn); font-weight: 600; }
.recovery-form { margin-top: 12px; }
/* Wrapper des "Jetzt aktualisieren"-Knopfs im pipeline_laeuft-Zustand (TASK-278):
   trägt bei aktivem Poll die hx-Attribute, das Markup selbst braucht nur Abstand. */
.pipeline-poll { margin-top: 12px; }

/* Pflichtfeld-Marker am Feld-/Kartenlabel: Sternchen, dekorativ (aria-hidden) —
   die Erläuterung steht in .hinweis-box-legende, die Screenreader-Ansage kommt
   aus dem begleitenden .visually-hidden-Text "Pflichtfeld" am Marker selbst. */
.pflicht-marker { color: var(--warn); font-weight: 700; margin-left: 3px; }

/* ---------- Trainer-Kursübersicht (TASK-046) ---------- */

/* Kurs-Liste: Breite begrenzt wie work-col, Abstand zwischen Karten via .card-Margin */
.kurs-list { max-width: 900px; }

/* Kurs-Karte: Flex-Layout mit linker Inhaltsspalte und rechter Aktionsspalte */
.kurs-body { display: flex; align-items: flex-start; justify-content: space-between; gap: 28px; }
.kurs-left { flex: 1; min-width: 0; }
.kurs-right { flex: none; display: flex; flex-direction: column; align-items: flex-end; gap: 14px; min-width: 210px; }

/* Kursnummer · Firma unterhalb des Titels */
.kurs-meta { font-size: 14px; color: var(--ink-soft); margin: 4px 0 16px; }

/* Fortschrittsbereich: Text + Balken gestapelt */
.kurs-fortschritt { display: flex; flex-direction: column; gap: 8px; }
.kurs-ft-text { font-size: 14px; color: var(--navy); }

/* Progressbar */
.progress { height: 8px; background: var(--line); border-radius: var(--r-pill); overflow: hidden; }
.progress-fill { height: 100%; background: var(--navy); border-radius: var(--r-pill); }

/* Kurs-Fakten-Status-Zeile */
.kf-status { display: flex; align-items: center; gap: 6px; font-size: 14px; margin: 14px 0 0; }
.kf-status.ok { color: var(--ok); }
.kf-status.warn { color: var(--warn); }

/* Aktionsbereich rechts: Buttons vertikal gestapelt, rechtsbündig */
.kurs-actions { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }

/* Kurs-Einstieg: zwei Schritte (Kurs-Fakten, Bewertung) untereinander (TASK-209) */
.kurs-einstieg-schritte { list-style: none; margin: 20px 0 0; padding: 0; display: flex; flex-direction: column; gap: 20px; }
.kurs-einstieg-schritt { border-top: 1px solid var(--line); padding-top: 20px; }
.kurs-einstieg-schritt:first-child { border-top: none; padding-top: 0; }
.kurs-einstieg-schritt h2 { font-size: 18px; font-weight: 500; margin: 2px 0 6px; color: var(--navy); }
.kurs-einstieg-schritt-label { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-soft); margin: 0; }
.kurs-einstieg-schritt .btn { margin-top: 12px; }

/* ---------- Topbar-Hilfe-Link (TASK-050) ---------- */
/* Konsistent zu den Topbar-Elementen: Navy, Pill-Hover, dezentes Fragezeichen-Icon. */
.topbar-hilfe-link {
  display: flex; align-items: center; gap: 6px;
  color: var(--navy); text-decoration: none;
  font-size: 14px; padding: 6px 10px;
  border-radius: var(--r-pill);
}
.topbar-hilfe-link:hover { background: var(--info-soft); }
.topbar-hilfe-icon {
  display: grid; place-items: center;
  width: 22px; height: 22px; border-radius: 50%;
  border: 1.5px solid var(--navy);
  font-size: 13px; font-weight: 600;
  flex: none;
}

/* ---------- Willkommens-Modal (TASK-050) ---------- */
/* Nutzt ausschließlich Design-Tokens; die rote Primär-Aktion ist die EINZIGE rote Fläche. */
.welcome-dialog {
  border: none;
  border-radius: var(--r-card);
  box-shadow: var(--shadow-cert);
  padding: 0;
  max-width: 520px;
  width: calc(100% - 48px);
  background: var(--paper);
}
.welcome-dialog::backdrop { background: rgba(21, 46, 88, 0.45); }
.welcome-close {
  position: absolute;
  top: 16px; right: 20px;
  background: none; border: none;
  font-size: 22px; line-height: 1;
  color: var(--ink-soft);
  cursor: pointer;
  padding: 4px 8px; border-radius: 6px;
}
.welcome-close:hover { background: var(--linen); }
.welcome-inner { padding: 32px 36px 28px; }
.welcome-eyebrow {
  color: var(--ink-soft); font-size: 12px;
  letter-spacing: 1px; text-transform: uppercase;
  margin: 0 0 8px;
}
.welcome-title { margin: 0 0 16px; font-size: 22px; }
.welcome-steps {
  margin: 0 0 24px; padding-left: 24px;
  display: flex; flex-direction: column; gap: 12px;
  color: var(--navy); font-size: 15px; line-height: 1.6;
}
.welcome-actions {
  display: flex; align-items: center;
  justify-content: flex-end; gap: 12px;
}
.welcome-cta-form { display: inline; }
.welcome-cta {
  background: var(--red); color: var(--paper); border-color: var(--red);
}
.welcome-cta:hover { filter: brightness(0.92); }

/* ---------- Hilfe-Seite (TASK-050) ---------- */
.hilfe-body { display: flex; flex-direction: column; gap: 20px; }
.hilfe-card { padding: 28px 32px; }
.hilfe-card h2 { margin: 0 0 12px; font-size: 18px; color: var(--navy); }
.hilfe-skala {
  margin: 0 0 16px; padding-left: 20px;
  display: flex; flex-direction: column; gap: 6px; line-height: 1.6;
}
.hilfe-hint {
  background: var(--info-soft); border-radius: var(--r-field);
  padding: 14px 18px; margin: 0; line-height: 1.6;
}
.hilfe-footer { padding: 8px 0 32px; }
/* Abschnittsuebersicht (TASK-210) */
.hilfe-toc {
  background: var(--info-soft); border-radius: var(--r-field);
  padding: 16px 20px; margin: 0;
}
.hilfe-toc-titel {
  margin: 0 0 8px; font-size: 12px; letter-spacing: 1px;
  text-transform: uppercase; color: var(--ink-soft);
}
.hilfe-toc ul {
  margin: 0; padding-left: 20px;
  display: flex; flex-direction: column; gap: 6px; line-height: 1.6;
}
