:root {
  --bg:#f8fafc; --karte:#fff; --rand:#e2e8f0; --text:#0f172a; --leise:#64748b; --mittel:#475569;
  --teal:#0d9488; --tealdunkel:#0f766e; --tealhell:#ccfbf1;
  --rot:#b91c1c; --rothell:#fee2e2; --gelb:#92400e; --gelbhell:#fef3c7; --grau:#334155; --grauhell:#f1f5f9;
}
* { box-sizing:border-box; }
::selection { background:var(--tealhell); color:var(--text); }
html { scrollbar-color:#cbd5e1 var(--bg); }
body { margin:0; background:var(--bg); color:var(--text); font:15px/1.5 system-ui,-apple-system,"Segoe UI",sans-serif; }
main { max-width:1120px; margin:0 auto; padding:20px 16px 56px; }
a { color:var(--tealdunkel); text-underline-offset:3px; }
a:focus-visible, .knopf:focus-visible, summary:focus-visible { outline:2px solid var(--teal); outline-offset:2px; border-radius:6px; }
h1 { font-size:22px; line-height:1.25; margin:0; }
h2 { font-size:16px; margin:36px 0 4px; }
.unter { color:var(--leise); font-size:13px; margin:0 0 12px; max-width:72ch; }
.entwurf { background:var(--gelbhell); color:var(--gelb); border-radius:10px; padding:10px 14px; font-size:13px; margin:0 0 18px; }
.kopf { display:flex; flex-wrap:wrap; align-items:flex-end; justify-content:space-between; gap:8px 16px; }
.kopf .wer { font-size:13px; color:var(--leise); }
nav.reiter { display:flex; gap:2px; border-bottom:1px solid var(--rand); margin:14px 0 22px; overflow-x:auto; }
nav.reiter span { padding:8px 13px; font-size:14px; color:var(--leise); border-bottom:2px solid transparent; margin-bottom:-1px; white-space:nowrap; }
nav.reiter span.aktiv { color:var(--text); font-weight:600; border-color:var(--teal); }
.karte { background:var(--karte); border:1px solid var(--rand); border-radius:14px; }
.tab-wrap { overflow-x:auto; }
table { border-collapse:collapse; width:100%; font-size:14px; font-variant-numeric:tabular-nums; }
th, td { text-align:left; padding:9px 12px; border-bottom:1px solid var(--rand); vertical-align:top; }
tr:last-child td { border-bottom:0; }
th { font-size:12px; color:var(--leise); font-weight:600; background:#fbfdff; white-space:nowrap; }
td.person { font-weight:600; white-space:nowrap; }
td.person small { display:block; font-weight:400; color:var(--leise); font-size:12px; }
.zelle small { display:block; color:var(--leise); font-size:12px; }
.zelle .marke { margin-top:4px; }
td { min-width:96px; }
.marke { display:inline-block; font-size:12px; font-weight:600; padding:1px 8px; border-radius:999px; white-space:nowrap; }
.ok { color:var(--tealdunkel); background:var(--tealhell); }
.offen { color:var(--gelb); background:var(--gelbhell); }
.fehlt { color:var(--rot); background:var(--rothell); }
.aus { color:var(--mittel); background:var(--grauhell); font-weight:500; }
.quelle { color:var(--grau); background:var(--grauhell); font-weight:600; }
.beispiel { color:var(--gelb); background:transparent; border:1px dashed #d6b26b; font-weight:500; }
.abw { display:grid; gap:8px; padding:14px 16px; }
.abw div { display:flex; gap:10px; align-items:baseline; font-size:14px; }
.filter { display:flex; flex-wrap:wrap; gap:6px; padding:12px 14px; border-bottom:1px solid var(--rand); }
.knopf { border-radius:8px; padding:5px 12px; font-size:13px; border:1px solid #cbd5e1; background:#fff; color:var(--grau); cursor:pointer; }
.knopf.an { background:var(--teal); border-color:var(--teal); color:#fff; }
td.zeit { white-space:nowrap; color:var(--mittel); }
.wahl { display:grid; gap:14px; grid-template-columns:1fr; }
@media (min-width:820px){ .wahl { grid-template-columns:1fr 1fr; } }
.wahl .karte { padding:16px 18px; }
.wahl h3 { margin:0 0 6px; font-size:15px; }
.wahl ul { margin:8px 0 0; padding-left:18px; font-size:14px; }
.wahl li { margin-bottom:4px; }
.empf { border-color:var(--teal); box-shadow:0 1px 6px rgba(13,148,136,.12); }
.empf .tag { color:var(--tealdunkel); font-size:13px; font-weight:600; margin-top:10px; }
.stufen { padding:6px 18px 14px; font-size:14px; }
.stufen h3 { font-size:14px; margin:12px 0 4px; }
.stufen ul { margin:0; padding-left:18px; }
.stufen li { margin-bottom:3px; }
code { font-size:12px; background:var(--grauhell); padding:1px 5px; border-radius:4px; }

.kpis { display:grid; gap:12px; grid-template-columns:repeat(2,minmax(0,1fr)); margin:0 0 8px; }
@media (min-width:820px){ .kpis { grid-template-columns:repeat(4,minmax(0,1fr)); } }
.kpi { padding:14px 16px; }
.kpi .zahl { font-size:30px; font-weight:650; line-height:1.1; font-variant-numeric:tabular-nums; }
.kpi .was { font-size:13px; color:var(--mittel); margin-top:2px; }
.kpi .dazu { font-size:12px; color:var(--leise); margin-top:6px; }
.kpi.warn .zahl { color:var(--rot); }
.grafik { padding:14px 16px 10px; }
.grafik h3 { font-size:14px; margin:0 0 2px; }
.grafik p.u { font-size:12px; color:var(--leise); margin:0 0 10px; }
.grafik svg { display:block; width:100%; height:auto; overflow:visible; }
.grafik svg text { font:11px system-ui,-apple-system,"Segoe UI",sans-serif; fill:var(--leise); }
.grafik svg text.n { fill:var(--text); font-weight:600; }
.grafik svg .hit:hover + .mark, .grafik svg .mark:hover { stroke:var(--text); stroke-width:1.5; }
.zwei-g { display:grid; gap:14px; grid-template-columns:1fr; }
@media (min-width:900px){ .zwei-g { grid-template-columns:1fr 1fr; } }
.seg { display:flex; height:40px; border-radius:8px; overflow:hidden; gap:2px; background:var(--karte); }
.seg div { display:flex; align-items:center; justify-content:center; font-size:13px; font-weight:600; color:#fff; min-width:28px; }
.legende { display:flex; flex-wrap:wrap; gap:6px 16px; font-size:12px; color:var(--mittel); margin-top:10px; }
.legende i { display:inline-block; width:10px; height:10px; border-radius:3px; margin-right:6px; vertical-align:-1px; }
.grafik svg.klein { max-width:460px; }
.tip { position:fixed; pointer-events:none; background:var(--text); color:#fff; font-size:12px; padding:5px 8px; border-radius:6px; opacity:0; transition:opacity .12s ease-out; z-index:9; white-space:nowrap; }

/* Ergänzungen für die gebaute Fassung (nicht im Entwurf) */
nav.reiter a { padding:8px 13px; font-size:14px; color:var(--leise); border-bottom:2px solid transparent; margin-bottom:-1px; white-space:nowrap; text-decoration:none; }
nav.reiter a:hover { color:var(--text); border-color:#cbd5e1; }
nav.reiter a:focus-visible { outline:2px solid var(--teal); outline-offset:-2px; border-radius:6px; }
h2 { scroll-margin-top:12px; }
.kopf form { margin:0; }
.kopf .wer button { background:none; border:0; padding:0; color:var(--tealdunkel); text-decoration:underline; text-underline-offset:3px; font:inherit; cursor:pointer; }
a.knopf { text-decoration:none; display:inline-block; }
a.knopf:hover { border-color:var(--teal); color:var(--tealdunkel); }
a.knopf.an:hover { color:#fff; }
.knopf:active { transform:translateY(1px); }
button.knopf[aria-busy="true"] { opacity:.7; cursor:progress; }
.leer { padding:14px 16px; color:var(--leise); font-size:14px; }
.platzhalter { height:78px; display:flex; align-items:center; max-width:460px; border:1px dashed var(--rand); border-radius:8px; padding:0 12px; color:var(--leise); font-size:13px; }
.hinweis { background:var(--tealhell); color:var(--tealdunkel); border-radius:10px; padding:10px 14px; font-size:13px; margin:0 0 18px; }
.warnung { background:var(--rothell); color:var(--rot); border-radius:10px; padding:10px 14px; font-size:13px; margin:0 0 18px; }
details.zelle-mehr summary { list-style:none; cursor:pointer; }
details.zelle-mehr summary::-webkit-details-marker { display:none; }
details.zelle-mehr summary:hover .rolle { text-decoration:underline; text-underline-offset:3px; }
details.zelle-mehr[open] summary { margin-bottom:6px; }
.mehr-kasten { font-size:12px; color:var(--mittel); background:var(--grauhell); border-radius:8px; padding:8px 10px; min-width:200px; }
.mehr-kasten dl { display:grid; grid-template-columns:auto 1fr; gap:2px 10px; margin:0 0 6px; }
.mehr-kasten dt { color:var(--leise); }
.mehr-kasten dd { margin:0; }
.zelle .herkunft { display:block; color:var(--leise); font-size:11px; margin-top:4px; }
.ohne-soll { color:var(--leise); }
form.reihe { display:flex; flex-wrap:wrap; gap:10px 12px; align-items:flex-end; padding:14px 16px; }
form.reihe label, form.stapel label { display:flex; flex-direction:column; gap:3px; font-size:12px; color:var(--mittel); font-weight:600; }
input, select, textarea { font:inherit; font-size:14px; padding:6px 9px; border:1px solid #cbd5e1; border-radius:8px; background:#fff; color:var(--text); min-width:0; }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline:2px solid var(--teal); outline-offset:1px; border-color:var(--teal); }
form.stapel { display:grid; gap:12px; padding:16px 18px; max-width:520px; }
.knopf.haupt { background:var(--teal); border-color:var(--teal); color:#fff; font-weight:600; padding:7px 16px; }
.knopf.haupt:hover { background:var(--tealdunkel); }
.knopf.gefahr { color:var(--rot); border-color:#fca5a5; }
.knopf.gefahr:hover { background:var(--rothell); }
.anmeldung { max-width:400px; margin:9vh auto 0; }
.anmeldung h1 { margin-bottom:6px; }
.anmeldung .karte { margin-top:16px; }
.fehler { color:var(--rot); font-size:14px; margin:0; }
.qr { display:flex; justify-content:center; padding:6px 0; }
.qr svg { width:220px; height:220px; }
.geheimnis { font-family:ui-monospace,Consolas,monospace; font-size:13px; letter-spacing:.04em; word-break:break-all; background:var(--grauhell); padding:6px 9px; border-radius:6px; }
.fuss { margin-top:40px; font-size:12px; color:var(--leise); }
.weiter { padding:10px 14px; border-top:1px solid var(--rand); display:flex; gap:8px; }
.zurueck { font-size:14px; display:inline-block; margin-bottom:10px; }
@media (max-width:560px){ form.reihe label { flex:1 1 140px; } form.reihe input, form.reihe select { width:100%; } }
@media (prefers-reduced-motion:reduce){ .tip { transition:none; } }

/* Handy: breite Grafiken seitlich verschiebbar statt winziger Schrift; Tastflächen groß genug */
.breit { overflow-x:auto; }
.breit:focus-visible { outline:2px solid var(--teal); outline-offset:2px; border-radius:6px; }
@media (max-width:640px){ .breit svg { min-width:620px; } }
@media (pointer:coarse), (max-width:640px){
  .knopf { padding:10px 14px; }
  nav.reiter a { padding:12px 13px; }
  details.zelle-mehr summary { padding:6px 0; min-height:44px; }
  .mehr-kasten a { display:inline-block; padding:10px 0; }
  .kopf .wer button { padding:10px 2px; }
  td.person a { display:inline-block; padding:8px 0; }
  .zurueck { padding:10px 0; }
}

/* Matrix: Personenspalte bleibt beim seitlichen Schieben stehen */
table.matrix th:first-child, table.matrix td.person { position:sticky; left:0; z-index:1; background:var(--karte); box-shadow:1px 0 0 var(--rand); }
table.matrix th:first-child { background:#fbfdff; }
/* Ereignisliste auf dem Handy: eine Karte je Zeile statt sechs Spalten */
@media (max-width:640px){
  table.liste thead { display:none; }
  table.liste tr { display:grid; grid-template-columns:auto auto 1fr; gap:4px 10px; align-items:baseline; padding:10px 14px; border-bottom:1px solid var(--rand); }
  table.liste tr:last-child { border-bottom:0; }
  table.liste td { border:0; padding:0; min-width:0; }
  table.liste td:nth-child(3) { color:var(--mittel); }
  table.liste td:nth-child(4), table.liste td:nth-child(5) { grid-column:1 / -1; }
  table.liste td:empty { display:none; }
}

ol.codes { margin:0; padding:16px 18px 16px 44px; display:grid; grid-template-columns:repeat(2, minmax(0, 1fr)); gap:8px 24px; font-size:16px; }
ol.codes code { font-size:16px; letter-spacing:.04em; background:none; padding:0; }
@media (max-width:420px){ ol.codes { grid-template-columns:1fr; } }

form.quittung { display:inline; margin-left:8px; }
.knopf.klein { padding:2px 9px; font-size:12px; }

/* Grid-Kinder dürfen schrumpfen, sonst drückt die breite Grafik die Seite auf */
.zwei-g > *, .kpis > * { min-width:0; }
.breit { max-width:100%; }
