/* CarFlip — mobile-first. Desktop is a three-column macOS glass-black workspace.
   Palette is unchanged from the original desk: only opacity, blur and hairline
   borders are new. No hue was introduced. */
:root {
  /* --- colour (identical to the original desk palette) --- */
  --bg: #0b0f14;
  --panel: #131a23;
  --panel-2: #182230;
  --line: #22303f;
  --txt: #e6edf3;
  --dim: #8b98a8;
  --accent: #37d67a;
  --accent-dim: #123b28;
  --warn: #f2b53d;
  --bad: #f4536b;
  --info: #4aa8ff;

  /* --- glass (same palette, translucent) --- */
  --glass-1: rgba(255, 255, 255, .045);
  --glass-2: rgba(255, 255, 255, .07);
  --glass-3: rgba(255, 255, 255, .11);
  --hair: rgba(255, 255, 255, .085);
  --hair-strong: rgba(255, 255, 255, .15);
  --inset: inset 0 1px 0 rgba(255, 255, 255, .07);
  --shadow: 0 24px 60px rgba(0, 0, 0, .55);
  --blur: saturate(150%) blur(26px);

  --radius: 14px;
  --radius-lg: 18px;
  --tap: 44px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  /* Near-black with the desk's own green / blue / amber bled in at low alpha,
     so the glass has something to sit on. Same hues, no new ones. */
  background:
    radial-gradient(1100px 720px at 8% -12%, rgba(55, 214, 122, .15), transparent 62%),
    radial-gradient(960px 620px at 102% -4%, rgba(74, 168, 255, .13), transparent 58%),
    radial-gradient(820px 560px at 50% 116%, rgba(242, 181, 61, .07), transparent 62%),
    #070a0e;
  background-attachment: fixed;
  color: var(--txt);
  font: 15px/1.45 var(--font);
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}
/* On a phone the glass has no room to read as glass, and a strong wash just tints the
   top edge — keep the original near-flat black there. */
@media (max-width: 719px) {
  body {
    background:
      radial-gradient(700px 420px at 12% -8%, rgba(55, 214, 122, .07), transparent 62%),
      radial-gradient(640px 380px at 104% -2%, rgba(74, 168, 255, .06), transparent 58%),
      #0b0f14;
  }
}
a { color: var(--info); text-decoration: none; }
button, select, input, textarea { font: inherit; color: inherit; }
/* A component that sets its own display beats the browser's [hidden] rule, so `hidden`
   silently stops working — a toggled button stays on screen next to the row it opened. */
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid rgba(55, 214, 122, .6); outline-offset: 2px; }
::selection { background: rgba(55, 214, 122, .28); }

.app { min-height: 100dvh; display: flex; flex-direction: column; }

/* ---------------------------------------------------------------- top bar */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(8px + env(safe-area-inset-top, 0px)) 14px 8px;
  background: rgba(11, 15, 20, .78);
  -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur);
  border-bottom: 1px solid var(--hair);
  box-shadow: 0 1px 0 rgba(0, 0, 0, .4), var(--inset);
}
.brand { display: flex; align-items: center; gap: 8px; letter-spacing: .08em; font-size: 13px; }
.brand .sub { color: var(--dim); letter-spacing: .04em; text-transform: none; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 8px var(--accent); }
.dot.off { background: var(--bad); box-shadow: 0 0 8px var(--bad); }
.topbar-right { display: flex; gap: 4px; }

/* macOS window buttons — drawn with the desk's own red / amber / green. */
.traffic { display: none; gap: 7px; margin-right: 6px; }
.traffic i {
  width: 11px; height: 11px; border-radius: 50%; display: block;
  border: 1px solid rgba(0, 0, 0, .35);
}
.traffic i:nth-child(1) { background: var(--bad); box-shadow: 0 0 6px rgba(244, 83, 107, .5); }
.traffic i:nth-child(2) { background: var(--warn); box-shadow: 0 0 6px rgba(242, 181, 61, .45); }
.traffic i:nth-child(3) { background: var(--accent); box-shadow: 0 0 6px rgba(55, 214, 122, .45); }

.ghost {
  background: transparent; border: 1px solid transparent; border-radius: 10px;
  min-width: var(--tap); min-height: 36px; padding: 0 8px; color: var(--dim); cursor: pointer;
  transition: background .15s ease, color .15s ease;
}
.ghost:hover { background: var(--glass-2); color: var(--txt); }
.ghost:active { background: var(--glass-3); }
/* The findings report is a full page, not a view: a plain anchor that the phone can tap. */
a.findings-link {
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 12px; letter-spacing: .04em; text-transform: uppercase;
  text-decoration: none; color: var(--dim);
}
a.findings-link:hover { color: var(--txt); }
.bell { position: relative; }
.badge {
  position: absolute; top: -2px; right: -2px; background: var(--bad); color: #fff;
  border-radius: 999px; font-size: 10px; padding: 1px 5px; font-weight: 700;
}

/* ------------------------------------------------------------------- view */
.view {
  flex: 1; padding: 12px 12px calc(78px + var(--safe-b));
  max-width: 780px; width: 100%; margin: 0 auto;
}
.loading { color: var(--dim); padding: 40px 0; text-align: center; }
h2.section {
  font-size: 12px; text-transform: uppercase; letter-spacing: .1em; color: var(--dim);
  margin: 20px 2px 8px; font-weight: 600;
}
.back { display: inline-flex; align-items: center; gap: 6px; color: var(--dim); margin-bottom: 8px; font-size: 13px; }

/* ------------------------------------------------------- 3-column workspace */
/* Mobile first: one column, same reading order the desk has always had —
   overview (stats + filters), then closest-to-a-deal, then the feed. */
.workspace {
  display: grid; gap: 12px; min-width: 0;
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas: "overview" "deals" "feed";
}
.pane { min-width: 0; }
.pane-overview { grid-area: overview; }
.pane-feed { grid-area: feed; }
.pane-deals { grid-area: deals; }
/* Detail screen: vehicle + analysis + money | work | paperwork.
   Order here is byte-for-byte the old single-column order, so the phone is unchanged. */
.workspace.detail { grid-template-areas: "vehicle" "work" "paper"; }
.pane-vehicle { grid-area: vehicle; }
.pane-work { grid-area: work; }
.pane-paper { grid-area: paper; }
/* Find reads search → marketplaces → policy on a phone, but the policy column sits on the
   right once there are three of them. */
.workspace.find { grid-template-areas: "overview" "feed" "deals"; }
.pane > h2.section:first-child { margin-top: 4px; }
/* Column label — only the desktop workspace needs it; the phone never had one. */
.pane-head { display: none; }
/* Rail-only detail: it gives the third column a job on a desktop, and would only push the
   feed further down on a phone. */
.rail-extra { display: none; }
.grade-spread { display: flex; flex-wrap: wrap; gap: 6px; }
.grade-pill.A { color: var(--accent); border-color: #1f5a3c; background: #0f2a1d; }
.grade-pill.B { color: #7fe0a2; border-color: #1d3a28; background: #12251a; }
.grade-pill.C { color: var(--warn); border-color: #4a3a17; background: #2a2210; }
.grade-pill.D { color: var(--bad); border-color: #4a1f27; background: #2a1015; }

/* --------------------------------------------------------------- stat grid */
.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.stat {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 10px 12px; min-height: 62px; display: flex; flex-direction: column; justify-content: space-between;
}
.stat .k { font-size: 10.5px; color: var(--dim); text-transform: uppercase; letter-spacing: .07em; }
.stat .v { font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; }
.stat.good .v { color: var(--accent); }
.stat.warn .v { color: var(--warn); }
.stat.bad .v { color: var(--bad); }
.stat small { color: var(--dim); font-size: 11px; }

/* ------------------------------------------------------------------- cards */
.card {
  display: block; background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); margin-bottom: 8px; overflow: hidden; color: var(--txt);
}
.card-row { display: flex; gap: 10px; padding: 10px; align-items: stretch; }
.thumb {
  width: 84px; min-width: 84px; height: 68px; border-radius: 10px; background: var(--panel-2);
  display: flex; align-items: center; justify-content: center; overflow: hidden; color: var(--dim);
  font-size: 11px; text-align: center; position: relative;
}
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.card-main { flex: 1; min-width: 0; }
.card-main .t { font-weight: 600; font-size: 14.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-main .m { color: var(--dim); font-size: 12px; margin-top: 2px; display: flex; gap: 8px; flex-wrap: wrap; }
.card-main .row1 { display: flex; align-items: center; gap: 8px; font-size: 14.5px; }
.card-main .sub { color: var(--dim); font-size: 12.5px; margin-top: 3px; }
.card-main .p { font-size: 17px; font-weight: 700; margin-top: 4px; font-variant-numeric: tabular-nums; }
.card-main .p .est { font-size: 12px; font-weight: 600; color: var(--accent); margin-left: 8px; }
.card-side { display: flex; flex-direction: column; align-items: flex-end; justify-content: space-between; gap: 6px; }
.grade {
  font-weight: 800; font-size: 13px; width: 26px; height: 26px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center; background: var(--panel-2); color: var(--dim);
}
.grade.A { background: var(--accent-dim); color: var(--accent); }
.grade.B { background: #1d3324; color: #7fe0a2; }
.grade.C { background: #33291d; color: var(--warn); }
.grade.D { background: #331d22; color: var(--bad); }
.pill {
  font-size: 10px; text-transform: uppercase; letter-spacing: .05em; padding: 3px 7px;
  border-radius: 999px; background: var(--panel-2); color: var(--dim); border: 1px solid var(--line);
  white-space: nowrap;
}
.pill.live { color: var(--accent); border-color: #1f5a3c; background: #0f2a1d; }
.pill.connected { color: var(--warn); border-color: #4a3a17; background: #2a2210; }
.pill.configured { color: var(--dim); }
.pill.disabled { color: var(--bad); border-color: #4a1f27; background: #2a1015; }
.pill.removed, .pill.sold { color: var(--warn); }

/* ------------------------------------------------------------------ filters */
.filters { display: flex; gap: 6px; overflow-x: auto; padding: 2px 0 8px; scrollbar-width: none; }
.filters::-webkit-scrollbar { display: none; }
.chip {
  white-space: nowrap; font-size: 12px; padding: 7px 11px; border-radius: 999px;
  background: var(--panel); border: 1px solid var(--line); color: var(--dim); cursor: pointer;
  transition: background .15s ease, color .15s ease, border-color .15s ease;
}
.chip.on { background: var(--accent-dim); border-color: #1f5a3c; color: var(--accent); }
.searchbox { display: flex; gap: 6px; margin-bottom: 8px; }
.searchbox input {
  flex: 1; background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
  padding: 11px 12px; min-height: var(--tap);
  /* Without this a number input refuses to shrink past its intrinsic width and pushes
     the button out of the row. */
  min-width: 0;
}
.searchbox .btn { flex: 0 0 auto; }
.btn {
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px;
  padding: 11px 14px; min-height: var(--tap); cursor: pointer; font-weight: 600;
}
.btn.primary { background: var(--accent); border-color: var(--accent); color: #07130c; }
.btn.small { padding: 7px 10px; min-height: 34px; font-size: 12.5px; }
.btn.wide { width: 100%; }
/* When a .btn is an <a>, the global link colour wins and it reads as a link, not a button. */
a.btn { color: var(--txt); display: inline-flex; align-items: center; justify-content: center; gap: 6px; }

/* Paste-a-link row: appears only where the exact ad URL was never captured. */
.fixlink { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; width: 100%; margin-top: 8px; }
.fixlink[hidden] { display: none; }
.fixlink .input {
  flex: 1 1 220px; min-width: 0;
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 9px;
  padding: 9px 10px; min-height: 40px;
}
.fixlink .input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }

/* ------------------------------------------------------------- detail page */
.hero { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; margin-bottom: 10px; }
.hero h1 { font-size: 19px; margin: 0 0 4px; line-height: 1.25; }
.hero .price { font-size: 26px; font-weight: 800; font-variant-numeric: tabular-nums; }
.hero .meta { color: var(--dim); font-size: 12.5px; margin-top: 4px; display: flex; flex-wrap: wrap; gap: 10px; }
.hero-actions { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
select.status-select {
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px;
  padding: 10px; min-height: var(--tap); flex: 1; min-width: 160px;
}
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; margin-bottom: 10px; }
.panel h3 { font-size: 12px; text-transform: uppercase; letter-spacing: .09em; color: var(--dim); margin: 0 0 10px; font-weight: 700; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.field { display: flex; flex-direction: column; gap: 4px; }
.field label { font-size: 10.5px; color: var(--dim); text-transform: uppercase; letter-spacing: .06em; }
.field input, .field textarea, .field select {
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 9px;
  padding: 9px 10px; min-height: 40px; width: 100%;
}
.field textarea { min-height: 68px; resize: vertical; }
.kv { display: flex; justify-content: space-between; gap: 10px; padding: 6px 0; border-bottom: 1px dashed var(--line); font-size: 13px; }
.kv:last-child { border-bottom: 0; }
.kv .k { color: var(--dim); min-width: 0; }
.kv .v { font-variant-numeric: tabular-nums; text-align: right; }
.kv .v.pos { color: var(--accent); font-weight: 700; }
.kv .v.neg { color: var(--bad); font-weight: 700; }
.factors { display: flex; flex-direction: column; gap: 8px; }
.factor .bar { height: 5px; background: var(--panel-2); border-radius: 3px; overflow: hidden; margin-top: 4px; }
.factor .bar i { display: block; height: 100%; background: var(--accent); }
.factor .lab { font-size: 12.5px; display: flex; justify-content: space-between; gap: 8px; }
.factor .det { font-size: 11.5px; color: var(--dim); margin-top: 2px; }
.timeline { font-size: 12.5px; }
.timeline .t-item { padding: 7px 0; border-bottom: 1px dashed var(--line); display: flex; justify-content: space-between; gap: 10px; }
.timeline .t-item:last-child { border-bottom: 0; }
.timeline .when { color: var(--dim); font-size: 11px; white-space: nowrap; }
.note { color: var(--dim); font-size: 12px; }
.empty { color: var(--dim); font-size: 13px; padding: 10px 0; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; overflow-wrap: anywhere; }
pre.code {
  background: #070b10; border: 1px solid var(--line); border-radius: 10px; padding: 10px;
  overflow-x: auto; font-size: 11.5px; line-height: 1.5; margin: 8px 0;
}
.tabs { display: flex; gap: 6px; margin-bottom: 10px; overflow-x: auto; }
.toast {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(86px + var(--safe-b));
  background: rgba(24, 34, 48, .88); -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur);
  border: 1px solid var(--hair-strong); color: var(--txt);
  padding: 10px 14px; border-radius: 12px; font-size: 13px; z-index: 100; max-width: 90vw;
  box-shadow: var(--shadow);
}
.toast.bad { border-color: var(--bad); }

/* Find tab: marketplace links become a 3-up grid on wide screens. */
.grid-links { display: block; }

/* ------------------------------------------------------------------ tabbar */
.tabbar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 30;
  /* One column per tab, whatever the count — a hardcoded repeat(4,…) wrapped the 5th tab. */
  display: grid; grid-auto-flow: column; grid-auto-columns: 1fr;
  padding: 6px 4px calc(6px + var(--safe-b));
  background: rgba(13, 18, 24, .92);
  -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur);
  border-top: 1px solid var(--hair);
}
.tabbar a {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  color: var(--dim); font-size: 10.5px; padding: 6px 0; min-height: var(--tap); justify-content: center;
  border-radius: 10px; transition: color .15s ease, background .15s ease;
}
.tabbar a span { font-size: 17px; line-height: 1; }
.tabbar a.on { color: var(--accent); }
/* Six tabs now that Saved is on the rail: "Integrations" is the long one, so the type
   steps down a little on the narrowest phones instead of clipping. */
.tabbar a { padding-left: 2px; padding-right: 2px; text-align: center; line-height: 1.15; }
@media (max-width: 430px) { .tabbar a { font-size: 9.5px; letter-spacing: -.01em; } }

/* --------------------------------------------------------------- favourites */
/* Star: a span styled as a control, because on a card it sits inside the card's own <a>.
   Amber is the palette's existing --warn, not a new hue. */
.fav {
  display: inline-flex; align-items: center; justify-content: center; flex: none;
  width: 30px; height: 30px; border-radius: 9px; font-size: 16px; line-height: 1;
  color: var(--dim); background: transparent; border: 1px solid transparent;
  cursor: pointer; user-select: none;
  transition: color .15s ease, background .15s ease, transform .06s ease;
}
.fav:hover { color: var(--txt); background: var(--panel-2); }
.fav:active { transform: scale(.94); }
.fav.on { color: var(--warn); }
.fav:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

.fav-fill { display: inline-flex; align-items: center; gap: 6px; }
.fav-fill .fav-mark { font-size: 14px; line-height: 1; }
.fav-fill.on { color: var(--warn); border-color: #4a3a17; }

/* Index density: one row per saved car, so the shortlist fits one screen. */
.idx { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.idx-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 8px 10px; border-top: 1px solid var(--line); }
.idx-row:first-child { border-top: 0; }
.idx-main { flex: 1 1 55%; min-width: 0; color: var(--txt); text-decoration: none; }
.idx-t { display: block; font-size: 13.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.idx-m { display: block; margin-top: 1px; color: var(--dim); font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.idx-p { font-weight: 700; font-variant-numeric: tabular-nums; font-size: 15px; }

/* ======================================================== macOS glass, wide */
@media (min-width: 720px) {
  .traffic { display: flex; }
  .topbar { padding-top: calc(10px + env(safe-area-inset-top, 0px)); padding-bottom: 10px; }
  .view { padding-bottom: 92px; }
  .stats { grid-template-columns: repeat(4, 1fr); }
  .card-row { padding: 12px; }
  .thumb { width: 116px; min-width: 116px; height: 82px; }
  .grid2 { grid-template-columns: repeat(3, 1fr); }
  .tabbar { grid-auto-columns: minmax(0, 140px); justify-content: center; }

  /* Glass controls (Apple-ish push buttons, inset fields, segmented chips). */
  .btn {
    background: linear-gradient(180deg, rgba(255, 255, 255, .10), rgba(255, 255, 255, .045));
    border: 1px solid var(--hair-strong);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .10), 0 1px 2px rgba(0, 0, 0, .45);
    transition: filter .15s ease, transform .06s ease;
  }
  .btn:hover { filter: brightness(1.14); }
  .btn:active { transform: translateY(1px); }
  .btn.primary {
    background: linear-gradient(180deg, rgba(55, 214, 122, .95), rgba(45, 180, 102, .95));
    border-color: rgba(55, 214, 122, .8); color: #06130b;
  }
  .searchbox input, .field input, .field textarea, .field select, select.status-select {
    background: rgba(0, 0, 0, .30); border: 1px solid var(--hair);
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, .5);
  }
  .card {
    background: var(--glass-1); border: 1px solid var(--hair);
    transition: background .15s ease, border-color .15s ease, transform .12s ease;
  }
  .card:hover { background: var(--glass-2); border-color: var(--hair-strong); transform: translateY(-1px); }
  .stat, .hero, .panel {
    background: var(--glass-1); border: 1px solid var(--hair); box-shadow: var(--inset);
  }
  /* Segmented control rather than loose pills. */
  .filters {
    background: rgba(255, 255, 255, .04); border: 1px solid rgba(255, 255, 255, .05);
    border-radius: 11px; padding: 3px; gap: 2px; overflow-x: auto;
  }
  .chip { background: transparent; border: 1px solid transparent; border-radius: 8px; padding: 6px 10px; }
  .chip:hover { color: var(--txt); background: rgba(255, 255, 255, .05); }
  .chip.on {
    background: linear-gradient(180deg, rgba(255, 255, 255, .16), rgba(255, 255, 255, .08));
    border-color: var(--hair-strong); color: var(--accent);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .16), 0 1px 2px rgba(0, 0, 0, .4);
  }

}

/* ------------------------------------------------------ the three columns */
@media (min-width: 1024px) {
  .view { max-width: 940px; }
  .view-wide { max-width: 1560px; }
  .pane-head { display: block; }
  .rail-extra { display: block; }

  .workspace {
    /* Three columns, middle one weighted — equal thirds truncated every listing title. */
    grid-template-columns: minmax(0, .9fr) minmax(0, 1.2fr) minmax(0, .9fr);
    grid-template-areas: "overview feed deals";
    /* stretch, not start: three equal-height sheets is what makes the layout read as three
       columns even when one of them has nothing in it yet. */
    gap: 16px; align-items: stretch;
  }
  .workspace.detail { grid-template-areas: "vehicle work paper"; }
  /* .workspace.find sets a single-column area list for the phone; restate the wide one
     here or its names win and every pane stacks back into column 1. */
  .workspace.find { grid-template-areas: "overview feed deals"; }

  /* Each column is its own frosted sheet, scrolling independently like a
     real three-pane app. */
  .pane {
    /* A single raking sheen across the sheet — that highlight is what separates macOS
       vibrancy from a flat grey box. */
    background:
      linear-gradient(157deg, rgba(255, 255, 255, .085) 0%, rgba(255, 255, 255, .03) 38%, rgba(255, 255, 255, .018) 70%, rgba(255, 255, 255, .045) 100%);
    border: 1px solid var(--hair);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, .13);
    -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur);
    padding: 14px;
    /* Leaves room for the sticky topbar and the floating dock, with enough slack that the
       page itself never scrolls — a second page scrollbar next to the pane scrollbars
       looked broken. */
    max-height: calc(100vh - 172px);
    max-height: calc(100dvh - 172px);
    overflow-y: auto;
    overscroll-behavior: contain;
  }
  .pane::-webkit-scrollbar { width: 11px; }
  .pane::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, .14); border-radius: 99px;
    border: 3px solid transparent; background-clip: content-box;
  }
  .pane::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, .24); background-clip: content-box; }
  .pane::-webkit-scrollbar-track { background: transparent; }

  /* Inside a column, panels don't need their own outline — the pane is the sheet. */
  .pane .panel, .pane .hero, .pane .stat, .pane .card {
    background: rgba(255, 255, 255, .035); border-color: rgba(255, 255, 255, .07);
  }
  .pane .stat { background: rgba(255, 255, 255, .045); }
  .workspace .stats { grid-template-columns: repeat(2, 1fr); }

  /* In a column there is no thumb to swipe, so wrap the chips instead of letting the
     last few disappear off the right edge behind a horizontal scroll. */
  .pane .filters { flex-wrap: wrap; overflow-x: visible; row-gap: 4px; }

  /* Closest-to-a-deal cards become tiles in the right rail. */
  .pane-deals .card-row { flex-wrap: wrap; padding: 10px; }
  .pane-deals .thumb { width: 100%; min-width: 0; height: 92px; border-radius: 10px; }
  .pane-deals .card-main { flex: 1 1 100%; }
  .pane-deals .card-side {
    flex-direction: row; width: 100%; align-items: center; justify-content: space-between;
    flex-wrap: wrap; gap: 6px;
  }
  .pane-feed .card { margin-bottom: 10px; }

  /* Detail columns: the money grid stays 2-up so fields don't get cramped. */
  .pane .grid2 { grid-template-columns: repeat(2, 1fr); }
  .pane .grid2 > .field[style*="grid-column"] { grid-column: 1 / -1 !important; }

  .topbar { padding-left: 18px; padding-right: 18px; }
  .toast { bottom: calc(96px + var(--safe-b)); }

  /* Floating dock instead of a full-width bar. */
  .tabbar {
    left: 50%; right: auto; transform: translateX(-50%);
    bottom: 14px; border: 1px solid var(--hair-strong); border-radius: 16px;
    padding: 6px; gap: 2px;
    background: rgba(16, 21, 28, .72);
    -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur);
    box-shadow: var(--shadow), var(--inset);
    grid-auto-columns: minmax(0, 116px);
  }
  .tabbar a { border-radius: 12px; }
  .tabbar a:hover { background: var(--glass-2); color: var(--txt); }
  .tabbar a.on { background: rgba(55, 214, 122, .12); color: var(--accent); }
}

/* Browsers without backdrop blur: fall back to opaque glass, same colours. */
@supports not ((backdrop-filter: blur(4px)) or (-webkit-backdrop-filter: blur(4px))) {
  @media (min-width: 1024px) {
    .pane { background: rgba(19, 26, 35, .97); }
    .topbar { background: rgba(11, 15, 20, .97); }
    .tabbar { background: rgba(16, 21, 28, .97); }
  }
}

@media (prefers-color-scheme: light) {
  /* stay dark: this is a shop-floor tool */
}


/* --------------------------------------------------- board (Deals / Parts) */
/* The board is a full-width surface: a top toolbar (search + sort + Cars/Parts
   switch) and a three-column grid of listings, instead of the old three panes. */
.board { display: flex; flex-direction: column; gap: 12px; }
.board-head { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.board-search { flex: 1 1 260px; margin: 0; min-width: 0; }
.board-search input { min-width: 0; }

/* Cars / Parts switch — a small segmented control. */
.seg {
  display: inline-flex; gap: 2px; padding: 3px; border-radius: 11px;
  background: rgba(255, 255, 255, .04); border: 1px solid var(--hair); flex: none;
}
.seg button {
  background: transparent; border: 1px solid transparent; border-radius: 8px;
  padding: 7px 16px; cursor: pointer; color: var(--dim); font-weight: 600; font-size: 13px;
  transition: color .15s ease, background .15s ease;
}
.seg button:hover { color: var(--txt); }
.seg button.on {
  background: linear-gradient(180deg, rgba(255, 255, 255, .16), rgba(255, 255, 255, .08));
  border-color: var(--hair-strong); color: var(--accent);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .16);
}

.board-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; }
.toolbar-label {
  font-size: 10.5px; text-transform: uppercase; letter-spacing: .08em; color: var(--dim); flex: none;
}

/* Compact stat strip; five across on a wide desktop. */
.stats.board-stats { grid-template-columns: repeat(2, 1fr); }
@media (min-width: 720px) { .stats.board-stats { grid-template-columns: repeat(5, 1fr); } }

/* The listing grid: one column on a phone, two on tablet, three on desktop. */
.grid3 { display: grid; gap: 12px; grid-template-columns: minmax(0, 1fr); }
.grid3 .card { margin-bottom: 0; height: 100%; }
.grid3 .empty { grid-column: 1 / -1; }
@media (min-width: 720px) { .grid3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1100px) { .grid3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
