:root {
  --primary: #FFD32B;
  --primary-hover: #EFB604;
  --primary-dark: #162455;
  --accent: #2A5BFF;
  --accent-hover: #1E48E5;
  --accent-soft: rgba(42, 91, 255, 0.10);
  --accent-soft-strong: rgba(42, 91, 255, 0.16);
  --bg-app: #F4F7FB;
  --bg-card: #ffffff;
  --bg-box: #F4F7FB;
  --bg-header: #ffffff;
  --text-main: #0F172A;
  --text-muted: #5A6B86;
  --text-on-primary: #162455;
  --text-on-accent: #ffffff;
  --border-light: #E2E8F0;
  --border-medium: #B8C5D6;
  --danger: #ef4444;
  --success: #10b981;
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.06), 0 2px 4px -2px rgb(0 0 0 / 0.04);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.08), 0 4px 6px -4px rgb(0 0 0 / 0.05);
  --shadow-box: 0px 12px 32px rgba(12, 12, 13, 0.08);
  --radius-md: 0.875rem;
  --radius-lg: 1.25rem;
  --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
}
[data-theme="dark"] {
  --primary: #FFD32B;
  --primary-hover: #FFE066;
  --primary-dark: #E6EDFF;
  --accent: #6E8BFF;
  --accent-hover: #88A1FF;
  --accent-soft: rgba(110, 139, 255, 0.16);
  --accent-soft-strong: rgba(110, 139, 255, 0.26);
  --bg-app: #0B1220;
  --bg-card: #131C2E;
  --bg-box: #1B2540;
  --bg-header: #0F1727;
  --text-main: #E6EEFF;
  --text-muted: #93A4C4;
  --text-on-primary: #162455;
  --text-on-accent: #0B1220;
  --border-light: #243353;
  --border-medium: #3A4D75;
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.4), 0 2px 4px -2px rgb(0 0 0 / 0.3);
  --shadow-box: 0px 12px 32px rgba(0, 0, 0, 0.55);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  font-family: var(--font-sans);
  background: var(--bg-app);
  color: var(--text-main);
  -webkit-font-smoothing: antialiased;
  line-height: 1.5;
}

.visually-hidden {
  position: absolute; width: 1px; height: 1px; padding: 0;
  margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0;
}

/* ─── Header ───────────────────────────────────────────────────────── */
.admin-header {
  background: var(--bg-header);
  border-bottom: 1px solid var(--border-light);
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.25rem;
}
.admin-logo {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  text-decoration: none;
  color: var(--text-main);
}
.admin-logo img { height: 28px; display: block; }
.admin-logo-divider {
  width: 1px;
  height: 22px;
  background: var(--border-light);
}
.admin-logo-label {
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.admin-header-right { display: flex; align-items: center; gap: 0.5rem; }
.admin-locked {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.78rem;
  color: var(--text-muted);
  padding: 0.3rem 0.55rem;
  border-radius: 9999px;
  background: var(--bg-box);
  border: 1px solid var(--border-light);
}
.btn-icon-ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  padding: 0;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 10px;
  color: var(--text-muted);
  cursor: pointer;
  font-family: inherit;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
}
.btn-icon-ghost:hover { background: var(--bg-box); color: var(--text-main); border-color: var(--border-light); }
.btn-icon-ghost:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--accent-soft); }
.btn-icon-ghost svg { display: block; }
.theme-icon-dark { display: none; }
[data-theme="dark"] .theme-icon-light { display: none; }
[data-theme="dark"] .theme-icon-dark { display: block; }

/* ─── Buttons ──────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-family: inherit;
  font-size: 0.92rem;
  font-weight: 600;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  padding: 0.55rem 1rem;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s, box-shadow 0.15s;
  background: transparent;
  color: var(--text-main);
  white-space: nowrap;
}
.btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--accent-soft-strong);
}
.btn-primary {
  background: var(--primary);
  color: var(--text-on-primary);
  border-color: var(--primary-hover);
}
.btn-primary:hover { background: var(--primary-hover); }
.btn-secondary {
  background: #fff;
  border-color: var(--border-medium);
  color: var(--text-main);
}
.btn-secondary:hover { background: var(--bg-box); }
.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border-color: transparent;
}
.btn-ghost:hover { background: rgba(22, 36, 85, 0.06); color: var(--text-main); }
.btn-block { width: 100%; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }

/* ─── Main ─────────────────────────────────────────────────────────── */
.admin-main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem 1.25rem 4rem;
}

/* ─── Login ────────────────────────────────────────────────────────── */
.login-card {
  max-width: 420px;
  margin: 6vh auto 0;
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-box);
  padding: 2.25rem 2rem 2rem;
}
.login-card h1 {
  font-size: 1.45rem;
  margin-bottom: 0.35rem;
  color: var(--primary-dark);
}
.login-sub {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin-bottom: 1.5rem;
}
#login-form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
#login-form input {
  width: 100%;
  font-family: inherit;
  font-size: 1rem;
  padding: 0.7rem 0.9rem;
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-md);
  background: #fff;
  color: var(--text-main);
}
#login-form input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.login-error {
  color: var(--danger);
  font-size: 0.88rem;
  margin-top: 0.25rem;
}

/* ─── Dashboard ────────────────────────────────────────────────────── */
.dashboard-head { margin-bottom: 1.25rem; }
.dashboard-head h1 {
  font-size: 1.6rem;
  color: var(--primary-dark);
  margin-bottom: 0.25rem;
}
.dashboard-sub { color: var(--text-muted); font-size: 0.95rem; }

.tabs {
  display: flex;
  gap: 0.25rem;
  border-bottom: 1px solid var(--border-light);
  margin: 1.25rem 0 1rem;
}
.tab {
  background: transparent;
  border: none;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-muted);
  padding: 0.7rem 1.1rem;
  cursor: pointer;
  border-bottom: 3px solid transparent;
  margin-bottom: -1px;
  transition: color 0.15s, border-color 0.15s;
}
.tab:hover { color: var(--text-main); }
.tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.panel {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: 1.25rem;
}
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}
.panel-meta { color: var(--text-muted); font-size: 0.88rem; }

.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.history-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.86rem;
  table-layout: fixed;
  /* Mindestbreite — fällt enger der Viewport, wird die Tabelle horizontal
     scrollbar, statt sich in unleserliche Stapel zu falten. */
  min-width: 760px;
}
/* Feste Spaltenbreiten in rem. Summe der festen Spalten = 38 rem (~608 px),
   die "Eingabe"-Spalte teilt sich den Rest. Bei einem 1200 px-Panel bleibt
   für die Eingabe-Vorschau ~480 px übrig. */
/* Zeit ist jetzt zweizeilig (Datum + Uhrzeit untereinander), darf
   schmaler sein. Aktion ist ebenfalls zweizeilig (Aktionstyp + Quelle).
   Der frei werdende Platz wandert in die Thema-Spalte, damit lange
   Topic-Labels wie "Soft-Skills & Persönlichkeitsentwicklung" weniger
   harte Silbenbrüche haben. */
.history-table col.col-time   { width: 6rem; }
.history-table col.col-action { width: 7rem; }
.history-table col.col-topic  { width: 11rem; }
.history-table col.col-thumb  { width: 5rem; }
.history-table col.col-input  { width: auto; }
.history-table col.col-cta    { width: 8rem; }

.history-table th,
.history-table td {
  text-align: left;
  padding: 0.7rem 0.55rem;
  border-bottom: 1px solid var(--border-light);
  vertical-align: middle;
}
.history-table th {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  font-weight: 600;
  background: var(--bg-box);
  vertical-align: middle;
}
.history-table td.empty {
  text-align: center;
  color: var(--text-muted);
  padding: 2rem;
}
.history-table tr.row-clickable { cursor: pointer; }
.history-table tr.row-clickable:hover td { background: var(--accent-soft); }
.history-table tr.row-clickable:focus { outline: none; }
.history-table tr.row-clickable:focus-visible td {
  background: var(--accent-soft-strong);
  box-shadow: inset 0 0 0 2px var(--accent);
}
.cell-topic { color: var(--text-main); word-break: break-word; }
/* Auf <td> selbst greift -webkit-line-clamp NICHT, weil display:table-cell den
   display:-webkit-box-Override zerstört. Deshalb wrappt admin.js den Text in
   <div class="cell-input-text"> und dort wenden wir den Clamp an. */
.cell-input {
  color: var(--text-main);
  vertical-align: middle;
}
.cell-input-text {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  line-clamp: 2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: normal;
  line-height: 1.4;
  /* Hard-Fallback falls der Browser -webkit-line-clamp nicht respektiert
     (sehr alte WebKit-Renderer): max-height = 2 × line-height. */
  max-height: 2.8em;
  word-break: break-word;
}
.cell-actions {
  text-align: right;
  white-space: nowrap;
}
.cell-actions .btn-detail {
  padding: 0.4rem 0.65rem;
  font-size: 0.82rem;
}
.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  margin-left: 0.2rem;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
  vertical-align: middle;
}
.btn-icon:hover {
  background: rgba(239, 68, 68, 0.08);
  color: var(--danger);
  border-color: rgba(239, 68, 68, 0.25);
}
.btn-icon:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.35);
}
.btn-icon svg { display: block; }
.cell-thumb-cell {
  padding: 0.5rem 0.4rem !important;
  text-align: center;
}
.cell-thumb-empty {
  display: inline-block;
  color: var(--text-muted);
  font-size: 0.85rem;
}
.type-badge {
  display: inline-block;
  padding: 0.1rem 0.5rem;
  border-radius: 9999px;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  border: 1px solid transparent;
}
.type-badge.badge-initial {
  background: #eef2ff;
  color: #3730a3;
  border-color: #c7d2fe;
}
.type-badge.badge-retry {
  background: #fef3c7;
  color: #92400e;
  border-color: #fde68a;
}
.type-badge.badge-iter {
  background: #dcfce7;
  color: #166534;
  border-color: #bbf7d0;
}
.type-badge.badge-other {
  background: var(--bg-box);
  color: var(--text-muted);
}

/* ── Referenz-Grid im Detail-Drawer ──────────────────────────────────── */
.ref-subhead {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
  margin: 0.6rem 0 0.4rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.ref-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  gap: 0.6rem;
  margin-bottom: 0.4rem;
}
.ref-card {
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.7rem;
  color: var(--text-muted);
}
.ref-card img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: contain;
  background: #fff;
  border: 1px solid var(--border-light);
  border-radius: 6px;
}
/* Caption darf bis zu 2 Zeilen umbrechen — vorher abgeschnitten mit "…",
   was die Datei-Identifizierung erschwert hat. */
.ref-card figcaption {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.25;
  word-break: break-word;
}
/* Klickbare Vorschau: das ganze figure ist ein Link, der das Bild im neuen
   Tab öffnet (für genauere Inspektion). Hover-Effekt am Bildrahmen. */
.ref-card a {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  text-decoration: none;
  color: inherit;
  cursor: zoom-in;
}
.ref-card a:hover img {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(22, 36, 85, 0.12);
}
.ref-card a:focus-visible img {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(22, 36, 85, 0.25);
}
/* Zeit-Zelle: Datum oben, Uhrzeit darunter. Spans als Block, damit
   eine Zelle ohne <br> umbricht. */
.cell-time {
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  font-size: 0.82rem;
  line-height: 1.25;
}
.cell-time-date,
.cell-time-clock {
  display: block;
  white-space: nowrap;
}
.cell-time-clock { color: var(--text-muted); opacity: 0.85; }

/* Aktion-Spalte (Imagine-Tab): zwei Zeilen, plain text.
   Zeile 1 (.cell-action-text): Aktionstyp ("Initial", "Auto-Retry", …)
   Zeile 2 (.cell-action-src):   Quelle ("Imagine" / "Kursplaner" / …) */
.cell-action-col {
  font-size: 0.85rem;
  color: var(--text-primary);
  line-height: 1.3;
}
.cell-action-text {
  display: block;
  font-weight: 500;
}
.cell-action-src {
  display: block;
  color: var(--text-muted);
  font-weight: 400;
  font-size: 0.78rem;
  margin-top: 0.1rem;
}
.cell-thumb {
  width: 56px;
  height: 56px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--border-light);
  background: #fff;
  display: inline-block;
  transition: transform 0.12s ease, box-shadow 0.12s ease, border-color 0.12s ease;
}
.row-clickable:hover .cell-thumb {
  transform: scale(1.04);
  box-shadow: var(--shadow-md);
  border-color: var(--accent);
}
/* (.cell-parent / .cell-parent code: war Parent-Eintrag-Hinweis
   "↳ <kurz-id>" in der Aktion-Spalte; jetzt entfernt — Parent-ID
   bleibt nur im Detail-Drawer sichtbar.) */

.pager { margin-top: 1rem; text-align: center; }

/* ─── Drawer ───────────────────────────────────────────────────────── */
.drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(2, 6, 23, 0.45);
  z-index: 50;
}
.drawer {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  width: min(620px, 100vw);
  background: #fff;
  z-index: 51;
  box-shadow: -8px 0 24px rgba(0,0,0,0.12);
  display: flex;
  flex-direction: column;
}
.drawer-inner { display: flex; flex-direction: column; height: 100%; }
.drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.1rem 1.25rem;
  border-bottom: 1px solid var(--border-light);
}
.drawer-head h2 { font-size: 1.1rem; color: var(--primary-dark); }
.drawer-head-actions {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
/* Drawer-Navigation (hoch/runter) — neutraler Hover statt der roten
   Lösch-Optik des Standard-.btn-icon. */
.drawer-head .btn-icon {
  font-size: 1rem;
  color: var(--text-main);
  border-color: var(--border-light);
}
.drawer-head .btn-icon:hover {
  background: rgba(22, 36, 85, 0.08);
  color: var(--primary-dark);
  border-color: var(--border-light);
}
.drawer-head .btn-icon:focus-visible {
  box-shadow: 0 0 0 3px rgba(22, 36, 85, 0.2);
}
.drawer-head .btn-icon[disabled] {
  opacity: 0.35;
  cursor: not-allowed;
  background: transparent;
  color: var(--text-muted);
}
.drawer-head .btn-icon[disabled]:hover {
  background: transparent;
  color: var(--text-muted);
}
.drawer-body {
  padding: 1.25rem;
  overflow-y: auto;
  flex: 1;
}
.drawer-body h3 {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin: 1.1rem 0 0.4rem;
}
.drawer-body h3:first-child { margin-top: 0; }
.drawer-body pre {
  background: var(--bg-box);
  border: 1px solid var(--border-light);
  border-radius: 10px;
  padding: 0.75rem;
  font-size: 0.82rem;
  font-family: 'SFMono-Regular', Menlo, Consolas, monospace;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--text-main);
  max-height: 320px;
  overflow: auto;
}
.drawer-body .meta-grid {
  display: grid;
  grid-template-columns: 9rem 1fr;
  gap: 0.45rem 0.75rem;
  font-size: 0.88rem;
}
.drawer-body .meta-grid dt { color: var(--text-muted); }
.drawer-body .meta-grid dd { color: var(--text-main); word-break: break-word; }
/* Sekundär-Info hinter "Basiert auf"-Link (z.B. Zeitstempel) — etwas
   kleiner und gedämpfter, damit der Klartext-Link dominiert. */
.drawer-body .meta-grid dd .meta-aux {
  color: var(--text-muted);
  font-size: 0.78rem;
  margin-left: 0.5rem;
}
/* Hinweis-Box im Drawer (z.B. „System-Prompt vom Kursplaner"). Soll
   sich klar vom regulären Inhalt abheben, ohne Alarm-Optik. */
.drawer-body .detail-note {
  background: var(--bg-soft, #f5f7fb);
  border-left: 3px solid var(--accent, #6366f1);
  padding: 0.55rem 0.75rem;
  margin: 0.6rem 0 0.6rem;
  border-radius: 6px;
  font-size: 0.86rem;
  color: var(--text-main);
}
.drawer-body .detail-note strong { color: var(--text-main); }
.drawer-body .detail-note a { margin-left: 0.35rem; }
/* Edit-Trail im Drawer: jeder User-Wunsch-Schritt (Initial / Edit n /
   Auto-Korrektur) als eigene visuell abgesetzte Sektion. So sieht der
   Admin auf einen Blick, welche Iter-Schritte den finalen Prompt
   geprägt haben — vorher war alles in einem `<pre>` zusammengezogen
   und nur per Marker-Wortlaut auseinanderzuhalten. Akzent-Streifen:
   neutral für Initial, Akzentfarbe für Edits, Warnton für die vom QA-
   Recheck angefügte Auto-Korrektur (technisch ein anderes Konstrukt). */
.drawer-body .prompt-trail {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.drawer-body .prompt-trail-note {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin: 0 0 0.55rem;
  line-height: 1.45;
}
.drawer-body .prompt-trail-note code {
  background: var(--bg-soft, #f5f7fb);
  padding: 0.05rem 0.3rem;
  border-radius: 4px;
  font-size: 0.85em;
}
.drawer-body .prompt-step {
  border: 1px solid var(--border-light);
  border-radius: 8px;
  background: var(--bg-box);
  padding: 0.5rem 0.7rem 0.55rem;
  border-left-width: 3px;
}
.drawer-body .prompt-step-initial {
  border-left-color: var(--text-muted);
}
/* System-Prompts (Strecke 1 SCORM-auto, Kursplaner-Titelbild) bekommen
   denselben neutralen Akzent wie Initial-User-Eingaben — sie sind keine
   User-Wünsche, aber strukturell „der eine Eingangs-Prompt" ihrer
   Strecke. Eigene Klasse für künftige stilistische Ausdifferenzierung. */
.drawer-body .prompt-step-system {
  border-left-color: var(--text-muted);
}
.drawer-body .prompt-step-edit {
  border-left-color: var(--accent, #6366f1);
}
.drawer-body .prompt-step-correction {
  border-left-color: #d97706;
  background: #fff7ed;
}
/* QA-Callout im QA-Hinweise-Block (#21): hebt die einzige umsetzbare
   Korrektur-Anweisung an das Bild-Modell hervor (warmer Akzent wie der
   alte „Auto-Korrektur"-Step in der Prompt-Trail, damit Admin-Benutzer
   die optische Verbindung „das ist die Retry-Begruendung" sofort haben). */
.drawer-body .qa-callout {
  border: 1px solid #fdba74;
  border-left: 3px solid #d97706;
  background: #fff7ed;
  border-radius: 8px;
  padding: 0.55rem 0.75rem 0.6rem;
  margin: 0.5rem 0 0;
}
.drawer-body .qa-callout-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #b45309;
  font-weight: 600;
  margin-bottom: 0.3rem;
}
.drawer-body .qa-callout-text {
  font-size: 0.88rem;
  line-height: 1.45;
  color: var(--text-main);
  white-space: pre-wrap;
  word-break: break-word;
}
.drawer-body .prompt-step-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 0.3rem;
  font-weight: 600;
}
.drawer-body .prompt-step-correction .prompt-step-label {
  color: #b45309;
}
.drawer-body .prompt-step-text {
  margin: 0;
  border: none;
  padding: 0;
  background: transparent;
  max-height: none;
  font-size: 0.85rem;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--text-main);
  font-family: inherit;
}
/* Ausklappbarer "Technische Details"-Block am Ende. */
.drawer-body details.tech-details {
  margin-top: 1rem;
  padding: 0.4rem 0.6rem;
  border: 1px dashed var(--border-light);
  border-radius: 6px;
  font-size: 0.86rem;
}
.drawer-body details.tech-details > summary {
  cursor: pointer;
  color: var(--text-muted);
  user-select: none;
  padding: 0.15rem 0;
}
.drawer-body details.tech-details[open] > summary {
  margin-bottom: 0.4rem;
}
.drawer-body img.detail-img {
  display: block;
  max-width: 100%;
  border-radius: 12px;
  border: 1px solid var(--border-light);
  background: #fff;
  margin-top: 0.4rem;
}
.drawer-body a.detail-img-link {
  display: inline-block;
  margin-top: 0.4rem;
  cursor: zoom-in;
  border-radius: 12px;
  transition: box-shadow 0.15s ease;
}
.drawer-body a.detail-img-link > img.detail-img {
  margin-top: 0;
  transition: border-color 0.15s ease;
}
.drawer-body a.detail-img-link:hover > img.detail-img,
.drawer-body a.detail-img-link:focus-visible > img.detail-img {
  border-color: var(--accent, #2563eb);
}
.drawer-body a.detail-img-link:focus-visible {
  outline: 2px solid var(--accent, #2563eb);
  outline-offset: 2px;
}
.drawer-body .child-link {
  display: block;
  padding: 0.45rem 0.6rem;
  border: 1px solid var(--border-light);
  border-radius: 8px;
  text-decoration: none;
  color: var(--text-main);
  font-size: 0.86rem;
  margin-bottom: 0.35rem;
  background: #fff;
  cursor: pointer;
}
.drawer-body .child-link:hover { background: var(--bg-box); }

/* ─── Responsive: schmale Viewports ─────────────────────────────────── */
/* Bei < 900 px wird die Tabelle horizontal scrollbar (min-width: 760 px greift).
   Für die Drumherum-UI kompaktieren wir Padding und Schriftgrößen. */
@media (max-width: 900px) {
  .admin-main { padding: 1.25rem 0.85rem 3rem; }
  .panel { padding: 0.85rem; border-radius: 1.25rem; }
  .dashboard-head h1 { font-size: 1.35rem; }
  .history-table { font-size: 0.82rem; }
  .history-table th, .history-table td { padding: 0.6rem 0.45rem; }
  .cell-thumb { width: 48px; height: 48px; }
  .cell-actions .btn-detail { padding: 0.3rem 0.5rem; font-size: 0.78rem; }
}

/* Auf wirklich kleinen Screens das Detail-Bild nicht in voller Breite, damit
   der Drawer-Body nicht überläuft. */
@media (max-width: 600px) {
  .drawer { width: 100vw; }
  .drawer-body img.detail-img { max-height: 60vh; object-fit: contain; }
}

/* ─── In-App Confirm Dialog (übernommen aus Haupt-App-Stylesheet) ──── */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 1.5rem;
}
.modal-content {
  background: #ffffff;
  border-radius: var(--radius-lg);
  border: 0.5px solid var(--border-medium);
  width: 100%;
  max-width: 640px;
  max-height: 90vh;
  overflow: hidden;
  box-shadow: var(--shadow-box);
  display: flex;
  flex-direction: column;
}
.confirm-dialog-content { max-width: 420px; padding: 0; }
.confirm-dialog-body {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  padding: 1.75rem 1.75rem 1.25rem;
}
.confirm-dialog-icon {
  width: 40px;
  height: 40px;
  min-width: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 0.1rem;
}
.confirm-dialog-icon.icon-warning { background: #FEF3C7; color: #92400E; }
.confirm-dialog-icon.icon-danger  { background: #FEE2E2; color: var(--danger); }
.confirm-dialog-icon.icon-info    { background: var(--bg-box); color: var(--text-muted); }
.confirm-dialog-icon svg,
.confirm-dialog-icon i { width: 20px; height: 20px; }
.confirm-dialog-text h3 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-main);
  margin: 0 0 0.375rem;
}
.confirm-dialog-text p {
  font-size: 0.875rem;
  color: var(--text-muted);
  line-height: 1.5;
  margin: 0;
}
.confirm-dialog-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  padding: 1rem 1.75rem 1.5rem;
  border-top: 0.5px solid var(--border-light);
}
/* Button-Varianten falls in admin.css noch nicht definiert. .btn .btn-secondary
   .btn-primary .btn-danger sind in der Haupt-App eingeführt; im Admin nutzen
   wir die existierenden btn/btn-ghost. Mappings für Konsistenz: */
.btn-secondary {
  background: #fff;
  color: var(--text-main);
  border: 1px solid var(--border-light);
}
.btn-secondary:hover { background: var(--bg-box); }
.btn-primary {
  background: var(--primary, #FFD32B);
  color: var(--primary-dark, #020617);
  border: 1px solid var(--primary, #FFD32B);
  font-weight: 600;
}
.btn-primary:hover { filter: brightness(0.96); }
.btn-danger {
  background: var(--danger);
  color: #fff;
  border: 1px solid var(--danger);
  font-weight: 600;
}
.btn-danger:hover { background: #dc2626; border-color: #dc2626; }

/* ── Tab-spezifische Spalten + Quelltext-Vorschau ─────────────────── */
/* Spalten-Konfig für Kursplaner/SCORM. col-title trägt den Kurstitel,
   col-notes die freien Hinweise, col-source die PDF-Datei oder Vorschau. */
.col-title  { width: 22%; }
.col-notes  { width: 28%; }
.col-source { width: 30%; }

/* PDF-Quelle: Datei-Icon + Dateiname (kleinere graue Bytes-Angabe). */
.src-pdf {
  display: inline-flex;
  align-items: center;
  font-weight: 500;
  color: var(--text-main);
  word-break: break-all;
}
.src-bytes {
  color: var(--text-muted);
  font-size: 0.85em;
  margin-left: 0.25rem;
  white-space: nowrap;
}

/* Detail-Drawer: Quelltext-Block — feste Schriftgröße, Wrap, max-Höhe
   gibt es nicht, weil das Toggle bereits die Länge begrenzt. */
.src-meta {
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin: 0 0 0.5rem;
}
.src-full {
  background: var(--bg-box);
  padding: 0.75rem 1rem;
  border: 1px solid var(--border-light);
  border-radius: 6px;
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 0.8125rem;
  line-height: 1.5;
  margin: 0 0 0.5rem;
}
.btn-src-toggle {
  font-size: 0.8125rem;
  padding: 0.25rem 0.625rem;
}


/* ── Collections-Tab ─────────────────────────────────────────────────── */
.coll-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; padding: 12px 0; }
.coll-card { border: 1px solid var(--border, #e5e7eb); border-radius: 8px; padding: 14px; background: #fff; display: flex; flex-direction: column; gap: 8px; }
.coll-card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.coll-slug { font-family: ui-monospace, monospace; font-size: 12px; color: #6b7280; }
.coll-status { font-size: 11px; padding: 2px 6px; background: #fef3c7; color: #92400e; border-radius: 4px; }
.coll-card-meta { font-size: 13px; color: #6b7280; }
.coll-card-actions { margin-top: auto; }
.coll-detail { margin-top: 24px; padding: 18px; border: 1px solid var(--border, #e5e7eb); border-radius: 8px; background: #fafafa; }
.coll-detail-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.coll-form { display: flex; flex-direction: column; gap: 10px; margin-bottom: 20px; }
.coll-form label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; font-weight: 500; }
.coll-form label.inline { flex-direction: row; align-items: center; gap: 8px; font-weight: 400; }
.coll-form input[type="text"], .coll-form textarea { padding: 8px; border: 1px solid var(--border, #e5e7eb); border-radius: 6px; font: inherit; width: 100%; box-sizing: border-box; }
.coll-form-actions { display: flex; gap: 8px; margin-top: 8px; }
.coll-drop { border: 2px dashed #cbd5e1; border-radius: 8px; padding: 24px; text-align: center; transition: background .15s, border-color .15s; }
.coll-drop.drag-over { background: #eff6ff; border-color: #3b82f6; }
.coll-drop .link { color: #2563eb; cursor: pointer; text-decoration: underline; }
.coll-drop .hint { font-size: 12px; color: #6b7280; margin: 4px 0 0; }
.coll-images { margin-top: 20px; display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.coll-img-card { border: 1px solid var(--border, #e5e7eb); border-radius: 8px; padding: 10px; background: #fff; display: flex; flex-direction: column; gap: 6px; }
.coll-img-card.is-showcase { border-color: #e5b73d; box-shadow: 0 0 0 2px rgba(229, 183, 61, 0.18); }
.coll-img-card img { width: 100%; height: 140px; object-fit: cover; border-radius: 4px; background: #f3f4f6; }
.coll-img-card textarea, .coll-img-card input[type="text"] { font: inherit; padding: 6px; border: 1px solid var(--border, #e5e7eb); border-radius: 4px; width: 100%; box-sizing: border-box; }
.coll-img-card .img-actions { display: flex; gap: 6px; justify-content: space-between; }
.coll-img-card .img-showcase { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; cursor: pointer; user-select: none; }
.coll-img-card .img-showcase-toggle { margin: 0; }
.coll-img-card .img-showcase-star { color: #c9cbd0; font-size: 16px; line-height: 1; }
.coll-img-card.is-showcase .img-showcase-star { color: #e5b73d; }
.coll-card-showcase { color: #c47a00; margin-left: 6px; font-weight: 600; }
.coll-showcase-status { margin: 8px 0 6px; font-size: 13px; }
.coll-showcase-counter { color: #555; }
.coll-showcase-counter.is-low { color: #c47a00; }
.btn-danger { background: #dc2626; color: #fff; border: 1px solid #dc2626; }
.btn-danger:hover { background: #b91c1c; }

/* ── Two-Column Admin Layout (Refactor 2026-05-20, Option C) ─────────── */
.admin-main { max-width: none; padding: 0; }
.dashboard {
  display: grid;
  grid-template-columns: 280px 1fr;
  min-height: calc(100vh - 64px);
  background: var(--bg-app);
}
.admin-sidebar {
  display: flex; flex-direction: column;
  background: #fff;
  border-right: 1px solid var(--border-light);
  min-height: 100%;
}
.admin-sidebar-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1rem 1.1rem 0.6rem;
  border-bottom: 1px solid var(--border-light);
}
.admin-sidebar-title {
  font-size: 0.78rem; font-weight: 700;
  letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--text-muted);
}
.admin-sidebar-add {
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px;
  border-radius: 8px;
  background: var(--accent); color: var(--text-on-accent);
  border: 1px solid var(--accent);
  font-size: 1.05rem; font-weight: 700; cursor: pointer; line-height: 1;
  font-family: inherit;
  transition: background 0.15s, border-color 0.15s;
}
.admin-sidebar-add:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.coll-sidebar-list {
  flex: 1; overflow-y: auto;
  padding: 0.5rem 0.6rem;
  display: flex; flex-direction: column; gap: 2px;
}
.sidebar-empty { color: var(--text-muted); font-size: 0.85rem; padding: 0.75rem; }
.sidebar-item {
  display: flex; align-items: center; gap: 0.6rem;
  width: 100%; padding: 0.55rem 0.65rem;
  background: transparent; border: 1px solid transparent;
  border-radius: 10px;
  font-family: inherit; font-size: 0.9rem;
  color: var(--text-main);
  cursor: pointer; text-align: left;
  transition: background 0.12s, border-color 0.12s;
}
.sidebar-item { position: relative; }
.sidebar-item:hover { background: var(--bg-box); }
.sidebar-item.is-active {
  background: var(--accent-soft);
  border-color: transparent;
}
.sidebar-item.is-active::before {
  content: "";
  position: absolute;
  left: -0.6rem;
  top: 0.45rem;
  bottom: 0.45rem;
  width: 3px;
  border-radius: 3px;
  background: var(--accent);
}
.sidebar-item-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px;
  border-radius: 8px;
  background: var(--bg-box);
  color: var(--text-muted);
  flex-shrink: 0;
}
.sidebar-item-icon svg { display: block; }
.sidebar-item.is-active .sidebar-item-icon {
  background: var(--accent-soft-strong);
  color: var(--accent);
}
.sidebar-item-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 20px;
  padding: 0 0.4rem;
  border-radius: 9999px;
  font-size: 0.7rem;
  font-weight: 600;
  background: var(--bg-box);
  color: var(--text-muted);
  flex-shrink: 0;
  margin-left: auto;
}
.sidebar-item.is-active .sidebar-item-count {
  background: rgba(255,255,255,0.7);
  color: var(--accent);
}
[data-theme="dark"] .sidebar-item.is-active .sidebar-item-count {
  background: rgba(0,0,0,0.3);
  color: var(--accent);
}
.sidebar-item-text { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.sidebar-item-title {
  font-weight: 600; font-size: 0.9rem;
  color: var(--text-main);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sidebar-item-sub {
  font-size: 0.75rem; color: var(--text-muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sidebar-item-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--border-medium); flex-shrink: 0;
}
.sidebar-item-dot.is-active { background: var(--success); }
.admin-sidebar-foot {
  border-top: 1px solid var(--border-light);
  padding: 0.5rem 0.6rem;
}
.sidebar-item-history .sidebar-item-icon { color: var(--text-muted); }

.admin-pane {
  display: flex; flex-direction: column;
  padding: 1.75rem 2rem 3rem;
  min-width: 0;
  max-width: 1100px;
}
.pane-empty {
  display: flex; align-items: center; justify-content: center;
  min-height: 60vh;
}
.pane-empty-inner { text-align: center; color: var(--text-muted); }
.pane-empty-inner h2 { color: var(--primary-dark); margin-bottom: 0.5rem; }
.pane-head { margin-bottom: 1rem; }
.pane-head h1 { color: var(--primary-dark); font-size: 1.5rem; margin-bottom: 0.25rem; }
.pane-head-sub { color: var(--text-muted); font-size: 0.9rem; }
.pane-coll-meta {
  display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap;
  margin-top: 0.4rem;
}
.coll-link {
  font-size: 0.82rem; color: var(--primary-dark);
  text-decoration: none; border-bottom: 1px dotted var(--border-medium);
}
.coll-link:hover { border-bottom-style: solid; }

.subtabs {
  display: flex; gap: 0.25rem;
  border-bottom: 1px solid var(--border-light);
  margin-bottom: 1.25rem;
}
.subtab {
  background: transparent; border: none;
  font-family: inherit; font-size: 0.92rem; font-weight: 600;
  color: var(--text-muted);
  padding: 0.6rem 1rem;
  cursor: pointer;
  border-bottom: 3px solid transparent;
  margin-bottom: -1px;
  transition: color 0.15s, border-color 0.15s;
}
.subtab:hover { color: var(--text-main); }
.subtab.active { color: var(--accent); border-bottom-color: var(--accent); }
.subpanel {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: 1.25rem;
}

/* Responsive: Sidebar wird auf schmalen Screens kollabiert (horizontal). */
@media (max-width: 900px) {
  .dashboard { grid-template-columns: 1fr; }
  .admin-sidebar { border-right: none; border-bottom: 1px solid var(--border-light); }
  .coll-sidebar-list { flex-direction: row; overflow-x: auto; gap: 6px; }
  .sidebar-item { flex-shrink: 0; min-width: 180px; }
  .admin-sidebar-foot { border-top: 1px solid var(--border-light); }
  .admin-pane { padding: 1.25rem 1rem 2.5rem; }
}
/* ── Onboarding-Wizard (neue Collection) ─────────────────────────────────
   Modal-Shell mit Fortschrittsbalken, Schritt-Indikator, Step-Body und
   sticky Footer. Animationen sind dezent: Fade+Slide beim Schritt-Wechsel,
   sanftes Fortschritts-Wachsen, kleines „Pop" beim Häkchen, Konfetti-
   Regen am Abschluss. Alles per Vanilla-CSS/JS, kein Build. */
.wizard-modal { padding: 0.75rem; }
.wizard-content {
  max-width: 720px;
  width: 100%;
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  padding: 0;
  animation: wizard-pop 0.22s ease-out;
}
@keyframes wizard-pop {
  from { opacity: 0; transform: translateY(8px) scale(0.985); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.wizard-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.25rem 1.5rem 0.9rem;
}
.wizard-head h2 {
  font-size: 1.25rem;
  color: var(--primary-dark);
  margin: 0 0 0.15rem;
}
.wizard-sub { color: var(--text-muted); font-size: 0.88rem; margin: 0; }
#wizard-close {
  font-size: 1.1rem;
  padding: 0.35rem 0.6rem;
  line-height: 1;
}
.wizard-progress {
  height: 4px;
  background: var(--bg-box);
  margin: 0 1.5rem;
  border-radius: 999px;
  overflow: hidden;
}
.wizard-progress-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--primary), var(--primary-hover));
  border-radius: 999px;
  transition: width 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.wizard-steps {
  list-style: none;
  display: flex;
  justify-content: space-between;
  gap: 0.4rem;
  padding: 0.75rem 1.5rem 0.2rem;
  margin: 0;
}
.wizard-steps li {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 500;
  flex: 1;
  min-width: 0;
}
.wizard-step-dot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--bg-box);
  border: 1px solid var(--border-light);
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 600;
  transition: background 0.2s, color 0.2s, border-color 0.2s, transform 0.2s;
  flex-shrink: 0;
}
.wizard-step-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.wizard-steps li.is-active .wizard-step-dot {
  background: var(--primary);
  border-color: var(--primary-hover);
  color: var(--text-on-primary);
}
.wizard-steps li.is-active { color: var(--primary-dark); font-weight: 600; }
.wizard-steps li.is-done .wizard-step-dot {
  background: var(--success);
  border-color: var(--success);
  color: #fff;
  animation: wizard-check-pop 0.35s ease-out;
}
.wizard-steps li.is-done .wizard-step-dot::before {
  content: "✓";
}
.wizard-steps li.is-done .wizard-step-dot > * { display: none; }
@keyframes wizard-check-pop {
  0%   { transform: scale(0.6); }
  60%  { transform: scale(1.18); }
  100% { transform: scale(1); }
}
.wizard-body {
  padding: 1rem 1.5rem 1.25rem;
  overflow-y: auto;
  flex: 1;
  min-height: 220px;
}
.wizard-body.is-leaving { opacity: 0; transform: translateX(-8px); transition: opacity 0.12s, transform 0.12s; }
.wizard-body.is-entering { animation: wizard-step-in 0.28s ease-out; }
@keyframes wizard-step-in {
  from { opacity: 0; transform: translateX(10px); }
  to   { opacity: 1; transform: translateX(0); }
}
.wizard-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 1.5rem 1.1rem;
  border-top: 1px solid var(--border-light);
  background: #fff;
}
.wizard-foot-right { display: flex; align-items: center; gap: 0.75rem; }
.wizard-status { color: var(--text-muted); font-size: 0.82rem; min-height: 1.1em; }
.wizard-status.is-error { color: var(--danger); }
.wizard-status.is-success { color: var(--success); }

/* ── Step-Bodies ─────────────────────────────────────────────────── */
.wizard-field { display: flex; flex-direction: column; gap: 0.35rem; margin-bottom: 1rem; }
.wizard-field label { font-size: 0.86rem; font-weight: 600; color: var(--text-main); }
.wizard-field .hint { font-size: 0.78rem; color: var(--text-muted); line-height: 1.4; }
.wizard-field input[type="text"],
.wizard-field textarea {
  font: inherit;
  padding: 0.65rem 0.8rem;
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-md);
  background: #fff;
  width: 100%;
  box-sizing: border-box;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.wizard-field input[type="text"]:focus,
.wizard-field textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.wizard-field .field-error { color: var(--danger); font-size: 0.8rem; min-height: 1em; }
.wizard-field .field-ok    { color: var(--success); font-size: 0.8rem; }
.wizard-slug-preview {
  font-family: ui-monospace, monospace;
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-top: 0.2rem;
}
.wizard-slug-preview code { color: var(--primary-dark); background: var(--bg-box); padding: 0.05rem 0.35rem; border-radius: 4px; }

.wizard-templates { display: flex; flex-direction: column; gap: 0.5rem; margin-bottom: 0.5rem; }
.wizard-template-btn {
  text-align: left;
  background: var(--bg-box);
  border: 1px solid var(--border-light);
  border-radius: 10px;
  padding: 0.7rem 0.85rem;
  cursor: pointer;
  font: inherit;
  color: var(--text-main);
  transition: background 0.15s, border-color 0.15s, transform 0.1s;
}
.wizard-template-btn:hover { background: #fff; border-color: var(--primary); }
.wizard-template-btn:active { transform: scale(0.99); }
.wizard-template-btn strong { display: block; font-size: 0.86rem; margin-bottom: 0.2rem; color: var(--primary-dark); }
.wizard-template-btn span { font-size: 0.8rem; color: var(--text-muted); line-height: 1.4; }

.wizard-drop {
  border: 2px dashed var(--border-medium);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  text-align: center;
  background: var(--bg-box);
  transition: background 0.15s, border-color 0.15s;
  cursor: pointer;
}
.wizard-drop.drag-over { background: #fff8d6; border-color: var(--primary); }
.wizard-drop p { margin: 0.2rem 0; color: var(--text-muted); font-size: 0.88rem; }
.wizard-drop .link { color: var(--primary-dark); text-decoration: underline; cursor: pointer; font-weight: 600; }
.wizard-goal {
  margin: 0.75rem 0;
  font-size: 0.84rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.wizard-goal-bar {
  flex: 1;
  height: 6px;
  background: var(--bg-box);
  border-radius: 999px;
  overflow: hidden;
}
.wizard-goal-bar > div {
  height: 100%;
  background: var(--primary);
  border-radius: 999px;
  transition: width 0.3s ease;
}
.wizard-goal-bar.is-reached > div { background: var(--success); }

.wizard-thumbs {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 0.6rem;
  margin-top: 0.9rem;
}
.wizard-thumb {
  position: relative;
  background: #fff;
  border: 1px solid var(--border-light);
  border-radius: 8px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  font-size: 0.72rem;
  animation: wizard-step-in 0.25s ease-out;
}
.wizard-thumb img { width: 100%; aspect-ratio: 1 / 1; object-fit: cover; background: var(--bg-box); }
.wizard-thumb-meta {
  padding: 0.35rem 0.45rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.3rem;
}
.wizard-thumb-status {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.7rem;
  color: var(--text-muted);
}
.wizard-thumb-status.is-ready { color: var(--success); }
.wizard-thumb-status .spinner {
  display: inline-block;
  width: 10px;
  height: 10px;
  border: 2px solid var(--border-light);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: wizard-spin 0.8s linear infinite;
}
@keyframes wizard-spin { to { transform: rotate(360deg); } }
.wizard-thumb-del {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(15, 23, 42, 0.7);
  color: #fff;
  border: none;
  font-size: 0.85rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.15s;
}
.wizard-thumb:hover .wizard-thumb-del,
.wizard-thumb-del:focus-visible { opacity: 1; }

.wizard-edit-list { display: flex; flex-direction: column; gap: 0.7rem; }
.wizard-edit-row {
  display: grid;
  grid-template-columns: 88px 1fr;
  gap: 0.7rem;
  background: var(--bg-box);
  border: 1px solid var(--border-light);
  border-radius: 10px;
  padding: 0.6rem;
}
.wizard-edit-row img {
  width: 88px;
  height: 88px;
  object-fit: cover;
  border-radius: 6px;
  background: #fff;
}
.wizard-edit-row .row-body { display: flex; flex-direction: column; gap: 0.3rem; min-width: 0; }
.wizard-edit-row textarea {
  font: inherit;
  font-size: 0.85rem;
  padding: 0.45rem 0.55rem;
  border: 1px solid var(--border-light);
  border-radius: 6px;
  resize: vertical;
  min-height: 56px;
}
.wizard-edit-row .row-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  font-size: 0.75rem;
  color: var(--text-muted);
}
.wizard-edit-row .row-foot button { font-size: 0.78rem; padding: 0.3rem 0.6rem; }

.wizard-empty {
  text-align: center;
  padding: 1.25rem;
  color: var(--text-muted);
  font-size: 0.9rem;
  background: var(--bg-box);
  border-radius: 10px;
  border: 1px dashed var(--border-light);
}
.wizard-empty .icon { font-size: 2rem; display: block; margin-bottom: 0.4rem; }

/* ── Schritt 5: Erfolg ──────────────────────────────────────────── */
.wizard-success {
  text-align: center;
  padding: 0.75rem 0.25rem;
  position: relative;
}
.wizard-success-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 68px;
  height: 68px;
  border-radius: 50%;
  background: var(--success);
  color: #fff;
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 0.75rem;
  animation: wizard-success-pop 0.5s cubic-bezier(0.2, 1.4, 0.4, 1);
  box-shadow: 0 8px 20px rgba(16, 185, 129, 0.35);
}
@keyframes wizard-success-pop {
  0%   { transform: scale(0); opacity: 0; }
  60%  { transform: scale(1.2); opacity: 1; }
  100% { transform: scale(1); }
}
.wizard-success h3 { font-size: 1.2rem; color: var(--primary-dark); margin-bottom: 0.35rem; }
.wizard-success p { color: var(--text-muted); margin-bottom: 1rem; }
.wizard-link-box {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  background: var(--bg-box);
  border: 1px solid var(--border-light);
  border-radius: 10px;
  padding: 0.45rem 0.5rem 0.45rem 0.85rem;
  margin: 0.5rem auto 1rem;
  max-width: 460px;
}
.wizard-link-box code {
  flex: 1;
  font-family: ui-monospace, monospace;
  font-size: 0.88rem;
  color: var(--primary-dark);
  word-break: break-all;
  text-align: left;
}
.wizard-success-actions { display: flex; gap: 0.5rem; justify-content: center; flex-wrap: wrap; }

/* Konfetti — kleine Quadrate, die über die Höhe fallen + rotieren. */
.wizard-confetti {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}
.wizard-confetti span {
  position: absolute;
  top: -12px;
  width: 8px;
  height: 12px;
  opacity: 0.9;
  animation: wizard-confetti-fall 2.4s ease-in forwards;
}
@keyframes wizard-confetti-fall {
  0%   { transform: translateY(0) rotate(0deg); }
  100% { transform: translateY(360px) rotate(540deg); opacity: 0; }
}

@media (max-width: 640px) {
  .wizard-steps .wizard-step-label { display: none; }
  .wizard-edit-row { grid-template-columns: 64px 1fr; }
  .wizard-edit-row img { width: 64px; height: 64px; }
}

/* ════════════════════════════════════════════════════════════════════════
   ── Admin-Refresh 2026-05-21 ───────────────────────────────────────────
   Token-Konsistenz (Dark-Mode-tauglich), Segment-Subtabs, Pane-Head-Dot,
   Image-Card-Overlay-Star + Dirty-Save, Empty-Illu, History-Polish.
   Diese Sektion überschreibt absichtlich frühere Regeln, damit der Diff
   klein bleibt und ein Rollback einfach ist (ganzen Block löschen).
   ════════════════════════════════════════════════════════════════════════ */

/* Tokens überall — hartcodierte #fff zurück auf Card-Hintergrund.
   Wichtig fürs Dark-Mode. */
.panel,
.subpanel,
.login-card,
.coll-card,
.coll-img-card,
.wizard-content,
.wizard-foot,
.modal-content,
.admin-sidebar,
.history-table th,
.cell-thumb {
  background: var(--bg-card);
}
.history-table th { background: var(--bg-box); color: var(--text-muted); }
#login-form input,
.coll-form input[type="text"],
.coll-form textarea,
.coll-img-card textarea,
.coll-img-card input[type="text"],
.wizard-field input[type="text"],
.wizard-field textarea {
  background: var(--bg-card);
  color: var(--text-main);
  border-color: var(--border-light);
}
.coll-detail { background: var(--bg-box); border-color: var(--border-light); }
.coll-drop { background: var(--bg-card); border-color: var(--border-medium); color: var(--text-muted); }
.coll-drop.drag-over { background: var(--accent-soft); border-color: var(--accent); }
.coll-drop .link, .coll-link, .coll-drop .link:hover { color: var(--accent); }
.coll-slug, .coll-card-meta { color: var(--text-muted); }
.drawer { background: var(--bg-card); }
.drawer-body pre,
.drawer-body .prompt-step,
.src-full { background: var(--bg-box); border-color: var(--border-light); color: var(--text-main); }
.btn-secondary, .btn-secondary:hover { background: var(--bg-card); }
.btn-secondary:hover { background: var(--bg-box); }

/* Headlines: aufs Accent-/Brand-Spektrum bringen. Im Light-Mode bleibt
   das tiefe Navy lesbar, im Dark-Mode geht --primary-dark auf hell. */
.dashboard-head h1, .pane-head h1, .pane-empty-inner h2,
.login-card h1, .drawer-head h2, .wizard-head h2, .wizard-success h3 {
  color: var(--primary-dark);
}

/* ── Pane-Head: klare Hierarchie + Status-Dot ────────────────────────── */
.pane-head h1 { font-size: 1.65rem; font-weight: 700; letter-spacing: -0.01em; }
.pane-head-sub { color: var(--text-muted); font-size: 0.92rem; }
.pane-coll-meta { font-size: 0.82rem; color: var(--text-muted); }
.pane-coll-meta .coll-slug {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  background: var(--bg-box);
  border: 1px solid var(--border-light);
  padding: 0.1rem 0.45rem;
  border-radius: 6px;
  font-size: 0.78rem;
}
/* Status: nicht mehr Pill, sondern Dot + Label. */
.pane-head .coll-status {
  display: inline-flex; align-items: center; gap: 0.35rem;
  background: transparent; color: var(--text-muted);
  padding: 0; font-size: 0.78rem; font-weight: 500;
  border-radius: 0;
}
.pane-head .coll-status::before {
  content: ""; width: 7px; height: 7px; border-radius: 50%;
  background: var(--success); flex-shrink: 0;
}
.pane-head .coll-status.is-inactive::before { background: var(--border-medium); }
.coll-link {
  font-size: 0.82rem; color: var(--accent);
  text-decoration: none; border-bottom: 1px dotted currentColor;
}
.coll-link:hover { border-bottom-style: solid; }

/* ── Subtabs als Segment-Control ──────────────────────────────────── */
.subtabs {
  display: inline-flex;
  background: var(--bg-box);
  border: 1px solid var(--border-light);
  border-radius: 10px;
  padding: 3px;
  gap: 0;
  margin-bottom: 1.25rem;
}
.subtab {
  background: transparent;
  border: none;
  font-family: inherit;
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--text-muted);
  padding: 0.45rem 0.95rem;
  cursor: pointer;
  border-bottom: none;
  margin-bottom: 0;
  border-radius: 7px;
  transition: background 0.15s, color 0.15s, box-shadow 0.15s;
}
.subtab:hover { color: var(--text-main); }
.subtab.active {
  background: var(--bg-card);
  color: var(--accent);
  border-bottom-color: transparent;
  box-shadow: 0 1px 2px rgba(0,0,0,0.06), 0 0 0 1px var(--border-light);
}

/* ── Sidebar-Foot: Globaler Verlauf — eigener Stil, nicht "is-active"
   übernehmen muss aber demselben Look folgen. */
.sidebar-item-history { color: var(--text-main); }

/* ── Image-Cards: Star als Overlay, Dirty-Save ─────────────────────── */
.coll-img-card {
  position: relative;
  padding: 0;
  overflow: hidden;
  border-color: var(--border-light);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.coll-img-card:hover { box-shadow: var(--shadow-md); }
.coll-img-card.is-showcase {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(255, 211, 43, 0.18);
}
.coll-img-card > img {
  height: 160px;
  border-radius: 0;
}
.img-star-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 32px;
  height: 32px;
  border-radius: 9999px;
  background: rgba(15, 23, 42, 0.55);
  color: #fff;
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  line-height: 1;
  transition: background 0.15s, color 0.15s, transform 0.1s;
  backdrop-filter: blur(4px);
}
.img-star-btn:hover { background: rgba(15, 23, 42, 0.78); transform: scale(1.06); }
.coll-img-card.is-showcase .img-star-btn {
  background: var(--primary);
  color: var(--text-on-primary);
}
.img-star-btn[aria-pressed="true"] { color: var(--text-on-primary); }
.img-body {
  padding: 10px 12px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.img-body label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  font-weight: 600;
}
.img-body .img-field { display: flex; flex-direction: column; gap: 3px; }
.coll-img-card .img-actions {
  margin-top: 4px;
  padding-top: 8px;
  border-top: 1px solid var(--border-light);
  display: flex;
  gap: 6px;
  justify-content: space-between;
  align-items: center;
}
.btn-img-save {
  padding: 0.4rem 0.75rem;
  font-size: 0.82rem;
  background: transparent;
  color: var(--text-muted);
  border: 1px solid transparent;
  border-radius: 8px;
  cursor: pointer;
  font-family: inherit;
  font-weight: 600;
  transition: background 0.15s, color 0.15s, border-color 0.15s, opacity 0.15s;
}
.btn-img-save[data-dirty="1"] {
  background: var(--accent);
  color: var(--text-on-accent);
  border-color: var(--accent);
}
.btn-img-save[data-dirty="1"]:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-img-save:not([data-dirty="1"]) { opacity: 0.55; cursor: default; }
.btn-img-save[data-saving="1"]::after { content: " …"; }
.btn-img-save[data-saved="1"] { color: var(--success); }

/* Hide redundant inline showcase label (now overlay-only). */
.coll-img-card .img-showcase { display: none; }
.coll-showcase-status { color: var(--text-muted); font-size: 0.85rem; margin: 0.5rem 0 0.75rem; }
.coll-showcase-counter.is-low { color: #c47a00; font-weight: 600; }

/* ── Empty-State Illustration ────────────────────────────────────────── */
.pane-empty-inner { display: flex; flex-direction: column; align-items: center; gap: 0.4rem; max-width: 360px; margin: 0 auto; padding: 1rem; }
.pane-empty-illu {
  color: var(--border-medium);
  margin-bottom: 0.75rem;
  opacity: 0.85;
}
.pane-empty-inner h2 { font-size: 1.2rem; margin-bottom: 0; }
.pane-empty-inner p { color: var(--text-muted); font-size: 0.92rem; }
.pane-empty-inner p strong { color: var(--accent); }

/* Sidebar-Empty + coll-images empty: dezenter Illu-Block */
.sidebar-empty { display: flex; flex-direction: column; align-items: center; gap: 0.4rem; text-align: center; padding: 1.25rem 0.75rem; }
.coll-images .empty {
  grid-column: 1 / -1;
  display: flex; flex-direction: column; align-items: center; gap: 0.5rem;
  padding: 2rem 1rem;
  color: var(--text-muted);
  background: var(--bg-box);
  border: 1px dashed var(--border-light);
  border-radius: 10px;
  font-size: 0.92rem;
}
.coll-images .empty::before {
  content: "";
  width: 56px; height: 42px;
  background: currentColor;
  opacity: 0.25;
  mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 64 48' fill='none' stroke='black' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'><rect x='3' y='3' width='58' height='42' rx='4'/><circle cx='20' cy='20' r='6'/><path d='M3 36 L22 24 L40 38 L52 28 L61 36'/></svg>") center / contain no-repeat;
  -webkit-mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 64 48' fill='none' stroke='black' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'><rect x='3' y='3' width='58' height='42' rx='4'/><circle cx='20' cy='20' r='6'/><path d='M3 36 L22 24 L40 38 L52 28 L61 36'/></svg>") center / contain no-repeat;
}

/* ── History: größere Thumbs, ruhigerer Hover ─────────────────────── */
.cell-thumb { width: 64px; height: 64px; border-radius: 10px; }
.history-table col.col-thumb { width: 6rem; }
@media (max-width: 900px) {
  .cell-thumb { width: 52px; height: 52px; }
}

/* Confirm-Dialog backdrop/text token-konsistent */
.confirm-dialog-text h3 { color: var(--text-main); }
.confirm-dialog-text p { color: var(--text-muted); }
.confirm-dialog-footer { border-top-color: var(--border-light); }
.confirm-dialog-icon.icon-info { background: var(--bg-box); color: var(--text-muted); }

/* Dark-Mode: spezifische Bild-Hintergründe (Thumbnails) abdunkeln */
[data-theme="dark"] .cell-thumb,
[data-theme="dark"] .coll-img-card > img,
[data-theme="dark"] .ref-card img { background: var(--bg-box); }
[data-theme="dark"] .src-pdf { color: var(--text-main); }
[data-theme="dark"] .type-badge.badge-initial { background: rgba(110,139,255,0.18); color: #c0d0ff; border-color: rgba(110,139,255,0.4); }
[data-theme="dark"] .type-badge.badge-retry  { background: rgba(255,200,80,0.15); color: #f7d680; border-color: rgba(255,200,80,0.35); }
[data-theme="dark"] .type-badge.badge-iter   { background: rgba(80,200,140,0.15); color: #8ce0b3; border-color: rgba(80,200,140,0.35); }

/* History-Header (Globaler Verlauf): Refresh-Button-Hover bleibt neutral */
.panel-head .btn-ghost:hover { background: var(--bg-box); }

/* Drawer in Dark-Mode */
[data-theme="dark"] .drawer-body img.detail-img { background: var(--bg-box); border-color: var(--border-light); }

/* ── Monitoring & Kosten ─────────────────────────────────────────────── */
.pane-monitoring { padding: 24px 28px 48px; overflow: auto; }
.pane-monitoring .pane-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; }
.mon-head-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.mon-range { display: inline-flex; align-items: center; gap: 6px; color: var(--text-muted); font-size: 13px; }
.mon-range select { padding: 6px 8px; border: 1px solid var(--border-light); border-radius: 6px; background: var(--bg-input); color: var(--text-main); }
.mon-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin: 20px 0 24px; }
.mon-kpi { background: var(--bg-card); border: 1px solid var(--border-light); border-radius: 10px; padding: 14px 16px; }
.mon-kpi-label { font-size: 12px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; }
.mon-kpi-value { font-size: 22px; font-weight: 600; margin: 4px 0 2px; color: var(--text-main); }
.mon-kpi-sub { font-size: 12px; color: var(--text-muted); }
.mon-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(420px, 1fr)); gap: 16px; }
.mon-card { background: var(--bg-card); border: 1px solid var(--border-light); border-radius: 10px; padding: 14px 16px; min-width: 0; }
.mon-chart-card { grid-column: 1 / -1; }
.mon-card-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 10px; }
.mon-card-head h3 { margin: 0; font-size: 14px; font-weight: 600; }
.mon-card-head select { padding: 4px 8px; border: 1px solid var(--border-light); border-radius: 6px; background: var(--bg-input); color: var(--text-main); font-size: 12px; }
.mon-chart svg { width: 100%; height: auto; display: block; color: var(--text-main); }
.mon-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.mon-table th, .mon-table td { padding: 6px 8px; text-align: left; border-bottom: 1px solid var(--border-light); vertical-align: top; }
.mon-table th { font-weight: 600; color: var(--text-muted); font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em; }
.mon-table td.num { text-align: right; font-variant-numeric: tabular-nums; }
.mon-sub { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.mon-pct-cell { display: flex; align-items: center; gap: 8px; min-width: 120px; }
.mon-pct-bar { flex: 1; height: 6px; background: var(--bg-box); border-radius: 3px; overflow: hidden; }
.mon-pct-bar > span { display: block; height: 100%; background: var(--accent, #6366f1); }
.mon-pct-bar.is-warn > span { background: #f59e0b; }
.mon-pct-bar.is-over > span { background: #ef4444; }
.mon-pct-num { font-size: 11px; color: var(--text-muted); font-variant-numeric: tabular-nums; min-width: 36px; text-align: right; }
.mon-iphash { font-size: 11px; color: var(--text-muted); }
.mon-err-cell { font-family: var(--mono, monospace); font-size: 11px; color: var(--text-muted); word-break: break-word; }
.mon-pricing-card { grid-column: 1 / -1; }
.mon-pricing-hint { font-size: 11px; color: var(--text-muted); }
.mon-pricing-row { margin-bottom: 8px; }
.mon-pricing-row label { display: inline-flex; align-items: center; gap: 8px; font-size: 12px; color: var(--text-muted); }
.mon-pricing-row input { padding: 4px 8px; border: 1px solid var(--border-light); border-radius: 6px; background: var(--bg-input); color: var(--text-main); }
#mon-pricing-json { width: 100%; box-sizing: border-box; padding: 10px; font-family: var(--mono, monospace); font-size: 12px; border: 1px solid var(--border-light); border-radius: 6px; background: var(--bg-input); color: var(--text-main); }
.mon-pricing-actions { display: flex; gap: 8px; align-items: center; margin-top: 8px; }
.mon-pricing-status { font-size: 12px; color: var(--text-muted); }
.mon-pricing-status.is-ok { color: var(--success, #10b981); }
.mon-pricing-status.is-error { color: #ef4444; }
