/* ==========================================================================
   Stale Leads — design system
   Inspired by the current iOS design language: frosted surfaces, generous
   radii, grouped lists, segmented controls, restrained motion. No framework.
   ========================================================================== */

:root {
  color-scheme: light;

  --bg:            #f2f2f7;
  --bg-elev:       rgba(255, 255, 255, 0.72);
  --bg-solid:      #ffffff;
  --bg-inset:      rgba(120, 120, 128, 0.08);
  --bg-nav:        rgba(246, 246, 249, 0.78);

  --ink:           #1c1c1e;
  --ink-2:         #3c3c43;
  --muted:         #8a8a8e;
  --line:          rgba(60, 60, 67, 0.12);
  --line-strong:   rgba(60, 60, 67, 0.22);

  --accent:        #0a7d55;
  --accent-ink:    #ffffff;
  --accent-soft:   rgba(10, 125, 85, 0.10);
  --blue:          #0a68d0;
  --amber:         #b25e00;
  --amber-soft:    rgba(255, 176, 32, 0.16);
  --red:           #c62f2f;
  --red-soft:      rgba(198, 47, 47, 0.10);

  --r-xs: 8px;
  --r-sm: 12px;
  --r-md: 16px;
  --r-lg: 22px;
  --r-xl: 28px;

  --shadow-sm: 0 1px 2px rgba(0,0,0,.05), 0 1px 1px rgba(0,0,0,.03);
  --shadow-md: 0 4px 16px rgba(0,0,0,.07), 0 1px 3px rgba(0,0,0,.05);
  --shadow-lg: 0 18px 50px rgba(0,0,0,.16), 0 4px 12px rgba(0,0,0,.08);

  --ease: cubic-bezier(.32, .72, 0, 1);
}

/* The theme attribute is always resolved to light or dark by app.js, so the
   palette never depends on CSS nesting support. */

html[data-theme="dark"] {
  color-scheme: dark;

  --bg:            #000000;
  --bg-elev:       rgba(28, 28, 30, 0.72);
  --bg-solid:      #1c1c1e;
  --bg-inset:      rgba(118, 118, 128, 0.18);
  --bg-nav:        rgba(18, 18, 20, 0.76);

  --ink:           #f5f5f7;
  --ink-2:         #d8d8dc;
  --muted:         #8e8e93;
  --line:          rgba(84, 84, 88, 0.5);
  --line-strong:   rgba(120, 120, 128, 0.55);

  --accent:        #31d18a;
  --accent-ink:    #04231a;
  --accent-soft:   rgba(49, 209, 138, 0.14);
  --blue:          #5aaaff;
  --amber:         #ffc65c;
  --amber-soft:    rgba(255, 176, 32, 0.14);
  --red:           #ff6b6b;
  --red-soft:      rgba(255, 107, 107, 0.14);

  --shadow-sm: 0 1px 2px rgba(0,0,0,.5);
  --shadow-md: 0 6px 20px rgba(0,0,0,.55);
  --shadow-lg: 0 24px 60px rgba(0,0,0,.7);
}

* { box-sizing: border-box; }
html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.47 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  -webkit-text-size-adjust: 100%;
  overscroll-behavior-y: none;
}

button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: none; background: none; }
h1,h2,h3 { margin: 0; letter-spacing: -0.02em; font-weight: 700; }
p { margin: 0; }
.muted { color: var(--muted); }
[hidden] { display: none !important; }

/* ───────────────────────────── layout ───────────────────────────── */
.app { display: grid; grid-template-columns: 248px 1fr; min-height: 100dvh; }

.nav {
  position: sticky; top: 0; align-self: start; height: 100dvh;
  display: flex; flex-direction: column; gap: 18px;
  padding: 22px 14px;
  background: var(--bg-nav);
  backdrop-filter: saturate(180%) blur(24px);
  -webkit-backdrop-filter: saturate(180%) blur(24px);
  border-right: 1px solid var(--line);
}
.nav-brand { display: flex; align-items: center; gap: 11px; padding: 0 8px 4px; }
.nav-mark {
  width: 34px; height: 34px; border-radius: 10px; flex: none;
  display: grid; place-items: center;
  background: linear-gradient(160deg, var(--accent), color-mix(in srgb, var(--accent) 62%, #0b3b8f));
  color: var(--accent-ink); font-weight: 800; font-size: 13px; letter-spacing: -0.03em;
  box-shadow: var(--shadow-sm);
}
.nav-title { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.nav-title strong { font-size: 15px; letter-spacing: -0.02em; }
.nav-title span { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.nav-items { display: flex; flex-direction: column; gap: 2px; }
.nav-item {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 10px; border-radius: var(--r-xs);
  color: var(--ink-2); font-size: 14.5px; font-weight: 500;
  transition: background .16s var(--ease), color .16s var(--ease);
}
.nav-item svg { width: 19px; height: 19px; flex: none; fill: currentColor; opacity: .78; }
.nav-item:hover { background: var(--bg-inset); }
.nav-item.is-active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.nav-item.is-active svg { opacity: 1; }
.nav-badge {
  margin-left: auto; font-style: normal; font-size: 12px; font-weight: 650;
  background: var(--bg-inset); color: var(--muted);
  padding: 1px 8px; border-radius: 20px; min-width: 24px; text-align: center;
}
.nav-item.is-active .nav-badge { background: var(--accent); color: var(--accent-ink); }
.nav-dot { margin-left: auto; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); animation: pulse 1.6s infinite; }
@keyframes pulse { 0%,100% { opacity: 1 } 50% { opacity: .35 } }
.nav-foot { margin-top: auto; }

.main { min-width: 0; padding: 34px 34px 90px; max-width: 1180px; }
.view { display: none; animation: fade .28s var(--ease); }
.view.is-active { display: block; }
@keyframes fade { from { opacity: 0; transform: translateY(6px) } to { opacity: 1; transform: none } }

.view-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; margin-bottom: 20px; flex-wrap: wrap; }
.view-head h1 { font-size: 30px; }
.view-head-actions { display: flex; gap: 9px; align-items: center; }

/* ───────────────────────────── hero ───────────────────────────── */
.hero {
  background: var(--bg-elev);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
  padding: 34px 32px 30px;
  margin-bottom: 18px;
  box-shadow: var(--shadow-md);
}
.hero-eyebrow { font-size: 12.5px; font-weight: 650; letter-spacing: .06em; text-transform: uppercase; color: var(--accent); }
.hero-num { font-size: clamp(48px, 8vw, 76px); line-height: 1; letter-spacing: -0.045em; margin: 8px 0 2px; font-weight: 750; }
.hero-sub { font-size: 18px; color: var(--ink-2); font-weight: 500; }
.hero-meta { margin-top: 10px; font-size: 13px; color: var(--muted); }
.hero-actions { display: flex; gap: 10px; margin-top: 20px; flex-wrap: wrap; }

/* ───────────────────────────── cards ───────────────────────────── */
.card {
  background: var(--bg-elev);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 22px 24px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
}
.card-head { margin-bottom: 14px; }
.card-head h2 { font-size: 17px; }
.card-head p { font-size: 13.5px; color: var(--muted); margin-top: 3px; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(168px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat {
  background: var(--bg-elev); border: 1px solid var(--line); border-radius: var(--r-md);
  padding: 16px 18px; box-shadow: var(--shadow-sm);
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
}
.stat b { display: block; font-size: 29px; letter-spacing: -0.035em; font-weight: 700; line-height: 1.1; }
.stat span { display: block; font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .045em; margin-top: 4px; font-weight: 600; }
.stat-grid-sm .stat b { font-size: 23px; }

/* ───────────────────────────── funnel ───────────────────────────── */
.funnel { list-style: none; margin: 0; padding: 0; }
.funnel li {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 11px 0; border-bottom: 1px solid var(--line); font-size: 14.5px;
}
.funnel li:last-child { border-bottom: none; }
.funnel .n { font-variant-numeric: tabular-nums; font-weight: 650; }
.funnel .cut { color: var(--muted); }
.funnel .cut .n { color: var(--muted); }
.funnel .final { color: var(--accent); font-weight: 650; }
.funnel .final .n { color: var(--accent); }
.funnel small { display: block; font-size: 12px; color: var(--muted); font-weight: 400; margin-top: 2px; }

/* ───────────────────────────── controls ───────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 9px 17px; border-radius: 980px; font-size: 14.5px; font-weight: 600;
  transition: transform .12s var(--ease), background .16s var(--ease), opacity .16s;
  white-space: nowrap;
}
.btn:active { transform: scale(.96); }
.btn:disabled { opacity: .42; pointer-events: none; }
.btn-primary { background: var(--accent); color: var(--accent-ink); box-shadow: var(--shadow-sm); }
.btn-ghost { background: var(--bg-inset); color: var(--ink); }
.btn-ghost:hover { background: var(--line); }
.btn-danger { background: var(--red-soft); color: var(--red); }
.btn-lg { padding: 13px 30px; font-size: 16px; }
.btn-icon svg { width: 16px; height: 16px; fill: currentColor; }
.chip-count { font-style: normal; background: var(--accent); color: var(--accent-ink); border-radius: 20px; padding: 0 6px; font-size: 11px; font-weight: 700; }

.seg {
  display: inline-flex; padding: 2px; gap: 2px;
  background: var(--bg-inset); border-radius: 10px;
}
.seg button {
  padding: 6px 15px; border-radius: 8px; font-size: 13.5px; font-weight: 550;
  color: var(--ink-2); transition: background .18s var(--ease), color .18s;
  white-space: nowrap;
}
.seg button.is-on { background: var(--bg-solid); color: var(--ink); font-weight: 620; box-shadow: var(--shadow-sm); }
.seg-sm button { padding: 5px 11px; font-size: 12.5px; }
.seg-full { display: flex; width: 100%; }
.seg-full button { flex: 1; }

.toolbar { display: flex; gap: 10px; align-items: center; margin-bottom: 14px; flex-wrap: wrap; }
.search {
  display: flex; align-items: center; gap: 8px; flex: 1; min-width: 200px;
  background: var(--bg-inset); border-radius: 10px; padding: 8px 12px;
}
.search svg { width: 16px; height: 16px; fill: none; stroke: var(--muted); stroke-width: 2; stroke-linecap: round; }
.search input { border: none; background: none; outline: none; width: 100%; font-size: 14.5px; }
.sortwrap select {
  appearance: none; background: var(--bg-inset); border: none; border-radius: 10px;
  padding: 9px 32px 9px 13px; font-size: 13.5px; font-weight: 550; outline: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%238a8a8e'%3E%3Cpath d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 8px center; background-size: 18px;
}

.active-filters { display: flex; gap: 7px; flex-wrap: wrap; margin-bottom: 14px; }
.fchip {
  display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 570;
  background: var(--accent-soft); color: var(--accent); padding: 4px 8px 4px 11px; border-radius: 980px;
}
.fchip button { color: inherit; opacity: .65; font-size: 15px; line-height: 1; padding: 0 2px; }
.fchip button:hover { opacity: 1; }

/* switch */
.switch { position: relative; width: 51px; height: 31px; flex: none; }
.switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; z-index: 1; }
.switch i {
  position: absolute; inset: 0; border-radius: 980px; background: var(--line-strong);
  transition: background .28s var(--ease);
}
.switch i::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 27px; height: 27px;
  background: #fff; border-radius: 50%; box-shadow: 0 3px 8px rgba(0,0,0,.15), 0 1px 1px rgba(0,0,0,.16);
  transition: transform .28s var(--ease);
}
.switch input:checked + i { background: var(--accent); }
.switch input:checked + i::after { transform: translateX(20px); }

/* ───────────────────────── settings list ───────────────────────── */
.group { margin-bottom: 24px; }
.group-title { font-size: 12.5px; font-weight: 650; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); padding: 0 6px 8px; }
.list {
  background: var(--bg-elev); border: 1px solid var(--line); border-radius: var(--r-md);
  overflow: hidden; box-shadow: var(--shadow-sm);
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
}
.row {
  display: flex; align-items: center; gap: 14px; width: 100%; text-align: left;
  padding: 13px 16px; border-bottom: 1px solid var(--line); background: none;
  transition: background .14s;
}
.row:last-child { border-bottom: none; }
.row.tappable:hover { background: var(--bg-inset); }
.row-label { flex: 1; min-width: 0; }
.row-label b { display: block; font-weight: 500; font-size: 15px; }
.row-label small { display: block; color: var(--muted); font-size: 12.5px; margin-top: 2px; line-height: 1.4; }
.row-value { color: var(--muted); font-size: 14.5px; text-align: right; white-space: nowrap; max-width: 46%; overflow: hidden; text-overflow: ellipsis; }
.row-chev { width: 8px; height: 13px; flex: none; opacity: .3; }
.row-chev path { stroke: currentColor; stroke-width: 2.4; fill: none; stroke-linecap: round; }
.row-stack { display: block; }
.row-stack .row-label { margin-bottom: 10px; }

.field { display: flex; flex-direction: column; gap: 7px; margin-bottom: 16px; }
.field > label { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.field small { color: var(--muted); font-size: 12.5px; line-height: 1.45; }
.input, .field input[type="text"], .field input[type="number"], .field textarea {
  background: var(--bg-inset); border: 1px solid transparent; border-radius: 10px;
  padding: 10px 13px; font-size: 15px; outline: none; width: 100%;
  transition: border-color .16s, background .16s;
}
.input:focus, .field input:focus, .field textarea:focus { border-color: var(--accent); background: var(--bg-solid); }
.field textarea { resize: vertical; min-height: 74px; font-family: inherit; }
.inline { display: flex; gap: 10px; align-items: center; }
.inline .input { flex: 1; }

.pills { display: flex; flex-wrap: wrap; gap: 7px; }
.pill {
  padding: 7px 14px; border-radius: 980px; font-size: 13.5px; font-weight: 560;
  background: var(--bg-inset); color: var(--ink-2); transition: background .16s, color .16s;
}
.pill.is-on { background: var(--accent); color: var(--accent-ink); }

.taglist { display: flex; flex-wrap: wrap; gap: 7px; }
.tag {
  display: inline-flex; align-items: center; gap: 7px; padding: 5px 8px 5px 12px;
  background: var(--bg-inset); border-radius: 980px; font-size: 13.5px; font-variant-numeric: tabular-nums;
}
.tag button { opacity: .45; font-size: 16px; line-height: 1; }
.tag button:hover { opacity: 1; color: var(--red); }
.tag-kind { font-size: 10.5px; text-transform: uppercase; letter-spacing: .04em; font-weight: 700; padding: 1px 6px; border-radius: 5px; }
.tag-kind.BROKERAGE { background: rgba(10,104,208,.14); color: var(--blue); }
.tag-kind.PROPERTY_MANAGER { background: var(--amber-soft); color: var(--amber); }
.tag-kind.INSTITUTIONAL { background: var(--accent-soft); color: var(--accent); }

/* ───────────────────────────── leads ───────────────────────────── */
.lead-list { display: flex; flex-direction: column; gap: 11px; }
.lead {
  background: var(--bg-elev); border: 1px solid var(--line); border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm); overflow: hidden;
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  transition: box-shadow .2s var(--ease), transform .2s var(--ease);
}
.lead:hover { box-shadow: var(--shadow-md); }
.lead-main { display: grid; grid-template-columns: 1fr 260px; gap: 22px; padding: 17px 20px; }
.lead-left { min-width: 0; }
.lead-top { display: flex; align-items: flex-start; gap: 12px; }
.lead-addr { font-size: 16.5px; font-weight: 650; letter-spacing: -0.015em; line-height: 1.3; }
.lead-addr a { color: inherit; text-decoration: none; border-bottom: 1.5px solid var(--line-strong); }
.lead-addr a:hover { border-bottom-color: var(--ink); }
.lead-score {
  margin-left: auto; flex: none; text-align: center; background: var(--accent-soft);
  color: var(--accent); border-radius: 12px; padding: 5px 11px; min-width: 54px;
}
.lead-score b { display: block; font-size: 17px; font-weight: 750; line-height: 1.1; font-variant-numeric: tabular-nums; }
.lead-score span { font-size: 9.5px; text-transform: uppercase; letter-spacing: .06em; opacity: .75; font-weight: 650; }
.lead-facts { display: flex; flex-wrap: wrap; align-items: center; gap: 5px 9px; margin-top: 7px; font-size: 14.5px; color: var(--ink-2); }
.lead-facts b { font-weight: 650; color: var(--ink); }
.lead-facts .dot { color: var(--line-strong); }
.lead-drop { color: var(--red); font-weight: 620; font-size: 13.5px; }
.badges { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.badge {
  font-size: 11.5px; font-weight: 620; padding: 3px 9px; border-radius: 980px;
  background: var(--bg-inset); color: var(--ink-2);
}
.badge.owner { background: var(--accent-soft); color: var(--accent); }
.badge.review { background: var(--amber-soft); color: var(--amber); }
.badge.direct { background: rgba(10,104,208,.13); color: var(--blue); }
.why { margin: 12px 0 0; padding: 0; list-style: none; display: flex; flex-wrap: wrap; gap: 4px 14px; }
.why li { font-size: 13px; color: var(--muted); position: relative; padding-left: 12px; }
.why li::before { content: ""; position: absolute; left: 2px; top: 8px; width: 4px; height: 4px; border-radius: 50%; background: var(--accent); opacity: .6; }
.why-h { font-size: 10.5px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); font-weight: 700; margin-top: 13px; }

.lead-right { border-left: 1px solid var(--line); padding-left: 20px; display: flex; flex-direction: column; gap: 9px; }
.contact-name { font-weight: 620; font-size: 15px; }
.contact-name.none { color: var(--muted); font-weight: 500; font-size: 13.5px; }
.contact-broker { font-size: 12.5px; color: var(--muted); }
.contact-phone { font-size: 19px; font-weight: 700; color: var(--accent); letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.lead-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: auto; }
.lead-actions .btn { padding: 8px 14px; font-size: 13.5px; }
.disp-row { display: flex; align-items: center; gap: 8px; padding: 10px 20px; border-top: 1px solid var(--line); background: var(--bg-inset); flex-wrap: wrap; }
.disp-row .seg button { font-size: 12.5px; padding: 5px 11px; }
.disp-note { margin-left: auto; font-size: 12.5px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.disp-note button { color: var(--blue); font-weight: 600; font-size: 12.5px; }
.status-tag { font-size: 11px; font-weight: 700; letter-spacing: .04em; padding: 3px 9px; border-radius: 980px; text-transform: uppercase; }
.status-CALLED { background: rgba(10,104,208,.13); color: var(--blue); }
.status-INTERESTED { background: var(--accent-soft); color: var(--accent); }
.status-NOT_INTERESTED { background: var(--bg-inset); color: var(--muted); }
.status-BAD_LEAD { background: var(--red-soft); color: var(--red); }
.status-REVIEWED { background: var(--amber-soft); color: var(--amber); }

/* ───────────────────────────── run ───────────────────────────── */
.run-card { text-align: center; padding: 34px 28px; }
.run-icon, .run-check, .run-warn {
  width: 62px; height: 62px; border-radius: 20px; margin: 0 auto 16px;
  display: grid; place-items: center; background: var(--accent-soft);
}
.run-icon svg, .run-check svg, .run-warn svg { width: 28px; height: 28px; }
.run-icon svg { fill: var(--accent); }
.run-check svg { fill: none; stroke: var(--accent); stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
.run-warn { background: var(--red-soft); }
.run-warn svg { fill: none; stroke: var(--red); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.run-card h2 { font-size: 22px; margin-bottom: 6px; }
.run-card .btn { margin-top: 18px; }
.fineprint { font-size: 12.5px; color: var(--muted); margin-top: 14px; }
.run-phase { font-size: 21px; font-weight: 700; letter-spacing: -0.02em; }
.run-detail { color: var(--muted); font-size: 14px; margin-top: 5px; min-height: 21px; }
.bar { height: 10px; border-radius: 980px; background: var(--bg-inset); overflow: hidden; margin: 20px 0 9px; }
.bar-fill { height: 100%; border-radius: 980px; background: linear-gradient(90deg, var(--accent), color-mix(in srgb, var(--accent) 60%, var(--blue))); transition: width .5s var(--ease); }
.run-meta { display: flex; justify-content: space-between; font-size: 13.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.run-meta strong { color: var(--ink); font-weight: 650; }
.phases { list-style: none; margin: 22px 0 0; padding: 0; display: flex; flex-direction: column; gap: 1px; text-align: left; }
.phases li { display: flex; align-items: center; gap: 11px; padding: 9px 12px; border-radius: 10px; font-size: 14px; color: var(--muted); }
.phases li.done { color: var(--ink-2); }
.phases li.active { background: var(--accent-soft); color: var(--accent); font-weight: 620; }
.phase-mark { width: 18px; height: 18px; border-radius: 50%; border: 2px solid currentColor; opacity: .35; flex: none; display: grid; place-items: center; font-size: 10px; }
.phases li.done .phase-mark { opacity: 1; background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.phases li.active .phase-mark { opacity: 1; border-style: dashed; animation: spin 2.4s linear infinite; }
@keyframes spin { to { transform: rotate(360deg) } }
.details { margin-top: 20px; text-align: left; }
.details summary { cursor: pointer; font-size: 13.5px; color: var(--blue); font-weight: 570; padding: 6px 0; }
.details pre {
  background: var(--bg-inset); border-radius: 12px; padding: 13px 15px; margin-top: 8px;
  font-size: 12px; line-height: 1.65; overflow-x: auto; max-height: 260px; overflow-y: auto;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; color: var(--ink-2);
}

/* ───────────────────────────── reports ───────────────────────────── */
.report-list { display: flex; flex-direction: column; gap: 10px; }
.report {
  background: var(--bg-elev); border: 1px solid var(--line); border-radius: var(--r-md);
  padding: 16px 20px; display: flex; align-items: center; gap: 18px; flex-wrap: wrap;
  box-shadow: var(--shadow-sm); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
}
.report-when { min-width: 168px; }
.report-when b { display: block; font-size: 15px; font-weight: 620; }
.report-when small { color: var(--muted); font-size: 12.5px; }
.report-counts { display: flex; gap: 20px; }
.report-counts div { text-align: center; }
.report-counts b { display: block; font-size: 18px; font-weight: 700; font-variant-numeric: tabular-nums; }
.report-counts span { font-size: 10.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; font-weight: 620; }
.report-actions { margin-left: auto; display: flex; gap: 7px; flex-wrap: wrap; }
.report-actions .btn { padding: 7px 13px; font-size: 13px; }
.mode-tag { font-size: 10.5px; font-weight: 700; letter-spacing: .05em; padding: 2px 7px; border-radius: 6px; text-transform: uppercase; }
.mode-PREVIEW { background: var(--amber-soft); color: var(--amber); }
.mode-FINAL { background: var(--accent-soft); color: var(--accent); }

.empty { text-align: center; padding: 60px 20px; color: var(--muted); }
.empty h3 { font-size: 17px; color: var(--ink); margin-bottom: 6px; }

/* ───────────────────────────── sheet ───────────────────────────── */
.sheet-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,.34); z-index: 40;
  backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px);
  animation: fadein .24s var(--ease);
}
@keyframes fadein { from { opacity: 0 } to { opacity: 1 } }
.sheet {
  position: fixed; z-index: 41; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: min(540px, calc(100vw - 32px)); max-height: 86dvh; display: flex; flex-direction: column;
  background: var(--bg-solid); border: 1px solid var(--line);
  border-radius: var(--r-xl); box-shadow: var(--shadow-lg);
  animation: pop .3s var(--ease);
}
@keyframes pop { from { opacity: 0; transform: translate(-50%, -46%) scale(.97) } to { opacity: 1; transform: translate(-50%,-50%) scale(1) } }
.sheet-grab { display: none; }
.sheet-head {
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px;
  padding: 15px 18px; border-bottom: 1px solid var(--line);
}
.sheet-head h3 { font-size: 16px; text-align: center; }
.sheet-cancel { color: var(--blue); font-size: 15px; text-align: left; }
.sheet-done { color: var(--blue); font-size: 15px; font-weight: 650; text-align: right; }
.sheet-body { padding: 20px; overflow-y: auto; -webkit-overflow-scrolling: touch; }

/* ───────────────────────────── toasts ───────────────────────────── */
.toasts { position: fixed; z-index: 60; bottom: 26px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast {
  background: rgba(28,28,30,.92); color: #fff; padding: 11px 20px; border-radius: 980px;
  font-size: 14px; font-weight: 550; box-shadow: var(--shadow-lg);
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  animation: toastin .32s var(--ease);
}
html[data-theme="dark"] .toast { background: rgba(240,240,245,.94); color: #111; }
.toast.err { background: var(--red); color: #fff; }
@keyframes toastin { from { opacity: 0; transform: translateY(14px) scale(.94) } to { opacity: 1; transform: none } }

/* ───────────────────────────── responsive ───────────────────────────── */
@media (max-width: 900px) {
  .lead-main { grid-template-columns: 1fr; gap: 14px; }
  .lead-right { border-left: none; border-top: 1px solid var(--line); padding-left: 0; padding-top: 14px; }
}

@media (max-width: 760px) {
  .app { grid-template-columns: 1fr; }
  .main { padding: 16px 14px calc(84px + env(safe-area-inset-bottom)); }

  .nav {
    position: fixed; bottom: 0; top: auto; left: 0; right: 0; height: auto; z-index: 30;
    flex-direction: row; padding: 7px 6px calc(7px + env(safe-area-inset-bottom));
    border-right: none; border-top: 1px solid var(--line);
  }
  .nav-brand, .nav-foot { display: none; }
  .nav-items { flex-direction: row; width: 100%; gap: 0; }
  .nav-item {
    /* Positioned so the count badge anchors to ITS tab, not to the whole bar. */
    position: relative;
    flex: 1; flex-direction: column; gap: 3px; padding: 7px 2px; font-size: 10.5px; font-weight: 570;
    border-radius: 10px; min-height: 50px; justify-content: center;
  }
  .nav-item svg { width: 23px; height: 23px; }
  .nav-item.is-active { background: none; }
  .nav-badge { position: absolute; top: 3px; left: 50%; margin-left: 6px; right: auto; font-size: 10px; padding: 0 5px; min-width: 18px; }
  .nav-dot { position: absolute; top: 7px; left: 50%; margin-left: 9px; right: auto; }

  .view-head { margin-bottom: 14px; }
  .view-head h1 { font-size: 25px; }
  .hero { padding: 24px 20px; border-radius: var(--r-lg); }
  .card { padding: 18px 16px; border-radius: var(--r-md); }
  .stat-grid { grid-template-columns: repeat(2, 1fr); gap: 9px; }
  .stat { padding: 13px 14px; }
  .stat b { font-size: 24px; }

  .toolbar { gap: 8px; }
  .seg { width: 100%; }
  .seg button { flex: 1; }
  .search { min-width: 0; }
  .sortwrap, .sortwrap select { width: 100%; }

  .lead-main { padding: 15px 16px; }
  .lead-addr { font-size: 15.5px; }
  .contact-phone { font-size: 21px; }
  .lead-actions { flex-direction: column; }
  .lead-actions .btn { width: 100%; padding: 12px; font-size: 15px; }
  .disp-row { padding: 10px 16px; }
  .disp-note { margin-left: 0; width: 100%; }

  .report { flex-direction: column; align-items: stretch; gap: 12px; }
  .report-actions { margin-left: 0; }
  .report-actions .btn { flex: 1; }

  /* bottom sheet on phones */
  .sheet {
    top: auto; bottom: 0; left: 0; transform: none;
    width: 100%; max-width: none; max-height: 90dvh;
    border-radius: var(--r-xl) var(--r-xl) 0 0; border-bottom: none;
    animation: sheetup .34s var(--ease);
    padding-bottom: env(safe-area-inset-bottom);
  }
  @keyframes sheetup { from { transform: translateY(100%) } to { transform: none } }
  .sheet-grab { display: block; width: 36px; height: 5px; border-radius: 3px; background: var(--line-strong); margin: 8px auto 0; }
  .toasts { bottom: calc(78px + env(safe-area-inset-bottom)); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ───────────────────────── login ───────────────────────── */
.login {
  position: fixed; inset: 0; z-index: 50; display: grid; place-items: center;
  padding: 24px; background: var(--bg);
}
.login-card {
  width: min(380px, 100%); background: var(--bg-elev); border: 1px solid var(--line);
  border-radius: var(--r-xl); padding: 32px 28px; box-shadow: var(--shadow-lg);
  backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px);
  text-align: center;
}
.login-mark {
  width: 52px; height: 52px; border-radius: 15px; margin: 0 auto 16px;
  display: grid; place-items: center; font-weight: 800; font-size: 18px; letter-spacing: -.03em;
  background: linear-gradient(160deg, var(--accent), color-mix(in srgb, var(--accent) 62%, #0b3b8f));
  color: var(--accent-ink); box-shadow: var(--shadow-md);
}
.login-card h1 { font-size: 22px; margin-bottom: 4px; }
.login-card > .muted { font-size: 14px; margin-bottom: 22px; }
.login-card .field { text-align: left; }
.login-card .btn { width: 100%; margin-top: 6px; }
.login-error {
  background: var(--red-soft); color: var(--red); border-radius: 10px;
  padding: 9px 12px; font-size: 13.5px; font-weight: 550; margin-bottom: 12px;
}

.who {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 0 8px 10px; font-size: 12px; color: var(--muted);
}
.who span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who button { color: var(--blue); font-size: 12px; font-weight: 600; flex: none; }

/* ───────────────────────── ETA ───────────────────────── */
.run-eta {
  margin-top: 14px; padding: 12px 16px; border-radius: var(--r-md);
  background: var(--accent-soft); display: flex; flex-direction: column; gap: 2px;
}
.run-eta > span {
  font-size: 11px; text-transform: uppercase; letter-spacing: .06em;
  color: var(--muted); font-weight: 650;
}
.run-eta strong { font-size: 20px; font-weight: 700; color: var(--accent); letter-spacing: -.02em; }
.run-eta small { font-size: 12px; color: var(--muted); }

@media (max-width: 760px) {
  .who { display: none; }
}

/* ── collector ─────────────────────────────────────────────────────── */
/* The collector is infrastructure, so it gets a quiet card that only
   raises its voice when it is the reason a run cannot start. */
.collector-card { text-align: left; }
.collector-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem;
}
.collector-card h2 { margin: 0 0 .25rem; font-size: 1.05rem; }
.collector-state {
  display: flex; align-items: center; gap: .5rem;
  margin: 0; font-size: .9rem; color: var(--ink-2);
}
.collector-state .dot {
  width: .55rem; height: .55rem; border-radius: 50%;
  background: var(--muted); flex: none;
}
.collector-state.is-online .dot { background: #34c759; box-shadow: 0 0 0 3px rgb(52 199 89 / .18); }
.collector-state.is-online { color: var(--ink); }
.collector-state.is-offline .dot { background: var(--muted); }
.collector-state.is-warn .dot { background: #ff9f0a; box-shadow: 0 0 0 3px rgb(255 159 10 / .18); }

.device-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; padding: .75rem 0; border-top: 1px solid var(--line);
}
.device-row:first-child { border-top: 0; }
.device-name { font-weight: 600; }
.device-meta { font-size: .8rem; color: var(--muted); margin-top: .1rem; }
.device-badge {
  font-size: .72rem; font-weight: 600; letter-spacing: .02em;
  padding: .2rem .5rem; border-radius: 999px; white-space: nowrap;
}
.device-badge.on { background: rgb(52 199 89 / .15); color: #248a3d; }
.device-badge.off { background: var(--bg-inset); color: var(--muted); }
.device-badge.warn { background: rgb(255 159 10 / .18); color: #a15c00; }
:root:not([data-theme="light"]) .device-badge.on { color: #4ade80; }
:root:not([data-theme="light"]) .device-badge.warn { color: #fbbf24; }
@media (prefers-color-scheme: dark) {
  .device-badge.on { color: #4ade80; }
  .device-badge.warn { color: #fbbf24; }
}
:root[data-theme="dark"] .device-badge.on { color: #4ade80; }
:root[data-theme="dark"] .device-badge.warn { color: #fbbf24; }

.collector-blocked {
  margin-top: .75rem; padding: .75rem .9rem; border-radius: var(--r-md);
  background: rgb(255 159 10 / .12); color: var(--ink); font-size: .88rem;
}
.pair-steps { counter-reset: step; list-style: none; padding: 0; margin: 0; }
.pair-steps li {
  counter-increment: step; position: relative; padding: .6rem 0 .6rem 2.25rem;
  border-top: 1px solid var(--line); font-size: .92rem;
}
.pair-steps li:first-child { border-top: 0; }
.pair-steps li::before {
  content: counter(step); position: absolute; left: 0; top: .55rem;
  width: 1.5rem; height: 1.5rem; border-radius: 50%;
  background: var(--bg-inset); color: var(--ink-2);
  display: grid; place-items: center; font-size: .78rem; font-weight: 600;
}
.pair-steps strong { display: block; }
.pair-steps small { color: var(--muted); }

/* ── scan depth ────────────────────────────────────────────────────── */
.depth { margin: 1rem 0 .25rem; text-align: left; }
.seg-depth { width: 100%; }
.depth-facts {
  display: grid; grid-template-columns: auto 1fr; gap: .3rem .75rem;
  margin: .85rem 0 0; font-size: .85rem;
}
.depth-facts dt { color: var(--muted); }
.depth-facts dd { margin: 0; color: var(--ink); font-variant-numeric: tabular-nums; }
.depth-warn {
  margin: .75rem 0 0; padding: .7rem .85rem; border-radius: var(--r-md);
  background: rgb(255 159 10 / .12); color: var(--ink); font-size: .85rem;
}
.run-cap { font-size: .8rem; color: var(--muted); margin-top: .3rem; }
.depth-rec {
  display: inline-block; margin-left: .4rem; padding: .1rem .45rem;
  border-radius: 999px; background: var(--accent-soft);
  color: var(--accent); font-size: .7rem; font-weight: 600;
  letter-spacing: .01em; vertical-align: middle;
}

.run-stop { margin: .9rem 0 .25rem; display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.run-stop-note { font-size: .82rem; color: var(--muted); }

/* ── custom select ─────────────────────────────────────────────────── */
/* The browser's native menu ignores the page theme entirely; this one is
   rendered in-page so dark mode stays dark and type stays consistent. */
.sel { position: relative; min-width: 0; }
.sel-btn {
  display: flex; align-items: center; justify-content: space-between;
  gap: .5rem; width: 100%; text-align: left; cursor: pointer;
}
.sel-btn svg { width: 1rem; height: 1rem; flex: none; stroke: currentColor; fill: none; stroke-width: 2; opacity: .55; }
.sel-btn[aria-expanded="true"] svg { transform: rotate(180deg); }
.sel-menu {
  position: absolute; z-index: 60; top: calc(100% + 6px); left: 0;
  min-width: 100%; max-width: min(20rem, 92vw); max-height: 300px; overflow-y: auto;
  background: var(--bg-solid);
  border: 1px solid var(--line); border-radius: var(--r-md);
  box-shadow: 0 12px 32px rgb(0 0 0 / .28), 0 2px 8px rgb(0 0 0 / .18);
  padding: .3rem;
}
.sel-menu.opens-up { top: auto; bottom: calc(100% + 6px); }
.sel-item {
  display: flex; align-items: flex-start; gap: .5rem;
  padding: .55rem .6rem; border-radius: calc(var(--r-md) - 4px);
  cursor: pointer; min-height: 40px;
}
.sel-item.is-active { background: var(--bg-inset); }
.sel-item.is-selected .sel-check { opacity: 1; }
.sel-check { opacity: 0; width: 1rem; flex: none; color: var(--accent); font-weight: 700; margin-top: .05rem; }
.sel-text { display: flex; flex-direction: column; gap: .1rem; min-width: 0; }
.sel-text small { color: var(--muted); font-size: .78rem; line-height: 1.3; }

.hero-actions-stack { display: flex; flex-direction: column; gap: .6rem; align-items: center; }
.hero-actions-stack .hero-actions { margin: 0; }

.preflight { display: grid; grid-template-columns: auto 1fr; gap: .55rem 1rem; margin: 0 0 .8rem; }
.preflight dt { color: var(--muted); font-size: .88rem; padding-top: .1rem; }
.preflight dd { margin: 0; font-weight: 600; }
.linklike { background: none; border: 0; color: var(--accent); cursor: pointer; font-size: .82rem; padding: 0 .2rem; }

/* ── onboarding ────────────────────────────────────────────────────── */
.onboard {
  position: fixed; inset: 0; z-index: 90; overflow-y: auto;
  background: var(--bg);
  display: grid; place-items: start center;
  padding: clamp(1rem, 4vh, 3rem) 1rem;
}
.onboard-card {
  width: 100%; max-width: 34rem;
  background: var(--bg-solid); border: 1px solid var(--line);
  border-radius: var(--r-xl); box-shadow: var(--shadow-md);
  padding: clamp(1.25rem, 4vw, 2rem);
  display: flex; flex-direction: column; gap: 1.1rem;
}
.onboard-progress { display: flex; gap: .4rem; }
.onboard-progress i {
  height: .3rem; flex: 1; border-radius: 999px; background: var(--bg-inset);
}
.onboard-progress i.done { background: var(--accent); }
.onboard-body h1 { font-size: clamp(1.35rem, 4.5vw, 1.7rem); line-height: 1.2; margin: .4rem 0 .6rem; }
.onboard-body p { color: var(--ink-2); line-height: 1.5; margin: 0 0 .7rem; }
.onboard-body .fineprint { color: var(--muted); }
.onboard-kicker { font-size: .8rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--accent); }
.onboard-nav { display: flex; align-items: center; gap: .6rem; }
.onboard-spacer { flex: 1; }
.ob-trio { display: grid; grid-template-columns: repeat(3, 1fr); gap: .6rem; margin: 1rem 0; }
.ob-trio div {
  background: var(--bg-inset); border-radius: var(--r-md); padding: .8rem .6rem;
  text-align: center; font-weight: 600;
}
.ob-trio small { display: block; font-weight: 400; color: var(--muted); margin-top: .25rem; font-size: .76rem; }
.ob-flow { display: flex; flex-direction: column; align-items: center; gap: .15rem; margin: 1rem 0; font-weight: 600; }
.ob-flow .arrow { color: var(--muted); font-weight: 400; }
.ob-flow span { background: var(--bg-inset); border-radius: 999px; padding: .35rem 1rem; }
.ob-callout {
  display: flex; gap: .7rem; align-items: flex-start;
  background: var(--amber-soft); border-radius: var(--r-md); padding: .8rem .9rem;
  font-size: .9rem; line-height: 1.45;
}
.ob-callout b { display: block; }
.ob-shield { font-size: 1.3rem; line-height: 1; }
.ob-wait {
  display: flex; align-items: center; gap: .8rem;
  background: var(--bg-inset); border-radius: var(--r-md); padding: 1rem;
}
.ob-wait .spin {
  width: 1.2rem; height: 1.2rem; flex: none;
  border: 2px solid var(--line-strong); border-top-color: var(--accent);
  border-radius: 50%; animation: obspin 0.9s linear infinite;
}
@keyframes obspin { to { transform: rotate(360deg); } }
.ob-connected {
  display: flex; align-items: center; gap: .8rem;
  background: var(--accent-soft); border-radius: var(--r-md); padding: 1rem;
}
.ob-connected .tick { color: var(--accent); font-size: 1.3rem; font-weight: 800; }
.ob-device b { display: block; }
.ob-device small { color: var(--muted); }
.ob-steps { counter-reset: s; list-style: none; margin: .8rem 0; padding: 0; }
.ob-steps li { counter-increment: s; position: relative; padding: .45rem 0 .45rem 2.1rem; }
.ob-steps li::before {
  content: counter(s); position: absolute; left: 0; top: .4rem;
  width: 1.5rem; height: 1.5rem; border-radius: 50%; background: var(--bg-inset);
  display: grid; place-items: center; font-size: .78rem; font-weight: 700; color: var(--ink-2);
}
.ob-summary { display: grid; grid-template-columns: auto 1fr; gap: .5rem 1rem; margin: .8rem 0; }
.ob-summary dt { color: var(--muted); }
.ob-summary dd { margin: 0; font-weight: 600; }
.ob-zips { display: flex; flex-wrap: wrap; gap: .4rem; margin: .6rem 0; }
.ob-depths { display: flex; flex-direction: column; gap: .6rem; margin: .8rem 0; }
.ob-depth {
  text-align: left; border: 1.5px solid var(--line); border-radius: var(--r-md);
  background: none; padding: .8rem .95rem; cursor: pointer; color: var(--ink);
}
.ob-depth.is-on { border-color: var(--accent); background: var(--accent-soft); }
.ob-depth b { display: flex; align-items: center; gap: .5rem; }
.ob-depth small { color: var(--muted); display: block; margin-top: .15rem; line-height: 1.4; }

/* coach marks */
.coach {
  display: flex; align-items: flex-start; gap: .6rem;
  background: var(--accent-soft); border-radius: var(--r-md);
  padding: .7rem .9rem; margin-bottom: 1rem; font-size: .9rem; line-height: 1.45;
}
.coach button { margin-left: auto; background: none; border: 0; color: var(--accent); cursor: pointer; font-weight: 600; }

/* empty states */
.empty-hero { text-align: center; padding: 2.2rem 1rem; }
.empty-hero h2 { margin: .4rem 0 .4rem; }
.empty-hero p { color: var(--muted); margin: 0 0 1rem; }

/* ---- Sprint 8: platform admin surfaces ---- */
.nav-sep { height: 1px; background: var(--line); margin: .6rem .9rem; }
.mode-tag.mode-FAILED { background: var(--red-soft); color: var(--red); }

/* ── prospect view ───────────────────────────────────────────────────── */
/* One prospect, with their opportunities folded underneath. */
.lead-why { margin-top: 8px; font-size: 12.5px; color: var(--muted); line-height: 1.5; }
.lead-why b { color: var(--fg); letter-spacing: .04em; font-size: 11px; margin-right: 6px; }
.opp-list { border-top: 1px solid var(--line); margin-top: 12px; padding-top: 10px; display: grid; gap: 10px; }
.opp { padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; }
.opp-addr { font-weight: 600; font-size: 13.5px; }
.opp-facts { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.opp-why { font-size: 12px; color: var(--muted); margin-top: 4px; }

/* ═══════════════════════ INTERNAL REVENUE CRM ═══════════════════════
 *
 * Our own sales tooling. It borrows the product's tokens so it feels like the
 * same application, but it is deliberately denser than the customer product:
 * this is a screen someone works in all day, not one they visit on a Monday.
 */

.btn-sm { padding: 6px 13px; font-size: 13px; border-radius: var(--r-xs); }

/* ---- filters row ---- */
.rev-filters { display: flex; flex-direction: column; gap: 12px; margin-bottom: 16px; }
/* A row of queue buttons is wider than a phone. Wrap it inside the column,
   rather than letting an inline-flex row push the whole page sideways. */
.rev-filters .seg, .rev-queues { flex-wrap: wrap; max-width: 100%; }
.rev-filter-row { display: flex; gap: 10px; flex-wrap: wrap; }
.rev-filter-row .input { flex: 1 1 200px; min-width: 0; }
.rev-filter-row select.input { flex: 0 1 180px; }

/* ---- dashboard ---- */
.rev-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 16px; }
.rev-stat { cursor: pointer; text-align: left; font: inherit; border: 1px solid transparent; transition: border-color .15s var(--ease); }
.rev-stat:hover { border-color: var(--line-strong); }
.rev-stat.is-alert b { color: var(--red); }

.rev-funnel { list-style: none; margin: 0; padding: 0; }
.rev-funnel li {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 9px 10px; border-radius: var(--r-xs); cursor: pointer;
  border-bottom: 1px solid var(--line);
}
.rev-funnel li:last-child { border-bottom: 0; }
.rev-funnel li:hover { background: var(--bg-inset); }
.rev-funnel li.is-zero { color: var(--muted); }
.rev-funnel .n { font-variant-numeric: tabular-nums; font-weight: 650; }

/* ---- tables ---- */
/* Wide tables scroll inside their own box; the page itself never does. */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; border-radius: var(--r-md); }
.rev-table { width: 100%; border-collapse: collapse; font-size: 13.5px; background: var(--bg-solid); }
.rev-table th, .rev-table td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.rev-table th {
  font-size: 11px; text-transform: uppercase; letter-spacing: .045em; color: var(--muted);
  font-weight: 650; white-space: nowrap; position: sticky; top: 0; background: var(--bg-solid); z-index: 1;
}
.rev-table tbody tr { cursor: pointer; }
.rev-table tbody tr:hover { background: var(--bg-inset); }
.rev-table tbody tr:last-child td { border-bottom: 0; }
.rev-table td small { display: block; font-size: 12px; margin-top: 2px; }
.rev-table b { font-weight: 620; }

/* ---- chips and states ---- */
.rev-chip {
  display: inline-block; font-size: 11px; font-weight: 650; letter-spacing: .02em;
  padding: 3px 9px; border-radius: 980px; background: var(--bg-inset); color: var(--ink);
  white-space: nowrap;
}
.rev-chip.is-won { background: var(--accent-soft); color: var(--accent); }
.rev-chip.is-lost { background: var(--red-soft); color: var(--red); }
.rev-unassigned { color: var(--amber); font-weight: 600; }
.rev-due { font-variant-numeric: tabular-nums; }
.rev-due.is-late { color: var(--red); font-weight: 650; }
.rev-due.is-today { color: var(--amber); font-weight: 650; }

.rev-banner {
  padding: 10px 14px; border-radius: var(--r-sm); margin-bottom: 14px;
  font-size: 13.5px; font-weight: 550; background: var(--bg-inset);
}
.rev-banner.is-won { background: var(--accent-soft); color: var(--accent); }
.rev-banner.is-lost { background: var(--red-soft); color: var(--red); }

/* ---- prospect detail sheet ---- */
.rev-detail section { margin-bottom: 22px; }
.rev-detail h4 {
  font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted);
  margin: 0 0 10px; font-weight: 650;
}
.rev-detail h4 small { text-transform: none; letter-spacing: 0; font-weight: 500; }
.rev-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 24px; }

.rev-dl { display: grid; grid-template-columns: minmax(84px, auto) 1fr; gap: 6px 14px; margin: 0 0 16px; font-size: 13.5px; }
.rev-dl dt { color: var(--muted); font-weight: 550; }
.rev-dl dd { margin: 0; overflow-wrap: anywhere; }

.rev-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 8px; }

.rev-list { list-style: none; margin: 0 0 8px; padding: 0; }
.rev-list li { padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 13.5px; }
.rev-list li:last-child { border-bottom: 0; }

.rev-tasks { list-style: none; margin: 0 0 12px; padding: 0; }
.rev-tasks li {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 13.5px;
}
.rev-tasks li:last-child { border-bottom: 0; }
.rev-tasks label { display: flex; align-items: center; gap: 9px; cursor: pointer; }

/* ---- timeline ---- */
.rev-timeline { list-style: none; margin: 0; padding: 0; }
.rev-timeline li { padding: 10px 0 10px 14px; border-left: 2px solid var(--line); position: relative; }
.rev-timeline li::before {
  content: ""; position: absolute; left: -5px; top: 15px;
  width: 8px; height: 8px; border-radius: 50%; background: var(--line-strong);
}
.rev-timeline .rev-tl-head { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; }
.rev-timeline .rev-tl-head b { font-size: 13.5px; font-weight: 600; }
.rev-timeline .rev-tl-head small { color: var(--muted); font-size: 12px; white-space: nowrap; }
.rev-timeline p { margin: 5px 0 3px; font-size: 13.5px; color: var(--ink); white-space: pre-wrap; }
.rev-timeline small.muted { font-size: 12px; }

@media (max-width: 720px) {
  .rev-cols { grid-template-columns: 1fr; }
  .rev-table { font-size: 13px; }
  .rev-table th, .rev-table td { padding: 9px 10px; }
}

/* ---- Sprint 13: the prospect engine's reasoning ---- */
.rev-score { font-variant-numeric: tabular-nums; font-size: 15px; font-weight: 700; margin-right: 6px; }
.rev-why { background: var(--bg-inset); border-radius: var(--r-sm); padding: 14px 16px; margin-bottom: 18px; }
.rev-why h4 { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.rev-why p { margin: 0 0 8px; font-size: 13.5px; }
.rev-facts { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.rev-facts li {
  font-size: 12.5px; background: var(--bg-solid); border: 1px solid var(--line);
  border-radius: 980px; padding: 3px 10px;
}
.rev-sweep { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; margin-bottom: 14px; }
.rev-sweep .stat b { font-size: 22px; }
