/* Layout: black top bar, one working column (max 1400px); the car screen splits into a work area and a price rail. */
:root {
  --bg: #F3F3F1;
  --panel: #FFFFFF;
  --ink: #141414;
  --muted: #5E5E5A;
  --line: #E1E1DC;
  --soft: #ECECE8;
  --bar: #0B0B0B;
  --bar-ink: #F5F5F3;
  --bar-muted: #A3A39E;
  --accent: #F58220;
  --accent-ink: #111111;
  --accent-soft: #FDEBDA;
  --accent-text: #A34F00;
  --good: #1E6B3A;
  --good-soft: #E1F1E6;
  --warn: #8F4A00;
  --warn-soft: #FDEEDB;
  --bad: #B3261E;
  --bad-soft: #FBE4E2;
  --f-display: 'Barlow Condensed', 'Arial Narrow', sans-serif;
  --f-body: 'IBM Plex Sans', 'Helvetica Neue', Arial, sans-serif;
  --f-mono: 'IBM Plex Mono', ui-monospace, Menlo, monospace;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #111110; --panel: #1A1A19; --ink: #EDEDEA; --muted: #A2A29C; --line: #2E2E2B; --soft: #242422;
    --bar: #000000; --bar-ink: #F5F5F3; --bar-muted: #9A9A94;
    --accent: #F58220; --accent-ink: #111111; --accent-soft: #3A2512; --accent-text: #F7A35C;
    --good: #7FD39B; --good-soft: #17301F; --warn: #F2B266; --warn-soft: #36260F; --bad: #F2948C; --bad-soft: #3A1714;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #111110; --panel: #1A1A19; --ink: #EDEDEA; --muted: #A2A29C; --line: #2E2E2B; --soft: #242422;
  --bar: #000000; --bar-ink: #F5F5F3; --bar-muted: #9A9A94;
  --accent: #F58220; --accent-ink: #111111; --accent-soft: #3A2512; --accent-text: #F7A35C;
  --good: #7FD39B; --good-soft: #17301F; --warn: #F2B266; --warn-soft: #36260F; --bad: #F2948C; --bad-soft: #3A1714;
  color-scheme: dark;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 14px/1.45 var(--f-body); }
body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 10; background: var(--bar); }
a { color: var(--accent-text); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.num { font-variant-numeric: tabular-nums; }
.mono { font-family: var(--f-mono); font-size: 12px; }
.mut { color: var(--muted); }

/* Top bar */
.bar { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 5; background: var(--bar); color: var(--bar-ink); }
.bar-in { max-width: 1400px; margin: 0 auto; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 20px;
  padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); min-height: 56px; }
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--bar-ink); white-space: nowrap; }
.brand .logo { height: 20px; width: auto; display: block; }
.brand .prod { font-family: var(--f-display); font-weight: 600; font-size: 20px; letter-spacing: .14em; text-transform: uppercase; color: var(--bar-ink);
  padding-left: 12px; border-left: 1px solid #3A3A38; line-height: 22px; }
.nav { display: flex; flex-wrap: wrap; gap: 2px; }
.nav a { color: var(--bar-muted); text-decoration: none; padding: 17px 10px 15px; border-bottom: 3px solid transparent; }
.nav a:hover { color: var(--bar-ink); }
.nav a[aria-current="page"] { color: var(--bar-ink); border-bottom-color: var(--accent); font-weight: 600; }
.who { margin-left: auto; display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--bar-muted); flex-wrap: wrap; }
.who select, .who .lnk { background: transparent; color: var(--bar-ink); border: 1px solid #3A3A38; border-radius: 6px; padding: 6px 8px; min-height: 36px; }
.who .lnk { cursor: pointer; }
.demo-band { background: var(--accent); color: var(--accent-ink); font-size: 13px; }
.demo-band div { max-width: 1400px; margin: 0 auto; padding: 6px max(16px, env(safe-area-inset-right, 0px)) 6px max(16px, env(safe-area-inset-left, 0px)); }

/* Page */
.page { max-width: 1400px; margin: 0 auto; padding-block: 24px 64px;
  padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px));
  display: flex; flex-direction: column; gap: 20px; }
.head { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px 16px; }
.head .grow { flex: 1 1 320px; min-width: 0; }
h1 { margin: 0; font-family: var(--f-display); font-weight: 700; font-size: clamp(30px, 4vw, 42px); line-height: 1.05; text-wrap: balance; }
h2 { margin: 0; font-size: 15px; font-weight: 600; }
.sub { color: var(--muted); font-size: 13px; }
.back { font-size: 13px; text-decoration: none; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 0 16px;
  border-radius: 6px; border: 1px solid var(--ink); background: var(--panel); cursor: pointer; text-decoration: none; color: var(--ink); white-space: nowrap; }
.btn:hover { background: var(--soft); }
.btn.pri { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.btn.pri:hover { filter: brightness(.95); }
.btn.sm { min-height: 36px; padding: 0 12px; font-size: 13px; }
.btn.ghost { border-color: var(--line); }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

/* Filter chips */
.chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.chip { border: 1px solid var(--line); background: var(--panel); border-radius: 999px; padding: 0 14px; min-height: 38px; cursor: pointer; display: inline-flex; align-items: center; gap: 8px; }
.chip b { font-weight: 600; font-variant-numeric: tabular-nums; }
.chip[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.search { flex: 1 1 220px; min-width: 0; max-width: 340px; margin-left: auto; min-height: 38px; border: 1px solid var(--line); border-radius: 6px; padding: 0 12px; background: var(--panel); }

/* Summary tiles */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; }
.tile { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; }
.tile .k { font-size: 12px; color: var(--muted); }
.tile .v { font-family: var(--f-display); font-weight: 700; font-size: 30px; line-height: 1.1; font-variant-numeric: tabular-nums; }
.tile.alert .v { color: var(--accent-text); }

/* Tables */
.box { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; }
.scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); padding: 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
td.r, th.r { text-align: right; font-variant-numeric: tabular-nums; }
.inv tbody tr { cursor: pointer; }
.inv tbody tr:hover { background: var(--soft); }
.car { display: flex; gap: 10px; align-items: center; min-width: 240px; }
.thumb { width: 64px; height: 44px; border-radius: 4px; background: var(--soft); object-fit: cover; flex: none; display: block; }
.car b { display: block; font-weight: 600; }
.car a { color: inherit; text-decoration: none; }

.pill { display: inline-block; font-size: 12px; padding: 2px 8px; border-radius: 999px; white-space: nowrap; font-weight: 500; }
.p-good { background: var(--good-soft); color: var(--good); }
.p-warn { background: var(--warn-soft); color: var(--warn); }
.p-bad { background: var(--bad-soft); color: var(--bad); }
.p-mute { background: var(--soft); color: var(--muted); }
.p-acc { background: var(--accent-soft); color: var(--accent-text); }
.ticks { display: flex; gap: 4px; flex-wrap: wrap; }

/* Car screen */
.split { display: flex; flex-wrap: wrap; gap: 20px; align-items: flex-start; }
.work { flex: 999 1 640px; min-width: 0; display: flex; flex-direction: column; gap: 20px; }
.rail { flex: 1 1 340px; min-width: 0; position: sticky; top: calc(env(safe-area-inset-top, 0px) + 72px); display: flex; flex-direction: column; gap: 14px;
  background: var(--panel); border: 2px solid var(--ink); border-radius: 10px; padding: 18px; }
.sec { padding: 18px; display: flex; flex-direction: column; gap: 14px; }
.sec-h { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: baseline; }
.sec-h .sub { margin-right: auto; }
.books { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; }
.book { border: 1px solid var(--line); border-radius: 6px; padding: 12px; display: flex; flex-direction: column; gap: 2px; }
.book .src { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; }
.book .amt { font-family: var(--f-display); font-weight: 700; font-size: 26px; font-variant-numeric: tabular-nums; }
.book .amt.none { color: var(--muted); font-size: 18px; font-family: var(--f-body); font-weight: 500; padding-block: 6px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; }
.stat .k { font-size: 12px; color: var(--muted); }
.stat .v { font-family: var(--f-display); font-size: 26px; font-weight: 700; font-variant-numeric: tabular-nums; }

.lines { display: flex; flex-direction: column; gap: 6px; font-size: 14px; }
.lines div { display: flex; justify-content: space-between; gap: 12px; }
.lines .tot { border-top: 1px solid var(--line); padding-top: 6px; font-weight: 600; }
.sugg { background: var(--soft); border-radius: 6px; padding: 12px; font-size: 13px; display: flex; flex-direction: column; gap: 4px; }
.sugg b { font-size: 16px; }

/* Forms */
.form { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field label, .lbl { font-size: 12px; font-weight: 600; color: var(--muted); }
.field input, .field select, .field textarea { min-height: 42px; border: 1px solid var(--line); border-radius: 6px; padding: 8px 10px; background: var(--panel); width: 100%; }
.field textarea { min-height: 96px; resize: vertical; }
.field.wide { grid-column: 1 / -1; }
.big input { font-size: 22px; font-weight: 600; border-color: var(--ink); font-variant-numeric: tabular-nums; }
.inline-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-end; }
.inline-form .field { flex: 1 1 130px; }
.check { display: flex; gap: 8px; align-items: center; min-height: 32px; }
.note { font-size: 12px; color: var(--muted); }
.msg { border-radius: 6px; padding: 10px 12px; font-size: 13px; }
.msg.ok { background: var(--good-soft); color: var(--good); }
.msg.err { background: var(--bad-soft); color: var(--bad); }

/* Settings */
.grid-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.icard { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 14px; display: flex; flex-direction: column; gap: 8px; }
.icard .top { display: flex; justify-content: space-between; gap: 8px; align-items: flex-start; }
.icard p { margin: 0; font-size: 13px; color: var(--muted); }
.group-h { font-family: var(--f-display); font-size: 22px; font-weight: 700; margin: 8px 0 0; }
.switch { position: relative; width: 44px; height: 26px; flex: none; }
.switch input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.switch span { position: absolute; inset: 0; background: var(--line); border-radius: 999px; transition: background .15s; pointer-events: none; }
.switch span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: var(--panel); transition: transform .15s; }
.switch input:checked + span { background: var(--accent); }
.switch input:checked + span::after { transform: translateX(18px); }
.switch input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Sign-in: same look as the HBi team sign-in (dashboard.hbiauto.com/team) */
.si-page { min-height: 100vh; background: #000; color: #fff; display: grid; place-items: center;
  padding-block: 32px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
.si-wrap { width: 100%; max-width: 420px; display: grid; gap: 16px; }
.si-brand { display: flex; justify-content: center; align-items: center; gap: 12px; }
.si-brand .logo { height: 28px; width: auto; }
.si-brand .prod { font-family: var(--f-display); font-weight: 600; font-size: 22px; letter-spacing: .14em; text-transform: uppercase; color: #fff; padding-left: 12px; border-left: 1px solid #3A3A38; }
.si-card { background: #0E0E0E; border: 1px solid rgba(255,255,255,.12); border-top: 3px solid #F58220; border-radius: 8px; padding: 24px 24px 26px; display: grid; gap: 14px; box-shadow: 0 24px 70px rgba(0,0,0,.7); }
.si-h { font-family: var(--f-display); text-transform: uppercase; letter-spacing: .1em; font-size: 17px; font-weight: 700; text-align: center; margin: 0; }
.si-note { font-size: 13px; color: #A8A8A3; margin: 0; text-align: center; }
.si-note a { color: #F7A35C; }
.si-foot { text-align: center; font-size: 12px; color: #7A7A75; margin: 0; }
.si-form { display: grid; gap: 8px; }
.si-l { font-family: var(--f-display); font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: #8F8F8A; }
.si-i { background: #0D0D0D; border: 1px solid rgba(255,255,255,.4); border-radius: 3px; padding: 11px 12px; color: #fff; min-width: 0; font: inherit; min-height: 44px; }
.si-i:focus-visible { outline: 2px solid #F58220; outline-offset: 1px; }
.si-code { font-size: 22px; letter-spacing: .3em; }
.si-go { width: 100%; }
.si-links { display: flex; gap: 6px 16px; justify-content: flex-end; flex-wrap: wrap; font-size: 13px; }
.si-socs { display: grid; gap: 8px; }
.si-soc { background: #fff; color: #1f1f1f; border: 1px solid #dadce0; font-weight: 600; width: 100%; }
.si-soc:hover { background: #f2f2f2; }
.si-or { display: flex; align-items: center; gap: 10px; color: #7A7A75; font-size: 12px; }
.si-or::before, .si-or::after { content: ""; flex: 1; height: 1px; background: rgba(255,255,255,.15); }
.si-msg { margin: 0; font-size: 13.5px; min-height: 1px; text-align: center; }
.si-msg.bad { color: #F2948C; } .si-msg.ok { color: #7FD39B; }
.linkbtn { background: none; border: 0; color: #F7A35C; text-decoration: underline; cursor: pointer; padding: 0; font: inherit; font-size: 13px; }
.si-card .btn.pri { color: #111; }
.empty { padding: 40px 16px; text-align: center; color: var(--muted); }

/* Shared */
.vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.count { display: inline-block; min-width: 22px; padding: 0 6px; margin-left: 4px; border-radius: 999px; background: var(--soft); color: var(--muted); font-size: 12px; text-align: center; font-variant-numeric: tabular-nums; }
a.tile { text-decoration: none; color: var(--ink); }
a.tile:hover { border-color: var(--ink); }
.stack { display: flex; flex-direction: column; gap: 12px; }
.lblrow { display: flex; justify-content: space-between; align-items: flex-end; gap: 8px; }
.form.one { grid-template-columns: 1fr; }
.form.two { grid-template-columns: repeat(2, minmax(0, 1fr)); margin-top: 10px; }
details summary { cursor: pointer; }

/* Today */
.cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 380px), 1fr)); gap: 16px; align-items: start; }
.q { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.q li { display: flex; flex-wrap: wrap; gap: 2px 10px; align-items: baseline; padding: 8px 0; border-top: 1px solid var(--line); }
.q li:first-child { border-top: 0; }
.q li a { font-weight: 600; text-decoration: none; color: var(--ink); }
.q li a:hover { color: var(--accent-text); }
.q-x { margin-left: auto; font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }

/* Pricing grid */
.grid td { padding-block: 6px; }
.pin { width: 120px; min-height: 38px; border: 1px solid var(--line); border-radius: 6px; padding: 0 8px; text-align: right; background: var(--panel); font-variant-numeric: tabular-nums; font-weight: 600; }
tr.changed { background: var(--accent-soft); }
tr.changed .pin { border-color: var(--accent); }
.savebar { position: sticky; bottom: 0; z-index: 4; display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; background: var(--panel); border: 1px solid var(--line); border-radius: 8px;
  padding: 12px; padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px)); box-shadow: 0 -6px 18px rgba(0,0,0,.08); }

/* Recon */
.board { display: grid; grid-template-columns: repeat(6, minmax(200px, 1fr)); gap: 10px; overflow-x: auto; padding-bottom: 6px; }
.lane { background: var(--soft); border-radius: 8px; padding: 10px; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.lane h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .05em; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: 10px; display: flex; flex-direction: column; gap: 4px; }
.card a { color: var(--ink); text-decoration: none; }
.card.stuck { border-color: var(--accent); box-shadow: inset 3px 0 0 var(--accent); }
.card .btn { margin-top: 4px; }
.stages { display: flex; flex-wrap: wrap; gap: 6px; }
.stage { border: 1px solid var(--line); background: var(--panel); border-radius: 6px; min-height: 38px; padding: 0 12px; cursor: pointer; }
.stage[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.stage[disabled] { cursor: default; }

/* Price to market vs target, aging rows, scatter */
.ptm-hi { color: var(--warn); font-weight: 600; }
.ptm-lo { color: #2F63B8; font-weight: 600; }
.ptm-ok { color: var(--good); font-weight: 600; }
tr.warnrow td { background: var(--warn-soft); }
.scatter { margin: 0; }
.scatter svg { width: 100%; height: auto; display: block; }
.sc-grid { stroke: var(--line); stroke-width: 1; }
.sc-lab { fill: var(--muted); font-size: 11px; font-family: var(--f-body); }
.sc-me { fill: var(--accent); stroke: var(--ink); stroke-width: 2; }
.sc-sold { fill: var(--good); }
.sc-ask { fill: var(--muted); }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; vertical-align: middle; }
.dot.sc-me { background: var(--accent); } .dot.sc-sold { background: var(--good); } .dot.sc-ask { background: var(--muted); }

@media (max-width: 720px) {
  .who { margin-left: 0; width: 100%; padding-bottom: 8px; }
  .rail { position: static; }
  .search { max-width: none; margin-left: 0; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
