/* Farben der Fahrtarten: geprüfte Palette (Farbfehlsichtigkeit, Kontrast); stehen immer neben Text. */
:root {
  color-scheme: light dark;
  --grund: #f1f3ef; --karte: #fff; --tinte: #16241e; --leise: #5a675f; --linie: #d5dbd4; --dunkel: #16241e; --auf-dunkel: #f0f4ee;
  --gruen: #0b6e45; --rot: #b92f25; --gelb-grund: #fff2cf; --gelb-tinte: #5c4200; --rot-grund: #fde5e1; --rot-tinte: #7d1b13;
  --gruen-grund: #dcf2e5; --gruen-tinte: #0a4a2f; --wahl: #16241e; --auf-wahl: #fff;
  --k-betrieblich: #2a78d6; --k-privat: #eb6834; --k-arbeitsweg: #1baf7a; --k-offen: #eda100;
}
@media (prefers-color-scheme: dark) {
  :root {
    --grund: #101513; --karte: #1a211d; --tinte: #eef2ec; --leise: #a5b1a9; --linie: #343d37; --dunkel: #0a0e0c; --auf-dunkel: #f0f4ee;
    --gruen: #12784d; --rot: #c23a30; --gelb-grund: #3d3110; --gelb-tinte: #ffe2a0; --rot-grund: #46201c; --rot-tinte: #ffd0c9;
    --gruen-grund: #15382a; --gruen-tinte: #bdf0d4; --wahl: #eef2ec; --auf-wahl: #101513;
    --k-betrieblich: #3987e5; --k-privat: #d95926; --k-arbeitsweg: #199e70; --k-offen: #c98500;
  }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--grund); color: var(--tinte); font: 17px/1.4 -apple-system, system-ui, "Segoe UI", sans-serif;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) 0 env(safe-area-inset-left); overscroll-behavior-y: none;
}
main { max-width: 560px; margin: 0 auto; padding: 8px 16px calc(96px + env(safe-area-inset-bottom)); display: grid; gap: 12px; grid-template-columns: minmax(0, 1fr); }
h1, h2, h3, p, dl, ul { margin: 0; }
h1 { font-size: 30px; line-height: 1.15; letter-spacing: -.02em; }
h2 { font-size: 19px; } h3 { font-size: 17px; }
small { display: block; font-size: 14px; font-weight: 400; color: var(--leise); }
button, input, textarea, select { font: inherit; color: inherit; }
button { border: 0; background: none; padding: 0; text-align: inherit; cursor: pointer; touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
button:disabled { opacity: .5; cursor: default; }
:focus-visible { outline: 3px solid var(--k-betrieblich); outline-offset: 2px; }
.icon { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.leise { color: var(--leise); font-size: 15px; } .mittig { text-align: center; } .leer { color: var(--leise); text-align: center; padding: 40px 16px; }
.kopf { display: flex; align-items: center; justify-content: space-between; min-height: 52px; }
.karte { background: var(--karte); border-radius: 18px; padding: 16px; display: grid; gap: 12px; grid-template-columns: minmax(0, 1fr); }
.karte.dunkel { background: var(--dunkel); color: var(--auf-dunkel); } .karte.dunkel .leise, .karte.dunkel dt { color: #b3c0b8; }

/* Schaltflächen */
.big { display: block; width: 100%; min-height: 56px; border-radius: 14px; padding: 12px 18px; text-align: center; font-weight: 650; font-size: 18px; background: var(--wahl); color: var(--auf-wahl); }
.big.gruen { background: var(--gruen); color: #fff; } .big.rot { background: var(--rot); color: #fff; }
.big.zweit { background: none; color: var(--tinte); box-shadow: inset 0 0 0 1.5px var(--linie); }
.karte .big.zweit, .sheet .big.zweit { background: var(--grund); box-shadow: none; }
.big.start, .big.ende { min-height: 84px; font-size: 24px; border-radius: 20px; }
.text { min-height: 44px; padding: 8px 10px; font-weight: 650; text-decoration: underline; text-underline-offset: 3px; }
.rund { width: 48px; height: 48px; display: grid; place-items: center; border-radius: 50%; background: var(--wahl); color: var(--auf-wahl); }

/* Fahrzeugwahl */
.fahrzeuge { display: flex; gap: 10px; overflow-x: auto; margin: 0 -16px; padding: 2px 16px 4px; scroll-snap-type: x proximity; scrollbar-width: none; }
.fahrzeug { flex: 0 0 auto; min-width: 128px; max-width: 200px; display: grid; gap: 2px; padding: 12px 14px; border-radius: 16px; background: var(--karte); scroll-snap-align: start; scroll-margin: 16px; }
.fahrzeug strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .fahrzeug span { font-size: 14px; color: var(--leise); }
.fahrzeug[aria-checked=true] { background: var(--wahl); color: var(--auf-wahl); } .fahrzeug[aria-checked=true] span { color: inherit; opacity: .8; }

/* Zählwerk */
.odoknopf { display: grid; justify-items: center; gap: 8px; width: 100%; padding: 4px 0; text-align: center; }
.odo { display: inline-flex; gap: 3px; padding: 6px; border-radius: 12px; background: var(--dunkel); }
.odo span { width: clamp(34px, 11.500vw, 46px); padding: 6px 0; border-radius: 7px; background: #24352d; color: #fff; text-align: center; font: 600 clamp(32px, 10.500vw, 42px)/1.1 ui-monospace, "SF Mono", Consolas, monospace; }
.odo .dim { color: #6f8478; }

/* Auswahlfelder */
.segmente { display: grid; grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); gap: 8px; }
.segmente:has(.k-offen, .k-geliehen, .k-sonstiges) { grid-template-columns: 1fr 1fr; }
.seg { min-height: 52px; padding: 8px 10px; border-radius: 12px; text-align: center; font-weight: 600; font-size: 16px; line-height: 1.2; background: var(--grund); border: 2px solid transparent; }
main > .segmente .seg { background: var(--karte); }
.seg[aria-checked=true], main > .segmente .seg[aria-checked=true] { background: var(--wahl); color: var(--auf-wahl); }

/* Laufende Fahrt */
.uhr { font: 650 72px/1 -apple-system, system-ui, sans-serif; font-variant-numeric: tabular-nums; text-align: center; letter-spacing: -.03em; }
.werte { display: grid; grid-template-columns: fit-content(45%) minmax(0, 1fr); gap: 8px 16px; } .werte dt { color: var(--leise); } .werte dd { margin: 0; text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; white-space: pre-line; }
.gps { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; padding: 12px 16px; border-radius: 14px; background: var(--karte); min-height: 52px; }
.gps::before { content: ""; width: 12px; height: 12px; border-radius: 50%; background: var(--leise); } .gps.aktiv::before { background: var(--k-arbeitsweg); } .gps.fehler::before { background: var(--rot); } .gps.sucht::before, .gps.ungenau::before { background: var(--k-offen); }
.gps span { flex-basis: 100%; }

/* Hinweise */
.hinweis { display: block; width: 100%; padding: 12px 14px; border-radius: 14px; background: var(--karte); font-size: 16px; } .karte .hinweis, .sheet .hinweis { background: var(--grund); }
.hinweis.gelb, .karte .hinweis.gelb, .sheet .hinweis.gelb, .warnbox { background: var(--gelb-grund); color: var(--gelb-tinte); }
.hinweis.rot, .karte .hinweis.rot, .sheet .hinweis.rot { background: var(--rot-grund); color: var(--rot-tinte); }
.hinweis.gruen, .sheet .hinweis.gruen { background: var(--gruen-grund); color: var(--gruen-tinte); }
.warnbox { padding: 12px 14px; border-radius: 14px; } .warnbox ul { padding-left: 20px; }
.fehlertext { color: var(--rot); font-size: 15px; font-weight: 600; } @media (prefers-color-scheme: dark) { .fehlertext { color: #ff9c92; } }
.toast { position: fixed; left: 16px; right: 16px; bottom: calc(96px + env(safe-area-inset-bottom)); max-width: 528px; margin: auto; padding: 14px 18px; border-radius: 14px; background: var(--dunkel); color: #fff; text-align: center; font-weight: 600; z-index: 9; box-shadow: 0 6px 24px #0005; }
.toast.fehler { background: var(--rot); }

/* Fahrtenliste */
.tag { font-size: 16px; color: var(--leise); margin: 8px 4px 6px; font-weight: 600; } section { display: grid; gap: 8px; grid-template-columns: minmax(0, 1fr); }
.fahrt { display: grid; gap: 4px; width: 100%; padding: 14px 16px 14px 22px; border-radius: 16px; background: var(--karte); position: relative; }
.fahrt::before { content: ""; position: absolute; left: 8px; top: 14px; bottom: 14px; width: 5px; border-radius: 3px; background: var(--f, var(--linie)); }
.zeile { display: flex; justify-content: space-between; gap: 12px; } .zeile strong { overflow-wrap: anywhere; } .kmwert { font-weight: 700; white-space: nowrap; font-variant-numeric: tabular-nums; }
.fahrt.storniert .zeile { text-decoration: line-through; color: var(--leise); }
.plaketten { display: flex; flex-wrap: wrap; gap: 6px; } .plaketten:empty { display: none; }
.plakette { display: inline-block; padding: 3px 9px; border-radius: 8px; font-size: 14px; background: var(--grund); margin-left: 0; } .plakette.gelb { background: var(--gelb-grund); color: var(--gelb-tinte); } .plakette.rot { background: var(--rot-grund); color: var(--rot-tinte); }
.korrektur { font-size: 14px; color: var(--leise); } ins { text-decoration: none; font-weight: 600; }
.verlauf { list-style: none; padding: 0; display: grid; gap: 12px; } .verlauf ul { padding-left: 20px; } .verlauf .plakette { margin-left: 6px; }
.blaettern { display: flex; align-items: center; justify-content: space-between; } .blaettern button { width: 52px; height: 48px; display: grid; place-items: center; border-radius: 12px; background: var(--karte); }
.eintrag { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 60px; padding: 8px 0; border-bottom: 1px solid var(--linie); } .eintrag:disabled { opacity: 1; } .eintrag > span:nth-child(2) { flex: 1; min-width: 0; }
.abgelehnt { display: grid; gap: 2px; padding: 8px 0; border-bottom: 1px solid var(--linie); }

/* Übersicht */
.k-betrieblich { --f: var(--k-betrieblich); } .k-privat { --f: var(--k-privat); } .k-arbeitsweg { --f: var(--k-arbeitsweg); } .k-offen { --f: var(--k-offen); }
.kmgross { font-size: 46px; line-height: 1.1; font-weight: 700; text-align: center; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.balken { display: flex; gap: 2px; height: 14px; } .balken span { min-width: 4px; border-radius: 4px; background: var(--f); flex-basis: 0; } .balken:empty { display: none; }
.punkt { display: inline-block; width: 12px; height: 12px; border-radius: 4px; background: var(--f); margin-right: 8px; }
table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; } th, td { padding: 9px 0 9px 8px; text-align: right; border-bottom: 1px solid var(--linie); vertical-align: top; }
th:first-child { text-align: left; padding-left: 0; font-weight: 600; } thead th { font-size: 14px; color: var(--leise); font-weight: 600; } tbody tr:last-child > * { border-bottom: 0; }

/* Formulare */
.formular { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr); } .formular > div:not([class]) { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr); } .formular > div:not([class]):empty { display: none; }
.feld { display: grid; gap: 6px; min-width: 0; } .feld label, .feldtitel { font-weight: 600; font-size: 16px; } .feldtitel { margin-bottom: -8px; }
input:not([type=checkbox]), textarea, select { width: 100%; min-width: 0; min-height: 52px; padding: 12px 14px; border-radius: 12px; border: 1.5px solid var(--linie); background: var(--karte); font-size: 17px; -webkit-appearance: none; appearance: none; }
input::placeholder, textarea::placeholder { color: var(--leise); opacity: .75; } textarea { resize: vertical; }
input.zahl { font: 650 32px/1.1 ui-monospace, "SF Mono", Consolas, monospace; min-height: 68px; letter-spacing: .04em; } input.zahl::placeholder { font: 400 17px/1.2 -apple-system, system-ui, sans-serif; letter-spacing: 0; }
.zwei { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; } .kmzeile { font-size: 17px; } .kmzeile strong { font-size: 24px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; } .chips:empty { display: none; } .chip { min-height: 44px; max-width: 100%; padding: 8px 14px; border-radius: 22px; background: var(--karte); border: 1.5px solid var(--linie); font-size: 15px; overflow-wrap: anywhere; } .chip.nah { border-color: var(--gruen); font-weight: 600; }
details { display: grid; } summary { min-height: 44px; padding: 10px 0; font-weight: 600; cursor: pointer; } details[open] > .feld { margin-bottom: 16px; }
.schalter { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 52px; } .schalter input { width: 28px; height: 28px; accent-color: var(--gruen); flex: none; }
.anmelden { max-width: 400px; width: 100%; margin: 8vh auto 0; gap: 20px; } .anmelden img { border-radius: 16px; }

/* Blätter */
.sheet { width: 100%; max-width: 560px; height: 100%; max-height: none; margin: 0 auto; padding: 0; border: 0; background: var(--grund); color: var(--tinte); overscroll-behavior: contain; }
.sheet::backdrop { background: #0008; }
.sheet-head { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; justify-content: space-between; min-height: 60px; padding: calc(env(safe-area-inset-top) + 6px) 16px 6px; background: var(--grund); }
.sheet-body { display: grid; gap: 14px; grid-template-columns: minmax(0, 1fr); padding: 8px 16px calc(32px + env(safe-area-inset-bottom)); } .sheet-body label { font-weight: 600; } .sheet .werte, .sheet .segmente .seg, .sheet .big.zweit { background: var(--karte); } .sheet .werte { padding: 16px; border-radius: 16px; } .sheet .segmente .seg[aria-checked=true] { background: var(--wahl); }

/* Navigation */
#tabs { position: fixed; inset: auto 0 0; display: flex; justify-content: center; background: var(--karte); border-top: 1px solid var(--linie); padding: 4px 4px env(safe-area-inset-bottom); z-index: 3; }
#tabs button { flex: 1; max-width: 112px; min-height: 58px; display: grid; justify-items: center; align-content: center; gap: 2px; position: relative; font-size: 12px; font-weight: 600; color: var(--leise); } #tabs button[aria-current] { color: var(--tinte); } #tabs button[aria-current] .icon { stroke-width: 2.4; }
.marke { position: absolute; top: 4px; left: calc(50% + 8px); min-width: 20px; padding: 0 6px; border-radius: 10px; background: var(--rot); color: #fff; font-size: 13px; line-height: 20px; text-align: center; }
