:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --text: #151922;
  --muted: #5d6677;
  --border: #e2e5eb;
  --accent: #0f766e;
  --accent-hover: #0b5f58;
  --accent-soft: #e7f4f2;
  --plate-blue: #1f4fbf;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08);
  --exact-bg: #dcfce7;  --exact-fg: #166534;
  --equiv-bg: #ccfbf1;  --equiv-fg: #115e59;
  --type-bg: #dbeafe;   --type-fg: #1e40af;
  --check-bg: #fef3c7;  --check-fg: #92400e;
  --cross-bg: #ede9fe;  --cross-fg: #5b21b6;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--text);
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); line-height: 1.5; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5rem; }
h1 { font-size: clamp(1.6rem, 4vw, 2.4rem); letter-spacing: -.02em; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.05rem; }
a { color: var(--accent); }
.wrap { max-width: 1080px; margin: 0 auto; padding: 0 16px; }
.muted { color: var(--muted); }
.short { display: none; }
main { padding-bottom: 64px; outline: none; }

.demo-banner { background: #fff7d6; color: #6b4e00; font-size: .85rem; text-align: center; padding: 6px 16px; }

.topbar { background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 10; }
.topbar-inner { display: flex; align-items: center; justify-content: space-between; height: 60px; gap: 12px; }
.logo { font-weight: 800; font-size: 1.2rem; color: var(--text); text-decoration: none; letter-spacing: -.02em; }
.logo span { color: var(--accent); font-weight: 600; }
.topnav { display: flex; align-items: center; gap: 12px; }
.navlink { color: var(--text); text-decoration: none; font-size: .95rem; }
.navlink:hover { color: var(--accent); }
.cart-btn { display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--border); background: var(--surface);
  border-radius: 999px; padding: 7px 14px; font: inherit; cursor: pointer; }
.cart-btn:hover { border-color: var(--accent); }
.count { background: var(--accent); color: #fff; border-radius: 999px; min-width: 22px; height: 22px; display: inline-grid;
  place-items: center; font-size: .8rem; font-weight: 700; padding: 0 6px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); font: inherit; font-weight: 600; padding: 10px 16px; cursor: pointer; text-decoration: none; }
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-hover); }
.btn:disabled { opacity: .6; cursor: default; }
.btn.block { width: 100%; }

/* Home */
.hero { padding: 48px 0 24px; max-width: 720px; }
.lead { color: var(--muted); font-size: 1.1rem; margin: 0 0 24px; }
.plate-form { display: flex; gap: 12px; flex-wrap: wrap; }
.plate { display: inline-flex; align-items: stretch; background: #fff; border: 2px solid #1b2230; border-radius: 8px; overflow: hidden; height: 60px; }
.plate-eu { background: var(--plate-blue); color: #fff; font-weight: 700; display: grid; place-items: center; width: 34px; font-size: .9rem; }
.plate input { border: 0; outline: none; font: 700 1.9rem/1 ui-monospace, "Cascadia Mono", Consolas, monospace; letter-spacing: .08em;
  width: calc(8.2ch + 24px); padding: 0 12px; text-transform: uppercase; color: #111; }
.plate:focus-within { box-shadow: 0 0 0 4px var(--accent-soft); border-color: var(--accent); }
.plate-form .btn { height: 60px; padding: 0 24px; font-size: 1.05rem; }
.demo-plates { margin-top: 16px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; font-size: .9rem; color: var(--muted); }
.chip { display: inline-block; border: 1px solid var(--border); background: var(--surface); border-radius: 999px; padding: 4px 12px;
  color: var(--text); text-decoration: none; font-size: .85rem; }
.chip:hover { border-color: var(--accent); color: var(--accent); }
.usp { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; margin-top: 40px; }
.usp div { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; }
.usp strong { display: block; margin-bottom: 4px; }
.usp p { margin: 0; color: var(--muted); font-size: .95rem; }
.form-error { color: #b42318; margin-top: 8px; }

/* Vehicle */
.vehicle { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px 18px; margin: 24px 0; box-shadow: var(--shadow); }
.plate.small { height: 36px; border-width: 1.5px; border-radius: 6px; }
.plate.small .plate-eu { width: 22px; font-size: .7rem; }
.plate-text { font: 700 1.1rem/36px ui-monospace, "Cascadia Mono", Consolas, monospace; letter-spacing: .06em; padding: 0 10px; }
.vehicle-name { font-weight: 700; font-size: 1.1rem; }
.vehicle-specs { color: var(--muted); font-size: .9rem; }
.vehicle .link { margin-left: auto; font-size: .9rem; }
.cat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.cat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; text-decoration: none;
  color: var(--text); display: flex; flex-direction: column; gap: 4px; transition: border-color .15s, transform .15s; }
.cat:hover { border-color: var(--accent); transform: translateY(-1px); }
.cat-name { font-weight: 700; }
.cat-meta { color: var(--muted); font-size: .88rem; }
.cat.empty { opacity: .55; }

/* Results */
.crumbs { font-size: .9rem; color: var(--muted); margin: 8px 0 4px; }
.crumbs a { color: var(--muted); }
.results-head { display: flex; justify-content: space-between; align-items: end; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; background: var(--surface); }
.seg button { border: 0; background: none; font: inherit; padding: 7px 12px; cursor: pointer; color: var(--muted); }
.seg button[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent); font-weight: 700; }
select { font: inherit; border: 1px solid var(--border); border-radius: 10px; padding: 7px 10px; background: var(--surface); }
.legend { display: flex; flex-wrap: wrap; gap: 8px 16px; font-size: .82rem; color: var(--muted); margin-bottom: 16px; }

.result { display: grid; grid-template-columns: 112px 1fr 210px; gap: 18px; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px; margin-bottom: 12px; box-shadow: var(--shadow); }
.thumb { background: repeating-linear-gradient(135deg, #eef0f4, #eef0f4 10px, #e6e9ef 10px, #e6e9ef 20px); border-radius: 10px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; color: var(--muted);
  font-size: .78rem; padding: 8px; min-height: 112px; }
.thumb span { font-weight: 700; color: #3c4453; }
.badges { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 6px; }
.badge { border-radius: 999px; font-size: .78rem; font-weight: 700; padding: 3px 10px; }
.badge.exact { background: var(--exact-bg); color: var(--exact-fg); }
.badge.equivalent { background: var(--equiv-bg); color: var(--equiv-fg); }
.badge.same_type { background: var(--type-bg); color: var(--type-fg); }
.badge.check { background: var(--check-bg); color: var(--check-fg); }
.badge.cross { background: var(--cross-bg); color: var(--cross-fg); }
.badge.plain { background: #eef0f4; color: #3c4453; }
.meta { margin: 2px 0; color: var(--muted); font-size: .9rem; }
.meta strong { color: var(--text); font-weight: 600; }
.quality { display: inline-block; border: 1px solid var(--border); border-radius: 6px; padding: 0 6px; font-weight: 700; color: var(--text);
  cursor: help; }
details.why { margin-top: 8px; }
details.why summary { cursor: pointer; color: var(--accent); font-weight: 600; font-size: .9rem; }
details.why ul { margin: 8px 0 0; padding-left: 20px; font-size: .9rem; }
details.why ul.cautions { color: var(--check-fg); }
.result-price { text-align: right; display: flex; flex-direction: column; gap: 2px; align-items: flex-end; }
.price { font-size: 1.35rem; font-weight: 800; }
.ship, .total-line { font-size: .88rem; color: var(--muted); }
.total-line strong { color: var(--text); font-size: 1rem; }
.result-price .btn { margin-top: 10px; width: 100%; }
.empty-state { background: var(--surface); border: 1px dashed var(--border); border-radius: var(--radius); padding: 32px; text-align: center; color: var(--muted); }

/* Part-number search */
.oe-form { display: flex; gap: 10px; flex-wrap: wrap; margin: 16px 0; }
.oe-form input { font: 600 1.15rem ui-monospace, "Cascadia Mono", Consolas, monospace; padding: 10px 14px; border: 1px solid var(--border);
  border-radius: 10px; min-width: 0; flex: 1 1 260px; max-width: 360px; text-transform: uppercase; }
.oe-form input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.parsed { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0; }
.parsed div { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 8px 12px; }
.parsed small { display: block; color: var(--muted); font-size: .75rem; }
.parsed b { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 1.05rem; }
.makes-line { font-size: 1.05rem; margin: 8px 0 16px; }

/* Cart drawer */
.scrim { position: fixed; inset: 0; background: rgba(15, 20, 30, .35); z-index: 20; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(420px, 100%); background: var(--surface); z-index: 30;
  transform: translateX(100%); transition: transform .2s ease; display: flex; flex-direction: column; box-shadow: -8px 0 24px rgba(0,0,0,.12); }
.drawer.open { transform: none; }
.drawer-head { display: flex; justify-content: space-between; align-items: center; padding: 16px 18px; border-bottom: 1px solid var(--border); }
.drawer-body { flex: 1; overflow-y: auto; padding: 8px 18px; }
.drawer-foot { border-top: 1px solid var(--border); padding: 16px 18px; }
.icon-btn { border: 0; background: none; font-size: 1.4rem; cursor: pointer; color: var(--muted); line-height: 1; padding: 4px 8px; }
.seller-group { padding: 12px 0; border-bottom: 1px solid var(--border); }
.seller-group h4 { margin: 0 0 6px; font-size: .9rem; }
.line-item { display: flex; justify-content: space-between; gap: 12px; font-size: .9rem; padding: 4px 0; }
.line-item button { border: 0; background: none; color: var(--muted); cursor: pointer; font-size: .8rem; text-decoration: underline; padding: 0; }
.sum { display: flex; justify-content: space-between; font-size: .92rem; padding: 2px 0; }
.sum.grand { font-size: 1.1rem; font-weight: 800; padding-top: 8px; }
.note { font-size: .8rem; color: var(--muted); }

/* Checkout */
.checkout { display: grid; grid-template-columns: 1fr 340px; gap: 24px; margin-top: 24px; align-items: start; }
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.panel h2 { margin-bottom: 12px; }
.choice { display: flex; gap: 10px; align-items: flex-start; border: 1px solid var(--border); border-radius: 10px; padding: 12px; margin-bottom: 8px; cursor: pointer; }
.choice:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.choice small { display: block; color: var(--muted); }
.done { text-align: center; padding: 64px 0; max-width: 560px; margin: 0 auto; }

@media (max-width: 760px) {
  .result { grid-template-columns: 72px 1fr; gap: 12px; }
  .thumb { min-height: 72px; font-size: .7rem; align-self: start; }
  .thumb small { display: none; }
  .result-price { grid-column: 1 / -1; flex-direction: row; flex-wrap: wrap; align-items: baseline; justify-content: space-between;
    text-align: left; border-top: 1px solid var(--border); padding-top: 10px; }
  .result-price .btn { width: 100%; margin-top: 6px; }
  .checkout { grid-template-columns: 1fr; }
  .long { display: none; }
  .short { display: inline; }
  .logo { font-size: 1.05rem; }
  .cart-btn { padding: 6px 10px; }
  .plate input { font-size: 1.6rem; }
}
