:root {
  --bg: #f4f6f9; --flaeche: #fff; --text: #1b2330; --leise: #637083; --linie: #dde3ea;
  --blau: #1f6feb; --gruen: #1a8f4c; --gelb: #b7791f; --rot: #c93c37; --blau-hell: #e8f0fe;
  --gruen-hell: #e3f5ea; --gelb-hell: #fdf3e1; --rot-hell: #fbe9e8;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f141a; --flaeche: #18202a; --text: #e4e9f0; --leise: #8d99aa; --linie: #2a3542;
    --blau: #5b9bff; --gruen: #46c27c; --gelb: #e0a84a; --rot: #ef6b66; --blau-hell: #1b2a40;
    --gruen-hell: #16301f; --gelb-hell: #33280f; --rot-hell: #3a1a19;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
body { margin: 0; font: 14px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; background: var(--bg); color: var(--text); }
h1, h2 { margin: 0 0 12px; font-weight: 600; }
h2 { font-size: 15px; }
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; border-radius: 6px; padding: 7px 14px; background: var(--blau); color: #fff; }
button.zweit { background: var(--flaeche); color: var(--text); border: 1px solid var(--linie); }
button.link { background: none; color: var(--leise); padding: 4px 6px; }
button.link:hover { color: var(--text); }
input, textarea { background: var(--flaeche); border: 1px solid var(--linie); border-radius: 6px; padding: 7px 10px; width: 100%; }
input:focus, textarea:focus, button:focus-visible { outline: 2px solid var(--blau); outline-offset: 1px; }
.leise { color: var(--leise); }
.klein { font-size: 12.5px; }
[hidden] { display: none !important; }

/* Kopf */
.kopf { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 16px; padding: 10px 20px;
  background: var(--flaeche); border-bottom: 1px solid var(--linie); flex-wrap: wrap; }
.marke { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 15px; }
#reiter { display: flex; gap: 4px; flex: 1; overflow-x: auto; }
#reiter button { background: none; color: var(--leise); padding: 6px 12px; white-space: nowrap; }
#reiter button.aktiv { background: var(--blau-hell); color: var(--blau); font-weight: 600; }
.kopf-rechts { display: flex; align-items: center; gap: 8px; font-size: 12.5px; }
.kopf-rechts form { margin: 0; }

main { max-width: 1280px; margin: 0 auto; padding: 20px; }
.karte { background: var(--flaeche); border: 1px solid var(--linie); border-radius: 10px; padding: 16px; margin-bottom: 16px; min-width: 0; }
.spalten { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.spalten > .karte { margin-bottom: 16px; }
.warnung { background: var(--rot-hell); color: var(--rot); padding: 10px 14px; border-radius: 8px; }

/* Kacheln */
.kacheln { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 16px; }
.kachel { background: var(--flaeche); border: 1px solid var(--linie); border-radius: 10px; padding: 14px 16px; }
.kachel .zahl { font-size: 28px; font-weight: 650; font-variant-numeric: tabular-nums; }
.kachel .titel { color: var(--leise); font-size: 12.5px; }
.kachel.gut .zahl { color: var(--gruen); }
.kachel.achtung .zahl { color: var(--gelb); }
.kachel.schlecht .zahl { color: var(--rot); }

/* Hinweise */
.hinweise { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.hinweise li { padding: 8px 10px; border-radius: 6px; border-left: 3px solid; }
.hinweise .rot { background: var(--rot-hell); border-color: var(--rot); }
.hinweise .gelb { background: var(--gelb-hell); border-color: var(--gelb); }
.hinweise .gruen { background: var(--gruen-hell); border-color: var(--gruen); }

/* aktive Sitzungen */
.sitzung { display: grid; grid-template-columns: 1fr auto 1fr; gap: 8px; align-items: center; padding: 10px; border: 1px solid var(--linie);
  border-radius: 8px; margin-bottom: 8px; }
.sitzung .pfeil { color: var(--leise); text-align: center; font-size: 12px; }
.sitzung .seite-b { text-align: right; }
.leer { color: var(--leise); padding: 6px 0; }

/* Seite (Gerät/IP) */
.wer { cursor: pointer; border-radius: 4px; }
.wer:hover .wer-name { text-decoration: underline; }
.wer-name { font-weight: 550; }
.wer-ip { color: var(--leise); font-size: 12px; font-variant-numeric: tabular-nums; }

/* Balken */
.balken { display: grid; grid-template-columns: repeat(14, 1fr); gap: 6px; align-items: end; height: 150px; }
.balken .tag { display: flex; flex-direction: column; justify-content: flex-end; align-items: center; height: 100%; gap: 4px; min-width: 0; }
.balken .saeule { width: 100%; max-width: 36px; background: var(--blau); border-radius: 4px 4px 0 0; min-height: 2px; }
.balken .wert { font-size: 11.5px; font-variant-numeric: tabular-nums; }
.balken .datum { font-size: 11px; color: var(--leise); white-space: nowrap; }

/* Werkzeugleiste + Tabellen */
.werkzeug { display: flex; gap: 12px; align-items: center; margin-bottom: 8px; flex-wrap: wrap; }
.werkzeug input[type=search] { max-width: 340px; }
.haken { display: flex; gap: 6px; align-items: center; white-space: nowrap; }
.haken input { width: auto; }
.tabelle-rahmen { overflow-x: auto; background: var(--flaeche); border: 1px solid var(--linie); border-radius: 10px; }
.tabelle { width: 100%; border-collapse: collapse; }
.tabelle th { text-align: left; font-weight: 600; font-size: 12.5px; color: var(--leise); padding: 9px 12px; border-bottom: 1px solid var(--linie); white-space: nowrap; }
.tabelle td { padding: 8px 12px; border-bottom: 1px solid var(--linie); vertical-align: top; }
.tabelle tr:last-child td { border-bottom: 0; }
.tabelle td.zahl { font-variant-numeric: tabular-nums; white-space: nowrap; }
.tabelle tr.ist-aktiv { background: var(--gruen-hell); }
#s-mehr { margin-top: 12px; }

.punkt { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--linie); }
.punkt.an { background: var(--gruen); }
.marke-aktiv { display: inline-block; font-size: 11.5px; padding: 1px 8px; border-radius: 10px; background: var(--gruen); color: #fff; }

/* Werte-Liste */
.werte { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0; }
.werte dt { color: var(--leise); }
.werte dd { margin: 0; font-variant-numeric: tabular-nums; }
.gut { color: var(--gruen); } .achtung { color: var(--gelb); } .schlecht { color: var(--rot); }

/* Dialog */
dialog { border: 1px solid var(--linie); border-radius: 12px; background: var(--flaeche); color: var(--text); padding: 20px; width: min(440px, calc(100vw - 32px)); }
dialog::backdrop { background: rgb(0 0 0 / .35); }
dialog label { display: block; margin-bottom: 12px; color: var(--leise); font-size: 12.5px; }
dialog label input, dialog label textarea { margin-top: 4px; color: var(--text); font-size: 14px; }
.knoepfe { display: flex; gap: 8px; justify-content: flex-end; }

/* Anmeldung */
body.login { display: grid; place-items: center; min-height: 100vh; padding: 16px; }
.login-box { background: var(--flaeche); border: 1px solid var(--linie); border-radius: 12px; padding: 28px; width: min(340px, 100%); display: grid; gap: 14px; text-align: center; }
.login-box h1 { font-size: 19px; margin: 0; }
.login-box img { margin: 0 auto; }
.login-box label { text-align: left; color: var(--leise); font-size: 12.5px; display: grid; gap: 4px; }
.meldung { margin: 0; background: var(--rot-hell); color: var(--rot); padding: 8px; border-radius: 6px; }

@media (max-width: 860px) {
  .spalten { grid-template-columns: 1fr; }
  .kacheln { grid-template-columns: 1fr 1fr; }
  main { padding: 16px; }
  .kopf { padding: 10px 16px; gap: 8px; }
  #reiter { order: 3; flex-basis: 100%; }
  .kopf-rechts { margin-left: auto; }
  #stand { display: none; }
  .sitzung { grid-template-columns: 1fr; }
  .sitzung .seite-b { text-align: left; }
  .balken { gap: 3px; }
  .balken .datum { font-size: 9.5px; }
}
