:root {
  --bg-app: #eceff5;
  --side: #0a0f1e;
  --side-2: #1b2942;
  --side-ink: #c2cde0;
  --side-active: #E89A12;
  --panel: #ffffff;
  --ink: #0f1626;
  --muted: #69768c;
  --line: #e3e7f0;
  --line-2: #eef1f7;
  --brand: #E89A12;          /* electric gold */
  --brand-dark: #C57E0A;
  --brand-soft: #fbe6bd;
  --gold1: #FFDE7A;
  --gold2: #E8941A;
  --storm1: #0b1224;
  --storm2: #060912;
  --green: #15803d;
  --green-bg: #d9f7e3;
  --amber: #b45309;
  --amber-bg: #fef0c7;
  --red: #dc2626;
  --red-bg: #fee2e2;
  --shadow-sm: 0 1px 2px rgba(13,22,38,.06), 0 1px 3px rgba(13,22,38,.06);
  --shadow-md: 0 8px 24px rgba(13,22,38,.10);
  --glow: 0 0 0 1px rgba(232,154,18,.25), 0 8px 26px rgba(232,148,26,.35);
  --radius: 13px;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font: 14px/1.5 "Segoe UI", -apple-system, Roboto, Helvetica, Arial,
    sans-serif;
  color: var(--ink);
  background: var(--bg-app);
  -webkit-font-smoothing: antialiased;
}
.hidden { display: none !important; }
.muted { color: var(--muted); }
.err { color: var(--red); min-height: 1.2em; margin: 6px 0 0;
  font-weight: 600; }
h1, h2 { margin: 0; letter-spacing: -.01em; }
.data td, .kpi-val, .pre, .suf { font-variant-numeric: tabular-nums; }

/* ---------- Auth (storm) ---------- */
.auth-wrap {
  min-height: 100vh; display: grid; place-items: center; overflow: hidden;
  position: relative;
  background:
    radial-gradient(900px 500px at 50% -10%, #20335e 0%, transparent 60%),
    linear-gradient(180deg, #0c1430 0%, #05070f 100%);
}
.auth-wrap::before, .auth-wrap::after {
  content: ""; position: absolute; inset: -20%;
  background:
    conic-gradient(from 200deg at 60% 40%,
      transparent 0deg, rgba(232,148,26,.10) 40deg, transparent 80deg);
  animation: storm 9s ease-in-out infinite;
  pointer-events: none;
}
.auth-wrap::after { animation-delay: 4.5s; opacity: .6;
  transform: scaleX(-1); }
@keyframes storm {
  0%, 100% { opacity: .15; }
  45% { opacity: .15; }
  50% { opacity: .55; }
  53% { opacity: .2; }
  56% { opacity: .6; }
  60% { opacity: .15; }
}
.auth-card {
  position: relative; background: #fff; padding: 38px 40px 34px;
  border-radius: 20px; width: 390px;
  box-shadow: 0 30px 80px rgba(0,0,0,.55);
  display: flex; flex-direction: column; gap: 13px; text-align: center;
  border-top: 4px solid transparent;
  background-image:
    linear-gradient(#fff, #fff),
    linear-gradient(90deg, var(--gold1), var(--gold2));
  background-origin: border-box;
  background-clip: padding-box, border-box;
}
.auth-logo {
  width: 64px; height: 64px; margin: 0 auto 2px;
  filter: drop-shadow(0 6px 16px rgba(232,148,26,.55));
}
.auth-logo svg, .side-brand .logo svg { width: 100%; height: 100%;
  display: block; }
.auth-card h1 { font-size: 24px; font-weight: 900; letter-spacing: .14em;
  color: var(--ink); display: flex; flex-direction: column; gap: 2px; }
.auth-card h1 .z-sub { font-size: 11px; font-weight: 800;
  letter-spacing: .42em; color: var(--brand-dark); }
.z-tag { margin: -4px 0 6px; font-size: 12.5px; font-weight: 700;
  color: var(--brand-dark); letter-spacing: .02em; }
.auth-card label { display: flex; flex-direction: column; gap: 6px;
  font-weight: 700; font-size: 12px; text-align: left; color: var(--muted);
  text-transform: uppercase; letter-spacing: .04em; }
.auth-card input { padding: 12px; border: 1px solid var(--line);
  border-radius: 11px; font-size: 15px; font-weight: 600; }
.auth-card input:focus { outline: 3px solid var(--brand-soft);
  border-color: var(--brand); }
.forgot-link { color: var(--brand-dark); font-weight: 700;
  font-size: 13px; text-decoration: none; margin-top: -4px; }
.forgot-link:hover { text-decoration: underline; }

.reset-row { display: flex; align-items: center;
  justify-content: space-between; gap: 12px; padding: 10px 0;
  border-bottom: 1px solid var(--line-2); font-size: 13px; }
.reset-row:last-child { border-bottom: 0; }
.reset-actions { display: flex; gap: 8px; flex: none; }
.temp-pw { margin: 16px 0; padding: 16px; text-align: center;
  font-size: 24px; font-weight: 800; letter-spacing: .08em;
  background: var(--storm1); color: var(--gold1); border-radius: 12px;
  font-variant-numeric: tabular-nums; }

/* ---------- App shell ---------- */
#app { display: flex; height: 100vh; overflow: hidden; }

.sidebar {
  width: 240px; flex: none;
  background: linear-gradient(180deg, #0c1326 0%, #070b16 100%);
  color: var(--side-ink); display: flex; flex-direction: column;
  padding: 16px 12px; border-right: 1px solid rgba(232,148,26,.15);
  transition: margin-left .24s ease;
  /* #app clips overflow, so the sidebar scrolls itself on short viewports —
     otherwise the bottom (Sign out) would be unreachable. */
  overflow: hidden auto;
}
/* leave a clear zone at the top-left for the fixed hamburger */
.side-brand { display: flex; align-items: center; gap: 11px;
  padding: 6px 8px 18px; margin-top: 34px; }

/* ---------- Sidebar collapse (hamburger) ---------- */
.nav-toggle {
  position: fixed; top: 13px; left: 13px; z-index: 40;
  width: 42px; height: 36px; display: flex; flex-direction: column;
  justify-content: center; gap: 5px; padding: 0 10px;
  background: #0c1326; border: 1px solid rgba(232,148,26,.5);
  border-radius: 9px; cursor: pointer;
  box-shadow: 0 4px 14px rgba(0,0,0,.32);
  transition: background .15s, box-shadow .15s;
}
.nav-toggle span { display: block; height: 2px; border-radius: 2px;
  background: #f0e2b8; }
.nav-toggle:hover { background: #16223f;
  box-shadow: 0 6px 18px rgba(0,0,0,.4); }
/* Dual light+dark ring so keyboard focus is visible on EITHER backdrop
   (navy sidebar when open, light/dark main when collapsed) — a single
   accent color washes out on one of them. Transparent outline keeps a
   cue in Windows forced-colors mode. */
.nav-toggle:focus-visible { outline: 2px solid transparent; outline-offset: 2px;
  box-shadow: 0 0 0 2px #fff, 0 0 0 5px #0b1120, 0 4px 14px rgba(0,0,0,.32); }
/* collapsed: sidebar slides out, main reflows to full width */
#app.nav-collapsed .sidebar { margin-left: -240px; }
#app.nav-collapsed .main { padding-left: 64px; }
/* dark mode: both bg's are navy, so lift the chip a shade to stay visible */
html.dark .nav-toggle { background: #16223f; border-color: rgba(232,148,26,.62); }
html.dark .nav-toggle:hover { background: #1d2c4e; }
/* Respect reduced-motion: no slide, just snap open/closed */
@media (prefers-reduced-motion: reduce) {
  .sidebar, .main { transition: none; }
}
.side-brand .logo { width: 38px; height: 38px; flex: none;
  filter: drop-shadow(0 3px 10px rgba(232,148,26,.5)); }
.brand-text { display: flex; flex-direction: column; line-height: 1.05; }
.brand-text b { font-size: 17px; font-weight: 900; color: #fff;
  letter-spacing: .12em; }
.brand-text i { font-size: 9.5px; font-style: normal; font-weight: 800;
  letter-spacing: .28em; color: var(--brand); }
.side-nav { display: flex; flex-direction: column; gap: 3px; flex: 1;
  margin-top: 4px; }
.side-nav .tab {
  display: flex; align-items: center; gap: 11px; width: 100%;
  background: transparent; border: 0; cursor: pointer;
  color: var(--side-ink); padding: 11px 12px; border-radius: 10px;
  font-size: 14px; font-weight: 600; text-align: left;
  transition: background .12s, color .12s;
}
.side-nav .tab:hover { background: rgba(255,255,255,.06); color: #fff; }
.side-nav .tab.active {
  background: linear-gradient(135deg, var(--gold1), var(--gold2));
  color: #1c1405; font-weight: 800;
  box-shadow: 0 6px 18px rgba(232,148,26,.45);
}
.side-nav .tab.active .ic { stroke: #1c1405; }
.side-nav .ic { width: 19px; height: 19px; flex: none; fill: none;
  stroke: currentColor; stroke-width: 2; stroke-linecap: round;
  stroke-linejoin: round; }
.side-foot { border-top: 1px solid rgba(255,255,255,.08);
  padding-top: 14px; display: flex; flex-direction: column; gap: 10px; }
.who-line { padding: 0 8px; font-size: 13px; color: #93a4bd;
  text-transform: capitalize; }
.btn.block { width: 100%; }
.btn.ghost { background: transparent; color: #cbd6e6;
  border-color: rgba(255,255,255,.18); }
.btn.ghost:hover { background: rgba(255,255,255,.08); color: #fff; }

/* ---------- Main ---------- */
.main { flex: 1; min-width: 0; overflow-y: auto; padding: 26px 30px 40px;
  transition: padding-left .24s ease; }
.page-head { margin-bottom: 18px; }
.page-head h1 { font-size: 23px; font-weight: 800;
  display: inline-flex; align-items: center; gap: 10px; }
.page-head h1::before {
  content: ""; width: 6px; height: 24px; border-radius: 3px;
  background: linear-gradient(180deg, var(--gold1), var(--gold2));
}
.page-head p { margin: 6px 0 0; }

/* KPI tiles */
.kpi-row { display: grid; gap: 14px; margin-bottom: 18px;
  grid-template-columns: repeat(4, 1fr); }
.kpi {
  position: relative; background: var(--panel);
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 17px 18px; box-shadow: var(--shadow-sm); overflow: hidden;
  transition: transform .12s, box-shadow .12s;
}
.kpi::before { content: ""; position: absolute; top: 0; left: 0; right: 0;
  height: 3px; background: linear-gradient(90deg,
    var(--gold1), var(--gold2)); opacity: .85; }
.kpi:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.kpi-label { font-size: 12px; font-weight: 700; color: var(--muted);
  text-transform: uppercase; letter-spacing: .05em; }
.kpi-val { font-size: 29px; font-weight: 800; margin: 7px 0 2px;
  letter-spacing: -.02em; }
.kpi-val.good { color: var(--green); }
.kpi-val.warn { color: var(--amber); }
.kpi-val.accent { color: var(--brand-dark); }
.kpi-sub { font-size: 12px; color: var(--muted); }
/* Reports: responsive stat-card grid + spacing between report cards */
.report-kpis { display: grid; gap: 14px; margin: 4px 0 4px;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
#reports-body .card { margin-bottom: 18px; }
/* Sub-section headings inside the combined Inventory Analysis card */
.report-sub { margin: 22px 0 10px; font-size: 12px; font-weight: 800;
  text-transform: uppercase; letter-spacing: .04em; color: var(--muted);
  border-top: 1px solid var(--line-2); padding-top: 16px; }
.report-sub:first-of-type { margin-top: 8px; border-top: none; padding-top: 0; }
.report-sub .muted { text-transform: none; letter-spacing: 0; }
/* Click-through report rows/cards */
tr.drill { cursor: pointer; }
tr.drill:hover { background: var(--brand-soft); }
tr.drill td:first-child::after { content: " ›"; color: var(--muted); }
.kpi.drill { cursor: pointer; }
.kpi.drill:hover { box-shadow: 0 0 0 2px var(--brand-soft), var(--shadow-md); }

/* Cards */
.card {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 20px;
  box-shadow: var(--shadow-sm); margin-bottom: 18px;
}
.card.narrow { max-width: 620px; }
.card-head { display: flex; align-items: center;
  justify-content: space-between; gap: 14px; margin-bottom: 16px;
  flex-wrap: wrap; }
.card-head h2 { font-size: 15px; }
.mode-badge { display: inline-block; margin-left: 10px; padding: 2px 10px;
  border-radius: 999px; font-size: 11px; font-weight: 800;
  letter-spacing: .06em; vertical-align: middle;
  background: var(--storm1); color: var(--gold1); }
.mode-badge.lease { background: var(--green-bg); color: var(--green); }
/* Retail/Lease toggle pill (segmented control) */
.mode-toggle { display: inline-flex; margin-right: auto;
  background: var(--storm1); border: 1px solid var(--line);
  border-radius: 999px; padding: 3px; gap: 2px; }
.mode-seg { border: 0; background: transparent; cursor: pointer;
  padding: 5px 16px; border-radius: 999px; font-size: 12px;
  font-weight: 800; letter-spacing: .04em; color: var(--muted);
  transition: background .12s, color .12s; }
.mode-seg:hover { color: var(--ink); }
.mode-seg.active { background: var(--gold1); color: #1a1206; }
.mode-seg[data-mode="lease"].active { background: var(--green);
  color: #06210f; }
/* Lease bonus-cash eligibility checkboxes */
.lz-bonus-row { display: flex; align-items: center; flex-wrap: wrap;
  gap: 8px 18px; margin: 12px 0 0; padding: 10px 12px;
  background: var(--storm1); border: 1px solid var(--line);
  border-radius: 10px; }
.lz-bonus-label { font-weight: 700; font-size: 12px; color: var(--muted); }
.lz-bonus-row .chk { font-size: 13px; }

/* Retail vs Lease mode: show one set of controls, hide the other. */
.lease-only { display: none; }
#tab-finder.lease-mode .retail-only { display: none; }
#tab-finder.lease-mode .lease-only { display: block; }
.card-actions { display: flex; align-items: center; gap: 9px;
  flex-wrap: wrap; }

/* Remove number-input spinners (cleaner currency fields) */
input[type=number] { -moz-appearance: textfield; appearance: textfield; }
input[type=number]::-webkit-outer-spin-button,
input[type=number]::-webkit-inner-spin-button {
  -webkit-appearance: none; margin: 0; }

/* Param grid — every input bottom-aligned on a shared baseline even
   when labels wrap to different line counts */
.params-grid { display: grid; gap: 18px 16px; align-items: end;
  grid-template-columns: repeat(auto-fill, minmax(172px, 1fr)); }
.params-grid label { position: relative; display: flex;
  flex-direction: column; justify-content: flex-end; gap: 7px;
  min-height: 62px; font-size: 11px; font-weight: 700;
  color: var(--muted); text-transform: uppercase; letter-spacing: .04em;
  line-height: 1.3; }
.params-grid input, .params-grid select {
  height: 42px; padding: 0 12px; border: 1px solid var(--line);
  border-radius: 9px; font-size: 15px; font-weight: 600;
  color: var(--ink); background: #fff; width: 100%;
}
.params-grid select { padding-right: 26px; }
.params-grid input:focus, .params-grid select:focus {
  outline: 3px solid var(--brand-soft); border-color: var(--brand);
}
.params-grid .pre, .params-grid .suf {
  position: absolute; bottom: 0; height: 42px; display: flex;
  align-items: center; color: var(--muted); font-size: 13px;
  font-weight: 700; pointer-events: none; }
.params-grid .pre { left: 12px; }
.params-grid .suf { right: 12px; }
.params-grid label:has(.pre) input { padding-left: 24px; }
.params-grid label:has(.suf) input { padding-right: 42px; }
.params-grid input:disabled { background: #f4f6fa; color: var(--muted);
  cursor: not-allowed; }

.row-actions { display: flex; align-items: center; gap: 12px;
  margin-top: 18px; flex-wrap: wrap; }

.rebate-box { margin-top: 16px; border: 1px solid var(--line);
  border-radius: 10px; padding: 10px 14px; background: #fbfcfe; }
.rebate-box summary { cursor: pointer; font-weight: 700; font-size: 13px;
  color: var(--ink); }
.rebate-box summary .muted { font-weight: 500; }
.rebate-box .params-grid { margin-top: 14px; }
.reb-grid { display: flex; flex-direction: column; gap: 8px;
  margin-top: 12px; }
.reb-row { display: grid; grid-template-columns: 1fr 140px; gap: 12px;
  align-items: center; }
.reb-row input { height: 40px; padding: 0 12px;
  border: 1px solid var(--line); border-radius: 9px; font-size: 14px;
  font-weight: 600; }
.reb-row input:focus { outline: 3px solid var(--brand-soft);
  border-color: var(--brand); }
#cond-filter { height: 42px; padding: 0 12px;
  border: 1px solid var(--line); border-radius: 9px; font-size: 14px;
  font-weight: 600; background: #fff; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 42px; padding: 0 18px;
  border: 1px solid var(--line); background: #fff; color: var(--ink);
  border-radius: 9px; font-size: 14px; font-weight: 700;
  cursor: pointer; transition: background .12s, border-color .12s,
  box-shadow .12s, transform .05s; white-space: nowrap;
}
.btn:hover { background: #f6f8fc; border-color: #d6dde8; }
.btn:active { transform: translateY(1px); }
.btn.primary {
  background: linear-gradient(135deg, var(--gold1), var(--gold2));
  border-color: var(--gold2); color: #1c1405;
  box-shadow: 0 4px 14px rgba(232,148,26,.40);
}
.btn.primary:hover { filter: brightness(1.05);
  box-shadow: var(--glow); transform: translateY(-1px); }
.btn.lg { min-height: 48px; padding: 0 20px; font-size: 15px; }
.btn.danger { color: var(--red); border-color: #f3c9c9; background: #fff; }
.btn.danger:hover { background: var(--red-bg); }
.btn.sm { min-height: 30px; padding: 0 11px; font-size: 12px;
  border-radius: 7px; }

/* ---------- Toolbar / inputs ---------- */
.results-toolbar { display: flex; align-items: center; gap: 12px;
  flex-wrap: wrap; }
.results-toolbar input:not([type=checkbox]), #inv-filter, .lease-filter {
  height: 42px; padding: 0 13px; border: 1px solid var(--line);
  border-radius: 9px; min-width: 230px; font-size: 14px; }
.results-toolbar input:focus, #inv-filter:focus, .lease-filter:focus {
  outline: 3px solid var(--brand-soft); border-color: var(--brand); }
.lease-filter { width: 100%; box-sizing: border-box; margin: 0 0 12px; }
.chk { display: flex; align-items: center; gap: 7px; font-weight: 600;
  color: var(--muted); font-size: 13px; cursor: pointer; }
.chk input { width: 15px; height: 15px; accent-color: var(--brand); }

/* ---------- Tables ---------- */
.table-scroll { overflow: auto; max-height: 60vh;
  border: 1px solid var(--line); border-radius: 10px; }
table.data { border-collapse: collapse; width: auto; font-size: 13px; }
table.data th, table.data td { padding: 8px 7px; text-align: right;
  white-space: nowrap; border-bottom: 1px solid var(--line-2); }
table.data th.l, table.data td.l { text-align: left; }
table.data thead th {
  position: sticky; top: 0; background: #0f1626; z-index: 1;
  font-size: 11px; text-transform: uppercase; letter-spacing: .04em;
  color: #aab6cc; cursor: pointer; user-select: none;
  border-bottom: 1px solid #0f1626;
}
table.data thead th:hover { color: #fff; }
table.data thead th .arr { color: var(--gold1); font-size: 10px; }
table.data tbody tr { transition: background .08s; }
table.data tbody tr:nth-child(even) { background: #fbfcfe; }
table.data tbody tr:hover { background: var(--brand-soft); }
table.data tbody tr.clickable { cursor: pointer; }
table.data td.l { font-weight: 600; }
.stock-link { color: var(--brand-dark); font-weight: 800;
  text-decoration: none; border-bottom: 1px dotted var(--brand); }
.stock-link:hover { color: var(--brand);
  border-bottom-style: solid; }
.pos { color: var(--green); font-weight: 700; }
.neg { color: var(--red); font-weight: 700; }
.warn-txt { color: var(--amber); font-weight: 700; }
/* Recon status bubble in the results (green ready / amber in-service / red not serviced) */
.recon-dot { display: inline-flex; align-items: center; justify-content: center;
  width: 18px; height: 18px; border-radius: 50%; font-size: 11px;
  font-weight: 800; line-height: 1; color: #fff; }
.recon-dot.recon-ready { background: var(--green); }
.recon-dot.recon-service { background: var(--amber); }
.recon-dot.recon-none { background: var(--red); }

/* Open-recall flag riding next to the recon bubble in the results */
.recall-flag { display: inline-block; margin-left: 5px; color: var(--red);
  font-weight: 800; cursor: default; }

/* "Lease cash is from a prior month" prompt on the incentive status line */
.stale-warn { display: inline-block; margin-top: 4px; padding: 3px 9px;
  border-radius: 6px; background: var(--amber-bg); color: var(--amber);
  border: 1px solid var(--amber); font-weight: 700; }
#incentive-status.is-stale { color: var(--ink, inherit); }

/* Recall list inside the vehicle detail popup */
#recall-box h4 { margin: 0 0 8px; }
#recall-box .recall-count-open { color: var(--red); font-weight: 700;
  font-size: 12px; }
.recall-item { border: 1px solid var(--line); border-left-width: 4px;
  border-radius: 8px; padding: 8px 10px; margin: 0 0 8px; background: var(--panel); }
.recall-item.open { border-left-color: var(--red); background: var(--red-bg); }
.recall-item.closed { border-left-color: var(--green); }
.recall-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.recall-badge { font-size: 11px; font-weight: 800; padding: 1px 7px;
  border-radius: 999px; white-space: nowrap; }
.recall-badge.open { background: var(--red); color: #fff; }
.recall-badge.closed { background: var(--amber-bg); color: var(--green); }
.recall-desc { margin: 4px 0 0; font-size: 13px; }
.recall-line { margin: 3px 0 0; font-size: 12px; color: var(--muted); }
.recall-line strong { color: var(--ink); }

/* Live OEM incentives (reference list in the new-car detail) */
#incentive-box h4 { margin: 0 0 8px; }
.inc-group { margin: 0 0 8px; }
.inc-group-h { font-weight: 800; font-size: 12px; text-transform: uppercase;
  letter-spacing: .04em; color: var(--muted); margin: 6px 0 3px; }
.inc-row { display: flex; align-items: baseline; gap: 8px; padding: 3px 0;
  border-bottom: 1px solid var(--line); font-size: 13px; }
.inc-row:last-child { border-bottom: 0; }
.inc-amt { flex: 0 0 96px; font-weight: 800; color: var(--green); }
.inc-name { flex: 1; }
.inc-end { flex: 0 0 auto; font-size: 12px; }
.inc-tag { display: inline-block; font-size: 10px; font-weight: 700;
  padding: 0 6px; border-radius: 999px; background: var(--amber-bg);
  color: var(--amber); vertical-align: middle; }
.inc-tag.ok { background: var(--green-bg); color: var(--green); }
.inc-cash-sum { margin: 2px 0 10px; font-size: 14px; }
.inc-cash-sum strong { color: var(--green); }

/* Conditional-offer pills on each vehicle card (customer must qualify) */
.cond-offers { display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
  margin: 8px 0 2px; }
.cond-offers-h { font-size: 11px; font-weight: 800; text-transform: uppercase;
  letter-spacing: .04em; color: var(--muted); margin-right: 2px; }
.cond-pill { display: inline-block; padding: 3px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 700; white-space: nowrap;
  background: #ede9fe; color: #5b21b6; border: 1px solid #c4b5fd; }
.cond-pill.is-clickable { cursor: pointer; font-family: inherit; }
.cond-pill.is-clickable:hover { background: #ddd6fe; border-color: #a78bfa; }
.cond-pill.is-clickable.active { background: #6d28d9; color: #fff;
  border-color: #6d28d9; }
.cond-pill.is-clickable.active::before { content: "✓ "; }
.cond-hint { font-size: 11px; }
.veh-rebates { margin: 8px 0 2px; }
.reb-nat { font-size: 13px; margin-bottom: 6px; }
.reb-nat-h { font-size: 11px; font-weight: 800; text-transform: uppercase;
  letter-spacing: .04em; color: var(--muted); margin-right: 4px; }
.reb-nat strong { color: var(--green); }
.wd-cash-note { font-size: 12px; margin: 6px 0 0; }
.reb-audit-row { margin-top: 6px; }
.audit-off { opacity: .45; }
.audit-off td { text-decoration: line-through; text-decoration-color:
  rgba(0,0,0,.25); }

/* Work Deal: interactive per-vehicle desking pop-out */
.wd-grid { display: grid; grid-template-columns: 1.1fr 1fr; gap: 16px;
  margin-top: 10px; align-items: start; }
@media (max-width: 640px) { .wd-grid { grid-template-columns: 1fr; } }
.wd-inputs { display: grid; grid-template-columns: 1fr 1fr; gap: 9px 12px; }
.wd-fld { display: flex; flex-direction: column; gap: 3px; font-size: 11px;
  font-weight: 700; text-transform: uppercase; letter-spacing: .03em;
  color: var(--muted); }
.wd-fld input { font-size: 15px; font-weight: 700; padding: 7px 9px;
  text-transform: none; letter-spacing: 0; }
.wd-out { background: var(--panel, #f7f8fa); border: 1px solid var(--line);
  border-radius: 10px; padding: 14px 16px; }
.wd-pay { display: flex; flex-direction: column; gap: 2px; margin-bottom: 10px;
  padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.wd-pay-lbl { font-size: 11px; font-weight: 800; text-transform: uppercase;
  letter-spacing: .05em; color: var(--muted); }
.wd-pay-amt { font-size: 30px; font-weight: 800; color: var(--green);
  line-height: 1.05; }
.wd-pay-mo { font-size: 15px; font-weight: 700; color: var(--muted);
  margin-left: 2px; }
.wd-lines.kv { margin: 0; }

/* Tools tab: plate decode + title check */
.tools-grid { display: grid; grid-template-columns: repeat(auto-fit,
  minmax(320px, 1fr)); gap: 16px; }
.tool-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
  margin: 10px 0; }
.tool-form input { flex: 1; min-width: 90px; text-transform: uppercase; }
.tool-form #tool-plate-state { flex: 0 0 64px; min-width: 64px;
  text-align: center; }
.tool-hit { margin-top: 12px; border-top: 1px solid var(--line);
  padding-top: 12px; }
.tool-hit .kv { margin-bottom: 10px; }
.tool-hit h4 { margin: 12px 0 6px; }
.title-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  padding: 8px 10px; border-radius: 8px; margin-bottom: 10px; }
.title-head.flag { background: var(--red-bg); }
.title-head.warn { background: var(--amber-bg); }
.title-head.clean { background: var(--green-bg); }
.title-badge { font-size: 12px; font-weight: 800; padding: 2px 9px;
  border-radius: 999px; white-space: nowrap; }
.title-badge.flag { background: var(--red); color: #fff; }
.title-badge.warn { background: var(--amber); color: #fff; }
.title-badge.clean { background: var(--green); color: #fff; }

/* Clickable comp count -> per-dealer 50-mile comps modal */
.mc-comps-btn { background: none; border: none; padding: 0; font: inherit;
  font-weight: 800; color: var(--brand-dark); cursor: pointer;
  text-decoration: underline dotted; }
.mc-comps-btn:hover { color: var(--brand); }

/* Resizable + reorderable result columns. Keep the header STICKY (sticky also
   anchors the absolute resize handle, so we don't fall back to relative — that
   was making the header scroll away). */
#results thead th { position: sticky; top: 0; z-index: 3; cursor: grab; }
#results thead th:active { cursor: grabbing; }
#results thead th.col-dragging { opacity: .45; }
#results thead th.col-drop { outline: 2px dashed var(--gold1);
  outline-offset: -2px; }
body.col-resizing #results thead th { cursor: col-resize; }
#results.cols-fixed { table-layout: fixed; }
#results.cols-fixed th, #results.cols-fixed td { overflow: hidden;
  text-overflow: ellipsis; }
/* The full-width expander row must not be clipped by fixed-column widths. */
#results.cols-fixed .veh-exp td { overflow: visible; text-overflow: clip; }
#results .col-resizer { position: absolute; top: 0; right: 0; width: 9px;
  height: 100%; cursor: col-resize; touch-action: none; user-select: none;
  z-index: 2; }
#results .col-resizer:hover,
body.col-resizing #results .col-resizer { background: var(--gold1); opacity: .5; }
body.col-resizing { cursor: col-resize; user-select: none; }

/* Lease vs Finance comparison */
.lvf-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px;
  margin-top: 8px; }
.lvf-col { border: 1px solid var(--line); border-radius: 12px; padding: 16px;
  background: rgba(15,22,38,.04); }   /* subtle light surface; dark-mode below */
.lvf-col.accent { border-color: var(--brand); background: var(--brand-soft); }
.lvf-title { font-weight: 800; font-size: 13px; letter-spacing: .04em;
  text-transform: uppercase; color: var(--muted); }
.lvf-pmt { font-size: 30px; font-weight: 800; margin: 4px 0 12px;
  color: var(--ink); }
.lvf-pmt .lvf-mo { font-size: 15px; font-weight: 600; color: var(--muted); }
.lvf-lines { display: grid; grid-template-columns: max-content auto;
  gap: 6px 12px; font-size: 13px; }
.lvf-lines .k { color: var(--muted); }
.lvf-lines .v { font-weight: 600; text-align: right; }
html.dark .lvf-col { background: rgba(255,255,255,.03); }

/* Window sticker (VIN explosion) */
.ws-img { display: block; max-width: 100%; height: auto; border-radius: 8px;
  border: 1px solid var(--line); background: #fff; }
.ws-highlights { margin: 4px 0 0; padding-left: 18px; }
.ws-highlights li { margin: 2px 0; font-size: 13px; }

/* NeoVIN factory packages sit in a column to the RIGHT of the used-car specs,
   as wrapping pills, so the whole build reads at a lateral glance. */
.veh-specs-wrap { display: flex; flex-wrap: wrap; gap: 6px 28px;
  align-items: flex-start; }
.vin-decode { flex: 1 1 240px; min-width: 200px; max-width: 560px; }
.vd-col-h { font-weight: 700; font-size: 10px; text-transform: uppercase;
  letter-spacing: .04em; color: var(--muted); margin-bottom: 5px; }
.vd-pills { display: flex; flex-wrap: wrap; gap: 5px; }
.vd-raw { margin-top: 8px; font-size: 11px; opacity: .7; }
.vd-opt { font-size: 12px; background: var(--panel); border: 1px solid var(--line);
  border-radius: 6px; padding: 1px 8px; white-space: nowrap; }
.vd-opt.has-det { cursor: pointer; border-color: var(--gold1); }
.vd-opt.has-det:hover { background: var(--brand-soft); }
.vd-opt.open { background: var(--brand-soft); border-color: var(--brand);
  box-shadow: 0 0 0 1px var(--brand) inset; }
.vd-info { font-size: 10px; color: var(--gold1); }
.vd-detail { display: none; margin-top: 8px; padding: 8px 10px;
  border: 1px solid var(--line); border-left: 3px solid var(--brand);
  border-radius: 8px; background: var(--panel); }
.vd-detail.show { display: block; }
.vd-detail-h { font-weight: 800; font-size: 12px; margin-bottom: 6px; }
.vd-detail-items { display: flex; flex-wrap: wrap; gap: 5px; }
.vd-detail-item { font-size: 12px; background: rgba(15,22,38,.04);
  border-radius: 6px; padding: 1px 8px; }
html.dark .vd-detail-item { background: rgba(255,255,255,.06); }

/* Team page: role badges + tidy action buttons */
.role-badge { display: inline-block; font-size: 11px; font-weight: 800;
  letter-spacing: .02em; padding: 2px 10px; border-radius: 999px; }
.role-badge.admin { background: var(--brand-soft); color: var(--brand); }
.role-badge.bdc { background: var(--green-bg); color: var(--green); }
.role-badge.user { background: rgba(15,22,38,.06); color: var(--muted); }
html.dark .role-badge.user { background: rgba(255,255,255,.08); }
.row-actions-cell { white-space: nowrap; }
#users-table td { vertical-align: middle; }

/* BDC (inventory-only) login: a read-only vehicle list — only the Inventory
   tab, no edit controls, and no dealer books/market in the row expander. */
body.is-bdc .tab:not([data-tab="inventory"]) { display: none; }
body.is-bdc #tab-inventory .card-actions .btn { display: none; }
body.is-bdc #tab-inventory .page-head p { display: none; }
body.is-bdc .veh-books { display: none; }
/* BDC inventory New/Used + body-type filter bar (hidden for other roles). */
#bdc-inv-controls { display: none; }
body.is-bdc #bdc-inv-controls { display: flex; flex-wrap: wrap;
  align-items: center; gap: 10px; margin: 0 0 12px; }

/* Sortable-column arrow on data tables (matches the Deal Finder's .arr) */
.sort-arr { color: var(--gold1); font-size: 10px; margin-left: 4px; }

/* Deal context strip — whose deal, where, what tax */
.deal-context { font-size: 13px; font-weight: 600; margin-left: 10px; }

/* Inline field warning (e.g. doc fee over the IL cap) */
.field-warn { display: none; font-size: 11px; font-weight: 700;
  color: var(--red); margin-top: 3px; }
.field-warn.on { display: block; }

/* Print dialog live payment echo */
.pq-echo { font-weight: 700; color: var(--brand-dark); margin: 4px 0 0;
  min-height: 18px; }

/* Search busy state */
#run.busy { opacity: .7; pointer-events: none; position: relative; }
#run.busy::after { content: " …"; }

/* Touch targets for tablet desking (managers work on iPads on the floor) */
@media (pointer: coarse) {
  .btn.sm { min-height: 44px; padding: 0 14px; }
  .exp-toggle, .pin-toggle { min-width: 40px; min-height: 40px;
    font-size: 18px; padding: 6px; }
  .chk input, input[type=checkbox] { width: 22px; height: 22px; }
  table.data th, table.data td { padding: 11px 9px; }
  .sort-chips .chip, .type-chips .chip { padding: 9px 14px; }
  select, input:not([type=checkbox]):not([type=radio]) { min-height: 42px; }
}

/* Rebate qualification checkboxes (retail) */
#retail-rebate-row { margin-top: 12px; }
#rebate-checks { display: flex; align-items: center; flex-wrap: wrap;
  gap: 8px 18px; }
#rebate-checks .chk.rb-zero { opacity: .45; }

/* Quick-sort chips + body-type filter chips on the results toolbar */
.sort-chips, .type-chips { display: flex; gap: 6px; }
.sort-chips .chip, .type-chips .chip {
  border: 1px solid var(--line); background: var(--panel);
  border-radius: 999px; padding: 5px 12px; font-size: 12px; font-weight: 700;
  color: var(--muted); cursor: pointer; }
.sort-chips .chip:hover, .type-chips .chip:hover { border-color: var(--brand); }
.sort-chips .chip.active { background: var(--brand-soft);
  border-color: var(--brand); color: var(--brand-dark); }
html.dark .sort-chips .chip, html.dark .type-chips .chip {
  background: transparent; }
/* Type chips are a multi-select "show only" filter — a solid gold fill with
   dark text makes it clear they stack (vs the single-select sort chips) and
   stays legible in both themes. The gold --brand is fixed across themes, so
   the label must be a fixed dark ink; the html.dark rule re-asserts the fill
   to win over the transparent inactive rule above. */
.type-chips .chip.active,
html.dark .type-chips .chip.active {
  background: var(--brand); border-color: var(--brand); color: #241a05; }

/* ---------- Open-deal tabs (multi-deal switcher) ---------- */
.deal-tabs { display: flex; align-items: flex-end; gap: 6px;
  flex-wrap: wrap; margin: 0 0 12px; }
.deal-tab { display: inline-flex; align-items: center; gap: 8px;
  max-width: 260px; padding: 8px 12px; border: 1px solid var(--line);
  border-bottom: none; background: var(--panel); color: var(--muted);
  border-radius: 10px 10px 0 0; font-size: 13px; font-weight: 700;
  cursor: pointer; }
.deal-tab:hover { border-color: var(--brand); color: var(--ink); }
.deal-tab.active { background: var(--card, var(--panel)); color: var(--ink);
  border-color: var(--brand); box-shadow: inset 0 3px 0 var(--brand); }
.deal-tab-label { min-width: 0; overflow: hidden; text-overflow: ellipsis;
  white-space: nowrap; }
.deal-tab-x { display: inline-flex; align-items: center; justify-content: center;
  width: 18px; height: 18px; border-radius: 50%; font-size: 15px;
  line-height: 1; color: var(--muted); }
.deal-tab-x:hover { background: var(--brand-soft); color: var(--brand-dark); }
.deal-tab-add { padding: 8px 12px; border: 1px dashed var(--line);
  background: transparent; color: var(--muted); border-radius: 10px;
  font-size: 13px; font-weight: 700; cursor: pointer; }
.deal-tab-add:hover { border-color: var(--brand); color: var(--brand-dark); }
html.dark .deal-tab { background: transparent; }
html.dark .deal-tab.active { background: #0f1830; }

/* Payment matrix in the vehicle popup */
.pm-box { margin-top: 16px; border-top: 1px solid var(--line);
  padding-top: 12px; }
.pm-box h4 { margin: 0 0 8px; font-size: 12px; text-transform: uppercase;
  letter-spacing: .04em; color: var(--muted); }
.pm-table { width: auto; }
.pm-table td.hl { background: var(--brand-soft); font-weight: 800; }
.pm-solve { display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin-top: 12px; }
.pm-solve input { width: 90px; height: 34px; padding: 0 8px;
  border: 1px solid var(--line); border-radius: 8px; }

/* Present Mode — hide dealer-only money while a customer is watching */
body.present .dealer-col { display: none !important; }
body.present .veh-books { display: none !important; }
#present-toggle.on { background: var(--brand-soft);
  border-color: var(--brand); color: var(--brand-dark); font-weight: 800; }

/* Pin & Compare */
.pin-toggle { border: 0; background: none; cursor: pointer; font-size: 14px;
  color: var(--muted); padding: 0 4px; }
.pin-toggle.on { color: var(--gold1); }
.compare-bar { display: flex; align-items: center; gap: 10px;
  flex-wrap: wrap; margin: 10px 0 12px; padding: 9px 12px;
  background: var(--brand-soft); border: 1px solid var(--brand);
  border-radius: 10px; }
.cmp-chip { display: inline-flex; align-items: center; gap: 6px;
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 999px; padding: 4px 10px; font-size: 12px;
  font-weight: 700; margin-right: 6px; }
.cmp-chip button { border: 0; background: none; cursor: pointer;
  color: var(--muted); font-size: 12px; }
.cmp-table th, .cmp-table td { white-space: normal; }
.cmp-table thead th { min-width: 150px; }

/* Multi-lender comparison */
.lc-table tr.lc-over td { opacity: .6; }
.lc-table tr.lc-no td { opacity: .5; }
.lc-info { cursor: help; color: var(--muted); font-size: 12px; }

/* F&I product menu */
.fi-grid { display: grid; gap: 10px;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); }
.fi-col { border: 1px solid var(--line); border-radius: 10px; padding: 10px;
  text-align: center; }
.fi-col.accent { border-color: var(--brand); background: var(--brand-soft); }
.fi-label { font-size: 11px; font-weight: 800; text-transform: uppercase;
  letter-spacing: .03em; color: var(--muted); }
.fi-pay { font-size: 22px; font-weight: 800; margin: 4px 0 0; }
.fi-pay .fi-mo { font-size: 12px; font-weight: 600; color: var(--muted); }
.fi-delta { font-size: 12px; font-weight: 700; color: var(--brand-dark); }
.fi-gross { font-size: 11px; color: var(--muted); margin-top: 4px; }
.empty { text-align: center; color: var(--muted); padding: 38px 10px;
  font-size: 14px; }

.badge { padding: 4px 11px; border-radius: 999px; font-weight: 800;
  font-size: 11.5px; display: inline-block; }
.badge.fit { background: var(--green-bg); color: var(--green); }
.badge.close { background: var(--amber-bg); color: var(--amber); }
.badge.over { background: var(--red-bg); color: var(--red); }
.badge.none { background: #eef1f6; color: var(--muted); }

/* ---------- Modal ---------- */
.modal { position: fixed; inset: 0; background: rgba(7,11,22,.62);
  backdrop-filter: blur(3px); display: grid; place-items: center;
  z-index: 50; padding: 20px; }
.modal-card { background: #fff; border-radius: 16px; padding: 26px;
  max-width: 640px; width: 100%; max-height: 90vh; overflow: auto;
  box-shadow: 0 30px 80px rgba(0,0,0,.55);
  border-top: 4px solid var(--brand); }
.modal-card h3 { margin: 0 0 4px; font-size: 19px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px;
  flex-wrap: wrap; margin-top: 22px; }
.kv { display: grid; grid-template-columns: 1fr auto; gap: 9px 18px;
  margin: 16px 0; }
.kv .k { color: var(--muted); }
.kv .v { font-weight: 700; text-align: right;
  font-variant-numeric: tabular-nums; }
.kv .total { border-top: 2px solid var(--line); padding-top: 10px;
  font-size: 17px; }
.modal-card label { display: block; font-size: 11px; font-weight: 700;
  color: var(--muted); text-transform: uppercase; margin-bottom: 14px;
  letter-spacing: .04em; }
.modal-card label input, .modal-card label select {
  display: block; width: 100%; height: 42px; padding: 0 12px;
  margin-top: 6px; border: 1px solid var(--line); border-radius: 9px;
  font-size: 14px; font-weight: 600; color: var(--ink); background: #fff; }
.modal-card label input:focus,
.modal-card label select:focus { outline: 3px solid var(--brand-soft);
  border-color: var(--brand); }
.modal-grid { display: grid; grid-template-columns: 1fr 1fr;
  gap: 2px 16px; }

/* ---------- Toast ---------- */
.toast { position: fixed; bottom: 26px; left: 50%;
  transform: translateX(-50%); background: #0f1626; color: #fff;
  padding: 13px 24px; border-radius: 11px; font-weight: 700; z-index: 80;
  box-shadow: 0 14px 40px rgba(0,0,0,.5);
  border-left: 4px solid var(--brand); }
.toast.bad { background: var(--red); border-left-color: #7f1d1d; }

/* ---------- Print customer sheet ---------- */
@media print {
  /* margin:0 drops Chrome's auto header/footer (title, URL, date, page#) */
  @page { size: letter; margin: 0; }
  /* Hide everything except the print sheet from layout, so the (tall)
     app behind it doesn't spill onto blank extra pages. */
  body > *:not(#print-area) { display: none !important; }
  /* !important so this beats the screen-hide rule below it (equal
     specificity, later in source) when the print media query is active. */
  #print-area { display: block !important; position: static;
    padding: 14mm 16mm; color: #000; }
  .modal-actions, .no-print { display: none !important; }
}
/* Hidden on screen — only rendered when printing. */
#print-area { display: none; font-size: 15px; }
#print-area h2 { margin: 0 0 2px; }
#print-area .ps-row { display: flex; justify-content: space-between;
  padding: 8px 0; border-bottom: 1px solid #e2e8f0; }
#print-area .ps-total { font-size: 21px; font-weight: 800;
  border-top: 3px solid #000; margin-top: 10px; padding-top: 12px; }
#print-area table.pgrid { width: 100%; border-collapse: collapse;
  margin-top: 14px; font-size: 14px; }
#print-area table.pgrid th, #print-area table.pgrid td {
  text-align: right; padding: 8px 10px; border-bottom: 1px solid #ccc; }
#print-area table.pgrid th:nth-child(-n+2),
#print-area table.pgrid td:nth-child(-n+2) { text-align: left; }
#print-area table.pgrid thead th { border-bottom: 2px solid #000;
  font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }

/* branded print header (logo + customer) */
#print-area .print-head {
  display: flex; justify-content: space-between; align-items: flex-start;
  border-bottom: 3px solid #000; padding-bottom: 10px; margin-bottom: 14px;
  gap: 24px;
}
#print-area .print-head h2 { margin: 0 0 2px; }
#print-area .print-head .cust { font-size: 16px; margin: 4px 0 2px; }
#print-area .dealer-logo { max-height: 64px; max-width: 250px; }
#print-area .dealer-name { text-align: right; font-weight: 800;
  font-size: 18px; line-height: 1.15; letter-spacing: .02em; }

/* vehicle block with thumbnail */
#print-area .veh-block { display: flex; gap: 16px; align-items: center;
  margin-bottom: 6px; }
#print-area .print-thumb { width: 168px; height: 116px; object-fit: cover;
  border-radius: 6px; border: 1px solid #bbb; flex: 0 0 auto; }
#print-area .veh-meta h3 { margin: 0 0 4px; }
#print-area .veh-meta p { margin: 2px 0; }

/* payment matrix (down x term) */
#print-area table.paygrid { width: 100%; border-collapse: collapse;
  margin-top: 10px; table-layout: fixed; }
#print-area table.paygrid th, #print-area table.paygrid td {
  border: 1px solid #999; padding: 9px 8px; text-align: center;
  width: 25%; height: 58px; vertical-align: middle; }
#print-area table.paygrid thead th { border-bottom: 2px solid #000;
  font-size: 12px; text-transform: uppercase; letter-spacing: .03em; }
#print-area table.paygrid tbody th { text-align: left; font-weight: 800; }
#print-area table.paygrid tbody td { font-weight: 700; font-size: 16px; }
#print-area table.paygrid .dn { display: block; font-weight: 400;
  font-size: 10px; color: #555; text-transform: uppercase; }

/* bill-of-sale financing terms strip */
#print-area .bos-terms { display: flex; gap: 16px; margin-top: 16px;
  border: 1px solid #999; border-radius: 6px; padding: 12px 14px; }
#print-area .bos-terms > div { flex: 1; display: flex; flex-direction: column;
  gap: 2px; }
#print-area .bos-terms .muted { font-size: 11px; text-transform: uppercase;
  letter-spacing: .03em; }
#print-area .bos-terms strong { font-size: 16px; }
#print-area .bos-terms strong.big { font-size: 22px; font-weight: 800; }

/* signature lines */
#print-area .sig-row { display: flex; gap: 48px; margin-top: 46px; }
#print-area .sig { flex: 1; font-size: 12px; color: #333; }
#print-area .sig-line { border-bottom: 1.5px solid #000; height: 36px;
  margin-bottom: 4px; }

/* ---------- Responsive ---------- */
@media (max-width: 880px) {
  #app { flex-direction: column; }
  .sidebar { width: auto; flex-direction: row; align-items: center;
    padding: 8px 10px; overflow-x: auto; border-right: 0;
    border-bottom: 1px solid rgba(232,148,26,.18); }
  .side-brand { padding: 6px 10px; margin-top: 0; }
  .brand-text { display: none; }
  .side-nav { flex-direction: row; flex: 1; margin-top: 0; }
  .side-nav .tab span { display: none; }
  .side-nav .tab { padding: 10px; }
  .side-foot { border: 0; padding: 0; flex-direction: row; }
  .who-line { display: none; }
  .kpi-row { grid-template-columns: repeat(2, 1fr); }
  .main { padding: 18px; }
  /* the top-bar nav can't slide off — turn the collapse feature off here.
     transition:none so crossing the 880px breakpoint while collapsed doesn't
     animate the margin/padding change as an accidental slide. */
  .nav-toggle { display: none; }
  .sidebar, .main { transition: none; }
  #app.nav-collapsed .sidebar { margin-left: 0; }
  #app.nav-collapsed .main { padding-left: 18px; }
}

/* ---------- Settings tab — theme buttons ---------- */
.theme-row { display: flex; gap: 10px; margin-top: 12px;
  flex-wrap: wrap; }
.theme-btn { min-width: 110px; }

/* ---------- Dark mode (.dark applied by JS on <html>) -------------- */
html.dark {
  --bg-app: #0a1124;
  --panel: #131b30;
  --ink: #e6ebf6;
  --muted: #9aaace;
  --line: #243152;
  --line-2: #1b2745;
  --brand-soft: rgba(232,154,18,.20);
  --green-bg: rgba(34,197,94,.18);
  --amber-bg: rgba(245,158,11,.20);
  --red-bg: rgba(220,38,38,.22);
  --shadow-sm: 0 1px 2px rgba(0,0,0,.4), 0 1px 3px rgba(0,0,0,.35);
  --shadow-md: 0 8px 24px rgba(0,0,0,.45);
}
html.dark body { color: var(--ink); }
html.dark .auth-card, html.dark .modal-card, html.dark .card,
html.dark .kpi { background: var(--panel); color: var(--ink); }
html.dark .auth-card h1 { color: var(--ink); }
html.dark .params-grid input, html.dark .params-grid select,
html.dark .modal-card label input, html.dark .modal-card label select,
html.dark .auth-card input,
html.dark .reb-row input, html.dark #cond-filter,
html.dark .results-toolbar input:not([type=checkbox]),
html.dark #inv-filter, html.dark .lease-filter {
  background: #0f1830; color: var(--ink); border-color: var(--line);
}
html.dark .params-grid input:disabled {
  background: #1a2238; color: #6e7c95; }
html.dark .btn { background: var(--panel); color: var(--ink);
  border-color: var(--line); }
html.dark .btn:hover { background: #1c2540; border-color: #2a3658; }
/* Primary buttons (Work Deal, Calculate, etc.): html.dark .btn above was
   overriding the gold gradient with a dark panel, leaving dark text on a dark
   fill (invisible). Re-assert the gold fill so they read in dark mode. */
html.dark .btn.primary {
  background: linear-gradient(135deg, var(--gold1), var(--gold2));
  border-color: var(--gold2); color: #1c1405;
  box-shadow: 0 3px 12px rgba(232,148,26,.30);
}
html.dark .btn.primary:hover { filter: brightness(1.06); }
html.dark .btn.ghost { background: transparent; border-color: var(--line);
  color: var(--muted); }
html.dark .btn.ghost:hover { background: rgba(255,255,255,.06); color: #fff; }
html.dark .btn.danger { background: var(--panel); color: var(--red);
  border-color: #592226; }
html.dark .btn.danger:hover { background: rgba(220,38,38,.18); }

/* Dark-mode scrollbars — the default light OS bars clashed with the theme. */
html.dark { scrollbar-color: #3d4c72 var(--bg-app); scrollbar-width: thin; }
html.dark ::-webkit-scrollbar { width: 12px; height: 12px; }
html.dark ::-webkit-scrollbar-track { background: var(--bg-app); }
html.dark ::-webkit-scrollbar-thumb { background: #3d4c72; border-radius: 7px;
  border: 3px solid var(--bg-app); }
html.dark ::-webkit-scrollbar-thumb:hover { background: #556699; }
html.dark ::-webkit-scrollbar-corner { background: var(--bg-app); }

/* Conditional-offer pills: a dark-friendly translucent violet instead of the
   light lavender chip (which floated oddly on the dark theme). */
html.dark .cond-pill { background: rgba(139,92,246,.18); color: #c9b8fb;
  border-color: rgba(139,92,246,.42); }
html.dark .cond-pill.is-clickable:hover { background: rgba(139,92,246,.32);
  border-color: rgba(167,139,250,.75); }
html.dark .cond-pill.is-clickable.active { background: #7c3aed; color: #fff;
  border-color: #8b5cf6; }
/* Review-modal cash inputs (in a table cell, not a <label>) need the dark
   field styling too. */
html.dark .cr-amt, html.dark .cr-cond {
  background: var(--bg-app); color: var(--ink); border-color: var(--line); }
html.dark .table-scroll { border-color: var(--line); }
html.dark table.data { color: var(--ink); }
html.dark table.data thead th { background: #060c1c;
  color: #aab6cc; border-bottom-color: #060c1c; }
html.dark table.data tbody tr:nth-child(even) { background: #182241; }
html.dark table.data tbody tr:hover { background: rgba(232,154,18,.10); }
html.dark table.data th, html.dark table.data td {
  border-bottom-color: var(--line); }
html.dark .empty { color: var(--muted); }
html.dark .toast { background: #1a2238; }
html.dark .rebate-box { background: #11192e; border-color: var(--line); }
html.dark .stock-link { color: var(--gold1); }
html.dark .stock-link:hover { color: var(--gold2); }
html.dark .page-head h1 { color: var(--ink); }

/* ---- per-vehicle expander (photo / Carfax / links / specs) ---- */
.exp-toggle {
  border: none; background: transparent; cursor: pointer;
  font-size: 12px; line-height: 1; padding: 2px 5px; margin-right: 4px;
  color: var(--brand); border-radius: 4px; vertical-align: middle;
}
.exp-toggle:hover { background: var(--brand-soft); }
tr.veh-exp > td { padding: 0; background: rgba(0,0,0,.025); }
/* Pin the card to the left of the scroll viewport so it stays visible
   and compact even though the results table is far wider than the screen. */
.veh-card {
  position: sticky; left: 0;
  display: flex; gap: 18px; align-items: flex-start;
  padding: 14px 16px; width: fit-content;
  max-width: calc(100vw - 60px);
}
.veh-photo {
  width: 200px; height: 140px; object-fit: cover; border-radius: 8px;
  background: #e9eef5; flex: 0 0 auto; box-shadow: var(--shadow-sm);
}
.veh-photo.noimg {
  display: flex; align-items: center; justify-content: center;
  color: #98a3b5; font-size: 13px; border: 1px dashed #c2cad6;
  box-shadow: none;
}
.veh-card-body { flex: 0 1 auto; min-width: 260px; }
.veh-links { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.veh-specs {
  display: grid; grid-template-columns: max-content max-content;
  justify-content: start; gap: 5px 16px;
  font-size: 13px; align-items: baseline;
}
.veh-specs .k { color: var(--muted); white-space: nowrap; }
.veh-specs .val { font-weight: 600; }
.veh-books { margin-top: 14px; border-top: 1px solid var(--line);
  padding-top: 10px; }
.veh-books h4 { margin: 8px 0 4px; font-size: 11px; letter-spacing: .04em;
  text-transform: uppercase; color: var(--muted); }
.veh-books h4:first-child { margin-top: 0; }

html.dark tr.veh-exp > td { background: rgba(255,255,255,.03); }
html.dark .veh-photo { background: #0f1830; }
html.dark .veh-photo.noimg { border-color: #2a3658; color: #6e7c95; }

/* ---- inline quick-edit cells (Inventory tab) ---- */
td.editable { cursor: pointer; position: relative; }
td.editable:hover { background: var(--brand-soft); border-radius: 4px; }
td.editable:hover::after {
  content: "✎"; font-size: 10px; color: var(--brand);
  position: absolute; top: 2px; right: 3px; opacity: .7;
}
input.cell-edit {
  width: 100%; box-sizing: border-box; padding: 3px 5px;
  font: inherit; text-align: right; border: 1px solid var(--brand);
  border-radius: 4px; background: #fff; color: #111;
}
html.dark input.cell-edit { background: #0f1830; color: var(--ink); }
