/* ============================================================================
   Autobought Lead Bank — futuristic "Depth" theme
   Drop-in replacement for public/styles.css.

   It keeps EVERY class name the current app already emits from app.js and the
   page scripts (.topbar, .tabs, .panel, .panel-head, .btn, .pill, .bar, .num,
   .lab, .sub, .stack, .cols, .tl, .scrim, .modal, .toast, .tile, .lead …), so
   nothing in the markup has to change to get the new look. The two OPTIONAL
   markup changes are listed at the bottom of this file.
   ========================================================================== */

:root {
  /* --- ground ------------------------------------------------------------ */
  --bg: #060B14;
  --bg-2: #080E1A;

  /* Glass surfaces. Anything that was a solid --panel is now a translucent
     layer over the page's own glow; the blur is what makes it read as glass. */
  --glass: rgba(19, 32, 54, 0.55);
  --glass-strong: rgba(19, 32, 54, 0.78);       /* modals, toasts, nav */
  --glass-blur: blur(28px) saturate(140%);
  --glass-blur-strong: blur(40px) saturate(160%);
  --glass-line: rgba(120, 170, 235, 0.16);
  --glass-line-hi: rgba(120, 170, 235, 0.34);
  --inner-surface: rgba(255, 255, 255, 0.03);   /* card inside a card */
  --inner-line: rgba(130, 180, 240, 0.12);
  --hair: rgba(130, 180, 240, 0.10);            /* row rules */
  --hair-soft: rgba(130, 180, 240, 0.08);

  /* legacy names the existing markup still references */
  --panel: var(--glass);
  --panel-2: var(--inner-surface);
  --line: var(--glass-line);

  /* --- ink --------------------------------------------------------------- */
  --text: #EAF1FB;
  --text-2: #B7C8DD;
  --muted: #8FA6C4;
  --dim: #7D93B2;
  --faint: #63799A;

  /* --- Autobought blue --------------------------------------------------- */
  --blue: #4FB6F5;
  --blue-hi: #8FD3FF;
  --blue-ink: #7FCBFF;                          /* blue text on dark */
  --blue-soft: rgba(31, 169, 255, 0.12);
  --blue-soft-line: rgba(31, 169, 255, 0.30);
  --brand-grad: linear-gradient(135deg, #0B62D6, #1FA9FF);
  --brand-grad-h: linear-gradient(90deg, #0B62D6, #1FA9FF);
  --brand-glow: 0 14px 36px rgba(31, 120, 255, 0.38);
  --bar-glow: 0 0 16px rgba(31, 169, 255, 0.5);

  /* --- states ------------------------------------------------------------ */
  --good: #35D6A0;
  --good-ink: #5FE3B8;
  --good-soft: rgba(53, 214, 160, 0.12);
  --good-line: rgba(53, 214, 160, 0.30);

  --orange: #E9A23B;                            /* leads waiting in the bank */
  --orange-ink: #F5CE93;
  --orange-soft: rgba(233, 162, 59, 0.12);
  --orange-line: rgba(233, 162, 59, 0.32);
  --orange-panel: linear-gradient(120deg, rgba(233,162,59,0.14), rgba(19,32,54,0.55) 55%);

  --bad: #FF9A94;
  --bad-soft: rgba(240, 115, 108, 0.10);
  --bad-line: rgba(240, 115, 108, 0.35);

  --grey-soft: rgba(255, 255, 255, 0.05);
  --grey-text: #9FB3CC;

  /* chart palette */
  --c-sold: #35D6A0;
  --c-working: #3E8FE8;
  --c-review: #C79436;
  --c-credited: #E06A93;
  --c-waiting: #54688A;

  /* --- form ------------------------------------------------------------- */
  --radius: 22px;          /* cards */
  --radius-sm: 18px;       /* cards inside cards */
  --radius-input: 14px;
  --radius-pill: 999px;    /* buttons, pills, nav, filter bar */
  --shadow: 0 22px 60px rgba(2, 8, 20, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.07);
  --shadow-nav: 0 20px 50px rgba(2, 8, 20, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.10);
  --shadow-modal: 0 40px 100px rgba(0, 0, 0, 0.65), inset 0 1px 0 rgba(255, 255, 255, 0.10);

  /* SF-like system stack: no webfont request, and it IS the Apple face on
     Apple hardware. Saira/Manrope are no longer loaded — the <link> in each
     page's <head> can be deleted. */
  --font-display: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --font-ui: var(--font-display);
  --font-mono: ui-monospace, SFMono-Regular, Menlo, monospace;
}

* { box-sizing: border-box; }
html { color-scheme: dark; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 14px;
  line-height: 1.5;
  letter-spacing: -0.01em;
  -webkit-font-smoothing: antialiased;
  font-variant-numeric: tabular-nums;
}

/* The page's own light. Everything glassy above it is reading THIS. */
body::before {
  content: "";
  position: fixed; inset: 0; pointer-events: none; z-index: 0;
  background:
    radial-gradient(58rem 34rem at 12% -8%, rgba(31,169,255,0.20), transparent 60%),
    radial-gradient(46rem 30rem at 92% 4%, rgba(11,98,214,0.22), transparent 62%),
    radial-gradient(60rem 40rem at 60% 110%, rgba(10,31,92,0.55), transparent 65%);
}
#chrome, main, #main, .scrim, .toast { position: relative; z-index: 1; }

a { color: var(--blue); text-decoration: none; }
a:hover { color: var(--blue-hi); }

h1, h2, h3 { margin: 0; font-family: var(--font-display); font-weight: 600; letter-spacing: -0.025em; }
h1 { font-size: 34px; }
h2 { font-size: 17px; }

.eyebrow {
  font-size: 11px; font-weight: 640; letter-spacing: 0.2em;
  text-transform: uppercase; color: var(--blue);
}
.sub { color: var(--dim); font-size: 12.5px; }
.dim { color: var(--faint); }
.lab {
  font-size: 11px; font-weight: 620; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--dim);
}
.num { font-size: 38px; font-weight: 600; letter-spacing: -0.04em; line-height: 1.1; }
.mono { font-family: var(--font-mono); font-size: 12.5px; }

/* ============================================================================
   Top bar → floating glass pill nav
   The existing .topbar markup becomes a centred pill. It shrinks to icons on
   scroll via the small script at the bottom of this file (add-on, optional).
   ========================================================================== */
/* A full-width bar pinned to the top, the way a CRM you live in all day is
   laid out. The floating pill looked good on a marketing page and got in the
   way here: it hovered over the content, and content scrolled behind it. */
.topbar {
  position: sticky; top: 0; z-index: 70;
  width: 100%; max-width: none; transform: none; left: auto;
  display: flex; align-items: center; justify-content: space-between; gap: 18px;
  padding: 0 26px; height: 58px;
  background: rgba(9, 17, 31, 0.82);
  backdrop-filter: blur(28px) saturate(150%);
  -webkit-backdrop-filter: blur(28px) saturate(150%);
  border: 0; border-bottom: 1px solid rgba(130, 180, 240, 0.16);
  border-radius: 0;
  box-shadow: none;
  transition: box-shadow .25s ease, border-color .25s ease, background .25s ease;
}

/* Once the page has moved under it, the bar separates itself from the content
   rather than shrinking. Nothing moves; it just stops being ambiguous. */
.topbar.compact {
  background: rgba(7, 14, 26, 0.94);
  border-bottom-color: rgba(130, 180, 240, 0.26);
  box-shadow: 0 10px 30px rgba(2, 8, 20, 0.55);
}
.topbar .left { display: flex; align-items: center; gap: 14px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 14px; }
.brand img { height: 22px; width: auto; display: block; }
.brand span, .tabs a span { white-space: nowrap; }

.tabs { display: flex; gap: 4px; }
.tabs a {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 14px; border-radius: var(--radius-pill);
  font-size: 13.5px; font-weight: 590; color: var(--muted);
  transition: background .25s ease, color .25s ease;
}
.tabs a:hover { background: rgba(255,255,255,0.06); color: var(--text); }
.tabs a.active {
  background: var(--brand-grad); color: #fff;
  box-shadow: 0 10px 26px rgba(31, 120, 255, 0.42);
}
.cycle {
  display: flex; align-items: center; gap: 7px;
  border: 1px solid var(--glass-line); border-radius: var(--radius-pill);
  padding: 7px 14px; font-size: 12.5px; font-weight: 590; color: var(--muted);
}

/* Body content clears the floating nav. */
main { padding: 28px 32px 96px; max-width: 1480px; margin: 0 auto;
       display: flex; flex-direction: column; gap: 22px; }

/* ============================================================================
   Surfaces
   ========================================================================== */
.panel {
  background: var(--glass);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.panel-head {
  display: flex; align-items: baseline; justify-content: space-between;
  padding: 22px 26px 16px; gap: 12px;
}
.panel.lift { transition: transform .3s cubic-bezier(.2,.8,.3,1), border-color .3s ease; }
.panel.lift:hover { transform: translateY(-3px); border-color: var(--glass-line-hi); }

/* a card inside a card (dealer info block, product card, contract row) */
.inner {
  background: var(--inner-surface);
  border: 1px solid var(--inner-line);
  border-radius: var(--radius-sm);
  padding: 18px 20px;
}

.grid-4 { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; }
.grid-auto { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 14px; }

/* --- headline strip ------------------------------------------------------ */
.headline {
  display: flex; align-items: center; gap: 20px; padding: 20px 24px;
  border-left: 0;                       /* the old 3px rule is gone */
}
.headline .icon {
  width: 44px; height: 44px; border-radius: var(--radius-pill); flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: var(--good-soft); border: 1px solid var(--good-line);
}
.headline .msg { font-size: 17px; font-weight: 620; }
.headline.warn { background: var(--orange-panel); border-color: var(--orange-line); }
.headline.warn .icon { background: var(--orange-soft); border-color: var(--orange-line); }
.headline.warn .msg { color: var(--orange-ink); }
.headline.warn .sub { color: #B49A76; }
.headline.bad .icon { background: var(--bad-soft); border-color: var(--bad-line); }
.headline.bad .msg { color: var(--bad); }

/* --- pills --------------------------------------------------------------- */
.pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 11px; border-radius: var(--radius-pill);
  font-size: 11.5px; font-weight: 620; white-space: nowrap;
  border: 1px solid transparent;
}
.pill.blue, .pill.credited { background: var(--blue-soft); color: var(--blue-ink); border-color: var(--blue-soft-line); }
.pill.good, .pill.assigned { background: var(--good-soft); color: var(--good-ink); border-color: var(--good-line); }
.pill.warn, .pill.unassigned, .pill.bad { background: var(--orange-soft); color: var(--orange-ink); border-color: var(--orange-line); }
.pill.danger { background: var(--bad-soft); color: var(--bad); border-color: var(--bad-line); }
.pill.grey, .pill.new { background: var(--grey-soft); color: var(--grey-text); border-color: var(--inner-line); }

/* --- progress ------------------------------------------------------------ */
.bar { height: 8px; border-radius: var(--radius-pill); background: rgba(255,255,255,0.06); overflow: hidden; }
.bar > i {
  display: block; height: 100%; border-radius: var(--radius-pill);
  background: var(--brand-grad-h); box-shadow: var(--bar-glow);
  transition: width .8s cubic-bezier(.2,.8,.3,1);
}
.bar > i.full { background: linear-gradient(90deg, #B98430, #E9A23B); box-shadow: 0 0 16px rgba(233,162,59,0.45); }
.bar > i.dim { background: rgba(255,255,255,0.14); box-shadow: none; }

/* --- tables -------------------------------------------------------------- */
table { width: 100%; border-collapse: collapse; }
th {
  text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: 0.14em;
  color: var(--dim); font-weight: 620; padding: 14px 20px;
  border-bottom: 1px solid var(--inner-line); white-space: nowrap;
}
td { padding: 14px 20px; border-bottom: 1px solid var(--hair-soft); vertical-align: middle; }
tbody tr:last-child td { border-bottom: none; }
tbody tr.clickable { cursor: pointer; transition: background .2s ease; }
tbody tr.clickable:hover td { background: rgba(255,255,255,0.045); }
tbody tr.sel td { background: rgba(31,169,255,0.10); }

/* --- controls ------------------------------------------------------------ */
button, input, select, textarea { font-family: inherit; font-size: 13.5px; color: var(--text); }

.btn {
  cursor: pointer; display: inline-flex; align-items: center; gap: 8px;
  border: 1px solid rgba(130,180,240,0.20);
  background: rgba(255,255,255,0.04);
  border-radius: var(--radius-pill); padding: 10px 18px;
  font-weight: 590; font-size: 13px;
  transition: background .2s ease, filter .2s ease, transform .15s ease;
}
.btn:hover { background: rgba(255,255,255,0.09); }
.btn:active { transform: scale(0.985); }
.btn.primary { background: var(--brand-grad); border-color: transparent; color: #fff; font-weight: 620; box-shadow: var(--brand-glow); }
.btn.primary:hover { filter: brightness(1.1); background: var(--brand-grad); }
.btn.danger { border-color: var(--bad-line); background: var(--bad-soft); color: var(--bad); }
.btn.danger:hover { background: rgba(240,115,108,0.18); }
.btn.small { padding: 7px 14px; font-size: 12.5px; }
.btn:disabled { opacity: 0.45; cursor: default; }
/* every tap target on the dealer portal clears 44px */
.callbtn, .btn.primary { min-height: 44px; }

input, select, textarea {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(130,180,240,0.14);
  border-radius: var(--radius-input); padding: 10px 14px;
}
input:focus, select:focus, textarea:focus {
  outline: 2px solid rgba(31,169,255,0.35); outline-offset: 1px;
  border-color: rgba(31,169,255,0.45);
}
::placeholder { color: #5E7492; opacity: 1; }
label.field { display: flex; flex-direction: column; gap: 7px; }
label.field > span { color: var(--muted); font-size: 12.5px; }

/* The filter row becomes one glass capsule. */
.filters {
  display: flex; gap: 10px; align-items: center; flex-wrap: wrap;
  padding: 12px; border-radius: var(--radius-pill);
  background: var(--glass); backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-line);
}
.filters input, .filters select { border-radius: var(--radius-pill); padding: 9px 16px; }

.seg { display: flex; gap: 4px; padding: 4px; border: 1px solid var(--glass-line); border-radius: var(--radius-pill); }
.seg button { border: 0; background: transparent; color: var(--muted); padding: 8px 16px; border-radius: var(--radius-pill); font-weight: 590; cursor: pointer; }
.seg button.on { background: var(--brand-grad); color: #fff; }

/* --- lead detail --------------------------------------------------------- */
.split { display: flex; gap: 18px; align-items: flex-start; flex-wrap: wrap; }
.split > .list { flex-grow: 1; min-width: 0; display: flex; flex-direction: column; gap: 14px; }
.split > .detail { width: 460px; flex-shrink: 0; }
/* the detail pane's header carries a soft brand wash */
.split > .detail .panel > div:first-child { background: linear-gradient(160deg, rgba(31,169,255,0.14), transparent 70%); }

.kv { display: grid; grid-template-columns: 100px 1fr; gap: 9px 14px; font-size: 13px; }
.kv .k { color: var(--dim); }
/* Lead answers: labels can be long ("Time Employed or Receiving Income"). */
.kv.answers { grid-template-columns: minmax(96px, 42%) 1fr; }
.kv.answers > div:not(.k) { overflow-wrap: anywhere; }
.answer-group + .answer-group { margin-top: 16px; }
.answer-group .eyebrow { display: block; margin-bottom: 8px; }
.note-card { background: var(--panel-2); border-radius: 9px; padding: 11px 13px; }
.note-card .txt { font-size: 13px; white-space: pre-wrap; overflow-wrap: anywhere; }
.note-card.internal { border-left: 3px solid var(--blue); }

.timeline { display: flex; flex-direction: column; }
.tl { display: flex; gap: 13px; }
.tl .rail { display: flex; flex-direction: column; align-items: center; flex-shrink: 0; }
.tl .dot { width: 9px; height: 9px; border-radius: 99px; margin-top: 6px; background: var(--c-working); box-shadow: 0 0 10px var(--c-working); }
.tl .dot.good { background: var(--good); box-shadow: 0 0 10px var(--good); }
.tl .dot.bad { background: #F0736C; box-shadow: 0 0 10px rgba(240,115,108,0.8); }
.tl .dot.warn { background: var(--orange); box-shadow: 0 0 10px rgba(233,162,59,0.8); }
.tl .dot.grey { background: #4A5D75; box-shadow: none; }
.tl .line { width: 1px; flex-grow: 1; background: rgba(130,180,240,0.16); min-height: 26px; }
.tl .body { padding-bottom: 16px; }

/* --- dealer portal ------------------------------------------------------- */
.p-top { position: sticky; top: 0; z-index: 60; background: transparent; border: 0; padding: 18px 24px; display: flex; justify-content: center; }
.p-top .accent { display: none; }              /* the 3px rule is replaced by the pill itself */
.p-top .inner {
  width: 100%; max-width: 1440px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 10px 14px 10px 18px;
  background: rgba(13,24,42,0.62);
  backdrop-filter: blur(34px) saturate(160%);
  -webkit-backdrop-filter: blur(34px) saturate(160%);
  border: 1px solid rgba(130,180,240,0.18);
  border-radius: var(--radius-pill);
  box-shadow: var(--shadow-nav);
}
.wrap { max-width: 1440px; margin: 0 auto; padding: 22px 32px 80px; display: flex; flex-direction: column; gap: 20px; }
.hero h1 { font-size: 40px; letter-spacing: -0.035em; }
.hero .since { color: var(--muted); font-size: 14.5px; margin-top: 8px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; }
.tile {
  background: var(--glass); backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-line); border-radius: var(--radius);
  padding: 20px 22px; box-shadow: var(--shadow);
  transition: transform .3s cubic-bezier(.2,.8,.3,1), border-color .3s ease;
}
.tile:hover { transform: translateY(-3px); border-color: var(--glass-line-hi); }
.tile .n { font-size: 36px; font-weight: 600; letter-spacing: -0.04em; line-height: 1.1; margin-top: 8px; }

.lead { display: grid; grid-template-columns: 82px 1fr auto; gap: 18px; align-items: center;
        padding: 16px 26px; border-top: 1px solid var(--hair); cursor: pointer; transition: background .2s ease; }
.lead:first-child { border-top: 0; }
.lead:hover { background: rgba(255,255,255,0.04); }
.lead.on { background: rgba(31,169,255,0.10); }
.lead .when { font-size: 12px; color: var(--dim); line-height: 1.4; }
.lead .when b { display: block; color: var(--text); font-size: 13.5px; font-weight: 600; }
.lead .who2 .nm { font-weight: 590; font-size: 15px; }
.lead .who2 .meta { color: var(--dim); font-size: 12.5px; margin-top: 1px; }

.callbtn {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--brand-grad); color: #fff;
  border-radius: var(--radius-pill); padding: 10px 18px;
  font-weight: 620; font-size: 13.5px; white-space: nowrap;
  box-shadow: 0 12px 30px rgba(31,120,255,0.35);
}
.callbtn:hover { color: #fff; filter: brightness(1.1); }

.p-foot { max-width: 1440px; margin: 0 auto; padding: 22px 32px 40px;
          color: var(--faint); font-size: 12.5px; line-height: 1.8; border-top: 1px solid var(--hair); }

/* --- charts -------------------------------------------------------------- */
.legend { display: flex; gap: 14px; flex-wrap: wrap; align-items: center; }
.legend .key { display: inline-flex; align-items: center; gap: 7px; font-size: 12px; color: var(--muted); }
.legend .swatch { width: 9px; height: 9px; border-radius: 3px; flex-shrink: 0; }

.stack { display: flex; height: 12px; border-radius: var(--radius-pill); overflow: hidden; background: rgba(255,255,255,0.05); gap: 2px; }
.stack > span { display: block; height: 100%; min-width: 0; }

.cols { display: flex; align-items: flex-end; gap: 4px; height: 124px; }
.col { flex: 1 1 0; display: flex; flex-direction: column; justify-content: flex-end; gap: 3px; height: 100%; min-width: 0; transition: opacity .2s ease; }
.col:hover { opacity: .7; }
.col .seg { width: 100%; border-radius: 5px 5px 0 0; }
.col .seg.rest { background: linear-gradient(180deg, #57A6F0, #2C6FD0); }
.col .seg.sold { background: linear-gradient(180deg, #35D6A0, #13906B); border-radius: 0 0 5px 5px; }
.col .empty-day { width: 100%; height: 2px; background: rgba(255,255,255,0.08); border-radius: 2px; }
.axis { display: flex; justify-content: space-between; margin-top: 12px; font-size: 11.5px; color: var(--faint); }

.chart-tip {
  position: fixed; z-index: 80; pointer-events: none; opacity: 0;
  background: var(--glass-strong); backdrop-filter: var(--glass-blur-strong);
  -webkit-backdrop-filter: var(--glass-blur-strong);
  border: 1px solid rgba(130,180,240,0.22); border-radius: 14px;
  padding: 9px 13px; font-size: 12.5px; color: var(--text);
  box-shadow: 0 24px 60px rgba(0,0,0,0.55); transition: opacity .12s ease; white-space: nowrap;
}
.chart-tip.on { opacity: 1; }

/* --- empty states -------------------------------------------------------- */
.empty { padding: 56px 30px; text-align: center; }
.empty .icon {
  width: 52px; height: 52px; border-radius: var(--radius-sm);
  background: var(--inner-surface); border: 1px solid var(--inner-line);
  display: flex; align-items: center; justify-content: center; margin: 0 auto 16px;
}

/* --- toast --------------------------------------------------------------- */
.toast {
  position: fixed; bottom: 26px; left: 50%; transform: translate(-50%, 8px); right: auto;
  z-index: 95; padding: 13px 22px; border-radius: var(--radius-pill);
  background: var(--glass-strong); backdrop-filter: blur(30px) saturate(160%);
  -webkit-backdrop-filter: blur(30px) saturate(160%);
  border: 1px solid rgba(130,180,240,0.22); box-shadow: 0 24px 60px rgba(0,0,0,0.55);
  color: var(--text); font-size: 13.5px; opacity: 0; pointer-events: none;
  transition: opacity .25s ease, transform .25s cubic-bezier(.2,.8,.3,1); max-width: 420px;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.err { border-color: var(--bad-line); color: var(--bad); }

/* --- modal --------------------------------------------------------------- */
.scrim {
  position: fixed; inset: 0; z-index: 90; padding: 24px;
  background: rgba(3, 7, 15, 0.62); backdrop-filter: blur(10px);
  display: flex; align-items: center; justify-content: center;
}
.modal {
  width: 480px; max-width: 100%; max-height: 88vh; overflow: auto;
  background: var(--glass-strong); backdrop-filter: var(--glass-blur-strong);
  -webkit-backdrop-filter: var(--glass-blur-strong);
  border: 1px solid rgba(130,180,240,0.22); border-radius: 24px;
  box-shadow: var(--shadow-modal);
}
.modal .accent { display: none; }
.modal .body { padding: 26px 28px 22px; background: linear-gradient(160deg, rgba(31,169,255,0.14), transparent 65%); }
.modal h2 { font-size: 19px; margin-bottom: 6px; }
.modal .fields { display: flex; flex-direction: column; gap: 14px; margin-top: 20px; }
.modal .foot {
  display: flex; justify-content: flex-end; gap: 9px;
  padding: 16px 28px; border-top: 1px solid var(--inner-line);
  background: rgba(0, 0, 0, 0.18); border-radius: 0 0 24px 24px;
}
.modal textarea { min-height: 92px; resize: vertical; }
.modal .hint { color: var(--faint); font-size: 11.5px; margin-top: -3px; }

/* --- login --------------------------------------------------------------- */
.card { position: relative; width: 100%; max-width: 430px; }
.rule { display: none; }
.box { padding: 32px 34px 34px; background: linear-gradient(160deg, rgba(31,169,255,0.13), transparent 60%); }
.box h1 { font-size: 24px; margin-bottom: 5px; }
.wordmark { font-size: 24px; font-weight: 700; letter-spacing: 0.06em; color: var(--text); }
.foot { text-align: center; margin-top: 22px; color: var(--faint); font-size: 12.5px; line-height: 1.8; }
.foot a { color: var(--muted); }

/* --- live dot ------------------------------------------------------------ */
.live { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12.5px;
        padding: 9px 15px; border-radius: var(--radius-pill);
        background: var(--glass); backdrop-filter: var(--glass-blur);
        -webkit-backdrop-filter: var(--glass-blur); border: 1px solid var(--glass-line); }
.live .dot { width: 7px; height: 7px; border-radius: 99px; background: var(--good); box-shadow: 0 0 10px var(--good); }

/* ============================================================================
   Motion — restrained, and all of it behind prefers-reduced-motion
   ========================================================================== */
@media (prefers-reduced-motion: no-preference) {
  @keyframes ab-in { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
  @keyframes ab-fade { from { opacity: 0; } to { opacity: 1; } }
  @keyframes ab-grow-w { from { transform: scaleX(0); } to { transform: scaleX(1); } }
  @keyframes ab-grow-h { from { transform: scaleY(0); } to { transform: scaleY(1); } }

  .rise { animation: ab-in .6s cubic-bezier(.2,.7,.3,1) both; }
  .fade { animation: ab-fade .4s ease both; }
  .grow-w { animation: ab-grow-w .8s cubic-bezier(.2,.75,.3,1) both; transform-origin: left; }
  .grow-h { animation: ab-grow-h .7s cubic-bezier(.2,.75,.3,1) both; transform-origin: bottom; }
  .scrim { animation: ab-fade .18s ease both; }
  .modal { animation: ab-in .28s cubic-bezier(.2,.8,.3,1) both; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* ============================================================================
   Small screens
   ========================================================================== */
@media (max-width: 940px) {
  /* Still a bar at the top on a phone, just tighter, with the tabs able to
     scroll sideways rather than wrapping or vanishing. */
  .topbar { padding: 0 14px; height: auto; min-height: 54px; flex-wrap: wrap; gap: 8px; }
  .topbar .left { gap: 10px; flex-wrap: wrap; }
  .tabs { overflow-x: auto; -webkit-overflow-scrolling: touch; max-width: 100%; }
  .cycle, .topbar #whoami { display: none; }
  main { padding: 20px 16px 60px; }
  .wrap, .p-top .inner, .p-foot { padding-left: 16px; padding-right: 16px; }
  .split > .detail { width: 100%; }
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hero h1 { font-size: 30px; }
  .lead { grid-template-columns: 66px 1fr; gap: 12px; padding: 14px 18px; }
  .lead .right { grid-column: 1 / -1; padding-left: 78px; }
  .panel > table, .table-scroll { display: block; overflow-x: auto; }
  .hide-narrow { display: none !important; }
}
@media (max-width: 520px) { .grid-4 { grid-template-columns: 1fr; } }

/* Safari on iOS still needs the -webkit- prefix for backdrop-filter, and a
   browser without it must not end up with unreadable transparent panels. */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .panel, .tile, .filters, .topbar, .p-top .inner, .modal, .toast, .live { background: #101B2E; }
}

/* ============================================================================
   THE TWO OPTIONAL MARKUP CHANGES (everything else is class-compatible)

   1. Delete the Google Fonts <link> from the <head> of every page in public/.
      The theme uses the system SF stack; the webfont request is dead weight.

   2. Add the scroll-shrink behaviour to app.js, at the end of renderChrome():

        const bar = document.querySelector('.topbar');
        const onScroll = () => bar.classList.toggle('compact', window.scrollY > 90);
        window.addEventListener('scroll', onScroll, { passive: true });
        onScroll();

      Without it the nav still works — it just stays at full width.

   Nice-to-have, not required: in index.html's tile() and dealerRow(), wrap the
   inner blocks in <div class="inner"> to pick up the nested-card surface, and
   in app.js's renderChrome() give each tab an inline SVG icon before its
   <span>label</span> so the compact nav has something to show.
   ========================================================================== */

/* Carried over from the previous stylesheet: the quiet pulse on the live dot
   when the page refreshes itself. The handoff styles .live and .live .dot but
   not the .pulsing state, and without this a refresh happens invisibly. */
@media (prefers-reduced-motion: no-preference) {
  .live.pulsing .dot { animation: ab-pulse 1.1s ease-in-out; }
  @keyframes ab-pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: .35; transform: scale(1.5); }
  }
}

/* --- pipeline ------------------------------------------------------------- */
.stage-strip { display: flex; flex-wrap: wrap; gap: 7px; }
.stage-chip {
  display: inline-flex; align-items: center; gap: 7px; padding: 6px 11px;
  border-radius: 99px; border: 1px solid var(--line); background: var(--panel-2);
  color: var(--text); font: inherit; font-size: 12.5px; cursor: pointer; white-space: nowrap;
}
.stage-chip b { font-weight: 700; }
.stage-chip:hover { border-color: var(--blue-soft-line); }
.stage-chip.zero { opacity: 0.55; }
.stage-chip.on { border-color: var(--blue); box-shadow: inset 0 0 0 1px var(--blue); }
.stage-chip .dot, .col-head .dot { width: 7px; height: 7px; border-radius: 99px; background: #4A5D75; }
.dot.blue { background: var(--c-working); }
.dot.good { background: var(--good); }
.dot.warn { background: var(--orange); }
.dot.danger { background: var(--bad); }
.dot.credited { background: var(--c-credited); }

.board {
  display: grid; grid-auto-flow: column; grid-auto-columns: minmax(212px, 1fr);
  gap: 10px; overflow-x: auto; padding-bottom: 8px; margin-top: 14px;
}
.board .col {
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 12px;
  padding: 10px; min-height: 120px;
}
.board .col.focus { border-color: var(--blue); box-shadow: inset 0 0 0 1px var(--blue); }
.board .col-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 9px; }
.board .cards { display: flex; flex-direction: column; gap: 7px; max-height: 470px; overflow-y: auto; }
.lead-card {
  display: block; width: 100%; text-align: left; cursor: pointer; font: inherit; color: var(--text);
  background: var(--panel); border: 1px solid var(--inner-line); border-radius: 10px; padding: 9px 11px;
}
.lead-card:hover, .lead-card:focus-visible { border-color: var(--blue-soft-line); }
.lead-card .nm { font-weight: 650; font-size: 13px; }
.lead-card .why {
  margin-top: 6px; font-size: 12px; color: var(--muted);
  border-left: 2px solid var(--orange); padding-left: 7px; overflow-wrap: anywhere;
}
.stage-picker { display: grid; grid-template-columns: repeat(auto-fill, minmax(116px, 1fr)); gap: 7px; }
.note-card.refund { border-left: 3px solid var(--line); }
.note-card.refund.warn { border-left-color: var(--orange); }
.note-card.refund.good { border-left-color: var(--good); }

/* --- lead drawer ------------------------------------------------------------ */
.drawer-scrim { position: fixed; inset: 0; z-index: 85; background: rgba(3, 7, 15, 0.5); backdrop-filter: blur(6px); }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 86;
  width: min(640px, 100%); overflow-y: auto;
  background: var(--glass-strong); backdrop-filter: var(--glass-blur-strong);
  -webkit-backdrop-filter: var(--glass-blur-strong);
  border-left: 1px solid rgba(130, 180, 240, 0.22); box-shadow: var(--shadow-modal);
}
.drawer .head {
  position: sticky; top: 0; z-index: 2; padding: 18px 20px 14px;
  border-bottom: 1px solid var(--hair); background: var(--glass-strong);
  backdrop-filter: var(--glass-blur-strong); -webkit-backdrop-filter: var(--glass-blur-strong);
}
@media (prefers-reduced-motion: no-preference) {
  .drawer:not(.still) { animation: drawer-in 0.22s ease-out; }
  .drawer-scrim:not(.still) { animation: scrim-in 0.22s ease-out; }
  @keyframes drawer-in { from { transform: translateX(28px); opacity: 0; } }
  @keyframes scrim-in { from { opacity: 0; } }
}

/* A board column is not a chart column: undo .col's bottom-aligned bar layout. */
.board .col { flex: none; height: auto; justify-content: flex-start; gap: 0; }
.drawer .panel { background: transparent; border: 0; box-shadow: none; backdrop-filter: none; -webkit-backdrop-filter: none; }

/* --- date range picker ---------------------------------------------------- */
.range-btn { display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; }
.range-btn .sub { font-weight: 400; }
.range-pop {
  position: absolute; z-index: 95; display: flex; width: 470px; max-width: calc(100vw - 24px);
  background: var(--glass-strong); backdrop-filter: var(--glass-blur-strong); -webkit-backdrop-filter: var(--glass-blur-strong);
  border: 1px solid rgba(130, 180, 240, 0.22); border-radius: 16px; box-shadow: var(--shadow-modal); overflow: hidden;
}
.range-pop .presets { display: flex; flex-direction: column; padding: 8px; min-width: 156px; border-right: 1px solid var(--inner-line); }
.range-pop .presets button {
  text-align: left; background: transparent; border: 0; color: var(--text); font: inherit; font-size: 13px;
  padding: 8px 11px; border-radius: 9px; cursor: pointer;
}
.range-pop .presets button:hover, .range-pop .presets button:focus-visible { background: var(--panel-2); }
.range-pop .presets button.on { background: var(--blue-soft); color: var(--blue-ink); font-weight: 650; }
.range-pop .custom { flex: 1; padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; }
.range-pop .custom input { width: 100%; }
@media (max-width: 560px) {
  .range-pop { flex-direction: column; }
  .range-pop .presets { flex-direction: row; flex-wrap: wrap; border-right: 0; border-bottom: 1px solid var(--inner-line); }
  .range-btn .sub { display: none; }
}
