:root {
  --bg: #f4f6f8; --flaeche: #ffffff; --text: #17212b; --leise: #5b6875;
  --linie: #d5dce3; --akzent: #0b6e6e; --akzent-text: #ffffff; --fehler: #b42318; --ok: #1a7f37;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #11171d; --flaeche: #1a232c; --text: #e6ebf0; --leise: #98a6b3;
    --linie: #2d3945; --akzent: #3fb8b0; --akzent-text: #07201f; --fehler: #ff8a80; --ok: #6fd08c;
  }
}
* { box-sizing: border-box; }
html { height: 100%; }
body {
  margin: 0; min-height: 100%; display: flex; flex-direction: column;
  background: var(--bg); color: var(--text);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  padding: env(safe-area-inset-top, 0) env(safe-area-inset-right, 0) env(safe-area-inset-bottom, 0) env(safe-area-inset-left, 0);
}
.kopf { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: .75rem 1rem; border-bottom: 1px solid var(--linie); background: var(--flaeche); flex-wrap: wrap; }
.marke { font-weight: 650; color: var(--text); text-decoration: none; }
nav { display: flex; gap: 1rem; align-items: center; }
nav form { margin: 0; }
a { color: var(--akzent); }
main { flex: 1; width: 100%; max-width: 46rem; margin: 0 auto; padding: 1rem; }
h1 { font-size: 1.5rem; margin: .5rem 0 1rem; }
h2 { font-size: 1.1rem; margin: 0 0 .5rem; }
.karte { background: var(--flaeche); border: 1px solid var(--linie); border-radius: 8px; padding: 1rem 1.25rem; margin-bottom: 1rem; }
.karte.schmal { max-width: 24rem; margin: 3rem auto; }
label { display: block; margin-bottom: .75rem; color: var(--leise); font-size: .9rem; }
input { display: block; width: 100%; margin-top: .25rem; padding: .6rem .7rem; font: inherit; color: var(--text); background: var(--bg); border: 1px solid var(--linie); border-radius: 6px; }
input:focus-visible, button:focus-visible, a:focus-visible { outline: 3px solid var(--akzent); outline-offset: 2px; }
button, .knopf { font: inherit; cursor: pointer; }
.primaer, .knopf { display: inline-block; padding: .6rem 1rem; border: 0; border-radius: 6px; background: var(--akzent); color: var(--akzent-text); text-decoration: none; font-weight: 600; }
.link { background: none; border: 0; padding: 0; color: var(--akzent); text-decoration: underline; }
.zeile { display: flex; gap: .75rem; align-items: flex-end; flex-wrap: wrap; }
.zeile label { margin: 0; }
.liste { padding-left: 1.2rem; margin: 0; } .liste li { margin-bottom: .4rem; }
.werte { display: grid; grid-template-columns: max-content 1fr; gap: .25rem 1rem; margin: 1rem 0; }
.werte dt { color: var(--leise); } .werte dd { margin: 0; }
.hinweis { padding: .6rem .8rem; border-radius: 6px; border: 1px solid var(--linie); background: var(--flaeche); }
.hinweis.success { border-color: var(--ok); } .hinweis.error { border-color: var(--fehler); color: var(--fehler); }
.fuss { padding: .75rem 1rem; text-align: center; color: var(--leise); font-size: .85rem; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* ---- Dashboard ---- */
:root {
  --gruen: #1a7f37; --gelb: #9a6700; --orange: #c2410c; --rot: #b42318;
  --p-tag: #0b6e6e; --p-woche: #3b6fb6; --p-monat: #7c4dbb; --p-jahr: #a35d00; --p-gesamt: #475569;
}
@media (prefers-color-scheme: dark) {
  :root {
    --gruen: #6fd08c; --gelb: #e3b341; --orange: #ff9f68; --rot: #ff8a80;
    --p-tag: #3fb8b0; --p-woche: #7fa8e6; --p-monat: #b79af0; --p-jahr: #e0a252; --p-gesamt: #9fb0c1;
  }
}
.uhr-karte { background: var(--flaeche); border: 1px solid var(--linie); border-radius: 8px; padding: 1.25rem; margin-bottom: 1rem; text-align: center; }
.uhr-karte .datum { margin: 0; color: var(--leise); }
.beschriftung { margin: 1rem 0 0; color: var(--leise); }
.gross { margin: 0; font-size: clamp(2.6rem, 14vw, 4.5rem); font-weight: 650; font-variant-numeric: tabular-nums; line-height: 1.1; letter-spacing: -.02em; }
.gross.ueber { color: var(--akzent); }
.gross.farbe-gruen { color: var(--gruen); } .gross.farbe-gelb { color: var(--gelb); }
.gross.farbe-orange { color: var(--orange); } .gross.farbe-rot { color: var(--rot); }
.gross.pause.offen { color: var(--gelb); } .gross.pause.ok { color: var(--gruen); }
.klein { margin: .35rem 0 0; font-size: .92rem; } .leise { color: var(--leise); }
.pausenchip { display: inline-block; padding: .1rem .6rem; border-radius: 999px; border: 1px solid currentColor; font-size: .85rem; }
.pausenchip.offen { color: var(--gelb); } .pausenchip.ok { color: var(--gruen); }
.aktionen { display: grid; gap: .6rem; margin-top: 1.25rem; }
.aktionen form { margin: 0; }
.gross-knopf { width: 100%; min-height: 3.25rem; padding: .7rem 1rem; font-size: 1.1rem; font-weight: 650; border: 2px solid var(--akzent); border-radius: 8px; background: var(--akzent); color: var(--akzent-text); }
.gross-knopf.sekundaer { background: transparent; color: var(--akzent); }
.doppel { display: grid; grid-template-columns: 3fr 2fr; gap: .6rem; }
.typwahl { border: 0; margin: 0 0 .75rem; padding: 0; display: flex; flex-wrap: wrap; gap: .5rem; justify-content: center; }
.typwahl legend { width: 100%; color: var(--leise); font-size: .9rem; padding: 0; margin-bottom: .35rem; }
.chip { margin: 0; }
.chip input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.chip span { display: inline-block; padding: .45rem .9rem; border: 1px solid var(--linie); border-radius: 999px; color: var(--text); cursor: pointer; }
.chip input:checked + span { border-color: var(--akzent); background: var(--akzent); color: var(--akzent-text); font-weight: 600; }
.chip input:focus-visible + span { outline: 3px solid var(--akzent); outline-offset: 2px; }
.hinweiswahl { text-align: left; } .hinweiswahl select, .tagesstatus select { width: 100%; padding: .55rem; font: inherit; color: var(--text); background: var(--bg); border: 1px solid var(--linie); border-radius: 6px; margin-top: .25rem; }
.tagesstatus { margin-top: 1rem; text-align: left; }
.tagesstatus summary { cursor: pointer; color: var(--akzent); }
.tagesstatus .zeile { margin: .75rem 0 .5rem; }
.kontroll { display: flex; gap: .4rem; align-items: center; margin: 0; } .kontroll input { width: auto; margin: 0; }
.badges { list-style: none; margin: 0 0 .5rem; padding: 0; display: grid; grid-template-columns: repeat(5, 1fr); gap: .5rem; }
.badge { display: flex; flex-direction: column; align-items: center; padding: .5rem .25rem; border-radius: 8px; border: 2px solid var(--b, var(--linie)); text-align: center; }
.badge-titel { font-size: .8rem; color: var(--b); font-weight: 650; }
.badge-wert { font-size: 1.05rem; font-weight: 650; font-variant-numeric: tabular-nums; }
.badge-ag { font-size: .75rem; color: var(--leise); font-variant-numeric: tabular-nums; }
.p-tag { --b: var(--p-tag); } .p-woche { --b: var(--p-woche); } .p-monat { --b: var(--p-monat); }
.p-jahr { --b: var(--p-jahr); } .p-gesamt { --b: var(--p-gesamt); }
@media (max-width: 30rem) { .badges { grid-template-columns: repeat(3, 1fr); } }
.woche { list-style: none; margin: 0 0 .5rem; padding: 0; display: grid; gap: .35rem; }
.woche li { display: grid; grid-template-columns: 4.2rem 1fr auto; gap: .6rem; align-items: center; padding: .2rem .3rem; border-radius: 6px; }
.woche li.heute { background: color-mix(in srgb, var(--akzent) 12%, transparent); font-weight: 600; }
.woche li.leer { opacity: .55; }
.wt small, .zahlen small { color: var(--leise); font-weight: 400; }
.zahlen { font-variant-numeric: tabular-nums; font-size: .9rem; text-align: right; white-space: nowrap; }
.balken { position: relative; display: flex; height: .7rem; background: var(--bg); border: 1px solid var(--linie); border-radius: 4px; overflow: hidden; }
.b-normal { background: var(--akzent); } .b-mehr { background: var(--orange); }
.balken .marke { position: absolute; top: -2px; bottom: -2px; width: 2px; background: var(--text); opacity: .7; }

/* ---- Tage und Formulare ---- */
.monatskopf { display: flex; align-items: center; justify-content: space-between; gap: .75rem; }
.monatskopf h1 { margin: .5rem 0; text-align: center; font-size: 1.3rem; }
.knopf.sekundaer { background: transparent; color: var(--akzent); border: 1px solid var(--akzent); padding: .4rem .8rem; }
.navzeile { margin: 0 0 .75rem; }
.tabelle-rahmen { overflow-x: auto; border: 1px solid var(--linie); border-radius: 8px; background: var(--flaeche); }
.tabelle { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.tabelle th, .tabelle td { padding: .45rem .6rem; text-align: left; border-bottom: 1px solid var(--linie); vertical-align: top; }
.tabelle thead th { font-size: .85rem; color: var(--leise); font-weight: 600; }
.tabelle .z { text-align: right; white-space: nowrap; }
.tabelle tr.heute td { background: color-mix(in srgb, var(--akzent) 12%, transparent); }
.tabelle tr.we td { color: var(--leise); }
.tabelle tr.leer td { opacity: .75; }
.tabelle tfoot th { border-bottom: 0; font-weight: 650; }
.tabelle .abweichung { color: var(--orange); font-weight: 650; }
.tabelle.ergebnis th { font-weight: 500; color: var(--leise); }
.tabelle.ergebnis tr.summe th, .tabelle.ergebnis tr.summe td { font-weight: 650; color: var(--text); }
.tag-chip { display: inline-block; padding: 0 .5rem; margin-right: .25rem; border: 1px solid var(--linie); border-radius: 999px; font-size: .8rem; color: var(--leise); }
.kopfzeile { display: flex; justify-content: space-between; align-items: center; gap: .75rem; margin-bottom: .5rem; }
.kopfzeile h2 { margin: 0; }
.eintrag { display: flex; justify-content: space-between; gap: 1rem; padding: .5rem 0; border-top: 1px solid var(--linie); }
.eintrag:first-of-type { border-top: 0; }
.aktionen-zeile { display: flex; gap: .9rem; white-space: nowrap; align-items: flex-start; }
.formular .feld { margin-bottom: .9rem; }
.formular .feld > label { display: block; margin: 0 0 .2rem; }
.formular select { width: 100%; padding: .6rem .7rem; font: inherit; color: var(--text); background: var(--bg); border: 1px solid var(--linie); border-radius: 6px; }
.formular .feld.fehler input, .formular .feld.fehler select { border-color: var(--fehler); }
.fehlertext { display: block; color: var(--fehler); }
.formular small { display: block; margin-top: .2rem; }
.primaer.gefahr { background: var(--fehler); border-color: var(--fehler); color: #fff; }

/* ---- Auswertung ---- */
.schnell { display: flex; flex-wrap: wrap; gap: .4rem; margin: 0 0 1rem; }
.schnell .tag-chip { padding: .3rem .8rem; font-size: .9rem; text-decoration: none; color: var(--akzent); border-color: var(--akzent); }
.typwahl.links { justify-content: flex-start; margin-bottom: 1rem; }
.zeile input[type="date"] { min-width: 10.5rem; }

/* ---- Kalender (Planung) ---- */
nav { flex-wrap: wrap; }
.kalender { border: 1px solid var(--linie); border-radius: 8px; overflow: hidden; background: var(--flaeche); margin-bottom: .75rem; }
.kopf-zeile, .woche-zeile { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.kopf-zeile span { padding: .35rem 0; text-align: center; font-size: .8rem; color: var(--leise); font-weight: 600; border-bottom: 1px solid var(--linie); }
.zelle { position: relative; display: flex; flex-direction: column; gap: 2px; min-height: 4.6rem; padding: .25rem; border-right: 1px solid var(--linie); border-bottom: 1px solid var(--linie); color: var(--text); text-decoration: none; overflow: hidden; }
.woche-zeile .zelle:last-child { border-right: 0; }
.zelle .nr { font-size: .85rem; font-weight: 600; }
.zelle.fremd { opacity: .4; } .zelle.we { background: color-mix(in srgb, var(--leise) 8%, transparent); }
.zelle.heute .nr { display: inline-block; width: 1.5rem; height: 1.5rem; line-height: 1.5rem; text-align: center; border-radius: 50%; background: var(--akzent); color: var(--akzent-text); }
.zelle:hover, .zelle:focus-visible { background: color-mix(in srgb, var(--akzent) 12%, transparent); }
.mini { font-size: .68rem; line-height: 1.2; padding: 0 .25rem; border-radius: 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mini.plan { background: var(--akzent); color: var(--akzent-text); } .mini.stat { border: 1px solid var(--akzent); color: var(--akzent); }
.mini.feier { color: var(--rot); }
.punkt { position: absolute; right: .3rem; top: .35rem; width: .5rem; height: .5rem; border-radius: 50%; background: var(--gruen); }
.schnell .tag-chip.aktiv { background: var(--akzent); color: var(--akzent-text); }
@media (max-width: 30rem) { .mini { font-size: .6rem; } .zelle { min-height: 4rem; } }

/* ---- Datum und Uhrzeit getrennt ---- */
.formular .feld input[type="date"], .formular .feld input[type="time"] { display: inline-block; width: auto; min-width: 9.5rem; margin-right: .5rem; }
.formular .feld input[type="time"] { min-width: 7rem; }

/* ---- Außen-Instanz: drei Badges ---- */
.badges.drei { grid-template-columns: repeat(3, 1fr); }
