:root {
  --bg: #f7f5f2; --karte: #fff; --text: #1f2933; --leise: #6b7280; --linie: #e5e0da;
  --akzent: #0f766e; --koralle: #f2685a; --fehler: #b91c1c; --ok: #15803d;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #15191d; --karte: #1f252b; --text: #e8eaed; --leise: #9aa3ad; --linie: #333b44; --akzent: #2dd4bf; }
}
* { box-sizing: border-box; }
body { margin: 0; font: 16px/1.45 system-ui, -apple-system, "Segoe UI", sans-serif; background: var(--bg); color: var(--text); }
main { max-width: 960px; margin: 0 auto; padding: 1rem; }
a { color: var(--akzent); }
h1 { font-size: 1.6rem; margin: 0.5rem 0 1rem; }
input, select, button { font: inherit; padding: 0.55rem 0.7rem; border: 1px solid var(--linie); border-radius: 8px; background: var(--karte); color: var(--text); }
button { cursor: pointer; }
button.primaer { background: var(--akzent); color: #fff; border-color: var(--akzent); font-weight: 600; }
button.klein { padding: 0.25rem 0.6rem; font-size: 0.85rem; }
label { display: block; margin: 0 0 0.9rem; }
label > input:not([type=checkbox]), label > select { display: block; width: 100%; margin-top: 0.25rem; }
label.check { display: flex; gap: 0.5rem; align-items: center; }
fieldset { border: 1px solid var(--linie); border-radius: 10px; margin: 0 0 1rem; padding: 0.8rem; }
fieldset input[type=search] { width: 100%; }
table { width: 100%; border-collapse: collapse; background: var(--karte); border-radius: 10px; overflow: hidden; }
th, td { text-align: left; padding: 0.5rem 0.6rem; border-bottom: 1px solid var(--linie); vertical-align: middle; }
small { color: var(--leise); }
.icon { width: 1.4em; height: 1.4em; vertical-align: middle; }

.leiste { display: flex; flex-wrap: wrap; gap: 0.3rem 1rem; align-items: center; padding: 0.6rem 1rem; background: var(--karte); border-bottom: 1px solid var(--linie); }
.leiste a { text-decoration: none; color: var(--text); }
.leiste .marke { font-weight: 800; color: var(--koralle); margin-right: 0.5rem; }
.leiste .abmelden { margin-left: auto; }
.leiste .abmelden { display: flex; gap: 0.6rem; align-items: center; }
.leiste .abmelden button { border: none; background: none; color: var(--leise); padding: 0; }

.karte { background: var(--karte); border: 1px solid var(--linie); border-radius: 12px; padding: 1.2rem; margin-bottom: 1rem; }
.schmal { max-width: 360px; margin: 3rem auto; }
.schmal button { width: 100%; }
.fehler { color: var(--fehler); font-weight: 600; }
.ok { color: var(--ok); font-weight: 700; font-size: 1.2rem; }
.leer { color: var(--leise); }
.zeile { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 0.5rem 0 1rem; }
.zeile input:not([type=checkbox]) { flex: 1 1 10rem; }
.gefahr button { color: var(--fehler); border-color: var(--fehler); background: transparent; margin-top: 1.5rem; }
form.inline { display: inline; }

/* Öffentliches Panel: grosse Knöpfe */
.platz { text-align: center; }
#meldung { text-align: center; min-height: 2.2rem; }
#meldung p { margin: 0 0 0.5rem; }
.knoepfe { display: grid; grid-template-columns: repeat(auto-fill, minmax(9.5rem, 1fr)); gap: 0.9rem; margin-bottom: 1.5rem; }
.knopf {
  --farbe: var(--akzent);
  width: 100%; aspect-ratio: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.4rem;
  background: var(--farbe); color: #fff; border: none; border-radius: 22px; font-size: 1.15rem; font-weight: 700;
  box-shadow: 0 4px 0 rgb(0 0 0 / 0.2); transition: transform 0.08s, box-shadow 0.08s; -webkit-tap-highlight-color: transparent;
}
.knopf .icon { width: 3rem; height: 3rem; }
.knopf small { color: rgb(255 255 255 / 0.85); font-weight: 500; }
.knopf:active { transform: translateY(3px); box-shadow: 0 1px 0 rgb(0 0 0 / 0.2); }
.htmx-request .knopf { opacity: 0.6; }

/* Dashboard */
.status { display: inline-block; width: 0.7rem; height: 0.7rem; border-radius: 50%; background: var(--fehler); vertical-align: middle; }
.status.an { background: var(--ok); }
.ereignis { --farbe: var(--akzent); display: flex; align-items: center; gap: 1rem; background: var(--karte); border: 1px solid var(--linie); border-left: 6px solid var(--farbe); border-radius: 12px; padding: 0.8rem 1rem; margin-bottom: 0.7rem; }
.ereignis-icon { color: var(--farbe); }
.ereignis-icon .icon { width: 2.2rem; height: 2.2rem; }
.ereignis-text { flex: 1; display: flex; flex-direction: column; }
.ereignis-text strong { font-size: 1.2rem; }
.ereignis button { padding: 0.8rem 1.2rem; }
.filter { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 1rem; }

/* Admin */
.liste { list-style: none; padding: 0; margin: 0 0 1rem; }
.liste li { display: flex; align-items: center; gap: 0.5rem; background: var(--karte); border: 1px solid var(--linie); border-radius: 10px; padding: 0.5rem 0.8rem; margin-bottom: 0.4rem; }
.liste li > a { flex: 1; text-decoration: none; color: var(--text); font-weight: 600; }
.liste li.inaktiv { opacity: 0.55; }
.aktionen { display: flex; gap: 0.3rem; }
.aktionen button { padding: 0.2rem 0.6rem; }
.mit-icon { display: flex; align-items: center; gap: 0.6rem; }
.punkt { display: inline-flex; padding: 0.3rem; border-radius: 8px; color: #fff; }
.vorschau-zeile { max-width: 10rem; margin: 0 auto 1rem; }
.icon-gitter { display: grid; grid-template-columns: repeat(auto-fill, minmax(3rem, 1fr)); gap: 0.4rem; margin-top: 0.6rem; max-height: 16rem; overflow-y: auto; }
.icon-gitter button { padding: 0.5rem; }
.icon-gitter button.gewaehlt { outline: 3px solid var(--akzent); }
.platz-karte { display: flex; gap: 1rem; align-items: flex-start; }
.platz-karte > div { flex: 1; min-width: 0; }
.platz-karte img { background: #fff; border-radius: 6px; }
@media (max-width: 600px) { .platz-karte { flex-direction: column; } th:nth-child(1) { width: 2rem; } }
.hinweis { text-align: center; background: var(--karte); border: 1px solid var(--linie); border-radius: 10px; padding: 0.6rem; }
.ausgang-text { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.monat { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; margin-bottom: 1rem; }
td.zahl, th.zahl { text-align: right; font-variant-numeric: tabular-nums; }
tfoot td { font-weight: 700; }
.neuer-key { border-color: var(--akzent); }
.key { display: block; padding: 0.6rem; background: var(--bg); border-radius: 8px; overflow-wrap: anywhere; user-select: all; }
pre { overflow-x: auto; font-size: 0.85rem; }
.zeitraum { display: flex; gap: 0.4rem; flex-wrap: wrap; margin-bottom: 1rem; }
.zeitraum a { padding: 0.35rem 0.8rem; border: 1px solid var(--linie); border-radius: 999px; text-decoration: none; color: var(--text); background: var(--karte); }
.zeitraum a.aktiv { background: var(--akzent); border-color: var(--akzent); color: #fff; }
.kacheln { display: grid; grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr)); gap: 0.8rem; margin-bottom: 1rem; }
.kachel { background: var(--karte); border: 1px solid var(--linie); border-radius: 12px; padding: 0.8rem 1rem; display: flex; flex-direction: column; }
.kachel strong { font-size: 1.7rem; font-variant-numeric: tabular-nums; }
.statistik-gitter { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 22rem), 1fr)); gap: 0 1rem; }
.balken-liste { display: flex; flex-direction: column; gap: 4px; }
.balken-zeile { display: grid; grid-template-columns: minmax(4rem, 9rem) 1fr 3rem; gap: 0.6rem; align-items: center; padding: 2px 0; border-radius: 4px; }
.balken-zeile:hover { background: var(--bg); }
.balken-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 0.9rem; }
.balken-spur { height: 12px; }
.balken { display: block; height: 100%; background: var(--akzent); border-radius: 0 4px 4px 0; }
.balken-zahl { text-align: right; font-variant-numeric: tabular-nums; font-size: 0.9rem; color: var(--leise); }
.dashboard-kopf { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.5rem; }
.schalter { display: flex; gap: 0.5rem; flex-wrap: wrap; }
#ton.an { background: var(--akzent); border-color: var(--akzent); color: #fff; }
.benutzer-kopf { justify-content: space-between; align-items: center; margin-top: 0; }
.panel-wahl { display: flex; flex-wrap: wrap; gap: 0.3rem 1rem; align-items: center; }
.panel-wahl small { flex-basis: 100%; }
.panel-wahl label { margin: 0; }
.leiste .marke { display: inline-flex; align-items: center; gap: 0.45rem; }
.leiste .marke img { border-radius: 7px; }
.logo { display: block; width: 100%; max-width: 240px; height: auto; margin: 0 auto 0.5rem; border-radius: 16px; }
.schmal h1 { text-align: center; }
.fuss { display: flex; align-items: center; justify-content: center; gap: 0.4rem; margin: 2rem 0 0.5rem; color: var(--leise); font-size: 0.85rem; }
.fuss img { border-radius: 5px; }
/* Dashboard-Einstellungen */
.anzahl { color: var(--leise); font-weight: 600; }
.schalter button.an { background: var(--akzent); border-color: var(--akzent); color: #fff; }
.einstellungen h2 small { font-weight: 400; font-size: 0.85rem; }
.einst-gitter { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 14rem), 1fr)); gap: 0 1rem; }
.einst-gitter fieldset { margin-bottom: 0.8rem; }
.einst-gitter input[type=range] { width: 100%; padding: 0; }
.ereignis.spaet { border-color: var(--fehler); border-left-color: var(--farbe); background: color-mix(in srgb, var(--fehler) 8%, var(--karte)); }
.ereignis.spaet .warte { color: var(--fehler); font-weight: 700; }

/* Grosse Anzeige für Wand-Bildschirm */
body.gross .leiste { display: none; }
body.gross main { max-width: none; padding: 1.5rem 2rem; }
body.gross h1 { font-size: 2.6rem; }
body.gross #liste { display: grid; grid-template-columns: repeat(auto-fill, minmax(22rem, 1fr)); gap: 1rem; }
body.gross .ereignis { margin: 0; padding: 1.2rem 1.4rem; border-left-width: 10px; }
body.gross .ereignis-text strong { font-size: 2rem; }
body.gross .ereignis-platz { font-size: 1.5rem; }
body.gross .ereignis-text small { font-size: 1.1rem; }
body.gross .ereignis-icon .icon { width: 3.5rem; height: 3.5rem; }
body.gross .ereignis button { font-size: 1.3rem; padding: 1rem 1.4rem; }
body.gross .leer { font-size: 2rem; text-align: center; grid-column: 1 / -1; margin-top: 3rem; }
@media (max-width: 600px) { body.gross #liste { grid-template-columns: 1fr; } body.gross main { padding: 1rem; } }
.warte:not(:empty)::after { content: " ·"; }
body.gross .zeit, body.gross .warte::after { display: none; }

/* Gast: Deine Bestellungen */
.meine h2 { font-size: 1.1rem; margin: 0 0 0.5rem; }
.meine-liste { list-style: none; padding: 0; margin: 0 0 0.5rem; }
.meine-liste li { display: flex; justify-content: space-between; gap: 1rem; padding: 0.35rem 0; border-bottom: 1px solid var(--linie); }
.meine-liste .st.offen { color: var(--leise); }
.meine-liste .st.erledigt { color: var(--ok); font-weight: 600; }
.tg-knopf { display: inline-block; padding: 0.55rem 0.9rem; border-radius: 8px; background: #229ed9; color: #fff; text-decoration: none; font-weight: 600; }
.ok-klein { color: var(--ok); margin: 0.3rem 0 0; }
.tg-bestellen { text-align: center; }
.weitere { text-align: center; color: var(--leise); grid-column: 1 / -1; }
.feld { margin: 0 0 0.9rem; }
.feld-titel { display: block; margin-bottom: 0.25rem; }
.feld > input { width: 100%; }
.geheim { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; }
.geheim > span { color: var(--ok); font-weight: 600; }
.geheim > input { flex-basis: 100%; }
.druck-links a { font-weight: 600; }
.via { color: var(--leise); font-size: 0.9em; }
.geraet-kopf { align-items: baseline; margin-top: 0; }
.geraet-id { font-family: ui-monospace, monospace; background: var(--bg); padding: 0.1rem 0.5rem; border-radius: 6px; }
.warn { color: #b45309; font-weight: 600; }
.wer-bin-ich { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 0.6rem; margin: -0.4rem 0 1rem; color: var(--leise); }
.zeile.eng { margin: 0; flex-wrap: nowrap; }
.zeile.eng input { min-width: 6rem; }

/* Station (gemeinsamer Rechner im Kursraum) */
body.station main { max-width: 1100px; }
.station-kopf { display: flex; align-items: center; gap: 0.8rem; padding: 0.8rem 1.2rem; background: var(--karte); border-bottom: 1px solid var(--linie); }
.station-kopf img { border-radius: 9px; }
.station-kopf h1 { margin: 0; flex: 1; font-size: 1.4rem; }
.gross-titel { font-size: 2rem; text-align: center; margin: 1rem 0; }
.scan-zeile input, .suche { width: 100%; font-size: 1.4rem; padding: 0.9rem 1rem; margin-bottom: 1rem; }
.treffer { display: grid; grid-template-columns: repeat(auto-fill, minmax(9rem, 1fr)); gap: 0.7rem; }
.person { display: flex; flex-direction: column; align-items: center; gap: 0.2rem; padding: 1.1rem 0.5rem; font-size: 1.2rem; border-radius: 14px; }
.person strong { font-size: 1.5rem; color: var(--akzent); }
.pin-anzeige { text-align: center; font-size: 3rem; letter-spacing: 0.6rem; margin: 0.5rem 0 1rem; }
.pin-tasten { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.7rem; max-width: 22rem; margin: 0 auto; }
.pin-tasten button { font-size: 2rem; padding: 1rem 0; border-radius: 14px; }
.abbrechen { display: block; margin: 1.2rem auto; font-size: 1.1rem; padding: 0.7rem 2rem; }
.station-meldung { position: fixed; left: 50%; bottom: 2rem; transform: translateX(-50%); margin: 0; padding: 0.9rem 1.6rem; border-radius: 14px; font-size: 1.4rem; font-weight: 700; color: #fff; }
.station-meldung:empty { display: none; }
.station-meldung.gut { background: var(--ok); }
.station-meldung.schlecht { background: var(--fehler); }
.station-qr svg { width: 220px; height: 220px; background: #fff; border-radius: 8px; }
.rueckgaengig { position: fixed; left: 50%; bottom: 1.5rem; transform: translateX(-50%); display: flex; align-items: center; gap: 0.8rem;
  background: var(--text); color: var(--bg); padding: 0.6rem 0.8rem 0.6rem 1.2rem; border-radius: 12px; box-shadow: 0 6px 20px rgb(0 0 0 / 0.25); z-index: 10; }
.rueckgaengig[hidden] { display: none; }
.rueckgaengig button { background: var(--akzent); color: #fff; border: none; font-weight: 700; }
.tabelle-scroll { overflow-x: auto; }
.protokoll td { font-size: 0.92rem; }
.protokoll .nowrap { white-space: nowrap; }
.protokoll .umbruch { overflow-wrap: anywhere; }
.protokoll tr.fehlerzeile td { background: color-mix(in srgb, var(--fehler) 9%, var(--karte)); }
.filter label.check { margin: 0; }
