* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: var(--ink); background: var(--surface);
  display: flex; flex-direction: column; min-height: 100vh;
}
main { flex: 1; }
a { color: var(--green-deep); text-decoration: none; }
.wrap { max-width: 900px; margin: 0 auto; padding: 0 22px; width: 100%; }

/* Header bar */
.topbar { background: var(--slate); color: var(--on-slate); }
.topbar-in { display: flex; align-items: center; gap: 20px; padding: 12px 22px; max-width: 900px; margin: 0 auto; }
.logo { font-weight: 800; font-size: 20px; letter-spacing: -0.5px; color: var(--on-slate); }
.logo b { color: var(--green); }
.topnav { margin-left: auto; display: flex; align-items: center; gap: 18px; }
.topnav a { color: var(--nav-link); font-size: 13.5px; font-weight: 600; }
.topnav a:hover { color: var(--on-slate); }
.topnav a.active { color: var(--on-slate); box-shadow: 0 2px 0 var(--green); }

/* Search island */
.search { position: relative; }
.search input {
  background: var(--search-bg); border: 1px solid var(--search-line); color: var(--nav-link);
  border-radius: 8px; padding: 8px 12px; font-size: 13px; min-width: 260px; font-family: inherit;
}
.search-results {
  position: absolute; top: calc(100% + 4px); left: 0; right: 0; z-index: 10;
  background: var(--surface); border: 1px solid var(--line); border-radius: 8px; overflow: hidden;
}
.search-results a { display: block; padding: 8px 12px; font-size: 13.5px; color: var(--ink); }
.search-results a:hover, .search-results a:focus { background: var(--zebra); }

/* Buttons */
.btn-primary { background: var(--green); color: var(--on-slate); border: none; border-radius: 8px; padding: 8px 14px; font-weight: 700; font-size: 13px; cursor: pointer; font-family: inherit; }
.btn-secondary { background: var(--surface); color: var(--green-deep); border: 1.5px solid var(--green); border-radius: 8px; padding: 8px 14px; font-weight: 700; font-size: 13px; cursor: pointer; font-family: inherit; }

/* Vehicle page */
.vh-head { display: flex; align-items: flex-start; gap: 20px; padding: 18px 0 6px; }
.vh-head-l { flex: 1; min-width: 0; }
h1 { font-size: 24px; font-weight: 800; letter-spacing: -0.3px; font-variant-numeric: tabular-nums; }
.vh-sub { color: var(--muted); font-size: 13px; margin-top: 3px; }
.vh-btns { display: flex; gap: 8px; flex-shrink: 0; padding-top: 2px; }
.quick { display: flex; margin: 14px 0 4px; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.qc { flex: 1; padding: 12px 16px; border-right: 1px solid var(--line); }
.qc:last-child { border-right: none; }
.qc .k { color: var(--muted); font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.5px; }
.qc .v { font-weight: 800; font-size: 19px; font-variant-numeric: tabular-nums; margin-top: 3px; }
.gal { max-width: 390px; margin: 16px auto 4px; }
.gal-hero { aspect-ratio: 4/3; border-radius: 12px; width: 100%; object-fit: cover; display: block; }
.gal-thumbs { display: flex; gap: 8px; overflow-x: auto; margin-top: 8px; padding-bottom: 2px; justify-content: center; }
.gal-thumbs img { flex: 0 0 auto; width: 68px; height: 46px; border-radius: 8px; border: 1px solid var(--line); object-fit: cover; }
.selbar { display: flex; align-items: flex-end; gap: 12px; margin: 24px 0 4px; }
.selbar label { font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.5px; color: var(--muted); display: block; margin-bottom: 3px; }
.selbar select { font-size: 13px; border: 1px solid var(--line); border-radius: 7px; padding: 6px 9px; background: var(--surface); color: var(--ink); font-weight: 600; font-family: inherit; }
.sec-h { font-size: 18px; font-weight: 800; margin: 22px 0 14px; padding-top: 22px; border-top: 1px solid var(--line); }
.specs .sec-h:first-child { border-top: none; padding-top: 6px; margin-top: 10px; }
.pairs { display: grid; grid-template-columns: 1fr 1fr; row-gap: 12px; column-gap: 48px; }
@media (max-width: 560px) { .pairs { grid-template-columns: 1fr; } }
.pair { font-size: 14px; line-height: 1.35; font-variant-numeric: tabular-nums; }
.pair .k { font-weight: 700; }
.pair .v { color: var(--val); }

/* Ad slot */
.adslot { margin: 22px 0 6px; border: 1px dashed var(--ad-line); border-radius: 8px; color: var(--ad-ink); text-align: center; padding: 14px; font-size: 11px; letter-spacing: 0.5px; }

/* Sources */
.sources { margin: 8px 0 20px; padding-top: 14px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; }
.sources h4 { font-size: 11px; text-transform: uppercase; letter-spacing: 0.6px; color: var(--ink); margin: 0 0 6px; }
.sources ul { margin: 0; padding-left: 16px; line-height: 1.7; }

/* Compare grid */
.cmp-title { padding: 16px 0 12px; font-size: 19px; font-weight: 700; }
.cmp-scroll { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; }
table.cmp { border-collapse: collapse; width: 100%; font-size: 13.5px; font-variant-numeric: tabular-nums; }
.cmp th, .cmp td { border-bottom: 1px solid var(--line); padding: 9px 14px; text-align: right; white-space: nowrap; }
.cmp td.lbl { text-align: left; font-weight: 600; position: sticky; left: 0; background: var(--surface); min-width: 150px; z-index: 1; }
.cmp tr:nth-child(even) td { background: var(--zebra); }
.cmp tr:nth-child(even) td.lbl { background: var(--zebra-lbl); }
.cmp .veh-head td { border-bottom: 2px solid var(--slate); vertical-align: top; padding: 12px 14px; min-width: 150px; text-align: left; background: var(--surface); position: sticky; top: 0; z-index: 2; }
.cmp .veh-head td.lbl { z-index: 3; }
.veh-name { font-weight: 800; font-size: 14.5px; }
.veh-x { color: var(--muted); font-size: 11px; margin-left: 6px; }
.veh-dds { margin-top: 7px; display: flex; gap: 6px; }
.veh-dds select { font-size: 11.5px; border: 1px solid var(--line); border-radius: 6px; padding: 3px 5px; background: var(--surface); color: var(--ink); font-family: inherit; }
.add-col { color: var(--green-deep); font-weight: 700; border: 2px dashed var(--green); border-radius: 8px; text-align: center; padding: 14px 10px; font-size: 13px; }
.cmp tr.cat td { background: var(--cat-bg); color: var(--ink); font-weight: 800; text-transform: uppercase; font-size: 11px; letter-spacing: 0.7px; text-align: left; border-top: 2px solid var(--cat-rule); border-bottom: 2px solid var(--cat-rule); position: sticky; }
.cmp td.best { background: var(--best-bg) !important; color: var(--best-ink); font-weight: 700; }
.cmp td.worst { background: var(--worst-bg) !important; color: var(--worst-ink); }

/* Browse */
.browse-filters { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; margin: 18px 0; }
.browse-filters label { font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.5px; color: var(--muted); display: block; margin-bottom: 3px; }
.browse-filters select, .browse-filters input { font-size: 13px; border: 1px solid var(--line); border-radius: 7px; padding: 6px 9px; background: var(--surface); color: var(--ink); font-family: inherit; }
table.browse { border-collapse: collapse; width: 100%; font-size: 13.5px; font-variant-numeric: tabular-nums; }
.browse th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px; color: var(--muted); padding: 8px 10px; border-bottom: 2px solid var(--line); }
.browse th.num, .browse td.num { text-align: right; }
.browse td { padding: 10px; border-bottom: 1px solid var(--line); }
.browse td a.veh { font-weight: 700; color: var(--ink); }
.browse td a.veh:hover { color: var(--green-deep); }

/* Home — marketing splash */
.home section { width: 100%; }

/* Hero */
.splash-hero { text-align: center; padding: 64px 22px 44px; }
.kicker { font-size: 11.5px; font-weight: 800; letter-spacing: 1.4px; text-transform: uppercase; color: var(--green-deep); }
.splash-hero h1 { font-size: clamp(38px, 7vw, 60px); line-height: 1.02; letter-spacing: -1.6px; font-weight: 800; margin: 14px 0 0; text-wrap: balance; }
.splash-hero .lede { color: var(--val); font-size: clamp(15px, 2.4vw, 18px); line-height: 1.5; max-width: 34ch; margin: 16px auto 26px; text-wrap: balance; }
.splash-hero .search { display: block; max-width: 460px; margin: 0 auto; }
.splash-hero .search input { width: 100%; background: var(--surface); border: 2px solid var(--slate); border-radius: 999px; color: var(--ink); font-size: 15px; padding: 13px 20px; }
.splash-hero .search input::placeholder { color: var(--muted); }
.splash-hero .search input:focus { outline: none; border-color: var(--green); box-shadow: 0 0 0 4px var(--best-bg); }

/* Live provenance counters */

/* Popular comparisons */
.popular { padding: 40px 22px 8px; }
.popular h2 { font-size: 18px; font-weight: 800; text-align: center; margin-bottom: 18px; }
.popular-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px; }
.popular-grid a { display: block; padding: 16px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.popular-grid a:hover { border-color: var(--green); box-shadow: 0 6px 20px rgba(0, 168, 98, 0.1); }
.popular-grid .pl { display: block; font-weight: 700; font-size: 15px; color: var(--ink); }
.popular-grid .pn { display: block; font-size: 12px; color: var(--green-deep); margin-top: 5px; }

/* Why */
.why { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 22px; padding: 40px 22px 56px; }
.why-card { text-align: left; }
.why-mark { display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; border-radius: 9px; background: var(--best-bg); color: var(--green-deep); font-weight: 800; font-size: 15px; margin-bottom: 10px; }
.why-card h3 { font-size: 15px; font-weight: 800; }
.why-card p { color: var(--muted); font-size: 13.5px; line-height: 1.6; margin-top: 5px; }

/* Footer */
.foot { border-top: 1px solid var(--line); margin-top: 32px; }
.foot-in { max-width: 900px; margin: 0 auto; padding: 14px 22px; display: flex; align-items: center; justify-content: space-between; color: var(--muted); font-size: 12px; }
.foot button { background: none; border: 1px solid var(--line); border-radius: 7px; color: var(--muted); font-size: 11.5px; padding: 4px 9px; cursor: pointer; font-family: inherit; }
.foot-in a { color: inherit; text-decoration: underline; }
.foot-in a:hover { color: var(--green-deep); }

/* Narrow screens: let the header search shrink instead of overflowing the row */
@media (max-width: 600px) {
  .topbar .search { flex: 1 1 auto; min-width: 0; }
  .topbar .search input { min-width: 0; width: 100%; }
}

/* Admin — utilitarian data editor, reuses tokens/components above */
.admin-links { display: flex; gap: 10px; margin: 18px 0; }
.admin-crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; margin: 4px 0 16px; font-size: 13px; }
.admin-crumbs a { color: var(--muted); text-decoration: none; }
.admin-crumbs a:hover { color: var(--ink); text-decoration: underline; }
.admin-crumbs [aria-current="page"] { color: var(--ink); font-weight: 700; }
.admin-crumb-sep { color: var(--line); }
.admin-hint { font-size: 12.5px; color: var(--muted); margin: 10px 0 4px; max-width: 640px; }
.admin-hint code { background: var(--surface); border: 1px solid var(--line); border-radius: 4px; padding: 0 4px; }
.admin-block { margin: 26px 0; padding-top: 18px; border-top: 1px solid var(--line); }
.admin-block h3 { font-size: 14.5px; font-weight: 800; margin-bottom: 10px; }
.admin-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 12px; }
.admin-form-col { flex-direction: column; align-items: stretch; max-width: 340px; }
.admin-form-inline { display: flex; gap: 6px; align-items: center; justify-content: flex-end; }
.admin-form input, .admin-form select { font-size: 13px; border: 1px solid var(--line); border-radius: 7px; padding: 6px 9px; background: var(--surface); color: var(--ink); font-family: inherit; }
.admin-form label { font-size: 12.5px; color: var(--muted); display: flex; align-items: center; gap: 4px; }
/* Inline stat editor: one editable row per stat */
.admin-stats { display: flex; flex-direction: column; gap: 4px; }
.admin-statrow { display: grid; grid-template-columns: 170px 1fr 150px auto auto; gap: 8px; align-items: center; }
.admin-statlabel { font-size: 12.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.admin-statinput { font-size: 13px; border: 1px solid var(--line); border-radius: 7px; padding: 5px 9px; background: var(--surface); color: var(--ink); font-family: inherit; width: 100%; }
.admin-statinput.is-manual { border-color: var(--green-deep); font-weight: 700; }
.admin-statsrc { font-size: 11px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.admin-statbtn { padding: 5px 11px; font-size: 12.5px; }
@media (max-width: 640px) {
  .admin-statrow { grid-template-columns: 1fr 1fr; }
  .admin-statlabel { grid-column: 1 / -1; }
}
.admin-imggrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 14px; margin-top: 16px; }
.admin-imgcard { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.admin-imgcard img { width: 100%; aspect-ratio: 4/3; object-fit: cover; display: block; }
.admin-imgmeta { font-size: 11.5px; color: var(--muted); padding: 6px 8px 0; display: flex; justify-content: space-between; }
.admin-imgbtns { display: flex; gap: 6px; padding: 8px; flex-wrap: wrap; }
.admin-imgbtns form { display: flex; gap: 4px; }
.admin-tag { color: var(--worst-ink); font-weight: 700; }
.admin-tag-visible { color: var(--best-ink); }

/* Crawl coverage */
.admin-flash { font-size: 13px; font-weight: 700; color: var(--green-deep); margin: 10px 0; }
.admin-cov-count { font-size: 12px; font-weight: 600; color: var(--muted); }
.admin-cov-years { display: flex; flex-wrap: wrap; gap: 6px; }
.admin-cov-form { display: inline; margin: 0; }
.admin-cov-year { display: inline-block; font-size: 12px; padding: 4px 9px; border-radius: 999px; border: 1px solid var(--line); font-family: inherit; line-height: 1; }
.admin-cov-year.is-done { color: var(--best-ink); border-color: var(--best-ink); background: transparent; }
.admin-cov-year.is-todo { color: var(--muted); background: var(--surface); cursor: pointer; }
.admin-cov-year.is-todo:hover { color: var(--ink); border-color: var(--ink); }

.admin-entries-filters { flex-wrap: wrap; }
.admin-entries-approveall { margin: 10px 0 18px; }
.admin-entries-table th a { color: var(--muted); text-decoration: none; }
.admin-entries-table th a:hover { color: var(--ink); text-decoration: underline; }
.admin-entries-valueform { display: flex; gap: 6px; align-items: center; }
.admin-entries-valueform .admin-statinput { width: 120px; }
.admin-entries-toggle { border: 1px solid var(--line); border-radius: 999px; padding: 3px 9px; font-size: 11.5px; background: var(--surface); cursor: pointer; font-family: inherit; }
.admin-entries-pager { display: flex; justify-content: space-between; align-items: center; margin: 14px 0; font-size: 13px; color: var(--muted); }
.admin-entries-pager a { color: var(--ink); font-weight: 700; text-decoration: none; margin: 0 4px; }
.admin-entries-pager a:hover { text-decoration: underline; }
