/* Spritpreise – Stylesheet */
:root {
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  --bg: #f4f5f2;
  --surface: #ffffff;
  --surface-2: #eef0ea;
  --text: #1b1f1a;
  --muted: #667064;
  --line: #dde1d8;
  --grid: rgba(27, 31, 26, .07);
  --accent: #e05a1b;
  --accent-ink: #ffffff;
  --good: #2f9e5f;
  --bad: #d4473a;
  --fill: rgba(224, 90, 27, .10);
  --s1: #e05a1b; --s2: #2c6fbb; --s3: #2f9e5f; --s4: #8a4fc7;
  --s5: #c99a06; --s6: #0f9aa8; --s7: #c2417f; --s8: #5b6b58;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(0,0,0,.04), 0 4px 16px rgba(0,0,0,.04);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121512; --surface: #1a1e1a; --surface-2: #232823; --text: #e8ebe5; --muted: #98a294;
    --line: #2c322b; --grid: rgba(232, 235, 229, .07); --accent: #ff7a3d; --fill: rgba(255, 122, 61, .14);
    --good: #45c07a; --bad: #f0655a;
    --s1: #ff7a3d; --s2: #5b9ee8; --s3: #45c07a; --s4: #b083e8; --s5: #e3b52b; --s6: #33c2cf; --s7: #e56aa6; --s8: #97a893;
    --shadow: none;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 15px/1.5 var(--font); background: var(--bg); color: var(--text); }
a { color: inherit; }
a:hover { color: var(--accent); }
h1, h2 { line-height: 1.2; margin: 0; }
h1 { font-size: clamp(1.5rem, 3vw, 2rem); letter-spacing: -.02em; }
h2 { font-size: 1.05rem; }
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 16px; }
.wrap.narrow { max-width: 520px; padding-top: 48px; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
sup { font-size: .6em; vertical-align: .55em; margin-left: 1px; }

/* Kopf & Fuß */
.site-head { background: var(--surface); border-bottom: 1px solid var(--line); }
.site-head .row { min-height: 60px; }
.logo { font-weight: 700; text-decoration: none; display: flex; align-items: center; gap: 8px; letter-spacing: -.01em; }
.logo-mark { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 9px; background: var(--accent); font-size: 18px; }
.site-head nav { display: flex; gap: 6px 18px; font-size: .92rem; flex-wrap: wrap; justify-content: flex-end; }
.site-head nav a { text-decoration: none; color: var(--muted); }
.site-head nav a:hover { color: var(--text); }
.site-foot { margin-top: 48px; padding: 24px 0 40px; border-top: 1px solid var(--line); font-size: .82rem; color: var(--muted); }
main.wrap { padding-top: 28px; }

/* Karten */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); margin-bottom: 20px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.card.empty { text-align: center; color: var(--muted); padding: 40px; }
.intro { margin-bottom: 22px; }
.intro p { max-width: 720px; margin: 8px 0 0; }

.grid.stations { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; margin-bottom: 24px; }
.grid.stations .card { margin: 0; }
.station { text-decoration: none; display: block; transition: border-color .15s, transform .15s; }
.station:hover { border-color: var(--accent); color: inherit; transform: translateY(-1px); }
.station-head { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; margin-bottom: 14px; }
.badge { font-size: .72rem; padding: 3px 8px; border-radius: 99px; white-space: nowrap; font-weight: 600; }
.badge.open { background: color-mix(in srgb, var(--good) 15%, transparent); color: var(--good); }
.badge.closed { background: var(--surface-2); color: var(--muted); }

.prices { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 0; }
.prices > div { background: var(--surface-2); border-radius: 10px; padding: 8px 10px; }
.prices > div.best { outline: 2px solid var(--good); outline-offset: -2px; }
.prices dt { font-size: .75rem; color: var(--muted); }
.prices dd { margin: 0; }
.price { font-family: var(--mono); font-weight: 700; font-size: 1.25rem; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.since { font-size: .72rem; color: var(--muted); }
.prices.inline { grid-template-columns: repeat(3, minmax(90px, auto)); }

/* Steuerelemente */
.seg { display: inline-flex; background: var(--surface-2); border-radius: 10px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.seg a, .seg button { border: 0; background: transparent; font: inherit; font-size: .88rem; padding: 6px 12px; border-radius: 8px; cursor: pointer; text-decoration: none; color: var(--muted); }
.seg .on { background: var(--surface); color: var(--text); font-weight: 600; box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.seg.small button { padding: 4px 9px; font-size: .8rem; }
.controls { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
input, select, textarea { font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--line); border-radius: 9px; padding: 7px 10px; }
input:focus, select:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid var(--line); background: var(--surface); color: var(--text); font: inherit; font-size: .9rem; padding: 7px 14px; border-radius: 9px; cursor: pointer; text-decoration: none; }
.btn:hover { border-color: var(--accent); color: var(--text); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.btn.danger { color: var(--bad); }
.btn.small { padding: 4px 10px; font-size: .82rem; }
.btn.disabled { opacity: .4; pointer-events: none; }

/* Stationsseite */
.back { display: inline-block; margin-bottom: 12px; font-size: .9rem; color: var(--muted); text-decoration: none; }
.station-title { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; flex-wrap: wrap; margin-bottom: 20px; }
.station-title p { margin: 6px 0 0; }
.toolbar { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.datenav { display: flex; gap: 6px; align-items: center; }
.tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 20px; }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; display: flex; flex-direction: column; gap: 2px; }
.tile span { font-size: .78rem; color: var(--muted); }
.tile strong { font-family: var(--mono); font-size: 1.5rem; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.tile em { font-style: normal; font-size: .78rem; color: var(--muted); min-height: 1.2em; }
.chart-box { position: relative; height: 340px; }
.chart-box.short { height: 220px; }
.two-col { display: grid; grid-template-columns: 1fr 1.4fr; gap: 20px; }
.two-col .card { margin-bottom: 20px; }

/* Tabellen */
.table-wrap { overflow-x: auto; }
.table-wrap.scroll { max-height: 300px; overflow-y: auto; }
.tbl { width: 100%; border-collapse: collapse; font-size: .9rem; }
.tbl th { text-align: left; font-weight: 600; font-size: .78rem; color: var(--muted); padding: 8px 10px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--surface); }
.tbl td { padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl .num { font-family: var(--mono); font-variant-numeric: tabular-nums; white-space: nowrap; }
.tbl .best { color: var(--good); font-weight: 700; }
.up { color: var(--bad); }
.down { color: var(--good); }
#compareTable { margin-top: 14px; }

.heat { border-collapse: separate; border-spacing: 2px; font-size: .72rem; width: 100%; min-width: 560px; table-layout: fixed; }
.heat thead th:first-child, .heat tbody th { width: 28px; }
.heat th { color: var(--muted); font-weight: 500; padding: 2px; }
.heat tbody th { text-align: left; padding-right: 6px; }
.heat td { height: 24px; border-radius: 4px; background: var(--surface-2); }
.heat td.g { background: color-mix(in srgb, var(--good) calc(var(--a) * 100%), var(--surface-2)); }
.heat td.r { background: color-mix(in srgb, var(--bad) calc(var(--a) * 100%), var(--surface-2)); }

/* Hinweise */
.notice { padding: 12px 14px; border-radius: 10px; margin-bottom: 16px; border: 1px solid var(--line); background: var(--surface); }
.notice.ok { border-color: var(--good); }
.notice.err { border-color: var(--bad); color: var(--bad); }
.notice.warn { border-color: var(--s5); }

/* Admin */
.admin .site-head { background: var(--text); color: var(--bg); border: 0; }
.admin .site-head nav a { color: color-mix(in srgb, var(--bg) 70%, transparent); }
.admin .site-head nav a.on, .admin .site-head nav a:hover { color: var(--bg); }
.form { display: grid; gap: 14px; }
.form label { display: grid; gap: 5px; font-size: .88rem; font-weight: 500; }
.form .hint { font-weight: 400; color: var(--muted); font-size: .8rem; }
.form .checks { display: flex; gap: 16px; flex-wrap: wrap; font-weight: 400; }
.form .checks label { display: flex; gap: 6px; align-items: center; }
.form-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
.form-row > label { flex: 1 1 140px; }
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; margin-bottom: 20px; }
.kpis .tile strong { font-family: var(--font); font-size: 1.2rem; }
code, .code { font-family: var(--mono); font-size: .82rem; background: var(--surface-2); padding: 2px 6px; border-radius: 6px; word-break: break-all; }
pre.code { padding: 10px 12px; white-space: pre-wrap; }
.inline-form { display: inline; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--muted); margin-right: 6px; }
.dot.ok { background: var(--good); } .dot.err { background: var(--bad); }

@media (max-width: 820px) {
  .tiles { grid-template-columns: repeat(2, 1fr); }
  .two-col { grid-template-columns: 1fr; }
  .chart-box { height: 280px; }
}
@media (max-width: 480px) {
  .prices, .prices.inline { grid-template-columns: repeat(3, 1fr); }
  .price { font-size: 1.05rem; }
  .site-head nav { gap: 12px; }
}
