:root {
  --grund: #f4f6f8; --flaeche: #ffffff; --text: #1d232b; --leise: #5f6b78; --rand: #d3d9df;
  --akzent: #2f6fd0; --akzent-text: #ffffff; --offen: #c86a00; --gut: #2e7d32; --gefahr: #b3261e;
  --teil: #4c5d72; --boden: #e6ebf0; --warn-grund: #fff3e0;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --grund: #111418; --flaeche: #1a1f25; --text: #e6e9ed; --leise: #9aa5b1; --rand: #333c46;
    --akzent: #6c9cf0; --akzent-text: #0d1117; --offen: #f0a040; --gut: #6cc070; --gefahr: #f2867d;
    --teil: #a8b8cc; --boden: #232a32; --warn-grund: #3a2a12;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --grund: #111418; --flaeche: #1a1f25; --text: #e6e9ed; --leise: #9aa5b1; --rand: #333c46;
  --akzent: #6c9cf0; --akzent-text: #0d1117; --offen: #f0a040; --gut: #6cc070; --gefahr: #f2867d;
  --teil: #a8b8cc; --boden: #232a32; --warn-grund: #3a2a12;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--grund); color: var(--text); font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
button, input, textarea { font: inherit; color: inherit; }
svg { width: 22px; height: 22px; flex: none; }

.kopf { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 8px; min-height: 52px;
  padding: 6px 16px; padding-top: max(6px, env(safe-area-inset-top)); background: var(--flaeche); border-bottom: 1px solid var(--rand); }
.kopf h1 { flex: 1; margin: 0; font-size: 18px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.marke { font-weight: 800; letter-spacing: .02em; color: var(--akzent); }
.marke.gross { font-size: 28px; margin: 8px 0; }

.inhalt { max-width: 640px; margin: 0 auto; padding: 12px 16px 40px; }
.inhalt.mit-leiste { padding-bottom: calc(96px + env(safe-area-inset-bottom)); }
h2 { font-size: 15px; margin: 22px 0 8px; color: var(--leise); text-transform: uppercase; letter-spacing: .04em; }
p { margin: 8px 0; }
.leise { color: var(--leise); }
.klein { font-size: 13px; }
.hinweis { color: var(--leise); font-size: 14px; }
.tipp { display: block; color: var(--leise); font-size: 13px; margin: 2px 0 6px; }
.leer { color: var(--leise); text-align: center; padding: 24px 0; }
.warnung { background: var(--warn-grund); border: 1px solid var(--offen); color: var(--text); border-radius: 10px; padding: 8px 12px; }
.warn-klein { display: block; color: var(--offen); font-size: 13px; }
.gut-text { color: var(--gut); font-weight: 600; }

button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 8px 14px;
  border: 1px solid var(--rand); border-radius: 10px; background: var(--flaeche); cursor: pointer; }
button:active { transform: translateY(1px); }
button.haupt { background: var(--akzent); border-color: var(--akzent); color: var(--akzent-text); font-weight: 600; }
button.gefahr { color: var(--gefahr); }
button.breit { width: 100%; margin-top: 16px; }
button.symbol { min-width: 44px; padding: 8px; border: none; background: none; }
button.symbol.klein { min-height: 36px; min-width: 36px; }
button.leise-knopf { border: none; background: none; color: var(--akzent); }
button.link { border: none; background: none; padding: 0; min-height: 0; color: inherit; text-align: left; justify-content: flex-start; }
button:focus-visible, input:focus-visible { outline: 2px solid var(--akzent); outline-offset: 2px; }
.knopfreihe { display: flex; gap: 10px; flex-wrap: wrap; margin: 12px 0; }
.knopfreihe > button { flex: 1 1 140px; }

.feld { display: block; margin: 10px 0; }
.feld > span:first-child { display: block; font-size: 14px; color: var(--leise); margin-bottom: 4px; }
.feld input, .feld textarea { width: 100%; padding: 10px 12px; border: 1px solid var(--rand); border-radius: 10px; background: var(--flaeche); }
.formular .feld { margin: 12px 0; }

.zeile { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 6px 0; border-bottom: 1px solid var(--rand); }
.zeile.aktiv .name { color: var(--akzent); font-weight: 600; }
.zeile .name { flex: 1; min-width: 0; }
.eingabe { display: inline-flex; align-items: center; gap: 6px; }
.eingabe .zahl { width: 108px; text-align: right; padding: 9px 10px; border: 1px solid var(--rand); border-radius: 10px; background: var(--flaeche); font-variant-numeric: tabular-nums; }
.feld .eingabe .zahl { width: 130px; }
.eingabe .zahl::placeholder { color: var(--offen); opacity: .75; }
.einheit { color: var(--leise); font-size: 13px; width: 26px; }
.punkt { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.punkt.gut { background: var(--gut); }
.punkt.offen { background: none; border: 2px solid var(--offen); }

.planbox { background: var(--flaeche); border: 1px solid var(--rand); border-radius: 12px; padding: 6px; }
.planbox .plan { max-height: 42vh; }
.planbox.gross .plan { max-height: 60vh; }
.zaehler { text-align: center; color: var(--leise); font-size: 14px; margin: 6px 0 0; }
.zaehler-gross { font-size: 18px; font-weight: 600; }

details { margin-top: 18px; border-top: 1px solid var(--rand); padding-top: 6px; }
summary { cursor: pointer; padding: 8px 0; color: var(--leise); font-weight: 600; }
.gruppe { border: 1px solid var(--rand); border-radius: 12px; padding: 4px 12px 8px; margin: 8px 0; background: var(--flaeche); }
.gruppe-kopf { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 10px 0 6px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 10px 0; }
.chip { min-height: 36px; padding: 4px 12px; border-radius: 99px; font-size: 14px; }
.chip.an { border-color: var(--akzent); color: var(--akzent); font-weight: 600; }
.chip.offen { border-color: var(--offen); }
.wandwahl { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; }
.wandwahl .chip { flex: none; }

.segment { display: flex; flex-wrap: wrap; gap: 6px; }
.segment button { flex: 1 1 auto; min-height: 40px; }
.segment button.an { border-color: var(--akzent); color: var(--akzent); font-weight: 600; box-shadow: inset 0 0 0 1px var(--akzent); }

.wahlbilder { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.wahlbild { flex-direction: column; min-height: 110px; }
.wahlbild svg { width: 56px; height: 56px; }
.zaehlknopf { display: inline-flex; align-items: center; gap: 10px; }
.zaehlknopf b { min-width: 2ch; text-align: center; font-size: 20px; }
.zaehlknopf .symbol { border: 1px solid var(--rand); font-size: 22px; }
.wahlbild.an { border-color: var(--akzent); color: var(--akzent); box-shadow: inset 0 0 0 1px var(--akzent); }

.arten { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.artknopf { flex-direction: column; gap: 4px; min-height: 84px; padding: 8px 4px; font-size: 13px; text-align: center; }
.artknopf svg { width: 32px; height: 32px; }
.teilliste { display: flex; flex-direction: column; gap: 8px; }
.teilzeile, .karte { justify-content: flex-start; text-align: left; gap: 12px; padding: 10px 12px; width: 100%; }
.teilzeile .bild svg { width: 30px; height: 30px; }
.karte-text { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.karte-text b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.karten { display: flex; flex-direction: column; gap: 10px; }
.mini { width: 64px; height: 52px; flex: none; display: flex; align-items: center; }
.mini .plan { width: 64px; max-height: 52px; }
.mini .plan text { display: none; }
.teilkopf { display: flex; align-items: center; gap: 14px; margin: 6px 0 10px; }
.bild.gross svg { width: 48px; height: 48px; }
.haken { display: flex; align-items: center; gap: 10px; min-height: 44px; margin: 8px 0; }
.haken input { width: 22px; height: 22px; accent-color: var(--akzent); }

.fotoreihe { border-bottom: 1px solid var(--rand); padding-bottom: 8px; }
.daumen { display: flex; gap: 8px; flex-wrap: wrap; margin: 6px 0; }
.daumen-bild { padding: 0; width: 76px; height: 76px; overflow: hidden; border-radius: 8px; }
.daumen-bild img { width: 100%; height: 100%; object-fit: cover; }
#foto-dialog { border: none; border-radius: 12px; padding: 10px; background: var(--flaeche); color: var(--text); max-width: min(96vw, 900px); }
#foto-dialog img { max-width: 100%; max-height: 72vh; display: block; margin: 0 auto; border-radius: 8px; }
#foto-dialog::backdrop { background: #000a; }

.leiste { position: fixed; left: 0; right: 0; bottom: 0; z-index: 6; display: grid; grid-template-columns: repeat(4, 1fr);
  background: var(--flaeche); border-top: 1px solid var(--rand); padding-bottom: env(safe-area-inset-bottom); }
.leiste button { border: none; border-radius: 0; min-height: 56px; background: none; color: var(--leise); font-size: 14px; }
.leiste button.an { color: var(--akzent); font-weight: 700; box-shadow: inset 0 3px 0 var(--akzent); }

#meldung { position: fixed; left: 16px; right: 16px; bottom: calc(72px + env(safe-area-inset-bottom)); z-index: 9; margin: 0 auto; max-width: 560px;
  background: var(--text); color: var(--grund); padding: 10px 14px; border-radius: 10px; box-shadow: 0 4px 16px #0004; }

.plan .boden { fill: var(--boden); }
.plan .wand { stroke-linecap: round; }
.plan .w-offen { color: var(--offen); stroke: var(--offen); }
.plan .w-gut { color: var(--gut); stroke: var(--gut); }
.plan text { stroke: none; fill: currentColor; font-family: system-ui, sans-serif; }
.plan text.hinten { font-weight: 700; }
.plan .wand.aktiv { stroke: var(--akzent); }
.plan .diag { fill: none; opacity: .8; }
.plan .teil { fill: var(--teil); stroke: var(--teil); }
.plan .ecke { fill: var(--leise); }
.plan .treffer { stroke: transparent; cursor: pointer; }
.plan { width: 100%; height: auto; display: block; touch-action: manipulation; }
