:root {
  --primary: #FFD32B;
  --primary-hover: #EFB604;
  --primary-dark: #162455;
  --bg-app: #EFF6FF;
  --bg-card: #ffffff;
  --bg-box: #F8FAFB;
  --text-main: #020617;
  --text-muted: #45556C;
  --text-on-primary: #162455;
  --border-light: #CAD5E2;
  --border-medium: #90A2B9;
  --danger: #ef4444;
  --success: #10b981;
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.08), 0 2px 4px -2px rgb(0 0 0 / 0.05);
  --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.10);
  --radius-md: 0.875rem;
  --radius-lg: 2rem;
  --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
}

* { 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: #fff;
  border-bottom: 0.5px solid var(--border-light);
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.25rem;
}
.admin-logo { display: flex; align-items: center; }
.admin-logo img { height: 36px; }
.admin-header-right { display: flex; align-items: center; gap: 0.75rem; }
.admin-badge {
  background: var(--primary);
  color: var(--text-on-primary);
  font-weight: 600;
  font-size: 0.78rem;
  padding: 0.3rem 0.7rem;
  border-radius: 9999px;
  letter-spacing: 0.02em;
}

/* ─── 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 rgba(255, 211, 43, 0.55);
}
.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(--primary);
  box-shadow: 0 0 0 3px rgba(255, 211, 43, 0.35);
}
.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(--primary-dark);
  border-bottom-color: var(--primary);
}

.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: rgba(255, 211, 43, 0.07); }
.history-table tr.row-clickable:focus { outline: none; }
.history-table tr.row-clickable:focus-visible td {
  background: rgba(255, 211, 43, 0.12);
  box-shadow: inset 0 0 0 2px var(--primary);
}
.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(--primary);
}
/* (.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;
}

