/* Betreiber-Bereich: Grundsatz und Rahmen (nach der Vorschau „Betreiber“). Nur Tokens aus gemeinsam/css/tokens.css –
   keine feste Farbe, kein fester Radius (Test t8). */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body { background: var(--bg); color: var(--text); font-family: var(--f-body); font-size: var(--fs-basis); line-height: 1.5; min-height: 100vh; }
[hidden] { display: none !important; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3 { font-family: var(--f-head); font-weight: var(--w-head); margin: 0; line-height: 1.2; text-wrap: balance; }
h1 { font-size: var(--fs-h1); }
h2 { font-size: var(--fs-h2); }
h3 { font-size: var(--fs-h3); }
p { margin: 0; overflow-wrap: anywhere; }
h1:focus, h2:focus, main:focus { outline: none; }
:focus-visible { outline: 3px solid var(--fokus); outline-offset: 2px; }
.sym { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
html[data-laden] .app { visibility: hidden; }
.app { min-height: 100vh; }
.laden-text { padding: 24px 16px; color: var(--muted); }

.einzeln {
  max-width: 1180px; margin: 0 auto; padding: var(--g4) max(16px, env(safe-area-inset-right, 0px)) 48px max(16px, env(safe-area-inset-left, 0px));
  display: flex; flex-direction: column; gap: var(--g3); min-width: 0;
}
.karte.anmelden { max-width: 520px; width: 100%; margin: 0 auto; }

/* Kopf */
.kopf { display: flex; flex-direction: column; gap: var(--g2); }
.kopf-zeile { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.marke { display: flex; align-items: center; gap: 10px; font-weight: 700; font-family: var(--f-head); }
.marke-zeichen { width: 32px; height: 32px; border-radius: var(--r-s); background: var(--primary); color: var(--on-primary); display: grid; place-items: center; }
.abstand { flex: 1; }
.bereich-titel { margin-top: var(--g2); }

/* Reiter wie in der Vorschau (umbrechend, kein waagerechtes Scrollen) */
.reiter { display: flex; flex-wrap: wrap; gap: 8px; margin-top: var(--g2); }
.reiter-knopf {
  min-height: 44px; padding: 0 16px; border-radius: var(--r-s); border: 1px solid var(--line); background: var(--surface);
  color: var(--text); font-weight: 600; cursor: pointer;
}
.reiter-knopf[aria-current="page"] { background: var(--text); color: var(--bg); border-color: var(--text); }

.bildschirm { display: flex; flex-direction: column; gap: var(--g3); min-width: 0; }
.meldungen:empty { display: none; }
.sr-titel { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Statistik nach Zustand */
.statistik { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 12px 14px; display: flex; flex-direction: column; gap: 2px; }
.stat strong { font-size: 1.5rem; }

.spalten { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--g4); }
@media (min-width: 900px) { .spalten { grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); } }
.raster2, .raster3 { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--g3); }
@media (min-width: 700px) { .raster2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .raster3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } }

/* Zeilen-Listen */
.zeilen { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.zeilen > li { padding: 12px 14px; }
.zeilen > li + li { border-top: 1px solid var(--line); }
.zeilen > li.karte { border-radius: 0; border: 0; box-shadow: none; }
.zeilen > li.karte + li.karte { border-top: 1px solid var(--line); }
.zeile-eintrag { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.zeile-haupt { min-width: 0; display: flex; flex-direction: column; gap: 2px; overflow-wrap: anywhere; }
.zeile-eintrag > .zeile-haupt { flex: 1 1 220px; }
.kopfzeile-detail { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; }
.kopfzeile-detail > h2, .kopfzeile-detail > h3 { flex: 1 1 200px; overflow-wrap: anywhere; }

/* Zustandsmarke: Zeichen + Text */
.zustand { white-space: nowrap; }
.zustand-zeichen { font-weight: 700; }

/* Schlüssel-Werte */
.kv { display: grid; grid-template-columns: minmax(0, 1fr); gap: 2px 16px; }
@media (min-width: 560px) { .kv { grid-template-columns: max-content minmax(0, 1fr); } }
.kv-k { color: var(--muted); font-size: var(--fs-klein); }
.kv-w { overflow-wrap: anywhere; }
@media (min-width: 560px) { .kv-k { font-size: inherit; } }

.aktionen { display: flex; flex-wrap: wrap; gap: 8px; }
.aktionen .knopf[aria-pressed="true"] { border-color: var(--primary-text); box-shadow: 0 0 0 1px var(--primary-text); }
.tafel { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r); padding: var(--g3); }

/* Felder, die bausteine.css nicht abdeckt */
.feld input[type="date"], .feld input[type="number"] {
  min-height: 48px; padding: 10px 12px; border-radius: var(--r-s); border: 1px solid var(--muted); background: var(--surface); color: var(--text); width: 100%;
}
.feld input[aria-invalid="true"], .feld select[aria-invalid="true"] { border-color: var(--err); box-shadow: 0 0 0 1px var(--err); }
.feld-hilfe:empty { display: none; }
.haken { display: flex; gap: 10px; align-items: flex-start; min-height: 44px; cursor: pointer; }
.haken input { width: 22px; height: 22px; margin-top: 2px; flex: none; accent-color: var(--primary); }

/* Modul-Kacheln */
.kacheln { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 8px; }
.kachel {
  min-height: 56px; display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 10px 12px 10px 40px; position: relative;
  border-radius: var(--r-s); border: 1px solid var(--line); background: var(--surface); color: var(--text); font-weight: 600; text-align: left; cursor: pointer;
}
.kachel[aria-pressed="true"] { background: var(--primary-soft); border-color: var(--primary-text); }
.kachel:disabled { cursor: not-allowed; }
.kachel-haken {
  position: absolute; left: 10px; top: 12px; width: 20px; height: 20px; border-radius: var(--r-s); border: 1.5px solid var(--muted);
  display: grid; place-items: center; font-size: .8rem; color: var(--on-primary);
}
.kachel[aria-pressed="true"] .kachel-haken { background: var(--primary); border-color: var(--primary); }

/* Einmal-Anzeige */
.geheimnis-karte { border-color: var(--warn); }
.geheimnis-block { display: flex; flex-direction: column; gap: 6px; }
.geheimnis {
  display: block; font-family: var(--f-mono); font-size: 1.05rem; padding: 12px 14px; border-radius: var(--r-s); background: var(--surface-2);
  border: 1px dashed var(--line); overflow-wrap: anywhere; word-break: break-all; user-select: all;
}
.brief { white-space: pre-wrap; font-size: var(--fs-klein); padding: 12px 14px; border-radius: var(--r-s); background: var(--surface-2); border: 1px solid var(--line); }

/* Protokoll */
.protokoll { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); }
.protokoll-eintrag { display: flex; flex-wrap: wrap; gap: 4px 12px; padding: 10px 14px; overflow-wrap: anywhere; }
.protokoll-eintrag + .protokoll-eintrag { border-top: 1px solid var(--line); }
.protokoll > li.leise { padding: 10px 14px; }

/* Dialog: Code-Feld */
.dialog .code { min-height: 48px; padding: 10px 12px; border-radius: var(--r-s); border: 1px solid var(--muted); background: var(--surface); color: var(--text); }
.einrichten { display: flex; flex-wrap: wrap; gap: var(--g3); align-items: center; }
.qr { background: var(--bild-flaeche); border-radius: var(--r-s); padding: 8px; }
.geheim { font-family: var(--f-mono); overflow-wrap: anywhere; }

/* P3-K3: Bausteine der Vorschau V4 (Tarif-Karten, Schritte, Wartezeit, Zähler, Verweis, leere Liste) */
.tarife { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; }
@media (min-width: 560px) { .tarife { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.tarif {
  text-align: left; padding: 14px 14px 14px 46px; position: relative; border-radius: var(--r); border: 1px solid var(--line); background: var(--surface);
  color: var(--text); cursor: pointer; display: flex; flex-direction: column; gap: 4px; min-height: 44px; font: inherit;
}
.tarif[aria-checked="true"] { border-color: var(--primary-text); box-shadow: 0 0 0 1px var(--primary-text); background: var(--primary-soft); }
.tarif strong { font-size: 1rem; }
.tarif-punkt { position: absolute; left: 14px; top: 16px; width: 20px; height: 20px; border-radius: var(--r-kreis); border: 2px solid var(--muted); }
.tarif[aria-checked="true"] .tarif-punkt { border-color: var(--primary); box-shadow: inset 0 0 0 4px var(--surface), inset 0 0 0 10px var(--primary); }
.schritte { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; counter-reset: s; }
.schritte li { counter-increment: s; display: flex; align-items: center; gap: 6px; font-size: var(--fs-klein); font-weight: 600; color: var(--muted); padding: 4px 10px 4px 4px; border-radius: var(--r-rund); background: var(--surface-2); }
.schritte li::before { content: counter(s); width: 22px; height: 22px; border-radius: var(--r-kreis); display: grid; place-items: center; background: var(--surface); border: 1px solid var(--line); }
.schritte li[aria-current="step"] { color: var(--primary-text); background: var(--primary-soft); }
.schritte li[aria-current="step"]::before { background: var(--primary); color: var(--on-primary); border-color: var(--primary); }
.schritte li.erledigt::before { content: "✓"; background: var(--ok-soft); color: var(--ok); border-color: var(--ok); }
.warten { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.warten-ring { width: 64px; height: 64px; border-radius: var(--r-kreis); display: grid; place-items: center; font-weight: 700; font-size: 1.125rem; border: 4px solid var(--line); border-top-color: var(--primary-text); flex: none; }
input.code { font-size: 1.5rem; letter-spacing: .3em; font-variant-numeric: tabular-nums; max-width: 12ch; }
.zaehler { font-size: var(--fs-klein); color: var(--muted); }
.verweis { background: none; border: 0; padding: 0; color: var(--primary-text); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; min-height: 44px; cursor: pointer; font: inherit; }
.leer { padding: 32px 16px; text-align: center; display: flex; flex-direction: column; gap: 8px; align-items: center; color: var(--muted); }
.leer h3 { color: var(--text); }
.zahl { font-variant-numeric: tabular-nums; }
.tafel.stapel { display: flex; flex-direction: column; gap: 10px; }
.feld textarea { min-height: 88px; padding: 10px 12px; border-radius: var(--r-s); border: 1px solid var(--muted); background: var(--surface); color: var(--text); width: 100%; resize: vertical; }
.feld textarea[aria-invalid="true"] { border-color: var(--err); box-shadow: 0 0 0 1px var(--err); }
.feld input:focus-within, .feld select:focus, .feld textarea:focus { outline: 3px solid var(--fokus); outline-offset: 2px; }
dl.kv { margin: 0; }
dl.kv dd { margin: 0 0 6px; }
@media (min-width: 560px) { dl.kv dd { margin: 0; } }
.notiz-text { flex: 1 1 220px; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.feld > .segment { align-self: flex-start; }
