/* iFind dashboard — one design system.
   Brand: navy + gold on a calm light surface. Mobile first; tables become cards on phones.
   No inline styles anywhere (the CSP forbids them): every value lives in this file. */

:root {
  --navy: #002039;
  --navy-700: #0a2e4a;
  --navy-500: #2f4e6b;
  --gold: #c9a862;
  --gold-ink: #7a5f1f;
  --gold-soft: #f6efdf;
  --bg: #f4f5f7;
  --card: #ffffff;
  --ink: #14202b;
  --muted: #5d6b79;
  --line: #e3e7ec;
  --line-soft: #eef1f4;
  --good: #1f7a55;
  --good-soft: #e3f3ec;
  --warn: #9a5b00;
  --warn-soft: #fdf1da;
  --bad: #b3402a;
  --bad-soft: #fbe9e5;
  --info: #2f4e6b;
  --info-soft: #e7eef5;
  --radius: 14px;
  --radius-s: 9px;
  --shadow: 0 1px 2px rgba(0, 32, 57, 0.05), 0 4px 14px rgba(0, 32, 57, 0.05);
  --side-w: 248px;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --display: "Cormorant Garamond", Georgia, "Times New Roman", serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.55 var(--font);
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
img { max-width: 100%; }
a { color: var(--navy-500); text-underline-offset: 2px; }
a:hover { color: var(--navy); }
h1, h2, h3, p { margin: 0; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.nowrap { white-space: nowrap; }
.num { font-variant-numeric: tabular-nums; }
:focus-visible { outline: 3px solid rgba(201, 168, 98, 0.65); outline-offset: 2px; border-radius: 6px; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--navy); color: #fff; padding: 8px 14px; border-radius: 8px; z-index: 100; }
.skip:focus { left: 12px; }

/* ── Icons ─────────────────────────────────────────────────── */
.ic { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.ic-s { width: 14px; height: 14px; stroke-width: 2.2; }

/* ── Shell ─────────────────────────────────────────────────── */
.shell { display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr); min-height: 100vh; min-height: 100dvh; }
.side {
  position: sticky; top: 0; height: 100vh; height: 100dvh;
  display: flex; flex-direction: column; gap: 8px;
  background: var(--card); border-right: 1px solid var(--line); padding: 18px 14px;
}
.brand { display: block; padding: 4px 8px 14px; border-bottom: 1px solid var(--line-soft); margin-bottom: 8px; }
.brand img { height: 56px; width: auto; display: block; }
.nav { display: flex; flex-direction: column; gap: 2px; flex: 1; overflow-y: auto; }
.nav-h { margin: 16px 10px 6px; font-size: 11px; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.nav a {
  position: relative; display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: var(--radius-s);
  color: var(--ink); text-decoration: none; font-weight: 500;
  transition: background 0.15s, color 0.15s;
}
.nav a .ic { color: var(--muted); transition: color 0.15s; }
.nav a:hover { background: var(--bg); }
.nav a.on { background: var(--navy); color: #fff; }
.nav a.on .ic { color: var(--gold); }
.me { display: flex; align-items: center; gap: 10px; padding: 12px 8px 4px; border-top: 1px solid var(--line-soft); }
.me form { margin: 0 0 0 auto; }
.me-t { min-width: 0; display: flex; flex-direction: column; line-height: 1.25; }
.me-t b { font-weight: 600; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me-t span { font-size: 12px; color: var(--muted); text-transform: capitalize; }
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; border: 0; border-radius: var(--radius-s);
  background: transparent; color: var(--ink); cursor: pointer;
}
.icon-btn:hover { background: var(--bg); }
.main { min-width: 0; }
.topbar { display: none; }
.scrim { position: fixed; inset: 0; background: rgba(0, 20, 38, 0.5); z-index: 40; }
.scrim[hidden] { display: none; }
.page-wrap { max-width: 1240px; margin: 0 auto; padding: 28px 32px 64px; }

/* ── Page header ───────────────────────────────────────────── */
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 14px 20px; margin-bottom: 22px; }
.page-head h1 { font-family: var(--display); font-size: clamp(32px, 4vw, 44px); line-height: 1.05; font-weight: 700; color: var(--navy); letter-spacing: -0.01em; }
.page-head .sub { margin-top: 6px; color: var(--muted); font-size: 14px; max-width: 62ch; }
.head-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }

.seg { display: inline-flex; padding: 3px; background: var(--card); border: 1px solid var(--line); border-radius: 11px; box-shadow: var(--shadow); }
.seg a { padding: 7px 14px; border-radius: 8px; color: var(--muted); font-weight: 600; font-size: 13px; text-decoration: none; }
.seg a:hover { color: var(--ink); }
.seg a.on { background: var(--navy); color: #fff; }

/* ── Cards ─────────────────────────────────────────────────── */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px; margin: 0 0 20px; }
.card > h2, .card-h h2 { font-size: 16px; font-weight: 650; color: var(--navy); letter-spacing: -0.005em; }
.card-h { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 12px; margin-bottom: 16px; }
.card-h .hint { margin-left: auto; font-size: 13px; color: var(--muted); }
.card > h2 { margin-bottom: 14px; }
.card h3 { font-size: 13px; font-weight: 600; margin: 18px 0 8px; color: var(--navy-500); display: flex; align-items: baseline; gap: 8px; }
.card .gap { margin-top: 22px; }
.card.flush { padding: 0; overflow: hidden; }
.card.flush > .card-h { padding: 18px 22px 0; margin-bottom: 8px; }
.cols { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; align-items: start; }
.cols > .card { margin-bottom: 0; }
.cols + .card, .cols + .cols, .card + .cols { margin-top: 20px; }
.cols.wide-left { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); }

/* ── KPI cards ─────────────────────────────────────────────── */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(164px, 1fr)); gap: 14px; margin-bottom: 20px; }
.kpi {
  display: flex; flex-direction: column; gap: 10px;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 18px; color: var(--ink); text-decoration: none; min-width: 0;
}
.kpi-link { transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s; }
.kpi-link:hover { transform: translateY(-2px); border-color: var(--gold); color: var(--ink); box-shadow: 0 6px 20px rgba(0, 32, 57, 0.1); }
.kpi-top { display: flex; align-items: center; gap: 10px; }
.kpi-ic { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; background: var(--gold-soft); color: var(--gold-ink); }
.kpi-l { font-size: 13px; font-weight: 500; color: var(--muted); }
.kpi-v { font-size: 30px; line-height: 1.05; font-weight: 650; letter-spacing: -0.02em; color: var(--navy); font-variant-numeric: tabular-nums; }
.kpi-foot { display: flex; align-items: center; gap: 8px; min-height: 22px; }
.delta { display: inline-flex; align-items: center; gap: 3px; padding: 2px 8px; border-radius: 99px; font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; }
.delta.good { background: var(--good-soft); color: var(--good); }
.delta.bad { background: var(--bad-soft); color: var(--bad); }
.delta.flat { background: var(--line-soft); color: var(--muted); }

/* ── Tables ────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
.table th {
  text-align: left; padding: 11px 16px; font-size: 11px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--muted); background: #fafbfc; border-bottom: 1px solid var(--line); white-space: nowrap;
}
.table td { padding: 13px 16px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background 0.12s; }
.table tbody tr:hover { background: #fbfaf6; }
.table td.num, .table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.table th[data-sort] { cursor: pointer; user-select: none; }
.table th[data-sort]::after { content: " ↕"; opacity: 0.35; }
.table th[data-sort][aria-sort="ascending"]::after { content: " ↑"; opacity: 1; color: var(--gold-ink); }
.table th[data-sort][aria-sort="descending"]::after { content: " ↓"; opacity: 1; color: var(--gold-ink); }
.who { display: flex; align-items: center; gap: 12px; min-width: 0; }
.who a, .who b { font-weight: 600; color: var(--navy); text-decoration: none; }
.who a:hover { text-decoration: underline; }
.who small { display: block; color: var(--muted); font-size: 12px; font-weight: 400; }
tr.thin td { opacity: 0.62; }
.cell-bar { min-width: 0; }

/* ── Avatars & pills ───────────────────────────────────────── */
.av { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; font-size: 12px; font-weight: 700; color: #fff; flex: none; letter-spacing: 0.02em; }
.av.lg { width: 56px; height: 56px; font-size: 18px; }
.av-0 { background: var(--navy); } .av-1 { background: #2f6f6a; } .av-2 { background: #8a5a2b; }
.av-3 { background: #5b4b8a; } .av-4 { background: #3b6a9a; } .av-5 { background: #8a3f55; }
.pill { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 99px; background: var(--line-soft); color: var(--muted); font-size: 12px; font-weight: 600; white-space: nowrap; line-height: 1.4; }
.pill.st-new { background: var(--info-soft); color: var(--info); }
.pill.st-work { background: var(--warn-soft); color: var(--warn); }
.pill.st-search { background: var(--gold-soft); color: var(--gold-ink); }
.pill.st-ready { background: var(--good-soft); color: var(--good); }
.pill.st-future { background: #eef0f6; color: #4a5680; }
.pill.st-dead { background: var(--line-soft); color: #7b8794; }
.pill.temp-hot { background: var(--bad-soft); color: var(--bad); text-transform: capitalize; }
.pill.temp-warm { background: var(--warn-soft); color: var(--warn); text-transform: capitalize; }
.pill.temp-cold { background: var(--info-soft); color: var(--info); text-transform: capitalize; }
.pill.good { background: var(--good-soft); color: var(--good); }
.pill.dim { background: var(--line-soft); color: #7b8794; }
.pill[class*="src-ai"] { background: #ece8fb; color: #4b3aa8; }
.pill.src-agent { background: var(--good-soft); color: var(--good); }
.pill.src-intake { background: var(--warn-soft); color: var(--warn); }
.pill.src-router, .pill.src-scheduler { background: var(--line-soft); color: #7b8794; }

/* ── Buttons & forms ───────────────────────────────────────── */
.btn, button.btn, .btn-primary {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 40px; padding: 0 16px; border-radius: var(--radius-s); border: 1px solid var(--line);
  background: var(--card); color: var(--navy); font: 600 14px var(--font); text-decoration: none; cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.btn:hover { background: var(--bg); color: var(--navy); border-color: #cfd6de; }
.btn-primary, button[type="submit"].primary { background: var(--navy); border-color: var(--navy); color: #fff; }
.btn-primary:hover { background: var(--navy-700); color: #fff; border-color: var(--navy-700); }
.btn-gold { background: var(--gold); border-color: var(--gold); color: var(--navy); }
.btn-gold:hover { background: #d6b974; color: var(--navy); border-color: #d6b974; }
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 16px; }
.field { position: relative; flex: 1 1 260px; }
.field .ic { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
input[type="search"], input[type="text"], input[type="email"], input[type="password"], select {
  width: 100%; min-height: 42px; padding: 0 14px; border: 1px solid var(--line); border-radius: var(--radius-s);
  background: var(--card); color: var(--ink); font: 15px var(--font);
}
.field input { padding-left: 40px; }
select { width: auto; min-width: 180px; padding-right: 32px; }
input:focus, select:focus { outline: 3px solid rgba(201, 168, 98, 0.35); border-color: var(--gold); }
.count { margin-left: auto; font-size: 13px; color: var(--muted); }

/* ── Chips / filters ───────────────────────────────────────── */
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 6px; margin: 0 0 14px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chips a { flex: none; padding: 8px 14px; border-radius: 99px; border: 1px solid var(--line); background: var(--card); color: var(--muted); font-size: 13px; font-weight: 600; text-decoration: none; }
.chips a:hover { color: var(--ink); border-color: #cfd6de; }
.chips a.on { background: var(--navy); border-color: var(--navy); color: #fff; }
.chips .n { opacity: 0.65; margin-left: 4px; font-variant-numeric: tabular-nums; }

/* ── Bars, ranges, charts ──────────────────────────────────── */
.bar { display: block; width: 100%; height: 8px; }
.bar-bg { fill: var(--line-soft); }
.bar-fg { fill: var(--navy-500); }
.bar.gold .bar-fg { fill: var(--gold); }
.bar.good .bar-fg { fill: var(--good); }
.bar.warn .bar-fg { fill: #d99a2b; }
.brow { display: grid; grid-template-columns: minmax(118px, 1.1fr) minmax(70px, 1.6fr) auto; align-items: center; gap: 12px; padding: 7px 0; font-size: 14px; }
.brow-l { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.brow-v { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; min-width: 2.2em; color: var(--navy); }
.rrow { display: grid; grid-template-columns: minmax(84px, 1fr) 3.4em minmax(80px, 2fr) 3.2em; align-items: center; gap: 10px; padding: 7px 0; font-size: 14px; }
.rrow.head { font-size: 11px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); padding-bottom: 4px; }
.rrow .c { text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; }
.rrow .v { text-align: right; font-weight: 650; color: var(--navy); font-variant-numeric: tabular-nums; }
.rrow.thin > * { opacity: 0.6; }
.rng { display: block; width: 100%; height: 14px; }
.rng-bg { fill: var(--line); } .rng-ci { fill: rgba(201, 168, 98, 0.45); } .rng-pt { fill: var(--navy); }

.chart { display: block; width: 100%; height: 230px; }
.chart .grid { stroke: var(--line-soft); stroke-width: 1; vector-effect: non-scaling-stroke; }
.chart .b-all { fill: #cfd9e3; }
.chart .b-ans { fill: var(--navy-500); }
.chart .on { fill: var(--navy-500); }
.chart .fc { fill: #cfd9e3; }
.chart rect { transition: opacity 0.12s; }
.chart g:hover rect { opacity: 0.8; }
.chart-sm { height: 120px; }
.axis { display: flex; justify-content: space-between; margin-top: 6px; font-size: 12px; color: var(--muted); }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 12px; color: var(--muted); margin-top: 10px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.legend .l-all { background: #cfd9e3; } .legend .l-ans { background: var(--navy-500); }
.chart-wrap { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 10px; align-items: stretch; }
.ylab { display: flex; flex-direction: column; justify-content: space-between; font-size: 11px; color: var(--muted); text-align: right; padding: 0 0 2px; font-variant-numeric: tabular-nums; }

/* ── Insights, notes, timeline ─────────────────────────────── */
.findings { background: linear-gradient(180deg, var(--gold-soft), #fffdf8); border-color: #ecdcb7; }
.findings ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 10px; }
.findings li { position: relative; padding-left: 26px; }
.findings li::before { content: ""; position: absolute; left: 4px; top: 9px; width: 8px; height: 8px; border-radius: 50%; background: var(--gold); }
.feed > * + * { border-top: 1px solid var(--line-soft); }
.feed-item { padding: 16px 0; }
.feed-item:first-child { padding-top: 0; }
.feed-item:last-child { padding-bottom: 0; }
.row-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin-bottom: 6px; }
.row-head .sp { margin-left: auto; }
.row-head a { font-weight: 600; color: var(--navy); }
pre.note { margin: 6px 0 0; white-space: pre-wrap; word-wrap: break-word; font: 14.5px/1.6 var(--font); color: #27323d; }
.note-more summary { cursor: pointer; list-style: none; color: #27323d; }
.note-more summary::-webkit-details-marker { display: none; }
.note-more .snip { color: var(--muted); }
.note-more .more-l { display: inline-block; margin-left: 8px; color: var(--gold-ink); font-weight: 600; font-size: 13px; }
.note-more[open] .more-l { display: none; }
.timeline { list-style: none; margin: 0; padding: 0 0 0 4px; }
.timeline li { position: relative; display: grid; grid-template-columns: 34px minmax(0, 1fr); gap: 14px; padding: 0 0 22px; }
.timeline li::before { content: ""; position: absolute; left: 16px; top: 36px; bottom: 0; width: 2px; background: var(--line-soft); }
.timeline li:last-child { padding-bottom: 0; }
.timeline li:last-child::before { display: none; }
.tl-dot { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--info-soft); color: var(--info); }
.tl-dot.call { background: var(--good-soft); color: var(--good); }
.tl-dot.call.miss { background: var(--line-soft); color: #7b8794; }
.tl-dot.note { background: var(--gold-soft); color: var(--gold-ink); }
.tl-when { font-size: 12.5px; color: var(--muted); margin-bottom: 2px; }
.timeline.compact li::before { display: none; }
.timeline.compact li { grid-template-columns: 140px minmax(0, 1fr); padding-bottom: 10px; gap: 12px; }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px 24px; margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--line-soft); }
.facts dt { font-size: 11px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.facts dd { margin: 3px 0 0; font-weight: 600; color: var(--navy); }
.lead-head { display: flex; flex-wrap: wrap; align-items: center; gap: 16px; }
.lead-head h1 { font-family: var(--display); font-size: clamp(30px, 4vw, 40px); line-height: 1.05; color: var(--navy); }
.lead-head .grow { flex: 1; min-width: 0; }
.lead-head .tags { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.crit { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin: 16px 0; }
.crit div { background: var(--bg); border-radius: var(--radius-s); padding: 10px 14px; }
.crit dt { font-size: 11px; font-weight: 600; letter-spacing: 0.07em; text-transform: uppercase; color: var(--muted); }
.crit dd { margin: 2px 0 0; font-weight: 600; color: var(--navy); }
.insight-list { margin: 8px 0 0; padding-left: 18px; }
.insight-list li { margin: 4px 0; }
.insight-lead { font-size: 16px; line-height: 1.6; }
details > summary { cursor: pointer; font-weight: 600; color: var(--navy); }
.pager { display: flex; align-items: center; justify-content: center; gap: 16px; margin-top: 20px; }

/* ── Empty / flash / stat strips ───────────────────────────── */
.empty { text-align: center; padding: 34px 16px; }
.empty-ic { display: inline-grid; place-items: center; width: 52px; height: 52px; border-radius: 50%; background: var(--line-soft); color: var(--muted); margin-bottom: 10px; }
.empty-title { font-weight: 600; color: var(--navy); margin-bottom: 2px; }
.flash { padding: 12px 16px; border-radius: var(--radius-s); background: var(--info-soft); color: var(--info); margin-bottom: 16px; font-weight: 500; }
.flash.error { background: var(--bad-soft); color: var(--bad); }
.strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; margin: 4px 0 18px; }
.strip > div { background: var(--bg); border-radius: var(--radius-s); padding: 12px 14px; }
.strip b { display: block; font-size: 22px; line-height: 1.15; color: var(--navy); font-weight: 650; font-variant-numeric: tabular-nums; }
.strip span { font-size: 12.5px; color: var(--muted); }

/* ── Sign-in ───────────────────────────────────────────────── */
.is-auth { background: var(--navy) url("skyline.webp") center / cover no-repeat fixed; }
.is-auth::before { content: ""; position: fixed; inset: 0; background: linear-gradient(180deg, rgba(0, 32, 57, 0.78), rgba(0, 32, 57, 0.95)); }
.auth-wrap { position: relative; min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; }
.auth-card { width: min(100%, 420px); text-align: center; }
.auth-logo { display: inline-block; background: #f7f4ef; border-radius: 12px; padding: 14px 20px; margin-bottom: 26px; }
.auth-logo img { height: 74px; display: block; }
.auth-card .eyebrow { display: flex; align-items: center; justify-content: center; gap: 12px; color: var(--gold); font-size: 11px; font-weight: 600; letter-spacing: 0.2em; text-transform: uppercase; margin-bottom: 14px; }
.auth-card .eyebrow::before, .auth-card .eyebrow::after { content: ""; width: 24px; height: 1px; background: var(--gold); }
.auth-card h1 { font-family: var(--display); color: #f7f4ef; font-size: clamp(34px, 7vw, 46px); line-height: 1.05; font-weight: 700; }
.auth-card h1 em { color: var(--gold); display: block; }
.auth-card .lede { color: rgba(247, 244, 239, 0.7); margin-top: 12px; font-size: 14.5px; }
.auth-form { margin-top: 26px; display: grid; gap: 12px; text-align: left; }
.auth-form .field .ic { color: var(--gold); }
.auth-form input { background: rgba(247, 244, 239, 0.07); border-color: rgba(201, 168, 98, 0.4); color: #f7f4ef; min-height: 52px; }
.auth-form input::placeholder { color: rgba(247, 244, 239, 0.45); }
.auth-form input:focus { border-color: var(--gold); }
.auth-form button { min-height: 52px; background: var(--gold); border: 0; color: var(--navy); font: 700 14px var(--font); letter-spacing: 0.12em; text-transform: uppercase; border-radius: var(--radius-s); cursor: pointer; }
.auth-form button:hover { background: #d6b974; }
.is-auth .flash { max-width: 420px; margin: 0 auto 16px; }
.card.narrow { max-width: 420px; margin: 12vh auto; text-align: center; }
.card.narrow h1 { font-family: var(--display); font-size: 56px; color: var(--navy); }

/* ── Tablet ────────────────────────────────────────────────── */
@media (max-width: 1100px) {
  .cols, .cols.wide-left { grid-template-columns: minmax(0, 1fr); }
  .page-wrap { padding: 24px 24px 56px; }
}

/* ── Phone & small tablet: drawer navigation ───────────────── */
@media (max-width: 900px) {
  .shell { display: block; }
  .topbar {
    position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 8px;
    height: 60px; padding: 0 10px 0 6px; background: var(--card); border-bottom: 1px solid var(--line);
    padding-top: env(safe-area-inset-top);
  }
  .topbar-brand img { height: 40px; display: block; }
  .side {
    position: fixed; z-index: 50; top: 0; left: 0; bottom: 0; width: min(84vw, 310px); height: auto;
    transform: translateX(-102%); visibility: hidden; transition: transform 0.25s ease, visibility 0s linear 0.25s;
    padding-top: max(18px, env(safe-area-inset-top)); padding-bottom: max(14px, env(safe-area-inset-bottom));
  }
  body.nav-open .side { transform: none; visibility: visible; transition-delay: 0s; box-shadow: 8px 0 30px rgba(0, 20, 38, 0.25); }
  body.nav-open { overflow: hidden; }
  .nav a { padding: 13px 14px; font-size: 16px; }
  .page-wrap { padding: 20px 16px 48px; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .kpi { padding: 14px; gap: 8px; }
  .kpi-v { font-size: 25px; }
  .card { padding: 16px; border-radius: 12px; }
  .card.flush > .card-h { padding: 16px 16px 0; }
  .page-head { margin-bottom: 16px; }
  .seg { width: 100%; }
  .seg a { flex: 1; text-align: center; padding: 10px 6px; }
  .head-actions { width: 100%; }
  .toolbar > label:not(.field) { flex: 1 1 100%; }
  .toolbar select { width: 100%; }
  .toolbar .btn { flex: 1 1 100%; }
  .card.flush:has(.table.stack) { background: transparent; border: 0; box-shadow: none; }
  .card.flush:has(.table.stack) > .card-h { padding: 4px 2px 0; }
  .card.flush:has(.table.stack) .table.stack tbody { padding: 0; }
  .count { margin-left: 0; width: 100%; }
  .chart { height: 160px; }
  .timeline.compact li { grid-template-columns: minmax(0, 1fr); gap: 2px; }

  /* tables become labelled cards */
  .table.stack thead { display: none; }
  .table.stack, .table.stack tbody, .table.stack tr, .table.stack td { display: block; width: 100%; }
  .table.stack tbody { padding: 4px 12px 8px; }
  .table.stack tr { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; margin: 10px 0; background: var(--card); }
  .table.stack td { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 6px 0; border: 0; text-align: right; }
  .table.stack td::before { content: attr(data-label); color: var(--muted); font-size: 12.5px; font-weight: 600; text-align: left; flex: none; }
  .table.stack td.cell-main { display: block; text-align: left; padding-bottom: 8px; margin-bottom: 4px; border-bottom: 1px solid var(--line-soft); }
  .table.stack td.cell-main::before { display: none; }
  .table.stack td.num { text-align: right; }
  .table.stack td[colspan] { display: block; text-align: center; }
  .table.stack td[colspan]::before { display: none; }
  .table.stack .cell-bar { min-width: 0; width: 56%; }
  .table.stack tbody tr:hover { background: var(--card); }
}

@media (max-width: 480px) {
  .brow { grid-template-columns: minmax(70px, 1fr) minmax(50px, 1fr) auto; gap: 8px; }
  .rrow { grid-template-columns: minmax(70px, 1fr) 3em minmax(60px, 1.4fr) 3em; gap: 8px; }
  .rrow.head span:nth-child(3) { font-size: 0; }
  .rrow.head span:nth-child(3)::after { content: 'Rate range'; font-size: 11px; }
  .facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi-foot .muted { display: none; }
}

/* Touch screens: comfortable targets */
@media (pointer: coarse) {
  .btn, .icon-btn { min-height: 44px; }
  .seg a, .chips a { min-height: 44px; display: inline-flex; align-items: center; justify-content: center; }
  .chips a { min-height: 40px; }
  select, input[type="search"], input[type="text"], input[type="email"], input[type="password"] { font-size: 16px; min-height: 46px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}

@media print {
  .side, .topbar, .scrim, .head-actions, .toolbar, .pager { display: none !important; }
  .shell { display: block; }
  .card, .kpi { box-shadow: none; break-inside: avoid; }
}

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.card.narrow .btn { margin-top: 18px; }

/* ── Lead page ─────────────────────────────────────────────── */
.crumb { margin: -4px 0 12px; font-size: 14px; }
.crumb a { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); text-decoration: none; font-weight: 500; }
.crumb a:hover { color: var(--navy); }
.flip { transform: rotate(180deg); }
.lead-grid { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.lead-grid .card { margin-bottom: 20px; }
.lg-main { grid-column: 1; grid-row: 1; }
.lg-side { grid-column: 2; grid-row: 1; position: sticky; top: 20px; }
.hint-pill { margin-left: auto; text-transform: capitalize; }
.tl-empty { display: block !important; padding: 0 !important; }
.tl-empty::before { display: none !important; }
@media (max-width: 1100px) {
  .lead-grid { grid-template-columns: minmax(0, 1fr); }
  .lg-main, .lg-side { grid-column: 1; grid-row: auto; position: static; }
  .lg-side { order: -1; }
}
@media (max-width: 600px) {
  .lead-head > .btn { width: 100%; }
}

.rate-cell { display: flex; align-items: center; gap: 10px; }
.rate-cell .bar, .rate-cell .rng { flex: 1; min-width: 44px; }
.rate-cell b { min-width: 2.9em; text-align: right; color: var(--navy); }
.table.stack td.cell-bar .rate-cell { width: 100%; }

.chip-line { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; }

.facts dd { overflow-wrap: anywhere; }

/* ── Leaderboard & gamification ────────────────────────────── */
:root { --silver: #9aa6b2; --bronze: #b4743a; }
.mv { display: inline-flex; align-items: center; gap: 1px; padding: 1px 7px; border-radius: 99px; font-size: 11.5px; font-weight: 700; font-variant-numeric: tabular-nums; vertical-align: middle; }
.mv.up { background: var(--good-soft); color: var(--good); }
.mv.down { background: var(--bad-soft); color: var(--bad); }
.mv.flat, .mv.new { background: var(--line-soft); color: var(--muted); }
.mv.new { text-transform: uppercase; letter-spacing: 0.06em; font-size: 10px; }
.pill.lvl { gap: 4px; }
.pill.lvl-1 { background: var(--line-soft); color: #6b7785; }
.pill.lvl-2 { background: var(--info-soft); color: var(--info); }
.pill.lvl-3 { background: #e5f1ec; color: #1f6b50; }
.pill.lvl-4 { background: var(--gold-soft); color: var(--gold-ink); }
.pill.lvl-5 { background: var(--navy); color: var(--gold); }
.flame-t { display: inline-flex; align-items: center; gap: 3px; font-weight: 700; color: var(--muted); }
.flame-t.hot, .pod .flame-t { color: #d4571a; }

.standing {
  display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 24px; align-items: center;
  margin: 0 0 20px; padding: 24px; border-radius: var(--radius); color: #f7f4ef;
  background: linear-gradient(135deg, var(--navy) 0%, var(--navy-700) 100%); border: 1px solid rgba(201, 168, 98, 0.35);
  box-shadow: 0 8px 28px rgba(0, 32, 57, 0.22);
}
.standing-main { display: flex; align-items: center; gap: 18px; min-width: 0; }
.standing-eyebrow { font-size: 11px; font-weight: 600; letter-spacing: 0.16em; text-transform: uppercase; color: var(--gold); }
.standing h2 { font-family: var(--display); font-size: clamp(28px, 4vw, 38px); line-height: 1.08; color: #fff; margin: 2px 0 4px; font-weight: 700; }
.standing h2 b { color: var(--gold); }
.standing-sub { color: rgba(247, 244, 239, 0.72); font-size: 14px; }
.standing .av.lg { border: 2px solid var(--gold); }
.standing-side { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 18px; align-items: center; }
.level-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.muted-l { font-size: 12px; color: rgba(247, 244, 239, 0.6); }
.standing .bar-bg { fill: rgba(255, 255, 255, 0.16); }
.standing .bar.gold .bar-fg { fill: var(--gold); }
.level-note { margin-top: 6px; font-size: 13px; color: rgba(247, 244, 239, 0.8); }
.level-note b { color: var(--gold); }
.streak { display: grid; justify-items: center; gap: 0; padding: 10px 16px; border-radius: 12px; background: rgba(255, 255, 255, 0.08); text-align: center; }
.streak .ic { width: 26px; height: 26px; color: rgba(247, 244, 239, 0.5); }
.streak b { font-size: 26px; line-height: 1.1; font-variant-numeric: tabular-nums; }
.streak span { font-size: 11px; color: rgba(247, 244, 239, 0.65); }
.streak.hot { background: rgba(212, 87, 26, 0.22); box-shadow: inset 0 0 0 1px rgba(255, 150, 80, 0.4); }
.streak.hot .ic { color: #ff9a4d; fill: rgba(255, 154, 77, 0.35); }

.podium { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; align-items: end; margin: 0 0 20px; }
.pod { position: relative; display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center; padding: 26px 16px 20px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.pod.p1 { order: 2; padding-top: 38px; padding-bottom: 28px; border-color: var(--gold); box-shadow: 0 10px 30px rgba(201, 168, 98, 0.3); background: linear-gradient(180deg, var(--gold-soft), #fff 60%); }
.pod.p2 { order: 1; }
.pod.p3 { order: 3; }
.pod.me { outline: 3px solid rgba(201, 168, 98, 0.55); outline-offset: 2px; }
.pod h3 { margin: 8px 0 0; font-size: 17px; color: var(--navy); }
.pod-rank { font-family: var(--display); font-size: 30px; font-weight: 700; line-height: 1; color: var(--navy); }
.pod-pts { font-size: 14px; color: var(--muted); }
.pod-pts b { font-size: 24px; color: var(--navy); font-variant-numeric: tabular-nums; }
.pod-meta { font-size: 13px; }
.medal { position: absolute; top: -16px; display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; color: #fff; box-shadow: 0 3px 10px rgba(0, 32, 57, 0.25); }
.medal.m1 { background: var(--gold); width: 44px; height: 44px; top: -22px; }
.medal.m2 { background: var(--silver); }
.medal.m3 { background: var(--bronze); }

.awards { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 14px; margin: 0 0 20px; }
.award { display: flex; gap: 14px; align-items: center; padding: 16px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.aw-ic { display: grid; place-items: center; flex: none; width: 44px; height: 44px; border-radius: 12px; background: var(--gold-soft); color: var(--gold-ink); }
.aw-speed .aw-ic { background: #fff3d6; color: #a86b00; }
.aw-connect .aw-ic { background: var(--good-soft); color: var(--good); }
.aw-qualified .aw-ic { background: var(--info-soft); color: var(--info); }
.aw-talk .aw-ic { background: #ece8fb; color: #4b3aa8; }
.aw-streak .aw-ic { background: #ffe9dc; color: #d4571a; }
.aw-t { font-size: 11px; font-weight: 600; letter-spacing: 0.09em; text-transform: uppercase; color: var(--muted); }
.aw-w { font-weight: 700; color: var(--navy); font-size: 16px; line-height: 1.25; }
.aw-d { font-size: 13px; color: var(--muted); }

.rank-cell { white-space: nowrap; }
.rk { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--line-soft); color: var(--navy); font-weight: 700; font-size: 13px; font-variant-numeric: tabular-nums; margin-right: 4px; }
.rk.r1 { background: var(--gold); color: var(--navy); }
.rk.r2 { background: var(--silver); color: #fff; }
.rk.r3 { background: var(--bronze); color: #fff; }
tr.is-me td { background: var(--gold-soft); }
tr.is-me:hover td { background: #f3e9cf; }
.how summary { cursor: pointer; font-weight: 650; color: var(--navy); }
.how[open] summary { margin-bottom: 10px; }
.table.plain-t td { padding: 8px 4px; }
.table.plain-t b.neg { color: var(--bad); }

@media (max-width: 900px) {
  .standing { grid-template-columns: minmax(0, 1fr); padding: 18px; gap: 18px; }
  .standing-main { flex-wrap: wrap; }
  .podium { grid-template-columns: minmax(0, 1fr); gap: 26px; margin-top: 26px; }
  .pod.p1, .pod.p2, .pod.p3 { order: 0; }
  .table.stack td.rank-cell { display: flex; }
}
@media (max-width: 480px) {
  .standing-side { grid-template-columns: minmax(0, 1fr); }
  .streak { grid-auto-flow: column; justify-content: center; gap: 8px; align-items: center; }
}

.top-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; }
.top-row { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius-s); text-decoration: none; color: var(--ink); background: var(--card); transition: border-color 0.15s, background 0.15s; }
.top-row:hover { border-color: var(--gold); background: var(--gold-soft); color: var(--ink); }
.top-n { min-width: 0; flex: 1; display: flex; flex-direction: column; line-height: 1.3; }
.top-n b { color: var(--navy); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.top-n small { color: var(--muted); font-size: 12px; }
.top-p { color: var(--muted); font-size: 13px; white-space: nowrap; }
.top-p b { font-size: 20px; color: var(--navy); font-variant-numeric: tabular-nums; }

.table.dense th, .table.dense td { padding: 11px 10px; }
.table.dense th:first-child, .table.dense td:first-child { padding-left: 18px; }
.table.dense th:last-child, .table.dense td:last-child { padding-right: 18px; }
.table.dense .who { white-space: nowrap; }

.delta { white-space: nowrap; }
.kpi-foot { flex-wrap: wrap; gap: 2px 8px; }
.kpi-foot .muted { white-space: nowrap; }

/* ── Lead distribution (Distribution page + the agent's own switch) ── */
.seg-btn { gap: 2px; flex-wrap: nowrap; }
.seg-btn button { appearance: none; border: 0; background: transparent; padding: 7px 12px; border-radius: 8px; color: var(--muted); font: inherit; font-weight: 600; font-size: 13px; cursor: pointer; display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.seg-btn button:hover { color: var(--ink); background: var(--bg); }
.seg-btn button:focus-visible { outline: 3px solid rgba(201, 168, 98, 0.45); outline-offset: 1px; }
.seg-btn button.on { background: var(--good); color: #fff; }
.seg-btn button.on.off { background: var(--bad); color: #fff; }
.seg-btn[disabled], .seg-btn button[disabled] { opacity: 0.5; cursor: not-allowed; }

.dist-kpis { grid-template-columns: minmax(164px, 220px) 1fr; }
.kpi-of { font-size: 15px; font-weight: 600; color: var(--muted); letter-spacing: 0; }
.kpi .small.bad { color: var(--bad); font-size: 16px; }
.next-list { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; counter-reset: nx; margin-top: 4px; }
.next-list li { counter-increment: nx; display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px 4px 4px; background: var(--gold-soft); color: var(--gold-ink); border-radius: 99px; font-weight: 600; font-size: 13px; }
.next-list li::before { content: counter(nx); display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; background: #fff; color: var(--navy); font-size: 11px; font-weight: 700; }

.dist-table select { min-width: 0; width: 136px; padding: 7px 24px 7px 9px; font-size: 13px; }
.dist-table .seg-btn button { padding: 7px 9px; }
.dist-table th, .dist-table td { padding-left: 10px; padding-right: 10px; }
.dist-table .who b { white-space: nowrap; }
.dist-table .who small { white-space: normal; max-width: 180px; display: block; }
.dist-table td { vertical-align: middle; }
.dist-table tr.is-off .who b { color: var(--muted); }
.dist-table .share { color: var(--gold-ink); font-size: 15px; }

.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 20px; }
.changes { list-style: none; display: grid; gap: 10px; padding-left: 0; }
.changes li { font-size: 14px; line-height: 1.45; }
.how-card ul { display: grid; gap: 8px; padding-left: 18px; }
.how-card .ic-s { vertical-align: -2px; }

.poolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; padding: 12px 16px; margin-bottom: 18px; background: var(--card); border: 1px solid var(--line); border-left: 4px solid var(--good); border-radius: var(--radius-s); box-shadow: var(--shadow); }
.poolbar.is-off { border-left-color: var(--bad); }
.poolbar-t { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; }
.poolbar-t b { color: var(--navy); }
.poolbar-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--good); align-self: center; }
.poolbar.is-off .poolbar-dot { background: var(--bad); }

@media (max-width: 900px) {
  .dist-kpis { grid-template-columns: 1fr; }
  .dist-table select { width: 100%; }
  .seg-btn button { padding: 9px 12px; }
}
@media (max-width: 480px) {
  .poolbar { padding: 12px; }
  .poolbar .seg-btn { width: 100%; justify-content: space-between; }
  .poolbar .seg-btn button { flex: 1; justify-content: center; }
}
