:root {
  --bg: #f6f7fb; --card: #ffffff; --text: #14181f; --muted: #5a6475; --line: #dfe3ec;
  --accent: #0b5fff; --accent-soft: #e8f0ff; --good: #0a7a45; --good-soft: #e3f6ec;
  --radius: 12px;
  --c-depreciation: #4c6ef5; --c-capital: #91a7ff; --c-insurance: #f59f00; --c-tfa: #ffd43b;
  --c-energy: #12b886; --c-maintenance: #63e6be; --c-tolls: #e8590c; --c-ferries: #ff922b;
  --c-parking: #868e96; --c-lease: #7048e8; --c-pt: #1c7ed6; --c-carshare: #d6336c;
  --c-taxi: #f783ac; --c-other: #adb5bd;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #0e1117; --card: #161b24; --text: #e8ecf3; --muted: #a0a9b8; --line: #2a3140;
          --accent: #6b9bff; --accent-soft: #1b2740; --good: #5fd39a; --good-soft: #12281f; }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
.wrap { max-width: 1140px; margin: 0 auto; padding: 0 16px; }
h1 { font-size: clamp(1.6rem, 4vw, 2.2rem); line-height: 1.15; margin: 0 0 6px; }
h2 { font-size: 1.15rem; margin: 0 0 8px; }
.top { background: var(--card); border-bottom: 1px solid var(--line); padding: 20px 0; }
.top-inner { display: flex; gap: 16px; justify-content: space-between; align-items: flex-start; flex-wrap: wrap; }
.lead { margin: 0; color: var(--muted); max-width: 62ch; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.btn { font: inherit; font-size: .9rem; padding: 8px 12px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--card); color: var(--text); cursor: pointer; }
.btn:hover { border-color: var(--accent); }
.btn:focus-visible, input:focus-visible, select:focus-visible, summary:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

.grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: 24px; padding-top: 20px; padding-bottom: 20px; }
.results { position: sticky; top: 12px; align-self: start; }
@media (max-width: 900px) {
  .grid { grid-template-columns: 1fr; }
  .results { position: static; order: -1; }
}
.hint { color: var(--muted); font-size: .9rem; margin: 0 0 12px; }

/* form */
details.sec { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 10px; }
details.sec > summary { cursor: pointer; padding: 12px 14px; font-weight: 600; list-style: none; display: flex; justify-content: space-between; gap: 8px; }
details.sec > summary::-webkit-details-marker { display: none; }
details.sec > summary::after { content: "+"; color: var(--muted); font-weight: 400; }
details.sec[open] > summary::after { content: "\2212"; }
.fields { padding: 4px 14px 14px; display: grid; gap: 10px; }
.field { display: grid; grid-template-columns: 1fr minmax(110px, 150px); gap: 8px; align-items: center; }
.field label { font-size: .92rem; }
.field small { display: block; color: var(--muted); font-size: .8rem; }
.inwrap { position: relative; }
.inwrap input, .inwrap select { width: 100%; font: inherit; padding: 8px 40px 8px 10px; border: 1px solid var(--line);
  border-radius: 8px; background: var(--bg); color: var(--text); }
.inwrap select { padding-right: 10px; }
.inwrap .unit { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); font-size: .78rem; color: var(--muted); pointer-events: none; }
.badge { display: inline-block; font-size: .68rem; padding: 0 6px; border-radius: 99px; background: var(--accent-soft);
  color: var(--accent); margin-left: 6px; vertical-align: middle; }
.field.check { grid-template-columns: 1fr auto; }
.field.check input { width: 22px; height: 22px; }
.subhead { font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: 6px 0 -2px; }

/* results */
.summary { background: var(--good-soft); border: 1px solid var(--good); border-radius: var(--radius); padding: 14px; margin-bottom: 12px; }
.summary strong { color: var(--good); }
.summary .big { font-size: 1.5rem; font-weight: 700; line-height: 1.2; }
.summary p { margin: 4px 0 0; color: var(--muted); font-size: .92rem; }
.legend { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: .78rem; color: var(--muted); margin-bottom: 10px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 4px; vertical-align: -1px; }
.row { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; margin-bottom: 10px; }
.row.best { border-color: var(--good); }
.row-head { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; flex-wrap: wrap; }
.row-head h3 { margin: 0; font-size: 1rem; }
.row-head .num { font-weight: 700; font-size: 1.15rem; white-space: nowrap; }
.row-head .num small { font-weight: 400; color: var(--muted); font-size: .8rem; }
.bar { display: flex; height: 14px; border-radius: 7px; overflow: hidden; background: var(--line); margin: 8px 0 4px; }
.bar span { display: block; min-width: 2px; }
.meta { color: var(--muted); font-size: .84rem; display: flex; gap: 6px 16px; flex-wrap: wrap; }
.meta .save { color: var(--good); }
.row details { margin-top: 6px; }
.row summary { cursor: pointer; font-size: .85rem; color: var(--accent); }
table.break { width: 100%; border-collapse: collapse; margin-top: 6px; font-size: .88rem; }
table.break td { padding: 3px 0; border-bottom: 1px dashed var(--line); }
table.break td:last-child { text-align: right; white-space: nowrap; }
table.break tr.total td { font-weight: 700; border-bottom: 0; }
table.break .dot { display: inline-block; width: 9px; height: 9px; border-radius: 2px; margin-right: 6px; }
.notes { margin: 6px 0 0; padding-left: 18px; color: var(--muted); font-size: .82rem; }
.taxbox { background: var(--accent-soft); border-radius: var(--radius); padding: 12px 14px; font-size: .92rem; }
.taxbox h3 { margin: 0 0 4px; font-size: 1rem; }
.taxbox p { margin: 4px 0; }
.taxbox .eq { font-variant-numeric: tabular-nums; }

/* info */
.info { padding-top: 8px; padding-bottom: 40px; }
.info details { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 14px; margin-bottom: 8px; }
.info summary { cursor: pointer; font-weight: 600; }
.info p { margin: 8px 0 0; color: var(--muted); }
#sources ul { margin: 6px 0; padding-left: 18px; color: var(--muted); font-size: .92rem; }
#sources a { color: var(--accent); }
.disclaimer { font-size: .85rem; }
@media print { .actions, .inputs { display: none; } .grid { display: block; } .results { position: static; } }

/* ads, affiliate cards, footer, simple pages */
.ad { margin: 20px 0; }
.ad[hidden] { display: none; }
.ad:has(ins[data-ad-status="unfilled"]) { display: none; }
.ad-label { display: block; font-size: .7rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin-bottom: 4px; }
.ad-box { min-height: 100px; overflow: hidden; }
#affiliate:empty { display: none; }
.aff { margin-top: 10px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; }
.aff p { margin: 4px 0 10px; color: var(--muted); font-size: .92rem; }
.aff .btn { display: inline-block; text-decoration: none; border-color: var(--accent); color: var(--accent); }
.foot { padding-top: 8px; padding-bottom: 32px; font-size: .9rem; }
.foot nav { display: flex; gap: 8px 20px; flex-wrap: wrap; align-items: center; }
.foot a, .linkbtn { color: var(--accent); }
.linkbtn { background: none; border: 0; padding: 0; font: inherit; cursor: pointer; text-decoration: underline; }
.linkbtn[hidden] { display: none; }
.page { max-width: 760px; margin: 0 auto; padding: 24px 16px 48px; }
.page h1 { font-size: 1.7rem; }
.page h2 { margin-top: 28px; }
.page p, .page li { color: var(--text); }
.page a { color: var(--accent); }
.page details { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 14px; margin-top: 24px; }
.page summary { cursor: pointer; font-weight: 600; }
@media (min-width: 901px) {
  .results { max-height: calc(100vh - 24px); overflow-y: auto; padding-right: 4px; }
}
@media print { .ad, #affiliate, .foot { display: none; } }
