/* =========================================================
   Biegner-IT Plattform-Template – zentrales Stylesheet
   1. Tokens (Farben, Schrift, Abstände)  → hier Branding anpassen
   2. Basis
   3. Layout (Shell, Sidebar, Topbar)
   4. Komponenten
   5. Seiten-spezifisch
   6. Druck
   ========================================================= */

/* ---------- 1. Tokens ---------- */
:root {
  --bg: #F4F6F9;
  --surface: #FFFFFF;
  --surface-2: #EEF2F7;
  --line: #DCE2EA;
  --control: #76839A;   /* Rahmen von Bedienelementen, ≥ 3:1 (WCAG 1.4.11) */
  --text: #0F1B2D;
  --text-2: #4A5A6E;
  --accent: #1662D6;
  --accent-hover: #0E4AA8;
  --accent-ink: #FFFFFF;
  --accent-soft: #E6EEFB;
  --accent-soft-ink: #0E4AA8;
  --nav-bg: #0A1628;
  --nav-line: #1E3149;
  --nav-text: #C9D5E3;
  --nav-muted: #7D91A8;
  --nav-active: #1A2E4A;
  --nav-accent: #6FB1FF;
  --ok: #0F6B45;   --ok-soft: #E3F5EC;
  --warn: #8A4B00; --warn-soft: #FFF1DB;
  --err: #B42318;  --err-soft: #FDE4E1;
  --shadow: 0 1px 2px rgba(10, 22, 40, .06), 0 4px 16px rgba(10, 22, 40, .06);

  --font-display: 'Space Grotesk', 'Segoe UI', system-ui, sans-serif;
  --font-body: 'IBM Plex Sans', 'Segoe UI', system-ui, sans-serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, 'Cascadia Mono', Consolas, monospace;

  --r-sm: 6px; --r-md: 10px; --r-lg: 14px;
  --sidebar-w: 256px;
  --gutter: clamp(16px, 3vw, 32px);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0B1320; --surface: #111C2D; --surface-2: #17243A; --line: #243650; --control: #5E7493;
    --text: #E6EDF5; --text-2: #9FB0C5;
    --accent: #4B8FF0; --accent-hover: #6FA6F5; --accent-ink: #06101F;
    --accent-soft: #16294A; --accent-soft-ink: #9CC4FF;
    --nav-bg: #070E1A; --nav-line: #17263B; --nav-active: #14243B;
    --ok: #5FD49A; --ok-soft: #10301F; --warn: #F2B44B; --warn-soft: #33260D; --err: #FF8A7A; --err-soft: #3A1814;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 4px 16px rgba(0,0,0,.25);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0B1320; --surface: #111C2D; --surface-2: #17243A; --line: #243650; --control: #5E7493;
  --text: #E6EDF5; --text-2: #9FB0C5;
  --accent: #4B8FF0; --accent-hover: #6FA6F5; --accent-ink: #06101F;
  --accent-soft: #16294A; --accent-soft-ink: #9CC4FF;
  --nav-bg: #070E1A; --nav-line: #17263B; --nav-active: #14243B;
  --ok: #5FD49A; --ok-soft: #10301F; --warn: #F2B44B; --warn-soft: #33260D; --err: #FF8A7A; --err-soft: #3A1814;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 4px 16px rgba(0,0,0,.25);
}

/* ---------- 2. Basis ---------- */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: var(--font-body); font-size: 0.9375rem; line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { font-family: var(--font-display); line-height: 1.15; margin: 0; letter-spacing: -.01em; text-wrap: balance; }
h1 { font-size: clamp(1.5rem, 3vw, 1.875rem); font-weight: 700; }
h2 { font-size: 1.25rem; font-weight: 600; }
h3 { font-size: 1.0625rem; font-weight: 600; }
p { margin: 0; }
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }
img, video { max-width: 100%; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
html { scroll-padding-top: 84px; }
main:focus { outline: none; }
.mono { font-family: var(--font-mono); }
.muted { color: var(--text-2); }
.num { font-variant-numeric: tabular-nums; }
.eyebrow { font-family: var(--font-mono); font-size: 0.75rem; letter-spacing: .06em; text-transform: uppercase; color: var(--accent); }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; border: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link { position: absolute; left: 12px; top: -100px; z-index: 200; padding: 12px 18px; border-radius: var(--r-md); background: var(--text); color: var(--bg); font-weight: 600; }
.skip-link:focus { top: 12px; color: var(--bg); }
.stack { display: flex; flex-direction: column; gap: var(--gap, 16px); }
.row { display: flex; align-items: center; gap: var(--gap, 12px); flex-wrap: wrap; }
.spacer { flex: 1; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* ---------- 3. Layout ---------- */
.shell { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); min-height: 100%; }
.sidebar {
  background: var(--nav-bg); color: var(--nav-text);
  display: flex; flex-direction: column; gap: 24px;
  padding: 20px 14px; position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.brand { display: flex; align-items: center; gap: 12px; padding: 4px 8px; color: #FFFFFF; }
.brand:hover { color: #FFFFFF; }
.brand-mark { width: 28px; height: 28px; display: grid; grid-template-columns: 1fr 1fr; gap: 3px; flex-shrink: 0; }
.brand-mark span { border-radius: 2px; background: var(--nav-accent); }
.brand-mark span:first-child { background: #1662D6; }
.brand-mark span:last-child { background: #FFFFFF; }
.brand-name { font-family: var(--font-display); font-weight: 700; font-size: 1.125rem; line-height: 1.1; }
.brand-sub { display: block; font-family: var(--font-mono); font-size: 0.6875rem; font-weight: 400; color: var(--nav-muted); letter-spacing: .04em; }
.nav-group { display: flex; flex-direction: column; gap: 2px; }
.nav-label { padding: 0 10px 6px; font-family: var(--font-mono); font-size: 0.6875rem; letter-spacing: .08em; text-transform: uppercase; color: var(--nav-muted); }
.nav-link {
  display: flex; align-items: center; gap: 12px; min-height: 42px; padding: 0 10px;
  border-radius: var(--r-sm); color: var(--nav-text); font-size: 0.90625rem;
}
.nav-link svg { width: 18px; height: 18px; flex-shrink: 0; opacity: .8; }
.nav-link:hover { background: var(--nav-active); color: #FFFFFF; }
.nav-link[aria-current="page"] { background: var(--nav-active); color: #FFFFFF; font-weight: 500; }
.nav-link[aria-current="page"] svg { color: var(--nav-accent); opacity: 1; }
.sidebar-foot { margin-top: auto; padding: 12px; border: 1px solid var(--nav-line); border-radius: var(--r-md); font-size: 0.8125rem; color: var(--nav-muted); }
.sidebar-foot strong { color: #FFFFFF; font-weight: 500; display: block; }

.main { display: flex; flex-direction: column; min-width: 0; }
.topbar {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20;
  display: flex; align-items: center; gap: 16px; min-height: 68px;
  padding: 10px var(--gutter); background: var(--surface); border-bottom: 1px solid var(--line);
}
.crumbs { display: flex; flex-direction: column; min-width: 0; }
.crumbs .path { font-family: var(--font-mono); font-size: 0.75rem; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.crumbs h1 { font-size: 1.3125rem; font-weight: 600; }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.content { padding: 28px var(--gutter) 48px; display: flex; flex-direction: column; gap: 24px; max-width: 1400px; width: 100%; }
.topbar .menu-btn { display: none; }
.scrim { display: none; }

@media (max-width: 960px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: min(280px, 85vw); z-index: 50; transform: translateX(-100%); visibility: hidden; transition: transform .2s ease, visibility 0s linear .2s; }
  body.nav-open .sidebar { transform: none; visibility: visible; transition: transform .2s ease; }
  body.nav-open .scrim { display: block; position: fixed; inset: 0; background: rgba(5, 10, 20, .5); z-index: 40; }
  .topbar .menu-btn { display: inline-flex; }
}

/* ---------- 4. Komponenten ---------- */
/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 42px; padding: 0 18px; border-radius: var(--r-sm); border: 1px solid transparent;
  font: inherit; font-size: 0.90625rem; font-weight: 600; cursor: pointer; white-space: nowrap;
  transition: background-color .15s, border-color .15s, color .15s;
}
.btn svg { width: 16px; height: 16px; }
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: var(--accent-hover); color: var(--accent-ink); }
.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--line); }
.btn-secondary:hover { border-color: var(--text-2); color: var(--text); }
.btn-ghost { background: transparent; color: var(--accent); padding: 0 10px; }
.btn-ghost:hover { background: var(--accent-soft); }
.btn-danger { background: var(--surface); color: var(--err); border-color: var(--line); }
.btn-danger:hover { background: var(--err-soft); }
.btn-sm { min-height: 34px; padding: 0 12px; font-size: 0.84375rem; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center; width: 42px; height: 42px;
  border-radius: var(--r-sm); border: 1px solid var(--line); background: var(--surface); color: var(--text); cursor: pointer;
}
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn:hover { border-color: var(--text-2); }

/* Karten */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); }
.card-pad { padding: 22px 24px; }
.card-head { display: flex; align-items: center; gap: 12px; padding: 18px 24px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.card-head h2 { font-size: 1.0625rem; }
.card-body { padding: 20px 24px; }

/* Raster */
.grid { display: grid; gap: var(--gap, 20px); grid-template-columns: repeat(auto-fill, minmax(var(--min, 260px), 1fr)); }
.split { display: grid; gap: 24px; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); align-items: start; }
@media (max-width: 1100px) { .split { grid-template-columns: minmax(0, 1fr); } }

/* KPI */
.kpis { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.kpi { padding: 18px 20px; display: flex; flex-direction: column; gap: 6px; }
.kpi-label { font-size: 0.84375rem; color: var(--text-2); }
.kpi-value { font-family: var(--font-display); font-size: 1.875rem; font-weight: 600; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.kpi-hint { font-family: var(--font-mono); font-size: 0.75rem; color: var(--text-2); }

/* Badges */
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 0.78125rem; font-weight: 600; white-space: nowrap; background: var(--surface-2); color: var(--text-2); }
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.err { background: var(--err-soft); color: var(--err); }
.badge.info { background: var(--accent-soft); color: var(--accent-soft-ink); }

/* Chips (Filter) */
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { min-height: 36px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--text); font: inherit; font-size: 0.84375rem; cursor: pointer; }
.chip[aria-pressed="true"] { background: var(--text); color: var(--bg); border-color: var(--text); }

/* Formulare */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field label, .label { font-size: 0.84375rem; font-weight: 600; }
.input, .select, .textarea {
  width: 100%; min-height: 42px; padding: 0 12px; border: 1px solid var(--line); border-radius: var(--r-sm);
  background: var(--surface); color: var(--text); font: inherit; font-size: 0.90625rem;
}
.textarea { padding: 10px 12px; min-height: 96px; resize: vertical; }
.input:focus, .select:focus, .textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: var(--accent); }
.input[aria-invalid="true"] { border-color: var(--err); }
.field-error { font-size: 0.8125rem; color: var(--err); }
.check { display: flex; gap: 10px; align-items: center; font-size: 0.875rem; min-height: 40px; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); }
.form-grid { display: grid; gap: 16px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-grid .full { grid-column: 1 / -1; }
@media (max-width: 600px) { .form-grid { grid-template-columns: minmax(0, 1fr); } }
.search { position: relative; }
.search svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--text-2); pointer-events: none; }
.search .input { padding-left: 36px; }

/* Tabellen */
.table-wrap { overflow-x: auto; position: relative; }
table.table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
.table th { text-align: left; font-family: var(--font-mono); font-weight: 500; font-size: 0.71875rem; letter-spacing: .06em; text-transform: uppercase; color: var(--text-2); padding: 10px 16px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 12px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tbody tr:hover { background: var(--surface-2); }
.table .r { text-align: right; font-variant-numeric: tabular-nums; }
.table tr:last-child td { border-bottom: 0; }
.table td.mono, .table td strong { white-space: nowrap; }

/* Fortschritt */
.progress { height: 6px; border-radius: 3px; background: var(--surface-2); overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--accent); border-radius: 3px; }

/* Tabs */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); overflow-x: auto; }
.tab { min-height: 44px; padding: 0 16px; border: 0; background: none; color: var(--text-2); font: inherit; font-size: 0.90625rem; font-weight: 500; cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tab[aria-selected="true"] { color: var(--text); border-bottom-color: var(--accent); }

/* Dialog */
dialog.modal { width: min(640px, calc(100vw - 32px)); max-height: calc(100vh - 32px); padding: 0; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
dialog.modal::backdrop { background: rgba(5, 10, 20, .55); }
.modal-head { display: flex; align-items: center; gap: 12px; padding: 18px 24px; border-bottom: 1px solid var(--line); }
.modal-body { padding: 20px 24px; }
.modal-foot { display: flex; gap: 10px; justify-content: flex-end; padding: 16px 24px; border-top: 1px solid var(--line); flex-wrap: wrap; }

/* Hinweise, Toast, Leerzustand */
.notice { display: flex; gap: 12px; padding: 14px 16px; border-radius: var(--r-md); background: var(--accent-soft); color: var(--accent-soft-ink); font-size: 0.875rem; }
.notice.warn { background: var(--warn-soft); color: var(--warn); }
.notice svg { width: 18px; height: 18px; flex-shrink: 0; margin-top: 2px; }
.toast:not(.show) { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); padding: 0; }
.toast { position: fixed; right: 16px; bottom: calc(16px + env(safe-area-inset-bottom, 0px)); z-index: 100; padding: 12px 18px; border-radius: var(--r-md); background: var(--text); color: var(--bg); font-size: 0.875rem; font-weight: 500; box-shadow: var(--shadow); }
.empty { padding: 40px 24px; text-align: center; color: var(--text-2); }

/* ---------- 5. Seiten ---------- */
/* Portal */
.portal { min-height: 100%; display: flex; flex-direction: column; }
.portal-top { background: var(--nav-bg); color: var(--nav-text); padding-inline: var(--gutter); }
.portal-top-inner { max-width: 1200px; margin: 0 auto; min-height: 72px; display: flex; align-items: center; gap: 16px; }
.portal-hero { background-color: var(--nav-bg); background-image: linear-gradient(var(--nav-line) 1px, transparent 1px), linear-gradient(90deg, var(--nav-line) 1px, transparent 1px); background-size: 44px 44px; padding: 64px var(--gutter) 120px; }
.portal-hero-inner { max-width: 1200px; margin: 0 auto; display: flex; flex-direction: column; gap: 18px; }
.portal-hero h1 { color: #FFFFFF; font-size: clamp(2.125rem, 5vw, 3.5rem); max-width: 16ch; }
.portal-hero p { color: var(--nav-text); font-size: 1.125rem; max-width: 58ch; }
.portal-hero .eyebrow { color: var(--nav-accent); }
.portal-cards { max-width: 1200px; margin: -72px auto 0; padding-inline: var(--gutter); display: grid; gap: 24px; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); width: 100%; }
.project { display: flex; flex-direction: column; gap: 16px; padding: 28px; color: var(--text); box-shadow: var(--shadow); transition: border-color .15s; }
.project:hover { border-color: var(--accent); color: var(--text); }
.project-icon { width: 52px; height: 52px; border-radius: var(--r-md); background: var(--nav-bg); color: var(--nav-accent); display: flex; align-items: center; justify-content: center; }
.project-icon svg { width: 26px; height: 26px; }
.project h2 { font-size: 1.625rem; }
.project ul { margin: 0; padding-left: 18px; color: var(--text-2); display: flex; flex-direction: column; gap: 4px; }
.project .go { margin-top: auto; font-weight: 600; color: var(--accent); }
.portal-foot { margin-top: auto; padding: 32px var(--gutter); color: var(--text-2); font-size: 0.84375rem; }
.portal-foot-inner { max-width: 1200px; margin: 0 auto; display: flex; gap: 20px; flex-wrap: wrap; border-top: 1px solid var(--line); padding-top: 20px; }

/* Lernplattform */
.course { display: flex; flex-direction: column; overflow: hidden; color: var(--text); }
.course:hover { border-color: var(--accent); color: var(--text); }
.course-thumb { aspect-ratio: 16 / 8; max-width: 100%; background: var(--nav-bg); color: var(--nav-accent); display: flex; align-items: flex-end; justify-content: space-between; padding: 16px 18px; }
.course-thumb .mono { font-size: 0.75rem; color: var(--nav-text); }
.course-thumb svg { width: 34px; height: 34px; }
.course-body { padding: 18px 20px 20px; display: flex; flex-direction: column; gap: 10px; flex: 1; }
.course-meta { display: flex; gap: 14px; font-size: 0.8125rem; color: var(--text-2); flex-wrap: wrap; }
.course-foot { margin-top: auto; display: flex; align-items: center; gap: 12px; padding-top: 6px; }
.course-foot .progress { flex: 1; }
.continue { display: grid; grid-template-columns: minmax(0, 220px) minmax(0, 1fr); gap: 0; overflow: hidden; }
.continue .course-thumb { aspect-ratio: auto; height: 100%; min-height: 140px; }
@media (max-width: 640px) { .continue { grid-template-columns: minmax(0, 1fr); } }

.player-layout { display: grid; gap: 24px; grid-template-columns: minmax(0, 1fr) 360px; align-items: start; }
@media (max-width: 1100px) { .player-layout { grid-template-columns: minmax(0, 1fr); } }
.player { position: relative; aspect-ratio: 16 / 9; max-width: 100%; background: #05090F; border-radius: var(--r-lg); overflow: hidden; }
.player video { width: 100%; height: 100%; display: block; background: #05090F; }
.player-fallback { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; padding: 24px; text-align: center; color: #C9D5E3; background-color: #0A1628; background-image: linear-gradient(#13243B 1px, transparent 1px), linear-gradient(90deg, #13243B 1px, transparent 1px); background-size: 40px 40px; }
.player-fallback strong { color: #FFFFFF; font-family: var(--font-display); font-size: 1.25rem; }
.player-fallback code { font-family: var(--font-mono); font-size: 0.8125rem; color: #6FB1FF; word-break: break-all; }
.lessons { display: flex; flex-direction: column; }
.lesson { display: flex; align-items: center; gap: 12px; padding: 12px 20px; border-top: 1px solid var(--line); color: var(--text); font-size: 0.875rem; }
.lesson:hover { background: var(--surface-2); color: var(--text); }
.lesson[aria-current="true"] { background: var(--accent-soft); }
.lesson-state { width: 24px; height: 24px; border-radius: 50%; border: 1.5px solid var(--line); flex-shrink: 0; display: flex; align-items: center; justify-content: center; font-family: var(--font-mono); font-size: 0.6875rem; color: var(--text-2); }
.lesson.done .lesson-state { background: var(--ok); border-color: var(--ok); color: var(--surface); }
.lesson-title { flex: 1; min-width: 0; }
.lesson-dur { font-family: var(--font-mono); font-size: 0.75rem; color: var(--text-2); }

/* Listen */
.list-item { display: flex; align-items: center; gap: 12px; padding: 12px 24px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.list-item:first-child { border-top: 0; }

.in-frame-hide { }
html.in-frame .in-frame-hide { display: none !important; }

/* ---------- 5b. Lernportal: Verwaltung, Tests, Zertifikate ---------- */
.foot-m { display: block; margin-top: 2px; color: var(--nav-text); }
.foot-label { display: block; margin-top: 10px; font-family: var(--font-mono); font-size: 0.65625rem; letter-spacing: .06em; text-transform: uppercase; }
.foot-select { width: 100%; margin-top: 4px; min-height: 34px; border-radius: var(--r-sm); border: 1px solid var(--nav-line); background: var(--nav-active); color: #FFFFFF; font: inherit; font-size: 0.8125rem; padding: 0 8px; }
.foot-btn { display: flex; align-items: center; gap: 8px; margin-top: 10px; padding: 0; min-height: 32px; border: 0; background: none; color: var(--nav-text); font: inherit; font-size: 0.8125rem; cursor: pointer; }
.foot-btn svg { width: 16px; height: 16px; }
.foot-btn:hover { color: #FFFFFF; }

dialog.modal.wide { width: min(980px, calc(100vw - 32px)); }
dialog.modal[open] { display: flex; flex-direction: column; }
dialog.modal .modal-body { overflow-y: auto; }
.btn-xs { min-height: 30px; padding: 0 10px; font-size: 0.8125rem; }
.icon-btn.sm { width: 34px; height: 34px; }
.icon-btn.sm svg { width: 16px; height: 16px; }
.actions { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: nowrap; }
.hint { font-size: 0.8125rem; color: var(--text-2); }
.kv { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 6px 16px; font-size: 0.875rem; margin: 0; }
.kv dt { color: var(--text-2); }
.kv dd { margin: 0; overflow-wrap: anywhere; }
.pill-row { display: flex; gap: 6px; flex-wrap: wrap; }
.notice.ok { background: var(--ok-soft); color: var(--ok); }
.notice a, .verdict a { color: inherit; text-decoration: underline; text-underline-offset: 2px; font-weight: 600; }
.notice.err { background: var(--err-soft); color: var(--err); }
.table td .sub { display: block; font-size: 0.78125rem; color: var(--text-2); }
.table .clip { max-width: 420px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.table input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--accent); }
.scroll-box { max-height: 340px; overflow: auto; border: 1px solid var(--line); border-radius: var(--r-md); }
.section-title { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.check-list { display: flex; flex-direction: column; }
.check-list label { display: flex; align-items: center; gap: 10px; padding: 9px 14px; border-top: 1px solid var(--line); font-size: 0.875rem; cursor: pointer; }
.check-list label:first-child { border-top: 0; }
.check-list label:hover { background: var(--surface-2); }
.check-list input { width: 18px; height: 18px; accent-color: var(--accent); flex-shrink: 0; }
.check-list .meta { margin-left: auto; font-size: 0.78125rem; color: var(--text-2); }
.empty-mini { padding: 18px; text-align: center; color: var(--text-2); font-size: 0.875rem; }

/* Kurs-Editor */
.chapter-ed { border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface-2); padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.chapter-ed .row .input { flex: 1; min-width: 160px; }
.lesson-ed { display: grid; grid-template-columns: minmax(0, 2fr) 90px minmax(0, 2fr) auto; gap: 8px; align-items: center; }
@media (max-width: 760px) { .lesson-ed { grid-template-columns: minmax(0, 1fr) 90px; } .lesson-ed .src, .lesson-ed .actions { grid-column: 1 / -1; } }
.option-ed { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 10px; align-items: center; }
.option-ed input[type="radio"], .option-ed input[type="checkbox"] { width: 20px; height: 20px; accent-color: var(--ok); }

/* Rechte-Matrix */
.perm-table td:not(:first-child), .perm-table th:not(:first-child) { text-align: center; width: 120px; }

/* Lernbereich */
.chapter-head { padding: 10px 20px 6px; border-top: 1px solid var(--line); font-family: var(--font-mono); font-size: 0.71875rem; letter-spacing: .06em; text-transform: uppercase; color: var(--text-2); background: var(--surface-2); }
.assign-card { display: flex; flex-direction: column; gap: 10px; padding: 20px; color: var(--text); }
.assign-card:hover { border-color: var(--accent); color: var(--text); }
.assign-card .top { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.assign-card h3 { font-size: 1.125rem; }

/* Test */
.q-card { padding: 20px 22px; display: flex; flex-direction: column; gap: 12px; }
.q-card legend { font-weight: 600; font-size: 1rem; padding: 0; margin-bottom: 4px; }
.q-card fieldset { border: 0; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.q-num { font-family: var(--font-mono); font-size: 0.75rem; color: var(--text-2); }
.answer { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--r-md); cursor: pointer; font-size: 0.9375rem; background: var(--surface); }
.answer:hover { border-color: var(--text-2); }
.answer input { width: 20px; height: 20px; margin: 1px 0 0; accent-color: var(--accent); flex-shrink: 0; }
.answer:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.answer.is-right { border-color: var(--ok); background: var(--ok-soft); }
.answer.is-wrong { border-color: var(--err); background: var(--err-soft); }
.exam-bar { position: sticky; top: 68px; z-index: 10; display: flex; align-items: center; gap: 14px; flex-wrap: wrap; padding: 12px 18px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow); }
.exam-bar .progress { flex: 1; min-width: 120px; }
.timer { font-family: var(--font-mono); font-size: 0.9375rem; font-weight: 500; display: inline-flex; align-items: center; gap: 6px; }
.timer svg { width: 16px; height: 16px; }
.timer.low { color: var(--err); }
.result-hero { display: flex; gap: 20px; align-items: center; flex-wrap: wrap; padding: 26px; }
.result-hero .big { font-family: var(--font-display); font-size: 3rem; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }

/* Login & Prüfseite (Portal-Layout) */
.auth-wrap { max-width: 1200px; margin: -72px auto 0; padding-inline: var(--gutter); width: 100%; display: grid; gap: 24px; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); align-items: start; }
@media (max-width: 900px) { .auth-wrap { grid-template-columns: minmax(0, 1fr); } }
.auth-card { padding: 28px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 18px; }
.demo-list { display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.demo-btn { text-align: left; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); color: var(--text); font: inherit; cursor: pointer; display: flex; flex-direction: column; gap: 2px; }
.demo-btn:hover { border-color: var(--accent); }
.demo-btn strong { font-size: 0.875rem; }
.demo-btn span { font-size: 0.78125rem; color: var(--text-2); font-family: var(--font-mono); }
.verdict { display: flex; gap: 18px; align-items: flex-start; padding: 24px; border-radius: var(--r-lg); border: 2px solid; }
.verdict svg { width: 44px; height: 44px; flex-shrink: 0; }
.verdict h2 { font-size: 1.625rem; }
.verdict.echt, .verdict.gueltig { border-color: var(--ok); background: var(--ok-soft); color: var(--ok); }
.verdict.abgelaufen, .verdict.ersetzt { border-color: var(--warn); background: var(--warn-soft); color: var(--warn); }
.verdict.gefaelscht { border-color: var(--err); background: var(--err-soft); color: var(--err); }
.verdict.widerrufen { border-color: var(--err); background: var(--err-soft); color: var(--err); }
.verdict .v-status { font-family: var(--font-mono, monospace); font-size: 0.8125rem; letter-spacing: .06em; text-transform: uppercase; }
.verdict .kv dd { overflow-wrap: anywhere; }
.verdict .kv { color: var(--text); margin-top: 10px; }

/* Zertifikat (Druckdokument) */
.cert { background: #FFFFFF; color: #111; border: 1px solid var(--line); border-radius: var(--r-md); padding: clamp(24px, 5vw, 56px); max-width: 820px; position: relative; overflow: hidden; }
.cert::before { content: ''; position: absolute; inset: 12px; border: 1.5px solid #1662D6; border-radius: 6px; pointer-events: none; }
.cert .c-eyebrow { font-family: var(--font-mono); font-size: 0.75rem; letter-spacing: .12em; text-transform: uppercase; color: #1662D6; }
.cert h2 { font-family: var(--font-display); font-size: clamp(1.625rem, 4vw, 2.25rem); color: #0A1628; margin: 6px 0 22px; }
.cert .c-name { font-family: var(--font-display); font-size: clamp(1.375rem, 3.4vw, 1.875rem); font-weight: 600; color: #0A1628; margin: 6px 0 4px; }
.cert .c-text { font-size: 0.9375rem; color: #333; max-width: 56ch; }
.cert .c-course { font-weight: 600; color: #0A1628; }
.cert .c-meta { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; margin-top: 28px; font-size: 0.8125rem; color: #444; }
.cert .c-meta strong { display: block; color: #111; font-size: 0.875rem; }
.cert .c-sig { margin-top: 22px; font-family: var(--font-mono); font-size: 0.65625rem; color: #555; word-break: break-all; line-height: 1.5; }
.cert .c-foot { margin-top: 18px; padding-top: 14px; border-top: 1px solid #E3E3E3; font-size: 0.75rem; color: #555; }

/* ---------- 6. Druck ---------- */
@media print {
  .sidebar, .topbar, .no-print, .tabs, .toast { display: none !important; }
  .shell { display: block; }
  body { background: #FFFFFF; }
  .content { padding: 0; }
  .cert { border: 0; max-width: none; }
  .card { border: 0; }
  .print-only { display: block !important; }
}
.print-only { display: none; }
@media print {
  body.print-cert .content > *:not(#certView) { display: none !important; }
  body.print-cert #certView > *:not(#certDoc) { display: none !important; }
}
.portal-user { color: var(--nav-text); font-size: 0.875rem; padding: 0 6px; }
@media (max-width: 640px) { .portal-user, .portal-top .btn-ghost[href^="https"] { display: none; } }
.icon-btn[disabled] { opacity: .35; cursor: not-allowed; }
.table td.nowrap { white-space: nowrap; }
@media (max-width: 600px) {
  .crumbs h1 { overflow-wrap: anywhere; }
  .crumbs .path { white-space: normal; }
}

/* Lerninhalte */
.prose { font-size: 0.96875rem; line-height: 1.65; max-width: 72ch; }
.prose > * + * { margin-top: .7em; }
.prose h3 { font-size: 1.25rem; margin-top: 1.1em; }
.prose h4 { font-size: 1.0625rem; margin-top: 1em; }
.prose h5 { font-size: 0.9375rem; margin-top: 1em; }
.prose ul, .prose ol { padding-left: 22px; margin-bottom: 0; }
.prose li + li { margin-top: 4px; }
.prose code { font-family: var(--font-mono); font-size: .9em; background: var(--surface-2); padding: 1px 5px; border-radius: 4px; }
.notice .prose { font-size: 0.90625rem; }
.player iframe { width: 100%; height: 100%; border: 0; display: block; }
.lesson-fig { margin: 0; }
.lesson-fig img { border-radius: var(--r-md); border: 1px solid var(--line); display: block; }
.lesson-fig figcaption { font-size: 0.8125rem; color: var(--text-2); margin-top: 6px; }
.file-link { display: inline-flex; align-items: center; gap: 10px; padding: 10px 14px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); font-weight: 500; align-self: flex-start; }
.file-link svg { width: 18px; height: 18px; }
.kind-badge { display: inline-flex; align-items: center; gap: 6px; font-family: var(--font-mono); font-size: 0.71875rem; letter-spacing: .05em; text-transform: uppercase; padding: 3px 9px; border-radius: 999px; }
.kind-badge svg { width: 14px; height: 14px; }
.kind-badge.theorie { background: var(--accent-soft); color: var(--accent-soft-ink); }
.kind-badge.praxis { background: var(--warn-soft); color: var(--warn); }
.lesson .k-ico { width: 16px; height: 16px; color: var(--text-2); flex-shrink: 0; }
.lesson .k-ico svg { width: 16px; height: 16px; }
.steps-list label { align-items: flex-start; }
.steps-list label.done span { text-decoration: line-through; color: var(--text-2); }
.answer-box { white-space: pre-wrap; padding: 14px 16px; border-radius: var(--r-md); background: var(--surface-2); font-size: 0.90625rem; }

/* Inhalts-Editor */
.editor-layout { display: grid; gap: 24px; grid-template-columns: 300px minmax(0, 1fr); align-items: start; }
@media (max-width: 1000px) { .editor-layout { grid-template-columns: minmax(0, 1fr); } }
.tree { position: sticky; top: 88px; max-height: calc(100vh - 110px); overflow: auto; }
@media (max-width: 1000px) { .tree { position: static; max-height: none; } }
.tree-ch { border-top: 1px solid var(--line); padding: 8px 0; }
.tree-ch:first-child { border-top: 0; }
.tree-item { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 38px; padding: 6px 16px; border: 0; background: none; color: var(--text); font: inherit; font-size: 0.875rem; text-align: left; cursor: pointer; }
.tree-item:hover { background: var(--surface-2); }
.tree-item[aria-current="true"] { background: var(--accent-soft); color: var(--accent-soft-ink); font-weight: 600; }
.tree-item.chap { font-weight: 600; font-family: var(--font-display); }
.tree-item.les { padding-left: 30px; }
.tree-item svg { width: 16px; height: 16px; flex-shrink: 0; opacity: .75; }
.tree-item .t { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tree-add { display: flex; gap: 6px; padding: 4px 16px 4px 30px; flex-wrap: wrap; }
.block-ed { border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); }
.block-ed .bh { display: flex; align-items: center; gap: 8px; padding: 8px 10px 8px 14px; border-bottom: 1px solid var(--line); background: var(--surface-2); border-radius: var(--r-md) var(--r-md) 0 0; }
.block-ed .bh .lbl { font-family: var(--font-mono); font-size: 0.75rem; text-transform: uppercase; letter-spacing: .05em; color: var(--text-2); display: inline-flex; gap: 8px; align-items: center; }
.block-ed .bh .lbl svg { width: 15px; height: 15px; }
.block-ed .bb { padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.add-bar { display: flex; gap: 8px; flex-wrap: wrap; }
.dirty-dot { display: inline-flex; align-items: center; gap: 6px; font-size: 0.8125rem; color: var(--warn); }
.dirty-dot::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.step-ed { display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto auto; gap: 8px; align-items: center; }
@media (max-width: 640px) { #portalUser a.btn-ghost { display: none; } .portal-top .brand-sub { display: none; } }

/* ---------- 7. Barrierefreiheit ---------- */
.a11y-set { border: 1px solid var(--line); border-radius: var(--r-md); padding: 12px 16px 14px; margin: 0; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.a11y-set legend { font-weight: 600; font-size: 0.875rem; padding: 0 6px; }
.a11y-opt { align-items: flex-start; }
.a11y-opt input { margin-top: 3px; }
.a11y-opt .sub { display: block; font-size: 0.8125rem; color: var(--text-2); }
.transcript { border: 1px solid var(--line); border-radius: var(--r-md); padding: 10px 14px; }
.transcript summary { cursor: pointer; font-weight: 600; }
.transcript[open] summary { margin-bottom: 10px; }
.a11y-warn { display: flex; flex-direction: column; gap: 6px; }
.a11y-warn li { font-size: 0.875rem; }
.field-error { font-weight: 500; }

/* Textgröße (WCAG 1.4.4) */
html.a11y-fs-125 { font-size: 125%; }
html.a11y-fs-150 { font-size: 150%; }
html.a11y-fs-200 { font-size: 200%; }
html.a11y-fs-150 .shell, html.a11y-fs-200 .shell { grid-template-columns: minmax(0, 1fr); }
html.a11y-fs-150 .sidebar, html.a11y-fs-200 .sidebar { position: fixed; inset: 0 auto 0 0; width: min(340px, 90vw); z-index: 50; transform: translateX(-100%); visibility: hidden; height: 100vh; }
html.a11y-fs-150 body.nav-open .sidebar, html.a11y-fs-200 body.nav-open .sidebar { transform: none; visibility: visible; }
html.a11y-fs-150 body.nav-open .scrim, html.a11y-fs-200 body.nav-open .scrim { display: block; position: fixed; inset: 0; background: rgba(5, 10, 20, .5); z-index: 40; }
html.a11y-fs-150 .topbar .menu-btn, html.a11y-fs-200 .topbar .menu-btn { display: inline-flex; }
html.a11y-fs-150 .player-layout, html.a11y-fs-200 .player-layout, html.a11y-fs-150 .editor-layout, html.a11y-fs-200 .editor-layout, html.a11y-fs-200 .split { grid-template-columns: minmax(0, 1fr); }
html.a11y-fs-200 .form-grid { grid-template-columns: minmax(0, 1fr); }

/* Links unterstreichen (WCAG 1.4.1) */
html.a11y-underline a:not(.btn):not(.nav-link):not(.brand):not(.card):not(.lesson):not(.skip-link) { text-decoration: underline; text-underline-offset: 2px; }

/* Starker Fokus (WCAG 2.4.7) */
html.a11y-focus :focus-visible { outline: 3px solid #000 !important; outline-offset: 2px; box-shadow: 0 0 0 6px #FFD400 !important; border-radius: 4px; }

/* Abstände (WCAG 1.4.12) */
html.a11y-spacing body { line-height: 1.8; letter-spacing: .04em; word-spacing: .14em; }
html.a11y-spacing .prose > * + * { margin-top: 1.2em; }
html.a11y-spacing p { max-width: 70ch; }

/* Bewegung aus (WCAG 2.3.3) */
html.a11y-motion *, html.a11y-motion *::before, html.a11y-motion *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }

/* Hoher Kontrast (WCAG 1.4.3 / 1.4.11, übertrifft AA) */
html.a11y-contrast {
  --bg: #FFFFFF; --surface: #FFFFFF; --surface-2: #F0F0F0; --line: #000000;
  --text: #000000; --text-2: #1F1F1F;
  --accent: #0033A0; --accent-hover: #001F66; --accent-ink: #FFFFFF; --accent-soft: #E3EBFF; --accent-soft-ink: #001F66;
  --nav-bg: #000000; --nav-line: #FFFFFF; --nav-text: #FFFFFF; --nav-muted: #E0E0E0; --nav-active: #1A1A1A; --nav-accent: #FFD400;
  --ok: #005A2B; --ok-soft: #E2F5EA; --warn: #6B3A00; --warn-soft: #FFF0D6; --err: #A00000; --err-soft: #FFE5E5;
}
html.a11y-contrast[data-theme="dark"] {
  --bg: #000000; --surface: #000000; --surface-2: #1A1A1A; --line: #FFFFFF;
  --text: #FFFFFF; --text-2: #F0F0F0;
  --accent: #FFD400; --accent-hover: #FFE666; --accent-ink: #000000; --accent-soft: #2A2400; --accent-soft-ink: #FFE666;
  --ok: #7DFFB0; --ok-soft: #002B14; --warn: #FFC266; --warn-soft: #2B1A00; --err: #FF9C9C; --err-soft: #330000;
}
@media (prefers-color-scheme: dark) {
  html.a11y-contrast:not([data-theme="light"]) {
    --bg: #000000; --surface: #000000; --surface-2: #1A1A1A; --line: #FFFFFF;
    --text: #FFFFFF; --text-2: #F0F0F0;
    --accent: #FFD400; --accent-hover: #FFE666; --accent-ink: #000000; --accent-soft: #2A2400; --accent-soft-ink: #FFE666;
    --ok: #7DFFB0; --ok-soft: #002B14; --warn: #FFC266; --warn-soft: #2B1A00; --err: #FF9C9C; --err-soft: #330000;
  }
}
html.a11y-contrast .card, html.a11y-contrast .input, html.a11y-contrast .select, html.a11y-contrast .textarea, html.a11y-contrast .btn-secondary, html.a11y-contrast .chip, html.a11y-contrast .answer { border-width: 2px; }
html.a11y-contrast .badge { border: 1.5px solid currentColor; }
html.a11y-contrast .muted, html.a11y-contrast .hint { color: var(--text); }
html.a11y-contrast .portal-hero { background-image: none; }

@media (forced-colors: active) {
  .progress { border: 1px solid CanvasText; }
  .progress > span { background: Highlight; forced-color-adjust: none; }
  .badge::before { background: CanvasText; }
  .btn, .chip, .icon-btn { border: 1px solid ButtonText; }
}
label.btn:has(input[type="file"]:focus-visible) { outline: 3px solid var(--accent); outline-offset: 2px; }
html.a11y-focus label.btn:has(input[type="file"]:focus-visible) { outline: 3px solid #000; box-shadow: 0 0 0 6px #FFD400; }
.a11y-details { border: 1px solid var(--line); border-radius: var(--r-md); padding: 12px 16px; }
.a11y-details summary { cursor: pointer; }
.badge svg { width: 13px; height: 13px; }
.badge:has(svg)::before { display: none; }
.doc-wrap { max-width: 900px; margin: -72px auto 0; padding-inline: var(--gutter); width: 100%; }
.doc-page { box-shadow: var(--shadow); max-width: none; font-size: 1rem; }
.doc-page h2 { font-size: 1.375rem; margin-top: 1.6em; }
.doc-page h2:first-of-type { margin-top: .4em; }
.doc-page .not-prose { margin-top: 1em; }
.leicht { font-size: 1.1875rem; line-height: 1.75; }
.leicht li + li { margin-top: 12px; }
/* Umbruch bei schmalen Bildschirmen (WCAG 1.4.10) */
.btn { white-space: normal; text-align: center; }
@media (max-width: 600px) {
  .topbar { flex-wrap: wrap; row-gap: 8px; }
  .topbar .crumbs { flex: 1 1 0; }
  .topbar-actions { margin-left: 0; width: 100%; justify-content: flex-end; flex-wrap: wrap; }
  .topbar-actions .btn-secondary { display: inline-flex; }
  .portal-top-inner { flex-wrap: wrap; row-gap: 8px; padding-block: 10px; }
  .portal-actions { margin-left: 0 !important; flex-wrap: wrap; }
  .portal-actions .btn-ghost[href="index.html"], .portal-actions .btn-ghost[href^="https"] { padding: 0 8px; }
  .card-pad, .card-body, .card-head, .modal-body, .modal-head, .modal-foot { padding-left: 16px; padding-right: 16px; }
  .row > .btn { max-width: 100%; }
}
.prose code, .doc-page code { overflow-wrap: anywhere; }
.prose a { overflow-wrap: anywhere; }
h1, h2, h3, h4, .prose, .doc-page li { overflow-wrap: break-word; hyphens: auto; -webkit-hyphens: auto; }

/* Bedienelemente mit ausreichendem Rahmenkontrast (WCAG 1.4.11) */
.input, .select, .textarea, .chip, .icon-btn, .btn-secondary, .btn-danger, .answer, .demo-btn { border-color: var(--control); }
html.a11y-contrast .input, html.a11y-contrast .select, html.a11y-contrast .textarea, html.a11y-contrast .chip, html.a11y-contrast .icon-btn, html.a11y-contrast .btn-secondary, html.a11y-contrast .answer { border-color: var(--line); }
.progress { box-shadow: inset 0 0 0 1px var(--control); }
.foot-switch { display: flex; gap: 6px; margin-top: 4px; }
.foot-switch .foot-select { margin-top: 0; flex: 1; min-width: 0; }
.foot-switch button { min-height: 34px; padding: 0 10px; border-radius: var(--r-sm); border: 1px solid var(--nav-line); background: var(--nav-active); color: #FFFFFF; font: inherit; font-size: 0.8125rem; cursor: pointer; }

/* ---------- 8. Pflichtschulungen ---------- */
:root { --st-good: #0F6B45; --st-warn: #C98A00; --st-crit: #B42318; }
:root[data-theme="dark"] { --st-good: #2E9E66; --st-warn: #B8860B; --st-crit: #DB5F8A; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --st-good: #2E9E66; --st-warn: #B8860B; --st-crit: #DB5F8A; } }
.badge svg { flex-shrink: 0; }
.cp-filter .field { min-width: 200px; }
.flow { display: flex; align-items: stretch; gap: 10px; flex-wrap: wrap; }
.flow-step { flex: 1 1 140px; display: flex; flex-direction: column; gap: 2px; padding: 14px 16px; border-radius: var(--r-md); border: 1px solid var(--line); background: var(--surface); }
.flow-n { font-family: var(--font-display); font-size: 2rem; font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; }
.flow-l { display: inline-flex; gap: 6px; align-items: center; color: var(--text-2); font-size: 0.875rem; }
.flow-l svg { width: 15px; height: 15px; }
.flow-p { font-family: var(--font-mono); font-size: 0.75rem; color: var(--text-2); }
.flow-step.ok { border-left: 4px solid var(--st-good); }
.flow-step.warn { border-left: 4px solid var(--st-warn); }
.flow-step.err { border-left: 4px solid var(--st-crit); }
.flow-arrow { align-self: center; color: var(--text-2); font-size: 1.25rem; }
@media (max-width: 700px) { .flow-arrow { display: none; } }
.sbar { display: flex; gap: 2px; height: 16px; min-width: 0; }
.sbar .seg { height: 100%; min-width: 4px; flex-basis: 0; cursor: default; }
.sbar .seg:first-child { border-radius: 4px 0 0 4px; }
.sbar .seg:last-child { border-radius: 0 4px 4px 0; }
.sbar .seg:only-child { border-radius: 4px; }
.seg-gueltig { background: var(--st-good); }
.seg-offen { background: var(--st-warn); }
.seg-ueberfaellig { background: var(--st-crit); }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 0.8125rem; color: var(--text-2); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend .sw { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.cbars { display: flex; flex-direction: column; gap: 14px; }
.cbar-row { display: grid; grid-template-columns: minmax(140px, 220px) minmax(0, 1fr) 90px; gap: 14px; align-items: center; }
.cbar-label { display: flex; flex-direction: column; min-width: 0; }
.cbar-label .hint { font-size: 0.75rem; }
.cbar-val { display: flex; flex-direction: column; align-items: flex-end; font-variant-numeric: tabular-nums; }
@media (max-width: 640px) { .cbar-row { grid-template-columns: minmax(0, 1fr) 70px; } .cbar-row .sbar { grid-column: 1 / -1; grid-row: 2; } }
.cp-tip { position: absolute; z-index: 150; padding: 6px 10px; border-radius: var(--r-sm); background: var(--text); color: var(--bg); font-size: 0.8125rem; pointer-events: none; box-shadow: var(--shadow); max-width: 280px; }
.link-btn { border: 0; background: none; padding: 0; color: var(--accent); font: inherit; font-weight: 600; cursor: pointer; text-align: left; }
.link-btn:hover { text-decoration: underline; }
.matrix th[scope="row"] { font-weight: 400; text-align: left; white-space: nowrap; }
.matrix td.mx { white-space: nowrap; }
.matrix td .sub, .matrix th .sub { margin-top: 2px; }
.cp-strip { display: flex; flex-direction: column; gap: 10px; padding: 18px 22px; color: var(--text); }
.cp-strip:hover { border-color: var(--accent); color: var(--text); }
.cp-strip-flow { font-size: 1rem; }
.t-ok { color: var(--ok); } .t-warn { color: var(--warn); } .t-err { color: var(--err); }
.pf-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.pf-line { display: flex; gap: 10px; align-items: flex-start; flex-wrap: wrap; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r-md); }
.pf-line .badge { flex-shrink: 0; }
.proof { display: flex; flex-direction: column; gap: 14px; }
.proof-h { font-size: 1.0625rem; margin-top: 6px; }
.proof-head { display: flex; justify-content: space-between; gap: 20px; align-items: flex-end; border-bottom: 2px solid #111; padding-bottom: 10px; }
.proof-foot { margin-top: 10px; }
.print-area { display: none; }
@media print {
  body.printing > *:not(.print-area) { display: none !important; }
  body.printing .print-area { display: block !important; color: #000; }
  body.printing .print-area .table th, body.printing .print-area .table td { padding: 6px 8px; font-size: 10pt; }
  body.printing .print-area .badge { border: 1px solid #000; background: none !important; color: #000 !important; }
  @page { size: A4; margin: 15mm; }
}
.notif-btn { position: relative; }
.notif-count { position: absolute; top: -4px; right: -4px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--st-crit); color: #fff; font-size: 0.6875rem; font-weight: 700; display: flex; align-items: center; justify-content: center; }
.notif-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.notif-list li { padding: 12px 4px; border-top: 1px solid var(--line); display: flex; gap: 10px; }
.notif-list li:first-child { border-top: 0; }
.notif-list li.unread strong::after { content: ' •'; color: var(--accent); }
.notif-list .body { white-space: pre-wrap; font-size: 0.875rem; color: var(--text-2); margin-top: 4px; }

/* ---------- 9. Zertifikat (A4) ---------- */
.cert-scroll { overflow-x: auto; }
.cert2 { --c-ink: #0A1628; --c-acc: #1662D6; background: #FFFFFF; color: #1A1A1A; width: 100%; max-width: 794px; margin: 0 auto; aspect-ratio: 210 / 297; padding: 22px; font-family: var(--font-body); position: relative; border: 1px solid #DCE2EA; }
.c2-frame { position: relative; height: 100%; border: 2px solid var(--c-ink); outline: 1px solid var(--c-acc); outline-offset: -8px; padding: 6% 7%; display: flex; flex-direction: column; gap: 1.1%; overflow: hidden; }
.c2-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; }
.c2-issuer { display: flex; gap: 12px; align-items: center; }
.c2-issuer strong { display: block; font-family: var(--font-display); font-size: 1.0625rem; color: var(--c-ink); }
.c2-issuer span { font-size: 0.75rem; color: #555; font-family: var(--font-mono); letter-spacing: .04em; }
.c2-mark { width: 30px; height: 30px; display: grid; grid-template-columns: 1fr 1fr; gap: 3px; }
.c2-mark i { background: var(--c-acc); border-radius: 2px; } .c2-mark i:last-child { background: var(--c-ink); }
.c2-idbox { text-align: right; font-size: 0.6875rem; color: #555; text-transform: uppercase; letter-spacing: .08em; }
.c2-idbox strong { display: block; font-size: 0.9375rem; color: var(--c-ink); letter-spacing: 0; text-transform: none; }
.c2-title { text-align: center; margin-top: 5%; }
.c2-eyebrow { font-family: var(--font-mono); font-size: 0.75rem; letter-spacing: .14em; text-transform: uppercase; color: var(--c-acc); }
.c2-title h2 { font-family: var(--font-display); font-size: clamp(2rem, 6vw, 3.25rem); color: var(--c-ink); letter-spacing: .02em; margin-top: 4px; }
.c2-lead { text-align: center; font-size: 0.9375rem; color: #333; }
.c2-name { text-align: center; font-family: var(--font-display); font-size: clamp(1.5rem, 4vw, 2.25rem); font-weight: 600; color: var(--c-ink); border-bottom: 1px solid #C9CED6; padding-bottom: 6px; margin: 2% 12% 0; }
.c2-sub { text-align: center; font-size: 0.75rem; color: #666; font-family: var(--font-mono); }
.c2-course { text-align: center; font-family: var(--font-display); font-size: clamp(1.125rem, 3vw, 1.625rem); font-weight: 600; color: var(--c-acc); }
.c2-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin: 4% 0 0; border-top: 1px solid #E3E3E3; border-bottom: 1px solid #E3E3E3; padding: 12px 0; }
.c2-grid dt { font-size: 0.6875rem; text-transform: uppercase; letter-spacing: .08em; color: #666; }
.c2-grid dd { margin: 2px 0 0; font-weight: 600; color: var(--c-ink); font-size: 0.9375rem; }
.c2-foot { margin-top: auto; display: grid; grid-template-columns: auto minmax(0, 1fr) minmax(0, 200px); gap: 18px; align-items: end; }
.c2-qr .qr { width: 112px; height: 112px; display: block; }
.c2-verify { display: flex; flex-direction: column; gap: 4px; font-size: 0.75rem; color: #444; }
.c2-verify strong { color: var(--c-ink); font-size: 0.8125rem; }
.c2-code strong { font-size: 0.9375rem; color: var(--c-ink); letter-spacing: .06em; }
.c2-url { font-size: 0.625rem; color: #777; word-break: break-all; }
.c2-sign { display: flex; flex-direction: column; gap: 6px; font-size: 0.75rem; color: #444; text-align: center; }
.c2-line { border-top: 1px solid #333; display: block; }
.c2-small { font-size: 0.625rem; color: #5F5F5F; text-align: center; margin-top: 10px; font-family: var(--font-mono); }
.c2-stamp { position: absolute; top: 42%; left: 50%; transform: translate(-50%, -50%) rotate(-18deg); font-family: var(--font-display); font-size: clamp(2.5rem, 9vw, 5rem); font-weight: 700; color: rgba(180, 35, 24, .22); border: 6px solid rgba(180, 35, 24, .22); padding: 0 24px; text-transform: uppercase; pointer-events: none; white-space: nowrap; }
@media (max-width: 640px) {
  .cert2 { aspect-ratio: auto; padding: 10px; }
  .c2-grid { grid-template-columns: repeat(2, 1fr); }
  .c2-foot { grid-template-columns: auto minmax(0, 1fr); }
  .c2-sign { grid-column: 1 / -1; }
}
@media print {
  body.printing .print-area .cert2 { border: 0; max-width: none; width: 180mm; height: 267mm; aspect-ratio: auto; padding: 0; margin: 0 auto; }
  .cert2 { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* Reflow: Auswahllisten mit langen Optionen nie breiter als der Container (WCAG 1.4.10) */
.select, select.input { max-width: 100%; min-width: 0; text-overflow: ellipsis; }
.field { min-width: 0; }

/* ---------- 10. Zertifikat nach Vorlage (Zonen) ---------- */
.c3 { --f: 1; }
.c3.c3-font-serif { font-family: Georgia, "Times New Roman", "DejaVu Serif", serif; }
.c3.c3-font-serif .c3-title, .c3.c3-font-serif .c3-name, .c3.c3-font-serif .c3-course { font-family: Georgia, "Times New Roman", "DejaVu Serif", serif; }
.c3-frame { gap: 0; }
.c3.c3-rahmen-keiner .c3-frame { border: 0; outline: 0; }
.c3.c3-rahmen-einfach .c3-frame { outline: 0; }
.c3-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1fr); gap: 14px; align-items: start; }
.c3-foot { margin-top: auto; align-items: end; }
.c3-z { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.c3-l { align-items: flex-start; text-align: left; }
.c3-c { align-items: center; text-align: center; }
.c3-r { align-items: flex-end; text-align: right; }
.c3-main { align-items: center; text-align: center; margin: 5% 0 3%; gap: 8px; }
.c3-e { max-width: 100%; }
.c3-sz-s { --f: .8; } .c3-sz-m { --f: 1; } .c3-sz-l { --f: 1.35; }
.c3-logo { max-height: calc(54px * var(--f)); max-width: 180px; object-fit: contain; display: block; }
.c3-logo + * { margin-top: 2px; }
.c3-issuer strong { display: block; font-family: var(--font-display); font-size: calc(1.0625rem * var(--f)); color: inherit; }
.c3-issuer span { font-size: .75rem; opacity: .75; font-family: var(--font-mono); letter-spacing: .04em; }
.c3-no { font-size: calc(.6875rem * var(--f)); text-transform: uppercase; letter-spacing: .08em; }
.c3-no span { opacity: .75; }
.c3-no strong { display: block; font-size: calc(.9375rem * var(--f)); letter-spacing: 0; text-transform: none; }
.c3-eyebrow { font-family: var(--font-mono); font-size: calc(.875rem * var(--f)); letter-spacing: .14em; text-transform: uppercase; }
.c3-title { font-family: var(--font-display); font-size: calc(2.4rem * var(--f)); letter-spacing: .02em; color: inherit; line-height: 1.1; }
.c3-lead { font-size: calc(.9375rem * var(--f)); }
.c3-name { font-family: var(--font-display); font-size: calc(1.65rem * var(--f)); font-weight: 600; border-bottom: 1px solid currentColor; padding: 0 1.5em 6px; }
.c3-sub { font-size: calc(.75rem * var(--f)); font-family: var(--font-mono); opacity: .8; }
.c3-kind { font-size: calc(.9375rem * var(--f)); color: var(--c-ink); }
.c3-course { font-family: var(--font-display); font-size: calc(1.25rem * var(--f)); font-weight: 600; }
.c3-facts { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px 28px; border-top: 1px solid rgba(0,0,0,.14); border-bottom: 1px solid rgba(0,0,0,.14); padding: 10px 0; margin-top: 2%; width: 100%; }
.c3-l .c3-facts { justify-content: flex-start; } .c3-r .c3-facts { justify-content: flex-end; }
.c3-fact { display: flex; flex-direction: column; gap: 2px; text-align: left; }
.c3-fl { font-size: calc(.6875rem * var(--f)); text-transform: uppercase; letter-spacing: .08em; opacity: .75; }
.c3-fact strong { font-size: calc(.9375rem * var(--f)); }
.c3-free { font-size: calc(.8125rem * var(--f)); max-width: 52ch; }
.c3-el-qr .qr { width: calc(112px * var(--f)); height: calc(112px * var(--f)); display: block; background: #fff; padding: 2px; }
.c3-verify { display: flex; flex-direction: column; gap: 3px; font-size: calc(.75rem * var(--f)); max-width: 30ch; }
.c3-verify strong { font-size: calc(.8125rem * var(--f)); }
.c3-code strong { font-size: calc(.9375rem * var(--f)); letter-spacing: .06em; }
.c3-url { font-size: .625rem; opacity: .8; word-break: break-all; }
.c3-sign { display: flex; flex-direction: column; gap: 6px; font-size: calc(.75rem * var(--f)); min-width: 160px; }
.c3-brand { display: flex; align-items: center; justify-content: center; gap: 8px; font-size: .625rem; margin-top: 6px; color: #3A4458; background: rgba(255,255,255,.85); padding: 3px 8px; border-radius: 4px; align-self: center; }
.c3-brand strong { color: #0A1628; }
.c3-brandmark { width: 14px; height: 14px; gap: 2px; }
.c3-brandmark i { background: #1662D6 !important; } .c3-brandmark i:last-child { background: #0A1628 !important; }
@media (max-width: 640px) { .c3-row { grid-template-columns: 1fr; } .c3-z { align-items: center; text-align: center; } }

/* Vorlagen-Editor */
.tpl-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); gap: 20px; align-items: start; }
.tpl-preview { position: sticky; top: 12px; }
.tpl-scale { position: relative; overflow: hidden; }
.tpl-scale .cert2 { width: 794px; max-width: none; transform-origin: top left; position: absolute; top: 0; left: 0; }
.tpl-el { padding: 10px 0; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 8px; }
.tpl-el:last-child { border-bottom: 0; }
.tpl-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.tpl-name { font-weight: 600; }
.tpl-ctl { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, .85fr) minmax(0, 1fr) minmax(0, 1.3fr); gap: 10px; }
.tpl-mini > span { overflow-wrap: anywhere; }
.tpl-mini { display: flex; flex-direction: column; gap: 3px; font-size: .75rem; color: var(--text-2); min-width: 0; }
.tpl-mini .select, .tpl-mini .input { width: 100%; }
.tpl-el input[type=color] { width: 44px; height: 38px; padding: 2px; border: 1px solid var(--control); border-radius: 6px; background: var(--surface); flex-shrink: 0; }
@media (max-width: 1100px) { .tpl-layout { grid-template-columns: 1fr; } .tpl-preview { position: static; } }
@media (max-width: 760px) { .tpl-ctl { grid-template-columns: 1fr 1fr; } }
