[hidden] { display: none !important; }
:root {
  --brand: #b3122e; --brand-dark: #8c0e24; --ink: #1d1f23; --muted: #626872; --line: #dfe2e7;
  --bg: #f5f6f8; --card: #ffffff; --ok: #1d7a3a; --warn: #a15c00; --bad: #b3122e; --chip: #eef0f3;
}
@media (prefers-color-scheme: dark) {
  :root { --ink: #eceef1; --muted: #a2a8b2; --line: #343841; --bg: #15171b; --card: #1f2227; --chip: #2a2e35; --ok: #5cc27f; --warn: #e4a340; --bad: #ff6b81; }
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
body { padding-bottom: env(safe-area-inset-bottom); }
main { max-width: 680px; margin: 0 auto; padding: 12px 16px 40px; }
h1 { font-size: 1.45rem; margin: 6px 0 10px; }
h2 { font-size: 1.1rem; margin: 22px 0 8px; }
.topbar { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 8px; padding: 10px 12px; padding-top: max(10px, env(safe-area-inset-top)); background: var(--brand); color: #fff; }
.brand { display: flex; align-items: center; gap: 8px; font-size: 1.05rem; flex: 1; }
.brand img { width: 30px; height: 30px; border-radius: 7px; background: #fff; }
.back { background: none; border: 0; color: #fff; font-size: 2rem; line-height: 1; padding: 0 6px; }
.install { background: #fff; color: var(--brand); border: 0; border-radius: 999px; padding: 6px 12px; font-weight: 600; }
.steps { position: sticky; top: 50px; z-index: 4; display: grid; grid-template-columns: repeat(4, 1fr); background: var(--card); border-bottom: 1px solid var(--line); }
.steps button { background: none; border: 0; border-bottom: 3px solid transparent; padding: 10px 2px; color: var(--muted); font-size: .9rem; }
.steps button.on { color: var(--brand); border-bottom-color: var(--brand); font-weight: 700; }
.steps button.done { color: var(--ink); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 48px; padding: 10px 16px; border-radius: 12px; border: 1px solid var(--line); background: var(--card); color: var(--ink); font: inherit; font-weight: 600; cursor: pointer; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:active { background: var(--brand-dark); }
.btn.ghost { background: transparent; }
.btn.big { width: 100%; min-height: 60px; font-size: 1.15rem; }
.btn:disabled { opacity: .45; }
.row { display: flex; gap: 10px; margin: 12px 0; }
.row.wrap { flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; margin-bottom: 14px; }
.muted { color: var(--muted); }
.small { font-size: .88rem; }
.tip { color: var(--muted); margin: 6px 0 10px; }
.seg { display: grid; grid-template-columns: repeat(3, 1fr); background: var(--chip); border-radius: 12px; padding: 4px; gap: 4px; }
.seg button { border: 0; background: transparent; padding: 10px 4px; border-radius: 9px; font: inherit; color: var(--ink); }
.seg button.on { background: var(--card); font-weight: 700; box-shadow: 0 1px 3px rgba(0,0,0,.15); }
.camwrap { position: relative; width: 100%; aspect-ratio: 4 / 3; background: #000; border-radius: 14px; overflow: hidden; margin-top: 10px; }
.camwrap video { width: 100%; height: 100%; object-fit: cover; display: block; }
.guide { position: absolute; left: 7%; right: 7%; top: 39%; height: 22%; border: 3px solid #ffd54a; border-radius: 10px; box-shadow: 0 0 0 999px rgba(0,0,0,.35); display: flex; align-items: flex-end; justify-content: center; }
.guide span { background: rgba(0,0,0,.6); color: #fff; font-size: .8rem; padding: 2px 8px; border-radius: 6px; transform: translateY(130%); }
.guide.door { top: 22%; height: 52%; left: 10%; right: 10%; }
.camstatus { position: absolute; left: 0; right: 0; top: 8px; text-align: center; color: #fff; font-size: .85rem; text-shadow: 0 1px 2px #000; }
.cropwrap canvas { width: 100%; border-radius: 12px; background: #000; touch-action: none; display: block; }
.status { min-height: 1.4em; margin: 10px 0 6px; font-weight: 600; }
.status.busy::before { content: ""; display: inline-block; width: 14px; height: 14px; margin-right: 8px; border: 2px solid var(--muted); border-top-color: transparent; border-radius: 50%; animation: spin .8s linear infinite; vertical-align: -2px; }
@keyframes spin { to { transform: rotate(360deg); } }
.candidates { display: grid; gap: 8px; }
.cand { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--card); font: inherit; color: var(--ink); text-align: left; }
.cand code { font-size: 1.05rem; letter-spacing: .06em; }
.cand code mark { background: #ffe08a; color: #000; border-radius: 3px; }
.cand .tag { font-size: .78rem; color: var(--muted); }
.field { display: flex; flex-direction: column; gap: 4px; font-size: .9rem; color: var(--muted); margin: 10px 0; }
.field input, .field select, .field textarea { font: inherit; color: var(--ink); background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 12px; min-height: 48px; }
#vinInput { font-size: 1.2rem; letter-spacing: .08em; text-transform: uppercase; font-family: ui-monospace, Menlo, Consolas, monospace; }
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.grid .full { grid-column: 1 / -1; }
.msg { min-height: 1.2em; margin: 4px 0; font-size: .92rem; }
.msg.ok { color: var(--ok); } .msg.bad { color: var(--bad); } .msg.warn { color: var(--warn); }
.decoded { display: grid; grid-template-columns: auto 1fr; gap: 2px 12px; font-size: .93rem; }
.decoded dt { color: var(--muted); } .decoded dd { margin: 0; }
.slots { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.slot { cursor: pointer; position: relative; aspect-ratio: 4 / 3; border: 2px dashed var(--line); border-radius: 12px; background: var(--card); overflow: hidden; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 6px; font: inherit; color: var(--ink); }
.slot .lbl { font-weight: 600; font-size: .9rem; }
.slot .hint { font-size: .75rem; color: var(--muted); }
.slot.filled { border-style: solid; padding: 0; }
.slot img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.slot .cap { position: absolute; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,.55); color: #fff; font-size: .78rem; padding: 3px 6px; display: flex; justify-content: space-between; align-items: center; }
.slot .cap button { background: rgba(255,255,255,.18); color: #fff; border: 0; border-radius: 6px; font-size: .75rem; padding: 3px 7px; }
.slot .cover { position: absolute; top: 6px; left: 6px; background: var(--brand); color: #fff; font-size: .7rem; padding: 2px 6px; border-radius: 6px; }
.listings { display: grid; gap: 10px; }
.litem { display: grid; grid-template-columns: 96px 1fr; gap: 12px; align-items: center; background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 8px; text-align: left; font: inherit; color: var(--ink); width: 100%; }
.litem img, .litem .noimg { width: 96px; height: 72px; object-fit: cover; border-radius: 9px; background: var(--chip); }
.litem .t { font-weight: 700; }
.listing-card { background: var(--card); border: 1px solid var(--line); border-radius: 16px; overflow: hidden; }
.listing-card .hero { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; display: block; background: var(--chip); }
.listing-card .thumbs { display: flex; gap: 6px; overflow-x: auto; padding: 8px; }
.listing-card .thumbs img { width: 72px; height: 54px; object-fit: cover; border-radius: 6px; flex: none; }
.listing-card .body { padding: 12px 14px 16px; }
.listing-card .title { font-size: 1.25rem; font-weight: 800; margin: 0; }
.listing-card .price { font-size: 1.4rem; font-weight: 800; color: var(--brand); margin: 2px 0 6px; }
.listing-card .facts { display: grid; grid-template-columns: auto 1fr; gap: 2px 12px; font-size: .93rem; margin: 8px 0; }
.listing-card .facts dt { color: var(--muted); } .listing-card .facts dd { margin: 0; }
.listing-card .edit { float: right; font-size: .85rem; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: #222; color: #fff; padding: 10px 16px; border-radius: 999px; z-index: 10; max-width: 90vw; text-align: center; }
@media (max-width: 380px) { .grid { grid-template-columns: 1fr; } }
