/* DKEK-Prüfung – Handy zuerst (docs/UX-HANDY-VORGABE.md), hell und dunkel. Farben nur über die Variablen in :root.
   Keine externen Ressourcen und keine Einbindungen fremder Dateien; keine Deckkraft-Absenkung auf Inhalten. */

:root {
  color-scheme: light dark;
  --hg: #f3f4f6;        --flaeche: #ffffff;    --flaeche-2: #f6f7f9;
  --text: #16191d;      --leise: #535c68;      --rand: #d9dde3;     --rand-stark: #7c8593;
  --akzent: #1d5fc4;    --akzent-dunkel: #174c9d;                  --akzent-text: #ffffff;
  --fokus: #f59e0b;
  --rot: #b42318;   --rot-hg: #fdecea;   --rot-rand: #d05a4e;   --rot-voll: #b42318; --auf-rot: #ffffff;
  --gelb: #7a4a00;  --gelb-hg: #fff3d1;  --gelb-rand: #b07d00;
  --gruen: #1a7336; --gruen-hg: #e3f3e8; --gruen-rand: #3f9a5c;
  --grau: #4b5563;  --grau-hg: #eceef1;
  --blau: #1d5fc4;  --blau-hg: #e6eefb;  --blau-rand: #5b86c9;
  --lila: #6b3fa0;  --lila-hg: #f0e9f9;
  --auto: #0b6b60;  --auto-hg: #dcf3ee;    /* Sofort-Freigabe (türkis, eigene Farbe) */
  --nachricht-hg: #fffaf0; --nachricht-rand: #e0a800; --nachricht-alt-rand: #7c8593;
  --sonder-hg: #ffd6d6;    --sonder-text: #8c1010;
  --ins-hg: #d4f5dd;       --del-hg: #fbd9d9;
  --schatten: 0 1px 2px rgba(16, 24, 40, .06), 0 2px 10px rgba(16, 24, 40, .05);
  --schatten-leiste: 0 -2px 14px rgba(16, 24, 40, .12);
  --schatten-blatt: 0 -10px 40px rgba(0, 0, 0, .35);
  --backdrop: rgba(10, 12, 16, .62);
  --radius: 12px; --radius-klein: 9px;
  --ziel: 44px; --kopf: 52px; --leiste: 76px; --seitenrand: 12px;
  --schrift: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SFMono-Regular", "Cascadia Mono", Consolas, "Liberation Mono", monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --hg: #0f1115;      --flaeche: #181b21;    --flaeche-2: #1f232a;
    --text: #e8eaed;    --leise: #a3acb7;      --rand: #2f343c;     --rand-stark: #6f7886;
    --akzent: #5b9bff;  --akzent-dunkel: #3f82f0;                  --akzent-text: #0b1220;
    --fokus: #fbbf24;
    --rot: #ff8a80;   --rot-hg: #3a1a1a;   --rot-rand: #c24a3f;   --rot-voll: #ff8a80; --auf-rot: #1a0b0b;
    --gelb: #ffcf5c;  --gelb-hg: #33290f;  --gelb-rand: #b88a00;
    --gruen: #6fd08c; --gruen-hg: #16301f; --gruen-rand: #3a8c55;
    --grau: #b4bcc6;  --grau-hg: #2a2f37;
    --blau: #8ab4ff;  --blau-hg: #182842;  --blau-rand: #6f8fc8;
    --lila: #c9a7f5;  --lila-hg: #2c2140;
    --auto: #6fd9c8;  --auto-hg: #10322d;
    --nachricht-hg: #231f14; --nachricht-rand: #b88a00; --nachricht-alt-rand: #6f7886;
    --sonder-hg: #5a1d1d;    --sonder-text: #ffc4c4;
    --ins-hg: #1c3d26;       --del-hg: #4a1f1f;
    --schatten: 0 1px 2px rgba(0, 0, 0, .4);
    --schatten-leiste: 0 -2px 14px rgba(0, 0, 0, .55);
    --schatten-blatt: 0 -10px 40px rgba(0, 0, 0, .7);
    --backdrop: rgba(0, 0, 0, .7);
  }
}

@media (min-width: 400px) {
  :root { --seitenrand: 16px; }
}

/* Grundlagen ------------------------------------------------------------------------------------------------ */

*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%; text-size-adjust: 100%;
  scroll-padding-top: calc(var(--kopf) + 12px);
  scroll-padding-bottom: calc(var(--leiste-h, calc(var(--leiste) + env(safe-area-inset-bottom))) + 16px);
}

body {
  margin: 0;
  background: var(--hg);
  color: var(--text);
  font: 16px/1.5 var(--schrift);
  overflow-wrap: break-word;
}

a { color: var(--akzent); text-underline-offset: 2px; }
a:hover { color: var(--akzent-dunkel); }

h1, h2, h3 { line-height: 1.3; margin: 0 0 8px; }
h1 { font-size: 20px; font-weight: 800; }
h2 { font-size: 16px; font-weight: 800; }
h3 { font-size: 16px; font-weight: 800; margin-top: 16px; }
p { margin: 0 0 8px; }

:focus-visible { outline: 3px solid var(--fokus); outline-offset: 2px; }

[hidden] { display: none !important; }

.unsichtbar {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.leise { color: var(--leise); font-weight: normal; }
.klein { font-size: 14px; }
.mono { font-family: var(--mono); font-size: 14px; overflow-wrap: anywhere; }
.warn-text { color: var(--rot); font-weight: 700; }
.betrag { white-space: nowrap; }

.inhalt {
  max-width: 640px;
  margin: 0 auto;
  padding: 12px var(--seitenrand) calc(32px + env(safe-area-inset-bottom));
}
body.hat-leiste .inhalt { padding-bottom: calc(var(--leiste) + 24px + env(safe-area-inset-bottom)); }
/* Leiste mit Info- bzw. Statuszeile (Kernfragen/Artikel gewählt, erledigt e, angeschrieben f) ist höher */
body.hat-leiste.leiste-info .inhalt,
body.hat-leiste.leiste-status .inhalt { padding-bottom: calc(var(--leiste) + 64px + env(safe-area-inset-bottom)); }
/* Mit JS folgt der Platz der tatsächlichen Höhe der festen Leiste (app.js misst sie per ResizeObserver: Info-Zeilen,
   Statuszeile, Zoom, safe-area); 0, solange sie im Fluss steht. Ohne JS gelten die festen Zugaben oben. */
html.js body.hat-leiste.leiste-gemessen .inhalt { padding-bottom: calc(var(--leiste-h, 76px) + 24px); }

/* Kopf (eine Zeile, klebt) ---------------------------------------------------------------------------------- */

.kopf {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between; gap: 4px;
  min-height: var(--kopf); padding: 4px max(4px, calc((100% - 640px) / 2));
  background: var(--flaeche); border-bottom: 1px solid var(--rand);
}
.kopf a {
  display: inline-flex; align-items: center; gap: 6px; min-height: var(--ziel); padding: 0 10px;
  color: var(--text); text-decoration: none; font-weight: 600; border-radius: var(--radius-klein);
}
.kopf a:hover { background: var(--flaeche-2); }
.kopf .marke { font-weight: 800; }
.kopf-zurueck .pfeil { font-size: 24px; line-height: 1; margin-top: -3px; }
.navi { display: flex; align-items: center; gap: 2px; }
.navi a[aria-current="page"] { background: var(--grau-hg); }

.zahl {
  display: inline-block; min-width: 1.7em; padding: 0 .45em;
  border-radius: 999px; background: var(--grau-hg); color: var(--text);
  font-size: 13px; font-weight: 700; text-align: center; line-height: 1.6;
}
.zahl-alarm { background: var(--rot-voll); color: var(--auf-rot); }

/* Banner, Neuer-Stand-Streifen, Meldungen ------------------------------------------------------------------ */

.banner-liste { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1px; }
.banner {
  min-width: 0; font-weight: 700;
  padding: 8px max(var(--seitenrand), env(safe-area-inset-right)) 8px max(var(--seitenrand), env(safe-area-inset-left));
}
/* Einzeilig mit Auslassung – der volle Text steht auf der Zielseite (Status bzw. Angebot) */
.banner a {
  color: inherit; display: block; position: relative; margin: -8px 0; min-height: var(--ziel); line-height: var(--ziel);
  text-decoration: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.banner-kritisch { background: var(--rot-voll); color: var(--auf-rot); }
.banner-kritisch a { padding-right: 22px; }
.banner-kritisch a::after { content: "›"; position: absolute; right: 0; top: 0; font-size: 20px; }
.banner-warnung { background: var(--gelb-hg); color: var(--gelb); border-bottom: 1px solid var(--gelb-rand); }
.banner-info { background: var(--blau-hg); color: var(--blau); }

.neu-hinweis {
  position: sticky; top: var(--kopf); z-index: 9;
  display: flex; justify-content: center;
  padding: 6px max(var(--seitenrand), env(safe-area-inset-right)) 6px max(var(--seitenrand), env(safe-area-inset-left));
  background: var(--blau-hg); border-bottom: 1px solid var(--blau-rand);
}

.meldung {
  padding: 12px 14px; border-radius: var(--radius-klein); border: 2px solid transparent; font-weight: 600;
}
.meldung-ok { background: var(--gruen-hg); color: var(--gruen); border-color: var(--gruen-rand); }
.meldung-fehler { background: var(--rot-hg); color: var(--rot); border-color: var(--rot-rand); }
.meldung-hinweis { background: var(--blau-hg); color: var(--blau); border-color: var(--blau-rand); }

/* Kästen ---------------------------------------------------------------------------------------------------- */

.kasten, .sperrkasten, .hinweis-kasten, .leer-karte {
  padding: 12px 14px; border-radius: var(--radius-klein); margin: 0 0 12px; border: 2px solid transparent;
}
.kasten > :last-child, .sperrkasten > :last-child, .hinweis-kasten > :last-child, .leer-karte > :last-child { margin-bottom: 0; }
.kasten-kritisch, .hinweis-kasten-kritisch { background: var(--rot-hg); border-color: var(--rot-rand); }
.kasten-warnung, .hinweis-kasten-warnung { background: var(--gelb-hg); border-color: var(--gelb-rand); }
.kasten-info, .hinweis-kasten-info { background: var(--blau-hg); border-color: var(--blau-rand); }
.sperrkasten-gelb { background: var(--gelb-hg); border-color: var(--gelb-rand); }
.sperrkasten-rot { background: var(--rot-hg); border-color: var(--rot-rand); }
.kasten-titel { font-weight: 800; margin-bottom: 4px; }
.kasten-kritisch .kasten-titel, .hinweis-kasten-kritisch .kasten-titel, .sperrkasten-rot .kasten-titel { color: var(--rot); }
.kasten-warnung .kasten-titel, .sperrkasten-gelb .kasten-titel { color: var(--gelb); }
.kasten-info .kasten-titel { color: var(--blau); }
.kasten-fuss { font-size: 14px; margin-top: 8px; }
.leer-karte { background: var(--flaeche-2); border: 2px dashed var(--rand-stark); }
.leer-karte .kasten-titel { font-size: 17px; }
.kasten a, .sperrkasten a:not(.knopf), .liste-hinweis a { display: inline-block; padding: 10px 2px; margin: -10px 0; }
.sperr-zeile { padding: 10px 0; color: var(--leise); }

/* Knöpfe und Formulare -------------------------------------------------------------------------------------- */

.knopf {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: var(--ziel); padding: 0 16px;
  border: 1px solid var(--rand-stark); border-radius: 10px;
  background: var(--flaeche); color: var(--text);
  font: inherit; font-size: 16px; font-weight: 700; line-height: 1.2; text-align: center; text-decoration: none;
  cursor: pointer; touch-action: manipulation;
}
.knopf:hover { background: var(--flaeche-2); color: var(--text); }
.knopf-voll { display: flex; width: 100%; }
.knopf-primaer { background: var(--akzent); border-color: var(--akzent); color: var(--akzent-text); }
.knopf-primaer:hover { background: var(--akzent-dunkel); border-color: var(--akzent-dunkel); color: var(--akzent-text); }
.knopf-umriss { border: 2px solid var(--blau-rand); color: var(--akzent); background: var(--flaeche); }
.knopf-umriss:hover { background: var(--blau-hg); color: var(--akzent); }
.knopf-ablehnen { border: 2px solid var(--rot-rand); color: var(--rot); background: var(--flaeche); }
.knopf-ablehnen:hover { background: var(--rot-hg); color: var(--rot); }
.knopf-ablehnen-voll { background: var(--rot-voll); border: 2px solid var(--rot-voll); color: var(--auf-rot); }
.knopf-ablehnen-voll:hover { background: var(--rot-voll); color: var(--auf-rot); }
.knopf:disabled, .knopf[disabled], .knopf-gesperrt {
  background: var(--grau-hg); border: 1px solid var(--rand-stark); color: var(--leise); cursor: not-allowed;
}
.knopf-zweizeilig { flex-direction: column; gap: 0; }
.knopf-zeile2 { display: block; font-size: 13px; font-weight: 600; }

.knopf-link {
  min-height: var(--ziel); padding: 0 8px; border: 0; background: none;
  color: inherit; font: inherit; font-weight: 700; text-decoration: underline; cursor: pointer;
}
.link-ziel { display: inline-flex; align-items: center; min-height: var(--ziel); padding: 0 4px; margin: -12px 0; }
.knopf-zeile { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.knopf-zeile .knopf, .knopf-zeile form { flex: 1 1 12rem; margin: 0; }
.knoepfe { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; }

.feld { display: grid; gap: 4px; margin-bottom: 12px; font-weight: 600; }
.feld input, .feld textarea, .feld select, .suche input {
  width: 100%; min-height: var(--ziel); padding: 8px 12px;
  border: 1px solid var(--rand-stark); border-radius: var(--radius-klein);
  background: var(--flaeche); color: var(--text); font: inherit; font-size: 16px; font-weight: normal;
}
.feld textarea { min-height: 5rem; resize: vertical; }
select, input, textarea { font-size: 16px; }

.haken {
  display: flex; align-items: flex-start; gap: 12px; min-height: var(--ziel); padding: 10px 0; cursor: pointer;
  font-weight: 600;
}
.haken input { width: 24px; height: 24px; margin: 0; flex: none; accent-color: var(--akzent); }
.haken-kasten { padding-top: 2px; padding-bottom: 2px; }
.haken-kasten .haken input { accent-color: var(--rot); }

.feld-fehler { outline: 2px solid var(--rot-rand); outline-offset: 2px; background: var(--rot-hg); border-radius: var(--radius-klein); }
.feld-fehler.haken { padding-left: 8px; padding-right: 8px; }
.feld-meldung { color: var(--rot); font-weight: 700; margin: 8px 0 12px; }

/* Aufklapper (allgemein) und Abschnitte --------------------------------------------------------------------- */

details > summary { list-style: none; cursor: pointer; }
details > summary::-webkit-details-marker { display: none; }
.aufklapp { margin: 4px 0 8px; }
.aufklapp > summary {
  display: flex; align-items: center; gap: 8px; min-height: var(--ziel); padding: 6px 0;
  color: var(--akzent); font-weight: 700;
}
.aufklapp > summary::after, .abschnitt > summary::after, .suche-auf > summary::after {
  content: ""; flex: none; width: 9px; height: 9px; margin: 0 6px 4px auto;
  border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg);
}
.aufklapp[open] > summary::after, .abschnitt[open] > summary::after { transform: rotate(-135deg); margin-bottom: -4px; }
.suche-auf > summary::after { display: none; }
.suche-auf .suche-offen, .suche-auf[open] .suche-zu { display: none; }
.suche-auf[open] .suche-offen { display: inline; }

.abschnitte-titel { font-size: 14px; font-weight: 800; color: var(--leise); margin: 24px 2px 8px; }
.abschnitte { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; }
.abschnitt { background: var(--flaeche); border: 1px solid var(--rand); border-radius: var(--radius); }
.abschnitt > summary { display: flex; align-items: center; gap: 10px; min-height: 60px; padding: 10px 14px; color: var(--leise); }
.abschnitt > summary h2 { flex: 1; min-width: 0; margin: 0; font-size: 16px; font-weight: 800; color: var(--text); }
.abschnitt-zeile { display: block; font-size: 14px; font-weight: 400; color: var(--leise); margin-top: 2px; }
.abschnitt[open] > summary { border-bottom: 1px solid var(--rand); }
.abschnitt-inhalt { padding: 12px 14px 14px; }
.abschnitt-inhalt > :last-child { margin-bottom: 0; }
.ton-sperre, .ton-achtung { border: 2px solid var(--gelb-rand); }
.ton-sperre .abschnitt-zeile, .ton-achtung .abschnitt-zeile { color: var(--gelb); font-weight: 700; }
.ton-fehler { border: 2px solid var(--rot-rand); }
.ton-fehler .abschnitt-zeile { color: var(--rot); font-weight: 700; }
.ton-ok .abschnitt-zeile { color: var(--gruen); font-weight: 700; }
.ton-geaendert { border: 2px solid var(--blau-rand); }
.ton-geaendert .abschnitt-zeile, .abschnitt-geaendert { color: var(--blau); font-weight: 700; }

/* Etiketten und Chips --------------------------------------------------------------------------------------- */

.etiketten { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.etikett {
  display: inline-block; padding: 1px 9px; border-radius: 999px;
  font-size: 13px; font-weight: 700; line-height: 1.6; white-space: nowrap; overflow-wrap: normal;
  background: var(--grau-hg); color: var(--grau);
}
.etikett-rot { background: var(--rot-hg); color: var(--rot); }
.etikett-gelb { background: var(--gelb-hg); color: var(--gelb); }
.etikett-gruen { background: var(--gruen-hg); color: var(--gruen); }
.etikett-grau { background: var(--grau-hg); color: var(--grau); }
.etikett-blau { background: var(--blau-hg); color: var(--blau); }
.etikett-lila { background: var(--lila-hg); color: var(--lila); }
.etikett-auto { background: var(--auto-hg); color: var(--auto); }   /* Sofort-Freigabe: „Automatisch“ */

.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; }
.chip {
  display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 14px; line-height: 1.5;
  background: var(--flaeche-2); border: 1px solid var(--rand); color: var(--text);
}
.chip-stark { background: var(--blau-hg); border-color: var(--blau-rand); color: var(--blau); font-weight: 700; }
.chip-grau { background: var(--grau-hg); color: var(--text); }

.marge { white-space: nowrap; }
.marge-plus { color: var(--gruen); font-weight: 700; }
.marge-minus { color: var(--rot); font-weight: 700; }

/* Detail: Lage ---------------------------------------------------------------------------------------------- */

.lage { margin-bottom: 12px; }
.lage > .meldung { margin-bottom: 12px; }
.lage-zeile { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; margin: 0 2px; font-size: 14px; color: var(--leise); }
.lage-karte {
  border-radius: var(--radius); padding: 14px 16px; margin-bottom: 12px; border: 2px solid var(--rand-stark);
  background: var(--flaeche);
}
.lage-kopf { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; margin-bottom: 6px; }
.lage-meta { font-size: 14px; color: var(--leise); }
.lage-titel { font-size: 18px; font-weight: 800; margin-bottom: 8px; }
.lage-sperre { font-size: 16px; color: var(--text); }
/* Die ?m=-Meldung als erste Zeile der Lage-Karte (6.2): kein eigener Kasten davor */
.lage-karte > .meldung { margin: -4px -6px 10px; padding: 8px 10px; border-width: 1px; }
/* „evtl. veraltet“ als eine gelbe Zeile, die Erklärung klappt auf (6.2) */
.veraltet-zeile { margin: 0 0 12px; padding: 0 12px; background: var(--gelb-hg); border: 1px solid var(--gelb-rand); border-radius: var(--radius-klein); color: var(--gelb); }
.veraltet-zeile > summary { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 8px; min-height: var(--ziel); padding: 6px 0; font-size: 14px; font-weight: 700; }
.veraltet-zeile .veraltet-warum { margin-left: auto; text-decoration: underline; }
.veraltet-zeile > p { color: var(--text); margin: 0 0 10px; }
.lage-gelb { background: var(--gelb-hg); border-color: var(--gelb-rand); }
.lage-rot { background: var(--rot-hg); border-color: var(--rot-rand); }
.lage-gruen { background: var(--gruen-hg); border-color: var(--gruen-rand); }
.lage-blau { background: var(--blau-hg); border-color: var(--blau-rand); }
.lage-lila { background: var(--lila-hg); border-color: var(--rand-stark); }
.lage-grau { background: var(--flaeche); border-color: var(--rand-stark); }
.lage-karte .knopf-zeile { margin-top: 12px; flex-wrap: nowrap; }
/* Zwei Knöpfe nebeneinander (erster Bildschirm), lange Texte umbrechen im Knopf statt die Zeile zu sprengen */
.lage-karte .knopf-zeile > * { flex: 1 1 0; min-width: 0; }
.lage-karte .knopf-zeile .knopf { padding: 4px 10px; }
.lage-karte .knopf-zeile .knopf-umriss { flex: 0 1 auto; }
.entscheidung-aendern { background: var(--flaeche); border: 1px solid var(--rand); border-radius: var(--radius); padding: 0 14px; }
.entscheidung-aendern[open] { padding-bottom: 14px; }
.entscheidung-aendern .entscheiden { margin-top: 4px; }

/* Schritte */
.schritte { list-style: none; margin: 10px 0 12px; padding: 0; display: grid; gap: 10px; }
.schritt { display: grid; grid-template-columns: 26px minmax(0, 1fr); gap: 10px; align-items: start; }
.schritt-zeichen {
  width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--rand-stark); background: var(--flaeche);
  display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 800; line-height: 1;
  color: var(--leise);
}
.schritt-erledigt .schritt-zeichen { background: var(--gruen); border-color: var(--gruen); color: var(--flaeche); }
.schritt-laeuft .schritt-zeichen { border-color: var(--gelb-rand); color: var(--gelb); }
.schritt-gescheitert .schritt-zeichen { background: var(--rot-voll); border-color: var(--rot-voll); color: var(--auf-rot); }
/* „unklar“ (ohne klare Antwort, kann DKEK erreicht haben): eigenes Zeichen „?“, gestrichelter gelber Rand */
.schritt-unklar .schritt-zeichen { border: 2px dashed var(--gelb-rand); background: var(--gelb-hg); color: var(--gelb); }
.schritt-titel { display: block; font-weight: 700; }
.schritt-offen .schritt-titel { font-weight: 600; color: var(--leise); }
.schritt-unter { display: block; font-size: 14px; color: var(--leise); }
.schritte-kompakt { display: flex; flex-wrap: wrap; gap: 6px 14px; margin: 6px 0 0; }
.schritte-kompakt .schritt { display: flex; gap: 6px; align-items: center; }
.schritte-kompakt .schritt-zeichen { width: 22px; height: 22px; font-size: 13px; }
.schritte-kompakt .schritt-unter { display: none; }
.schritte-kompakt .schritt-unklar .schritt-unter { display: block; }     /* der Zusatz sagt, was unklar ist */

/* Detail: Kopfkarte ------------------------------------------------------------------------------------------ */

.kopfkarte {
  display: grid; grid-template-columns: 76px minmax(0, 1fr); gap: 10px 12px; padding: 12px;
  background: var(--flaeche); border: 1px solid var(--rand); border-radius: var(--radius); box-shadow: var(--schatten);
  margin-bottom: 12px;
}
.kopf-bild { display: block; width: 76px; height: 76px; border-radius: var(--radius-klein); overflow: hidden; background: var(--grau-hg); }
.kopf-bild img, .kopf-bild .bild-platzhalter { width: 76px; height: 76px; object-fit: cover; display: flex; min-height: 0; }
.kopfkarte h1 { font-size: 19px; line-height: 1.3; margin: 0; align-self: center; }
.kennzahlen { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; margin: 0; }
.kennzahlen > div { background: var(--flaeche-2); border-radius: var(--radius-klein); padding: 6px 10px; min-width: 0; }
.kennzahlen dt { font-size: 13px; color: var(--leise); }
.kennzahlen dd { margin: 0; font-weight: 800; font-size: 18px; white-space: nowrap; }
.kennzahlen .zusatz { font-size: 13px; font-weight: 700; color: var(--leise); }
.kopfkarte .chips { grid-column: 1 / -1; }
.kopf-artikel { grid-column: 1 / -1; font-size: 14px; color: var(--leise); margin: 0; }
.kopf-artikel-hinweis { color: var(--gelb); font-weight: 700; }

/* Detail: Blöcke --------------------------------------------------------------------------------------------- */

.block { margin-bottom: 12px; }
.block-titel {
  display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 4px 8px;
  margin: 0 2px 8px; font-size: 16px; font-weight: 800;
}
.block-titel .leise, .block-rechts { font-size: 14px; font-weight: 400; }
.unter-titel { font-weight: 800; margin: 12px 0 8px; }

.nachricht {
  white-space: pre-wrap; margin: 0; padding: 14px 16px; font-size: 17px; line-height: 1.55;
  background: var(--nachricht-hg); border: 1px solid var(--nachricht-rand); border-left-width: 5px;
  border-radius: var(--radius); color: var(--text);
}
.nachricht-alt { background: var(--flaeche-2); border-color: var(--rand); border-left-color: var(--nachricht-alt-rand); }
.fussnote { font-size: 14px; color: var(--leise); margin: 6px 2px 0; }
.sonder {
  display: inline-block; padding: 0 3px; margin: 0 1px; border-radius: 4px;
  background: var(--sonder-hg); color: var(--sonder-text);
  font-family: var(--mono); font-size: .8em; font-weight: 700; white-space: nowrap;
}

.karte {
  background: var(--flaeche); border: 1px solid var(--rand); border-radius: var(--radius);
  box-shadow: var(--schatten); padding: 14px; margin-bottom: 12px;
}

/* Hinweise (Pakete) */
.hinweise-block .hinweis-kasten { margin-bottom: 8px; }
.paket-hinweise { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; }
.paket-hinweise li { display: grid; gap: 2px; justify-items: start; }
.hinweis-text { white-space: pre-wrap; font-weight: 700; color: var(--text); }
.hinweis-wo { font-size: 14px; color: var(--leise); }

/* Positionen, Zeilen */
.positionen { list-style: none; margin: 0 0 12px; padding: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; }
.position {
  display: grid; gap: 3px; justify-items: start; padding: 10px 12px;
  background: var(--flaeche); border: 1px solid var(--rand); border-left: 5px solid var(--rand-stark);
  border-radius: 10px;
}
.position.rolle-gruen { border-left-color: var(--gruen-rand); }
.position.rolle-blau { border-left-color: var(--blau-rand); }
.position.rolle-grau { border-left-color: var(--rand-stark); }
.position.rolle-rot { border-left-color: var(--rot-rand); }
.position-name { font-weight: 700; }
.position-meta { font-size: 14px; color: var(--leise); }
.position-rechnung { font-size: 15px; }

.zeilen { margin: 0; display: grid; }
.zeilen > div { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 8px 0; border-top: 1px solid var(--rand); }
.zeilen > div:first-child { border-top: 0; }
.zeilen dt { color: var(--leise); overflow-wrap: normal; }
.zeilen dd { margin: 0; text-align: right; font-weight: 600; white-space: nowrap; }
.zeilen .summe { border-top: 2px solid var(--text); }
.zeilen .summe dt { color: var(--text); font-weight: 800; }

/* Anzeige prüfen */
.streifen {
  display: flex; gap: 8px; overflow-x: auto; scroll-snap-type: x mandatory;
  margin: 0 -14px 10px; padding: 0 14px 4px; -webkit-overflow-scrolling: touch;
}
.streifen > * { flex: none; scroll-snap-align: start; }
.streifen img, .streifen .bild-platzhalter { width: 150px; height: 112px; object-fit: cover; border-radius: var(--radius-klein); display: flex; }
.verkaeufer { font-size: 14px; color: var(--leise); margin: 0 0 4px; }
.zweizeilig { display: grid; min-width: 0; flex: 1; }
.anriss { font-size: 14px; font-weight: 400; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.anzeige-link { margin: 8px 0 0; }
.vorformatiert { white-space: pre-wrap; padding: 10px 12px; background: var(--flaeche-2); border-radius: var(--radius-klein); }

.bild-platzhalter {
  display: flex; align-items: center; justify-content: center;
  color: var(--leise); font-size: 13px; text-align: center; background: var(--grau-hg);
  border-radius: var(--radius-klein);
}

/* Entscheidungsblock und feste Aktionsleiste (6.9) --------------------------------------------------------- */

.entscheiden { margin: 16px 0 12px; }
.entscheidung-form { margin: 0; }
.bestaetigung { font-weight: 700; }
/* Wiedervorlage: „Nie wieder vorlegen“ hinter dem Formular (form=), bzw. kurzer Hinweis ohne Fähigkeit */
.endgueltig { margin-top: 12px; }
.endgueltig-text { font-size: 14px; color: var(--leise); margin: 0 2px 8px; }
.endgueltig-frei { padding: 12px; border: 1px solid var(--rand); border-radius: var(--radius); background: var(--flaeche); }
.endgueltig-frei .endgueltig-text { color: var(--text); }
.endgueltig .knopf { min-height: 52px; }
/* „Ablehnen“ mit zweiter Zeile „nur diesen Preis“ (Wiedervorlage): weniger Innenabstand, damit sie in der Leiste (2fr)
   in eine Zeile passt */
.knopf-ablehnen.knopf-zweizeilig, .knopf-ablehnen-voll.knopf-zweizeilig { padding: 0 8px; }
.lage-warnung { margin: 8px 0 0; padding: 6px 10px; background: var(--gelb-hg); color: var(--gelb); font-weight: 700;
  border: 1px solid var(--gelb-rand); border-radius: var(--radius-klein); }
.warn-zeile { color: var(--gelb); font-weight: 700; }

.leiste {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  background: var(--flaeche); border-top: 1px solid var(--rand); box-shadow: var(--schatten-leiste);
  padding: 12px max(var(--seitenrand), calc((100% - 640px) / 2)) calc(12px + env(safe-area-inset-bottom));
}
.leiste-knoepfe { display: grid; grid-template-columns: 2fr 3fr; gap: 12px; }
.leiste-knoepfe.eins { grid-template-columns: 1fr; }
/* „Freigeben“ ist im DOM der erste Absende-Knopf (Enter auf einem Häkchen), links steht trotzdem immer „Ablehnen“. */
.leiste-knoepfe > .knopf-ablehnen, .leiste-knoepfe > .knopf-ablehnen-voll { order: -1; }
.leiste .knopf { min-height: 52px; font-size: 17px; }
.leiste .knopf-zweizeilig { font-size: 16px; }
.leiste .leiste-info { font-size: 14px; margin: 0 0 8px; display: flex; flex-wrap: wrap; align-items: center; gap: 0 4px; }
.leiste .leiste-info[data-leiste-kernfragen], .leiste .leiste-info-artikel {
  background: var(--blau-hg); color: var(--blau); padding: 0 6px 0 10px; border-radius: var(--radius-klein); font-weight: 700;
}
.leiste .leiste-info-css { display: none; background: var(--blau-hg); color: var(--blau); padding: 6px 10px; border-radius: var(--radius-klein); font-weight: 700; }
.leiste .leiste-info-css.zeigen { display: block; }
/* :has() steht immer in eigenen Regeln: Ein Browser ohne :has() (Safari < 15.4) verwirft sonst die ganze Liste –
   auch die Klassen-Selektoren, auf die app.js dort angewiesen ist. */
html:not(.js) body:has(input[name=kernfrage][data-vorher="1"]:not(:checked)) .leiste-info-css { display: block; }
html:not(.js) body:has(input[name=kernfrage][data-vorher="0"]:checked) .leiste-info-css { display: block; }
/* Zustand „Artikel gewählt“ (wie b): Wahlkarte angetippt, nicht übernommen → rechts „Artikel übernehmen“ statt
   „Freigeben“. Mit JS über body.artikel-gewaehlt, ohne JS über :has() (ohne :has() bleibt es wie bisher). */
.leiste .leiste-artikel, .leiste .leiste-info-artikel { display: none; }
.leiste .leiste-info-artikel > span { flex: 1 1 12rem; min-width: 0; padding: 4px 0; }
.leiste .leiste-info-artikel > .leiste-info-tun { flex: 0 0 auto; padding: 0; white-space: nowrap; }
body.artikel-gewaehlt .leiste .leiste-artikel { display: inline-flex; }
body.artikel-gewaehlt .leiste .leiste-info-artikel { display: flex; }
body.artikel-gewaehlt .leiste [data-freigeben], body.artikel-gewaehlt .leiste [data-leiste-kernfragen],
body.artikel-gewaehlt .leiste .leiste-info-css { display: none; }
html:not(.js) body:has(#artikel-waehlen input[name=produkt_id]:checked) .leiste .leiste-artikel { display: inline-flex; }
html:not(.js) body:has(#artikel-waehlen input[name=produkt_id]:checked) .leiste .leiste-info-artikel { display: flex; }
html:not(.js) body:has(#artikel-waehlen input[name=produkt_id]:checked) .leiste [data-freigeben] { display: none; }
html:not(.js) body:has(#artikel-waehlen input[name=produkt_id]:checked) .leiste .leiste-info-css { display: none; }
html:not(.js) body:has(#artikel-waehlen input[name=produkt_id]:checked) .inhalt {
  padding-bottom: calc(var(--leiste) + 88px + env(safe-area-inset-bottom));
}
.leiste-status { font-size: 15px; font-weight: 700; margin: 0 0 8px; }
.leiste-status-ok { color: var(--gruen); }
.leiste-status-achtung { color: var(--gelb); }
.knoepfe-fluss { margin-top: 12px; }
.knoepfe-fluss .knopf { min-height: 52px; }
/* Beim Tippen (iOS-Tastatur) steht die Leiste im Fluss am Ende des Formulars – mit JS über body.tippt, ohne JS über
   :has(:focus) (Browser, die bei offener Tastatur den Viewport verkleinern, z. B. Firefox Android). Im Querformat
   (niedrig) ebenso: eine feste Leiste nähme dort ein Drittel der Höhe. */
body.tippt .leiste { position: static; box-shadow: none; border-top: 0; padding: 12px 0 0; background: transparent; }
html:not(.js) body:has(:is(textarea, input[type=text], input[type=search]):focus) .leiste {
  position: static; box-shadow: none; border-top: 0; padding: 12px 0 0; background: transparent;
}
@media (max-height: 500px) and (orientation: landscape) {
  .leiste { position: static; box-shadow: none; border-top: 0; padding: 12px 0 0; background: transparent; }
}

/* Freigabe-Blatt (6.10) ------------------------------------------------------------------------------------- */

.dialog {
  width: min(560px, calc(100vw - 32px)); max-height: calc(100vh - 32px); overflow: auto;
  padding: 20px; border: 1px solid var(--rand); border-radius: var(--radius);
  background: var(--flaeche); color: var(--text); box-shadow: var(--schatten-blatt);
}
.dialog::backdrop { background: var(--backdrop); }
.blatt { padding: 16px 16px 0; }
.blatt h2 { font-size: 20px; margin-bottom: 10px; }
.blatt .kurzinfo { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 10px; }
.blatt .kurzinfo > div { flex: 1 1 auto; min-width: 0; padding: 6px 10px; background: var(--flaeche-2); border-radius: var(--radius-klein); }
.blatt .kurzinfo dt { font-size: 13px; color: var(--leise); }
.blatt .kurzinfo dd { margin: 0; font-weight: 700; }
.nachricht-blatt { max-height: 40vh; max-height: 40dvh; overflow: auto; margin-bottom: 10px; }
.folge { margin: 0 0 8px; padding-left: 1.4rem; list-style: decimal; display: grid; gap: 6px; }
.folge .kombi-fragen { list-style: disc; padding-left: 1.2rem; margin: 4px 0 0; font-weight: 700; }
.blatt-knoepfe {
  position: sticky; bottom: 0; display: grid; grid-template-columns: 1fr 1.4fr; gap: 12px;
  margin: 12px -16px 0; padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  background: var(--flaeche); border-top: 1px solid var(--rand);
}
.blatt-knoepfe .knopf { min-height: 52px; font-size: 17px; }
.blatt .haken-kasten { margin-top: 8px; }

@media (max-width: 639px) {
  .blatt {
    width: 100%; max-width: 100%; margin: auto 0 0; max-height: 92vh; max-height: 92dvh;
    border-radius: 16px 16px 0 0; border-bottom: 0;
  }
}
@media (prefers-reduced-motion: no-preference) {
  .blatt[open] { animation: blatt-rein .18s ease-out; }
  @keyframes blatt-rein { from { transform: translateY(24px); } to { transform: none; } }
}

/* Artikel ----------------------------------------------------------------------------------------------------- */

.stand-zeile { color: var(--leise); }
.wahlkarten { display: grid; gap: 8px; margin: 0 0 12px; min-width: 0; }
.wahlkarten.feld-fehler { padding: 8px; }
.wahlkarte {
  display: grid; grid-template-columns: 24px minmax(0, 1fr); gap: 2px 12px; padding: 12px;
  min-height: 56px; border: 2px solid var(--rand-stark); border-radius: 10px; background: var(--flaeche);
}
label.wahlkarte { cursor: pointer; }
.wahlkarte input { width: 24px; height: 24px; margin: 0; accent-color: var(--akzent); }
.wahlkarte:has(input:checked) { border-color: var(--blau-rand); background: var(--blau-hg); }
.wahlkarte-gewaehlt { border-color: var(--gruen-rand); background: var(--gruen-hg); }
.wahlkarte-neu { border-color: var(--blau-rand); background: var(--blau-hg); }
.wahlkarte-bisher { border-style: dashed; }
/* Nicht antippbare Karten (Artikelwechsel läuft): ohne Radio-Spalte und ohne radioähnliche Kreise */
.wahlkarte-info { grid-template-columns: minmax(0, 1fr); }
.wahlkarte-inhalt { display: grid; gap: 2px; min-width: 0; }
.wahlkarte-name { display: block; font-weight: 800; }
.wahlkarte-zeile { display: block; font-size: 15px; }
.wahlkarte-zeile.leise { font-size: 14px; }
.wahlkarte .etiketten-reihe { gap: 4px; margin-top: 2px; }
.wahlkarte .etiketten-reihe .etikett { font-size: 13px; padding: 0 8px; }
.haken-gewaehlt {
  width: 24px; height: 24px; border-radius: 50%; background: var(--gruen); color: var(--flaeche);
  display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 14px;
}
.liste-schlicht { list-style: none; margin: 0 0 8px; padding: 0; }
.liste-schlicht li { display: grid; gap: 2px; padding: 10px 2px; border-top: 1px solid var(--rand); }
.liste-schlicht li:first-child { border-top: 0; }

.liste-dl { display: grid; grid-template-columns: minmax(7rem, 38%) minmax(0, 1fr); gap: 6px 12px; margin: 0 0 8px; }
.liste-dl dt { color: var(--leise); overflow-wrap: normal; }
.liste-dl dd { margin: 0; min-width: 0; }

/* Kernfragen (6.13) ----------------------------------------------------------------------------------------- */

.fragen { list-style: none; display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; margin: 8px 0 12px; padding: 0; }
.fragen.feld-fehler { padding: 8px; }
.frage { border: 1px solid var(--rand-stark); border-radius: 10px; background: var(--flaeche); }
.frage-zeile {
  display: grid; grid-template-columns: 24px minmax(0, 1fr); gap: 4px 12px; padding: 12px; min-height: 56px; cursor: pointer;
}
.frage-zeile input { width: 24px; height: 24px; margin: 0; accent-color: var(--akzent); grid-row: 1 / span 4; }
.frage-zeile > :not(input) { grid-column: 2; }   /* auch mit mehr als 4 Zeilen (z. B. „Ankunft unklar“) rechts */
.frage-text { white-space: pre-wrap; font-weight: 700; }
.frage-meta { display: flex; flex-wrap: wrap; gap: 4px 6px; align-items: center; font-size: 14px; color: var(--leise); }
.frage-klein { font-size: 14px; color: var(--leise); }
.frage-folge { font-size: 14px; font-weight: 700; }
.frage-folge-an { color: var(--gruen); }
.frage-folge-aus { color: var(--leise); }
.frage-geaendert { display: none; font-size: 14px; font-weight: 700; color: var(--blau); }
.frage-zeile input:checked ~ .frage-folge-aus,
.frage-zeile input:not(:checked) ~ .frage-folge-an { display: none; }
.frage-zeile input:not(:checked) ~ .frage-text { text-decoration: line-through; color: var(--leise); }
.frage-zeile input[data-vorher="1"]:not(:checked) ~ .frage-geaendert,
.frage-zeile input[data-vorher="0"]:checked ~ .frage-geaendert { display: block; }
.frage:has(input[data-vorher="1"]:not(:checked)), .frage:has(input[data-vorher="0"]:checked) { border: 2px solid var(--blau-rand); }
.frage.nur-anzeige { display: grid; gap: 4px; padding: 12px; background: var(--flaeche-2); }
.frage.ist-aus .frage-text { text-decoration: line-through; color: var(--leise); }
.frage.veraltet { border-style: dashed; }
.frage.veraltet .frage-folge { color: var(--gelb); }
.frage.unklar { border: 2px dashed var(--gelb-rand); }
.frage.unklar.nur-anzeige .frage-folge { color: var(--gelb); }
.kernfragen-status { padding: 12px 14px; border-radius: var(--radius-klein); margin: 0 0 12px; border: 2px solid transparent; }
.kernfragen-status-ok { background: var(--gruen-hg); border-color: var(--gruen-rand); }
.kernfragen-status-laeuft { background: var(--blau-hg); border-color: var(--blau-rand); }
.kernfragen-status-fehler, .kernfragen-status-unklar { background: var(--rot-hg); border-color: var(--rot-rand); }
.kombi-block { margin-top: 12px; }
.anpassung-form .knopf-voll { margin-top: 8px; }

/* Verlauf, Versionen, Technik ------------------------------------------------------------------------------- */

.verlauf, .versionen-liste, .ereignisse { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
.verlauf-eintrag, .versionen-liste > li { padding-left: 12px; border-left: 3px solid var(--rand-stark); }
.verlauf-eintrag p, .versionen-liste p { margin-bottom: 4px; }
.ereignisse { gap: 6px; font-size: 14px; }
.ereignisse li { padding: 6px 0; border-top: 1px solid var(--rand); }
p.kommentar { font-style: italic; }
.zustellung { font-weight: 700; }
.zustellung-zugestellt { color: var(--gruen); }
.zustellung-fehler, .zustellung-unwirksam, .zustellung-abgelaufen { color: var(--rot); }
.zustellung-abgewiesen, .zustellung-ueberholt { color: var(--gelb); }
.zustellung-ersetzt { color: var(--leise); }

pre, .roh {
  white-space: pre-wrap; overflow-wrap: anywhere; margin: 6px 0;
  padding: 8px 10px; background: var(--flaeche-2); border: 1px solid var(--rand); border-radius: var(--radius-klein);
  font-family: var(--mono); font-size: 14px; max-height: 320px; overflow: auto;
}
.kompakt { margin: 0; padding-left: 1.1rem; }
.kompakt li { margin-bottom: 6px; }
.ausblenden { margin: 24px 0 0; text-align: center; }

/* Übersicht (5) --------------------------------------------------------------------------------------------- */

.reiter { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; margin: 0 0 12px; }
.reiter-feld {
  display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 50px; padding: 3px 2px;
  border-radius: 10px; background: var(--flaeche); border: 1px solid var(--rand-stark); color: var(--text);
  text-decoration: none; line-height: 1.25; font-size: 14px; font-weight: 700; text-align: center;
}
.reiter-feld .zahl { display: block; background: none; font-size: 15px; font-weight: 800; padding: 0; }
.reiter-feld[aria-current="page"] { background: var(--akzent); border-color: var(--akzent); color: var(--akzent-text); }
.reiter-feld[aria-current="page"] .zahl { color: var(--akzent-text); }

.liste-kopf { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; margin: 0 2px 10px; }
.liste-kopf h1 { font-size: 19px; margin: 0; }
.liste-kopf h1 .leise { font-size: 16px; }
.liste-werkzeuge { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
.liste-werkzeuge .knopf { min-height: var(--ziel); padding: 0 10px; font-size: 14px; border-width: 1px; }
.liste-kopf { position: relative; }
.liste-kopf.suche-offen { margin-bottom: 64px; }
.liste-kopf:has(.suche-auf[open]) { margin-bottom: 64px; }
.suche-auf .suche { position: absolute; left: 0; right: 0; top: calc(100% + 8px); display: flex; gap: 8px; margin: 0; }
.suche input { flex: 1; min-width: 0; }
.liste-hinweis { font-size: 14px; color: var(--leise); margin: 0 2px 10px; }

.gruppe { margin-bottom: 16px; }
.gruppe-titel { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; font-size: 16px; margin: 0 2px 8px; }
.gruppe-unter { font-size: 14px; font-weight: 400; color: var(--leise); }
.gruppe-achtung .gruppe-titel { color: var(--rot); }

.karten { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; }
.k {
  display: grid; grid-template-columns: 64px minmax(0, 1fr) 14px; column-gap: 12px; row-gap: 2px; align-items: start;
  padding: 12px; background: var(--flaeche); border: 1px solid var(--rand); border-radius: var(--radius);
  color: var(--text); text-decoration: none; box-shadow: var(--schatten);
}
a.k:hover { border-color: var(--rand-stark); color: var(--text); }
/* Titel und Preis neben dem Bild; Marge, Ort, Etiketten, Grund und Fortschritt über die volle Breite (kompakt) */
.k-text { display: contents; }
.k-bild, .k .bild-platzhalter { grid-column: 1; grid-row: 1 / span 2; width: 64px; height: 64px; border-radius: var(--radius-klein); object-fit: cover; }
.k-titel, .k-preis { grid-column: 2; }
.k-zeile, .k-meta, .k .etiketten, .k-grund, .k-fortschritt { grid-column: 1 / -1; }
.k-titel {
  font-weight: 700; font-size: 16px; line-height: 1.3; overflow: hidden;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}
.k-preis { font-size: 15px; align-self: start; }
.k-zeile { margin-top: 4px; }
.k-zeile, .k-meta, .k-grund, .k-fortschritt { font-size: 14px; }
.k-meta { color: var(--leise); margin-top: 2px; }
.k-grund-gelb { color: var(--gelb); font-weight: 600; }
.k-grund-rot { color: var(--rot); font-weight: 600; }
.k-grund-wv { color: var(--gruen); font-weight: 600; }
.k-grund-frueher { color: var(--blau); font-weight: 600; }   /* früher abgelehnt (Prüfbefund C): ruhig */
.k-fortschritt { color: var(--blau); font-weight: 600; }
.k .etiketten { margin-top: 2px; gap: 4px 6px; }
.k .etikett { white-space: normal; }
.k-rest { font-size: 13px; color: var(--leise); }
.k-pfeil { grid-column: 3; grid-row: 1 / span 2; align-self: center; font-size: 24px; color: var(--leise); line-height: 1; }
.k-wahl { grid-template-columns: 24px 64px minmax(0, 1fr); cursor: pointer; }
.k-wahl > input { grid-column: 1; grid-row: 1 / span 2; width: 24px; height: 24px; margin: 20px 0 0; accent-color: var(--akzent); }
.k-wahl .k-bild, .k-wahl .bild-platzhalter { grid-column: 2; }
.k-wahl .k-titel, .k-wahl .k-preis { grid-column: 3; }
.k-wahl:has(input:checked) { border: 2px solid var(--blau-rand); background: var(--blau-hg); }
.mehr { text-align: center; margin: 12px 0; }

/* Vergleich (8) ---------------------------------------------------------------------------------------------- */

.tabelle-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 8px 0; }
.tabelle { width: 100%; border-collapse: collapse; font-size: 15px; }
.tabelle th, .tabelle td { padding: 8px; border-bottom: 1px solid var(--rand); text-align: left; vertical-align: top; }
.tabelle th { overflow-wrap: normal; }
.tabelle thead th { color: var(--leise); font-weight: 700; font-size: 14px; }
.tabelle tr.geaendert { background: var(--gelb-hg); }
.markierung {
  display: inline-block; margin-left: 4px; padding: 0 6px; border-radius: 999px;
  background: var(--gelb-hg); color: var(--gelb); border: 1px solid var(--gelb-rand); font-size: 13px; font-weight: 700;
}
.vergleich-tabelle { border-collapse: separate; border-spacing: 0; }
.vergleich-tabelle th[scope="row"] {
  position: sticky; left: 0; z-index: 1; background: var(--flaeche); min-width: 96px; color: var(--leise); font-weight: 700;
}
.vergleich-tabelle td { min-width: 170px; }
/* Versionsvergleich schmal: jede Zeile gestapelt – Feldname als Kopf, darunter „alt“ und „neu“ (wie die Auswahl oben),
   keine abgeschnittene dritte Spalte */
@media (max-width: 479px) {
  .gestapelt, .gestapelt tbody, .gestapelt tr, .gestapelt th, .gestapelt td { display: block; }
  .gestapelt thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .gestapelt tr { padding: 8px 10px; border-bottom: 1px solid var(--rand); }
  .gestapelt th, .gestapelt td { padding: 0; border: 0; min-width: 0; }
  .gestapelt th[scope="row"], .vergleich-tabelle.gestapelt th[scope="row"] {
    position: static; background: none; color: var(--text); min-width: 0; margin-bottom: 4px;
  }
  .gestapelt td { display: grid; grid-template-columns: 3.2rem minmax(0, 1fr); gap: 8px; padding: 2px 0; }
  .gestapelt td::before { color: var(--leise); font-size: 14px; }
  .gestapelt td:nth-of-type(1)::before { content: "alt"; }
  .gestapelt td:nth-of-type(2)::before { content: "neu"; }
  .gestapelt-konflikt td { grid-template-columns: 7.5rem minmax(0, 1fr); }
  .gestapelt-konflikt td:nth-of-type(1)::before { content: "Schnappschuss"; }
  .gestapelt-konflikt td:nth-of-type(2)::before { content: "später gemeldet"; }
  .gestapelt tr.geaendert td:nth-of-type(2) { font-weight: 700; }
}
.vergleich-bild { width: 100%; max-width: 160px; height: 100px; object-fit: cover; border-radius: var(--radius-klein); display: block; }
.vergleich-tabelle .bild-platzhalter { height: 100px; max-width: 160px; }
.vergleich-tabelle .knopf { margin-top: 6px; }

/* Versionsvergleich (7) --------------------------------------------------------------------------------------- */

.versionswahl { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 8px; margin-bottom: 12px; }
.versionswahl .feld { margin: 0; min-width: 7rem; flex: 1; }
.diff { white-space: pre-wrap; padding: 12px 14px; background: var(--flaeche-2); border-radius: var(--radius-klein); line-height: 1.6; font-size: 16px; }
.diff ins { background: var(--ins-hg); text-decoration: none; border-radius: 3px; }
.diff del { background: var(--del-hg); text-decoration: line-through; border-radius: 3px; }
.kopf-titel { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; }

/* Status (9) -------------------------------------------------------------------------------------------------- */

.ampel { border-radius: var(--radius); padding: 14px 16px; margin-bottom: 12px; border: 2px solid var(--rand-stark); }
.ampel-gruen { background: var(--gruen-hg); border-color: var(--gruen-rand); }
.ampel-gelb { background: var(--gelb-hg); border-color: var(--gelb-rand); }
.ampel-rot { background: var(--rot-hg); border-color: var(--rot-rand); }
.ampel h2 { font-size: 18px; }
.ampel ul { list-style: none; margin: 0; padding: 0; }
.ampel li a { display: flex; align-items: center; min-height: var(--ziel); gap: 8px; font-weight: 700; }
.alarm { padding: 12px 14px; margin-bottom: 8px; border-radius: var(--radius-klein); border: 2px solid var(--rand-stark); background: var(--flaeche); }
.alarm-kritisch { border-color: var(--rot-rand); background: var(--rot-hg); }
.alarm-warnung { border-color: var(--gelb-rand); background: var(--gelb-hg); }
.alarm-titel { font-weight: 800; }
.alarm .roh { font-family: var(--schrift); font-size: 14px; }
.alarm .knopf-zeile form { flex: 1 1 10rem; }

/* Anmeldung ---------------------------------------------------------------------------------------------------- */

.login {
  max-width: 400px; margin: 8vh auto 0; padding: 24px;
  background: var(--flaeche); border: 1px solid var(--rand); border-radius: var(--radius); box-shadow: var(--schatten);
}
.login h1 { margin-bottom: 16px; }
.login .knopf { width: 100%; min-height: 52px; }
.login .meldung-fehler { padding: 12px 14px; border-radius: var(--radius-klein); border: 2px solid var(--rot-rand); background: var(--rot-hg); color: var(--rot); }
.zurueck a { display: inline-flex; align-items: center; min-height: var(--ziel); }

/* Sehr schmal (200 % Zoom auf dem Handy, ~195 px, Vorgabe 13): nichts überlappt, kein waagrechter Seiten-Scroll.
   Reiter und Kopf brechen um, Etiketten und Beträge dürfen umbrechen (Zahl und „€“ trennt das geschützte
   Leerzeichen trotzdem nie). */
.kopf, .navi { flex-wrap: wrap; }
.reiter-feld { min-width: 0; overflow-wrap: anywhere; hyphens: auto; }
@media (max-width: 300px) {
  :root { --seitenrand: 8px; }
  /* lange Wörter („preisentscheidend“, „Widersprüchliche“) dürfen hier umbrechen – sonst wird die Seite breiter */
  body, .etikett, .zeilen dt, .liste-dl dt, .tabelle th { overflow-wrap: anywhere; hyphens: auto; }
  .etikett, .betrag, .marge, .kennzahlen dd, .zeilen dd, .sonder { white-space: normal; }
  .ampel li a { flex-wrap: wrap; gap: 0 8px; }
  .abschnitt-inhalt { padding: 10px 8px 12px; }
  .frage-zeile { padding: 10px 8px; gap: 4px 8px; }
  .wahlkarte { padding: 10px 8px; gap: 2px 8px; }
  .kopf a { padding: 0 6px; }
  .kennzahlen { grid-template-columns: minmax(0, 1fr); }
  .knopf { padding: 0 8px; overflow-wrap: anywhere; }
  .leiste-knoepfe { grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); gap: 6px; }
  .leiste-knoepfe:not(.eins) { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .leiste .knopf { font-size: 14px; padding: 0 4px; overflow-wrap: normal; min-height: var(--ziel); }
  .leiste { padding: 6px var(--seitenrand) calc(6px + env(safe-area-inset-bottom)); }
  .leiste-status, .leiste .leiste-info { font-size: 13px; margin-bottom: 4px; }
  .leiste .knopf-zweizeilig { font-size: 14px; }
  .leiste .knopf-zeile2 { font-size: 12px; }
  .k { grid-template-columns: 44px minmax(0, 1fr) 10px; column-gap: 8px; padding: 10px; }
  .k-bild, .k .bild-platzhalter { width: 44px; height: 44px; }
  .k-wahl { grid-template-columns: 24px 44px minmax(0, 1fr); }
  .kopfkarte { grid-template-columns: minmax(0, 1fr); }
  .kopf-bild { display: none; }                 /* die Bilder stehen unter „Anzeige prüfen“ – der Titel bekommt die Breite */
  .kopfkarte h1 { font-size: 17px; }
  .liste-dl { grid-template-columns: minmax(0, 1fr); gap: 0 8px; }
  .liste-dl dd { margin-bottom: 6px; }
  .zeilen > div { flex-wrap: wrap; }
  .schritt { grid-template-columns: 24px minmax(0, 1fr); gap: 6px; }
  .dialog { width: 100%; }
  /* Lage-Karte: zwei Knöpfe untereinander statt gestaucht (ein Buchstabe je Zeile) */
  .lage-karte .knopf-zeile { flex-wrap: wrap; }
  .lage-karte .knopf-zeile > *, .lage-karte .knopf-zeile .knopf-umriss { flex: 1 1 100%; }
  /* Der Kopf klebt nicht: zwei- bis dreizeilig verdeckte er den Streifen „neu laden“ und die Sprungziele */
  .kopf { position: static; }
  .neu-hinweis { top: 0; }
  html { scroll-padding-top: 12px; }
  /* Leiste „Artikel gewählt“ kürzer (der Name steht auf der angetippten Karte) */
  .leiste .leiste-info-artikel [data-artikel-name-zeile] { display: none; }
  /* Freigabe-Blatt: Knöpfe untereinander, Wörter nicht mitten im Wort trennen */
  .blatt-knoepfe { grid-template-columns: minmax(0, 1fr); gap: 6px; padding-top: 8px; }
  .blatt-knoepfe .knopf { min-height: var(--ziel); font-size: 15px; overflow-wrap: normal; }
}
@media (max-width: 280px) {
  .reiter { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; transition: none !important; animation: none !important; }
}
