/* Truck Clinic tracker — mobile-first, light by default with automatic dark mode. No JS anywhere. */

/* ---------- 1. Tokens ---------- */
:root {
  color-scheme: light dark;
  --bg: #f2f2f7; --surface: #ffffff; --surface-2: #f2f2f7;
  --line: rgba(60,60,67,.18); --line-strong: rgba(60,60,67,.32);
  --bar-bg: rgba(255,255,255,.86); --card-border: transparent;
  --shadow: 0 1px 2px rgba(0,0,0,.04), 0 6px 20px rgba(0,0,0,.05);
  --ink: #1c1c1e; --muted: #6e6e73; --faint: #8e8e93;
  --accent: #0071e3; --accent-ink: #ffffff; --accent-bg: rgba(0,113,227,.10);
  --ok: #1b7a43; --ok-bg: #e3f5e9; --warn: #8f5300; --warn-bg: #fff2d9; --bad: #c8281f; --bad-bg: #fde8e7; --neutral: #6e6e73; --neutral-bg: #eceef1;
  --cat-seo: #0b6e73; --cat-seo-bg: #dff4f5; --cat-content: #3d4fb5; --cat-content-bg: #e6e9fa; --cat-design: #7a3fb0; --cat-design-bg: #f0e6fa;
  --cat-bugfix: #a04a12; --cat-bugfix-bg: #fbeadf; --cat-infra: #55606e; --cat-infra-bg: #e9ecf0;
  --brand: #e0392f;
  --radius: 14px; --radius-sm: 10px; --gutter: 16px; --header-h: 52px; --tabbar-h: 56px; --maxw: 920px;
  --sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #000000; --surface: #1c1c1e; --surface-2: #2c2c2e;
    --line: rgba(84,84,88,.55); --line-strong: rgba(84,84,88,.9);
    --bar-bg: rgba(28,28,30,.86); --card-border: var(--line); --shadow: none;
    --ink: #f5f5f7; --muted: #a1a1a6; --faint: #8e8e93;
    --accent: #2997ff; --accent-bg: rgba(41,151,255,.16);
    --ok: #30d158; --ok-bg: rgba(48,209,88,.16); --warn: #ffb340; --warn-bg: rgba(255,159,10,.16); --bad: #ff6961; --bad-bg: rgba(255,69,58,.16); --neutral: #a1a1a6; --neutral-bg: rgba(255,255,255,.08);
    --cat-seo: #5ad1d8; --cat-seo-bg: rgba(90,209,216,.14); --cat-content: #8ea2ff; --cat-content-bg: rgba(142,162,255,.16); --cat-design: #c99cf6; --cat-design-bg: rgba(201,156,246,.16);
    --cat-bugfix: #ffb07a; --cat-bugfix-bg: rgba(255,176,122,.16); --cat-infra: #aab4c0; --cat-infra-bg: rgba(170,180,192,.14);
  }
  input, select, textarea { border-color: var(--line-strong); }
}

/* ---------- 2. Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.45 var(--sans); -webkit-font-smoothing: antialiased; padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); }
body.bare { padding-bottom: 0; }
a { color: var(--accent); }
h1, h2, h3, p, ul, ol { margin: 0; }
img, svg { max-width: 100%; vertical-align: middle; }
pre, code { font-family: var(--mono); overflow-wrap: anywhere; white-space: pre-wrap; }
code { font-size: .9em; }
button { font: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
:focus:not(:focus-visible) { outline: none; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; animation: none !important; } }

/* ---------- 3. Shell ---------- */
header.top, .land-head { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 8px; min-height: var(--header-h); padding: env(safe-area-inset-top) var(--gutter) 0; background: var(--bar-bg); -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px); border-bottom: 1px solid var(--line); }
.brand { display: inline-flex; align-items: center; gap: 8px; color: var(--ink); text-decoration: none; font-size: 17px; min-height: 44px; }
.brand b { font-weight: 600; }
.brand-sub { display: none; color: var(--muted); font-size: 15px; }
.top-actions { margin-left: auto; display: flex; align-items: center; gap: 4px; }
.iconbtn { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 12px; color: var(--muted); text-decoration: none; }
.iconbtn[aria-current] { color: var(--accent); }
nav.primary { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: grid; grid-template-columns: repeat(4, 1fr); height: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom); background: var(--bar-bg); -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px); border-top: 1px solid var(--line); }
nav.primary a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; color: var(--muted); font-size: 11px; font-weight: 500; text-decoration: none; min-height: 44px; }
nav.primary a svg { width: 24px; height: 24px; }
nav.primary a[aria-current="page"] { color: var(--accent); }
.nav-long { display: none; }
main { max-width: var(--maxw); margin: 0 auto; padding: 20px var(--gutter) 40px; }

/* ---------- 4. Type ---------- */
.page-head { margin-bottom: 20px; }
.eyebrow { font-size: 13px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; margin-bottom: 6px; }
h1 { font-size: 28px; line-height: 1.15; font-weight: 700; letter-spacing: -.01em; }
.sub { color: var(--muted); font-size: 15px; margin-top: 6px; }
.group { margin-top: 28px; }
.group-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.group-title { font-size: 20px; font-weight: 600; letter-spacing: -.01em; }
.group-desc { color: var(--muted); font-size: 15px; margin-top: 2px; }
.group-aside { color: var(--muted); font-size: 15px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.group-foot { color: var(--muted); font-size: 13px; margin-top: 10px; }
.group-foot a, .stat-link, .toggles a, .plain-link { text-decoration: none; font-weight: 500; }
.muted { color: var(--muted); }
.mono { font-family: var(--mono); font-size: .9em; }

/* ---------- 5. Cards & stats ---------- */
.card { background: var(--surface); border: 1px solid var(--card-border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; }
.stats { display: grid; grid-template-columns: 1fr; gap: 12px; }
.stat-label { font-size: 15px; color: var(--muted); font-weight: 500; }
.stat-value { font-size: 34px; font-weight: 600; letter-spacing: -.02em; font-variant-numeric: tabular-nums; line-height: 1.1; margin-top: 6px; display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; }
.stat-unit { font-size: 17px; color: var(--muted); font-weight: 500; letter-spacing: 0; }
.stat-caption { font-size: 13px; color: var(--muted); margin-top: 8px; line-height: 1.4; }
.stat-link { display: inline-flex; align-items: center; gap: 4px; margin-top: 10px; font-size: 15px; min-height: 32px; }
.stat .spark { margin-top: 10px; }
.stat.ok .stat-value { color: var(--ok); } .stat.warn .stat-value { color: var(--warn); } .stat.bad .stat-value { color: var(--bad); }
.status-card { padding: 20px 16px; }
.status-card h1 { font-size: 24px; }
.status-card .sub { font-size: 16px; margin-top: 8px; }
.status-card.ok h1 { color: var(--ok); } .status-card.warn h1 { color: var(--warn); } .status-card.bad h1 { color: var(--bad); }

/* ---------- 6. Grouped lists ---------- */
.list { list-style: none; margin: 0; padding: 0; background: var(--surface); border: 1px solid var(--card-border); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.list > li { padding: 12px 16px; }
.list > li + li { border-top: 1px solid var(--line); }
.row { display: flex; gap: 12px; align-items: flex-start; flex-wrap: wrap; }
.row-lead { flex: 0 0 auto; padding-top: 2px; }
.row-body { flex: 1 1 200px; min-width: 0; }
.row-title { font-size: 16px; font-weight: 500; overflow-wrap: anywhere; display: flex; flex-wrap: wrap; gap: 6px 8px; align-items: center; }
.row-sub { font-size: 15px; color: var(--muted); margin-top: 2px; overflow-wrap: anywhere; }
.row-meta { font-size: 13px; color: var(--faint); margin-top: 4px; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.row-trail { flex: 0 0 100%; color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }
.row-time { display: inline-block; min-width: 64px; font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; padding-top: 3px; }
.row .disclosure { margin-top: 4px; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; margin: 0; font-size: 14px; }
.kv dt { color: var(--faint); }
.kv dd { margin: 0; overflow-wrap: anywhere; }

/* ---------- 7. Pills & dots ---------- */
.pill { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 600; line-height: 1; padding: 5px 8px; border-radius: 999px; white-space: nowrap; background: var(--neutral-bg); color: var(--neutral); }
.pill.ok { background: var(--ok-bg); color: var(--ok); } .pill.warn { background: var(--warn-bg); color: var(--warn); } .pill.bad { background: var(--bad-bg); color: var(--bad); } .pill.neutral { background: var(--neutral-bg); color: var(--neutral); }
.pill.seo { background: var(--cat-seo-bg); color: var(--cat-seo); } .pill.content { background: var(--cat-content-bg); color: var(--cat-content); } .pill.design { background: var(--cat-design-bg); color: var(--cat-design); }
.pill.bugfix { background: var(--cat-bugfix-bg); color: var(--cat-bugfix); } .pill.infra { background: var(--cat-infra-bg); color: var(--cat-infra); } .pill.other { background: var(--neutral-bg); color: var(--neutral); }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--neutral); margin-top: 6px; }
.dot.ok { background: var(--ok); } .dot.warn { background: var(--warn); } .dot.bad { background: var(--bad); }
.tone-ok { color: var(--ok); } .tone-warn { color: var(--warn); } .tone-bad { color: var(--bad); }

/* ---------- 8. Progress, ring, sparkline ---------- */
.progress { height: 6px; background: var(--neutral-bg); border-radius: 3px; overflow: hidden; margin-top: 8px; }
.progress i { display: block; height: 100%; background: var(--accent); border-radius: 3px; }
.progress.full i { background: var(--ok); }
.ring { position: relative; width: 96px; height: 96px; flex: 0 0 auto; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 8; }
.ring .track { stroke: var(--neutral-bg); }
.ring .value { stroke: var(--accent); stroke-linecap: round; }
.ring.ok .value { stroke: var(--ok); } .ring.warn .value { stroke: var(--warn); } .ring.bad .value { stroke: var(--bad); }
.ring-num { position: absolute; inset: 0; display: grid; place-items: center; font-size: 30px; font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.spark { display: block; width: 100%; height: 40px; color: var(--accent); }
.spark.ok { color: var(--ok); } .spark.warn { color: var(--warn); } .spark.bad { color: var(--bad); }
.spark.sm { width: 80px; height: 24px; }

/* ---------- 9. Buttons & forms ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 0 16px; border: 0; border-radius: 12px; font: 600 16px/1 var(--sans); cursor: pointer; text-decoration: none; background: var(--neutral-bg); color: var(--ink); }
.btn.primary { background: var(--accent); color: var(--accent-ink); }
.btn.secondary { background: var(--accent-bg); color: var(--accent); }
.btn.quiet { background: transparent; color: var(--accent); padding: 0 10px; }
.btn.block { width: 100%; }
.btn:active { opacity: .75; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field-label { font-size: 13px; color: var(--muted); font-weight: 500; }
.field-hint { font-size: 13px; color: var(--faint); }
input, select, textarea { min-height: 44px; font: 16px var(--sans); padding: 10px 12px; border-radius: var(--radius-sm); background: var(--surface-2); border: 1px solid transparent; color: var(--ink); width: 100%; }
input { -webkit-appearance: none; appearance: none; }
textarea { min-height: 96px; resize: vertical; }
.form-row { display: grid; gap: 10px; }
.form-actions { margin-top: 12px; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.form-help { font-size: 13px; color: var(--muted); margin-bottom: 10px; }
.err { color: var(--bad); font-size: 15px; margin-top: 10px; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* ---------- 10. Disclosure ---------- */
.disclosure summary { list-style: none; cursor: pointer; min-height: 40px; display: flex; align-items: center; gap: 8px; color: var(--accent); font-size: 15px; font-weight: 500; }
.disclosure summary::-webkit-details-marker { display: none; }
.disclosure summary::before { content: ""; width: 6px; height: 6px; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: rotate(-45deg); transition: transform .15s; margin: 0 2px 0 4px; flex: 0 0 auto; }
.disclosure[open] summary::before { transform: rotate(45deg); }
.disclosure-body { font-size: 14px; color: var(--muted); padding: 2px 0 8px; }
.disclosure-body pre, .disclosure-body code.block { display: block; font: 13px/1.45 var(--mono); background: var(--surface-2); border-radius: 8px; padding: 8px 10px; margin: 6px 0; color: var(--ink); }
.disclosure-body code { font-size: 13px; }
.disclosure-body ul { margin: 6px 0; padding-left: 18px; }
.disclosure-body .kv { margin: 6px 0; }
.log-fail { color: var(--bad); }

/* ---------- 11. Empty, flash, chips, day titles ---------- */
.empty { text-align: center; padding: 32px 16px; }
.empty-title { font-size: 17px; font-weight: 600; }
.empty-desc { color: var(--muted); font-size: 15px; margin-top: 6px; }
.empty .btn, .empty form { margin-top: 14px; }
.flash { border-radius: 12px; padding: 12px 16px; font-size: 15px; margin: 0 0 16px; background: var(--neutral-bg); }
.flash.ok { background: var(--ok-bg); color: var(--ok); } .flash.warn { background: var(--warn-bg); color: var(--warn); } .flash.bad { background: var(--bad-bg); color: var(--bad); }
.chips { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; margin: 0 calc(-1 * var(--gutter)); padding: 2px var(--gutter) 6px; -webkit-overflow-scrolling: touch; }
.chips::-webkit-scrollbar { display: none; }
.chip { display: inline-flex; align-items: center; min-height: 40px; padding: 0 14px; border-radius: 999px; background: var(--neutral-bg); color: var(--ink); font-size: 15px; font-weight: 500; white-space: nowrap; text-decoration: none; }
.chip[aria-current] { background: var(--accent); color: var(--accent-ink); }
.toggles { display: flex; flex-wrap: wrap; gap: 6px 20px; margin: 10px 0 4px; font-size: 15px; }
.toggles .hint { display: block; font-size: 13px; color: var(--faint); }
.day-title { font-size: 13px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; margin: 24px 0 8px; display: flex; justify-content: space-between; gap: 12px; }
.day-title span { font-weight: 500; text-transform: none; letter-spacing: 0; }
.notice { border-radius: 12px; padding: 12px 16px; font-size: 15px; margin: 0 0 16px; background: var(--warn-bg); color: var(--warn); }

/* ---------- 12. Page-specific ---------- */
.hero { display: flex; flex-direction: column; gap: 16px; }
.hero-text h2 { font-size: 22px; font-weight: 600; }
.hero-text .sub { margin-top: 4px; }
.hero-text .row-meta { margin-top: 8px; font-size: 14px; }
.hero .form-actions { margin-top: 4px; }
.login-wrap { min-height: 100dvh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px var(--gutter); gap: 18px; }
.login { width: 100%; max-width: 360px; padding: 24px; }
.login h1 { font-size: 22px; }
.login .field { margin: 18px 0; }

/* ---------- 13. Landing (signed-out root) ---------- */
.land-head .btn { margin-left: auto; white-space: nowrap; }
.land-head .brand { font-size: 16px; }
.land-head .brand b { white-space: nowrap; }
.land { max-width: var(--maxw); margin: 0 auto; padding: 0 var(--gutter) 48px; }
.land section { padding-top: 44px; }
.hero-land { padding-top: 40px; }
.hero-land h1 { font-size: 34px; line-height: 1.1; letter-spacing: -.02em; }
.lede { font-size: 18px; color: var(--muted); margin-top: 14px; max-width: 560px; line-height: 1.45; }
.cta-row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 22px; }
.section-title { font-size: 26px; font-weight: 700; letter-spacing: -.02em; margin-bottom: 6px; }
.section-lede { color: var(--muted); font-size: 16px; margin-bottom: 18px; max-width: 560px; }
.demo { border-radius: var(--radius); background: var(--bg); border: 1px solid var(--line); padding: 16px; overflow: hidden; }
.demo .status-card { margin-bottom: 12px; }
.demo .list, .demo .group { margin-top: 12px; }
.demo-cap { font-size: 13px; color: var(--muted); margin-top: 12px; text-align: center; }
.steps, .features, .tiers { display: grid; gap: 12px; }
.step { padding: 16px; display: flex; gap: 12px; }
.step-n { width: 32px; height: 32px; border-radius: 50%; background: var(--accent-bg); color: var(--accent); display: grid; place-items: center; font-weight: 600; flex: 0 0 auto; }
.step h3, .feature h3 { font-size: 17px; font-weight: 600; }
.step p, .feature p { color: var(--muted); font-size: 15px; margin-top: 4px; }
.feature { padding: 16px; }
.feature .ico { width: 40px; height: 40px; border-radius: 12px; background: var(--accent-bg); color: var(--accent); display: grid; place-items: center; margin-bottom: 10px; }
.tier { padding: 22px 20px 20px; position: relative; display: flex; flex-direction: column; }
.tier.featured { border: 2px solid var(--accent); }
.tier-badge { position: absolute; top: -12px; left: 20px; background: var(--accent); color: var(--accent-ink); font-size: 12px; font-weight: 600; padding: 5px 10px; border-radius: 999px; }
.tier h3 { font-size: 20px; font-weight: 600; }
.tier .tagline { color: var(--muted); font-size: 15px; margin-top: 2px; }
.price { margin-top: 14px; font-size: 34px; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; line-height: 1; }
.price small { font-size: 15px; color: var(--muted); font-weight: 500; letter-spacing: 0; margin-left: 4px; }
.tier ul { list-style: none; margin: 16px 0 0; padding: 0; display: grid; gap: 8px; flex: 1; }
.tier li { display: flex; gap: 8px; align-items: flex-start; font-size: 15px; }
.tier li svg { flex: 0 0 auto; color: var(--ok); margin-top: 2px; }
.tier .btn { margin-top: 18px; }
.tiers-foot { font-size: 13px; color: var(--muted); margin-top: 12px; text-align: center; }
.contact { padding: 20px 16px; }
.contact .form-row { margin-top: 14px; }
.land-foot { margin-top: 48px; padding-top: 20px; border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; display: flex; flex-wrap: wrap; gap: 8px 16px; justify-content: space-between; }
.land-foot a { color: inherit; }

/* ---------- 14. Breakpoints ---------- */
@media (min-width: 480px) {
  .stats, .tiers, .features { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 600px) {
  :root { --gutter: 24px; }
  .brand-sub { display: inline; }
  nav.primary { padding-left: calc(50% - 240px); padding-right: calc(50% - 240px); }
  main { padding-top: 28px; }
  .card { padding: 20px; }
  .status-card h1 { font-size: 28px; }
  .row-trail { flex: 0 0 auto; margin-left: auto; text-align: right; }
  .form-row { grid-template-columns: repeat(2, 1fr); }
  .form-row .span2 { grid-column: 1 / -1; }
  .hero { flex-direction: row; align-items: center; }
  .hero-text { flex: 1; }
  .chips { margin: 0; flex-wrap: wrap; padding: 2px 0 6px; }
  .land section { padding-top: 56px; }
  .hero-land { padding-top: 56px; }
  .hero-land h1 { font-size: 44px; }
  .steps { grid-template-columns: repeat(3, 1fr); }
  .contact { padding: 24px; }
}
@media (min-width: 900px) {
  :root { --gutter: 32px; }
  body { padding-bottom: 0; }
  header.top { gap: 20px; }
  nav.primary { position: fixed; top: calc(env(safe-area-inset-top) + 7px); bottom: auto; left: 50%; right: auto; transform: translateX(-50%); z-index: 21; display: flex; height: auto; padding: 3px; border: 0; background: var(--neutral-bg); border-radius: 999px; -webkit-backdrop-filter: none; backdrop-filter: none; }
  nav.primary a { flex-direction: row; padding: 7px 14px; border-radius: 999px; font-size: 15px; min-height: 0; color: var(--muted); }
  nav.primary a svg, .nav-short { display: none; }
  .nav-long { display: inline; }
  nav.primary a[aria-current="page"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.12); }
  main { padding-top: 36px; }
  h1 { font-size: 34px; }
  .stats { grid-template-columns: repeat(3, 1fr); }
  .tiers { grid-template-columns: repeat(3, 1fr); }
  .features { grid-template-columns: repeat(4, 1fr); }
  .form-row.plan { grid-template-columns: auto 1fr 1fr auto; align-items: end; }
  .ring { width: 120px; height: 120px; }
  .ring-num { font-size: 36px; }
  .hero-land h1 { font-size: 52px; }
}
.mt { margin-top: 12px; }
