:root {
  --bg: #f4f6f9; --fl: #ffffff; --text: #1b2330; --leise: #5b6676; --rand: #d8dee7; --zebra: #f8fafc;
  --marke: #1a2750; --marke-text: #ffffff; --akzent: #1f5fbf; --akzent-hell: #e7effb; --knopf-text: #ffffff;
  --gruen: #1e7b3c; --gruen-bg: #e3f4e8; --gelb: #8a5a00; --gelb-bg: #fff2cc; --rot: #b42318; --rot-bg: #fde8e7;
  --grau: #5b6676; --grau-bg: #eceff3; --schatten: 0 1px 2px rgba(16, 24, 40, .06);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #11161d; --fl: #19202a; --text: #e6eaf0; --leise: #9aa6b5; --rand: #2c3644; --zebra: #1c242f;
    --marke: #1a2750; --akzent: #7aa7f0; --akzent-hell: #1d2a40; --knopf-text: #0b1220;
    --gruen: #6fd08c; --gruen-bg: #173322; --gelb: #f2c35b; --gelb-bg: #3a2f12; --rot: #ff8a80; --rot-bg: #3d1a18;
    --grau: #9aa6b5; --grau-bg: #252e3a; --schatten: none; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #11161d; --fl: #19202a; --text: #e6eaf0; --leise: #9aa6b5; --rand: #2c3644; --zebra: #1c242f;
  --marke: #1a2750; --akzent: #7aa7f0; --akzent-hell: #1d2a40; --knopf-text: #0b1220;
  --gruen: #6fd08c; --gruen-bg: #173322; --gelb: #f2c35b; --gelb-bg: #3a2f12; --rot: #ff8a80; --rot-bg: #3d1a18;
  --grau: #9aa6b5; --grau-bg: #252e3a; --schatten: none; color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.45 "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif; }
a { color: var(--akzent); }
h1 { font-size: 1.45rem; margin: .2rem 0 1rem; }
h2 { font-size: 1.1rem; margin: 1.6rem 0 .6rem; }
h3 { font-size: 1rem; margin: 1.2rem 0 .5rem; }
small, .leise { color: var(--leise); }
.abstand-oben { margin-top: 1rem; }
h2.oben, h3.oben { margin-top: 0; }
code, .mono { font-family: Consolas, "Cascadia Mono", monospace; }

/* Kopfzeile */
.kopf { background: var(--marke); color: var(--marke-text); display: flex; flex-wrap: wrap; align-items: center; gap: .4rem 1.2rem; padding: .55rem 1rem; }
.kopf a { color: var(--marke-text); text-decoration: none; }
.marke { display: inline-flex; align-items: center; gap: .7rem; white-space: nowrap; padding: .2rem 0; }
.marke .logo { height: 15px; width: auto; display: block; }
.marke span { font-weight: 400; font-size: .95rem; opacity: .85; padding-left: .7rem; border-left: 1px solid rgba(255,255,255,.35); }
.logo-gross { background: #1a2750; border-radius: 10px 10px 0 0; padding: 1.6rem 1.5rem; display: flex; justify-content: center; }
.logo-gross img { width: 210px; height: auto; display: block; }
.logo-gross + .flaeche { border-top-left-radius: 0; border-top-right-radius: 0; }
.nav { display: flex; flex-wrap: wrap; gap: .15rem; flex: 1; }
.nav a { padding: .35rem .6rem; border-radius: 6px; opacity: .88; white-space: nowrap; }
.nav a:hover { background: rgba(255,255,255,.12); opacity: 1; }
.nav a[aria-current="page"] { background: rgba(255,255,255,.18); opacity: 1; font-weight: 600; }
.konto { display: flex; align-items: center; gap: .6rem; font-size: .9rem; white-space: nowrap; }
.konto small { color: rgba(255,255,255,.7); }
.konto form { margin: 0; }
button.link { background: none; border: 0; color: inherit; text-decoration: underline; cursor: pointer; font: inherit; padding: 0; }

.inhalt { max-width: 1720px; margin: 0 auto; padding: 1.2rem 1rem 3rem; }

/* Meldungen */
.meldung { padding: .65rem .9rem; border-radius: 8px; margin-bottom: 1rem; border: 1px solid var(--rand); background: var(--fl); }
.meldung.ok { background: var(--gruen-bg); border-color: transparent; color: var(--gruen); }
.meldung.fehler { background: var(--rot-bg); border-color: transparent; color: var(--rot); }
.meldung.warnung { background: var(--gelb-bg); border-color: transparent; color: var(--gelb); }
.meldung.info { background: var(--akzent-hell); border-color: transparent; }

/* Flächen */
.flaeche { background: var(--fl); border: 1px solid var(--rand); border-radius: 10px; padding: 1rem 1.1rem; box-shadow: var(--schatten); }
.flaeche + .flaeche { margin-top: 1rem; }
.gefahrzone { border-color: var(--rot); }
.gefahrzone label { display: block; margin: .6rem 0 .3rem; }
.zwei { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 1rem; align-items: start; }
@media (max-width: 960px) { .zwei { grid-template-columns: minmax(0, 1fr); } }
.kacheln { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: .8rem; margin-bottom: 1.2rem; }
.kachel { background: var(--fl); border: 1px solid var(--rand); border-radius: 10px; padding: .8rem 1rem; text-decoration: none; color: var(--text); box-shadow: var(--schatten); }
.kachel b { display: block; font-size: 1.7rem; line-height: 1.1; font-variant-numeric: tabular-nums; }
.kachel span { color: var(--leise); font-size: .88rem; }
.kachel.rot b { color: var(--rot); } .kachel.gelb b { color: var(--gelb); } .kachel.gruen b { color: var(--gruen); }
a.kachel:hover { border-color: var(--akzent); }

.titelzeile { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: .5rem 1rem; margin-bottom: .8rem; }
.titelzeile h1 { margin: 0; }
.aktionen { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }

/* Formulare */
label { font-weight: 600; font-size: .9rem; }
input[type=text], input[type=email], input[type=tel], input[type=date], input[type=password], input[type=search], select, textarea {
  width: 100%; padding: .5rem .6rem; border: 1px solid var(--rand); border-radius: 7px; background: var(--fl); color: var(--text); font: inherit; min-height: 2.4rem;
}
textarea { min-height: 5rem; resize: vertical; }
input:focus, select:focus, textarea:focus, button:focus-visible, a:focus-visible { outline: 2px solid var(--akzent); outline-offset: 1px; }
.knopf, button.knopf { display: inline-flex; align-items: center; gap: .35rem; padding: .5rem .95rem; border-radius: 7px; border: 1px solid var(--akzent);
  background: var(--akzent); color: var(--knopf-text); font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; min-height: 2.4rem; }
.knopf.zweit { background: var(--fl); color: var(--akzent); }
.knopf.gefahr { background: var(--fl); color: var(--rot); border-color: var(--rot); }
.knopf:hover { filter: brightness(1.05); }
.filter { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: .6rem; align-items: end; margin-bottom: 1rem; }
.filter .breit { grid-column: span 2; }
@media (max-width: 520px) { .filter .breit { grid-column: auto; } }
.filter label { display: block; margin-bottom: .2rem; font-size: .82rem; color: var(--leise); }

.felder { display: grid; grid-template-columns: 1fr; gap: .1rem; }
.feld { display: grid; grid-template-columns: 12rem minmax(0, 1fr); gap: .3rem 1rem; padding: .45rem 0; border-bottom: 1px solid var(--rand); align-items: center; }
.feld:last-child { border-bottom: 0; }
.feld > label, .feld > .name { font-weight: 600; font-size: .9rem; }
.feld .quelle { display: block; font-weight: 400; font-size: .75rem; color: var(--leise); }
.feld .wert { min-height: 1.4rem; overflow-wrap: anywhere; }
.feld .hinweis { grid-column: 2; font-size: .82rem; }
.feld .hinweis.fm { color: var(--gelb); }
.feld .hinweis.err { color: var(--rot); font-weight: 600; }
.feld.hat-fehler input, .feld.hat-fehler select { border-color: var(--rot); }
@media (max-width: 620px) { .feld { grid-template-columns: minmax(0, 1fr); } .feld .hinweis { grid-column: 1; } }
fieldset { border: 0; padding: 0; margin: 0 0 1rem; min-width: 0; }
legend { font-weight: 700; font-size: 1rem; margin-bottom: .3rem; padding: 0; }
.formfuss { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; margin-top: 1rem; }

/* Tabellen */
.tabelle { overflow-x: auto; background: var(--fl); border: 1px solid var(--rand); border-radius: 10px; box-shadow: var(--schatten); }
table { border-collapse: collapse; width: 100%; font-size: .9rem; }
th, td { text-align: left; padding: .5rem .65rem; border-bottom: 1px solid var(--rand); vertical-align: top; }
th { background: var(--zebra); font-weight: 600; white-space: nowrap; position: sticky; top: 0; }
th a { color: inherit; text-decoration: none; }
th a:hover { text-decoration: underline; }
tbody tr:hover { background: var(--akzent-hell); }
tbody tr:last-child td { border-bottom: 0; }
td.zahl { font-variant-numeric: tabular-nums; white-space: nowrap; }
td.knapp { white-space: nowrap; }
.anzahl { color: var(--leise); font-size: .9rem; margin: .4rem 0 .8rem; }

/* Kennzeichen */
.marke-st { display: inline-block; padding: .08rem .5rem; border-radius: 999px; font-size: .8rem; font-weight: 600; white-space: nowrap; }
.st-aktiv, .gv-gueltig { background: var(--gruen-bg); color: var(--gruen); }
.st-krank, .gv-laeuft_bald_ab { background: var(--gelb-bg); color: var(--gelb); }
.st-ausgeschieden, .gv-unbekannt { background: var(--grau-bg); color: var(--grau); }
.st-haupt { background: var(--akzent-hell); color: var(--akzent); }
.gv-abgelaufen { background: var(--rot-bg); color: var(--rot); }
.chips { display: flex; flex-wrap: wrap; gap: .3rem; }
.chip { background: var(--gelb-bg); color: var(--gelb); border-radius: 999px; padding: .05rem .5rem; font-size: .8rem; overflow-wrap: anywhere; }
.chip.fehlt { background: var(--rot-bg); color: var(--rot); }
.chip.anders { background: var(--gelb-bg); color: var(--gelb); }
.chip.info { background: var(--grau-bg); color: var(--grau); }

/* Einfache Mitarbeiterliste und Formular */
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.haken label { display: flex; align-items: center; gap: .4rem; font-weight: 400; color: var(--text); font-size: .9rem; min-height: 2.4rem; }
.haken input { width: 1.1rem; height: 1.1rem; }
table.mitarbeiter { font-size: .86rem; }
table.mitarbeiter td.mail { overflow-wrap: anywhere; min-width: 10rem; }
td.aktion { text-align: right; }
td.aktion a { margin-right: .6rem; }
td.aktion form { display: inline; margin: 0; }
button.link.rot { color: var(--rot); }
.formular { max-width: 760px; margin: 0 auto; }
.formular > * + * { margin-top: 1rem; }
.formgitter { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .9rem 1.2rem; }
.formgitter .feld { display: block; border: 0; padding: 0; }
.formgitter .feld > label, .formgitter .feld > .name { display: block; margin-bottom: .25rem; }
.formgitter .feld .wert { display: block; padding: .5rem 0; }
.formgitter .feld .hinweis { display: block; margin-top: .25rem; font-size: .82rem; color: var(--leise); }
.formgitter .feld .hinweis.fm { color: var(--gelb); }
.formgitter .feld .hinweis.err { color: var(--rot); font-weight: 600; }
@media (max-width: 620px) { .formgitter { grid-template-columns: minmax(0, 1fr); } }
.abw-box { border-color: var(--gelb); }
.abw { background: var(--gelb-bg); color: var(--gelb); border-radius: 4px; padding: 0 .25rem; }
td.quelle { font-size: .82rem; line-height: 1.35; min-width: 10rem; }
td.quelle small { color: var(--leise); }
th.quelle-fm, td.quelle-fm, th.quelle-ol, td.quelle-ol { background: var(--zebra); }
th.quelle-fm { border-left: 2px solid var(--rand); }
td.quelle-fm { border-left: 2px solid var(--rand); }
tbody tr:hover td.quelle { background: var(--akzent-hell); }
.nl-auswahl { margin: 1rem 0 0; }
.nl-auswahl[hidden] { display: none; }
.kaestchen { display: grid; grid-template-columns: repeat(auto-fill, minmax(9rem, 1fr)); gap: .35rem .8rem; }
.kaestchen label { display: flex; align-items: center; gap: .45rem; font-weight: 400; padding: .3rem .4rem; border: 1px solid var(--rand); border-radius: 6px; cursor: pointer; }
.kaestchen label:has(input:checked) { border-color: var(--akzent); background: var(--akzent-hell); }
.kaestchen input { width: 1.05rem; height: 1.05rem; }
.formular-links { max-width: 900px; }
.drei { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 1rem; }
.drei label { display: block; margin: .6rem 0 .25rem; }
.vergleich-zwei { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
@media (max-width: 620px) { .vergleich-zwei { grid-template-columns: minmax(0, 1fr); } }
dl.werte { display: grid; grid-template-columns: 7rem minmax(0, 1fr); gap: .35rem .8rem; margin: 0; }
dl.werte dt { color: var(--leise); font-size: .88rem; }
dl.werte dd { margin: 0; overflow-wrap: anywhere; }
button.klein, .klein { font-size: .82rem; }
button.link.klein { margin-left: .4rem; color: var(--akzent); }
input.geaendert { border-color: var(--akzent); box-shadow: 0 0 0 2px var(--akzent-hell); }
.schnell { display: grid; gap: .6rem; margin: 1rem 0 .4rem; }
.schnell .knopf { justify-content: center; }
details summary { cursor: pointer; }
.loeschzeile { margin: 1rem 0 0; }
details.verlauf summary { cursor: pointer; font-weight: 600; }
details.verlauf[open] summary { margin-bottom: .6rem; }

/* Anmeldung */
.anmeldung { max-width: 430px; margin: 6vh auto 0; }
.anmeldung .flaeche { padding: 1.4rem 1.5rem; }
.anmeldung h1 { margin-bottom: .4rem; }
.anmeldung .feldzeile { margin: .9rem 0; }
.anmeldung .feldzeile label { display: block; margin-bottom: .25rem; }
.code-eingabe { font-size: 1.5rem !important; letter-spacing: .3rem; text-align: center; font-variant-numeric: tabular-nums; }
.qr { display: block; margin: .8rem auto; width: 220px; height: 220px; background: #fff; padding: 6px; border-radius: 8px; }
.schritte { padding-left: 1.2rem; } .schritte li { margin: .35rem 0; }
.codes { display: grid; grid-template-columns: repeat(2, 1fr); gap: .4rem; font-family: Consolas, monospace; font-size: 1.1rem; margin: 1rem 0; }
.codes span { background: var(--zebra); border: 1px solid var(--rand); border-radius: 6px; padding: .35rem; text-align: center; }
.link-anzeige { font-size: .85rem; overflow-wrap: anywhere; display: block; margin-top: .3rem; }
.pw-anzeige {font-family: Consolas, monospace; font-size: 1.2rem; background: var(--zebra); padding: .4rem .7rem; border-radius: 6px; border: 1px dashed var(--rand); display: inline-block; user-select: all; }

@media print { .kopf, .filter, .aktionen, .formfuss { display: none; } body { background: #fff; } .tabelle, .flaeche { border: 0; box-shadow: none; } }
