/* ===== Tokens ===== */
:root {
  --bg: #0D0E10;
  --surface: #15161A;
  --surface-raised: #1D1F24;
  --surface-hover: #24262D;
  --border: #2A2C32;
  --border-soft: #202227;
  --ink: #ECEDEF;
  --ink-muted: #8A8D96;
  --ink-faint: #5A5D66;
  --ignition: #4DA8FF;
  --ignition-soft: rgba(77, 168, 255, 0.14);
  --verified: #4FD1C5;
  --verified-soft: rgba(79, 209, 197, 0.14);
  --danger: #E5484D;

  --radius-lg: 18px;
  --radius: 12px;
  --radius-sm: 8px;

  --font-display: "Space Grotesk", "Inter", sans-serif;
  --font-body: "Inter", -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, monospace;

  --shadow-card: 0 12px 32px rgba(0, 0, 0, 0.45);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
  height: 100%;
  overflow: hidden;
}

body { height: 100vh; height: 100dvh; }

.page {
  height: 100%;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(ellipse 70% 45% at 50% -8%, rgba(77, 168, 255, 0.10), transparent 60%),
    radial-gradient(ellipse 50% 35% at 100% 100%, rgba(79, 209, 197, 0.05), transparent 60%),
    var(--bg);
}

.page-content {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
}

/* Use this instead of the `hidden` attribute on any element whose own CSS
   sets `display` (flex/grid/etc.) — author rules beat the browser's default
   [hidden]{display:none}, so `el.hidden = true` alone silently fails on
   those elements. This class wins because it's more specific + !important. */
.is-hidden { display: none !important; }

a { color: inherit; }

button {
  font-family: var(--font-body);
  cursor: pointer;
}

:focus-visible {
  outline: 2px solid var(--ignition);
  outline-offset: 2px;
}

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 8px;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
}

/* ===== Buttons ===== */
.btn {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 14px;
  border-radius: var(--radius-sm);
  padding: 10px 18px;
  border: 1px solid transparent;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}
.btn:active { transform: translateY(1px); }

.btn-primary {
  background: linear-gradient(135deg, #8FCCFF 0%, #4DA8FF 45%, #2569B8 100%);
  color: #06182B;
  border-color: rgba(255, 255, 255, 0.25);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.3) inset, 0 4px 16px rgba(77, 168, 255, 0.25);
}
.btn-primary:hover {
  background: linear-gradient(135deg, #A3D6FF 0%, #5FB4FF 45%, #2B72C4 100%);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.35) inset, 0 6px 22px rgba(77, 168, 255, 0.4);
  transform: translateY(-1px);
}
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.btn-ghost {
  background: transparent;
  color: var(--ink);
  border-color: var(--border);
}
.btn-ghost:hover { background: var(--surface-raised); }

.btn-text {
  background: transparent;
  color: var(--ink-muted);
  border: none;
  padding: 8px 10px;
  font-weight: 500;
}
.btn-text:hover { color: var(--ink); }

.btn-block { width: 100%; }

/* ===== Top nav ===== */
.topnav {
  height: 60px;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  border-bottom: 1px solid var(--border-soft);
  background: rgba(13, 14, 16, 0.85);
  backdrop-filter: blur(10px);
  z-index: 40;
  position: relative;
}
.topnav::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: -1px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(77, 168, 255, 0.5), transparent);
}

.brand {
  display: flex;
  align-items: baseline;
  gap: 6px;
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 500;
  letter-spacing: -0.005em;
  text-decoration: none;
}
.brand .dot { color: var(--ignition); }
.brand-sub {
  font-size: 11px;
  color: var(--ink-faint);
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.nav-right { display: flex; align-items: center; gap: 10px; }
.nav-dealer-link {
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-faint);
  text-decoration: none;
  margin-right: 10px;
  border-right: 1px solid var(--border);
  padding-right: 14px;
}
.nav-dealer-link:hover { color: var(--ink-muted); }

/* ===== Footer (Vicimus attribution) ===== */
.site-footer {
  flex: 0 0 auto;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-top: 1px solid var(--border-soft);
  background: var(--bg);
}
.footer-logo-link {
  display: inline-flex;
  align-items: center;
  opacity: 0.5;
  transition: opacity 0.15s ease;
}
.footer-logo-link:hover { opacity: 0.85; }
.footer-logo { height: 13px; width: auto; display: block; }
@media (max-width: 880px) {
  .site-footer { height: 28px; }
  .footer-logo { height: 10px; }
}

/* ===== View stage: gate and chat live in the same box, crossfading.
   Using a class instead of the `hidden` attribute here is deliberate —
   .view-gate/.view-app both set their own `display`, which is an author
   rule and beats the browser's default [hidden]{display:none}, so
   `hidden` alone silently fails to hide them. Visibility is controlled
   entirely through .is-active instead. ===== */
.view-stage {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}

.view {
  position: absolute;
  inset: 0;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.35s ease;
}
.view.is-active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

/* ===== Intro gate (location capture) ===== */
.view-gate {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.gate-card {
  max-width: 460px;
  width: 100%;
  text-align: center;
}
.gate-eyebrow {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  margin-bottom: 16px;
  background: linear-gradient(90deg, #4DA8FF, #9FE0FF);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.gate-title {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 34px;
  line-height: 1.2;
  margin: 0 0 14px;
  letter-spacing: -0.015em;
}
.gate-sub {
  color: var(--ink-muted);
  font-weight: 300;
  font-size: 15.5px;
  margin: 0 0 28px;
  line-height: 1.6;
}
.gate-form { display: flex; gap: 10px; }
.gate-form input {
  flex: 1;
}
.gate-blocked {
  color: var(--ink-muted);
  font-size: 15px;
  line-height: 1.6;
}

/* ===== Inputs ===== */
input[type="text"], input[type="email"], input[type="password"] {
  background: var(--surface-raised);
  border: 1px solid var(--border);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 14px;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  width: 100%;
}
input::placeholder { color: var(--ink-faint); }

.field { margin-bottom: 14px; text-align: left; }
.field label {
  display: block;
  font-size: 12px;
  color: var(--ink-muted);
  margin-bottom: 6px;
  font-weight: 500;
}

/* ===== App shell (chat + build panel) ===== */
.view-app {
  display: grid;
  grid-template-columns: 1fr 420px;
}

.chat-pane {
  display: flex;
  flex-direction: column;
  min-height: 0;
  border-right: 1px solid var(--border-soft);
  min-width: 0;
}

.chat-thread {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 24px 24px 12px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}


.msg {
  max-width: 72%;
  padding: 13px 16px;
  border-radius: var(--radius);
  font-size: 15px;
  line-height: 1.55;
}
.msg-assistant {
  align-self: flex-start;
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-bottom-left-radius: 4px;
}
.msg-user {
  align-self: flex-end;
  background: var(--ignition-soft);
  border: 1px solid rgba(77, 168, 255, 0.3);
  color: var(--ink);
  border-bottom-right-radius: 4px;
}
.msg-system {
  align-self: center;
  color: var(--ink-faint);
  font-family: var(--font-mono);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Richer assistant bubbles (choice prompts, inline auth, confirmations) need
   more room than a normal chat line. */
.msg-rich { max-width: 92%; }

.choice-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}
.choice-pill {
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 600;
  padding: 9px 16px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-raised);
  color: var(--ink);
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, opacity 0.15s ease;
}
.choice-pill:hover:not(:disabled) { border-color: var(--ignition); }
.choice-pill:disabled { cursor: default; opacity: 0.45; }
.choice-pill.chosen {
  border-color: var(--ignition);
  background: var(--ignition-soft);
  opacity: 1;
}

.msg-auth-card .auth-card-intro { margin-bottom: 12px; line-height: 1.5; }
.msg-auth-card form { margin-top: 4px; }
.msg-auth-card input { margin-bottom: 8px; }
.msg-auth-card .modal-tabs { margin-bottom: 12px; max-width: 260px; }

.next-steps-note {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border-soft);
  font-size: 13px;
  color: var(--ink-muted);
  line-height: 1.7;
}
.next-steps-note ul { margin: 6px 0 0; padding-left: 18px; }
.next-steps-note li { margin-bottom: 4px; }

.notify-card {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border-soft);
}
.notify-card-row { display: flex; gap: 8px; margin-top: 8px; }
.notify-card-row input { flex: 1; }
.notify-card-confirmed {
  color: var(--verified);
  font-size: 13px;
  font-weight: 600;
  margin-top: 10px;
}

.typing-dots {
  align-self: flex-start;
  display: flex;
  gap: 4px;
  padding: 13px 16px;
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
}
.typing-dots span {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--ink-faint);
  animation: bounce 1.2s infinite ease-in-out;
}
.typing-dots span:nth-child(2) { animation-delay: 0.15s; }
.typing-dots span:nth-child(3) { animation-delay: 0.3s; }
@keyframes bounce {
  0%, 80%, 100% { transform: translateY(0); opacity: 0.5; }
  40% { transform: translateY(-4px); opacity: 1; }
}

.chat-cta-bar {
  display: none;
  padding: 12px 24px;
  border-top: 1px solid var(--border-soft);
  background: linear-gradient(180deg, rgba(77, 168, 255, 0.07), transparent);
}
.chat-cta-bar.is-visible { display: flex; }
.chat-cta-bar .btn { width: 100%; }

.chat-input-bar {
  border-top: 1px solid var(--border-soft);
  padding: 16px 24px 22px;
  display: flex;
  gap: 10px;
  align-items: flex-end;
}
.chat-input-bar input { flex: 1; }

/* ===== Build panel ===== */
.build-panel {
  background: var(--surface);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  min-height: 0;
  padding: 22px;
}

.build-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 14px;
}
.build-header h2 {
  font-family: var(--font-display);
  font-size: 16px;
  margin: 0;
  font-weight: 600;
}

.build-rail {
  display: flex;
  gap: 6px;
  margin-bottom: 18px;
}
.rail-step {
  flex: 1;
  height: 3px;
  border-radius: 2px;
  background: var(--border);
  transition: background 0.4s ease;
}
.rail-step.done { background: var(--ignition); }

.build-stage {
  position: relative;
  aspect-ratio: 16 / 9;
  border-radius: var(--radius-lg);
  background: var(--surface-raised);
  border: 1px solid var(--border);
  overflow: hidden;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.build-stage img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.build-stage .placeholder {
  color: var(--ink-faint);
  font-family: var(--font-mono);
  font-size: 12px;
  text-align: center;
  padding: 0 30px;
  line-height: 1.6;
}
.build-stage .scan-line {
  position: absolute;
  left: 0; right: 0; top: 0;
  height: 3px;
  background: linear-gradient(90deg, transparent, var(--ignition), transparent);
  box-shadow: 0 0 18px var(--ignition);
  animation: scan 0.9s ease-out forwards;
}
@keyframes scan {
  0% { top: 0; opacity: 1; }
  100% { top: 100%; opacity: 0; }
}
.build-stage.loading::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(100deg, transparent 30%, rgba(255,255,255,0.06) 50%, transparent 70%);
  background-size: 200% 100%;
  animation: shimmer 1.6s infinite;
}
@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.build-thumbs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 14px;
  margin-bottom: 14px;
}
.build-thumbs img {
  width: 64px; height: 44px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  cursor: pointer;
  flex-shrink: 0;
  opacity: 0.75;
  transition: opacity 0.15s ease, border-color 0.15s ease;
}
.build-thumbs img:hover, .build-thumbs img.active {
  opacity: 1;
  border-color: var(--ignition);
}

/* ===== Vehicle options: the actual selectable inventory list ===== */
.options-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 16px;
}
.option-card {
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  text-align: left;
  padding: 0;
  font-family: var(--font-body);
  color: var(--ink);
  transition: border-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}
.option-card:hover {
  border-color: var(--ignition);
  transform: translateY(-2px);
  box-shadow: 0 10px 24px rgba(77, 168, 255, 0.18);
}
.option-card img {
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  display: block;
  background: var(--surface);
}
.option-card-imgless {
  width: 100%;
  aspect-ratio: 16 / 10;
  background: var(--surface);
}
.option-card-body { padding: 8px 10px 10px; }
.option-card-title {
  font-size: 12.5px;
  font-weight: 600;
  margin-bottom: 3px;
  line-height: 1.3;
}
.option-card-meta {
  font-size: 10.5px;
  color: var(--ink-muted);
  font-family: var(--font-mono);
  margin-bottom: 4px;
}
.option-card-price {
  font-size: 13px;
  font-weight: 700;
  background: linear-gradient(90deg, #4DA8FF, #9FE0FF);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.option-selected-card {
  display: flex;
  gap: 12px;
  align-items: center;
  background: var(--ignition-soft);
  border: 1px solid var(--ignition);
  border-radius: var(--radius);
  padding: 10px;
  margin-bottom: 16px;
}
.option-selected-card img {
  width: 76px;
  height: 52px;
  object-fit: cover;
  border-radius: 7px;
  flex-shrink: 0;
}
.option-selected-badge {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--verified);
  margin-bottom: 3px;
}

/* ===== Celebration confetti ===== */
.confetti-particle {
  position: fixed;
  width: 7px;
  height: 7px;
  border-radius: 2px;
  pointer-events: none;
  z-index: 200;
  animation: confetti-burst 0.9s ease-out forwards;
}
@keyframes confetti-burst {
  0% { transform: translate(0, 0) rotate(0deg) scale(1); opacity: 1; }
  100% { transform: translate(var(--dx), var(--dy)) rotate(var(--rot)) scale(0.4); opacity: 0; }
}

.spec-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 18px;
}
.chip {
  font-size: 12px;
  font-family: var(--font-mono);
  padding: 6px 11px;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--ink-muted);
  background: var(--surface-raised);
}
.chip.set { color: var(--ink); border-color: var(--ignition); background: var(--ignition-soft); }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 600;
  padding: 4px 9px;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.badge-preferred { background: var(--verified-soft); color: var(--verified); }
.badge-standard { background: var(--surface-raised); color: var(--ink-muted); border: 1px solid var(--border); }

/* ===== Modals ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(5, 5, 6, 0.7);
  backdrop-filter: blur(3px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
}
.modal-overlay[hidden] { display: none; }

.modal-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  width: 100%;
  max-width: 420px;
  padding: 28px;
}
.modal-card h3 {
  font-family: var(--font-display);
  font-size: 20px;
  margin: 0 0 6px;
}
.modal-sub {
  color: var(--ink-muted);
  font-size: 13px;
  margin: 0 0 20px;
}
.modal-tabs {
  display: flex;
  gap: 4px;
  background: var(--surface-raised);
  border-radius: var(--radius-sm);
  padding: 4px;
  margin-bottom: 20px;
}
.modal-tab {
  flex: 1;
  text-align: center;
  padding: 8px 0;
  font-size: 13px;
  font-weight: 600;
  border-radius: 6px;
  color: var(--ink-muted);
  background: transparent;
  border: none;
}
.modal-tab.active { background: var(--ignition); color: #06182B; }
.modal-error {
  color: var(--danger);
  font-size: 13px;
  margin: -4px 0 14px;
}
.modal-close {
  position: absolute;
  top: 18px; right: 18px;
  background: none;
  border: none;
  color: var(--ink-faint);
  font-size: 18px;
}

.checkout-step { display: none; }
.checkout-step.active { display: block; }
.choice-group { display: flex; flex-direction: column; gap: 8px; margin-bottom: 18px; }
.choice-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-raised);
  font-size: 14px;
  cursor: pointer;
}
.choice-option:hover { border-color: var(--ink-faint); }
.choice-option.selected { border-color: var(--ignition); background: var(--ignition-soft); }
.choice-option input { accent-color: var(--ignition); }

.confirm-summary {
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 16px;
  font-size: 14px;
  line-height: 1.7;
}
.confirm-summary dt { color: var(--ink-muted); font-size: 12px; margin-top: 8px; }
.confirm-summary dd { margin: 0; font-family: var(--font-mono); }

/* ===== Responsive ===== */
@media (max-width: 880px) {
  .topnav { height: 52px; padding: 0 14px; }
  .brand { font-size: 16px; }
  .brand-sub { display: none; }
  .nav-dealer-link { display: none; }

  /* Chat owns the whole screen by default. The build panel becomes a
     bottom-sheet overlay, summoned only by the tray tab — this is the
     'stay focused on chat, pull out the tray to see images' behavior. */
  .view-app { display: block; }
  .chat-pane { height: 100%; border-right: none; }
  .chat-thread { padding: 16px 16px 10px; }
  .msg { max-width: 86%; font-size: 14px; }
  .chat-input-bar { padding: 12px 14px 16px; }

  .build-panel {
    position: fixed;
    left: 0; right: 0; bottom: 0;
    max-height: 80dvh;
    border-radius: 18px 18px 0 0;
    border: 1px solid var(--border);
    border-bottom: none;
    box-shadow: 0 -14px 44px rgba(0, 0, 0, 0.55);
    transform: translateY(105%);
    transition: transform 0.35s cubic-bezier(0.22, 0.9, 0.32, 1.05);
    z-index: 70;
    padding-top: 6px;
  }
  .build-panel.is-open { transform: translateY(0); }
  .build-panel::before {
    content: "";
    display: block;
    width: 36px;
    height: 4px;
    border-radius: 2px;
    background: var(--border);
    margin: 0 auto 12px;
  }
  .build-tray-close {
    display: block;
    position: absolute;
    top: 10px;
    right: 14px;
    background: none;
    border: none;
    color: var(--ink-faint);
    font-size: 20px;
    line-height: 1;
    padding: 4px;
  }

  .build-tray-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    z-index: 65;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
  }
  .build-tray-backdrop.is-open { opacity: 1; pointer-events: auto; }

  .build-tray-tab {
    display: flex;
    width: 100%;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 11px 16px;
    border-radius: 0;
    border: none;
    border-top: 1px solid var(--border-soft);
    border-bottom: 1px solid var(--border-soft);
    background: linear-gradient(135deg, #6EE7DD 0%, #3FC4B5 50%, #1F9C8F 100%);
    color: #04231F;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.01em;
  }
  .build-tray-tab .dot-badge {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #04231F;
    opacity: 0;
  }
  .build-tray-tab.has-update .dot-badge {
    opacity: 1;
    animation: pulse-dot 1.6s infinite;
  }
  @keyframes pulse-dot {
    0% { box-shadow: 0 0 0 0 rgba(4, 35, 31, 0.5); }
    70% { box-shadow: 0 0 0 6px rgba(4, 35, 31, 0); }
    100% { box-shadow: 0 0 0 0 rgba(4, 35, 31, 0); }
  }

  .options-grid { grid-template-columns: repeat(2, 1fr); }
  .spec-chips { margin-bottom: 10px; gap: 6px; }
  .chip { font-size: 10.5px; padding: 4px 9px; }

  .gate-form { flex-direction: column; }
  .gate-title { font-size: 26px; }
  .stat-grid { grid-template-columns: 1fr; }
}

/* Tray tab/backdrop/close button only exist as a concept on mobile */
.build-tray-tab, .build-tray-backdrop, .build-tray-close { display: none; }
@media (max-width: 880px) {
  .build-tray-tab, .build-tray-backdrop { display: flex; }
  .build-tray-backdrop { display: block; }
}

/* ===== Dealer portal ===== */
.dealer-shell {
  max-width: 1040px;
  margin: 0 auto;
  padding: 40px 24px 80px;
}
.dealer-gate {
  min-height: calc(100vh - 64px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.dealer-eyebrow {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--verified);
  margin-bottom: 14px;
}
.dealer-title {
  font-family: var(--font-display);
  font-size: 28px;
  margin: 0 0 8px;
}
.dealer-sub { color: var(--ink-muted); font-size: 14px; margin: 0 0 24px; }

.dealer-trial-toggle {
  display: flex;
  gap: 8px;
  margin-bottom: 18px;
}
.dealer-trial-toggle button {
  flex: 1;
  padding: 9px 0;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-raised);
  color: var(--ink-muted);
  font-size: 13px;
  font-weight: 600;
}
.dealer-trial-toggle button.active { border-color: var(--verified); color: var(--verified); background: var(--verified-soft); }

.banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 18px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  margin-bottom: 24px;
  font-size: 14px;
}
.banner.trial { border-color: rgba(77, 168, 255, 0.35); background: var(--ignition-soft); }
.banner.client { border-color: rgba(79, 209, 197, 0.35); background: var(--verified-soft); }

.stat-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-bottom: 28px;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
}
.stat-card .stat-label {
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-faint);
  margin-bottom: 8px;
}
.stat-card .stat-value {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 600;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px;
}
.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.panel-header h3 {
  font-family: var(--font-display);
  font-size: 16px;
  margin: 0;
}

.lead-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.lead-table th {
  text-align: left;
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ink-faint);
  padding: 0 10px 10px;
  border-bottom: 1px solid var(--border);
}
.lead-table td {
  padding: 12px 10px;
  border-bottom: 1px solid var(--border-soft);
  font-family: var(--font-mono);
}
.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--ink-faint);
  font-size: 13px;
  line-height: 1.7;
}

/* ===== Admin: cached render review ===== */
.admin-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 14px;
}
.admin-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.admin-card img {
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  display: block;
  background: var(--surface-raised);
}
.admin-card-body { padding: 10px; }
.admin-card-name {
  font-family: var(--font-mono);
  font-size: 10.5px;
  word-break: break-all;
  margin-bottom: 5px;
  color: var(--ink);
}
.admin-card-meta {
  font-size: 10.5px;
  color: var(--ink-muted);
  margin-bottom: 10px;
}
.admin-delete-btn {
  width: 100%;
  font-size: 12px;
  padding: 7px 0;
  color: var(--danger);
  border-color: rgba(229, 72, 77, 0.4);
}
.admin-delete-btn:hover { background: rgba(229, 72, 77, 0.12); }
