/* Layout: Karte oben, darunter eine Spalte Karten-Panels; große Ziele, sonnenlesbare Kontraste */
:root {
  --bg: #f4f6f8; --surface: #ffffff; --fg: #0e1216; --muted: #46505b; --line: #c9d0d8;
  --accent: #1747c2; --accent-fg: #ffffff; --accent-soft: #e3eafc;
  --warn: #9a4a00; --err: #b3261e; --ok: #1d6b3a;
  --v1: #1747c2; --v2: #c73a1d; --v3: #7b2cb5; --v4: #00707a;
  --s-asph: #3b434c; --s-paved: #8a939d; --s-unp: #a8742a; --s-unk: #d5dae0;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", sans-serif;
  --mono: ui-monospace, "Roboto Mono", "SFMono-Regular", Menlo, monospace;
  --r: 10px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) {
  --bg: #0d1014; --surface: #161b21; --fg: #eef1f4; --muted: #a3adb8; --line: #2d353e;
  --accent: #7fa3ff; --accent-fg: #0b1230; --accent-soft: #1c2742;
  --warn: #f0a24a; --err: #ff8a80; --ok: #7fd69b;
  --v1: #7fa3ff; --v2: #ff8a65; --v3: #c792ff; --v4: #4fd1c5;
  --s-asph: #cfd6de; --s-paved: #7d8894; --s-unp: #d49a4a; --s-unk: #3a434d;
  color-scheme: dark; } }
:root[data-theme="dark"] {
  --bg: #0d1014; --surface: #161b21; --fg: #eef1f4; --muted: #a3adb8; --line: #2d353e;
  --accent: #7fa3ff; --accent-fg: #0b1230; --accent-soft: #1c2742;
  --warn: #f0a24a; --err: #ff8a80; --ok: #7fd69b;
  --v1: #7fa3ff; --v2: #ff8a65; --v3: #c792ff; --v4: #4fd1c5;
  --s-asph: #cfd6de; --s-paved: #7d8894; --s-unp: #d49a4a; --s-unk: #3a434d;
  color-scheme: dark; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .leaflet-tile-pane { filter: invert(.92) hue-rotate(180deg) brightness(.95) contrast(.9); } }
:root[data-theme="dark"] .leaflet-tile-pane { filter: invert(.92) hue-rotate(180deg) brightness(.95) contrast(.9); }

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--fg); font: 17px/1.4 var(--font); -webkit-text-size-adjust: 100%; }
header { position: sticky; top: 0; z-index: 1000; display: flex; align-items: center; gap: 6px; padding: calc(env(safe-area-inset-top, 0px) + 8px) 12px 8px 16px; background: var(--surface); border-bottom: 1px solid var(--line); }
header h1 { font-size: 18px; margin: 0; flex: 1; font-weight: 700; letter-spacing: .01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#map { height: 44vh; height: 44svh; min-height: 250px; background: var(--line); }
main { display: grid; gap: 14px; padding: 14px 16px calc(env(safe-area-inset-bottom, 0px) + 32px); max-width: 720px; margin: 0 auto; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 14px; display: grid; gap: 12px; min-width: 0; }
.card.panel { border: 2px solid var(--accent); }
.card h2 { margin: 0; font-size: 18px; }
.grid-pt { display: grid; gap: 8px; min-width: 0; }
label, .lbl { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.row { display: flex; gap: 8px; align-items: stretch; flex-wrap: wrap; }
.row.between { justify-content: space-between; align-items: center; }
.row > .grow { flex: 1 1 120px; min-width: 0; }
input[type=text], input[type=number], input[type=url], select {
  font: inherit; color: var(--fg); background: var(--bg); border: 2px solid var(--line); border-radius: 8px;
  min-height: 50px; padding: 8px 12px; width: 100%; }
input:focus-visible, select:focus-visible, button:focus-visible, summary:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
button { font: inherit; font-weight: 650; min-height: 50px; padding: 8px 14px; border-radius: 8px; border: 2px solid var(--line); background: var(--surface); color: var(--fg); cursor: pointer; }
button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); width: 100%; min-height: 58px; font-size: 19px; }
button.ghost { min-height: 42px; padding: 6px 10px; font-size: 15px; }
button.danger { color: var(--err); }
button[aria-pressed="true"] { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
button:disabled { opacity: .55; cursor: default; }
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; border: 2px solid var(--line); border-radius: 10px; overflow: hidden; }
.seg button { border: 0; border-radius: 0; min-height: 50px; background: var(--surface); padding: 6px 8px; }
.seg button[aria-pressed="true"] { background: var(--accent); color: var(--accent-fg); box-shadow: none; }
.presets { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.presets button { display: grid; gap: 2px; text-align: left; min-height: 58px; padding: 8px 12px; }
.presets button small { font-weight: 500; font-size: 13px; color: var(--muted); font-family: var(--mono); }
.presets button[aria-pressed="true"] { background: var(--accent-soft); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips button { min-height: 40px; padding: 4px 12px; border-radius: 20px; font-size: 15px; }
.chips button[aria-pressed="true"] { background: var(--accent-soft); }
.hint { font-size: 14px; color: var(--muted); margin: 0; }
.results { display: grid; gap: 4px; }
.results button { text-align: left; font-weight: 500; font-size: 15px; min-height: 46px; }
.pt { font-size: 14px; color: var(--muted); font-family: var(--mono); overflow-wrap: anywhere; text-align: right; }
.pt.set { color: var(--ok); }
.check { display: flex; align-items: center; gap: 10px; min-height: 48px; font-weight: 600; text-transform: none; letter-spacing: 0; color: var(--fg); font-size: 16px; cursor: pointer; }
.check input { width: 22px; height: 22px; accent-color: var(--accent); }
.calc { font-family: var(--mono); font-variant-numeric: tabular-nums; font-size: 15px; color: var(--muted); }
#status { min-height: 1.4em; font-size: 15px; margin: 0; }
#status.warn { color: var(--warn); } #status.err { color: var(--err); font-weight: 650; } #status.ok { color: var(--ok); }
.variants { display: grid; gap: 8px; }
.variant { display: grid; grid-template-columns: 14px 1fr auto; gap: 10px; align-items: center; text-align: left; font-weight: 500; }
.variant[aria-pressed="true"] { border-width: 3px; }
.variant .sw { width: 14px; align-self: stretch; min-height: 38px; border-radius: 4px; }
.variant .body { min-width: 0; display: grid; gap: 2px; }
.variant .name { font-weight: 700; overflow-wrap: anywhere; }
.variant .meta { font-family: var(--mono); font-variant-numeric: tabular-nums; font-size: 13px; color: var(--muted); }
.variant .km { font-family: var(--mono); font-variant-numeric: tabular-nums; font-size: 20px; font-weight: 700; }
.badge { display: inline-block; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; padding: 2px 6px; border-radius: 4px; background: var(--accent); color: var(--accent-fg); margin-left: 6px; vertical-align: 2px; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.stat { display: grid; gap: 2px; min-width: 0; }
.stat b { font-family: var(--mono); font-variant-numeric: tabular-nums; font-size: 18px; white-space: nowrap; }
.kv { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; font-size: 15px; }
.kv span:nth-child(even) { font-family: var(--mono); font-variant-numeric: tabular-nums; text-align: right; }
.block { display: grid; gap: 6px; }
.bar { display: flex; height: 16px; border-radius: 4px; overflow: hidden; border: 1px solid var(--line); }
.bar span { display: block; height: 100%; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 14px; }
.legend i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }
.notes { margin: 0; padding-left: 18px; font-size: 15px; color: var(--warn); }
.trade { font-size: 15px; margin: 0; }
.list { display: grid; gap: 6px; }
.item { display: grid; grid-template-columns: 1fr auto; gap: 6px; align-items: center; }
.item > button:first-child { text-align: left; font-weight: 500; font-size: 15px; min-width: 0; overflow-wrap: anywhere; }
.item small { display: block; color: var(--muted); font-family: var(--mono); font-size: 13px; }
.pin { width: 30px; height: 30px; border-radius: 50% 50% 50% 0; transform: rotate(-45deg); border: 3px solid #fff; box-shadow: 0 1px 4px rgba(0,0,0,.5); display: grid; place-items: center; }
.pin span { transform: rotate(45deg); color: #fff; font: 700 14px/1 var(--font); }
.kmm span { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--surface); color: var(--fg); border: 2px solid var(--fg); font: 700 11px/1 var(--mono); }
.xm span { display: grid; place-items: center; width: 20px; height: 20px; border-radius: 4px; background: var(--warn); color: var(--surface); border: 2px solid #fff; font: 700 11px/1 var(--mono); }
.leaflet-container { font: 13px/1.3 var(--font); }
footer { font-size: 13px; color: var(--muted); text-align: center; }
footer a { color: inherit; }
details summary { cursor: pointer; font-weight: 650; min-height: 32px; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
