:root {
  --bg: #f3f5f8; --surface: #ffffff; --text: #17212b; --muted: #5d6b7a; --line: #dfe4ea;
  --primary: #0f6fd1; --primary-ink: #ffffff; --accent: #f5b83d; --ok: #1f9d55; --warn: #c77700; --err: #c62828;
  --top: #0f1f2e; --radius: 12px; --shadow: 0 1px 3px rgba(15, 31, 46, .12);
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #0d1620; --surface: #15212d; --text: #e7edf3; --muted: #9aa9b8; --line: #2a3a4a; --primary: #4da3ff; --primary-ink: #06121e; --shadow: none; }
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; background: var(--bg); color: var(--text);
  padding-bottom: calc(72px + env(safe-area-inset-bottom)); -webkit-tap-highlight-color: transparent;
}
.hidden { display: none !important; }
.topbar {
  position: sticky; top: 0; z-index: 10; display: flex; align-items: center; justify-content: space-between;
  gap: 8px; padding: 10px 16px; padding-top: calc(10px + env(safe-area-inset-top)); background: var(--top); color: #fff;
}
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 1.1rem; }
.chip { border: 0; border-radius: 999px; padding: 6px 12px; font-size: .8rem; font-weight: 600; background: #24394d; color: #d6e4f0; }
.chip.ok { background: #1c5b38; color: #d9f7e5; } .chip.warn { background: #7a4d00; color: #fff0d1; } .chip.err { background: #7d1f1f; color: #ffe1e1; }
main { max-width: 640px; margin: 0 auto; padding: 12px 16px; outline: none; }
h2 { font-size: 1.25rem; margin: 8px 0 12px; } h3 { font-size: 1.05rem; margin: 0 0 10px; }
.card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; margin-bottom: 14px; border: 1px solid var(--line); }
.muted { color: var(--muted); } .small { font-size: .85rem; } .center { text-align: center; }
.row { display: flex; gap: 10px; align-items: center; } .row > * { flex: 1; } .wrap { flex-wrap: wrap; }
.spread { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
label { display: block; font-size: .85rem; font-weight: 600; color: var(--muted); margin: 10px 0 4px; }
input, select, textarea {
  width: 100%; font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--line);
  border-radius: 10px; padding: 11px 12px; min-height: 46px;
}
input[type=checkbox] { width: auto; min-height: 0; margin-right: 8px; transform: scale(1.3); }
input[type=range] { padding: 0; border: 0; min-height: 36px; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--primary); outline-offset: 1px; }
.btn {
  display: block; width: 100%; border: 0; border-radius: 12px; padding: 13px 16px; min-height: 48px; font: inherit; font-weight: 700;
  background: var(--line); color: var(--text); cursor: pointer; text-align: center; text-decoration: none; margin-top: 10px;
}
.btn.primary { background: var(--primary); color: var(--primary-ink); }
.btn.ok { background: var(--ok); color: #fff; } .btn.danger { background: transparent; color: var(--err); border: 1px solid var(--err); }
.btn.small { width: auto; display: inline-block; padding: 8px 12px; min-height: 38px; font-size: .9rem; margin-top: 0; }
.btn:disabled { opacity: .55; }
.btn.big { font-size: 1.15rem; padding: 18px; min-height: 64px; }
.seg { display: flex; background: var(--line); border-radius: 12px; padding: 4px; gap: 4px; margin-bottom: 14px; }
.seg button { flex: 1; border: 0; background: transparent; padding: 10px; border-radius: 9px; font: inherit; font-weight: 700; color: var(--muted); }
.seg button.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.chips button { border: 1px solid var(--line); background: var(--surface); color: var(--text); border-radius: 999px; padding: 7px 12px; font: inherit; font-size: .85rem; }
.result { border-left: 5px solid var(--primary); }
.result.rank-1 { border-left-color: var(--ok); }
.price { font-size: 1.6rem; font-weight: 800; letter-spacing: -.5px; }
.price sup { font-size: .9rem; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 2px 12px; font-size: .9rem; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; text-align: right; font-weight: 600; }
.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: .75rem; font-weight: 700; background: var(--line); color: var(--text); vertical-align: middle; }
.badge.hoch, .badge.aktuell { background: #d9f7e5; color: #135c33; } .badge.mittel { background: #fff0d1; color: #6b4200; }
.badge.fehlt, .badge.niedrig, .badge.keine { background: #ffe1e1; color: #7d1f1f; } .badge.fav { background: #fff3cf; color: #6b4b00; }
.list { list-style: none; margin: 0; padding: 0; }
.list li { padding: 12px 0; border-bottom: 1px solid var(--line); } .list li:last-child { border-bottom: 0; }
.advice { font-size: 1.05rem; font-weight: 600; }
.notice { border-radius: 10px; padding: 10px 12px; background: #fff3cf; color: #5a4100; font-size: .9rem; margin: 8px 0; }
.notice.err { background: #ffe1e1; color: #6d1b1b; } .notice.ok { background: #d9f7e5; color: #135c33; }
.preview { width: 100%; max-height: 320px; object-fit: contain; border-radius: 10px; background: #000; }
.thumb { width: 64px; height: 64px; object-fit: cover; border-radius: 8px; }
.tabbar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 10; display: flex; background: var(--surface); border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.tabbar a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 0 10px; color: var(--muted); text-decoration: none; font-size: .72rem; font-weight: 600; }
.tabbar a span { font-size: 1.25rem; }
.tabbar a.active { color: var(--primary); }
.toast {
  position: fixed; left: 16px; right: 16px; bottom: calc(84px + env(safe-area-inset-bottom)); z-index: 20; max-width: 600px; margin: 0 auto;
  background: #17212b; color: #fff; padding: 12px 16px; border-radius: 12px; box-shadow: 0 4px 16px rgba(0, 0, 0, .3);
}
.spark { width: 100%; height: 70px; }
.spark path { fill: none; stroke: var(--primary); stroke-width: 2; }
.spark .best { fill: var(--ok); }
details summary { cursor: pointer; color: var(--muted); font-size: .9rem; padding: 6px 0; }
pre { white-space: pre-wrap; font-size: .75rem; background: var(--bg); padding: 8px; border-radius: 8px; max-height: 240px; overflow: auto; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 10px; }
.stat { font-size: 1.3rem; font-weight: 800; } .stat-label { font-size: .75rem; color: var(--muted); }
a { color: var(--primary); }
.heatwrap { overflow-x: auto; }
.heatmap { border-collapse: collapse; width: 100%; min-width: 300px; font-size: .65rem; }
.heatmap th { color: var(--muted); font-weight: 600; padding: 1px; text-align: center; }
.heatmap td.heat { height: 18px; border: 1px solid var(--surface); background: var(--line); }
.grid2 > *, .row > * { min-width: 0; }
input[type=datetime-local], input[type=date], input[type=time] { min-width: 0; font-size: .95rem; }
