/* ==========================================================================
   Milemarker — brand system (from design_handoff_milemarker_brand)
   Haze paper, Asphalt ink, Sunset Coral, Lane Gold accents, square corners.
   Display & body: Overpass · Technical/meta: Overpass Mono
   ========================================================================== */

:root {
  --paper: #F5EFE6;        /* Haze */
  --paper-deep: #EFE7D8;   /* panel tint */
  --panel: #F8F2E7;
  --ink: #2B2B30;          /* Asphalt */
  --ink-soft: #6F675A;     /* muted text */
  --rule: #D8CFC0;         /* Sand rule */
  --rule-soft: #E5DECF;
  --orange: #E3785C;       /* Sunset Coral */
  --orange-deep: #C4573D;
  --gold: #E8B04B;         /* Lane Gold */
  --blue: #5E7A93;         /* Marine, darkened for text */
  --ok: #3D7A44;
  --warn: #96660A;
  --bad: #A72315;
  --shadow: none;
  --font-display: 'Overpass', 'Helvetica Neue', sans-serif;
  --font-body: 'Overpass', 'Helvetica Neue', sans-serif;
  --font-mono: 'Overpass Mono', 'Courier New', monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
/* one stray wide element must never widen the page itself (iPhone: content
   wider than the layout viewport renders zoomed-in with the right edge cut) */
html, body { max-width: 100%; overflow-x: clip; }

body {
  background: var(--paper);
  color: var(--ink);
  font: 15px/1.55 var(--font-body);
  -webkit-font-smoothing: antialiased;
  /* Native shell + installed PWA: keep the app out from under the iPhone
     status bar / notch. env() is 0 in ordinary browser tabs. */
  padding-top: env(safe-area-inset-top);
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
}

/* paper grain */
body::before {
  content: '';
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  opacity: .05;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)'/%3E%3C/svg%3E");
}

a { color: var(--orange-deep); text-decoration-thickness: 1px; text-underline-offset: 2px; }
h1, h2, h3 { line-height: 1.05; }

.app { display: flex; min-height: 100vh; position: relative; z-index: 1; }

/* ==========================================================================
   Sidebar — manual cover / tab index
   ========================================================================== */
.sidebar {
  width: 248px; flex-shrink: 0;
  background: var(--paper-deep);
  border-right: 2px solid var(--ink);
  padding: 22px 0 24px;
  display: flex; flex-direction: column;
}
.brand { padding: 0 18px 16px; border-bottom: 2px solid var(--ink); margin-bottom: 14px; }
.brand-crest { display: block; line-height: 0; margin-bottom: 10px; }
.brand-name {
  font-family: var(--font-display); font-weight: 800; font-size: 17px;
  letter-spacing: .28em; text-transform: uppercase; padding-left: .28em;
}
.brand-sub {
  font-family: var(--font-mono); font-size: 9px; letter-spacing: .24em;
  color: #B98A5E; text-transform: uppercase; margin-top: 4px;
}
.nav-link {
  display: flex; align-items: baseline; gap: 10px;
  padding: 8px 18px; margin: 1px 0;
  color: var(--ink); text-decoration: none;
  font-weight: 600; font-size: 14px; letter-spacing: .02em;
  text-transform: uppercase;
  border-left: 4px solid transparent;
}
.nav-num { font-family: var(--font-mono); font-size: 10.5px; color: var(--ink-soft); }
.nav-link:hover { background: var(--panel); border-left-color: var(--rule); }
.nav-link.active { border-left-color: var(--orange); background: var(--panel); }
.nav-link.active .nav-num { color: var(--orange-deep); }

.side-head {
  margin: 20px 18px 6px; padding-top: 14px; border-top: 1px solid var(--rule);
  font-family: var(--font-mono); font-size: 10px; letter-spacing: .16em;
  text-transform: uppercase; color: var(--ink-soft);
}
.vehicle-btn {
  display: block; width: calc(100% - 24px); margin: 3px 12px; text-align: left;
  background: var(--panel); border: 1.5px solid var(--rule);
  color: var(--ink); padding: 8px 10px; cursor: pointer;
  font: 600 13.5px var(--font-body);
}
.vehicle-btn small { display: block; font-family: var(--font-mono); font-weight: 400; font-size: 10.5px; color: var(--ink-soft); margin-top: 1px; }
.vehicle-btn:hover { border-color: var(--ink); }
.vehicle-btn.active { border: 1.5px solid var(--ink); box-shadow: 2px 2px 0 var(--ink); background: #fff; }
.sidebar > .btn { margin: 10px 12px 0; }

/* ==========================================================================
   Main column & section headers
   ========================================================================== */
.main { flex: 1; padding: 30px 36px 70px; max-width: 1080px; min-width: 0; }

@media (prefers-reduced-motion: no-preference) {
  .main > * { animation: rise .35s cubic-bezier(.2,.7,.3,1) both; }
  .main > *:nth-child(2) { animation-delay: .04s; }
  .main > *:nth-child(3) { animation-delay: .08s; }
  .main > *:nth-child(4) { animation-delay: .12s; }
  .main > *:nth-child(5) { animation-delay: .16s; }
  .main > *:nth-child(6) { animation-delay: .20s; }
  @keyframes rise { from { opacity: 0; transform: translateY(9px); } to { opacity: 1; transform: none; } }
  /* full badge emblem now — a gentle float instead of the old clipped rise */
  @keyframes sun-rise { 0%, 100% { transform: translateY(4px); } 50% { transform: translateY(-2px); } }
}

.topbar {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 14px;
  border-bottom: 3px double var(--ink);
  padding-bottom: 12px; margin-bottom: 22px; flex-wrap: wrap;
}
.kicker {
  font-family: var(--font-mono); font-size: 10.5px; letter-spacing: .18em;
  text-transform: uppercase; color: var(--orange-deep); margin-bottom: 2px;
}
.topbar h1 {
  margin: 0; font-family: var(--font-display); font-weight: 800;
  font-size: 29px; text-transform: uppercase; letter-spacing: .08em; line-height: 1.15;
}
/* overflow-wrap: VINs, file names, and emails are single long tokens — on a
   phone they must break mid-token or they push the page wider than the screen */
.topbar .sub { color: var(--ink-soft); font-size: 13.5px; max-width: 60ch; overflow-wrap: anywhere; }
.topbar .actions { display: flex; gap: 8px; padding-bottom: 4px; }

/* ==========================================================================
   Buttons & inputs
   ========================================================================== */
.btn {
  display: inline-block;
  background: var(--panel); color: var(--ink);
  border: 1.5px solid var(--ink); border-radius: 0;
  padding: 9px 16px; cursor: pointer; text-decoration: none;
  font: 800 12px var(--font-body); letter-spacing: .14em; text-transform: uppercase;
  transition: filter 150ms ease, background 150ms ease;
}
.btn:hover { background: rgba(43, 43, 48, .06); }
.btn.primary { background: var(--orange); border-color: var(--orange); color: #F5EFE6; }
.btn.primary:hover { background: var(--orange); filter: brightness(.94); }
.btn.danger { color: var(--bad); border-color: var(--bad); background: none; }
.btn.danger:hover { background: rgba(167, 35, 21, .07); }
.btn.small { padding: 5px 10px; font-size: 10.5px; }

input, select, textarea {
  background: #FBF7EE; color: var(--ink);
  border: 1.5px solid var(--ink); border-radius: 0;
  padding: 8px 10px; font: 400 14px var(--font-body); width: 100%;
}
input[type="number"], input[type="date"] { font-family: var(--font-mono); font-size: 13px; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--orange); outline-offset: -1px; }
label {
  display: block; margin-bottom: 4px;
  font-family: var(--font-mono); font-size: 10.5px; font-weight: 500;
  letter-spacing: .12em; text-transform: uppercase; color: var(--ink-soft);
}
.field { margin-bottom: 13px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }

/* ==========================================================================
   Cards & spec plates
   ========================================================================== */
.card {
  position: relative;
  background: var(--panel);
  border: 1.5px solid var(--ink);
  padding: 18px 20px; margin-bottom: 18px;
}
.card h3 {
  margin: -18px -20px 14px; padding: 8px 20px 7px;
  border-bottom: 1.5px solid var(--ink);
  font-family: var(--font-mono); font-size: 11px; font-weight: 600;
  letter-spacing: .18em; text-transform: uppercase;
  background: var(--paper-deep);
}

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 18px; }
.stat {
  background: var(--panel); border: 1.5px solid var(--ink);
  padding: 12px 14px 10px; position: relative;
}
.stat::after {
  content: ''; position: absolute; top: 4px; right: 4px; width: 5px; height: 5px;
  border-radius: 50%; background: var(--rule); box-shadow: inset 0 0 0 1px var(--ink-soft);
}
.stat .num { font-family: var(--font-display); font-weight: 800; font-size: 30px; letter-spacing: .01em; }
.stat .lbl { font-family: var(--font-mono); font-size: 9.5px; letter-spacing: .16em; text-transform: uppercase; color: var(--ink-soft); }

/* ==========================================================================
   Stamps (verification verdicts) & tags
   ========================================================================== */
.badge, .stamp {
  display: inline-block;
  font: 600 10.5px var(--font-mono); letter-spacing: .1em; text-transform: uppercase;
  border: 1.5px solid currentColor; border-radius: 1px;
  padding: 2px 8px 1px;
  transform: rotate(-1.6deg);
  white-space: nowrap;
}
.badge.ok   { color: var(--ok); }
.badge.warn { color: var(--warn); }
.badge.bad  { color: var(--bad); transform: rotate(-3deg); }
.badge.none { color: var(--ink-soft); border-style: dashed; transform: none; }
.badge.type { color: var(--blue); transform: none; border-style: solid; }

/* ==========================================================================
   Tables
   ========================================================================== */
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--rule); vertical-align: top; }
th {
  font-family: var(--font-mono); font-weight: 600; font-size: 10px;
  letter-spacing: .14em; text-transform: uppercase; color: var(--ink-soft);
  border-bottom: 1.5px solid var(--ink);
}
td .mono, .mono { font-family: var(--font-mono); font-size: 12.5px; }
tr:last-child td { border-bottom: none; }

/* ==========================================================================
   Record rows (ledger style)
   ========================================================================== */
.record-row {
  display: flex; gap: 14px; align-items: center;
  padding: 11px 6px; border-bottom: 1px dashed var(--rule); cursor: pointer;
}
.record-row:hover { background: rgba(208, 73, 27, .06); }
.record-row:last-child { border-bottom: none; }
.record-row .grow { flex: 1; min-width: 0; }
.record-row .title { font-weight: 700; font-size: 15px; }
.record-row .meta { color: var(--ink-soft); font-family: var(--font-mono); font-size: 11.5px; margin-top: 1px; }

/* ==========================================================================
   Dynamic form rows
   ========================================================================== */
.row-list .frow { display: grid; gap: 8px; margin-bottom: 8px; align-items: center; }
.frow.part-row { grid-template-columns: 2fr 1.2fr 1.4fr 60px 90px 30px; }
.frow.torque-row { grid-template-columns: 2fr 2fr 30px; }
/* torque-page entry form: real button track, not the 30px ✕ slot */
.frow.spec-form { display: grid; gap: 8px; grid-template-columns: 2fr 2fr auto; align-items: center; }
.frow.plan-part-row { grid-template-columns: 1.8fr 1.2fr 55px 85px 1.6fr 30px; }
.row-x { background: none; border: none; color: var(--bad); font: 700 15px var(--font-mono); cursor: pointer; padding: 2px; }

/* ==========================================================================
   Receipts & vetting output
   ========================================================================== */
.receipt-pending { border: 1.5px dashed var(--ink-soft); padding: 12px; margin-bottom: 12px; background: #FBF7EE; }
.receipt-pending .fname { font-family: var(--font-mono); font-size: 12px; margin-bottom: 10px; }
.vet-flag, .vet-caution, .vet-ok { font-family: var(--font-mono); font-size: 12px; margin: 3px 0; padding-left: 14px; text-indent: -14px; }
.vet-flag { color: var(--bad); }
.vet-caution { color: var(--warn); }
.vet-ok { color: var(--ok); }

.thumbs { display: flex; gap: 8px; flex-wrap: wrap; }
.thumbs img {
  width: 92px; height: 92px; object-fit: cover;
  border: 1.5px solid var(--ink); background: #fff; padding: 3px;
  box-shadow: 2px 2px 0 rgba(232,176,75,.4);
  cursor: zoom-in;
}
.thumbs img:hover { box-shadow: 2px 2px 0 rgba(232,176,75,.85); }

/* Lightbox — tap a receipt/photo thumbnail to read it full size. Sits above
   the record modal (z-index 50); on the native shell where pinch-zoom is
   disabled this is the only way to enlarge a receipt. */
.lightbox-backdrop {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(25, 22, 16, .93);
  display: flex; flex-direction: column; align-items: center;
  overflow: auto; overscroll-behavior: contain;
  padding: calc(56px + env(safe-area-inset-top, 0px))
           calc(16px + env(safe-area-inset-right, 0px))
           calc(24px + env(safe-area-inset-bottom, 0px))
           calc(16px + env(safe-area-inset-left, 0px));
}
.lightbox-img {
  max-width: 100%; height: auto; margin: auto 0;
  border: 1.5px solid var(--ink); background: #fff; padding: 4px;
  box-shadow: 8px 8px 0 rgba(232,176,75,.4);
  cursor: zoom-out;
}
.lightbox-cap {
  color: var(--paper); font-size: 12px; text-align: center;
  margin-top: 12px; max-width: 100%; word-break: break-word;
}
.lightbox-pdf {
  margin-top: 14px; background: var(--paper); color: var(--ink);
  border: 1.5px solid var(--paper); flex: 0 0 auto;
}
.lightbox-pdf:hover { background: var(--orange); border-color: var(--orange); }
.lightbox-close {
  position: fixed; top: calc(12px + env(safe-area-inset-top, 0px)); right: 14px;
  width: 40px; height: 40px; border-radius: 50%;
  border: 1.5px solid var(--paper); background: rgba(25, 22, 16, .6);
  color: var(--paper); font-size: 20px; line-height: 1; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.lightbox-close:hover { background: var(--ink); }

/* ==========================================================================
   Modal — pulled work order
   ========================================================================== */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(25, 22, 16, .5);
  display: flex; align-items: flex-start; justify-content: center;
  /* viewport-fit=cover in the iOS shell: keep modal content (wizard, plan
     picker, auth) clear of the notch and home indicator */
  padding: calc(42px + env(safe-area-inset-top, 0px))
           calc(16px + env(safe-area-inset-right, 0px))
           calc(42px + env(safe-area-inset-bottom, 0px))
           calc(16px + env(safe-area-inset-left, 0px));
  overflow-y: auto; z-index: 50;
}
.modal {
  background: var(--paper); border: 2px solid var(--ink);
  box-shadow: 8px 8px 0 rgba(232,176,75,.35);
  padding: 24px 26px; width: 100%; max-width: 740px;
}
.modal h2 {
  margin: -24px -26px 18px; padding: 14px 26px 12px;
  border-bottom: 2px solid var(--ink); background: var(--paper-deep);
  font-family: var(--font-display); font-weight: 800; font-size: 26px;
  text-transform: uppercase;
}
.modal .card { background: #FBF7EE; }

/* ==========================================================================
   Empty states
   ========================================================================== */
.empty { text-align: center; color: var(--ink-soft); padding: 42px 16px; }
.empty .big {
  font-family: var(--font-display); font-weight: 800; font-size: 54px;
  color: var(--orange); letter-spacing: .02em; margin-bottom: 6px;
}
.empty h2 { font-family: var(--font-display); text-transform: uppercase; font-size: 30px; color: var(--ink); margin: 0 0 8px; }

/* ==========================================================================
   Checkbox grid
   ========================================================================== */
.check-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 3px 18px; }
.check-grid label {
  display: flex; align-items: center; gap: 8px;
  font: 400 13.5px var(--font-body); text-transform: none; letter-spacing: 0;
  color: var(--ink); margin: 0;
}
.check-grid input { width: auto; accent-color: var(--orange); }

/* AI manual-section finder (Master Tech) — planned-work estimates */
#ai-section-finder .ai-mt-tag {
  font-size: 9.5px; letter-spacing: .14em; color: var(--blue);
  border: 1px solid var(--rule); border-radius: 3px; padding: 1px 5px;
  margin-left: 6px; vertical-align: middle;
}
#ai-section-results { display: flex; flex-direction: column; gap: 6px; }
.ai-suggestion {
  display: flex; align-items: flex-start; gap: 8px; margin: 0;
  border: 1.5px solid var(--rule); border-radius: 4px; padding: 8px 10px;
  background: #FBF7EE; font: 400 13.5px var(--font-body);
}
.ai-suggestion input { width: auto; margin-top: 2px; accent-color: var(--orange); }
.ai-suggestion-body { line-height: 1.35; }
.ai-reason { font-size: 11px; color: var(--ink-soft); }
.ai-badge {
  font: 700 9px var(--font-mono); letter-spacing: .1em; padding: 1px 5px;
  border-radius: 3px; border: 1px solid currentColor; vertical-align: middle;
}
.ai-badge.ai-high { color: var(--ok); }
.ai-badge.ai-medium { color: var(--warn); }
.ai-badge.ai-low { color: var(--ink-soft); }

/* ==========================================================================
   Report — the printable record
   ========================================================================== */
.report {
  background: #FBF7EE; color: #171512;
  border: 2px solid var(--ink); box-shadow: 8px 8px 0 rgba(232,176,75,.35);
  padding: 36px 40px; position: relative;
}
.report h1 { font-family: var(--font-display); font-weight: 800; font-size: 27px; margin: 0; text-transform: uppercase; }
.report h2 {
  font-family: var(--font-mono); font-size: 11.5px; font-weight: 600;
  letter-spacing: .18em; text-transform: uppercase;
  margin: 26px 0 8px; border-bottom: 2px solid #171512; padding-bottom: 4px;
}
.report .rpt-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 18px; border-bottom: 3px solid var(--orange); padding-bottom: 14px; }
.report .rpt-veh { text-align: right; }
.report .muted { color: #6a6250; font-size: 12.5px; }
.report .rpt-head .mono, .report .muted { font-family: var(--font-mono); font-size: 11.5px; }
.report table { font-size: 12.5px; }
.report th, .report td { border-bottom: 1px solid #d8d2c0; color: #171512; padding: 6px 8px; }
.report th { color: #5c5442; border-bottom: 1.5px solid #171512; }
.report .rpt-stats { display: flex; gap: 30px; margin: 16px 0 4px; flex-wrap: wrap; }
.report .rpt-stats div { font-family: var(--font-mono); font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase; color: #5c5442; }
.report .rpt-stats b { font-family: var(--font-display); font-size: 26px; display: block; color: #171512; letter-spacing: .01em; }
.report .integrity { color: var(--bad); font-size: 13px; }
.report .disclaimer { font-size: 10.5px; color: #6a6250; margin-top: 22px; border-top: 1px solid #d8d2c0; padding-top: 10px; line-height: 1.6; }
.report .mi-flag { color: var(--bad); font-weight: 700; }

@media print {
  body { background: #fff; }
  body::before { display: none; }
  .sidebar, .topbar, .no-print { display: none !important; }
  .app { display: block; }
  .main { max-width: none; padding: 0; }
  .report { border: none; box-shadow: none; padding: 0; }
  .report tr { break-inside: avoid; }
}

/* ==========================================================================
   Mobile — companion layout
   ========================================================================== */
/* ==========================================================================
   Mobile & native shell — hamburger + slide-in drawer.
   The sidebar keeps its desktop (vertical) styling and becomes the drawer.
   ========================================================================== */
.mobilebar { display: none; }
.nav-backdrop { display: none; }

@media (max-width: 840px) {
  body { padding-top: 0; } /* the sticky bar carries the safe-area inset instead */

  .mobilebar {
    display: flex; align-items: center; gap: 13px;
    position: sticky; top: 0; z-index: 40;
    background: var(--paper-deep);
    border-bottom: 2px solid var(--ink);
    padding: calc(10px + env(safe-area-inset-top)) 14px 10px;
  }
  .hamb {
    display: flex; flex-direction: column; justify-content: center; gap: 4px;
    width: 42px; height: 38px; padding: 9px 10px; flex-shrink: 0;
    background: var(--panel); border: 1.5px solid var(--ink);
    box-shadow: 2px 2px 0 var(--ink); cursor: pointer; border-radius: 0;
  }
  .hamb span { display: block; height: 2px; background: var(--ink); }
  .hamb:active { transform: translate(1px, 1px); box-shadow: 1px 1px 0 var(--ink); }
  .now { min-width: 0; }
  .now-kicker {
    display: block; font-family: var(--font-mono); font-size: 9.5px; font-weight: 600;
    letter-spacing: .18em; text-transform: uppercase; color: var(--orange-deep);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }
  .now-label {
    display: block; font-family: var(--font-display); font-weight: 800; font-size: 17px;
    letter-spacing: .06em; text-transform: uppercase; line-height: 1.2;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }
  .mobilebar .crest { margin-left: auto; flex-shrink: 0; line-height: 0; }

  .app { display: block; }
  .sidebar {
    position: fixed; top: 0; left: 0; bottom: 0; z-index: 60;
    width: min(320px, 86vw);
    padding-top: calc(22px + env(safe-area-inset-top));
    padding-bottom: calc(24px + env(safe-area-inset-bottom));
    transform: translateX(-103%);
    transition: transform .22s ease;
    overflow-y: auto;
  }
  body.nav-open .sidebar { transform: none; box-shadow: 7px 0 26px rgba(43, 43, 48, .28); }
  .nav-backdrop {
    display: block; position: fixed; inset: 0; z-index: 50;
    background: rgba(43, 43, 48, .34);
    opacity: 0; pointer-events: none; transition: opacity .18s ease;
  }
  body.nav-open .nav-backdrop { opacity: 1; pointer-events: auto; }

  .main { padding: 18px 14px 60px; }
  .topbar h1 { font-size: 30px; }
  .grid2, .grid3, .check-grid { grid-template-columns: 1fr; }
  .frow.part-row { grid-template-columns: 1fr 1fr; }
  .frow.torque-row { grid-template-columns: 1fr 1fr 30px; }
  .frow.plan-part-row { grid-template-columns: 1fr 1fr; }
  .frow.spec-form { grid-template-columns: 1fr; } /* stack: fastener, spec, + Add */
}

@media (prefers-reduced-motion: reduce) {
  .sidebar, .nav-backdrop { transition: none; }
}

/* ==========================================================================
   Ledger cards — dense tables become stacked cards on phones.
   Screen only: print keeps real tables (the history report stays a clean
   printable document even when printed FROM a phone).
   Opt a table in with class="cardable"; cells label themselves via
   data-label, c-title (card heading), c-inline (side-by-side mono),
   c-status (chip pinned top-right).
   ========================================================================== */
@media screen and (max-width: 840px) {
  .cardable, .cardable tbody, .cardable tr, .cardable td { display: block; }
  .cardable tr:first-child { display: none; } /* the <th> header row */
  .cardable tr {
    position: relative;
    background: var(--panel);
    border: 1.5px solid var(--ink);
    box-shadow: 2px 2px 0 var(--ink);
    padding: 12px 12px 10px;
    margin-bottom: 12px;
  }
  .cardable td { border: none; padding: 3px 0; }
  .cardable td[data-label]::before {
    content: attr(data-label);
    font-family: var(--font-mono); font-weight: 600; font-size: 9.5px;
    letter-spacing: .14em; text-transform: uppercase; color: var(--ink-soft);
    margin-right: 8px;
  }
  .cardable td.c-title { font-weight: 600; font-size: 15.5px; padding: 0 96px 6px 0; }
  .cardable td.c-inline { display: inline-block; padding: 0 12px 4px 0; font-family: var(--font-mono); font-size: 12.5px; }
  .cardable td.c-inline:first-child { font-weight: 600; }
  .cardable td.c-status { position: absolute; top: 12px; right: 12px; padding: 0; }

  /* tables that stay tables scroll inside their card instead of clipping */
  .card > table:not(.cardable) { display: block; overflow-x: auto; }

  /* history report: header stacks, stat strip becomes a tidy grid */
  .report .rpt-head { flex-direction: column; }
  .report .rpt-veh { text-align: left; }
  .report .rpt-head { overflow-wrap: anywhere; }
  .report .rpt-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; }
  .report .rpt-stats div:last-child { grid-column: 1 / -1; }
}

/* ==========================================================================
   Billing — plans, paywall, report watermark, toast
   ========================================================================== */
.plan-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 14px 0; }
.plan-grid.two { grid-template-columns: repeat(2, 1fr); }
.plan-card {
  position: relative; display: flex; flex-direction: column; gap: 8px; align-items: flex-start;
  border: 1.5px solid var(--rule); background: var(--panel); padding: 18px 15px 15px;
}
.plan-card.featured { border-color: var(--ink); box-shadow: 4px 4px 0 rgba(227, 120, 92, .3); }
.plan-card.current { border-color: var(--ink); border-style: dashed; }
.plan-flag {
  position: absolute; top: -9px; right: 10px; background: var(--orange); color: var(--paper);
  font-family: var(--font-mono); font-size: 9px; font-weight: 600; letter-spacing: .18em; padding: 2px 8px;
}
.plan-name { font-family: var(--font-mono); font-weight: 600; font-size: 12px; letter-spacing: .18em; text-transform: uppercase; }
.plan-price { font-family: var(--font-display); font-weight: 800; font-size: 26px; line-height: 1; }
.plan-feats { margin: 0 0 4px; padding-left: 17px; font-size: 12.5px; color: var(--ink-soft); }
.plan-feats li { margin: 3px 0; }
.plan-card .btn { margin-top: auto; }

.lock-note {
  font-family: var(--font-mono); font-size: 11px; color: var(--orange-deep);
  border: 1.5px dashed var(--orange-deep); padding: 7px 10px; margin-bottom: 10px; cursor: pointer;
}
.lock-note:hover { background: rgba(227, 120, 92, .08); }

/* locked buyer report: TILED diagonal watermark — the stamp repeats across the
   whole report so no screenshot crop or partial print comes out clean. The
   pattern is a repeating SVG tile; prints darker via the @media print swap. */
.rpt-watermark {
  position: absolute; inset: 0; z-index: 5; pointer-events: none;
  background-repeat: repeat; background-position: center;
  background-image: url("data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20width='300'%20height='200'%3E%3Cg%20transform='rotate(-24%20150%20100)'%20fill='%23c4573d'%20fill-opacity='0.13'%20font-family='Arial'%20font-weight='800'%20text-anchor='middle'%3E%3Ctext%20x='150'%20y='96'%20font-size='27'%20letter-spacing='3'%3EPREVIEW%3C/text%3E%3Ctext%20x='150'%20y='122'%20font-size='13'%20letter-spacing='2'%3ENOT%20FOR%20SALE%20USE%3C/text%3E%3C/g%3E%3C/svg%3E");
}
@media print {
  .rpt-watermark {
    display: block !important;
    background-image: url("data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20width='300'%20height='200'%3E%3Cg%20transform='rotate(-24%20150%20100)'%20fill='%23c4573d'%20fill-opacity='0.26'%20font-family='Arial'%20font-weight='800'%20text-anchor='middle'%3E%3Ctext%20x='150'%20y='96'%20font-size='27'%20letter-spacing='3'%3EPREVIEW%3C/text%3E%3Ctext%20x='150'%20y='122'%20font-size='13'%20letter-spacing='2'%3ENOT%20FOR%20SALE%20USE%3C/text%3E%3C/g%3E%3C/svg%3E");
  }
}

.toast {
  position: fixed; left: 50%; bottom: 26px; z-index: 400;
  transform: translateX(-50%) translateY(12px);
  background: var(--ink); color: var(--paper);
  font-size: 11.5px; letter-spacing: .08em; padding: 12px 18px;
  border: 1.5px solid var(--ink); box-shadow: 3px 3px 0 rgba(43, 43, 48, .25);
  opacity: 0; transition: opacity .3s ease, transform .3s ease;
  max-width: min(90vw, 480px); text-align: center;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

@media (max-width: 760px) {
  .plan-grid, .plan-grid.two { grid-template-columns: 1fr; }
}

/* full-screen "tap Done" card shown in the iOS Safari sheet after checkout */
.native-return {
  position: fixed; inset: 0; z-index: 1000;
  background: var(--paper);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 4px; text-align: center; padding: 40px 26px;
}
.native-return .nr-done {
  position: absolute; top: max(14px, env(safe-area-inset-top)); left: 16px;
  font-size: 12px; letter-spacing: .06em; color: var(--orange-deep);
  animation: nr-nudge 1.8s ease-in-out infinite;
}
@keyframes nr-nudge { 0%, 100% { transform: translateX(0); } 50% { transform: translateX(-5px); } }
.native-return .nr-crest { display: inline-block; line-height: 0; margin-bottom: 10px; }
.native-return .nr-rule { height: 3px; width: 240px; max-width: 70vw; background: var(--ink); margin: 0 0 10px; }
.native-return .nr-word { font-weight: 800; font-size: 19px; letter-spacing: .42em; padding-left: .42em; }
.native-return h1 {
  font-family: var(--font-display); font-weight: 800;
  font-size: clamp(30px, 8vw, 46px); letter-spacing: .1em;
  margin: 18px 0 4px; color: var(--orange-deep);
}
.native-return .nr-line { font-size: 13px; color: var(--ink-soft); margin: 0; }
.native-return .nr-hint {
  font-size: 12px; color: var(--ink-soft); margin-top: 18px;
  border: 1.5px dashed var(--rule); padding: 10px 14px; line-height: 1.7;
}
@media (prefers-reduced-motion: reduce) { .native-return .nr-done { animation: none; } }

/* ==========================================================================
   Feature gating — tier-locked elements (data-requires-tier)
   Visible but dimmed; clicking opens an upsell instead of the action.
   ========================================================================== */
.feature-locked { opacity: .62; filter: saturate(.75); }
.feature-locked:hover { opacity: .88; }
.vehicle-btn.ghost-slot { border-style: dashed; background: transparent; }
.vehicle-btn.ghost-slot:hover { border-color: var(--orange-deep); }

/* ==========================================================================
   Odometer timeline (dashboard) — SVG trace with live service markers.
   Marks wear data color; every label wears text tokens (ink / ink-soft).
   ========================================================================== */
.mm-chart { position: relative; }
.mm-chart svg { display: block; width: 100%; height: auto; }
.mm-grid { stroke: var(--rule-soft); stroke-width: 1; }
.mm-axis { stroke: var(--ink); stroke-width: 1.5; }
.mm-lab { font-family: var(--font-mono); font-size: 10px; fill: var(--ink-soft); letter-spacing: .04em; }
.mm-trace { fill: none; stroke: var(--ink); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.mm-now { stroke: var(--ink-soft); stroke-dasharray: 3 5; }
.mm-nowdot { fill: var(--panel); stroke: var(--ink-soft); stroke-width: 2; }
.mm-fuel { fill: var(--ink-soft); opacity: .6; }
.mm-x { stroke: var(--ink-soft); stroke-width: 1; }
.mm-pt { cursor: pointer; outline: none; }
.mm-hit { fill: transparent; }
/* marker: orange-deep ≥9px dot with a 2px panel ring so it stays legible on the trace */
.mm-dot { fill: var(--orange-deep); stroke: var(--panel); stroke-width: 2; }
.mm-dot.flag { fill: var(--warn); }
.mm-count { fill: var(--paper); font: 700 8.5px var(--font-mono); pointer-events: none; }
.mm-flagmark { fill: var(--warn); }
.mm-focus { fill: none; stroke: var(--ink); stroke-width: 1.5; stroke-dasharray: 2 3; opacity: 0; }
.mm-pt:focus-visible .mm-focus { opacity: 1; }

.mm-keys { display: flex; flex-wrap: wrap; gap: 4px 16px; margin-top: 8px; font-size: 10px; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-soft); }
.mm-key { display: inline-flex; align-items: center; gap: 6px; }
.mm-key i { display: inline-block; flex-shrink: 0; }
.mm-key .k-line { width: 14px; height: 2px; background: var(--ink); }
.mm-key .k-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--orange-deep); }
.mm-key .k-fuel { width: 5px; height: 5px; border-radius: 50%; background: var(--ink-soft); opacity: .7; }
.mm-key .k-flag { width: 0; height: 0; border-left: 5px solid transparent; border-right: 5px solid transparent; border-bottom: 8px solid var(--warn); }
.mm-key .k-now { width: 14px; height: 0; border-top: 2px dashed var(--ink-soft); }

.mm-tip {
  position: absolute; z-index: 5; left: 0; top: 0;
  background: #FBF7EE; border: 1.5px solid var(--ink);
  box-shadow: 3px 3px 0 rgba(232, 176, 75, .35);
  padding: 9px 12px; max-width: min(270px, 80vw);
  opacity: 0; pointer-events: none; transition: opacity .12s ease;
}
.mm-tip.show { opacity: 1; pointer-events: auto; }
.mm-tip-meta { font-family: var(--font-mono); font-size: 10px; letter-spacing: .12em; color: var(--ink-soft); }
.mm-tip-rec { display: block; margin-top: 5px; color: var(--ink); text-decoration: none; font-size: 13.5px; line-height: 1.35; }
.mm-tip-rec b { display: block; }
.mm-tip-rec:hover b { text-decoration: underline; text-decoration-color: var(--orange-deep); }
.mm-tip-rec .go { font-family: var(--font-mono); font-size: 10.5px; letter-spacing: .08em; color: var(--orange-deep); text-transform: uppercase; }
.mm-tip-flag { font-family: var(--font-mono); font-size: 10.5px; color: var(--warn); margin-top: 6px; }
@media (prefers-reduced-motion: reduce) { .mm-tip { transition: none; } }

/* Welcome wizard (first-run tour) */
.wizard-dots { display: flex; gap: 8px; justify-content: center; margin-top: 16px; }
.wizard-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--rule); }
.wizard-dot.active { background: var(--orange-deep); }
.wizard-body { min-height: 76px; margin-top: 0; }
