/* Farben, Schriften und Ampel wie in den Reise-Cockpits (kreta-cockpit), damit alles aus einem Guss wirkt. */
:root {
  --display: "GFS Didot", "Didot", "Bodoni 72", Georgia, serif;
  --body: "Source Sans 3", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --bg: #f7f4ed; --surface: #ffffff; --surface-2: #f2efe7; --line: #dbe3e8; --line-soft: #e8eef2;
  --ink: #10232f; --muted: #4e6572; --faint: #59707c;
  --sea: #0d5c8c; --sea-soft: #d9e9f3;
  --ok: #2b764a; --mid: #8e5e18; --bad: #b2382c; --na: #b3bdc0;
  --ok-bg: #dcefe3; --mid-bg: #f6ead2; --bad-bg: #f5dcd8; --na-bg: #eef1f1;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0d161b; --surface: #142129; --surface-2: #1b2b34; --line: #253842; --line-soft: #1d2f38;
    --ink: #e4ecee; --muted: #9aabb2; --faint: #85949b;
    --sea: #5cb0cf; --sea-soft: #173847;
    --ok: #45b074; --mid: #d9a33a; --bad: #e0675a; --na: #4b5d65;
    --ok-bg: #173226; --mid-bg: #33280f; --bad-bg: #3a1c19; --na-bg: #1b2a31;
  }
}
:root[data-theme="dark"] {
  --bg: #0d161b; --surface: #142129; --surface-2: #1b2b34; --line: #253842; --line-soft: #1d2f38;
  --ink: #e4ecee; --muted: #9aabb2; --faint: #85949b;
  --sea: #5cb0cf; --sea-soft: #173847;
  --ok: #45b074; --mid: #d9a33a; --bad: #e0675a; --na: #4b5d65;
  --ok-bg: #173226; --mid-bg: #33280f; --bad-bg: #3a1c19; --na-bg: #1b2a31;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.5 var(--body);
  padding-inline: max(16px, env(safe-area-inset-left)) max(16px, env(safe-area-inset-right));
  padding-bottom: calc(96px + env(safe-area-inset-bottom));
}
.wrap { max-width: 560px; margin: 0 auto; }
.num, .mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
h1, h2 { font-family: var(--display); font-weight: 400; margin: 0; text-wrap: balance; }
h1 { color: var(--sea); font-size: clamp(28px, 8vw, 40px); line-height: 1.05; white-space: nowrap; }
h2 { font-size: 22px; line-height: 1.15; }
h3 { font-size: 14px; margin: 22px 0 6px; font-weight: 700; }
a { color: var(--sea); }
.eyebrow { font-family: var(--mono); font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--faint); }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.fuss { text-align: center; margin: 18px 0; }

header.top { padding-block: max(18px, env(safe-area-inset-top)) 12px; display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; }
header.top .meta { display: flex; flex-direction: column; gap: 2px; }
header.top .eyebrow { color: var(--sea); opacity: .75; }
.kopf-rechts { display: flex; align-items: center; gap: 8px; }
.pill { display: inline-flex; align-items: center; font-family: var(--mono); font-size: 12px; padding: 3px 9px; border-radius: 999px; background: var(--sea-soft); color: var(--sea); white-space: nowrap; }

.karte { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 16px; margin-bottom: 12px; }
.karte:empty { display: none; }
.karte > .eyebrow { display: block; margin-bottom: 6px; }

/* Ampel-Karte */
.ampel { border-left: 6px solid var(--na); }
.ampel.ok { border-left-color: var(--ok); }
.ampel.mid { border-left-color: var(--mid); }
.ampel.bad { border-left-color: var(--bad); }
.gross { font-family: var(--mono); font-variant-numeric: tabular-nums; font-size: clamp(30px, 9vw, 40px); font-weight: 600; line-height: 1.1; letter-spacing: -0.01em; }
.urteil { display: inline-block; margin: 8px 0 4px; padding: 4px 10px; border-radius: 8px; font-weight: 700; }
.urteil.ok { background: var(--ok-bg); color: var(--ok); }
.urteil.mid { background: var(--mid-bg); color: var(--mid); }
.urteil.bad { background: var(--bad-bg); color: var(--bad); }
.urteil.na { background: var(--na-bg); color: var(--muted); }
.zusatz { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line-soft); }

/* Kennzahlen */
.zeilen { display: grid; gap: 6px; margin-top: 10px; }
.zeile { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; }
.zeile .num { white-space: nowrap; font-weight: 500; }
.plus { color: var(--bad); }
.minus { color: var(--ok); }

.balken { position: relative; height: 12px; border-radius: 6px; background: var(--surface-2); border: 1px solid var(--line-soft); overflow: hidden; margin-top: 10px; }
.balken > .fuell { position: absolute; inset: 0 auto 0 0; background: var(--sea); border-radius: 6px 0 0 6px; }
.balken > .fuell.bad { background: var(--bad); }
.balken > .fuell.mid { background: var(--mid); }
.balken > .fuell.ok { background: var(--ok); }
.balken > .marke { position: absolute; top: -2px; bottom: -2px; width: 2px; background: var(--ink); }
.legende { display: flex; justify-content: space-between; font-size: 12px; color: var(--faint); margin-top: 4px; }

/* Vertragsjahre */
.jahr { margin-top: 12px; }
.jahr:first-of-type { margin-top: 8px; }
.jahr .zeile > span:first-child { font-weight: 600; white-space: nowrap; }
.jahr .zeile .num { font-size: 14px; }

/* Planungsrechner */
input[type="range"] { width: 100%; accent-color: var(--sea); margin: 14px 0 4px; height: 28px; }
.planer-ergebnis { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.ziele { display: grid; gap: 6px; margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line-soft); }
.ziel { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; background: none; border: 0; padding: 4px 0; font: inherit; color: inherit; text-align: left; cursor: pointer; }
.ziel .num { color: var(--sea); font-weight: 600; white-space: nowrap; }

/* Diagramm */
.diagramm svg { display: block; width: 100%; height: auto; margin-top: 8px; overflow: visible; }
.diagramm .achse { stroke: var(--line); stroke-width: 1; }
.diagramm .gitter { stroke: var(--line-soft); stroke-width: 1; }
.diagramm .beschr { fill: var(--faint); font: 10px var(--mono); }
.diagramm .band { fill: var(--ok-bg); }
.diagramm .soll { stroke: var(--ok); stroke-width: 1.5; stroke-dasharray: 4 3; fill: none; }
.diagramm .ist { stroke: var(--sea); stroke-width: 2.5; fill: none; stroke-linejoin: round; stroke-linecap: round; }
.diagramm .punkt { fill: var(--surface); stroke: var(--sea); stroke-width: 2; }
.diagramm .prog { stroke-width: 2; stroke-dasharray: 2 4; fill: none; stroke-linecap: round; }
.diagramm .prog.ok { stroke: var(--ok); } .diagramm .prog.mid { stroke: var(--mid); } .diagramm .prog.bad { stroke: var(--bad); }
.diagramm .heute { stroke: var(--faint); stroke-width: 1; stroke-dasharray: 1 3; }
.diagramm-legende { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 12px; color: var(--muted); margin-top: 8px; }
.diagramm-legende i { display: inline-block; width: 14px; height: 3px; vertical-align: middle; margin-right: 5px; border-radius: 2px; }

/* Verlauf */
.liste { list-style: none; margin: 8px 0 0; padding: 0; }
.liste li { border-top: 1px solid var(--line-soft); }
.liste button { display: flex; width: 100%; align-items: center; gap: 12px; padding: 10px 0; background: none; border: 0; font: inherit; color: inherit; text-align: left; cursor: pointer; }
.liste img, .liste .ohne-foto { width: 52px; height: 40px; border-radius: 6px; object-fit: cover; background: var(--surface-2); flex: none; }
.liste .ohne-foto { display: grid; place-items: center; font-size: 11px; color: var(--faint); }
.liste .mitte { flex: 1; min-width: 0; }
.liste .rechts { text-align: right; white-space: nowrap; }

/* Hinweise oben */
.hinweis { display: flex; gap: 10px; align-items: flex-start; justify-content: space-between; border-radius: 12px; padding: 10px 12px; margin-bottom: 10px; font-size: 14px; background: var(--mid-bg); color: var(--ink); border: 1px solid color-mix(in srgb, var(--mid) 35%, transparent); }
.hinweis button { flex: none; }

/* Knoepfe */
.knopf { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 10px 16px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font: 600 15px var(--body); cursor: pointer; text-decoration: none; }
/* Schrift in Hintergrundfarbe: hell auf dunklem Blau, im Dunkelmodus dunkel auf hellem Blau. */
.knopf.haupt { background: var(--sea); border-color: var(--sea); color: var(--bg); }
.knopf.leise { background: transparent; }
.knopf.gefahr { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 40%, transparent); }
.knopf.klein { min-height: 32px; padding: 4px 10px; font-size: 13px; }
.knopf:disabled { opacity: .5; cursor: default; }
.knopf-reihe { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.knopf-reihe > * { flex: 1 1 auto; }
.icon-knopf { display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--muted); font-size: 16px; cursor: pointer; }

.aktion-leiste { position: fixed; inset: auto 0 0 0; padding: 10px max(16px, env(safe-area-inset-left)) calc(10px + env(safe-area-inset-bottom)); background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(8px); border-top: 1px solid var(--line); z-index: 10; }
.aktion-leiste .knopf { display: flex; width: 100%; max-width: 560px; margin: 0 auto; font-size: 16px; min-height: 50px; }

/* Dialoge */
dialog.vollbild { width: 100%; max-width: 560px; max-height: 100dvh; height: 100dvh; margin: 0 auto; padding: max(14px, env(safe-area-inset-top)) 16px calc(20px + env(safe-area-inset-bottom)); border: 0; background: var(--bg); color: var(--ink); overflow-y: auto; }
@media (min-width: 600px) { dialog.vollbild { height: auto; max-height: 92dvh; margin: 4vh auto; border-radius: 16px; border: 1px solid var(--line); } }
dialog::backdrop { background: rgb(0 0 0 / .5); }
.dlg-kopf { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 12px; }

.sucher { position: relative; border-radius: 14px; overflow: hidden; background: #000; aspect-ratio: 3 / 4; max-height: 62dvh; width: 100%; }
.sucher video { width: 100%; height: 100%; object-fit: cover; display: block; }
/* Rahmen: Lage und Groesse muessen zu RAHMEN in kamera.js passen. */
.rahmen { position: absolute; left: 10%; width: 80%; top: 41%; height: 18%; border: 3px solid #fff; border-radius: 10px; box-shadow: 0 0 0 100vmax rgb(0 0 0 / .45); }
.rahmen span { position: absolute; left: 0; right: 0; top: calc(100% + 8px); text-align: center; color: #fff; font-size: 13px; text-shadow: 0 1px 2px #000; }

#vorschau { width: 100%; max-height: 34dvh; object-fit: contain; border-radius: 12px; background: #000; display: block; }
.feld { display: grid; gap: 4px; margin-top: 12px; }
.feld > span { font-size: 13px; color: var(--muted); font-weight: 600; }
.feld input { font: 500 18px var(--mono); padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); width: 100%; min-height: 46px; }
#eingabe-km { font-size: 26px; letter-spacing: 0.02em; }
.raster { display: grid; grid-template-columns: 1fr 1fr; gap: 0 10px; }
.raster .feld input { font-size: 15px; }
.raster .breit { grid-column: 1 / -1; }
.meldung { margin: 10px 0 0; padding: 8px 10px; border-radius: 10px; font-size: 14px; background: var(--bad-bg); color: var(--bad); }
.meldung.frage { background: var(--mid-bg); color: var(--ink); }
.hinweisliste { padding-left: 18px; }
.hinweisliste li { margin-bottom: 4px; }
