:root {
  --bg: #f4f5f7; --flaeche: #ffffff; --flaeche2: #eceef2; --text: #14171c; --leise: #5d6470; --linie: #d9dde4;
  --akzent: #e0303e; --akzent-text: #ffffff; --gut: #168a4a; --warn: #b56b00; --schlecht: #c62a37; --info: #2b5fd9;
  --radius: 14px; --schatten: 0 1px 2px rgba(0,0,0,.06), 0 4px 14px rgba(0,0,0,.05);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1215; --flaeche: #181c21; --flaeche2: #20252c; --text: #eef0f3; --leise: #9aa3ae; --linie: #2b3139;
    --akzent: #ff4d5a; --gut: #3ccf7b; --warn: #f0a530; --schlecht: #ff5c68; --info: #6f9bff;
    --schatten: none; color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body { font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; -webkit-text-size-adjust: 100%; }
button, input, select { font: inherit; color: inherit; }

.kopf { position: sticky; top: 0; z-index: 5; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--linie); padding: max(10px, env(safe-area-inset-top)) 16px 0; }
.marke { font-weight: 700; letter-spacing: .01em; display: flex; align-items: center; gap: 8px; padding-bottom: 8px; }
.punkt { width: 10px; height: 10px; border-radius: 50%; background: var(--akzent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--akzent) 25%, transparent); }
.nav { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; }
.nav button { border: 0; background: none; padding: 10px 12px; border-bottom: 2px solid transparent; color: var(--leise); white-space: nowrap; cursor: pointer; }
.nav button[aria-current="page"] { color: var(--text); border-bottom-color: var(--akzent); font-weight: 600; }

.inhalt { max-width: 860px; margin: 0 auto; padding: 16px 16px calc(32px + env(safe-area-inset-bottom)); display: grid; gap: 14px; }
h1 { font-size: 1.35rem; margin: 6px 0 2px; }
h2 { font-size: 1.1rem; margin: 0; }
h3 { font-size: .95rem; margin: 8px 0 4px; color: var(--leise); font-weight: 600; }
p { margin: 0; }
.leise { color: var(--leise); font-size: .9rem; }
.karte { background: var(--flaeche); border: 1px solid var(--linie); border-radius: var(--radius); padding: 14px; box-shadow: var(--schatten); display: grid; gap: 12px; min-width: 0; }
.zeile { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; min-width: 0; }
.zeile.zwischen { justify-content: space-between; }
.raster2 { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }

.knopf { border: 1px solid var(--linie); background: var(--flaeche2); border-radius: 10px; padding: 10px 14px; min-height: 44px; cursor: pointer; font-weight: 600; }
.knopf:hover { filter: brightness(.97); }
.knopf:disabled { opacity: .45; cursor: not-allowed; }
.knopf.haupt { background: var(--akzent); color: var(--akzent-text); border-color: transparent; }
.knopf.gefahr { color: var(--schlecht); }
.knopf.klein { min-height: 36px; padding: 6px 10px; font-size: .9rem; }
.knopf.aktiv { outline: 2px solid var(--akzent); outline-offset: -2px; }
.knoepfe { display: flex; gap: 8px; flex-wrap: wrap; }
.szenen { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.szenen .knopf { padding: 8px 4px; }

label { display: grid; gap: 4px; font-size: .9rem; color: var(--leise); min-width: 0; }
input[type=text], input[type=password], input[type=number], select {
  width: 100%; min-height: 44px; border: 1px solid var(--linie); border-radius: 10px; padding: 8px 10px; background: var(--flaeche); color: var(--text); font-size: 16px; }
input[type=checkbox] { width: 20px; height: 20px; accent-color: var(--akzent); }
label.haken { display: flex; align-items: center; gap: 8px; color: var(--text); }

.pille { display: inline-flex; align-items: center; gap: 6px; border-radius: 999px; padding: 3px 10px; font-size: .82rem; font-weight: 600; background: var(--flaeche2); color: var(--leise); white-space: nowrap; }
.pille::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.pille.live { background: color-mix(in srgb, var(--akzent) 16%, transparent); color: var(--akzent); }
.pille.gut { background: color-mix(in srgb, var(--gut) 14%, transparent); color: var(--gut); }
.pille.warn { background: color-mix(in srgb, var(--warn) 16%, transparent); color: var(--warn); }
.pille.schlecht { background: color-mix(in srgb, var(--schlecht) 14%, transparent); color: var(--schlecht); }

details { border-top: 1px solid var(--linie); padding-top: 10px; }
summary { cursor: pointer; color: var(--leise); font-weight: 600; min-height: 32px; }
details[open] > summary { margin-bottom: 10px; }
.adresse { display: grid; gap: 8px; background: var(--flaeche2); border-radius: 10px; padding: 12px; }
.adresse code { font: 13px/1.4 ui-monospace, SFMono-Regular, Menlo, monospace; word-break: break-all; user-select: all; }
.qr { width: 220px; max-width: 100%; background: #fff; border-radius: 10px; padding: 6px; }
.qr svg { display: block; width: 100%; height: auto; }
.mittig { max-width: 420px; margin: 8vh auto 0; width: 100%; }
.meldung { position: fixed; left: 50%; bottom: max(16px, env(safe-area-inset-bottom)); transform: translateX(-50%); max-width: calc(100% - 32px);
  background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 10px; font-weight: 600; z-index: 10; }
.meldung.fehler { background: var(--schlecht); color: #fff; }
.balken { height: 6px; border-radius: 3px; background: var(--flaeche2); overflow: hidden; }
.balken > span { display: block; height: 100%; background: var(--gut); transition: width .4s; }
.stapel { display: grid; gap: 12px; }
.leer { text-align: center; padding: 24px; color: var(--leise); }
@media (max-width: 420px) { .szenen { grid-template-columns: repeat(2, 1fr); } }
