:root {
  --bg: #f4f5f7; --surface: #ffffff; --surface-2: #f0f2f5; --ink: #0d1b2a; --ink-2: #4a5566; --ink-3: #7b8594;
  --line: #e2e6ec; --brand: #ff6b2c; --brand-ink: #ffffff; --brand-soft: #fff0e8; --navy: #0d1b2a;
  --buy: #0f9d58; --buy-soft: #e6f6ee; --warn: #b45309; --warn-soft: #fff7e6; --danger: #c62828;
  --chart-dot: #8a94a6; --chart-line: #0d1b2a; --radius: 16px; --shadow: 0 1px 2px rgba(13,27,42,.06), 0 4px 16px rgba(13,27,42,.06);
  --font: 'Manrope', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif; --mono: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b1320; --surface: #121c2b; --surface-2: #1a2637; --ink: #eef2f7; --ink-2: #b4bfcd; --ink-3: #8794a6;
    --line: #243246; --brand-soft: #3a1f12; --buy: #34c47c; --buy-soft: #0f2c1f; --warn: #f2b45a; --warn-soft: #33260f;
    --chart-dot: #6f7d92; --chart-line: #eef2f7; --shadow: none; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0b1320; --surface: #121c2b; --surface-2: #1a2637; --ink: #eef2f7; --ink-2: #b4bfcd; --ink-3: #8794a6;
  --line: #243246; --brand-soft: #3a1f12; --buy: #34c47c; --buy-soft: #0f2c1f; --warn: #f2b45a; --warn-soft: #33260f;
  --chart-dot: #6f7d92; --chart-line: #eef2f7; --shadow: none; color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font); -webkit-text-size-adjust: 100%; }
body { min-height: 100dvh; font-size: 16px; line-height: 1.45; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; }
.wrap { max-width: 640px; margin: 0 auto; padding: 0 16px 120px; }
.topbar { position: sticky; top: 0; z-index: 20; background: var(--navy); color: #fff; padding: calc(env(safe-area-inset-top) + 10px) 16px 10px; }
.topbar-in { max-width: 640px; margin: 0 auto; display: flex; align-items: center; gap: 12px; }
.brand { display: flex; align-items: center; gap: 9px; font-weight: 800; font-size: 19px; letter-spacing: -.02em; text-decoration: none; color: #fff; }
.brand svg { width: 28px; height: 28px; flex: none; }
.topbar .sp { flex: 1; }
.topbar .dealer { font-size: 13px; opacity: .8; max-width: 40vw; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.icon-btn { background: transparent; border: 0; color: inherit; width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; cursor: pointer; }
.icon-btn:hover { background: rgba(255,255,255,.1); }
.icon-btn svg { width: 22px; height: 22px; }
.pill-preview { font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; background: rgba(255,255,255,.14); padding: 3px 8px; border-radius: 99px; }

h1 { font-size: 28px; line-height: 1.15; letter-spacing: -.02em; margin: 24px 0 8px; }
h2 { font-size: 18px; margin: 0 0 12px; letter-spacing: -.01em; }
h3 { font-size: 15px; margin: 0 0 8px; }
.muted { color: var(--ink-2); }
.small { font-size: 13px; }
.tiny { font-size: 12px; color: var(--ink-3); }
.mono { font-family: var(--mono); letter-spacing: .02em; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin: 14px 0; box-shadow: var(--shadow); }
.card.flat { box-shadow: none; }
.row { display: flex; gap: 10px; align-items: center; }
.row.wrap-ok { flex-wrap: wrap; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
@media (max-width: 380px) { .grid3 { grid-template-columns: 1fr 1fr; } }

label.f { display: block; font-size: 13px; font-weight: 700; color: var(--ink-2); margin: 0 0 6px; }
.field { margin-bottom: 12px; }
input.in, select.in, textarea.in { width: 100%; background: var(--surface); border: 1.5px solid var(--line); border-radius: 12px; padding: 12px 14px; font-size: 16px; outline: none; min-height: 48px; }
input.in:focus, select.in:focus, textarea.in:focus { border-color: var(--brand); }
.in.vin { font-family: var(--mono); text-transform: uppercase; letter-spacing: .06em; }
.prefix { position: relative; }
.prefix > span { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--ink-3); font-size: 15px; pointer-events: none; }
.prefix > input { padding-left: 26px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 0; border-radius: 12px; padding: 12px 18px; min-height: 48px; font-weight: 800; font-size: 16px; cursor: pointer; text-decoration: none; background: var(--surface-2); color: var(--ink); white-space: nowrap; flex-shrink: 0; }
.btn svg { width: 20px; height: 20px; }
.btn.primary { background: var(--brand); color: var(--brand-ink); }
.btn.dark { background: var(--navy); color: #fff; }
.btn.ghost { background: transparent; border: 1.5px solid var(--line); }
.btn.block { width: 100%; }
.btn.big { min-height: 60px; font-size: 18px; border-radius: 14px; }
.btn:disabled { opacity: .55; cursor: default; }
.link { background: none; border: 0; padding: 0; color: var(--brand); font-weight: 700; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }

.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { border: 1.5px solid var(--line); background: var(--surface); border-radius: 99px; padding: 8px 14px; font-weight: 700; font-size: 14px; cursor: pointer; min-height: 40px; }
.chip.on { background: var(--navy); color: #fff; border-color: var(--navy); }
:root[data-theme="dark"] .chip.on { background: var(--ink); color: var(--bg); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .chip.on { background: var(--ink); color: var(--bg); border-color: var(--ink); } }

.tabs { display: flex; background: var(--surface-2); border-radius: 12px; padding: 4px; margin-bottom: 16px; }
.tabs button { flex: 1; border: 0; background: transparent; padding: 10px; border-radius: 9px; font-weight: 800; cursor: pointer; color: var(--ink-2); }
.tabs button.on { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }

.banner { border-radius: 12px; padding: 10px 14px; font-size: 14px; font-weight: 600; margin: 12px 0; display: flex; gap: 10px; align-items: flex-start; }
.banner.sample { background: var(--warn-soft); color: var(--warn); border: 1px dashed var(--warn); }
.banner.err { background: #fdecec; color: var(--danger); }
.banner.ok { background: var(--buy-soft); color: var(--buy); }

.meter { height: 8px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.meter > i { display: block; height: 100%; background: var(--brand); }

.hero-auth { padding: 8px 0 4px; }
.hero-auth h1 { font-size: 32px; margin-top: 28px; }
.ticks { list-style: none; padding: 0; margin: 14px 0 6px; }
.ticks li { padding-left: 28px; position: relative; margin: 8px 0; font-weight: 600; }
.ticks li::before { content: ''; position: absolute; left: 0; top: 3px; width: 18px; height: 18px; border-radius: 50%; background: var(--buy-soft); box-shadow: inset 0 0 0 2px var(--buy); }
.ticks li::after { content: ''; position: absolute; left: 6px; top: 7px; width: 6px; height: 9px; border: solid var(--buy); border-width: 0 2.5px 2.5px 0; transform: rotate(45deg); }

.vin-start { display: flex; gap: 8px; }
.vin-start input { flex: 1; }

.list { list-style: none; margin: 0; padding: 0; }
.list li { border-top: 1px solid var(--line); }
.list li:first-child { border-top: 0; }
.list a, .list .li { display: flex; align-items: center; gap: 12px; padding: 12px 0; text-decoration: none; }
.list .t { font-weight: 800; }
.list .s { font-size: 13px; color: var(--ink-2); }
.list .r { margin-left: auto; text-align: right; }
.status { font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; padding: 2px 8px; border-radius: 99px; background: var(--surface-2); color: var(--ink-2); }
.status.bought { background: var(--buy-soft); color: var(--buy); }
.status.passed { background: var(--surface-2); color: var(--ink-3); }

.veh-title { font-size: 22px; font-weight: 800; letter-spacing: -.01em; line-height: 1.2; }
.veh-sub { color: var(--ink-2); font-size: 14px; margin-top: 2px; }

.price-hero { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.ptile { border-radius: 14px; padding: 14px; background: var(--surface-2); }
.ptile .k { font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-2); }
.ptile .v { font-size: 30px; font-weight: 800; letter-spacing: -.02em; line-height: 1.1; margin: 4px 0 2px; font-variant-numeric: tabular-nums; }
.ptile .rng { font-size: 12px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.ptile.buy { background: var(--buy-soft); }
.ptile.buy .v { color: var(--buy); }
.ptile.retail { background: var(--brand-soft); }
@media (max-width: 360px) { .ptile .v { font-size: 25px; } }
.conf { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 700; color: var(--ink-2); margin-top: 10px; }
.conf i { width: 8px; height: 8px; border-radius: 50%; background: var(--buy); display: inline-block; }
.conf.medium i { background: #e0a100; } .conf.low i, .conf.none i { background: var(--danger); }

.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; background: var(--line); border-radius: 12px; overflow: hidden; border: 1px solid var(--line); }
.stats > div { background: var(--surface); padding: 10px 12px; }
.stats .k { font-size: 11px; font-weight: 700; color: var(--ink-3); text-transform: uppercase; letter-spacing: .04em; }
.stats .v { font-size: 17px; font-weight: 800; font-variant-numeric: tabular-nums; }
@media (max-width: 380px) { .stats { grid-template-columns: 1fr 1fr; } }

.chart { width: 100%; height: auto; display: block; }
.chart text { font-family: var(--font); font-size: 12px; fill: var(--ink-3); }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--ink-2); margin-top: 6px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 5px; vertical-align: -1px; }

.comp { display: grid; grid-template-columns: 28px 1fr auto; gap: 10px; padding: 12px 0; border-top: 1px solid var(--line); align-items: start; }
.comp:first-child { border-top: 0; }
.comp.off { opacity: .45; }
.comp input[type=checkbox] { width: 22px; height: 22px; accent-color: var(--brand); margin-top: 2px; }
.comp .p { font-weight: 800; font-size: 18px; font-variant-numeric: tabular-nums; text-align: right; }
.comp .adj { font-size: 12px; color: var(--ink-3); text-align: right; font-variant-numeric: tabular-nums; }
.comp .t { font-weight: 700; }
.comp .m { font-size: 13px; color: var(--ink-2); }
.comp .d { font-size: 12px; color: var(--ink-3); margin-top: 2px; overflow-wrap: anywhere; }
.tag { display: inline-block; font-size: 11px; font-weight: 800; padding: 1px 7px; border-radius: 99px; background: var(--surface-2); color: var(--ink-2); margin-left: 4px; vertical-align: 1px; }
.tag.ind { background: var(--buy-soft); color: var(--buy); }
.tag.out { background: #fdecec; color: var(--danger); }
.tag.dom-long { background: var(--warn-soft); color: var(--warn); }

.sticky-actions { position: fixed; left: 0; right: 0; bottom: 0; z-index: 15; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(10px); border-top: 1px solid var(--line); padding: 10px 16px calc(env(safe-area-inset-bottom) + 10px); }
.sticky-actions .in-wrap { max-width: 640px; margin: 0 auto; display: flex; gap: 8px; }
.sticky-actions .btn { flex: 1; }

.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 15; background: var(--surface); border-top: 1px solid var(--line); padding: 6px 8px calc(env(safe-area-inset-bottom) + 6px); }
.tabbar .in-wrap { max-width: 640px; margin: 0 auto; display: grid; grid-template-columns: repeat(5, 1fr); }
.tabbar a { display: flex; flex-direction: column; align-items: center; gap: 2px; text-decoration: none; font-size: 11px; font-weight: 700; color: var(--ink-3); padding: 6px 0; border-radius: 10px; position: relative; }
.tabbar a svg { width: 22px; height: 22px; }
.tabbar a.on { color: var(--brand); }
.tabbar .dot { position: absolute; top: 3px; right: calc(50% - 16px); min-width: 16px; height: 16px; border-radius: 8px; background: var(--brand); color: #fff; font-size: 10px; line-height: 16px; text-align: center; padding: 0 4px; }
.verdict { font-size: 11px; font-weight: 800; padding: 2px 8px; border-radius: 99px; text-transform: uppercase; letter-spacing: .03em; white-space: nowrap; }
.verdict.over { background: #fdecec; color: var(--danger); }
.verdict.under { background: var(--buy-soft); color: var(--buy); }
.verdict.at { background: var(--surface-2); color: var(--ink-2); }
.plan { border: 2px solid var(--line); border-radius: var(--radius); padding: 16px; margin: 12px 0; background: var(--surface); }
.plan.cur { border-color: var(--brand); }
.plan .pp { font-size: 30px; font-weight: 800; letter-spacing: -.02em; }
.plan ul { padding-left: 18px; margin: 8px 0 12px; }
.plan li { margin: 4px 0; }
.scan { position: fixed; inset: 0; z-index: 50; background: #000; display: flex; flex-direction: column; }
.scan video { flex: 1; width: 100%; object-fit: cover; }
.scan .guide { position: absolute; left: 6%; right: 6%; top: 38%; height: 18%; border: 3px solid var(--brand); border-radius: 14px; box-shadow: 0 0 0 9999px rgba(0,0,0,.45); }
.scan .scan-bar { position: absolute; left: 0; right: 0; bottom: 0; padding: 16px 16px calc(env(safe-area-inset-bottom) + 16px); color: #fff; text-align: center; background: linear-gradient(transparent, rgba(0,0,0,.8)); }
.scan .scan-top { position: absolute; top: 0; left: 0; right: 0; padding: calc(env(safe-area-inset-top) + 16px) 16px 16px; color: #fff; text-align: center; font-weight: 700; background: linear-gradient(rgba(0,0,0,.7), transparent); }

.spin { width: 20px; height: 20px; border: 3px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: sp .8s linear infinite; display: inline-block; }
@keyframes sp { to { transform: rotate(360deg); } }
.skeleton { height: 14px; border-radius: 6px; background: linear-gradient(90deg, var(--surface-2), var(--line), var(--surface-2)); background-size: 200% 100%; animation: sk 1.2s infinite; margin: 8px 0; }
@keyframes sk { to { background-position: -200% 0; } }

.toast { position: fixed; left: 50%; bottom: calc(env(safe-area-inset-bottom) + 90px); transform: translateX(-50%); background: var(--navy); color: #fff; padding: 12px 18px; border-radius: 12px; font-weight: 700; z-index: 60; box-shadow: 0 8px 24px rgba(0,0,0,.25); max-width: calc(100% - 32px); }

/* Customer sheet */
.sheet { background: #fff; color: #0d1b2a; border-radius: var(--radius); border: 1px solid var(--line); padding: 22px 18px; margin: 14px 0; }
.sheet .sh-top { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; border-bottom: 2px solid #0d1b2a; padding-bottom: 12px; }
.sheet .sh-dealer { font-weight: 800; font-size: 18px; }
.sheet .sh-date { font-size: 12px; color: #4a5566; text-align: right; }
.sheet h2 { font-size: 22px; margin: 16px 0 2px; }
.sheet .sh-big { display: flex; gap: 12px; margin: 14px 0; flex-wrap: wrap; }
.sheet .sh-big > div { flex: 1 1 160px; border-radius: 12px; padding: 12px 14px; background: #f4f5f7; }
.sheet .sh-big .k { font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; color: #4a5566; }
.sheet .sh-big .v { font-size: 30px; font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.sheet .sh-big .offer { background: #e6f6ee; } .sheet .sh-big .offer .v { color: #0b7a44; }
.sheet table { width: 100%; border-collapse: collapse; font-size: 13px; font-variant-numeric: tabular-nums; }
.sheet th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: #4a5566; border-bottom: 1px solid #d5dae2; padding: 6px 4px; }
.sheet td { border-bottom: 1px solid #eef0f3; padding: 7px 4px; }
.sheet td.n, .sheet th.n { text-align: right; }
.sheet .why { font-size: 15px; margin: 10px 0; }
.sheet .brk { width: 100%; font-size: 15px; margin: 8px 0 4px; }
.sheet .brk td { border: 0; padding: 4px 0; }
.sheet .brk td:last-child { white-space: nowrap; text-align: right; padding-left: 12px; font-variant-numeric: tabular-nums; }
.in.vin::placeholder { text-transform: none; letter-spacing: 0; font-family: var(--font); }
.sheet .brk tr.tot td { border-top: 2px solid #0d1b2a; font-weight: 800; padding-top: 8px; }
.sheet .foot { font-size: 11px; color: #7b8594; margin-top: 14px; }
.sheet .chart text { fill: #7b8594; }
.sheet .banner.sample { background: #fff7e6; color: #b45309; border-color: #b45309; }
.table-scroll { overflow-x: auto; }

@media print {
  .topbar, .sticky-actions, .no-print { display: none !important; }
  body, html { background: #fff; }
  .wrap { padding: 0; max-width: none; }
  .sheet { border: 0; padding: 0; margin: 0; }
}
