/* Phone + iOS app layer: global car search, mic buttons, the Ask sheet, safe areas, tap targets, no zoom-on-input.
   Loaded after app.css / dealer.css / admin.css; only adds to them. html.native = running inside the iOS app (native.js). */

/* ---------- global search button (next to the logo) ---------- */
.gsbtn { display: flex; align-items: center; gap: 9px; width: 100%; margin: -8px 0 14px; padding: 8px 10px; border-radius: 8px; border: 1px solid var(--side-line, #1d2733);
  background: transparent; color: var(--side-muted); cursor: pointer; font-size: 13px; text-align: left; }
.gsbtn:hover { color: var(--side-on); background: var(--side-hover); }
.gsbtn svg, .gsbox svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; flex: none; }

/* ---------- mic buttons ---------- */
.micbtn { flex: none; display: inline-grid; place-items: center; width: 30px; height: 30px; margin: -6px -4px -6px 0; padding: 0; border: 0; border-radius: 50%;
  background: transparent; color: var(--muted); cursor: pointer; }
.micbtn svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; }
@media (hover: hover) { .micbtn:hover { color: var(--accent); background: var(--accent-soft); } }
.micbtn.live { color: #fff; background: var(--red); animation: micpulse 1.2s ease-in-out infinite; }
@keyframes micpulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(194, 53, 43, .45); } 50% { box-shadow: 0 0 0 7px rgba(194, 53, 43, 0); } }
.micwrap { position: relative; display: inline-flex; align-items: center; min-width: 0; }
.micwrap > input { padding-right: 38px; }
.micwrap > .micbtn { position: absolute; right: 8px; top: 50%; margin: 0; transform: translateY(-50%); }
.micwrap > input:has(+ .micbtn[hidden]) { padding-right: 10px; }

/* ---------- global search sheet ---------- */
.gsearch { position: fixed; inset: 0; z-index: 70; background: var(--bg); display: none; flex-direction: column; padding-top: env(safe-area-inset-top); }
.gsearch.on { display: flex; }
.gshead { display: flex; gap: 10px; align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--line); background: var(--surface); }
.gsbox { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 0 12px; color: var(--muted); height: 44px; }
.gsbox input { flex: 1; min-width: 0; border: 0; background: transparent; padding: 0; box-shadow: none !important; font-size: 16px; height: 100%; }
.gsbox .micbtn { margin: 0 -6px 0 0; width: 34px; height: 34px; }
.gsclose { border: 0; background: none; color: var(--accent); font-weight: 600; cursor: pointer; padding: 0 4px; min-height: 44px; }
.gsres { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 6px 0 calc(16px + env(safe-area-inset-bottom)); overscroll-behavior: contain; }
.gsres a { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; padding: 11px 16px; border-bottom: 1px solid var(--line-2); color: var(--ink); min-height: 56px; }
.gsres a b { font-weight: 600; } .gsres a span { grid-column: 1; color: var(--muted); font-size: 12.5px; } .gsres a small { grid-column: 2; grid-row: 1 / 3; align-self: center; color: var(--faint); font-size: 12px; text-align: right; }
.gsres a:active, .gsres a:hover { background: var(--surface-2); }
.gshint { color: var(--muted); padding: 18px 16px; margin: 0; font-size: 14px; }
@media (min-width: 901px) {
  .gsearch { inset: 70px auto auto 50%; transform: translateX(-50%); width: min(620px, 92vw); max-height: 70vh; border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 20px 50px rgba(16,24,40,.25); overflow: hidden; padding: 0; }
}

/* ---------- Ask: floating button + bottom sheet ---------- */
.askfab { position: fixed; right: max(18px, env(safe-area-inset-right)); bottom: calc(18px + env(safe-area-inset-bottom)); z-index: 60; display: inline-flex; align-items: center; gap: 7px;
  height: 48px; padding: 0 18px 0 15px; border-radius: 999px; border: 0; background: var(--accent); color: var(--accent-ink); font-weight: 650; font-size: 15px; cursor: pointer;
  box-shadow: 0 6px 20px rgba(14, 107, 92, .35), 0 2px 6px rgba(0,0,0,.12); }
.askfab svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linejoin: round; stroke-linecap: round; }
.askfab:active { transform: scale(.97); }
.askscrim { position: fixed; inset: 0; background: rgba(8,12,18,.45); opacity: 0; pointer-events: none; transition: opacity .2s; z-index: 64; }
.askscrim.on { opacity: 1; pointer-events: auto; }
.asksheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 65; height: min(86vh, 760px); height: min(86dvh, 760px); display: flex; flex-direction: column;
  background: var(--surface); border-radius: 18px 18px 0 0; box-shadow: 0 -10px 40px rgba(0,0,0,.25); transform: translateY(105%); transition: transform .26s cubic-bezier(.2,.8,.2,1);
  padding-bottom: env(safe-area-inset-bottom); visibility: hidden; }
.asksheet.on { transform: none; visibility: visible; }
@media (min-width: 901px) { .asksheet { left: auto; right: 24px; bottom: 24px; width: 440px; height: min(680px, calc(100vh - 48px)); border-radius: 16px; border: 1px solid var(--line); } }
.askgrab { width: 40px; height: 5px; border-radius: 3px; background: var(--line); margin: 8px auto 0; flex: none; }
.askhead { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; padding: 6px 10px 10px 16px; border-bottom: 1px solid var(--line-2); flex: none; }
.askhead b { font-size: 16px; } .askhead .grow { flex: 1; }
.askhead > .faint { order: 9; flex-basis: 100%; margin-top: -10px; }
.askclear { border: 0; background: none; color: var(--accent); font-size: 13px; font-weight: 600; cursor: pointer; min-height: 44px; padding: 0 8px; }
.askx { border: 0; background: var(--surface-2); color: var(--muted); width: 36px; height: 36px; border-radius: 50%; display: inline-grid; place-items: center; cursor: pointer; align-self: center; }
.askx svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.asklog { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; padding: 14px 14px 6px; display: flex; flex-direction: column; gap: 10px; }
.askq { align-self: flex-end; max-width: 86%; background: var(--accent); color: var(--accent-ink); padding: 9px 13px; border-radius: 16px 16px 4px 16px; white-space: pre-wrap; word-break: break-word; }
.aska { align-self: flex-start; max-width: 94%; background: var(--surface-2); border: 1px solid var(--line-2); padding: 10px 13px; border-radius: 16px 16px 16px 4px; word-break: break-word; }
.aska .prose { font-size: 14.5px; line-height: 1.5; padding: 0; margin: 0; background: none; border: 0; box-shadow: none; max-width: none; }
.aska .prose > :first-child { margin-top: 0; } .aska .prose > :last-child { margin-bottom: 0; }
.aska .prose p, .aska .prose ul, .aska .prose ol { margin: 0 0 8px; } .aska .prose ul, .aska .prose ol { padding-left: 20px; }
.aska .prose table { display: block; overflow-x: auto; font-size: 13px; border-collapse: collapse; } .aska .prose td, .aska .prose th { padding: 4px 8px; border-bottom: 1px solid var(--line); }
.aska .prose h1, .aska .prose h2, .aska .prose h3 { font-size: 15px; margin: 10px 0 6px; padding: 0; border: 0; }
.aska.thinking { color: var(--muted); display: flex; gap: 8px; align-items: center; }
.asksrc { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 9px; }
.asksrc a { display: inline-flex; align-items: center; min-height: 32px; padding: 4px 11px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); font-size: 13px; font-weight: 600; }
.askempty { color: var(--muted); margin: auto 0 0; } .askempty p { margin: 0 0 10px; }
.asksugg { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.asksugg button { border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); border-radius: 12px; padding: 9px 12px; text-align: left; cursor: pointer; min-height: 44px; }
.askerr { align-self: stretch; background: var(--amber-soft); color: var(--ink); border-radius: 10px; padding: 10px 12px; font-size: 14px; }
.askerr .btn { margin-left: 6px; min-height: 34px; }
.askbar { display: flex; align-items: flex-end; gap: 6px; padding: 8px 10px 10px; border-top: 1px solid var(--line-2); flex: none; }
.askbar textarea { flex: 1; min-width: 0; resize: none; max-height: 140px; min-height: 44px; font-size: 16px; line-height: 1.35; padding: 11px 12px; border-radius: 22px; }
.askbar .askmic, .asksend { width: 44px; height: 44px; margin: 0; flex: none; border-radius: 50%; }
.askbar .askmic svg { width: 21px; height: 21px; }
.asksend { border: 0; background: var(--accent); color: var(--accent-ink); display: inline-grid; place-items: center; cursor: pointer; }
.asksend svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.asksend:disabled { opacity: .45; }
html.asking, html.searching { overflow: hidden; }
html.asking body, html.searching body { overflow: hidden; }

/* ---------- pull to refresh (app only) ---------- */
.ptr { position: fixed; top: env(safe-area-inset-top); left: 50%; transform: translate(-50%, -50px); z-index: 80; width: 36px; height: 36px; border-radius: 50%; background: var(--surface);
  box-shadow: 0 2px 10px rgba(0,0,0,.18); display: grid; place-items: center; color: var(--muted); opacity: 0; pointer-events: none; transition: opacity .15s; }
.ptr .spin { animation-play-state: paused; } .ptr.ready { color: var(--accent); } .ptr.go .spin { animation-play-state: running; }
html:not(.native) .ptr { display: none; }

/* ---------- sign-in: paste-the-link box (app only) ---------- */
.pastelink { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 12px; }
.pastelink input { width: 100%; margin: 4px 0 8px; }

/* ---------- phones ---------- */
@media (max-width: 900px) {
  /* one column, no grid: a grid's rows stretch to fill min-height, so the header grew while a page was still loading */
  .shell { display: block; }
  .shell > main { min-width: 0; }

  /* the full menu slides in from the left (mnav.js) */
  .side { position: fixed; inset: 0 auto 0 0; z-index: 63; width: min(300px, 84vw); height: 100vh; height: 100dvh; flex-direction: column; align-items: stretch; gap: 0;
    overflow-x: hidden; overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; padding: calc(14px + env(safe-area-inset-top)) 12px calc(14px + env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
    transform: translateX(-105%); visibility: hidden; transition: transform .28s cubic-bezier(.2,.8,.2,1), visibility 0s .28s; box-shadow: 0 0 40px rgba(0,0,0,.35); }
  html.menu-open .side { transform: none; visibility: visible; transition: transform .28s cubic-bezier(.2,.8,.2,1); }
  html.menu-open, html.menu-open body { overflow: hidden; }
  .side .logo { padding: 4px 8px 16px; } .side .logo span:not(.mark) { display: block; }
  .side .gsbtn { margin: 0 0 12px; min-height: 44px; }
  #nav { flex-direction: column; flex: none; }
  #nav a { min-height: 46px; padding: 8px 10px; font-size: 15px; display: flex; align-items: center; white-space: normal; }
  #nav svg { display: block; flex: none; }
  .navgroup { display: block !important; }
  #nav .mtheme { display: none !important; }
  .side-foot { display: grid; margin-top: 18px; }
  .side-foot .themebtn, .side-foot .link { min-height: 40px; }

  main { padding-bottom: calc(104px + env(safe-area-inset-bottom)); padding-left: max(14px, env(safe-area-inset-left)); padding-right: max(14px, env(safe-area-inset-right)); }

  /* iOS zooms into any field under 16px; keep every field at 16px on phones */
  input, select, textarea { font-size: 16px; }
  input[type=checkbox], input[type=radio] { width: 22px; height: 22px; }
  select { min-height: 44px; }
  .toolbar input[type=search], .toolbar .micwrap { min-height: 44px; }
  .toolbar .micwrap { flex: 1 1 100%; }
  .toolbar .micwrap > input { width: 100%; }

  /* Dealer OS top search: full width, mic inside, no keyboard hint */
  .dos .topbar { flex-wrap: nowrap; gap: 8px; }
  .dos .search { flex: 1 1 auto; min-width: 0; max-width: none; min-height: 46px; padding: 0 12px; }
  .dos .search input { height: 44px; }
  .dos .search kbd { display: none; }
  .dos .search .micbtn { width: 38px; height: 38px; margin: 0 -8px 0 0; }
  .dos .iconbtn { height: 46px; padding: 0 12px; flex: none; }
  .dos .sres a { min-height: 52px; align-items: center; flex-wrap: wrap; }
  .dos .sres small { margin-left: 0; width: 100%; }

  /* a KPI whose value is words ("2015-17 Chevrolet Corvette") wraps instead of widening the page */
  .dos .kpi .v { white-space: normal; overflow-wrap: anywhere; }
  .dos .kpi .l, .dos .kpi .s { min-width: 0; overflow-wrap: anywhere; flex-wrap: wrap; }

  /* tap targets: segmented controls, chips that filter, buttons */
  .seg button, .dos .seg button { min-height: 40px; }
  .btn { min-height: 44px; } .btn.sm { min-height: 36px; }
  .crumb { display: inline-flex; align-items: center; min-height: 40px; }
  .drawer .dh .x { width: 44px; height: 44px; top: calc(10px + env(safe-area-inset-top)); right: 10px; }
  .drawer { padding-bottom: env(safe-area-inset-bottom); }
  .drawer .dh { padding-top: calc(16px + env(safe-area-inset-top)); }

  /* tables keep scrolling sideways inside their own box, never the page */
  .tbl-wrap, .tw { overflow-x: auto; -webkit-overflow-scrolling: touch; max-width: 100%; }
  main img, main canvas { max-width: 100%; }

  .toast { bottom: calc(88px + env(safe-area-inset-bottom)); max-width: calc(100vw - 32px); }
}
/* inside the app: no grey tap flash, no rubber-band showing the page background */
html.native body { -webkit-tap-highlight-color: transparent; overscroll-behavior-y: none; }
html.native .side .logo { pointer-events: none; }

/* ---------- phone navigation: slim top bar, glass tab capsule, glass Ask ---------- */
:root { --g-tint: rgba(255,255,255,.42); --g-sheen: rgba(255,255,255,.22); --g-rim: rgba(255,255,255,.3); --g-hi: rgba(255,255,255,.85); --g-idle: #3b4656;
  --g-shadow: 0 0 0 .5px rgba(0,0,0,.06), 0 8px 24px rgba(0,0,0,.14), 0 1px 3px rgba(0,0,0,.08); --g-on-bg: rgba(14,107,92,.14); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --g-tint: rgba(24,31,40,.42); --g-sheen: rgba(255,255,255,.07); --g-rim: rgba(255,255,255,.13); --g-hi: rgba(255,255,255,.2); --g-idle: #c6ced8;
  --g-shadow: 0 10px 30px rgba(0,0,0,.45), 0 2px 6px rgba(0,0,0,.3); --g-on-bg: rgba(52,179,154,.2); } }
:root[data-theme="dark"] { --g-tint: rgba(24,31,40,.42); --g-sheen: rgba(255,255,255,.07); --g-rim: rgba(255,255,255,.13); --g-hi: rgba(255,255,255,.2); --g-idle: #c6ced8;
  --g-shadow: 0 10px 30px rgba(0,0,0,.45), 0 2px 6px rgba(0,0,0,.3); --g-on-bg: rgba(52,179,154,.2); }
.mbar, .mtabs, .mscrim { display: none; }
@property --ask-angle { syntax: "<angle>"; initial-value: 0deg; inherits: false; }
@keyframes ask-spin { to { --ask-angle: 360deg; } }
@media (max-width: 900px) {
  :root { --nav-bottom: max(12px, calc(env(safe-area-inset-bottom) - 12px)); --nav-h: 50px; }
  .mbar { display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; z-index: 30; padding: env(safe-area-inset-top) max(6px, env(safe-area-inset-right)) 0 max(6px, env(safe-area-inset-left)); height: calc(50px + env(safe-area-inset-top));
    background: var(--g-tint); -webkit-backdrop-filter: blur(16px) saturate(180%); backdrop-filter: blur(16px) saturate(180%); border-bottom: .5px solid var(--line); }
  .mtitle { font-weight: 650; font-size: 16px; letter-spacing: .01em; color: var(--ink); }
  .mbtn { width: 44px; height: 44px; display: grid; place-items: center; border: 0; background: none; color: var(--ink); cursor: pointer; padding: 0; -webkit-tap-highlight-color: transparent; }
  .mbtn svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; }
  .mscrim { display: block; position: fixed; inset: 0; z-index: 62; background: rgba(8,12,18,.45); opacity: 0; pointer-events: none; transition: opacity .25s; }
  html.menu-open .mscrim { opacity: 1; pointer-events: auto; }

  .mtabs { display: flex; align-items: center; gap: 2px; position: fixed; left: max(14px, env(safe-area-inset-left)); bottom: var(--nav-bottom); z-index: 45; height: var(--nav-h); padding: 4px; box-sizing: border-box; isolation: isolate; border-radius: 999px;
    background: var(--g-tint); -webkit-backdrop-filter: blur(14px) saturate(180%); backdrop-filter: blur(14px) saturate(180%); border: .5px solid var(--g-rim); box-shadow: inset 0 1px 0 var(--g-hi), var(--g-shadow); }
  .mtabs::before { content: ""; position: absolute; inset: 0; z-index: -1; border-radius: inherit; background: linear-gradient(to bottom, var(--g-sheen), transparent 55%); pointer-events: none; }
  .mtabs a { display: inline-flex; align-items: center; justify-content: center; height: 100%; min-width: 50px; padding: 0 13px; box-sizing: border-box; border-radius: 999px; color: var(--g-idle); -webkit-tap-highlight-color: transparent;
    transition: color .2s, background .25s, transform .12s; }
  .mtabs a:active { transform: scale(.94); }
  .mtabs a.on { color: var(--accent); background: var(--g-on-bg); }
  .mtabs svg { width: 21px; height: 21px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
  .mtabs span { max-width: 0; margin-left: 0; opacity: 0; overflow: hidden; white-space: nowrap; font-size: 13px; font-weight: 600; transition: max-width .32s cubic-bezier(.2,.8,.2,1), margin-left .32s cubic-bezier(.2,.8,.2,1), opacity .2s; }
  .mtabs a.on span { max-width: 90px; margin-left: 6px; opacity: 1; }

  .askfab { right: max(14px, env(safe-area-inset-right)); bottom: var(--nav-bottom); height: var(--nav-h); padding: 0 17px 0 14px; color: var(--ink); isolation: isolate;
    background: var(--g-tint); -webkit-backdrop-filter: blur(14px) saturate(180%); backdrop-filter: blur(14px) saturate(180%); box-shadow: inset 0 1px 0 var(--g-hi), var(--g-shadow); }
  .askfab::before { content: ""; position: absolute; inset: 0; border-radius: inherit; padding: 1.5px; pointer-events: none;
    background: conic-gradient(from var(--ask-angle), #3A9AB5, #10d9a0, #5cc8e0, #a78bfa, #3A9AB5);
    -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); mask-composite: exclude;
    animation: ask-spin 4s linear infinite; }
  .askfab[hidden] { display: none; }
}
@media (max-width: 900px) and (prefers-reduced-motion: reduce) { .askfab::before { animation: none; } .mtabs a, .mtabs span, .side { transition: none; } }

/* ---------- range rows open their cars in place (all widths) ---------- */
.dos .rr.open { background: var(--surface-2); }
.dos .rrx { margin: 2px 0 10px; border: 1px solid var(--line-2); border-radius: 10px; overflow: hidden; }
.dos .rrc + .rrc { border-top: 1px solid var(--line-2); }
.dos .rrh { display: flex; justify-content: space-between; align-items: center; gap: 10px; width: 100%; min-height: 50px; padding: 8px 12px; background: none; border: 0; color: var(--ink); text-align: left; cursor: pointer; font: inherit; }
.dos .rrh b { display: block; font-weight: 600; } .dos .rrh small { color: var(--muted); font-size: 12px; } .dos .rrh .num { font-weight: 650; white-space: nowrap; }
.dos .rrd { padding: 2px 12px 12px; } .dos .rrd[hidden] { display: none; }
.dos .rrd dl { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 12px; margin: 0 0 10px; }
.dos .rrd dt { color: var(--muted); font-size: 11.5px; } .dos .rrd dd { margin: 0; font-weight: 600; font-size: 13.5px; overflow-wrap: anywhere; }
.dos .supply { margin-top: 12px; } .dos .supply .sl { display: flex; justify-content: space-between; align-items: baseline; font-size: 13px; margin-bottom: 4px; } .dos .supply .sl span { font-size: 12.5px; font-weight: 600; } .dos .supply .spark { width: 100%; height: auto; }

/* ---------- phones: foldable sections, roomier cards, range rows on two lines ---------- */
.chev { display: none; }
@media (max-width: 900px) {
  .dos .panel.coll > .ph { position: relative; padding-right: 44px; cursor: pointer; -webkit-tap-highlight-color: transparent; }
  .chev { display: block; position: absolute; right: 14px; top: 16px; width: 20px; height: 20px; fill: none; stroke: var(--muted); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; transition: transform .2s; }
  .dos .panel.coll.shut > .chev, .dos .panel.coll.shut > .ph .chev { transform: rotate(-90deg); }
  .dos .panel.coll.shut > :not(.ph) { display: none; }
  .dos .panel.coll.shut > .ph { border-bottom: 0; }
  .dos .panel > .ph h2 { font-size: 17px; }
  .dos .panel > .ph h2.bk { font-size: 23px; font-weight: 750; letter-spacing: -.01em; }
  .dos .ccard { padding: 16px; }
  .dos .ccard .r1 .car .sub { display: block; margin-top: 3px; line-height: 1.4; }
  .dos .rr.axis { display: none; }
  .dos .rr { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "nm num" "tr tr"; gap: 6px 10px; padding: 11px 6px; border-bottom: 1px solid var(--line-2); border-radius: 0; }
  .dos .rr .nm { grid-area: nm; } .dos .rr .tr { grid-area: tr; } .dos .rr > .num { grid-area: num; align-self: start; }
  .dos .rr .nm b { white-space: normal; font-size: 14px; } .dos .rr .tr u { display: none; }
  .dos .rr .tr { background: linear-gradient(var(--line-2), var(--line-2)) center / 100% 1px no-repeat; }
}

/* ---------- phones: every other tab. Cards instead of wide tables, foldable sections, less explanation ---------- */
@media (min-width: 901px) { .ponly, .pcards, .psort, .hmore { display: none !important; } }
@media (max-width: 900px) {
  .donly, .lng { display: none !important; }
  #app > .head:not(:last-child) p:not(.ponly) { display: none; }          /* a page's intro paragraph; a "no data yet" page has only its head and keeps it */
  .panel, #app > h2, .deal-grid h2 { scroll-margin-top: 64px; }

  /* sections on the coaching pages */
  #app > h2, .deal-grid h2, .pcx h2 { font-size: 19px; font-weight: 700; text-transform: none; letter-spacing: -.005em; color: var(--ink); margin: 22px 0 10px; }
  .fhead { position: relative; padding-right: 30px; cursor: pointer; -webkit-tap-highlight-color: transparent; }
  .fhead .chev { top: 2px; right: 2px; }
  .fhead.shut .chev { transform: rotate(-90deg); }
  .fhead.shut { margin-bottom: 4px; }
  .foldaway { display: none !important; }
  .panel.bar-list h3 { font-size: 17px; font-weight: 700; color: var(--ink); margin: 0; }
  .panel.bar-list.coll > h3 { position: relative; padding-right: 30px; cursor: pointer; -webkit-tap-highlight-color: transparent; }
  .panel.bar-list.coll > h3 .chev { top: 0; right: 0; }
  .panel.bar-list.coll.shut > h3 .chev { transform: rotate(-90deg); }
  .panel.bar-list.coll.shut > :not(h3) { display: none; }
  .panel.bar-list:not(.shut) > h3 { margin-bottom: 10px; }
  .dos .panel.coll.shut > .ph ~ .ph { display: none; }
  .dos details.panel.coll > summary.ph { list-style: none; } .dos details.panel.coll > summary.ph::-webkit-details-marker { display: none; }

  /* table rows as cards */
  .tbl-wrap.has-pc { display: none; }
  .pc { padding: 14px 16px; border-top: 1px solid var(--line-2); }
  .pc:first-child { border-top: 0; }
  .pc.click { cursor: pointer; -webkit-tap-highlight-color: transparent; }
  .pc.open { background: var(--surface-2); }
  .pc .pch { position: static; flex: none; width: 18px; height: 18px; margin-top: 3px; }
  .pc.open .pch { transform: rotate(180deg); }
  .dos .panel.coll.shut > .ph .legend { display: none; }
  .pc1 { display: flex; align-items: flex-start; gap: 12px; }
  .pct { flex: 1; min-width: 0; }
  .pct b { display: block; font-size: 15px; font-weight: 600; color: var(--ink); }
  .pct span:not(.chip) { display: block; margin-top: 2px; color: var(--muted); font-size: 12.5px; line-height: 1.4; }
  .pcv { flex: none; text-align: right; font-size: 17px; font-weight: 700; font-variant-numeric: tabular-nums; }
  .pcv small { display: block; font-size: 11px; font-weight: 500; color: var(--muted); }
  .pcd { font-size: 12px; font-weight: 500; color: var(--muted); white-space: nowrap; }
  .pcs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; margin: 10px 0 0; }
  .pcs > div { background: var(--surface-2); border-radius: 8px; padding: 6px 8px; min-width: 0; }
  .pc.open .pcs > div { background: var(--surface); }
  .pcs dt { font-size: 11px; color: var(--muted); }
  .pcs dd { margin: 0; font-size: 13.5px; font-weight: 600; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
  .pcs dd small { color: var(--muted); font-weight: 500; }
  .pcc { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 9px; }
  .pcn { margin-top: 10px; }
  .pcx { padding: 2px 12px 14px; background: var(--surface-2); border-top: 1px solid var(--line-2); }
  .pcx h2 { font-size: 15px; margin: 14px 0 8px; }
  .psort { display: flex; align-items: center; gap: 8px; padding: 8px 16px; border-bottom: 1px solid var(--line-2); font-size: 13px; color: var(--muted); }
  .psort select { flex: 1; min-width: 0; min-height: 40px; }
  .psort button { flex: none; width: 40px; height: 40px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--ink); font-size: 16px; cursor: pointer; }
  .pmore { display: block; width: 100%; min-height: 46px; border: 0; border-top: 1px solid var(--line-2); background: var(--surface-2); color: var(--accent); font: inherit; font-weight: 600; cursor: pointer; }

  /* filters and search rows */
  .toolbar select { flex: 1 1 42%; min-width: 0; }
  .toolbar .seg, #only { display: flex; flex-wrap: wrap; width: 100%; max-width: none; }
  #only button { flex: 1 1 auto; white-space: nowrap; }
  .dos #if { flex-wrap: wrap; overflow: visible; }
  .dos #days, .dos #store { display: flex; width: 100%; }
  .dos #days button, .dos #store button { flex: 1 1 0; min-width: 0; padding-left: 2px; padding-right: 2px; white-space: nowrap; }
  .dos #days button { font-size: 12.5px; }
  .dos .kpis[style] { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }

  /* the data-status box: summary + anything wrong; the rest behind one tap */
  .dos .health.folded:not(.open) > :not(.warn):not(.keep):not(.src.stale):not(.hmore):not(.recon) { display: none; }
  .dos .health .src { white-space: normal; }
  .hmore { flex-basis: 100%; min-height: 34px; padding: 0; border: 0; background: none; color: var(--accent); font: inherit; font-weight: 600; text-align: left; cursor: pointer; }

  /* car cards: the name and details use the full width; the number sits beside the name only */
  .dos .cards.wide .ccard .r1 { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 10px; }
  .dos .cards.wide .ccard .r1 .car { display: contents; }
  .dos .cards.wide .ccard .r1 > div:last-child { display: flex; align-items: baseline; gap: 5px; }
  .dos .cards.wide .ccard .r3 .pr { display: inline-flex; align-items: center; gap: 5px; margin-right: 8px; }
  .dos .cards.wide .ccard .r1 .car .sub { grid-column: 1 / -1; grid-row: 2; }
  .dos .cards.wide .ccard .r2 { grid-template-columns: none; grid-auto-flow: column; grid-auto-columns: auto; }
  .dos .cards.wide .ccard .r2 strong { white-space: nowrap; }
  .dos .cards.wide .ccard .why { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; }
  .dos .cards.wide .ccard .r2 em { display: block; font-style: normal; font-size: 11.5px; }
  .dos .tiem { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: baseline; gap: 8px; padding: 9px 16px; border-top: 1px solid var(--line-2); font-size: 13px; }
  .dos .tiem b { font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
  .dos .grid-reps th:first-child, .dos .grid-reps td:first-child { position: sticky; left: 0; background: var(--surface); }

  /* grading standard: a wide table scrolls in its own box */
  .prose table, .prose pre { display: block; max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .tabs { overflow-x: auto; scrollbar-width: none; }
  .tabs a { flex: none; white-space: nowrap; }

  /* deal page */
  .deal-head h1 { font-size: 20px; line-height: 1.25; }
  .deal-grid > div { min-width: 0; }
  .callwho select { max-width: 100%; }

  /* car story */
  .drawer .dh { position: static; }
  .drawer .dh .x { position: fixed; z-index: 3; }
  .drawer .dh h2 { padding-right: 52px; }
  .drawer .wf .row { grid-template-columns: minmax(0, 1fr) auto; }
  .drawer .wf .row > .lane { grid-column: 1 / -1; grid-row: 2; }
  .drawer .wf .row > .lane:empty { display: none; }
  .drawer .crm .lead { grid-template-columns: minmax(0, 1fr); }
  .drawer .crm .lead > .small { text-align: left !important; }
}

/* phones: the top bar's magnifier is the one search; Refresh sits beside the page title */
@media (max-width: 900px) {
  #app > .dos { position: relative; }   /* not the car story drawer, which is also .dos and must stay fixed */
  .dos > .topbar { position: absolute; top: 0; right: 0; margin: 0; z-index: 2; }
  .dos > .topbar .search, .dos > .topbar .grow { display: none; }
  .dos > .topbar .iconbtn { height: 38px; padding: 0 12px; border-radius: 10px; }
  .dos > .head h1 { padding-right: 110px; min-height: 38px; display: flex; align-items: center; }
}

/* ---------- Today's timeframes + sales trend (trend.js) ---------- */
:root { --s1: #2a78d6; --s2: #eb6834; --s3: #1baf7a; --s4: #eda100; --s5: #e87ba4; --s6: #6250d6; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500; --s5: #d55181; --s6: #9085e9; } }
:root[data-theme="dark"] { --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500; --s5: #d55181; --s6: #9085e9; }
.dos .trctl { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.dos .trline { position: relative; margin-top: 6px; touch-action: pan-y; }
.dos .trline svg, .dos .trpie svg { display: block; width: 100%; height: auto; }
.dos .trline .g { stroke: var(--line-2); stroke-width: 1; }
.dos .trline .xh { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 3 3; }
.dos .trline .ax, .dos .trpie .ax { fill: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.dos .trpie { max-width: 260px; margin: 6px auto 0; } .dos .trpie .pv { fill: var(--ink); font-size: 26px; font-weight: 700; }
.dos .trtip { position: absolute; top: 0; z-index: 3; min-width: 150px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; font-size: 12.5px; box-shadow: 0 6px 18px rgba(0,0,0,.14); pointer-events: none; }
.dos .trtip div { display: flex; align-items: center; gap: 6px; margin-top: 3px; color: var(--ink-2); } .dos .trtip span { margin-left: auto; font-weight: 650; color: var(--ink); font-variant-numeric: tabular-nums; }
.dos .trtip i, .dos .trleg i { width: 9px; height: 9px; border-radius: 50%; flex: none; display: inline-block; }
.dos .trleg { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 10px; font-size: 12.5px; color: var(--ink-2); } .dos .trleg span { display: inline-flex; align-items: center; gap: 6px; }
.dos .trtab .sw { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 8px; vertical-align: 1px; }
@media (max-width: 900px) {
  .dos .rangeseg { display: flex; overflow-x: auto; scrollbar-width: none; max-width: 100%; } .dos .rangeseg::-webkit-scrollbar { display: none; }
  .dos .rangeseg button { flex: none; }
  .dos .head .right { min-width: 0; max-width: 100%; }
  .dos .health.th { display: none; }
  .dos .trctl .seg { flex: 1 1 auto; } .dos .trctl .seg button { flex: 1; }
  .dos .trctl .seg[data-k="by"] { overflow-x: auto; flex-wrap: nowrap; scrollbar-width: none; }
}

/* ---------- Inventory: compact full-width filters + sort (phones) ---------- */
.phsort { display: none; }
@media (max-width: 900px) {
  .dos #tbl > .ph { flex-wrap: wrap; }
  .dos #if { flex-basis: 100%; order: 3; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px; padding: 3px; width: 100%; box-sizing: border-box; }
  .dos #if button { min-height: 44px; padding: 4px 2px; font-size: 12px; line-height: 1.15; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; text-align: center; white-space: normal; }
  .dos #if button .n { margin: 0; font-size: 11px; opacity: .75; }
  .phsort { display: flex; align-items: center; gap: 10px; padding: 10px 16px 4px; color: var(--muted); font-size: 13px; }
  .phsort select { flex: 1; min-height: 44px; font-size: 15px; }
}
@media (max-width: 900px) { .dos #tbl.coll > .ph #if { flex-basis: calc(100% + 28px); width: calc(100% + 28px); max-width: none; margin-right: -28px; } }

/* ---------- car page: photo gallery, full-screen viewer, who's working it, full-page mode ---------- */
.drawer .db { grid-template-columns: minmax(0, 1fr); }   /* a grid item's min-width is its content: 46 photos in a row would widen the drawer */
.drawer .gal { position: relative; margin: 0 0 14px; }
.drawer .gal-main { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; border-radius: 12px; background: var(--surface-2); aspect-ratio: 4 / 3; }
.drawer .gal-main::-webkit-scrollbar { display: none; }
.drawer .gal-main figure { flex: 0 0 100%; margin: 0; scroll-snap-align: center; cursor: zoom-in; }
.drawer .gal-main img { width: 100%; height: 100%; object-fit: cover; display: block; }
.drawer .gal-main figure.broken { display: none; }
.drawer .gal-n { position: absolute; right: 10px; top: 10px; background: rgba(0,0,0,.55); color: #fff; font-size: 12px; padding: 3px 9px; border-radius: 99px; font-variant-numeric: tabular-nums; pointer-events: none; }
.drawer .gal-thumbs { position: relative; display: flex; gap: 6px; overflow-x: auto; padding: 8px 0 2px; scrollbar-width: none; }
.drawer .gal-thumbs::-webkit-scrollbar { display: none; }
.drawer .gal-thumbs button { flex: none; width: 64px; height: 48px; padding: 0; border: 2px solid transparent; border-radius: 7px; overflow: hidden; background: var(--surface-2); cursor: pointer; opacity: .7; }
.drawer .gal-thumbs button.on { border-color: var(--accent); opacity: 1; }
.drawer .gal-thumbs img { width: 100%; height: 100%; object-fit: cover; display: block; }
.lbox { position: fixed; inset: 0; z-index: 90; background: #000; display: flex; flex-direction: column; }
.lbox .lbs { flex: 1; display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; }
.lbox .lbs::-webkit-scrollbar { display: none; }
.lbox figure { flex: 0 0 100%; margin: 0; display: grid; place-items: center; scroll-snap-align: center; }
.lbox img { max-width: 100%; max-height: 100%; object-fit: contain; }
.lbox .lbx { position: absolute; top: calc(10px + env(safe-area-inset-top)); right: 12px; z-index: 2; width: 44px; height: 44px; border-radius: 50%; border: 0; background: rgba(255,255,255,.14); color: #fff; display: grid; place-items: center; cursor: pointer; }
.lbox .lbx svg { width: 18px; height: 18px; stroke: currentColor; }
.lbox .lbn { position: absolute; bottom: calc(16px + env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%); color: #fff; font-size: 13px; opacity: .8; }
html.lbopen, html.lbopen body { overflow: hidden; }
.drawer .working { border: 1px solid var(--line); background: var(--surface); border-radius: 12px; padding: 10px 12px; margin: 0 0 12px; display: grid; gap: 6px; }
.drawer .working small { font-size: 11.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.drawer .working div { display: flex; flex-wrap: wrap; gap: 6px; } .drawer .working em { font-style: normal; font-size: 12.5px; color: var(--muted); }
.drawer .dh .dfull { position: absolute; right: 60px; top: 14px; height: 36px; padding: 0 12px; }
.drawer .dh h2 { padding-right: 160px; }
.drawer.full { width: 100vw; border-left: 0; }
.drawer.full > .dh, .drawer.full > .db { max-width: 1120px; margin-left: auto; margin-right: auto; }
@media (min-width: 1000px) {
  .drawer.full > .db { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); grid-auto-flow: row dense; gap: 14px 24px; align-items: start; }
  .drawer.full > .db > * { grid-column: 1; }
  .drawer.full > .db > .gal { grid-column: 1; grid-row: span 3; }
  .drawer.full > .db > .working, .drawer.full > .db > .stats4, .drawer.full > .db > .signal, .drawer.full > .db > .crm { grid-column: 2; }
}
@media (max-width: 900px) {
  .drawer .dh .dfull { display: none; }
  .drawer .dh h2 { padding-right: 52px; }
  .drawer .gal { margin: 0 -12px 2px; } .drawer .gal-main { border-radius: 0; } .drawer .gal-thumbs { padding-left: 12px; padding-right: 12px; }
}

/* ---------- ignore a car on the lot ---------- */
.drawer .ignp .igrow { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.drawer .ignp .igform { display: grid; gap: 10px; }
.drawer .ignp .igform .seg { flex-wrap: wrap; } .drawer .ignp .igform input { width: 100%; box-sizing: border-box; min-height: 44px; }
.drawer .ignp .igbtns { display: flex; gap: 8px; }
