/* medlaps – Design-System
   Farbprofil: Petrol als Primärfarbe (ruhig, medizinisch), semantische Farben für Richtig/Falsch,
   eigene ordinale Skala für die fünf Relevanzstufen. Alle Textfarben ≥ 4.5:1 (WCAG AA), Bedienrahmen ≥ 3:1.
   Mobile-first: Navigation unten, Aktionen im Daumenbereich; ab 720 px Navigation oben. */

:root {
  color-scheme: light;
  /* Flächen & Text */
  --bg: #F5F7F8; --flaeche: #FFFFFF; --flaeche-2: #EDF1F3; --flaeche-3: #E3E9EC;
  --text: #14212B; --text-2: #4A5A66; --rand: #D5DDE2; --rand-stark: #8697A2;
  /* Primär */
  --primaer: #0B6B6F; --primaer-hover: #095A5D; --primaer-fg: #FFFFFF; --primaer-weich: #E3F1F1;
  /* Semantik */
  --gut: #1B7F4B; --gut-weich: #E4F3EA; --schlecht: #B42318; --schlecht-weich: #FBE9E7; --warn: #9A6200; --warn-weich: #FDF3DC;
  --auf-farbe: #FFFFFF;
  /* Relevanz 1–5 */
  --r1: #B42318; --r2: #C2410C; --r3: #2D5FB0; --r4: #4E5C66; --r5: #63727C;
  /* Raster */
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px;
  --rad-s: 8px; --rad-m: 12px; --rad-l: 16px; --rad-voll: 999px;
  --schatten-1: 0 1px 2px rgba(16, 33, 43, .06), 0 1px 3px rgba(16, 33, 43, .08);
  --schatten-2: 0 4px 16px rgba(16, 33, 43, .12);
  --fokus: 0 0 0 3px color-mix(in srgb, var(--primaer) 45%, transparent);
  /* Typografie */
  --schrift: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --fs-xs: .75rem; --fs-s: .8125rem; --fs-m: .9375rem; --fs-n: 1rem; --fs-l: 1.125rem; --fs-xl: 1.3125rem; --fs-xxl: 1.625rem;
  /* Maße */
  --kopf-h: 56px; --nav-h: 64px; --inhalt-max: 760px; --ziel: 44px;
  --unten: env(safe-area-inset-bottom, 0px);
}
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #0E1519; --flaeche: #162026; --flaeche-2: #1E2A31; --flaeche-3: #26343C;
    --text: #E6EDF0; --text-2: #9FB0BA; --rand: #2C3A42; --rand-stark: #5E707B;
    --primaer: #4FC1C0; --primaer-hover: #6FD0CF; --primaer-fg: #06272A; --primaer-weich: #123436;
    --gut: #4CC38A; --gut-weich: #12301F; --schlecht: #F97066; --schlecht-weich: #3A1715; --warn: #F2B84B; --warn-weich: #33270C;
    --auf-farbe: #0E1519;
    --r1: #F97066; --r2: #FB923C; --r3: #8AB4F8; --r4: #9FB0BA; --r5: #7D8E99;
    --schatten-1: 0 1px 2px rgba(0, 0, 0, .4); --schatten-2: 0 6px 20px rgba(0, 0, 0, .5);
  }
}

/* ---------- Basis ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--kopf-h) + var(--s3)); }
body { margin: 0; background: var(--bg); color: var(--text); font: var(--fs-n)/1.55 var(--schrift); -webkit-font-smoothing: antialiased; }
h1, h2, h3 { line-height: 1.25; margin: 0; }
h1 { font-size: var(--fs-xxl); font-weight: 700; letter-spacing: -.01em; }
h2 { font-size: var(--fs-l); font-weight: 650; }
p { margin: 0 0 var(--s3); }
a { color: var(--primaer); text-underline-offset: 2px; }
button, input, textarea, select { font: inherit; color: inherit; }
:focus-visible { outline: none; box-shadow: var(--fokus); border-radius: var(--rad-s); }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.gedimmt { color: var(--text-2); }
.klein { font-size: var(--fs-s); color: var(--text-2); }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* ---------- App-Rahmen ---------- */
.kopf { position: sticky; top: 0; z-index: 20; height: var(--kopf-h); display: flex; align-items: center; gap: var(--s3);
  padding: 0 var(--s4); padding-top: env(safe-area-inset-top, 0px); background: color-mix(in srgb, var(--flaeche) 92%, transparent);
  backdrop-filter: saturate(1.4) blur(10px); -webkit-backdrop-filter: saturate(1.4) blur(10px); border-bottom: 1px solid var(--rand); }
.marke { display: flex; align-items: center; gap: var(--s2); font-weight: 750; font-size: var(--fs-l); color: var(--text); text-decoration: none; letter-spacing: -.01em; }
.marke svg { width: 26px; height: 26px; flex: none; }
.kopf .zurueck { display: none; }
.kopf-nav { display: none; margin-left: var(--s5); gap: var(--s1); }
.kopf-rechts { margin-left: auto; display: flex; align-items: center; gap: var(--s2); }

.tabnav { position: fixed; z-index: 20; left: 0; right: 0; bottom: 0; height: calc(var(--nav-h) + var(--unten)); padding-bottom: var(--unten);
  display: grid; grid-template-columns: repeat(3, 1fr); background: var(--flaeche); border-top: 1px solid var(--rand); }
.tabnav a, .kopf-nav a { display: flex; align-items: center; justify-content: center; gap: var(--s2); text-decoration: none; color: var(--text-2); font-weight: 600; }
.tabnav a { flex-direction: column; gap: 2px; font-size: var(--fs-xs); }
.tabnav svg, .kopf-nav svg { width: 24px; height: 24px; }
.tabnav a.aktiv, .kopf-nav a.aktiv { color: var(--primaer); }
.kopf-nav a { padding: var(--s2) var(--s3); border-radius: var(--rad-s); font-size: var(--fs-m); }
.kopf-nav a:hover { background: var(--flaeche-2); }
.kopf-nav a.aktiv { background: var(--primaer-weich); }
.kopf-nav svg { width: 20px; height: 20px; }

main { max-width: var(--inhalt-max); margin: 0 auto; padding: var(--s4) var(--s4) calc(var(--nav-h) + var(--unten) + 120px); }
.seitenkopf { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--s3); margin: var(--s2) 0 var(--s4); }
.abschnitt { margin-top: var(--s5); }
.abschnitt > h2 { margin-bottom: var(--s3); display: flex; align-items: baseline; justify-content: space-between; gap: var(--s3); }

/* Fokusmodus beim Lernen: Tab-Navigation ausblenden, Zurück-Knopf zeigen */
body.fokus .tabnav { display: none; }
body.fokus main { padding-bottom: calc(150px + var(--unten)); }
body.fokus .kopf .zurueck { display: inline-flex; }
body.fokus .kopf .marke { display: none; }
body.fokus #kopfinfo { font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
body.fokus .kopf-rechts { flex: 1; min-width: 0; justify-content: space-between; }

@media (min-width: 720px) {
  .tabnav { display: none; }
  .kopf-nav { display: flex; }
  main { padding: var(--s5) var(--s5) 140px; }
  body.fokus .kopf .marke { display: flex; }
  body.fokus .kopf-rechts { flex: 0 1 auto; }
  body.fokus #kopfinfo { font-weight: 400; color: var(--text-2); }
}

/* ---------- Karten / Flächen ---------- */
.flaeche { background: var(--flaeche); border: 1px solid var(--rand); border-radius: var(--rad-l); box-shadow: var(--schatten-1); }
.flaeche.innen { padding: var(--s4); }
@media (min-width: 720px) { .flaeche.innen { padding: var(--s5); } }
.trenner { height: 1px; background: var(--rand); border: 0; margin: var(--s4) 0; }

/* ---------- Knöpfe (einheitliches System) ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: var(--s2); min-height: var(--ziel); padding: 0 var(--s4);
  border-radius: var(--rad-m); border: 1px solid transparent; font-weight: 650; font-size: var(--fs-m); line-height: 1.2; text-decoration: none;
  cursor: pointer; user-select: none; -webkit-tap-highlight-color: transparent; transition: background-color .15s, border-color .15s, transform .05s; }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn svg { width: 20px; height: 20px; flex: none; }
.btn-primaer { background: var(--primaer); color: var(--primaer-fg); }
.btn-primaer:hover:not(:disabled) { background: var(--primaer-hover); }
.btn-zweit { background: var(--flaeche); color: var(--text); border-color: var(--rand-stark); }
.btn-zweit:hover:not(:disabled) { background: var(--flaeche-2); }
.btn-text { background: transparent; color: var(--text-2); padding: 0 var(--s3); }
.btn-text:hover:not(:disabled) { background: var(--flaeche-2); color: var(--text); }
.btn-gut { background: var(--gut); color: var(--auf-farbe); }
.btn-schlecht { background: var(--schlecht); color: var(--auf-farbe); }
.btn-gross { min-height: 52px; font-size: var(--fs-n); border-radius: var(--rad-m); }
.btn-klein { min-height: 36px; padding: 0 var(--s3); font-size: var(--fs-s); border-radius: var(--rad-s); }
.btn-icon { width: var(--ziel); padding: 0; }
.btn-voll { width: 100%; }
.btn kbd { font: 600 var(--fs-xs)/1 var(--schrift); opacity: .7; border: 1px solid currentColor; border-radius: 4px; padding: 2px 4px; display: none; }
@media (hover: hover) and (min-width: 720px) { .btn kbd { display: inline-block; } }
.knopfreihe { display: flex; gap: var(--s2); flex-wrap: wrap; align-items: center; }

/* ---------- Chips / Badges ---------- */
.chip { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 var(--s3); border-radius: var(--rad-voll);
  border: 1px solid var(--rand-stark); background: var(--flaeche); color: var(--text); font-size: var(--fs-s); font-weight: 600; cursor: pointer; }
.chip .punkt { width: 10px; height: 10px; border-radius: 50%; background: var(--farbe, var(--rand-stark)); flex: none; }
.chip[aria-pressed="true"] { background: color-mix(in srgb, var(--farbe, var(--primaer)) 14%, var(--flaeche)); border-color: var(--farbe, var(--primaer)); }
.chip[aria-pressed="true"]::before { content: "✓"; font-weight: 800; color: var(--farbe, var(--primaer)); }
.chipreihe { display: flex; flex-wrap: wrap; gap: var(--s2); }
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px var(--s2); border-radius: var(--rad-voll); font-size: var(--fs-xs); font-weight: 650;
  background: var(--flaeche-2); color: var(--text-2); white-space: nowrap; }
.badge.primaer { background: var(--primaer-weich); color: var(--primaer); }
.badge.gut { background: var(--gut-weich); color: var(--gut); }
.badge.warn { background: var(--warn-weich); color: var(--warn); }
.badge.demo { background: var(--warn-weich); color: var(--warn); }
.rel-1 { --farbe: var(--r1); } .rel-2 { --farbe: var(--r2); } .rel-3 { --farbe: var(--r3); } .rel-4 { --farbe: var(--r4); } .rel-5 { --farbe: var(--r5); }
.badge.rel { background: color-mix(in srgb, var(--farbe) 14%, var(--flaeche)); color: var(--farbe); }

/* ---------- Auswahl ---------- */
.filterkopf { display: flex; align-items: center; justify-content: space-between; gap: var(--s2); margin-bottom: var(--s3); }
.baum { margin: 0 calc(-1 * var(--s2)); }
.baum details > summary { list-style: none; }
.baum summary::-webkit-details-marker { display: none; }
.knoten { display: grid; grid-template-columns: 32px 28px 1fr auto; align-items: center; min-height: 48px; padding: 0 var(--s2); border-radius: var(--rad-s); }
.knoten:hover { background: var(--flaeche-2); }
.knoten .auf { width: 32px; height: 32px; display: grid; place-items: center; color: var(--text-2); border-radius: var(--rad-s); cursor: pointer; }
.knoten .auf svg { width: 18px; height: 18px; transition: transform .15s; }
details[open] > summary .auf svg { transform: rotate(90deg); }
.knoten.blatt { grid-template-columns: 32px 28px 1fr auto; cursor: pointer; }
.knoten .name { min-width: 0; padding: var(--s2) var(--s2) var(--s2) 0; overflow-wrap: anywhere; line-height: 1.35; cursor: pointer; }
.ebene-1 > summary .name { font-weight: 700; }
.ebene-2 > summary .name { font-weight: 600; }
.ebene-2 { margin-left: var(--s4); }
.ebene-3 { margin-left: calc(var(--s4) * 2); }
.ebene-3 .name { font-size: var(--fs-m); }
input[type=checkbox] { width: 20px; height: 20px; margin: 0; accent-color: var(--primaer); cursor: pointer; }
.zahl { font-size: var(--fs-xs); font-weight: 650; color: var(--text-2); white-space: nowrap; font-variant-numeric: tabular-nums;
  padding: 2px var(--s2); border-radius: var(--rad-voll); background: var(--flaeche-2); }
.zahl b { color: var(--gut); }
.legende { display: flex; gap: var(--s3); flex-wrap: wrap; font-size: var(--fs-xs); color: var(--text-2); margin-top: var(--s3); }

/* fixe Start-Leiste */
.aktionsleiste { position: fixed; z-index: 15; left: 0; right: 0; bottom: calc(var(--nav-h) + var(--unten));
  background: color-mix(in srgb, var(--flaeche) 94%, transparent); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-top: 1px solid var(--rand); padding: var(--s3) var(--s4); }
.aktionsleiste .innen { max-width: var(--inhalt-max); margin: 0 auto; display: flex; gap: var(--s3); align-items: center; }
.aktionsleiste .zusammenfassung { flex: 1; min-width: 0; font-size: var(--fs-s); color: var(--text-2); line-height: 1.3; }
.aktionsleiste .zusammenfassung b { color: var(--text); font-size: var(--fs-m); display: block; }
body.fokus .aktionsleiste { bottom: 0; padding-bottom: calc(var(--s3) + var(--unten)); }
@media (min-width: 720px) { .aktionsleiste { bottom: 0; padding-bottom: calc(var(--s3) + var(--unten)); } }

/* Sitzungsliste */
.liste { list-style: none; margin: 0; padding: 0; }
.liste > li { display: flex; gap: var(--s3); align-items: center; padding: var(--s3) 0; border-top: 1px solid var(--rand); }
.liste > li:first-child { border-top: 0; padding-top: 0; }
.liste > li:last-child { padding-bottom: 0; }
.liste .text { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.liste .titelzeile { font-weight: 600; line-height: 1.35; }
.liste .aktionen { display: flex; gap: var(--s1); flex: none; }
.leer { color: var(--text-2); text-align: center; padding: var(--s4) 0; margin: 0; }

/* ---------- Lernen ---------- */
.fortschritt { display: flex; align-items: center; gap: var(--s3); margin-bottom: var(--s3); }
.mengen { display: flex; gap: var(--s3); font-size: var(--fs-s); color: var(--text-2); font-variant-numeric: tabular-nums; white-space: nowrap; }
.mengen b { color: var(--text); }
.bahnen { margin-left: auto; display: flex; gap: 4px; align-items: flex-end; }
.bahn { width: 10px; height: 28px; display: flex; flex-direction: column-reverse; gap: 2px; padding: 1px; border-radius: 4px; }
.bahn i { flex: 1; border-radius: 2px; background: var(--flaeche-3); }
.bahn i.an { background: var(--gut); }
.bahn.leer { opacity: .45; }
.bahn.aktuell { box-shadow: 0 0 0 2px var(--primaer); }

.lernkarte { overflow: hidden; }
.lernkarte .karteninhalt { padding: var(--s4); }
@media (min-width: 720px) { .lernkarte .karteninhalt { padding: var(--s5); } }
.pfad { font-size: var(--fs-xs); color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-bottom: var(--s2); }
.metazeile { display: flex; flex-wrap: wrap; gap: var(--s1) var(--s2); align-items: center; margin-bottom: var(--s3); }
.frage { font-size: var(--fs-l); font-weight: 650; line-height: 1.45; }
@media (min-width: 720px) { .frage { font-size: var(--fs-xl); } }
.frage p:last-child { margin-bottom: 0; }
.antwort { margin-top: var(--s4); padding: var(--s3) var(--s4); background: var(--primaer-weich); border-left: 4px solid var(--primaer); border-radius: var(--rad-s); font-weight: 550; }
.antwort p:last-child, .antwort ul:last-child, .antwort ol:last-child { margin-bottom: 0; }
.antwort-label, .loesung-label { font-size: var(--fs-xs); font-weight: 750; letter-spacing: .06em; text-transform: uppercase; color: var(--primaer); margin-bottom: var(--s1); }
.loesung-label { color: var(--text-2); margin-top: var(--s5); }
.md { overflow-wrap: anywhere; }
.md ul, .md ol { padding-left: 1.3em; margin: 0 0 var(--s3); }
.md li { margin: 2px 0; }
.md h3, .md h4, .md h5, .md h6 { font-size: var(--fs-n); margin: var(--s4) 0 var(--s2); }
.md blockquote { margin: var(--s3) 0; padding: var(--s2) var(--s3); border-left: 4px solid var(--warn); background: var(--warn-weich); border-radius: var(--rad-s); }
.md code { background: var(--flaeche-2); padding: 0 4px; border-radius: 4px; font-size: .92em; }
.md pre { background: var(--flaeche-2); padding: var(--s3); border-radius: var(--rad-s); overflow-x: auto; }
.tabelle { overflow-x: auto; margin: var(--s3) 0; -webkit-overflow-scrolling: touch; border: 1px solid var(--rand); border-radius: var(--rad-s); }
.tabelle table { border-collapse: collapse; width: 100%; font-size: var(--fs-s); }
.tabelle th, .tabelle td { padding: var(--s2) var(--s3); border-bottom: 1px solid var(--rand); vertical-align: top; text-align: left; }
.tabelle tr:last-child td { border-bottom: 0; }
.tabelle th { background: var(--flaeche-2); font-weight: 650; }
.bilder { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: var(--s2); margin: var(--s4) 0; }
.bilder button { position: relative; padding: 0; border: 1px solid var(--rand); border-radius: var(--rad-m); overflow: hidden; background: #fff; cursor: zoom-in; aspect-ratio: 4 / 3; }
.bilder img { display: block; width: 100%; height: 100%; object-fit: contain; }
.bilder .lupe { position: absolute; right: 6px; bottom: 6px; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center;
  background: rgba(0, 0, 0, .55); color: #fff; }
.bilder .lupe svg { width: 16px; height: 16px; }
.quellen { margin-top: var(--s4); font-size: var(--fs-s); color: var(--text-2); }
.quellen summary { cursor: pointer; min-height: 32px; display: flex; align-items: center; }
.quellen ul { margin: var(--s1) 0 0; padding-left: 1.2em; }

.kartenfuss { border-top: 1px solid var(--rand); background: var(--flaeche-2); padding: var(--s3) var(--s4); }
@media (min-width: 720px) { .kartenfuss { padding: var(--s3) var(--s5); } }
.kartenfuss .zeile { display: flex; align-items: center; justify-content: space-between; gap: var(--s2); margin-bottom: var(--s2); }
.segment { display: grid; grid-template-columns: repeat(5, 1fr); gap: 2px; padding: 2px; background: var(--flaeche-3); border-radius: var(--rad-m); }
.segment button { min-height: 40px; padding: 2px 4px; border: 0; border-radius: 10px; background: transparent; color: var(--text-2);
  font-size: var(--fs-xs); font-weight: 650; line-height: 1.15; cursor: pointer; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; }
.segment button .punkt { width: 8px; height: 8px; border-radius: 50%; background: var(--farbe); }
.segment button[aria-pressed="true"] { background: var(--flaeche); color: var(--farbe); box-shadow: var(--schatten-1); }
.segment button .vor { font-size: 9px; font-weight: 600; color: var(--text-2); }
@media (min-width: 720px) { .segment button { flex-direction: row; font-size: var(--fs-s); } }

.lernaktionen { position: fixed; z-index: 15; left: 0; right: 0; bottom: 0; padding: var(--s3) var(--s4) calc(var(--s3) + var(--unten));
  background: color-mix(in srgb, var(--flaeche) 94%, transparent); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-top: 1px solid var(--rand); }
.lernaktionen .innen { max-width: var(--inhalt-max); margin: 0 auto; display: grid; gap: var(--s2); grid-template-columns: 1fr 1fr; }
.lernaktionen .innen.drei { grid-template-columns: 1fr 1fr auto; }
.lernaktionen .innen.vor { grid-template-columns: auto 1fr; }

/* ---------- Statistik ---------- */
.kacheln { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--s2); }
@media (min-width: 720px) { .kacheln { grid-template-columns: repeat(4, 1fr); gap: var(--s3); } }
.kachel { padding: var(--s3) var(--s4); }
.kachel .wert { font-size: var(--fs-xxl); font-weight: 750; font-variant-numeric: tabular-nums; line-height: 1.1; }
.kachel .bez { font-size: var(--fs-s); color: var(--text-2); }
.zeilen { list-style: none; margin: 0; padding: 0; }
.zeilen li { padding: var(--s3) 0; border-top: 1px solid var(--rand); }
.zeilen li:first-child { border-top: 0; padding-top: 0; }
.zeilen li:last-child { padding-bottom: 0; }
.zeilen .kopfzeile { display: flex; justify-content: space-between; gap: var(--s3); align-items: baseline; }
.zeilen .name { font-weight: 600; min-width: 0; overflow-wrap: anywhere; }
.zeilen .zahlen { font-size: var(--fs-s); color: var(--text-2); white-space: nowrap; font-variant-numeric: tabular-nums; }
.balken { display: flex; height: 8px; border-radius: var(--rad-voll); overflow: hidden; background: var(--flaeche-3); margin-top: var(--s2); }
.balken span { display: block; height: 100%; }
.balken .g { background: var(--gut); } .balken .a { background: var(--warn); }
.legende .punkt { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 4px; vertical-align: -1px; }
.legende .g { background: var(--gut); } .legende .a { background: var(--warn); } .legende .n { background: var(--flaeche-3); }
.erledigt { opacity: .55; }

/* ---------- Overlays ---------- */
.vollbild { position: fixed; inset: 0; z-index: 50; background: rgba(5, 10, 13, .94); display: flex; align-items: center; justify-content: center; overflow: auto; }
.vollbild img { max-width: 100%; max-height: 100%; object-fit: contain; background: #fff; touch-action: pinch-zoom; cursor: zoom-in; }
.vollbild.zoom { align-items: flex-start; justify-content: flex-start; }
.vollbild.zoom img { max-width: none; max-height: none; cursor: zoom-out; }
.vollbild .schliessen { position: fixed; top: calc(var(--s3) + env(safe-area-inset-top, 0px)); right: var(--s3); z-index: 51; width: var(--ziel); height: var(--ziel);
  border-radius: 50%; border: 0; background: rgba(255, 255, 255, .92); color: #000; display: grid; place-items: center; cursor: pointer; }
.vollbild .schliessen svg { width: 22px; height: 22px; }
dialog { border: 1px solid var(--rand); border-radius: var(--rad-l); background: var(--flaeche); color: var(--text); width: min(480px, calc(100vw - 32px));
  padding: var(--s5); box-shadow: var(--schatten-2); }
dialog::backdrop { background: rgba(5, 10, 13, .55); }
dialog h2 { margin-bottom: var(--s2); }
dialog .knopfreihe { justify-content: flex-end; margin-top: var(--s4); }
label.feld { display: block; font-weight: 600; font-size: var(--fs-s); margin: var(--s3) 0 var(--s1); }
textarea, input[type=password], input[type=text] { width: 100%; padding: var(--s3); border-radius: var(--rad-m); border: 1px solid var(--rand-stark); background: var(--flaeche); }
textarea:focus, input:focus { outline: none; border-color: var(--primaer); box-shadow: var(--fokus); }
.toast { position: fixed; z-index: 60; left: 50%; transform: translateX(-50%); bottom: calc(var(--nav-h) + var(--unten) + 84px);
  max-width: calc(100vw - 32px); padding: var(--s2) var(--s4); border-radius: var(--rad-m); background: var(--text); color: var(--bg);
  font-size: var(--fs-m); font-weight: 550; box-shadow: var(--schatten-2); }
body.fokus .toast { bottom: calc(var(--unten) + 96px); }
@media (min-width: 720px) { .toast { bottom: 96px; } }
.laden { display: flex; justify-content: center; padding: var(--s6) 0; color: var(--text-2); }
.logo-grund { fill: var(--primaer); } .logo-kreuz { fill: var(--primaer-fg); }

/* Tabellen in Lösungen: nie mitten im Wort umbrechen, bei Bedarf horizontal scrollen (mit Scroll-Schatten) */
.md .tabelle { overflow-x: auto; overscroll-behavior-x: contain;
  background: linear-gradient(to right, var(--flaeche) 30%, transparent) left / 24px 100% no-repeat local,
              linear-gradient(to left, var(--flaeche) 30%, transparent) right / 24px 100% no-repeat local,
              radial-gradient(farthest-side at 0 50%, rgba(16, 33, 43, .18), transparent) left / 10px 100% no-repeat scroll,
              radial-gradient(farthest-side at 100% 50%, rgba(16, 33, 43, .18), transparent) right / 10px 100% no-repeat scroll; }
.md .tabelle table { width: max-content; min-width: 100%; max-width: none; }
.md .tabelle th, .md .tabelle td { overflow-wrap: normal; word-break: normal; hyphens: manual; min-width: 9rem; max-width: 22rem; }
.md .tabelle th:first-child, .md .tabelle td:first-child { min-width: 0; white-space: nowrap; font-weight: 650; }

/* Angemeldeter Benutzer in der Kopfzeile (dezent; im Fokusmodus auf dem Handy ausgeblendet) */
.benutzer { display: inline-flex; align-items: center; gap: 4px; min-width: 0; max-width: 40vw; font-size: var(--fs-s); color: var(--text-2); white-space: nowrap; }
.benutzer svg { width: 16px; height: 16px; flex: none; }
#benutzername { overflow: hidden; text-overflow: ellipsis; }
body.fokus .benutzer { display: none; }
@media (min-width: 720px) {
  .benutzer { max-width: 220px; }
  body.fokus .benutzer { display: inline-flex; padding-left: var(--s2); border-left: 1px solid var(--rand); }
}
