:root {
  --bg: #f4f6f9; --panel: #fff; --ink: #0f172a; --muted: #64748b; --line: #e2e8f0; --brand: #2563eb; --good: #059669;
  color-scheme: light;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
h1, h2, h3 { margin: 0; line-height: 1.2; }
h2 { font-size: 1.1rem; margin-bottom: 12px; }
h3 { font-size: 0.95rem; margin: 18px 0 6px; }
small { color: var(--muted); font-weight: 400; }
.top { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 16px 24px; background: #0f172a; color: #fff; flex-wrap: wrap; }
.top h1 { font-size: 1.5rem; letter-spacing: -0.02em; }
.top p { margin: 2px 0 0; color: #cbd5e1; font-size: 0.9rem; }
.actions { display: flex; gap: 8px; }
button { font: inherit; padding: 7px 14px; border-radius: 8px; border: 1px solid var(--brand); background: var(--brand); color: #fff; cursor: pointer; }
button:hover { filter: brightness(1.1); }
button:disabled { opacity: 0.4; cursor: not-allowed; }
button.ghost { background: transparent; color: var(--brand); border-color: var(--line); padding: 3px 10px; font-size: 0.85rem; }
.top button.ghost { color: #fff; border-color: #475569; padding: 7px 14px; font-size: inherit; }
main { display: grid; grid-template-columns: minmax(300px, 380px) minmax(0, 1fr); gap: 20px; padding: 20px 24px; max-width: 1600px; margin: 0 auto; }
@media (max-width: 960px) { main { grid-template-columns: 1fr; padding: 16px; } }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 16px; margin-bottom: 16px; }
#controls { align-self: start; }
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.field { display: flex; flex-direction: column; gap: 3px; font-size: 0.82rem; color: var(--muted); margin-bottom: 8px; }
.field.small { margin: 0; }
.field .input { display: flex; align-items: center; gap: 6px; }
.field .input em { font-style: normal; font-size: 0.75rem; white-space: nowrap; }
input, select { font: inherit; color: var(--ink); width: 100%; padding: 6px 8px; border: 1px solid var(--line); border-radius: 6px; background: #fff; min-width: 0; }
input:focus, select:focus, button:focus-visible, summary:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }
fieldset { border: 1px solid var(--line); border-radius: 8px; margin: 12px 0 0; padding: 8px 12px 6px; }
legend { font-size: 0.8rem; font-weight: 600; padding: 0 6px; }
.check { display: flex; gap: 8px; align-items: center; font-size: 0.88rem; margin-bottom: 8px; }
.check input { width: auto; }
.presets { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.presets button { background: #eff6ff; color: var(--brand); border-color: #bfdbfe; font-size: 0.82rem; padding: 5px 10px; }
.vehicles { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 8px; }
.vehicle { border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; }
.vhead { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.vhead strong { flex: 1; font-size: 0.9rem; }
.dot { width: 12px; height: 12px; border-radius: 50%; }
details summary { cursor: pointer; font-size: 0.82rem; color: var(--brand); margin-top: 6px; }
details .grid { margin: 8px 0; }
.tag { font-size: 0.7rem; padding: 1px 7px; border-radius: 999px; background: #e2e8f0; color: #334155; font-weight: 600; }
.tag.ev { background: #d1fae5; color: #065f46; } .tag.cng { background: #cffafe; color: #155e75; }
.tag.diesel { background: #e2e8f0; } .tag.petrol { background: #ffedd5; color: #9a3412; } .tag.hybrid { background: #ede9fe; color: #5b21b6; }
.summary { margin: 0 0 14px; color: var(--muted); font-size: 0.9rem; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 14px; margin-bottom: 16px; }
.card { background: var(--panel); border: 1px solid var(--line); border-top: 4px solid var(--accent); border-radius: 12px; padding: 14px; position: relative; }
.card.best { box-shadow: 0 0 0 2px var(--good) inset; }
.card h3 { margin: 0 0 4px; font-size: 0.92rem; }
.big { font-size: 2rem; font-weight: 700; letter-spacing: -0.02em; }
.big small { font-size: 0.9rem; margin-left: 2px; }
dl { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; margin: 8px 0 0; font-size: 0.83rem; }
dt { color: var(--muted); } dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }
.badge { position: absolute; top: 10px; right: 10px; background: var(--good); color: #fff; font-size: 0.7rem; padding: 2px 8px; border-radius: 999px; }
.chart { width: 100%; height: auto; display: block; }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .axis { stroke: #94a3b8; }
.chart .zero { stroke: #0f172a; stroke-dasharray: 4 3; }
.chart text { fill: var(--ink); font-size: 12px; }
.chart .tick { fill: var(--muted); font-size: 11px; }
.chart .value { font-weight: 600; font-size: 12px; }
.chart .cross { fill: #fff; stroke: #0f172a; stroke-width: 2.5; }
.legend { list-style: none; display: flex; flex-wrap: wrap; gap: 6px 14px; padding: 0; margin: 0 0 8px; font-size: 0.78rem; color: var(--muted); }
.legend span, .swatch { display: inline-block; width: 11px; height: 11px; border-radius: 2px; margin-right: 6px; }
.note { color: var(--muted); font-size: 0.82rem; margin: 2px 0 8px; }
.pill { display: inline-block; background: #f1f5f9; border-radius: 999px; padding: 2px 10px; font-size: 0.82rem; margin: 2px 0; }
.pairpick { display: flex; gap: 14px; flex-wrap: wrap; margin-bottom: 8px; }
.pairpick label { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 240px; font-size: 0.85rem; }
.breakeven { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; background: #f8fafc; border-radius: 8px; padding: 4px 14px 12px; }
.breakeven ul { margin: 0; padding-left: 18px; font-size: 0.88rem; } .breakeven p { margin: 0; }
.prob { font-size: 1.05rem; }
.prob strong { font-size: 1.6rem; color: var(--brand); }
.tablewrap { overflow-x: auto; margin-top: 10px; }
table { border-collapse: collapse; width: 100%; font-size: 0.84rem; font-variant-numeric: tabular-nums; }
th, td { padding: 5px 10px; border-bottom: 1px solid var(--line); text-align: right; }
th:first-child { text-align: left; font-weight: 500; }
thead th { font-weight: 600; font-size: 0.8rem; vertical-align: bottom; }
tr.total th, tr.total td { font-weight: 700; border-top: 2px solid var(--ink); }
footer { text-align: center; color: var(--muted); font-size: 0.8rem; padding: 12px 24px 28px; }
@media print {
  body { background: #fff; font-size: 12px; }
  .top .actions, #controls, footer { display: none; }
  .top { background: #fff; color: #000; padding: 0 0 8px; } .top p { color: #444; }
  main { display: block; padding: 0; }
  .panel, .card { break-inside: avoid; }
}
