/* =========================================================
   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: none; width: 100%; min-width: 0; }
.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; overflow-y: hidden; scrollbar-width: none; -ms-overflow-style: none; }
.tabs::-webkit-scrollbar { display: none; }
.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); } }
/* Lektionsliste: eingeklappt nur schmale Leiste, Platz erst beim Aufklappen */
.player-layout:not(.side-open) { grid-template-columns: minmax(0, 1fr) 190px; }
.player-layout.side-open { grid-template-columns: minmax(0, 1fr) 360px; }
@media (max-width: 1100px) { .player-layout, .player-layout:not(.side-open), .player-layout.side-open { grid-template-columns: minmax(0, 1fr); } }
.side-lessons { overflow: hidden; }
/* Fortschritt als dünne eingefärbte Linie (immer sichtbar, auch eingeklappt) */
.side-prog { height: 4px; background: var(--surface-2); }
.side-prog > span { display: block; height: 100%; background: var(--accent); transition: width .2s; }
@media (prefers-reduced-motion: reduce) { .side-prog > span { transition: none; } }
@media (forced-colors: active) { .side-prog { border-block: 1px solid CanvasText; } .side-prog > span { background: Highlight; forced-color-adjust: none; } }
.side-toggle { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 48px; padding: 10px 16px; border: 0; background: var(--surface); color: var(--text); font: inherit; cursor: pointer; text-align: left; }
.side-toggle:hover { background: var(--surface-2); }
.side-toggle:focus-visible { outline: 3px solid var(--accent); outline-offset: -3px; }
.side-ttl { flex: 1; font-family: var(--font-display); font-weight: 600; font-size: 1.0625rem; }
.side-count { font-size: 0.75rem; color: var(--text-2); }
.side-chev { width: 9px; height: 9px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg); margin-top: -4px; transition: transform .15s; }
.side-open .side-chev { transform: rotate(-135deg); margin-top: 4px; }
.side-body { display: none; border-top: 1px solid var(--line); }
.side-open .side-body { display: block; }
.side-open .lessons .lesson:last-child { border-bottom: 0; }
@media (prefers-reduced-motion: reduce) { .side-chev { transition: none; } }
.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; }

/* Erhöhter Kontrast AAA (WCAG 1.4.6): Text ≥ 7:1, großer Text ≥ 4,5:1 – Farben bleiben erhalten */
html.a11y-aaa {
  --text: #0A1220; --text-2: #3A4859; --control: #5B6A80;
  --accent: #0A47A8; --accent-hover: #072F73; --accent-ink: #FFFFFF; --accent-soft-ink: #0A3A85;
  --nav-text: #E3ECF6; --nav-muted: #B4C3D6; --nav-active: #1A2E4A; --nav-accent: #9CC9FF;
  --ok: #0A5233; --warn: #6B3A00; --err: #8F1A10;
}
html.a11y-aaa[data-theme="dark"] {
  --text: #F2F6FB; --text-2: #C5D2E2; --control: #8FA6C4;
  --accent: #8DBBFF; --accent-hover: #B0D0FF; --accent-ink: #06101F; --accent-soft-ink: #C7DEFF;
  --nav-text: #E3ECF6; --nav-muted: #B4C3D6; --nav-accent: #9CC9FF;
  --ok: #8CE8B8; --warn: #FFD27A; --err: #FFB0A3;
}
@media (prefers-color-scheme: dark) {
  html.a11y-aaa:not([data-theme="light"]) {
    --text: #F2F6FB; --text-2: #C5D2E2; --control: #8FA6C4;
    --accent: #8DBBFF; --accent-hover: #B0D0FF; --accent-ink: #06101F; --accent-soft-ink: #C7DEFF;
    --nav-text: #E3ECF6; --nav-muted: #B4C3D6; --nav-accent: #9CC9FF;
    --ok: #8CE8B8; --warn: #FFD27A; --err: #FFB0A3;
  }
}
html.a11y-aaa .muted, html.a11y-aaa .hint { color: var(--text-2); }

/* Links hervorgehoben (WCAG 1.4.1): nicht allein durch Farbe – Unterstreichung, Gewicht und Streifen; Hover/Fokus deutlich stärker */
html.a11y-linkmark a:not(.btn):not(.nav-link):not(.brand):not(.card):not(.lesson):not(.skip-link):not(.icon-btn) {
  text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 3px; text-decoration-skip-ink: none;
  font-weight: 600; padding: 0 .22em; margin: 0 -.05em; border-radius: 5px;
  background: linear-gradient(to top, color-mix(in srgb, var(--accent) 22%, transparent) 0, color-mix(in srgb, var(--accent) 22%, transparent) 55%, transparent 55%);
  box-decoration-break: clone; -webkit-box-decoration-break: clone;
  transition: background-color .15s, color .15s, box-shadow .15s;
}
html.a11y-linkmark a:not(.btn):not(.nav-link):not(.brand):not(.card):not(.lesson):not(.skip-link):not(.icon-btn):hover {
  background: var(--accent); color: var(--accent-ink); text-decoration-thickness: 3px; box-shadow: 0 0 0 2px var(--accent);
}
html.a11y-linkmark a:not(.btn):not(.nav-link):not(.brand):not(.card):not(.lesson):not(.skip-link):not(.icon-btn):focus-visible {
  background: var(--accent); color: var(--accent-ink); text-decoration-thickness: 3px;
  outline: 3px solid var(--text); outline-offset: 2px; box-shadow: 0 0 0 5px var(--accent-soft);
}
.mod-body[hidden] { display: none; }

/* 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; } }

/* Schieberegler (Schalter) */
.switch { position: relative; display: inline-flex; align-items: center; cursor: pointer; }
.switch input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.switch-track { width: 52px; height: 28px; border-radius: 999px; background: var(--line-strong, #8a93a0); transition: background .15s; display: inline-flex; align-items: center; padding: 3px; box-sizing: border-box; }
.switch-knob { width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.35); transition: transform .15s; }
.switch input:checked + .switch-track { background: var(--ok, #1d7a46); }
.switch input:checked + .switch-track .switch-knob { transform: translateX(24px); }
.switch input:focus-visible + .switch-track { outline: 3px solid var(--focus, #1a56db); outline-offset: 2px; }
.switch input:disabled + .switch-track { opacity: .55; }
@media (prefers-reduced-motion: reduce) { .switch-track, .switch-knob { transition: none; } }

/* ---------- Termine, Veranstaltungen, Schulungsfeedback ---------- */
.scale-set { border: 0; padding: 0; margin: 0 0 16px; min-width: 0; }
.scale-set legend { font-weight: 600; padding: 0; margin-bottom: 8px; }
.scale { display: flex; gap: 8px; }
.scale-opt { flex: 1 1 0; position: relative; display: block; }
.scale-opt input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.scale-opt span { display: flex; align-items: center; justify-content: center; min-height: 48px; min-width: 48px; border: 2px solid var(--control); border-radius: var(--r-md); background: var(--surface); font-weight: 600; font-size: 1.0625rem; }
.scale-opt input:checked + span { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.scale-opt input:focus-visible + span { outline: 3px solid var(--accent); outline-offset: 2px; }
.scale-ends { display: flex; justify-content: space-between; font-size: 0.78125rem; color: var(--text-2); margin-top: 4px; }
.ev-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr)); gap: 14px; }
.ev-card { padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.ev-card.ev-hl { outline: 3px solid var(--accent); outline-offset: 2px; }
.ev-meta { display: flex; flex-wrap: wrap; gap: 4px 14px; color: var(--text-2); font-size: 0.875rem; }
.bars { display: grid; gap: 4px; }
.bar-row { display: grid; grid-template-columns: 1.5rem 1fr 7.5rem; gap: 8px; align-items: center; font-size: 0.84375rem; }
.bar-t { height: 10px; background: var(--surface-2); border-radius: 5px; overflow: hidden; display: block; }
.bar-f { display: block; height: 100%; background: var(--accent); border-radius: 0 4px 4px 0; }
.bar-l { font-weight: 600; text-align: right; }
.bar-v { color: var(--text-2); font-variant-numeric: tabular-nums; }
.list-plain { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.q-row { align-items: center; gap: 8px; }
@media (max-width: 520px) { .scale { gap: 6px; } .bar-row { grid-template-columns: 1.25rem 1fr 6rem; } }
.ev-meta { margin: 0; }
.ev-meta > div { display: flex; gap: 6px; }
.ev-meta dt { font-weight: 600; }
.ev-meta dt::after { content: ':'; }
.ev-meta dd { margin: 0; }
.list-plain > li.list-item { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 12px 16px; border-top: 1px solid var(--line); }
.list-plain > li.list-item:first-child { border-top: 0; }
@media (max-width: 520px) { .list-plain > li.list-item > div:first-child { flex: 1 1 100% !important; } }

/* ---------- Videoplayer mit eigener Steuerung ---------- */
.player[data-vp] { background: #000; border-radius: var(--r-md); overflow: hidden; display: flex; flex-direction: column; aspect-ratio: auto; }
.player[data-vp] .vp-stage video { height: auto; }
.player[data-vp] .vp-stage { position: relative; background: #000; }
.player[data-vp] .vp-stage video { display: block; width: 100%; max-height: 70vh; background: #000; cursor: pointer; }
.player[data-vp] .vp-stage:focus-visible { outline: 3px solid var(--accent); outline-offset: -3px; }
.vp-bar { display: flex; align-items: center; gap: 6px; padding: 8px 10px; background: #0A1628; color: #fff; flex-wrap: wrap; }
.vp-btn { appearance: none; border: 0; background: transparent; color: #fff; width: 44px; height: 44px; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; flex: none; }
.vp-btn svg { width: 24px; height: 24px; }
.vp-btn:hover { background: rgba(255,255,255,.14); }
.vp-btn:focus-visible, .vp-seek:focus-visible, .vp-vol:focus-visible, .vp-speed:focus-visible { outline: 3px solid #6FB1FF; outline-offset: 1px; }
.vp-btn[disabled] { opacity: .45; cursor: not-allowed; }
.vp-cc.on { background: #fff; color: #0A1628; }
.vp-time { font-size: 0.8125rem; min-width: 5.6em; white-space: nowrap; color: #DCE6F2; }
.vp-seek, .vp-vol { -webkit-appearance: none; appearance: none; background: transparent; height: 44px; cursor: pointer; margin: 0; }
.vp-seek { flex: 1 1 100px; min-width: 90px; --vp-pos: 0%; --vp-buf: 0%; }
.vp-vol { width: 64px; flex: none; }
.vp-seek::-webkit-slider-runnable-track { height: 8px; border-radius: 4px; background: linear-gradient(to right, #6FB1FF 0 var(--vp-pos), #5B7192 var(--vp-pos) var(--vp-buf), #2A3C57 var(--vp-buf) 100%); }
.vp-seek::-moz-range-track { height: 8px; border-radius: 4px; background: linear-gradient(to right, #6FB1FF 0 var(--vp-pos), #5B7192 var(--vp-pos) var(--vp-buf), #2A3C57 var(--vp-buf) 100%); }
.vp-vol::-webkit-slider-runnable-track { height: 6px; border-radius: 3px; background: #5B7192; }
.vp-vol::-moz-range-track { height: 6px; border-radius: 3px; background: #5B7192; }
.vp-seek::-webkit-slider-thumb, .vp-vol::-webkit-slider-thumb { -webkit-appearance: none; width: 20px; height: 20px; border-radius: 50%; background: #fff; border: 2px solid #0A1628; margin-top: -6px; }
.vp-vol::-webkit-slider-thumb { margin-top: -7px; }
.vp-seek::-moz-range-thumb, .vp-vol::-moz-range-thumb { width: 16px; height: 16px; border-radius: 50%; background: #fff; border: 2px solid #0A1628; }
.vp-speed-l { flex: none; }
.vp-speed { background: #1A2E4A; color: #fff; border: 1px solid #5B7192; border-radius: 8px; min-height: 36px; padding: 0 6px; font-size: 0.8125rem; }
.player[data-vp].vp-fs { height: 100%; border-radius: 0; }
.player[data-vp].vp-fs .vp-stage { flex: 1; display: flex; }
.player[data-vp].vp-fs .vp-stage video { max-height: none; height: 100%; object-fit: contain; }
.player[data-vp].vp-err .vp-bar { display: none; }
video::cue { font-size: 1.15em; background: rgba(0,0,0,.78); color: #fff; }
.player[data-vp] .transcript { background: var(--surface); }
.player[data-vp] .transcript summary { padding: 10px 14px; }
.tr-cues { list-style: none; margin: 0; padding: 0 8px 10px; max-height: 260px; overflow: auto; }
.tr-cue { appearance: none; border: 0; background: transparent; text-align: left; width: 100%; padding: 6px 8px; border-radius: 6px; cursor: pointer; font: inherit; color: var(--text); }
.tr-cue:hover { background: var(--surface-2); }
.tr-t { color: var(--accent); margin-right: 6px; }
.tr-cues li.on .tr-cue { background: var(--accent-soft); color: var(--accent-soft-ink); font-weight: 600; }
@media (max-width: 520px) { .vp-vol { display: none; } .vp-time { order: 2; } .vp-seek { order: 3; flex-basis: 100%; } }
@media (prefers-reduced-motion: no-preference) { .vp-btn { transition: background .12s; } }

/* Untertitel-Editor */
.sub-vid { width: 100%; max-height: 220px; background: #000; border-radius: 8px; }
.sub-table td { vertical-align: top; }
.sub-table .sub-t { width: 8.5rem; display: inline-block; }
.sub-table tr.sub-now td { background: var(--accent-soft); }
.sub-acts { white-space: nowrap; }
.sub-table textarea { min-width: 14rem; }
@media (max-width: 720px) { .sub-table thead { display: none; } .sub-table tr { display: grid; gap: 6px; padding: 10px 0; border-top: 1px solid var(--line); } .sub-table td { padding: 0; } .sub-table .sub-t { width: 7.5rem; } }

/* Fremdinhalte und Lernpakete */
.embed { border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); overflow: hidden; }
.embed-ph { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; padding: 18px; }
.embed-ico { width: 48px; height: 48px; border-radius: 12px; background: var(--accent-soft); color: var(--accent-soft-ink); display: grid; place-items: center; flex: none; }
.embed-ico svg { width: 26px; height: 26px; }
.embed-txt { flex: 1 1 240px; display: grid; gap: 4px; font-size: 0.9375rem; }
.embed-txt span { color: var(--text-2); font-size: 0.875rem; }
.embed-act { display: flex; flex-wrap: wrap; gap: 8px; }
.embed-empty { padding: 16px; display: grid; gap: 6px; color: var(--text-2); }
.embed-on iframe { display: block; width: 100%; border: 0; background: #fff; }
.embed-on.embed-video iframe { aspect-ratio: 16 / 9; height: auto; }
.embed-note { font-size: 0.8125rem; color: var(--text-2); padding: 8px 14px; border-top: 1px solid var(--line); }
.pkg { border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); overflow: hidden; }
.pkg-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; padding: 10px 14px; border-bottom: 1px solid var(--line); background: var(--surface-2); }
.pkg-ico svg { width: 22px; height: 22px; color: var(--accent); }
.pkg-type { font-size: 0.75rem; color: var(--text-2); border: 1px solid var(--line); border-radius: 999px; padding: 2px 8px; background: var(--surface); }
.pkg-status { font-size: 0.8125rem; color: var(--ok); }
.pkg-frame { display: block; width: 100%; border: 0; background: #fff; }
.pkg-body { overflow: hidden; border-radius: 0 0 var(--r-md) var(--r-md); }
.pkg-frame { border-radius: inherit; }
.pkg-prog { height: 6px; background: var(--line); }
.pkg-prog[hidden] { display: none; }
.pkg-prog i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .4s; }
.pkg-hint { padding: 8px 14px; margin: 0; }
.pkg-fs { width: 100%; height: 100%; }

/* Audio (Podcast) im eigenen Player: gleiche Bedienung wie beim Video, aber flache Bühne mit Symbol statt schwarzem Bild */
.player-audio[data-vp] .vp-stage { background: linear-gradient(135deg, var(--accent, #1d4ed8), #0b1630); min-height: 96px; display: flex; align-items: center; justify-content: center; }
.player-audio[data-vp] .vp-stage video { height: 96px; max-height: 96px; opacity: 0; position: absolute; inset: 0; }
.player-audio[data-vp] .vp-stage::before { content: "♪  Audio"; color: #fff; font-weight: 600; letter-spacing: .04em; font-size: 1.05rem; }
.player-audio[data-vp] .vp-full { display: none; }
.brand-logo { max-height: 32px; max-width: 120px; width: auto; height: auto; flex-shrink: 0; object-fit: contain; background: #fff; border-radius: 4px; padding: 2px; }

/* ---------- Zertifikat aus eigener Datei (Design als Hintergrund) ---------- */
.cf { position: relative; width: 100%; margin: 0 auto; background: #fff; container-type: inline-size; overflow: hidden; border: 1px solid #DCE2EA; font-family: Helvetica, Arial, "Liberation Sans", sans-serif; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.cf-quer { max-width: 1123px; aspect-ratio: 297 / 210; }
.cf-hoch { max-width: 794px; aspect-ratio: 210 / 297; }
.cf-bg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; object-fit: fill; }
.cf-f { position: absolute; margin: 0; line-height: 1.2; overflow-wrap: anywhere; }
.cf-f > span { display: block; }
.cf-qr { aspect-ratio: 1 / 1; background: #fff; }
.cf-qr svg, .cf-qr .qr { width: 100%; height: 100%; display: block; }
@media print {
  body.printing .print-area .cf { border: 0; max-width: none; margin: 0; aspect-ratio: auto; }
  body.printing .print-area .cf-quer { width: 297mm; height: 209.5mm; }
  body.printing .print-area .cf-hoch { width: 210mm; height: 296.5mm; }
}

/* ---------- Vorlage „Eigene Datei“: Editor ---------- */
.tpl-mode { border: 1px solid var(--line); margin: 0 0 16px; min-width: 0; }
.tpl-mode legend { padding: 0 6px; }
.tpl-mode-opts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.tpl-mode-opt { display: flex; gap: 10px; align-items: flex-start; padding: 12px; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; min-height: 44px; }
.tpl-mode-opt:has(input:checked) { border-color: var(--accent); background: var(--accent-soft, rgba(22,98,214,.07)); }
.tpl-mode-opt input { margin-top: 4px; width: 20px; height: 20px; flex-shrink: 0; }
.tpl-mode-opt > span { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.fe-layout { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(300px, 1fr); gap: 20px; align-items: start; margin-top: 16px; }
.fe-stagebox { min-width: 0; position: sticky; top: 8px; }
.fe-edit .cf { box-shadow: 0 1px 8px rgba(0,0,0,.15); }
.fe-edit .cf-f { cursor: grab; touch-action: none; outline: 1px dashed rgba(22,98,214,.75); outline-offset: 1px; user-select: none; -webkit-user-select: none; }
.fe-edit .cf-f:active { cursor: grabbing; }
.fe-edit .cf-f.fe-sel { outline: 2px solid #1662d6; background: rgba(22,98,214,.14); }
.fe-edit .cf-f:focus-visible { outline: 3px solid #ff8a00; }
.fe-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.fe-chip { min-height: 36px; padding: 4px 10px; border: 1px solid var(--control, #8a94a6); border-radius: 18px; background: var(--surface); color: var(--text); font: inherit; font-size: .8125rem; cursor: pointer; }
.fe-chip.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.fe-chip.on .hint { color: inherit; }
.fe-chip.off:not(.on) { opacity: .7; border-style: dashed; }
.fe-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.tpl-actions { flex-wrap: wrap; }
@media (max-width: 1100px) { .fe-layout { grid-template-columns: minmax(0, 1fr); } .fe-stagebox { position: static; } }
@media (max-width: 640px) { .tpl-mode-opts { grid-template-columns: minmax(0, 1fr); } }

/* ---------- Mobil- und Tablet-Feinschliff (Version 2026.10.19) ---------- */
/* Tabellen: Hinweis auf seitliches Wischen durch Randschatten, flüssiges Wischen auf Touch-Geräten */
.table-wrap { -webkit-overflow-scrolling: touch; overscroll-behavior-x: contain;
  background: linear-gradient(to right, var(--surface) 30%, rgba(255,255,255,0)) left center / 28px 100% no-repeat local,
              linear-gradient(to left, var(--surface) 30%, rgba(255,255,255,0)) right center / 28px 100% no-repeat local,
              radial-gradient(farthest-side at 0 50%, rgba(0,0,0,.22), rgba(0,0,0,0)) left center / 10px 100% no-repeat scroll,
              radial-gradient(farthest-side at 100% 50%, rgba(0,0,0,.22), rgba(0,0,0,0)) right center / 10px 100% no-repeat scroll; }
/* Sicherer Bereich (Notch, Querformat am Handy) */
.topbar, .content { padding-left: max(var(--gutter), env(safe-area-inset-left)); padding-right: max(var(--gutter), env(safe-area-inset-right)); }
/* Touch-Geräte: Bedienflächen mindestens 44 px */
@media (pointer: coarse) {
  .btn { min-height: 44px; } .btn-sm { min-height: 40px; }
  .icon-btn { width: 44px; height: 44px; }
  .input, .select, .textarea { min-height: 44px; }
  .fe-chip { min-height: 40px; }
  .check { min-height: 32px; }
}
@media (max-width: 600px) {
  /* 16 px in Eingabefeldern verhindert das automatische Hineinzoomen auf iPhones */
  .input, .select, .textarea, input[type=text], input[type=number], input[type=search], input[type=email], input[type=password], input[type=date], input[type=datetime-local] { font-size: 1rem; }
  .table th, .table td { padding-left: 10px; padding-right: 10px; }
  .content { gap: 18px; padding-top: 18px; }
  .modal, .dialog { max-width: 100vw; }
  .tpl-ctl, .fe-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
}
/* Tablets: Karten und Raster nutzen die Breite, Editor einspaltig */
@media (min-width: 601px) and (max-width: 1100px) { .content { gap: 20px; } .fe-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }

/* Video zuschneiden */
.rc-trim { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; margin: 0; min-width: 0; display: flex; flex-direction: column; gap: 10px; }
.rc-trim legend { font-weight: 600; padding: 0 6px; }
.rc-trim-times { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.rc-trim-times .input { width: 8.5rem; }
.rc-trim-len { flex: 1 1 12rem; }
.rc-trim-sliders { display: flex; flex-direction: column; gap: 4px; }
.rc-trim-sliders input[type=range] { width: 100%; min-height: 28px; accent-color: var(--accent); }

/* Rollen: Spaltenüberschrift als Link */
.btn-link{background:none;border:0;padding:0;color:inherit;font:inherit;font-weight:600;text-decoration:underline;cursor:pointer}
.btn-link:focus-visible{outline:2px solid var(--focus,currentColor);outline-offset:2px}

/* Sprachumschalter */
.icon-btn.lang-btn{width:auto;min-width:40px;gap:4px;padding:0 10px;display:inline-flex;align-items:center;justify-content:center}
.lang-btn .lang-code{font:600 .75rem/1 var(--font-mono,monospace);letter-spacing:.04em}

/* Offene Passwort-Anfragen: rote Zahl wie bei den Benachrichtigungen */
.notif-count.static { position: static; flex-shrink: 0; }
.nav-count { margin-left: auto; }
.pw-req-box { display: flex; gap: 12px; align-items: flex-start; border-left: 4px solid var(--st-crit); }
.pw-req-box .notif-count { margin-top: 2px; }
.badge.pw-req { font-weight: 700; }

/* Kurstabelle: volle Breite, feste Höhe – seitlicher Scroller immer sichtbar, Kopfzeile bleibt stehen */
.tbl-fixed { max-height: calc(100vh - 250px); min-height: 240px; overflow: auto; width: 100%; }
.tbl-fixed table.table { min-width: 960px; }
.tbl-fixed thead th { position: sticky; top: 0; background: var(--surface); z-index: 2; }
.main { min-width: 0; }
.card:has(> .tbl-fixed) { overflow: hidden; }
.kthumb { float: left; width: 96px; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 6px; margin: 0 12px 0 0; background: var(--surface-2); }
.kt-text { overflow: hidden; min-width: 200px; }
.course-thumb.has-img { background-size: cover; background-position: center; align-items: flex-end; }
.course-thumb.has-img .mono { background: rgba(0,0,0,.6); color: #fff; padding: 2px 8px; border-radius: 4px; }

/* =========================================================
   Darstellungen (Optik) – nur Farben, Schrift, Rundungen, Seitenleiste.
   Auswahl pro Benutzer (Symbol „Darstellung“ oben rechts). Gesetzt über <html data-look="…">.
   Mandanten-Akzentfarbe (html.branded) und Hell/Dunkel (html.look-light) haben Vorrang bzw. werden beachtet.
   ========================================================= */
/* Auswahl-Dialog */
.look-grid { border: 0; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 700px) { .look-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.look-card { position: relative; display: flex; flex-direction: column; gap: 4px; padding: 10px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); cursor: pointer; }
.look-card input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.look-card:has(input:checked) { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); }
.look-card:has(input:focus-visible) { outline: 3px solid var(--accent); outline-offset: 2px; }
.look-prev { display: grid; grid-template-columns: 28% 1fr; height: 62px; border-radius: 6px; overflow: hidden; border: 1px solid var(--line); }
.look-prev i { display: block; position: relative; }
.look-prev b { position: absolute; left: 14%; top: 30%; width: 44%; height: 14px; border-radius: 4px; }
.look-name { font-weight: 600; font-size: 0.9375rem; }
.look-sub { font-size: 0.8125rem; color: var(--text-2); }

/* Gemeinsam: Akzent und Schrift */
:root[data-look="klar"]:not(.branded) { --accent: #1F4FD8; --accent-hover: #1639A0; --accent-soft: #E8EEFC; --accent-soft-ink: #1639A0; }
:root[data-look="dunkel"]:not(.branded) { --accent: #0B7A75; --accent-hover: #075652; --accent-soft: #DDF1EF; --accent-soft-ink: #075652; }
:root[data-look="warm"]:not(.branded) { --accent: #1F5C3F; --accent-hover: #133B28; --accent-soft: #E6F0E9; --accent-soft-ink: #133B28; }
:root[data-look="kachel"]:not(.branded) { --accent: #3B3FD9; --accent-hover: #2A2DA8; --accent-soft: #E9EAFC; --accent-soft-ink: #2A2DA8; }
:root[data-look="kompakt"]:not(.branded) { --accent: #B4540A; --accent-hover: #8A3F05; --accent-soft: #FDEBDA; --accent-soft-ink: #8A3F05; }
:root[data-look="klar"] { --font-display: 'Manrope', 'Segoe UI', system-ui, sans-serif; --font-body: 'Manrope', 'Segoe UI', system-ui, sans-serif; --r-sm: 8px; --r-md: 12px; --r-lg: 16px; }
:root[data-look="dunkel"] { --font-display: 'DM Serif Display', Georgia, serif; --font-body: 'DM Sans', 'Segoe UI', system-ui, sans-serif; --r-sm: 6px; --r-md: 10px; --r-lg: 14px; }
:root[data-look="warm"] { --font-display: 'Fraunces', Georgia, serif; --font-body: 'Source Sans 3', 'Segoe UI', system-ui, sans-serif; --r-sm: 6px; --r-md: 8px; --r-lg: 12px; }
:root[data-look="kachel"] { --font-display: 'Plus Jakarta Sans', 'Segoe UI', system-ui, sans-serif; --font-body: 'Plus Jakarta Sans', 'Segoe UI', system-ui, sans-serif; --r-sm: 10px; --r-md: 14px; --r-lg: 20px; }
:root[data-look="kompakt"] { --r-sm: 4px; --r-md: 6px; --r-lg: 8px; }
:root[data-look="dunkel"] h1, :root[data-look="warm"] h1 { font-weight: 500; }
:root[data-look="dunkel"] h1 { font-weight: 400; }

/* Hintergründe nur im hellen Farbschema (Dunkelmodus bleibt unverändert) */
html.look-light[data-look="klar"] { --bg: #F5F7FB; --line: #E3E8F0; }
html.look-light[data-look="dunkel"] { --bg: #FAFAF8; --line: #E3E7EA; }
html.look-light[data-look="warm"] { --bg: #F7F4EE; --surface-2: #F1EDE4; --line: #E4DED2; }
html.look-light[data-look="kachel"] { --bg: #EEF0F7; --surface-2: #EEF0F7; --line: #E1E4F0; }
html.look-light[data-look="kompakt"] { --bg: #FFFFFF; --surface-2: #F3F5F9; --line: #DFE3EB; }

/* Dunkle Seitenleisten in neuem Ton */
:root[data-look="dunkel"] { --nav-bg: #0F1D2A; --nav-line: #1C3144; --nav-active: #1D3447; --nav-accent: #2EB8AE; --nav-text: #B4C3D0; --nav-muted: #8FA3B5; }
:root[data-look="kompakt"] { --nav-bg: #1B2230; --nav-line: #2C3547; --nav-active: #2C3547; --nav-accent: #F2A65A; --nav-text: #D6DCE8; --nav-muted: #AEB7C8; }

/* Helle Seitenleisten (klar, warm, kachel): Farben nur an der Seitenleiste umstellen */
html.look-light[data-look="klar"] .sidebar, html.look-light[data-look="warm"] .sidebar, html.look-light[data-look="kachel"] .sidebar {
  --nav-bg: #FFFFFF; --nav-line: var(--line); --nav-text: #34425C; --nav-muted: #5B6B86; --nav-accent: var(--accent); --nav-active: var(--accent-soft);
  border-right: 1px solid var(--line);
}
html.look-light[data-look="warm"] .sidebar { --nav-text: #3C4239; --nav-muted: #6B6A60; }
html.look-light[data-look="klar"] .sidebar .brand, html.look-light[data-look="warm"] .sidebar .brand, html.look-light[data-look="kachel"] .sidebar .brand,
html.look-light[data-look="klar"] .sidebar .brand:hover, html.look-light[data-look="warm"] .sidebar .brand:hover, html.look-light[data-look="kachel"] .sidebar .brand:hover { color: var(--text); }
html.look-light[data-look="klar"] .sidebar .nav-link:hover, html.look-light[data-look="warm"] .sidebar .nav-link:hover, html.look-light[data-look="kachel"] .sidebar .nav-link:hover,
html.look-light[data-look="klar"] .sidebar .nav-link[aria-current="page"], html.look-light[data-look="warm"] .sidebar .nav-link[aria-current="page"], html.look-light[data-look="kachel"] .sidebar .nav-link[aria-current="page"] { color: var(--accent-soft-ink); }
html.look-light[data-look="klar"] .sidebar .sidebar-foot strong, html.look-light[data-look="warm"] .sidebar .sidebar-foot strong, html.look-light[data-look="kachel"] .sidebar .sidebar-foot strong,
html.look-light[data-look="klar"] .sidebar .foot-select, html.look-light[data-look="warm"] .sidebar .foot-select, html.look-light[data-look="kachel"] .sidebar .foot-select,
html.look-light[data-look="klar"] .sidebar .foot-btn:hover, html.look-light[data-look="warm"] .sidebar .foot-btn:hover, html.look-light[data-look="kachel"] .sidebar .foot-btn:hover { color: var(--text); }
html.look-light[data-look="klar"] .sidebar .foot-select, html.look-light[data-look="warm"] .sidebar .foot-select, html.look-light[data-look="kachel"] .sidebar .foot-select { background: var(--surface-2); }
html.look-light[data-look="klar"] .sidebar .brand-mark span:last-child, html.look-light[data-look="warm"] .sidebar .brand-mark span:last-child, html.look-light[data-look="kachel"] .sidebar .brand-mark span:last-child { background: var(--line); }
html.look-light[data-look="klar"] .sidebar .brand-mark span:first-child, html.look-light[data-look="warm"] .sidebar .brand-mark span:first-child, html.look-light[data-look="kachel"] .sidebar .brand-mark span:first-child { background: var(--accent); }

/* Kachel: weichere Karten und Tabellen */
:root[data-look="kachel"] .card { border-radius: var(--r-lg); }
:root[data-look="kachel"] .btn { border-radius: 999px; }
/* Kompakt: dichtere Tabellen */
:root[data-look="kompakt"] .table td { padding: 8px 12px; }
:root[data-look="kompakt"] .table th { padding: 8px 12px; }
:root[data-look="warm"] .table th, :root[data-look="dunkel"] .table th { font-family: var(--font-body); letter-spacing: .03em; }
/* Hoher Kontrast der Barrierefreiheit hat immer Vorrang */
html.a11y-contrast[data-look] .sidebar { --nav-bg: #000000; --nav-line: #FFFFFF; --nav-text: #FFFFFF; --nav-muted: #E0E0E0; --nav-active: #1A1A1A; --nav-accent: #FFD400; border-right: 0; }
html.a11y-contrast[data-look] .sidebar .brand, html.a11y-contrast[data-look] .sidebar .nav-link:hover, html.a11y-contrast[data-look] .sidebar .nav-link[aria-current="page"], html.a11y-contrast[data-look] .sidebar .foot-select { color: #FFFFFF; }
/* Dunkelmodus je Darstellung: eigene, passend abgestimmte Töne (Hell/Dunkel bleibt getrennt wählbar) */
html.look-dark[data-look="klar"] { --bg: #0D1424; --surface: #141D31; --surface-2: #1A2540; --line: #263451; --control: #6578A0; --text: #E8EDF8; --text-2: #A3B1CC; --accent-ink: #0A1230; --nav-bg: #0A101E; --nav-line: #1C2842; --nav-active: #17233F; --nav-accent: #8EA7FF; --nav-text: #A3B1CC; --nav-muted: #6578A0; }
html.look-dark[data-look="klar"]:not(.branded) { --accent: #6B8CFF; --accent-hover: #8EA7FF; --accent-soft: #1B2A55; --accent-soft-ink: #B5C5FF; }
html.look-dark[data-look="dunkel"] { --bg: #0B1419; --surface: #111E26; --surface-2: #172A35; --line: #223845; --control: #5F8190; --text: #E6EFF2; --text-2: #9DB5BF; --accent-ink: #04201E; --nav-bg: #08121A; --nav-line: #17303D; --nav-active: #14303B; --nav-accent: #3CC9BD; --nav-text: #9DB5BF; --nav-muted: #5F8190; }
html.look-dark[data-look="dunkel"]:not(.branded) { --accent: #3CC9BD; --accent-hover: #6AD8CE; --accent-soft: #11353A; --accent-soft-ink: #9EE8E1; }
html.look-dark[data-look="warm"] { --bg: #14120F; --surface: #1D1A16; --surface-2: #26221C; --line: #38332A; --control: #857C6B; --text: #EFEBE2; --text-2: #B5AD9D; --accent-ink: #07200F; --nav-bg: #100E0B; --nav-line: #2C2820; --nav-active: #26221C; --nav-accent: #6FCB96; --nav-text: #B5AD9D; --nav-muted: #857C6B; }
html.look-dark[data-look="warm"]:not(.branded) { --accent: #6FCB96; --accent-hover: #92DAB0; --accent-soft: #1C3A29; --accent-soft-ink: #B2E8C8; }
html.look-dark[data-look="kachel"] { --bg: #0E0F22; --surface: #16182F; --surface-2: #1E2142; --line: #2B2F57; --control: #7378B0; --text: #ECEDFA; --text-2: #A9ACD2; --accent-ink: #0B0C30; --nav-bg: #0A0B1B; --nav-line: #202346; --nav-active: #1E2142; --nav-accent: #AEB1FF; --nav-text: #A9ACD2; --nav-muted: #7378B0; }
html.look-dark[data-look="kachel"]:not(.branded) { --accent: #8E92FF; --accent-hover: #AEB1FF; --accent-soft: #25285A; --accent-soft-ink: #C6C8FF; }
html.look-dark[data-look="kompakt"] { --bg: #11141B; --surface: #181C25; --surface-2: #212631; --line: #303644; --control: #7C8598; --text: #ECEFF4; --text-2: #A9B1C0; --accent-ink: #2A1500; --nav-bg: #0C0F15; --nav-line: #262B38; --nav-active: #262B38; --nav-accent: #F2A65A; --nav-text: #A9B1C0; --nav-muted: #7C8598; }
html.look-dark[data-look="kompakt"]:not(.branded) { --accent: #F2A65A; --accent-hover: #F7BE85; --accent-soft: #3A2A15; --accent-soft-ink: #FFD3A1; }
html.look-dark[data-look="klar"] .sidebar, html.look-dark[data-look="warm"] .sidebar, html.look-dark[data-look="kachel"] .sidebar { border-right: 1px solid var(--nav-line); }

/* Hoher Kontrast: Farben der Barrierefreiheit überstimmen jede Darstellung */
html.a11y-contrast.a11y-contrast.a11y-contrast[data-look] {
  --bg: #FFFFFF; --surface: #FFFFFF; --surface-2: #F0F0F0; --line: #000000; --text: #000000; --text-2: #1F1F1F;
  --accent: #0033A0; --accent-hover: #001F66; --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;
}
html.a11y-contrast.a11y-contrast.a11y-contrast[data-look][data-theme="dark"] {
  --bg: #000000; --surface: #000000; --surface-2: #1A1A1A; --line: #FFFFFF; --text: #FFFFFF; --text-2: #F0F0F0;
  --accent: #FFD400; --accent-hover: #FFE666; --accent-soft: #2A2400; --accent-soft-ink: #FFE666;
}
@media (prefers-color-scheme: dark) {
  html.a11y-contrast.a11y-contrast.a11y-contrast[data-look]:not([data-theme="light"]) {
    --bg: #000000; --surface: #000000; --surface-2: #1A1A1A; --line: #FFFFFF; --text: #FFFFFF; --text-2: #F0F0F0;
    --accent: #FFD400; --accent-hover: #FFE666; --accent-soft: #2A2400; --accent-soft-ink: #FFE666;
  }
}
/* Navigationseintrag, der einen Dialog öffnet (Darstellung) */
.nav-action { width: 100%; border: 0; background: none; font: inherit; font-size: 0.90625rem; text-align: left; cursor: pointer; }

/* Abgerundete Ecken auch bei Karten mit Tabellen: Inhalt wird an der Rundung beschnitten (clip statt hidden: Kopfzeile bleibt „sticky“) */
.card:has(.table-wrap), .card:has(.scroll-box), .card:has(> table) { overflow: clip; }
.table-wrap { border-radius: inherit; }


/* ---------- Navigation einklappbar (nur Desktop) ---------- */
.nav-collapse { display: none; }
@media (min-width: 961px) {
  html:not(.a11y-fs-150):not(.a11y-fs-200) .nav-collapse { display: inline-flex; align-items: center; justify-content: center; align-self: flex-end; width: 32px; height: 32px; margin: -12px 0 -12px; border: 1px solid var(--nav-line); border-radius: var(--r-sm); background: transparent; color: var(--nav-muted); cursor: pointer; }
  html:not(.a11y-fs-150):not(.a11y-fs-200) .nav-collapse:hover { background: var(--nav-active); color: #FFFFFF; }
  html.nav-collapsed:not(.a11y-fs-150):not(.a11y-fs-200) .shell { grid-template-columns: 68px minmax(0, 1fr); }
  html.nav-collapsed:not(.a11y-fs-150):not(.a11y-fs-200) .sidebar { padding: 20px 8px; align-items: center; }
  html.nav-collapsed:not(.a11y-fs-150):not(.a11y-fs-200) .nav-collapse { align-self: center; }
  /* Beschriftungen bleiben für Screenreader erhalten, nur optisch weg */
  html.nav-collapsed:not(.a11y-fs-150):not(.a11y-fs-200) .brand-name,
  html.nav-collapsed:not(.a11y-fs-150):not(.a11y-fs-200) .nav-label,
  html.nav-collapsed:not(.a11y-fs-150):not(.a11y-fs-200) .nav-link > span:not(.nav-count),
  html.nav-collapsed:not(.a11y-fs-150):not(.a11y-fs-200) .foot-btn > span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  html.nav-collapsed:not(.a11y-fs-150):not(.a11y-fs-200) .nav-group { width: 100%; align-items: center; }
  html.nav-collapsed:not(.a11y-fs-150):not(.a11y-fs-200) .nav-link { justify-content: center; padding: 0; width: 44px; position: relative; }
  html.nav-collapsed:not(.a11y-fs-150):not(.a11y-fs-200) .nav-link .nav-count { position: absolute; top: 2px; right: 0; transform: scale(.8); }
  html.nav-collapsed:not(.a11y-fs-150):not(.a11y-fs-200) .brand { padding: 4px 0; }
  html.nav-collapsed:not(.a11y-fs-150):not(.a11y-fs-200) .brand-logo { max-width: 32px; }
  html.nav-collapsed:not(.a11y-fs-150):not(.a11y-fs-200) .sidebar-foot { font-size: 0; padding: 6px; border: 0; width: 100%; display: flex; flex-direction: column; align-items: center; }
  html.nav-collapsed:not(.a11y-fs-150):not(.a11y-fs-200) .sidebar-foot > :not(.foot-btn) { display: none; }
}

/* ---------- Anpassung an alle Bildschirmgrößen (Version 2026.10.58) ---------- */
/* Kopfzeile: Titel behält Mindestbreite und läuft nach rechts; Knöpfe rutschen bei Platzmangel in die nächste Zeile */
.topbar { flex-wrap: wrap; row-gap: 8px; }
.topbar .crumbs { flex: 1 1 200px; min-width: 0; }
.crumbs h1 { overflow-wrap: break-word; word-break: normal; hyphens: auto; }
.topbar-actions { flex-wrap: wrap; justify-content: flex-end; }
@media (max-width: 1100px) { .topbar-actions { flex: 1 1 100%; margin-left: 0; } }
@media (min-width: 1101px) { .topbar-actions { flex: 0 1 auto; } }
.menu-btn { flex: 0 0 auto; }
/* Untermenüs (Reiter): auf kleinen Bildschirmen umbrechen statt verstecktes Wischen – alle Punkte sichtbar */
@media (max-width: 900px) {
  .tabs { flex-wrap: wrap; overflow: visible; gap: 6px; border-bottom: 0; padding-bottom: 4px; }
  .tab { min-height: 40px; padding: 0 14px; margin-bottom: 0; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); white-space: normal; text-align: center; }
  .tab[aria-selected="true"] { background: var(--accent-soft); color: var(--accent-soft-ink); border-color: var(--accent); }
}
/* Tabellen: lange Wörter umbrechen, Tabellen scrollen waagerecht innerhalb der Karte */
.table-wrap > table.table { min-width: 680px; }
.table td { overflow-wrap: break-word; }
/* Formular- und Kartenraster auf Tablet */
@media (max-width: 820px) {
  .card-head { padding: 14px 16px; }
  .section-title { flex-wrap: wrap; gap: 8px; }
  .row { flex-wrap: wrap; }
  .modal-foot { flex-wrap: wrap; }
  .modal-foot .btn { flex: 1 1 auto; }
  dialog.modal { width: calc(100vw - 16px); max-height: calc(100dvh - 16px); }
}

/* Sprachauswahl (Deutsch / English / Polski): Aufklappliste, schwebt unter der Taste – das Layout verschiebt sich nicht */
.lang-dd { position: relative; display: inline-flex; flex: none; }
.icon-btn.lang-trigger { width: auto; min-width: 74px; padding: 0 10px; gap: 6px; display: inline-flex; align-items: center; justify-content: space-between; font: 600 .8125rem/1 var(--font-body); letter-spacing: .04em; }
.lang-trigger .lang-code { min-width: 1.5em; text-align: left; }
.lang-trigger svg:last-child { width: 14px; height: 14px; opacity: .75; transition: transform .15s; }
.lang-trigger[aria-expanded="true"] svg:last-child { transform: rotate(180deg); }
.lang-menu { position: absolute; top: calc(100% + 6px); right: 0; z-index: 60; min-width: 100%; width: max-content; margin: 0; padding: 4px; list-style: none; background: var(--surface); color: var(--text); border: 1px solid var(--line); border-radius: var(--r-md, 10px); box-shadow: var(--shadow); }
.lang-menu:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.lang-menu li { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: calc(var(--r-md, 10px) - 4px); cursor: pointer; font: 500 .875rem/1.2 var(--font-body); white-space: nowrap; }
.lang-menu li .lang-code { font: 700 .75rem/1 var(--font-mono, monospace); letter-spacing: .04em; min-width: 1.6em; color: var(--text-2, var(--text)); }
.lang-menu li:hover, .lang-menu li.is-active { background: color-mix(in srgb, var(--accent) 14%, transparent); }
.lang-menu li.is-cur { font-weight: 700; box-shadow: inset 3px 0 0 var(--accent); }
.lang-menu li.is-active { outline: 2px solid var(--accent); outline-offset: -2px; }
.login-switch { padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--r-md, 10px); background: color-mix(in srgb, var(--accent) 6%, transparent); align-items: center; }

/* Fallfragen und Grafiken im Test */
.q-case { margin: 10px 0 12px; padding: 12px 14px; border-left: 4px solid var(--accent); background: var(--surface-2); border-radius: 0 var(--r-md) var(--r-md) 0; }
.q-case p { margin: 4px 0 0; max-width: 72ch; }
.q-case-ttl { font-size: 0.75rem; text-transform: uppercase; letter-spacing: .06em; color: var(--text-2); font-weight: 600; }
.q-fig { margin: 8px 0 12px; }
.q-fig img { max-width: 100%; height: auto; border: 1px solid var(--line); border-radius: var(--r-md); background: #fff; display: block; }

/* ---------- Raumkalender ---------- */
.rc-bar-wrap { display: flex; flex-wrap: wrap; gap: 10px; align-items: end; }
.rc-bar-wrap .field { min-width: 150px; }
.rc-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 0.8125rem; color: var(--text-2); }
.rc-legend span { display: inline-flex; align-items: center; gap: 6px; }
.rc-sw { width: 18px; height: 12px; border-radius: 3px; border: 1px solid var(--text-2); display: inline-block; }
.rc-k-frei { background: var(--ok-soft); border-color: var(--ok); }
.rc-k-belegt { background: var(--accent); border-color: var(--accent-hover); }
.rc-k-dauer { background: repeating-linear-gradient(45deg, #7a4bd1 0 5px, #9b7be0 5px 10px); border-color: #5b34a5; }
.rc-k-geblockt { background: repeating-linear-gradient(-45deg, #8a8f98 0 4px, #c4c8ce 4px 8px); border-color: #4a4f57; }
.rc-k-veranstaltung { background: #0d7a8a; border-color: #0a5c68; }
.rc-tl { border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); overflow-x: auto; }
.rc-tl-inner { min-width: 760px; }
.rc-tl-head, .rc-tl-row { display: grid; grid-template-columns: 190px 1fr; }
.rc-tl-head { background: var(--surface-2); border-bottom: 1px solid var(--line); font-size: 0.75rem; color: var(--text-2); }
.rc-hours { position: relative; height: 28px; }
.rc-hours span { position: absolute; top: 6px; transform: translateX(-50%); font-family: var(--font-mono); }
.rc-tl-row { border-bottom: 1px solid var(--line); min-height: 52px; }
.rc-tl-row:last-child { border-bottom: 0; }
.rc-room { padding: 8px 12px; border-right: 1px solid var(--line); font-size: 0.875rem; }
.rc-room strong { display: flex; align-items: center; gap: 6px; }
.rc-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; flex: none; }
.rc-room .sub { display: block; font-size: 0.75rem; color: var(--text-2); }
.rc-track { position: relative; background: var(--ok-soft); min-height: 52px; }
.rc-closed { position: absolute; top: 0; bottom: 0; background: repeating-linear-gradient(135deg, var(--surface-2) 0 6px, var(--surface) 6px 12px); opacity: .9; pointer-events: none; }
.rc-gridline { position: absolute; top: 0; bottom: 0; width: 1px; background: var(--line); pointer-events: none; }
.rc-ev { position: absolute; top: 5px; bottom: 5px; border: 2px solid; border-radius: 6px; color: #fff; font: inherit; font-size: 0.75rem; line-height: 1.2; padding: 2px 6px; text-align: left; overflow: hidden; cursor: pointer; min-width: 6px; }
.rc-ev:focus-visible { outline: 3px solid var(--text); outline-offset: 2px; z-index: 3; }
.rc-ev b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 600; }
.rc-ev span { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; opacity: .95; }
.rc-k-geblockt.rc-ev { color: #101418; }
.rc-add { position: absolute; inset: 0; background: transparent; border: 0; cursor: cell; }
.rc-free { margin: 6px 0 0; font-size: 0.8125rem; color: var(--ok); }
.rc-wk { border: 1px solid var(--line); border-radius: var(--r-md); overflow-x: auto; background: var(--surface); min-width: 0; }
.rc-wk-inner { min-width: 860px; display: grid; grid-template-columns: 56px repeat(7, 1fr); }
.rc-wk-h { background: var(--surface-2); padding: 8px 6px; text-align: center; font-size: 0.8125rem; border-bottom: 1px solid var(--line); border-left: 1px solid var(--line); }
.rc-wk-h button { all: unset; cursor: pointer; font-weight: 600; color: var(--accent); }
.rc-wk-h.today { background: var(--accent-soft); }
.rc-wk-col { position: relative; border-left: 1px solid var(--line); background: var(--ok-soft); }
.rc-wk-time { position: relative; font-family: var(--font-mono); font-size: 0.6875rem; color: var(--text-2); }
.rc-wk-time span { position: absolute; right: 6px; transform: translateY(-50%); }
.rc-wk-ev { position: absolute; left: 3px; right: 3px; }
.rc-mx td, .rc-mx th { vertical-align: top; }
.rc-cell-st { font-weight: 600; font-size: 0.8125rem; }
.rc-st-frei { color: var(--ok); } .rc-st-teil { color: var(--warn); } .rc-st-belegt { color: var(--err); } .rc-st-zu { color: var(--text-2); }
.rc-chip { display: block; margin-top: 3px; padding: 2px 6px; border-radius: 4px; border: 1px solid; font-size: 0.75rem; color: #fff; text-align: left; width: 100%; cursor: pointer; font-family: inherit; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rc-chip.rc-k-geblockt { color: #101418; }
.rc-mon { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border: 1px solid var(--line); border-radius: var(--r-md); overflow: hidden; background: var(--surface); }
.rc-mon-h { background: var(--surface-2); padding: 6px; text-align: center; font-size: 0.75rem; font-weight: 600; border-bottom: 1px solid var(--line); }
.rc-day { min-height: 96px; padding: 4px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); font-size: 0.75rem; min-width: 0; }
.rc-day.other { background: var(--surface-2); opacity: .7; }
.rc-day.today { box-shadow: inset 0 0 0 2px var(--accent); }
.rc-day > button.d { all: unset; cursor: pointer; font-weight: 600; color: var(--accent); margin-bottom: 2px; display: block; }
.rc-list summary { cursor: pointer; font-weight: 600; }
.rc-sw-in { width: 28px; height: 28px; padding: 0; border: 1px solid var(--line); border-radius: 6px; background: none; }
@media (max-width: 720px) { .rc-tl-head, .rc-tl-row { grid-template-columns: 130px 1fr; } .rc-day { min-height: 70px; } }
@media print {
  .rc-bar-wrap, .rc-add, .rc-print-hide { display: none !important; }
  .rc-tl, .rc-wk, .rc-mon { border-color: #000; overflow: visible; }
  .rc-tl-inner, .rc-wk-inner { min-width: 0; }
  .rc-ev, .rc-chip, .rc-sw, .rc-closed { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .rc-print-title { display: block !important; }
}
.rc-print-title { display: none; margin: 0 0 8px; font-size: 1.1rem; font-weight: 700; }
@media (prefers-contrast: more), (forced-colors: active) { .rc-ev, .rc-chip { forced-color-adjust: none; } }

/* ---------- KI-Assistent (Chat-Symbol unten rechts; nur sichtbar, wenn eine KI hinterlegt und eingeschaltet ist) ---------- */
.ki-fab { position: fixed; right: 20px; bottom: 20px; z-index: 95; width: 56px; height: 56px; border-radius: 50%; border: 0; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; cursor: pointer; box-shadow: 0 6px 20px rgba(0,0,0,.28); }
.ki-fab:hover { background: var(--accent-hover); }
.ki-fab:focus-visible { outline: 3px solid var(--text); outline-offset: 3px; }
.ki-fab svg { width: 26px; height: 26px; }
.ki-panel { position: fixed; right: 20px; bottom: 88px; z-index: 96; width: min(400px, calc(100vw - 40px)); height: min(560px, calc(100vh - 120px)); display: flex; flex-direction: column; background: var(--surface); color: var(--text); border: 1px solid var(--line); border-radius: var(--r-lg, 14px); box-shadow: 0 12px 40px rgba(0,0,0,.3); overflow: hidden; }
.ki-panel[hidden] { display: none; }
.ki-head { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-bottom: 1px solid var(--line); background: var(--surface-2); }
.ki-head h2 { margin: 0; font-size: 1rem; flex: 1; }
.ki-head button { min-height: 36px; min-width: 36px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--text); font: inherit; font-size: .8125rem; cursor: pointer; padding: 0 10px; }
.ki-note { margin: 0; padding: 8px 12px; font-size: .78125rem; background: var(--warn-soft); color: var(--warn); border-bottom: 1px solid var(--line); }
.ki-log { flex: 1; overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 10px; }
.ki-msg { max-width: 88%; padding: 8px 12px; border-radius: 12px; white-space: pre-wrap; overflow-wrap: anywhere; font-size: .9375rem; line-height: 1.45; }
.ki-msg.user { align-self: flex-end; background: var(--accent); color: var(--accent-ink); border-bottom-right-radius: 4px; }
.ki-msg.assistant { align-self: flex-start; background: var(--surface-2); color: var(--text); border: 1px solid var(--line); border-bottom-left-radius: 4px; }
.ki-msg.error { align-self: stretch; max-width: 100%; background: var(--err-soft); color: var(--err); border: 1px solid var(--err); }
.ki-form { display: flex; gap: 8px; padding: 10px 12px; border-top: 1px solid var(--line); background: var(--surface); }
.ki-form textarea { flex: 1; min-height: 44px; max-height: 120px; resize: vertical; padding: 8px 10px; border: 1px solid var(--control, var(--line)); border-radius: 10px; background: var(--surface); color: var(--text); font: inherit; }
.ki-form button { min-width: 64px; border: 0; border-radius: 10px; background: var(--accent); color: var(--accent-ink); font: inherit; font-weight: 600; cursor: pointer; }
.ki-form button:disabled { opacity: .55; cursor: wait; }
@media (max-width: 640px) { .ki-panel { inset: 0; width: auto; height: auto; border-radius: 0; border: 0; } .ki-fab[aria-expanded="true"] { display: none; } }
@media print { .ki-fab, .ki-panel { display: none !important; } }
@media (prefers-reduced-motion: no-preference) { .ki-panel { animation: kiIn .15s ease-out; } @keyframes kiIn { from { opacity: 0; transform: translateY(8px); } } }

.perm-off td { color: var(--text-2); opacity: .6; }
.perm-off input[type=checkbox] { cursor: not-allowed; }

/* =========================================================
   Layouts (Seitenaufbau) – getrennt von den Paletten (data-look).
   Gesetzt über <html data-layout="…">. Nur Desktop (ab 961 px); auf Handy gilt immer die Menü-Schublade.
   Hoher Kontrast der Barrierefreiheit behält seine Farben.
   ========================================================= */
.layout-grid { border: 0; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 700px) { .layout-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.layout-card { position: relative; display: flex; flex-direction: column; gap: 4px; padding: 10px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); cursor: pointer; }
.layout-card input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.layout-card:has(input:checked) { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); }
.layout-card:has(input:focus-visible) { outline: 3px solid var(--accent); outline-offset: 2px; }
.layout-card:has(input:disabled) { opacity: .55; cursor: not-allowed; }
.layout-prev { position: relative; display: block; height: 62px; border-radius: 6px; overflow: hidden; border: 1px solid var(--line); background: var(--bg); }
.layout-prev i, .layout-prev b { position: absolute; display: block; border-radius: 3px; }
.layout-prev i { background: var(--text-2); opacity: .55; }
.layout-prev b { background: var(--accent); opacity: .9; }
.lp-standard i:nth-child(1) { left: 0; top: 0; bottom: 0; width: 26%; border-radius: 0; background: #0A1628; opacity: 1; }
.lp-standard b { left: 34%; top: 14px; width: 40%; height: 12px; } .lp-standard i:nth-child(2) { left: 34%; top: 34px; width: 56%; height: 14px; background: var(--surface); border: 1px solid var(--line); opacity: 1; }
.lp-hell i:nth-child(1) { left: 0; top: 0; bottom: 0; width: 26%; border-radius: 0; background: #fff; border-right: 1px solid var(--line); opacity: 1; }
.lp-hell b { left: 34%; top: 14px; width: 40%; height: 12px; } .lp-hell i:nth-child(2) { left: 34%; top: 34px; width: 56%; height: 14px; background: var(--surface); border: 1px solid var(--line); opacity: 1; }
.lp-oben i:nth-child(1) { left: 0; right: 0; top: 0; height: 14px; border-radius: 0; background: #fff; border-bottom: 1px solid var(--line); opacity: 1; }
.lp-oben b { left: 10%; top: 24px; width: 40%; height: 12px; } .lp-oben i:nth-child(2) { left: 10%; top: 42px; width: 80%; height: 12px; background: var(--surface); border: 1px solid var(--line); opacity: 1; }
.lp-kachel i:nth-child(1), .lp-kachel i:nth-child(2), .lp-kachel i:nth-child(3) { top: 14px; width: 24%; height: 34px; border-radius: 8px; background: var(--surface); border: 1px solid var(--line); opacity: 1; }
.lp-kachel i:nth-child(1) { left: 8%; } .lp-kachel i:nth-child(2) { left: 38%; } .lp-kachel i:nth-child(3) { left: 68%; } .lp-kachel b { left: 8%; top: 8px; width: 24%; height: 5px; }
.lp-schiene i:nth-child(1) { left: 0; top: 0; bottom: 0; width: 10%; border-radius: 0; background: #0A1628; opacity: 1; }
.lp-schiene b { left: 20%; top: 14px; width: 40%; height: 12px; } .lp-schiene i:nth-child(2) { left: 20%; top: 34px; width: 70%; height: 14px; background: var(--surface); border: 1px solid var(--line); opacity: 1; }
.lp-modern i:nth-child(1) { left: 14%; right: 14%; top: 6px; height: 10px; border-radius: 99px; background: var(--surface); border: 1px solid var(--line); opacity: 1; box-shadow: 0 2px 6px rgba(0,0,0,.12); }
.lp-modern b { left: 8%; top: 24px; width: 46%; height: 30px; border-radius: 10px; } .lp-modern i:nth-child(2) { left: 58%; top: 24px; width: 34%; height: 14px; border-radius: 8px; background: var(--surface); border: 1px solid var(--line); opacity: 1; }

@media (min-width: 961px) {
  /* ----- Hell: helle Seitenleiste, unabhängig von der Palette ----- */
  html.look-light[data-layout="hell"] .sidebar { --nav-bg: #FFFFFF; --nav-line: var(--line); --nav-text: #34425C; --nav-muted: #5B6B86; --nav-accent: var(--accent); --nav-active: var(--accent-soft); border-right: 1px solid var(--line); }
  html.look-light[data-layout="hell"] .sidebar .brand, html.look-light[data-layout="hell"] .sidebar .brand:hover,
  html.look-light[data-layout="hell"] .sidebar .sidebar-foot strong, html.look-light[data-layout="hell"] .sidebar .foot-select, html.look-light[data-layout="hell"] .sidebar .foot-btn:hover { color: var(--text); }
  html.look-light[data-layout="hell"] .sidebar .nav-link:hover, html.look-light[data-layout="hell"] .sidebar .nav-link[aria-current="page"] { color: var(--accent-soft-ink); }
  html.look-light[data-layout="hell"] .sidebar .foot-select { background: var(--surface-2); }
  html.look-light[data-layout="hell"] .sidebar .brand-mark span:last-child { background: var(--text); }

  /* ----- Oben: Behörden-Navigation als Leiste über dem Inhalt ----- */
  html[data-layout="oben"] .shell, html[data-layout="modern"] .shell { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); align-content: start; }
  html[data-layout="oben"] .sidebar, html[data-layout="modern"] .sidebar { align-self: start; align-content: center; }
  html[data-layout="oben"].nav-collapsed .shell { grid-template-columns: minmax(0, 1fr); }
  html[data-layout="oben"] .sidebar { position: sticky; top: 0; z-index: 40; height: auto; max-height: none; overflow: visible; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 4px 16px; padding: 8px var(--gutter); border-bottom: 1px solid var(--line); }
  html[data-layout="oben"] .nav-collapse, html[data-layout="modern"] .nav-collapse { display: none !important; }
  html[data-layout="oben"] .nav-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  html[data-layout="oben"] .nav-group { flex-direction: row; flex-wrap: wrap; gap: 2px; }
  html[data-layout="oben"] .nav-link { min-height: 40px; padding: 0 12px; }
  html[data-layout="oben"] .sidebar-foot { margin-top: 0; margin-left: auto; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; padding: 4px 0; border: 0; }
  html[data-layout="oben"] .sidebar-foot strong { display: inline; }
  html[data-layout="oben"] .topbar { position: static; }
  html.look-light[data-layout="oben"] .sidebar { --nav-bg: #FFFFFF; --nav-line: var(--line); --nav-text: #34425C; --nav-muted: #5B6B86; --nav-accent: var(--accent); --nav-active: var(--accent-soft); }
  html.look-light[data-layout="oben"] .sidebar .brand, html.look-light[data-layout="oben"] .sidebar .brand:hover,
  html.look-light[data-layout="oben"] .sidebar .sidebar-foot strong, html.look-light[data-layout="oben"] .sidebar .foot-select, html.look-light[data-layout="oben"] .sidebar .foot-btn:hover { color: var(--text); }
  html.look-light[data-layout="oben"] .sidebar .nav-link:hover, html.look-light[data-layout="oben"] .sidebar .nav-link[aria-current="page"] { color: var(--accent-soft-ink); }
  html.look-light[data-layout="oben"] .sidebar .foot-select { background: var(--surface-2); }
  html.look-light[data-layout="oben"] .sidebar .brand-mark span:last-child { background: var(--text); }
  html[data-layout="oben"] .nav-link[aria-current="page"] { box-shadow: inset 0 -3px 0 var(--nav-accent); border-radius: var(--r-sm) var(--r-sm) 0 0; }

  /* ----- Kachel: weiche, luftige Karten ----- */
  html[data-layout="kachel"] { --r-md: 14px; --r-lg: 20px; }
  html[data-layout="kachel"] .content { gap: 28px; }
  html[data-layout="kachel"] .card { border-radius: 20px; box-shadow: var(--shadow); }
  html[data-layout="kachel"] .grid { --gap: 24px; }
  html[data-layout="kachel"] .kpis { gap: 20px; }
  html[data-layout="kachel"] .kpi { padding: 24px; }
  html[data-layout="kachel"] .btn { border-radius: 999px; }
  html[data-layout="kachel"] .topbar { background: transparent; border-bottom: 0; }

  /* ----- Schiene: schmale Icon-Leiste (Beschriftung nur für Screenreader) ----- */
  html[data-layout="schiene"]:not(.a11y-fs-150):not(.a11y-fs-200) .shell { grid-template-columns: 68px minmax(0, 1fr); }
  html[data-layout="schiene"]:not(.a11y-fs-150):not(.a11y-fs-200) .sidebar { padding: 20px 8px; align-items: center; }
  html[data-layout="schiene"]:not(.a11y-fs-150):not(.a11y-fs-200) .nav-collapse { display: none; }
  html[data-layout="schiene"]:not(.a11y-fs-150):not(.a11y-fs-200) .brand-name, html[data-layout="schiene"]:not(.a11y-fs-150):not(.a11y-fs-200) .nav-label,
  html[data-layout="schiene"]:not(.a11y-fs-150):not(.a11y-fs-200) .nav-link > span:not(.nav-count), html[data-layout="schiene"]:not(.a11y-fs-150):not(.a11y-fs-200) .foot-btn > span,
  html[data-layout="schiene"]:not(.a11y-fs-150):not(.a11y-fs-200) .sidebar-foot > :not(.foot-btn) { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  html[data-layout="schiene"]:not(.a11y-fs-150):not(.a11y-fs-200) .sidebar-foot { padding: 6px; border: 0; font-size: 0; }
  html[data-layout="schiene"]:not(.a11y-fs-150):not(.a11y-fs-200) .nav-link { justify-content: center; padding: 0; width: 44px; }

  /* ----- Modern: schwebende Navigation, weicher Verlauf, viel Luft ----- */
  html[data-layout="modern"] { --r-md: 16px; --r-lg: 24px; }
  html.look-light[data-layout="modern"] body { background: radial-gradient(900px 480px at 85% -8%, var(--accent-soft) 0%, transparent 60%), var(--bg); background-attachment: fixed; }
  html[data-layout="modern"] .sidebar { position: sticky; top: 12px; z-index: 40; height: auto; max-height: none; overflow: visible; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 4px 14px; margin: 12px var(--gutter) 0; padding: 8px 14px; border: 1px solid var(--line); border-radius: 28px; box-shadow: 0 10px 30px rgba(20, 40, 90, .12); }
  html[data-layout="modern"] .nav-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  html[data-layout="modern"] .nav-group { flex-direction: row; flex-wrap: wrap; gap: 4px; }
  html[data-layout="modern"] .nav-link { border-radius: 999px; min-height: 40px; padding: 0 14px; }
  html[data-layout="oben"] .foot-m, html[data-layout="modern"] .foot-m, html[data-layout="oben"] .brand-sub, html[data-layout="modern"] .brand-sub { display: none; }
  html[data-layout="modern"] .sidebar-foot { margin-top: 0; margin-left: auto; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; padding: 0; border: 0; }
  html[data-layout="modern"] .sidebar-foot strong { display: inline; }
  html[data-layout="modern"] .topbar { position: static; background: transparent; border-bottom: 0; padding-top: 22px; }
  html[data-layout="modern"] .crumbs h1 { font-size: 2rem; letter-spacing: -.02em; }
  html[data-layout="modern"] .content { gap: 28px; }
  html[data-layout="modern"] .card { border-radius: 24px; box-shadow: 0 12px 34px rgba(37, 70, 160, .07); }
  html[data-layout="modern"] .btn { border-radius: 999px; }
  html.look-light[data-layout="modern"] .sidebar { --nav-bg: rgba(255, 255, 255, .92); --nav-line: var(--line); --nav-text: #34425C; --nav-muted: #5B6B86; --nav-accent: var(--accent-ink); --nav-active: var(--accent); }
  html.look-light[data-layout="modern"] .sidebar .brand, html.look-light[data-layout="modern"] .sidebar .brand:hover,
  html.look-light[data-layout="modern"] .sidebar .sidebar-foot strong, html.look-light[data-layout="modern"] .sidebar .foot-select, html.look-light[data-layout="modern"] .sidebar .foot-btn:hover { color: var(--text); }
  html.look-light[data-layout="modern"] .sidebar .nav-link:hover { color: var(--accent-soft-ink); background: var(--accent-soft); }
  html.look-light[data-layout="modern"] .sidebar .nav-link[aria-current="page"] { color: var(--accent-ink); font-weight: 600; }
  html.look-light[data-layout="modern"] .sidebar .nav-link[aria-current="page"] svg { color: var(--accent-ink); }
  html.look-light[data-layout="modern"] .sidebar .foot-select { background: var(--surface-2); }
  html.look-light[data-layout="modern"] .sidebar .brand-mark span:last-child { background: var(--text); }
  html.look-dark[data-layout="modern"] .sidebar { --nav-active: var(--accent-soft); }
}
/* Hoher Kontrast: Navigation behält Schwarz/Weiß, auch bei hellen Layouts */
html.a11y-contrast[data-layout] .sidebar { --nav-bg: #000000; --nav-line: #FFFFFF; --nav-text: #FFFFFF; --nav-muted: #E0E0E0; --nav-active: #1A1A1A; --nav-accent: #FFD400; }
html.a11y-contrast[data-layout] .sidebar .brand, html.a11y-contrast[data-layout] .sidebar .brand:hover, html.a11y-contrast[data-layout] .sidebar .nav-link:hover, html.a11y-contrast[data-layout] .sidebar .nav-link[aria-current="page"],
html.a11y-contrast[data-layout] .sidebar .sidebar-foot strong, html.a11y-contrast[data-layout] .sidebar .foot-btn:hover { color: #FFFFFF; }
html.a11y-contrast[data-layout] .sidebar .foot-select { background: #000000; color: #FFFFFF; }
html.a11y-contrast[data-layout] body { background: var(--bg); }

/* ---------- Teilnehmer-Startseite: Ansichten, Fristen, Lernpfad ---------- */
.view-switch { margin-left: 8px; }
.grid.view-liste { grid-template-columns: minmax(0, 1fr); gap: 8px; }
.grid.view-liste .card.course { display: grid; grid-template-columns: 72px minmax(0, 1fr); align-items: center; gap: 0 14px; padding: 8px 14px 8px 8px; }
.grid.view-liste .course-thumb { width: 72px; height: 48px; min-height: 0; aspect-ratio: auto; border-radius: 8px; padding: 0; }
.grid.view-liste .course-thumb .mono { display: none; }
.grid.view-liste .course-body { padding: 0; gap: 4px; }
.grid.view-liste .course-body > p { display: none; }
.grid.view-liste .course-body h3 { font-size: 1rem; }
.grid.view-mittel { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.grid.view-mittel .course-body > p { display: none; }
.grid.view-gross { grid-template-columns: repeat(auto-fill, minmax(min(100%, 380px), 1fr)); gap: 24px; }
.grid.view-gross .course-thumb { min-height: 200px; }
.grid.view-gross .course-body h3 { font-size: 1.25rem; }
.frist-card { border-left: 4px solid var(--warn); }
.frist-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.frist-item { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 14px; padding: 10px 12px; border-radius: var(--r-sm); background: var(--surface-2); }
.frist-item.soon { background: var(--warn-soft); }
.frist-item.late { background: var(--err-soft); }
.frist-days { font-weight: 700; min-width: 11ch; }
.frist-item.late .frist-days { color: var(--err); } .frist-item.soon .frist-days { color: var(--warn); }
.pfad-steps { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0; align-items: stretch; counter-reset: none; }
.pfad-step { position: relative; flex: 1 1 200px; min-width: 190px; padding-right: 28px; }
.pfad-step:not(:last-child)::after { content: ""; position: absolute; right: 6px; top: 50%; width: 16px; height: 16px; margin-top: -8px; border-top: 3px solid var(--line); border-right: 3px solid var(--line); transform: rotate(45deg); }
.pfad-step > a, .pfad-step > div { display: flex; flex-direction: column; gap: 4px; height: 100%; padding: 16px; border: 2px solid var(--line); border-radius: var(--r-md); background: var(--surface); color: var(--text); text-decoration: none; }
.pfad-ico { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2); color: var(--text-2); }
.pfad-ico svg { width: 18px; height: 18px; }
.pfad-nr { font-family: var(--font-mono); font-size: .75rem; color: var(--text-2); letter-spacing: .06em; text-transform: uppercase; }
.pfad-st { font-size: .8125rem; font-weight: 600; }
.pfad-fertig > a { border-color: var(--ok); } .pfad-fertig .pfad-ico { background: var(--ok-soft); color: var(--ok); } .pfad-fertig .pfad-st { color: var(--ok); }
.pfad-aktuell > a { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); } .pfad-aktuell .pfad-ico { background: var(--accent); color: var(--accent-ink); } .pfad-aktuell .pfad-st { color: var(--accent-soft-ink); }
.pfad-wartet > div, .pfad-offen > div { border-style: dashed; background: var(--surface-2); }
@media (max-width: 700px) { .pfad-steps { flex-direction: column; gap: 14px; } .pfad-step { padding-right: 0; } .pfad-step:not(:last-child)::after { right: 50%; top: auto; bottom: -14px; margin: 0; transform: rotate(135deg); } }
html.a11y-contrast .pfad-step > a, html.a11y-contrast .pfad-step > div, html.a11y-contrast .frist-item { border-color: #000; }

/* ---------- Aufklappmenüs (Layouts Behörde und Modern) ---------- */
.dd-btn { display: none; }
.dd-panel { display: contents; }
@media (min-width: 961px) {
  html[data-layout="oben"] .dd, html[data-layout="modern"] .dd { position: relative; }
  html[data-layout="oben"] .dd-btn, html[data-layout="modern"] .dd-btn { display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 14px; border: 0; background: transparent; color: var(--nav-text); font: inherit; font-size: 0.90625rem; font-weight: 500; border-radius: var(--r-sm); cursor: pointer; white-space: nowrap; }
  html[data-layout="modern"] .dd-btn { border-radius: 999px; padding: 0 16px; }
  html[data-layout="oben"] .dd-btn:hover, html[data-layout="modern"] .dd-btn:hover, html[data-layout="oben"] .dd.open > .dd-btn, html[data-layout="modern"] .dd.open > .dd-btn { background: var(--nav-active); color: var(--nav-text); }
  html.look-light[data-layout="oben"] .dd-btn:hover, html.look-light[data-layout="oben"] .dd.open > .dd-btn, html.look-light[data-layout="modern"] .dd-btn:hover, html.look-light[data-layout="modern"] .dd.open > .dd-btn { background: var(--accent-soft); color: var(--accent-soft-ink); }
  html[data-layout="oben"] .dd-btn.has-current { box-shadow: inset 0 -3px 0 var(--nav-accent); border-radius: var(--r-sm) var(--r-sm) 0 0; font-weight: 700; }
  html[data-layout="modern"] .dd-btn.has-current { background: var(--accent); color: var(--accent-ink); font-weight: 700; }
  html[data-layout="oben"] .dd-btn:focus-visible, html[data-layout="modern"] .dd-btn:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
  .dd-chev { transition: transform .15s; opacity: .75; }
  .dd.open > .dd-btn .dd-chev { transform: rotate(180deg); }
  html[data-layout="oben"] .nav-group.dd > .nav-label, html[data-layout="modern"] .nav-group.dd > .nav-label { display: none; }
  html[data-layout="oben"] .dd > .dd-panel, html[data-layout="modern"] .dd > .dd-panel {
    display: none; position: absolute; top: calc(100% + 8px); left: 0; z-index: 60; min-width: 270px; flex-direction: column; gap: 2px; padding: 8px;
    background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 18px 44px rgba(10, 22, 40, .20);
  }
  html[data-layout="oben"] .sidebar-foot.dd > .dd-panel, html[data-layout="modern"] .sidebar-foot.dd > .dd-panel { left: auto; right: 0; min-width: 300px; gap: 6px; padding: 14px; font-size: 0.8125rem; color: var(--text-2); }
  html[data-layout="oben"] .dd.open > .dd-panel, html[data-layout="modern"] .dd.open > .dd-panel { display: flex; }
  html[data-layout="modern"] .dd > .dd-panel { border-radius: 22px; top: calc(100% + 14px); padding: 10px; }
  html[data-layout="oben"] .dd-panel .nav-link, html[data-layout="modern"] .dd-panel .nav-link { color: var(--text); width: 100%; border-radius: 10px; padding: 0 12px; }
  html[data-layout="oben"] .dd-panel .nav-link:hover, html[data-layout="modern"] .dd-panel .nav-link:hover { background: var(--accent-soft); color: var(--accent-soft-ink); }
  html[data-layout="oben"] .dd-panel .nav-link[aria-current="page"], html[data-layout="modern"] .dd-panel .nav-link[aria-current="page"] { background: var(--accent-soft); color: var(--accent-soft-ink); font-weight: 600; box-shadow: none; border-radius: 10px; }
  html[data-layout="oben"] .dd-panel .nav-link svg, html[data-layout="modern"] .dd-panel .nav-link svg { color: var(--accent); opacity: 1; }
  html[data-layout="oben"] .dd-panel .foot-btn, html[data-layout="modern"] .dd-panel .foot-btn { color: var(--text); }
  html[data-layout="oben"] .dd-panel .foot-select, html[data-layout="modern"] .dd-panel .foot-select { color: var(--text); background: var(--surface-2); }
  html[data-layout="oben"] .dd-panel .foot-label, html[data-layout="modern"] .dd-panel .foot-label { color: var(--text-2); }
  html[data-layout="oben"] .sidebar-foot, html[data-layout="modern"] .sidebar-foot { margin-left: auto; }
  html[data-layout="oben"] .sidebar-foot > strong, html[data-layout="modern"] .sidebar-foot > strong { display: none; }
  html[data-layout="oben"] .nav-group.dd-single, html[data-layout="modern"] .nav-group.dd-single { flex-direction: row; }
  html.look-dark[data-layout="oben"] .dd-btn:hover, html.look-dark[data-layout="modern"] .dd-btn:hover { color: #fff; }
}
html.a11y-contrast[data-layout] .dd-panel { background: #000; border: 2px solid #fff; }
html.a11y-contrast[data-layout] .dd-panel .nav-link, html.a11y-contrast[data-layout] .dd-panel .foot-btn, html.a11y-contrast[data-layout] .dd-panel .foot-label { color: #fff; }
html.a11y-contrast[data-layout] .dd-btn { color: #fff; }

/* ---------- Kurse: Suche, Ansichten, Kacheln mit Hover-Infos ---------- */
.kc-bar { align-items: center; gap: 12px; flex-wrap: wrap; }
.kc-search { width: min(360px, 100%); }
.kc-grid { display: grid; gap: 16px; }
.kc-grid-klein { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.kc-grid-gross { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 20px; }
.kc { position: relative; display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; box-shadow: var(--shadow); cursor: default; }
.kc:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.kc-off { opacity: .8; }
.kc-thumb { display: grid; place-items: center; background: linear-gradient(135deg, var(--accent-soft), var(--surface-2)); color: var(--accent); background-size: cover; background-position: center; }
.kc-thumb svg { width: 36%; height: 36%; max-width: 56px; max-height: 56px; }
.kc-gross .kc-thumb { aspect-ratio: 16 / 9; }
.kc-klein .kc-thumb { aspect-ratio: 4 / 3; }
.kc-body { padding: 10px 12px; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.kc-body h3 { font-size: 0.9375rem; line-height: 1.25; overflow-wrap: anywhere; }
.kc-klein .kc-body { padding: 8px 10px; }
.kc-klein .kc-body h3 { font-size: 0.8125rem; }
.kc-topic { font-size: 0.8125rem; color: var(--text-2); }
.kc-actions { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.kc-actions-vis { padding: 0 12px 12px; margin-top: auto; }
/* Info-Fläche: liegt über der Kachel und erscheint bei Hover, Tastaturfokus oder Antippen */
.kc-info { position: absolute; inset: 0; padding: 12px; background: var(--surface); display: flex; flex-direction: column; gap: 10px; overflow: auto; opacity: 0; visibility: hidden; transition: opacity .15s; font-size: 0.8125rem; }
.kc-gross .kc-info { bottom: 52px; }
.kc:hover .kc-info, .kc:focus-within .kc-info, .kc.kc-open .kc-info { opacity: 1; visibility: visible; }
.kc-dl { margin: 0; display: flex; flex-direction: column; gap: 6px; }
.kc-dl dt { font-family: var(--font-mono); font-size: 0.6875rem; color: var(--text-2); text-transform: uppercase; letter-spacing: .05em; }
.kc-dl dd { margin: 0; overflow-wrap: anywhere; }
.kc-dl .sub { display: block; color: var(--text-2); }
.kc-more { position: relative; }
.kc-more > summary { list-style: none; cursor: pointer; display: inline-flex; align-items: center; min-height: 28px; padding: 0 10px; border: 1px solid var(--line); border-radius: var(--r-sm); font-size: 0.8125rem; font-weight: 600; background: var(--surface); }
.kc-more > summary::-webkit-details-marker { display: none; }
.kc-menu { position: absolute; z-index: 5; bottom: calc(100% + 4px); left: 0; display: flex; flex-direction: column; gap: 4px; min-width: 170px; padding: 8px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 12px 30px rgba(10, 22, 40, .2); }
.kc-menu .btn { justify-content: flex-start; }
@media (hover: none) { .kc:hover .kc-info { opacity: 0; visibility: hidden; } .kc.kc-open .kc-info, .kc:focus-within .kc-info { opacity: 1; visibility: visible; } }

/* ---------- Lernpfad-Editor ---------- */
.pf-edit { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; align-items: start; }
@media (max-width: 800px) { .pf-edit { grid-template-columns: minmax(0, 1fr); } }
.pf-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; min-height: 60px; }
.pf-list li { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); }
.pf-list li[draggable="true"] { cursor: grab; }
.pf-list li.pf-drag { opacity: .45; }
.pf-list .pf-t { flex: 1; min-width: 0; overflow-wrap: anywhere; font-weight: 600; }
.pf-list .pf-t .sub { display: block; font-weight: 400; color: var(--text-2); font-size: 0.8125rem; }
.pf-grip { color: var(--text-2); }
.pf-n { display: inline-grid; place-items: center; min-width: 26px; height: 26px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); font-size: 0.8125rem; font-weight: 700; }
.pf-btns { display: flex; gap: 2px; }
.pf-sel.pf-over { outline: 2px dashed var(--accent); outline-offset: 4px; border-radius: var(--r-md); }
.pf-drop { color: var(--text-2); justify-content: center; border-style: dashed !important; }
.pf-chain { list-style: none; margin: 0; padding: 0; display: flex; gap: 10px; align-items: stretch; }
.pf-chain.pf-h { flex-wrap: wrap; }
.pf-chain.pf-v { flex-direction: column; }
.pf-chain li { position: relative; display: flex; align-items: center; gap: 10px; padding: 10px 14px; border: 2px solid var(--line); border-radius: var(--r-md); background: var(--surface); font-weight: 600; }
.pf-chain.pf-h li:not(:last-child)::after { content: "→"; position: absolute; right: -22px; top: 50%; transform: translateY(-50%); color: var(--text-2); font-weight: 400; }
.pf-chain.pf-h li:not(:last-child) { margin-right: 22px; }
.pf-chain.pf-v li:not(:last-child)::after { content: "↓"; position: absolute; left: 22px; bottom: -22px; color: var(--text-2); font-weight: 400; }
.pf-chain.pf-v li:not(:last-child) { margin-bottom: 16px; }

/* ---------- Darstellungsvarianten Dashboard / Pflichtschulungen ---------- */
#view[data-var="karten"] { gap: 28px; }
#view[data-var="karten"] .card { border-radius: 22px; box-shadow: 0 12px 34px rgba(37, 70, 160, .07); }
#view[data-var="karten"] .kpis { gap: 20px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
#view[data-var="karten"] .kpi { padding: 26px; gap: 10px; background: linear-gradient(150deg, var(--surface) 40%, var(--accent-soft)); border-radius: 24px; position: relative; overflow: hidden; }
#view[data-var="karten"] .kpi::after { content: ""; position: absolute; right: -28px; top: -28px; width: 96px; height: 96px; border-radius: 50%; background: var(--accent-soft); opacity: .8; }
#view[data-var="karten"] .kpi-value { font-size: 2.75rem; letter-spacing: -.03em; position: relative; z-index: 1; }
#view[data-var="karten"] .kpi-label { font-weight: 600; position: relative; z-index: 1; }
#view[data-var="karten"] .card-head { border-bottom: 0; padding-bottom: 6px; }
#view[data-var="karten"] .btn { border-radius: 999px; }
#view[data-var="kompakt"] { gap: 12px; }
#view[data-var="kompakt"] .kpis { gap: 8px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
#view[data-var="kompakt"] .kpi { padding: 8px 12px; flex-direction: row; align-items: baseline; justify-content: space-between; gap: 10px; }
#view[data-var="kompakt"] .kpi-value { font-size: 1.25rem; }
#view[data-var="kompakt"] .card-pad { padding: 12px 14px; }
#view[data-var="kompakt"] .card-head { padding: 10px 14px; }
#view[data-var="kompakt"] .table td, #view[data-var="kompakt"] .table th { padding: 6px 10px; }

/* Themenliste auf dem Lernpfad-Zertifikat */
.c3-topics { list-style: none; margin: 8px auto 0; padding: 0; display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 14px; font-size: .9em; }
.c3-topics li::before { content: "• "; }
/* Inhalt hinter der Navigationsleiste wird leicht weichgezeichnet */
.topbar, html[data-layout="oben"] .sidebar, html[data-layout="modern"] .sidebar { -webkit-backdrop-filter: blur(14px) saturate(1.4); backdrop-filter: blur(14px) saturate(1.4); }
.topbar { background: color-mix(in srgb, var(--surface) 82%, transparent); }
html[data-layout="oben"] .sidebar, html[data-layout="modern"] .sidebar { background: color-mix(in srgb, var(--nav-bg) 84%, transparent); }
@media (prefers-reduced-transparency: reduce) { .topbar, html[data-layout="oben"] .sidebar, html[data-layout="modern"] .sidebar { -webkit-backdrop-filter: none; backdrop-filter: none; background: var(--surface); } }

/* Kachel-Menü „Mehr“: klappt im Infofeld nach unten auf, wird nie abgeschnitten */
.kc-more[open] { flex: 1 0 100%; }
.kc-menu { position: static; bottom: auto; left: auto; margin-top: 6px; min-width: 0; width: 100%; box-shadow: none; max-height: none; overflow: visible; flex-direction: row; flex-wrap: wrap; }
.kc-menu .btn { flex: 1 1 auto; }

/* Sicherheit & Schnittstellen: kleine aufklappbare Kästen, bei breitem Fenster nebeneinander */
.sec-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(360px, 1fr)); gap: 14px; align-items: start; margin-top: 14px; }
.sec-card { max-width: none !important; margin-top: 0 !important; padding: 0 !important; }
.sec-card:has(details[open]) { grid-column: 1 / -1; }
.sec-acc > .mod-body { padding: 4px 20px 20px; }
.sec-sum { display: flex; align-items: center; gap: 12px; padding: 16px 20px; cursor: pointer; list-style: none; border-radius: inherit; }
.sec-sum::-webkit-details-marker { display: none; }
.sec-sum::after { content: ""; width: 9px; height: 9px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg); margin-left: 4px; transition: transform .15s; flex: none; }
.sec-acc[open] > .sec-sum::after { transform: rotate(-135deg); }
.sec-sum:hover { background: var(--accent-soft); }
.sec-sum:focus-visible { outline: 3px solid var(--focus, var(--accent)); outline-offset: -3px; }
.sec-t { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; font-size: 1.05rem; }
.sec-acc[open] > .sec-sum { border-bottom: 1px solid var(--line); margin-bottom: 14px; }
.login-switch { padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface-2, var(--accent-soft)); margin-top: 6px; }
.sec-t { font-size: .95rem; } .sec-sum .badge { white-space: nowrap; }

/* Aufklappbare Kästen: Hover-Hintergrund bleibt innerhalb der runden Ecken */
.sec-card { overflow: hidden; border-radius: var(--r-lg, 16px); }
.sec-acc { border-radius: inherit; }
.sec-sum { border-radius: 0; }
.sec-acc:not([open]) > .sec-sum { border-radius: inherit; }

/* ---------- Ticketsystem ---------- */
.tk-item > summary { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; padding: 12px 16px; cursor: pointer; }
.tk-item .tk-no { font-weight: 700; }
.tk-item .tk-title { font-weight: 600; flex: 1 1 200px; }
.tk-item .tk-meta { color: var(--muted, #556); font-size: .875rem; flex-basis: 100%; }
.tk-item .tk-body { padding: 0 16px 16px; }
.tk-item .tk-text { white-space: pre-wrap; overflow-wrap: anywhere; }
.tk-hist { margin: 0; padding-left: 1.2em; display: grid; gap: 4px; }
.tk-seg { display: inline-flex; gap: 6px; }
.tk-seg .btn.on { outline: 2px solid currentColor; outline-offset: -2px; font-weight: 700; }
.tk-stages { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.tk-stage { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.tk-stage .input { flex: 1 1 180px; max-width: 280px; }
.tk-stage .select { flex: 0 1 200px; }
.tk-sn { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--surface-2, #e8ecf3); font-weight: 700; }

/* ---------- Bibliothek ---------- */
.bib-grid { display: grid; gap: 18px; }
.bib-grid.view-mittel { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.bib-grid.view-gross { grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr)); gap: 24px; }
.bib-grid.view-liste { grid-template-columns: minmax(0, 1fr); gap: 8px; }
.bib-card { display: flex; flex-direction: column; overflow: hidden; padding: 0; }
.bib-prev { aspect-ratio: 4 / 3; background: var(--surface-2); border-bottom: 1px solid var(--line); display: grid; place-items: center; overflow: hidden; }
.bib-prev img { width: 100%; height: 100%; object-fit: contain; object-position: top center; background: #fff; }
.bib-noprev { color: var(--text-2); align-content: center; justify-items: center; gap: 6px; }
.bib-noprev svg { width: 44px; height: 44px; }
.bib-grid.view-gross .bib-prev { aspect-ratio: 3 / 4; }
.bib-body { display: flex; flex-direction: column; gap: 8px; padding: 14px 16px 16px; flex: 1; }
.bib-body h3 { margin: 0; font-size: 1.05rem; overflow-wrap: anywhere; }
.bib-grid.view-gross .bib-body h3 { font-size: 1.25rem; }
.bib-desc { margin: 0; font-size: .9rem; }
.bib-grid.view-mittel .bib-desc { display: none; }
.bib-flags { display: flex; flex-wrap: wrap; gap: 6px; }
.bib-act { margin-top: auto; flex-wrap: wrap; }
.bib-grid.view-liste .bib-card { display: grid; grid-template-columns: 72px minmax(0, 1fr); align-items: center; gap: 0 14px; padding: 8px 14px 8px 8px; }
.bib-grid.view-liste .bib-prev { width: 72px; height: 54px; aspect-ratio: auto; border: 0; border-radius: 8px; }
.bib-grid.view-liste .bib-prev .mono { display: none; }
.bib-grid.view-liste .bib-noprev svg { width: 28px; height: 28px; }
.bib-grid.view-liste .bib-body { padding: 0; gap: 4px; }
.bib-grid.view-liste .bib-desc { display: none; }
