/* Spritmonitor – eine Datei, keine Abhängigkeiten.
   Farb- und Typo-Entscheidungen sind in DESIGN.md begründet. */

:root {
  color-scheme: light dark;

  --bg:         oklch(97.5% 0.004 250);
  --surface:    oklch(100%  0     0);
  --surface-2:  oklch(96%   0.005 250);
  --ink:        oklch(22%   0.012 250);
  --ink-soft:   oklch(46%   0.014 250);
  --line:       oklch(90%   0.006 250);
  --line-strong:oklch(82%   0.008 250);

  --accent:     oklch(52% 0.16 250);
  --accent-ink: oklch(100% 0 0);
  --accent-bg:  oklch(52% 0.16 250 / 0.10);

  --good:       oklch(44% 0.13 155);
  --good-bg:    oklch(44% 0.13 155 / 0.11);
  --bad:        oklch(50% 0.18 25);
  --bad-bg:     oklch(50% 0.18 25 / 0.11);
  --warn:       oklch(45% 0.11 75);
  --warn-bg:    oklch(70% 0.14 75 / 0.18);

  --radius:     12px;
  --radius-sm:  8px;

  --s1: 4px;  --s2: 8px;  --s3: 12px; --s4: 16px;
  --s5: 20px; --s6: 24px; --s7: 32px; --s8: 44px;

  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --ease: cubic-bezier(.22, .61, .36, 1);
  --z-sticky: 100;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg:         oklch(17% 0.008 250);
    --surface:    oklch(21% 0.008 250);
    --surface-2:  oklch(25% 0.009 250);
    --ink:        oklch(93% 0.006 250);
    --ink-soft:   oklch(70% 0.012 250);
    --line:       oklch(30% 0.010 250);
    --line-strong:oklch(38% 0.012 250);

    --accent:     oklch(72% 0.14 250);
    --accent-ink: oklch(17% 0.02 250);
    --accent-bg:  oklch(72% 0.14 250 / 0.16);

    --good:       oklch(76% 0.15 155);
    --good-bg:    oklch(76% 0.15 155 / 0.15);
    --bad:        oklch(76% 0.16 25);
    --bad-bg:     oklch(76% 0.16 25 / 0.15);
    --warn:       oklch(80% 0.13 75);
    --warn-bg:    oklch(80% 0.13 75 / 0.16);
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 0.9375rem/1.55 var(--sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.wrap { max-width: 1120px; margin: 0 auto; padding: 0 var(--s5); }

:where(a, button, input, select, textarea, summary):focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* ---------- Kopf und Navigation ---------- */

.top {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.top .wrap {
  display: flex; flex-wrap: wrap; gap: var(--s4);
  align-items: baseline; justify-content: space-between;
  padding-top: var(--s5); padding-bottom: var(--s4);
}
h1 { margin: 0; font-size: 1.375rem; font-weight: 650; letter-spacing: -0.015em; }
.top .sub { margin: var(--s1) 0 0; color: var(--ink-soft); font-size: 0.8125rem; }
.status { display: flex; align-items: center; gap: var(--s3); flex-wrap: wrap; font-size: 0.8125rem; color: var(--ink-soft); }

.nav {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: var(--z-sticky);
}
.nav .wrap { display: flex; gap: var(--s1); overflow-x: auto; scrollbar-width: none; }
.nav .wrap::-webkit-scrollbar { display: none; }
.nav a {
  padding: var(--s3) var(--s4);
  color: var(--ink-soft); text-decoration: none;
  font-size: 0.875rem; font-weight: 500; white-space: nowrap;
  border-bottom: 2px solid transparent;
  transition: color .15s var(--ease), border-color .15s var(--ease);
}
.nav a:hover { color: var(--ink); }
.nav a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--accent); font-weight: 600; }

main.wrap { padding-top: var(--s6); padding-bottom: var(--s8); }

/* ---------- Flächen ---------- */

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: var(--s5);
  margin-bottom: var(--s5);
}
.panel > :first-child { margin-top: 0; }
.panel > :last-child  { margin-bottom: 0; }

h2 { margin: 0 0 var(--s4); font-size: 1.0625rem; font-weight: 620; letter-spacing: -0.01em; text-wrap: balance; }
h3 { margin: var(--s6) 0 var(--s3); font-size: 0.9375rem; font-weight: 600; }
p  { margin: 0 0 var(--s3); max-width: 72ch; text-wrap: pretty; }
.muted { color: var(--ink-soft); }
.small { font-size: 0.8125rem; }
a { color: var(--accent); text-underline-offset: 2px; }

.cols { display: grid; gap: var(--s5); }
@media (min-width: 800px) { .cols.two { grid-template-columns: 1fr 1fr; } }

/* ---------- Die Antwort oben ---------- */

.verdict {
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  padding: var(--s6) var(--s5);
  margin-bottom: var(--s5);
}
.verdict .lead { font-size: 1.25rem; font-weight: 620; letter-spacing: -0.01em; margin: 0 0 var(--s2); text-wrap: balance; }
.verdict .lead.yes { color: var(--good); }
.verdict .lead.no  { color: var(--bad); }
.verdict p:last-child { margin-bottom: 0; }

/* ---------- Kennzahlen ---------- */

.figures { display: flex; flex-wrap: wrap; gap: var(--s6) var(--s7); margin: 0; }
.figure { margin: 0; min-width: 8rem; }
.figure dt {
  font-size: 0.8125rem; font-weight: 500; color: var(--ink-soft);
  margin-bottom: var(--s1);
}
.figure dd {
  margin: 0;
  font-size: 1.75rem; font-weight: 600; letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  line-height: 1.15;
}
.figure dd .unit { font-size: 0.9375rem; font-weight: 500; color: var(--ink-soft); margin-left: 2px; }
.figure .note { display: block; font-size: 0.75rem; color: var(--ink-soft); margin-top: var(--s1); font-weight: 400; }

/* Herkunft einer Zahl – nie nur Farbe, immer auch Wort. */
.origin {
  display: inline-block; vertical-align: 2px;
  font-size: 0.6875rem; font-weight: 600; letter-spacing: .01em;
  padding: 1px var(--s2); border-radius: 999px; margin-left: var(--s2);
}
.origin.gemessen   { background: var(--good-bg); color: var(--good); }
.origin.abgeleitet { background: var(--accent-bg); color: var(--accent); }
.origin.annahme    { background: var(--warn-bg); color: var(--warn); }

.badge {
  display: inline-block; padding: 2px var(--s2); border-radius: 999px;
  font-size: 0.75rem; font-weight: 600;
}
.badge.ok   { background: var(--good-bg); color: var(--good); }
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.bad  { background: var(--bad-bg);  color: var(--bad); }

/* ---------- Hinweise ---------- */

.notice {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: var(--s4) var(--s5);
  margin-bottom: var(--s5);
  font-size: 0.875rem;
}
.notice.warn { background: var(--warn-bg); border-color: transparent; color: var(--ink); }
.notice.bad  { background: var(--bad-bg);  border-color: transparent; color: var(--ink); }
.notice p:last-child { margin-bottom: 0; }
.notice strong { font-weight: 620; }

/* ---------- Auswahl ---------- */

.switcher { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2); margin-bottom: var(--s4); }
.switcher .label { font-size: 0.8125rem; font-weight: 500; color: var(--ink-soft); margin-right: var(--s2); }
.chip {
  display: inline-block; padding: var(--s2) var(--s4);
  border: 1px solid var(--line-strong); border-radius: 999px;
  background: var(--surface); color: var(--ink);
  font-size: 0.8125rem; font-weight: 500; text-decoration: none;
  transition: background .15s var(--ease), border-color .15s var(--ease);
}
.chip:hover { background: var(--surface-2); }
.chip[aria-pressed="true"], .chip.active {
  background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600;
}
/* Nebentext im ausgewählten Chip: grau auf blau ist nicht lesbar. */
.chip.active .muted, .chip[aria-pressed="true"] .muted { color: inherit; opacity: .75; }
.chip.disabled { opacity: .55; pointer-events: none; }

/* ---------- Tabellen ---------- */

.scroll { overflow-x: auto; margin: 0 calc(var(--s5) * -1); padding: 0 var(--s5); }
table.grid { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
table.grid th, table.grid td { padding: var(--s3) var(--s3); text-align: left; border-bottom: 1px solid var(--line); }
table.grid thead th {
  font-size: 0.75rem; font-weight: 600; color: var(--ink-soft);
  background: var(--surface-2); white-space: nowrap;
}
table.grid thead th:first-child { border-top-left-radius: var(--radius-sm); }
table.grid thead th:last-child  { border-top-right-radius: var(--radius-sm); }
/* Die letzte Zeile behält ihre Linie: ohne sie franst die Tabelle unten aus. */
table.grid tbody tr:last-child td,
table.grid tbody tr:last-child th { border-bottom: 1px solid var(--line-strong); }
table.grid td.num, table.grid th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
table.grid td.num .p { font-weight: 600; }
table.grid .who { display: block; font-size: 0.75rem; color: var(--ink-soft); font-weight: 400; margin-top: 1px; }
table.grid tr.row-active td { background: var(--accent-bg); }
.d.better { color: var(--good); font-weight: 600; }
.d.worse  { color: var(--bad);  font-weight: 600; }

/* ---------- Grafiken ---------- */

figure.chart { margin: 0 0 var(--s4); }
figure.chart figcaption { font-size: 0.8125rem; color: var(--ink-soft); margin-bottom: var(--s3); }
svg.chart { display: block; width: 100%; height: auto; overflow: visible; }
svg.chart .axis      { stroke: var(--line); stroke-width: 1; }
svg.chart .gridline  { stroke: var(--line); stroke-width: 1; stroke-dasharray: 2 4; }
svg.chart .tick      { fill: var(--ink-soft); font-size: 10px; font-family: var(--sans); }
svg.chart .line      { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
svg.chart .area      { fill: var(--accent-bg); }
svg.chart .bar       { fill: var(--accent); }
svg.chart .bar.low   { fill: var(--good); }
svg.chart .bar.high  { fill: var(--bad); }
svg.chart .bar.dim   { fill: var(--line-strong); }

.legend { display: flex; flex-wrap: wrap; gap: var(--s4); font-size: 0.75rem; color: var(--ink-soft); margin-top: var(--s2); }
.legend span { display: inline-flex; align-items: center; gap: var(--s2); }
.legend i { width: 10px; height: 10px; border-radius: 2px; display: inline-block; }

/* ---------- Formulare ---------- */

.form { display: grid; gap: var(--s4); }
@media (min-width: 640px) { .form.grid2 { grid-template-columns: 1fr 1fr; } }
.field { display: flex; flex-direction: column; gap: var(--s1); min-width: 0; }
.field label { font-size: 0.8125rem; font-weight: 500; color: var(--ink-soft); }
.field .hint { font-size: 0.75rem; color: var(--ink-soft); }
input, select, textarea {
  font: inherit; color: var(--ink);
  background: var(--surface-2);
  border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  padding: var(--s3) var(--s3);
  min-height: 42px; width: 100%;
  transition: border-color .15s var(--ease);
}
input[type="number"] { font-variant-numeric: tabular-nums; }
input:hover, select:hover, textarea:hover { border-color: var(--ink-soft); }
input::placeholder, textarea::placeholder { color: var(--ink-soft); opacity: 1; }
.checkline { display: flex; align-items: center; gap: var(--s3); }
.checkline input { width: auto; min-height: 0; }
.checkline label { color: var(--ink); font-size: 0.9375rem; }

button, .button {
  font: inherit; font-weight: 600; font-size: 0.875rem;
  padding: var(--s3) var(--s5); min-height: 42px;
  border-radius: var(--radius-sm); border: 1px solid transparent;
  background: var(--accent); color: var(--accent-ink);
  cursor: pointer; text-decoration: none; display: inline-flex;
  align-items: center; justify-content: center; gap: var(--s2);
  transition: filter .15s var(--ease);
}
button:hover, .button:hover { filter: brightness(1.08); }
button:active, .button:active { filter: brightness(.95); }
button[disabled] { opacity: .55; cursor: not-allowed; }
button.ghost, .button.ghost {
  background: var(--surface); color: var(--ink); border-color: var(--line-strong);
}
button.ghost:hover, .button.ghost:hover { background: var(--surface-2); filter: none; }
button.quiet {
  background: none; color: var(--ink-soft); border: none; min-height: 0;
  padding: var(--s1) var(--s2); font-size: 0.8125rem; font-weight: 500;
}
button.quiet:hover { color: var(--bad); filter: none; }
.actions { display: flex; flex-wrap: wrap; gap: var(--s3); align-items: center; margin-top: var(--s2); }

/* ---------- Leere Zustände ---------- */

.empty {
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-sm);
  padding: var(--s6) var(--s5);
  text-align: left;
  color: var(--ink-soft);
  font-size: 0.875rem;
}
.empty strong { display: block; color: var(--ink); font-weight: 620; margin-bottom: var(--s1); }
.empty p { margin: 0; max-width: 60ch; }

/* ---------- Fuß ---------- */

.foot {
  border-top: 1px solid var(--line);
  margin-top: var(--s8);
  padding: var(--s5) 0 var(--s7);
  font-size: 0.8125rem; color: var(--ink-soft);
}
.foot p { margin: 0 0 var(--s1); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 1ms !important; animation-duration: 1ms !important; }
}

/* ---------- Kostenvergleich ---------- */

.compare { display: grid; gap: var(--s3); }
.compare-row {
  display: grid;
  grid-template-columns: minmax(7rem, auto) 1fr minmax(6rem, auto);
  align-items: center;
  gap: var(--s3);
}
.compare-label { font-size: 0.875rem; font-weight: 500; }
.compare-track { background: var(--surface-2); border-radius: 999px; height: 12px; overflow: hidden; }
.compare-track i { display: block; height: 100%; border-radius: 999px; transition: width .2s var(--ease); }
.compare-value { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; white-space: nowrap; }
.compare-value .unit { font-size: 0.75rem; font-weight: 500; color: var(--ink-soft); }
.compare-note { grid-column: 1 / -1; font-size: 0.75rem; color: var(--ink-soft); margin-top: calc(var(--s2) * -1); }

@media (max-width: 520px) {
  .compare-row { grid-template-columns: 1fr auto; }
  .compare-track { grid-column: 1 / -1; order: 3; }
}

@media (max-width: 480px) {
  .nav a { padding: var(--s3) var(--s2); font-size: 0.8125rem; }
  .wrap { padding: 0 var(--s4); }
  .panel { padding: var(--s4); }
  .scroll { margin: 0 calc(var(--s4) * -1); padding: 0 var(--s4); }
  .figure dd { font-size: 1.5rem; }
}

/* ---------- Belege ---------- */

.beleg-split { display: grid; gap: var(--s5); align-items: start; }
@media (min-width: 760px) { .beleg-split { grid-template-columns: minmax(0, 320px) 1fr; } }
.beleg-bild {
  display: block; width: 100%; height: auto;
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--surface-2);
}
.posten {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: var(--s4);
  margin-bottom: var(--s3);
  background: var(--surface-2);
}
.posten .field label { font-size: 0.75rem; }
.posten input, .posten select { background: var(--surface); min-height: 38px; }
input[type="file"] {
  padding: var(--s2); background: var(--surface-2); cursor: pointer;
}
input[type="file"]::file-selector-button {
  font: inherit; font-weight: 600; font-size: 0.8125rem;
  margin-right: var(--s3); padding: var(--s2) var(--s3);
  border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--ink); cursor: pointer;
}
.posten.gebucht {
  background: var(--good-bg); border-color: transparent;
  font-size: 0.875rem; display: flex; flex-wrap: wrap;
  align-items: center; gap: var(--s2);
}

/* Kennzeichen im Stil des Nummernschilds: blauer EU-Streifen links. */
.kennzeichen {
  display: inline-block;
  margin-left: var(--s2);
  padding: 1px var(--s2) 1px calc(var(--s2) + 7px);
  border: 1px solid var(--ink);
  border-radius: 3px;
  background:
    linear-gradient(to right, oklch(38% 0.17 265) 0 6px, var(--surface) 6px);
  color: var(--ink);
  font-family: var(--mono);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  white-space: nowrap;
  vertical-align: 1px;
}

/* ---------- Aufklappbarer Zusatzbereich ---------- */

details.mehr {
  border-top: 1px solid var(--line);
  padding-top: var(--s4);
  margin-top: var(--s2);
}
details.mehr > summary {
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--accent);
  list-style: none;
  display: flex;
  align-items: center;
  gap: var(--s2);
}
details.mehr > summary::-webkit-details-marker { display: none; }
details.mehr > summary::before {
  content: "";
  width: 0; height: 0;
  border-left: 5px solid currentColor;
  border-top: 4px solid transparent;
  border-bottom: 4px solid transparent;
  transition: transform .15s var(--ease);
}
details.mehr[open] > summary::before { transform: rotate(90deg); }

fieldset.wahlfeld {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: var(--s3) var(--s4) var(--s4);
  margin: var(--s4) 0 0;
  display: flex;
  flex-wrap: wrap;
  gap: var(--s3) var(--s5);
}
fieldset.wahlfeld legend {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--ink-soft);
  padding: 0 var(--s2);
}
fieldset.wahlfeld label {
  display: inline-flex;
  align-items: center;
  gap: var(--s2);
  font-size: 0.875rem;
  cursor: pointer;
}
fieldset.wahlfeld input { width: auto; min-height: 0; }

/* ---------- Rangfolge der Tankorte ---------- */

table.grid.rang th[scope="row"] { padding-right: var(--s5); }
table.grid.rang .ort {
  display: block;
  font-size: 0.9375rem;
  font-weight: 620;
  letter-spacing: -0.005em;
}
table.grid.rang .who {
  display: block;
  font-size: 0.8125rem;
  color: var(--ink-soft);
  font-weight: 400;
  margin-top: 1px;
}
table.grid.rang a.who { text-decoration: none; }
table.grid.rang a.who:hover { color: var(--accent); text-decoration: underline; }
table.grid.rang td.num .p { font-size: 1.0625rem; }
table.grid.rang .ergebnis {
  display: block;
  font-size: 1.0625rem;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}
table.grid.rang .ergebnis.better { color: var(--good); }
table.grid.rang .ergebnis.worse  { color: var(--bad); }
table.grid.rang tbody + tbody { border-top: 1px solid var(--line-strong); }
table.grid.rang tr.zwischenzeile th {
  background: var(--surface-2);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--ink-soft);
  text-align: left;
  padding: var(--s2) var(--s3);
}
table.grid.rang tbody tr:not(.zwischenzeile) th,
table.grid.rang tbody tr:not(.zwischenzeile) td { padding-top: var(--s4); padding-bottom: var(--s4); }

.beleg-pdf {
  display: flex; flex-direction: column; gap: var(--s1);
  border: 1px dashed var(--line-strong); border-radius: var(--radius-sm);
  padding: var(--s6) var(--s5); text-decoration: none; color: var(--ink);
  background: var(--surface-2); text-align: center;
}
.beleg-pdf:hover { border-color: var(--accent); }
.beleg-pdf span { font-size: 0.75rem; color: var(--ink-soft); font-family: var(--mono); }

/* Stationslink in der Preistabelle: sichtbar klickbar, nicht als graue Nebenzeile. */
table.grid.rang a.station {
  color: var(--accent);
  text-decoration: none;
  font-size: 0.875rem;
  border-bottom: 1px solid transparent;
}
table.grid.rang a.station:hover { border-bottom-color: currentColor; }
table.grid.rang a.station::after {
  content: " ›";
  color: var(--ink-soft);
}

svg.chart.verbrauch .punkt { fill: var(--accent); stroke: var(--surface); stroke-width: 1.5; }
svg.chart.verbrauch .punkt:hover { fill: var(--ink); }
.posten.ausserhalb {
  background: var(--warn-bg); border-color: transparent; opacity: .8;
  font-size: 0.875rem; display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2);
}
.posten.ausserhalb .who { flex-basis: 100%; margin-top: 0; }

.zuordnung {
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--s3);
  padding: var(--s3) var(--s4); margin-bottom: var(--s5);
  background: var(--surface-2); border-radius: var(--radius-sm);
}
.zuordnung label { font-size: 0.8125rem; font-weight: 500; color: var(--ink-soft); }
.zuordnung select { width: auto; min-width: 16rem; min-height: 36px; }
.zuordnung .who { font-size: 0.75rem; color: var(--warn); }

/* ==========================================================================
   Schnellerfassung — gebaut für das Handy an der Zapfsäule.
   Große Ziele, wenig Text, alles mit dem Daumen erreichbar.
   ========================================================================== */

.schnell { max-width: 34rem; margin: 0 auto; }

.schnell-wahl {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  gap: var(--s2);
  margin-bottom: var(--s4);
}
.gross-chip {
  display: flex; align-items: center; justify-content: center;
  min-height: 52px; padding: var(--s3);
  border: 1px solid var(--line-strong); border-radius: var(--radius);
  background: var(--surface); color: var(--ink);
  font-size: 1rem; font-weight: 600; text-decoration: none;
  text-align: center; line-height: 1.2;
}
.gross-chip.active {
  background: var(--accent); border-color: var(--accent); color: var(--accent-ink);
}

.schnell-form {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: var(--s5);
  display: grid;
  gap: var(--s4);
}

/* Foto: das größte Ziel auf der Seite, weil es der schnellste Weg ist. */
.foto-feld {
  position: relative;
  display: flex; align-items: center; gap: var(--s4);
  min-height: 68px; padding: var(--s4);
  border: 2px dashed var(--line-strong); border-radius: var(--radius);
  background: var(--surface-2); cursor: pointer;
}
.foto-feld:active { border-color: var(--accent); }
.foto-feld input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.foto-feld::before {
  content: "";
  flex: 0 0 34px; height: 28px; border-radius: 5px;
  border: 2px solid var(--ink-soft);
  background:
    radial-gradient(circle at 50% 55%, var(--surface-2) 0 5px, var(--ink-soft) 5px 7px, transparent 7px),
    linear-gradient(var(--surface-2), var(--surface-2));
}
.foto-text { display: flex; flex-direction: column; gap: 2px; }
.foto-text strong { font-size: 0.9375rem; }
.foto-text span { font-size: 0.75rem; color: var(--ink-soft); }

.gross-feld { display: flex; flex-direction: column; gap: var(--s1); }
.gross-feld label {
  font-size: 0.8125rem; font-weight: 600; color: var(--ink-soft);
  letter-spacing: .01em;
}
.gross-feld input,
.gross-feld select {
  min-height: 56px;
  font-size: 1.375rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  padding: var(--s3) var(--s4);
  background: var(--surface-2);
}
.gross-feld select { font-size: 1rem; font-weight: 500; }
.gross-feld input:focus { background: var(--surface); }
.km-quelle { font-size: 0.75rem; color: var(--ink-soft); }

.gross-paar { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s3); }

.gross-schalter {
  display: flex; align-items: center; gap: var(--s4);
  min-height: 56px; padding: 0 var(--s4);
  border: 1px solid var(--line-strong); border-radius: var(--radius);
  background: var(--surface-2); cursor: pointer;
  font-size: 1rem; font-weight: 500;
}
.gross-schalter input { width: 26px; height: 26px; min-height: 0; flex: 0 0 auto; }

.gross-knopf {
  min-height: 60px;
  font-size: 1.0625rem;
  border-radius: var(--radius);
  margin-top: var(--s2);
}

/* Die letzten Einträge: antippen heißt ändern. */
.letzte { margin-top: var(--s6); }
.letzte h2 { font-size: 0.8125rem; color: var(--ink-soft); margin-bottom: var(--s3); }
.letzte-zeile {
  display: grid;
  grid-template-columns: 3.2rem 1fr auto auto 1rem;
  align-items: center;
  gap: var(--s3);
  min-height: 52px;
  padding: var(--s2) var(--s4);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  margin-bottom: var(--s2);
  background: var(--surface);
  color: var(--ink);
  text-decoration: none;
  font-variant-numeric: tabular-nums;
}
.letzte-zeile:active { background: var(--surface-2); }
.letzte-zeile .datum { font-size: 0.8125rem; color: var(--ink-soft); }
.letzte-zeile .menge { font-weight: 620; }
.letzte-zeile .betrag { font-size: 0.875rem; }
.letzte-zeile .km { font-size: 0.75rem; color: var(--ink-soft); }
.letzte-zeile .pfeil { color: var(--ink-soft); text-align: right; }

@media (max-width: 400px) {
  .letzte-zeile { grid-template-columns: 3rem 1fr auto 0.8rem; }
  .letzte-zeile .km { display: none; }
}

/* Navigation auf dem Handy: zwei Zeilen statt Seitwärtsscrollen. */
@media (max-width: 640px) {
  .nav .wrap {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 0;
    overflow: visible;
  }
  .nav a {
    padding: var(--s3) var(--s1);
    font-size: 0.6875rem;
    text-align: center;
    border-bottom-width: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .top .wrap { padding-top: var(--s4); padding-bottom: var(--s3); }
  h1 { font-size: 1.1875rem; }
  .verdict { padding: var(--s5) var(--s4); }
  .verdict .lead { font-size: 1.0625rem; }
}

/* ---------- Untere Leiste (nur Handy) ---------- */

.tabbar { display: none; }

@media (max-width: 640px) {
  .nav { display: none; }

  .tabbar {
    position: fixed;
    left: 0; right: 0; bottom: 0;
    z-index: var(--z-sticky);
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    background: var(--surface);
    border-top: 1px solid var(--line);
    /* Platz für die Hausgeste am iPhone */
    padding-bottom: env(safe-area-inset-bottom, 0);
  }
  .tabbar a {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 2px;
    min-height: 56px;
    color: var(--ink-soft);
    text-decoration: none;
  }
  .tabbar a[aria-current="page"] { color: var(--accent); }
  .tab-zeichen {
    font-size: 1.125rem; font-weight: 700; line-height: 1;
    width: 26px; height: 26px;
    display: flex; align-items: center; justify-content: center;
  }
  .tab-text { font-size: 0.625rem; font-weight: 600; letter-spacing: .01em; }

  /* Die Leiste verdeckt sonst den Seitenfuß. */
  main.wrap { padding-bottom: calc(72px + env(safe-area-inset-bottom, 0)); }
  .foot { margin-bottom: calc(56px + env(safe-area-inset-bottom, 0)); }
}

/* ---------- Kacheln auf der Mehr-Seite ---------- */

.kacheln { display: grid; gap: var(--s3); }
@media (min-width: 700px) { .kacheln { grid-template-columns: 1fr 1fr; } }
.kachel {
  display: flex; flex-direction: column; gap: var(--s1);
  padding: var(--s5);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  text-decoration: none; color: var(--ink);
}
.kachel:active, .kachel:hover { border-color: var(--accent); }
.kachel strong { font-size: 1rem; font-weight: 620; }
.kachel span { font-size: 0.8125rem; color: var(--ink-soft); }
.feld-hinweis {
  font-size: 0.75rem; color: var(--ink-soft);
  margin: calc(var(--s2) * -1) 0 0; max-width: none;
}

/* ==========================================================================
   Bedienelemente für die Schnellerfassung.
   Segmentwahl und Schalter, rein mit CSS: kein Skript, damit die Seite auch
   dann funktioniert, wenn unterwegs die Verbindung wackelt.
   ========================================================================== */

.gruppe { margin-top: var(--s5); }
.gruppe > .gruppe-titel {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--ink-soft);
  letter-spacing: .02em;
  margin: 0 0 var(--s2) var(--s2);
}

/* ---- Segmentwahl (Reifen, Fahrweise) ---- */

.segment {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  gap: 3px;
  padding: 3px;
  background: var(--surface-2);
  border-radius: var(--radius);
  border: 1px solid var(--line);
}
.segment input { position: absolute; opacity: 0; pointer-events: none; }
.segment label {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  min-height: 58px;
  border-radius: calc(var(--radius) - 4px);
  cursor: pointer;
  color: var(--ink-soft);
  font-size: 0.6875rem;
  font-weight: 600;
  text-align: center;
  transition: background .15s var(--ease), color .15s var(--ease);
}
.segment input:checked + label {
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 1px 2px rgb(0 0 0 / .08);
}
.segment input:focus-visible + label { outline: 2px solid var(--accent); outline-offset: 1px; }
.segment label svg { width: 24px; height: 24px; display: block; }
.segment input:checked + label svg { color: var(--accent); }

/* ---- Schalterzeilen (Strecken, Zubehör) ---- */

.schalter-liste {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface);
}
.schalter-zeile {
  display: grid;
  grid-template-columns: 26px 1fr 50px;
  align-items: center;
  gap: var(--s4);
  min-height: 54px;
  padding: 0 var(--s4);
  cursor: pointer;
  border-bottom: 1px solid var(--line);
}
.schalter-liste .schalter-zeile:last-child { border-bottom: none; }
.schalter-zeile:active { background: var(--surface-2); }
.schalter-zeile svg { width: 22px; height: 22px; color: var(--ink-soft); }
.schalter-zeile .text { font-size: 0.9375rem; font-weight: 500; }
.schalter-zeile input { position: absolute; opacity: 0; pointer-events: none; }

/* Der Schalter selbst */
.schalter-zeile .knopf {
  position: relative;
  width: 46px; height: 28px;
  border-radius: 999px;
  background: var(--line-strong);
  transition: background .18s var(--ease);
  justify-self: end;
}
.schalter-zeile .knopf::after {
  content: "";
  position: absolute;
  top: 3px; left: 3px;
  width: 22px; height: 22px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgb(0 0 0 / .25);
  transition: transform .18s var(--ease);
}
.schalter-zeile input:checked ~ .knopf { background: var(--good); }
.schalter-zeile input:checked ~ .knopf::after { transform: translateX(18px); }
.schalter-zeile input:checked ~ svg { color: var(--good); }
.schalter-zeile input:focus-visible ~ .knopf { outline: 2px solid var(--accent); outline-offset: 2px; }

@media (prefers-reduced-motion: reduce) {
  .schalter-zeile .knopf, .schalter-zeile .knopf::after { transition: none; }
}

.posten.geprueft  { background: var(--good-bg); border-color: transparent; }
.posten.abweichung { background: var(--warn-bg); border-color: transparent; }
.posten-kopf {
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--s3);
  font-size: 0.875rem;
}
.posten.geprueft .who, .posten.abweichung .who {
  display: block; margin-top: var(--s2); font-size: 0.8125rem; color: var(--ink-soft);
}
