/* Layout: sticky top bar; filter rail + virtualized notice ledger; drawer slides in from the right.
   Federal-procurement desk: Public Sans (USWDS face), mono for codes, ledger-green accent, deadline color as the key signal. */
:root {
  --bg: #f3f6f8;
  --surface: #ffffff;
  --surface-2: #eaf0f3;
  --ink: #13202a;
  --muted: #5a6874;
  --line: #d6dfe5;
  --accent: #0b6e5f;
  --accent-ink: #ffffff;
  --accent-soft: #dbeee9;
  --warn: #a95700;
  --warn-soft: #fbe9d2;
  --danger: #b3261e;
  --danger-soft: #f8dedb;
  --info: #2c5aa0;
  --info-soft: #e1e9f6;
  --shadow: 0 10px 30px rgba(19, 32, 42, .14);
  --scrim: rgba(19, 32, 42, .38);

  --font-ui: "Public Sans", "Source Sans 3", -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  --fs-xs: .75rem; --fs-sm: .8125rem; --fs-md: .875rem; --fs-lg: 1rem; --fs-xl: 1.25rem; --fs-2xl: 1.625rem;
  --r-sm: 4px; --r-md: 6px;
  --top: 56px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0d141a; --surface: #141d25; --surface-2: #1b2630; --ink: #e5ecf1; --muted: #92a0ad; --line: #283642;
    --accent: #3fb59e; --accent-ink: #062520; --accent-soft: #123a33;
    --warn: #f0a24a; --warn-soft: #3a2914; --danger: #f2837b; --danger-soft: #3d1d1a; --info: #8fb3f0; --info-soft: #1b2a42;
    --shadow: 0 10px 30px rgba(0, 0, 0, .5); --scrim: rgba(0, 0, 0, .55);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0d141a; --surface: #141d25; --surface-2: #1b2630; --ink: #e5ecf1; --muted: #92a0ad; --line: #283642;
  --accent: #3fb59e; --accent-ink: #062520; --accent-soft: #123a33;
  --warn: #f0a24a; --warn-soft: #3a2914; --danger: #f2837b; --danger-soft: #3d1d1a; --info: #8fb3f0; --info-soft: #1b2a42;
  --shadow: 0 10px 30px rgba(0, 0, 0, .5); --scrim: rgba(0, 0, 0, .55);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
:root { padding-top: env(safe-area-inset-top, 0px); padding-bottom: env(safe-area-inset-bottom, 0px); }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: var(--font-ui); font-size: var(--fs-md); line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}
body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 30; background: var(--surface); }
[hidden] { display: none !important; }
a { color: var(--accent); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.num, .mono { font-variant-numeric: tabular-nums; }
.mono { font-family: var(--font-mono); font-size: .92em; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.eyebrow { margin: 0; font-size: var(--fs-xs); font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }

/* ---------- top bar ---------- */
.topbar { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20; background: var(--surface); border-bottom: 1px solid var(--line); }
.topbar-inner {
  display: flex; align-items: center; gap: 20px; min-height: var(--top);
  padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px));
}
.brand { display: flex; align-items: center; gap: 8px; color: var(--ink); text-decoration: none; }
.brand-mark { color: var(--accent); display: grid; }
.brand-name { font-weight: 800; letter-spacing: -.01em; font-size: var(--fs-lg); white-space: nowrap; }
.tabs { display: flex; gap: 4px; }
.tab {
  display: flex; align-items: center; gap: 6px; padding: 8px 12px; border-radius: var(--r-md);
  color: var(--muted); text-decoration: none; font-weight: 600; white-space: nowrap;
}
.tab:hover { color: var(--ink); background: var(--surface-2); }
.tab[aria-current="page"] { color: var(--ink); background: var(--surface-2); box-shadow: inset 0 -2px 0 var(--accent); }
.tab-count { font-size: var(--fs-xs); font-variant-numeric: tabular-nums; color: var(--muted); background: var(--bg); border: 1px solid var(--line); border-radius: 999px; padding: 0 7px; }
.topbar-meta { margin-left: auto; display: flex; align-items: center; gap: 10px; min-width: 0; }
.snapshot-chip { font-size: var(--fs-xs); color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-chip { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 4px 10px; font-size: var(--fs-sm); font-weight: 600; cursor: pointer; white-space: nowrap; }
.user-chip:hover { border-color: var(--accent); }
.banner {
  font-size: var(--fs-sm); background: var(--info-soft); color: var(--ink); border-top: 1px solid var(--line);
  padding-block: 8px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px));
}
.banner.is-error { background: var(--danger-soft); }

/* ---------- buttons & fields ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  border-radius: var(--r-md); padding: 7px 12px; font-weight: 600; font-size: var(--fs-sm); cursor: pointer; white-space: nowrap;
}
.btn:hover { border-color: var(--muted); }
.btn-primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn-primary:hover { filter: brightness(1.08); border-color: var(--accent); }
.btn-ghost { background: transparent; }
.btn-danger { color: var(--danger); border-color: var(--danger); background: transparent; }
.btn:disabled { opacity: .55; cursor: default; }
.link-btn { border: 0; background: none; color: var(--accent); font-weight: 600; font-size: var(--fs-sm); cursor: pointer; padding: 2px 0; }
.icon-btn { border: 0; background: none; padding: 6px; border-radius: var(--r-md); cursor: pointer; color: var(--muted); display: grid; }
.icon-btn:hover { background: var(--surface-2); color: var(--ink); }

.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field-label { font-size: var(--fs-xs); font-weight: 600; color: var(--muted); letter-spacing: .02em; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
input[type="text"], input[type="search"], input[type="password"], input[type="number"], input[type="date"], select, textarea {
  width: 100%; min-width: 0; border: 1px solid var(--line); background: var(--surface); border-radius: var(--r-md);
  padding: 7px 9px; font-size: var(--fs-md);
}
textarea { resize: vertical; min-height: 72px; line-height: 1.45; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: var(--accent); }
.check { display: flex; gap: 8px; align-items: flex-start; font-size: var(--fs-sm); cursor: pointer; }
.check input { margin-top: 3px; accent-color: var(--accent); }

/* ---------- chips & pills ---------- */
.chip-set { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 3px 10px;
  font-size: var(--fs-xs); font-weight: 600; cursor: pointer; color: var(--muted);
}
.chip[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); color: var(--ink); }
.chip .n { font-weight: 500; font-variant-numeric: tabular-nums; margin-left: 4px; opacity: .8; }
.tag { display: inline-block; font-size: var(--fs-xs); font-weight: 600; border-radius: var(--r-sm); padding: 1px 6px; background: var(--surface-2); color: var(--muted); white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: ellipsis; vertical-align: middle; }
.tag-sa { background: var(--info-soft); color: var(--info); font-family: var(--font-mono); font-weight: 500; }
.due {
  display: inline-flex; flex-direction: column; align-items: flex-start; gap: 0; line-height: 1.15;
  font-variant-numeric: tabular-nums; font-weight: 700; font-size: var(--fs-sm); color: var(--ink);
}
.due small { font-weight: 500; font-size: var(--fs-xs); color: var(--muted); }
.due.urgent { color: var(--danger); }
.due.soon { color: var(--warn); }
.due.none { color: var(--muted); font-weight: 500; }
.stage-pill { display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-xs); font-weight: 700; padding: 3px 8px; border-radius: 999px; background: var(--surface-2); white-space: nowrap; }
.stage-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); flex: none; }
.st-watching .stage-dot { background: var(--muted); }
.st-qualifying .stage-dot { background: var(--info); }
.st-pursuing .stage-dot { background: var(--accent); }
.st-proposal .stage-dot { background: var(--warn); }
.st-submitted .stage-dot { background: var(--info); box-shadow: 0 0 0 2px var(--info-soft); }
.st-won .stage-dot { background: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.st-lost .stage-dot { background: var(--danger); }
.st-nobid .stage-dot { background: var(--line); }

/* ---------- views ---------- */
main { position: relative; }
.view { padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
.view-opps { display: grid; grid-template-columns: 272px minmax(0, 1fr); gap: 20px; padding-block: 16px 0; height: calc(100dvh - var(--top) - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px) - var(--banner-h, 0px)); }
.results-title { margin: 0; font-size: var(--fs-xl); font-weight: 800; letter-spacing: -.015em; text-wrap: balance; }

.filters { display: flex; flex-direction: column; gap: 14px; overflow-y: auto; padding-bottom: 20px; padding-right: 4px; min-width: 0; }
.filters-head { display: flex; justify-content: space-between; align-items: center; }
.filters-note { margin: 0; font-size: var(--fs-xs); color: var(--muted); border-top: 1px solid var(--line); padding-top: 12px; }
.filters-toggle { display: none; }

.results { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--surface); border: 1px solid var(--line); border-bottom: 0; border-radius: var(--r-md) var(--r-md) 0 0; }
.results-head { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.results-tools { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.results-tools select { width: auto; }

.table-head, .row {
  display: grid; align-items: center; gap: 14px;
  grid-template-columns: 88px minmax(0, 1fr) 172px 128px 84px 140px 96px;
}
.table-head { padding: 8px 16px; font-size: var(--fs-xs); font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); border-bottom: 1px solid var(--line); background: var(--surface-2); }
.table-scroll { position: relative; flex: 1; overflow-y: auto; overflow-x: hidden; min-height: 0; }
.table-spacer { position: relative; width: 100%; }
.row {
  position: absolute; left: 0; right: 0; height: var(--row-h, 68px); padding: 0 16px;
  border-bottom: 1px solid var(--line); cursor: pointer; background: var(--surface);
}
.row:hover { background: var(--surface-2); }
.row.is-tracked { box-shadow: inset 3px 0 0 var(--accent); }
.row-main { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.row-title { font-weight: 600; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-sub { font-size: var(--fs-xs); color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-type { font-size: var(--fs-xs); color: var(--muted); line-height: 1.25; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.row-place { font-size: var(--fs-xs); color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-act { display: flex; justify-content: flex-end; }
.track-btn { font-size: var(--fs-xs); padding: 4px 9px; }
.empty { padding: 48px 16px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.empty-title { margin: 0; font-weight: 600; }

/* ---------- pipeline board ---------- */
.view-pipeline { padding-block: 16px 24px; }
.pipe-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.pipe-tools { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.pipe-tools input { width: 200px; }
.pipe-tools select { width: auto; }
.board-scroll { overflow-x: auto; padding-bottom: 8px; }
.board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(240px, 1fr); gap: 12px; min-height: 60vh; }
.col { background: var(--surface-2); border-radius: var(--r-md); display: flex; flex-direction: column; min-width: 0; border: 1px solid transparent; }
.col.drop-ok { border-color: var(--accent); background: var(--accent-soft); }
.col-head { display: flex; align-items: center; gap: 8px; padding: 10px 12px; font-weight: 700; font-size: var(--fs-sm); }
.col-head .stage-dot { width: 9px; height: 9px; }
.col-meta { margin-left: auto; font-size: var(--fs-xs); color: var(--muted); font-weight: 500; font-variant-numeric: tabular-nums; text-align: right; }
.col-cards { display: flex; flex-direction: column; gap: 8px; padding: 0 8px 10px; min-height: 40px; }
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); padding: 10px;
  display: flex; flex-direction: column; gap: 6px; cursor: grab; text-align: left; width: 100%;
}
.card:hover { border-color: var(--muted); }
.card.dragging { opacity: .5; }
.card-title { font-weight: 600; font-size: var(--fs-sm); line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card-sub { font-size: var(--fs-xs); color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-foot { display: flex; align-items: center; gap: 8px; justify-content: space-between; font-size: var(--fs-xs); }
.card-foot .due { font-size: var(--fs-xs); }
.avatar { width: 22px; height: 22px; border-radius: 50%; background: var(--accent-soft); color: var(--ink); display: grid; place-items: center; font-size: 10px; font-weight: 700; flex: none; }
.card-value { font-weight: 700; font-variant-numeric: tabular-nums; }
.prio-high { color: var(--danger); font-weight: 700; }
.col-empty { font-size: var(--fs-xs); color: var(--muted); padding: 6px 4px; }

/* ---------- overview ---------- */
.view-overview { padding-block: 16px 32px; display: flex; flex-direction: column; gap: 16px; max-width: 1280px; }
.kpis { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); padding: 14px 16px; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.kpi-label { font-size: var(--fs-xs); font-weight: 600; color: var(--muted); }
.kpi-value { font-size: var(--fs-2xl); font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi-note { font-size: var(--fs-xs); color: var(--muted); }
.ov-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); padding: 14px 16px; min-width: 0; }
.panel-wide { grid-column: 1 / -1; }
.panel-title { margin: 0 0 10px; font-size: var(--fs-md); font-weight: 700; }
.due-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.due-list li { display: grid; grid-template-columns: 96px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 8px 0; border-top: 1px solid var(--line); cursor: pointer; }
.due-list li:first-child { border-top: 0; }
.due-list li:hover .dl-title { color: var(--accent); }
.dl-title { font-weight: 600; font-size: var(--fs-sm); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dl-sub { font-size: var(--fs-xs); color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.muted-note { color: var(--muted); font-size: var(--fs-sm); margin: 4px 0; }
.bars { display: flex; flex-direction: column; gap: 8px; }
.bar-row { display: grid; grid-template-columns: minmax(0, 220px) minmax(0, 1fr) 64px; gap: 10px; align-items: center; font-size: var(--fs-sm); }
.bar-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-track { height: 10px; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.bar-fill { height: 100%; background: var(--accent); border-radius: 999px; min-width: 2px; }
.bar-val { text-align: right; font-variant-numeric: tabular-nums; color: var(--muted); }

/* ---------- drawer ---------- */
.scrim { position: fixed; inset: 0; background: var(--scrim); z-index: 40; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(680px, 100%); z-index: 41;
  background: var(--surface); box-shadow: var(--shadow); display: flex; flex-direction: column;
  padding-top: env(safe-area-inset-top, 0px); padding-bottom: env(safe-area-inset-bottom, 0px); padding-right: env(safe-area-inset-right, 0px);
}
.drawer-bar { display: flex; justify-content: flex-end; padding: 8px 10px 0; }
.drawer-body { overflow-y: auto; padding: 0 24px 32px; display: flex; flex-direction: column; gap: 20px; min-height: 0; }
.d-kicker { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.d-title { margin: 6px 0 4px; font-size: var(--fs-xl); font-weight: 800; letter-spacing: -.015em; line-height: 1.25; text-wrap: balance; }
.d-agency { font-size: var(--fs-sm); color: var(--muted); }
.d-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 20px; margin: 0; }
.facts div { min-width: 0; }
.facts dt { font-size: var(--fs-xs); font-weight: 600; color: var(--muted); }
.facts dd { margin: 2px 0 0; overflow-wrap: anywhere; }
.d-section { display: flex; flex-direction: column; gap: 10px; border-top: 1px solid var(--line); padding-top: 16px; }
.d-section h3 { margin: 0; font-size: var(--fs-md); font-weight: 700; }
.desc { white-space: pre-wrap; overflow-wrap: anywhere; max-width: 68ch; color: var(--ink); line-height: 1.55; }
.desc.clamped { max-height: 16em; overflow: hidden; -webkit-mask-image: linear-gradient(#000 70%, transparent); mask-image: linear-gradient(#000 70%, transparent); }
.contacts { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px; }
.contact { border: 1px solid var(--line); border-radius: var(--r-md); padding: 10px 12px; display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.contact-name { font-weight: 700; }
.contact-line { display: flex; gap: 6px; align-items: center; font-size: var(--fs-sm); min-width: 0; }
.contact-line span { overflow-wrap: anywhere; user-select: all; }
.copy-btn { border: 0; background: var(--surface-2); color: var(--muted); border-radius: var(--r-sm); font-size: 11px; font-weight: 600; padding: 1px 6px; cursor: pointer; flex: none; }
.crm { background: var(--surface-2); border-radius: var(--r-md); padding: 14px; display: flex; flex-direction: column; gap: 12px; }
.crm-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.crm-grid .span2 { grid-column: 1 / -1; }
.crm-foot { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.crm-foot .spacer { flex: 1; }
.dirty-note { font-size: var(--fs-xs); color: var(--warn); font-weight: 600; }
.timeline { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.timeline li { display: grid; grid-template-columns: 22px minmax(0, 1fr); gap: 10px; }
.tl-body { min-width: 0; }
.tl-meta { font-size: var(--fs-xs); color: var(--muted); }
.tl-text { white-space: pre-wrap; overflow-wrap: anywhere; }
.tl-history .tl-text { color: var(--muted); font-size: var(--fs-sm); }
.tl-history .avatar { background: var(--surface); border: 1px solid var(--line); }
.confirm-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: var(--fs-sm); }

/* ---------- modal, toast, loading ---------- */
.modal-wrap { position: fixed; inset: 0; z-index: 60; background: var(--scrim); display: grid; place-items: center; padding: 16px; }
.modal { width: min(420px, 100%); background: var(--surface); border-radius: var(--r-md); box-shadow: var(--shadow); padding: 22px; display: flex; flex-direction: column; gap: 14px; }
.modal-title { margin: 0; font-size: var(--fs-xl); font-weight: 800; }
.modal-copy { margin: 0; color: var(--muted); font-size: var(--fs-sm); }
.form-error { margin: 0; color: var(--danger); font-size: var(--fs-sm); font-weight: 600; }
.toast {
  position: fixed; z-index: 70; left: 50%; transform: translateX(-50%);
  bottom: calc(20px + env(safe-area-inset-bottom, 0px));
  background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: var(--r-md); font-weight: 600; font-size: var(--fs-sm); box-shadow: var(--shadow); max-width: calc(100% - 32px);
}
.loading { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; color: var(--muted); background: var(--bg); min-height: 60vh; }
.spinner { width: 28px; height: 28px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--accent); animation: spin .9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation: none; } }

/* ---------- responsive ---------- */
@media (max-width: 1180px) {
  .table-head, .row { grid-template-columns: 84px minmax(0, 1fr) 150px 120px 96px; }
  .table-head span:nth-child(5), .row .c-sa, .table-head span:nth-child(6), .row .c-place { display: none; }
  .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
  .topbar-inner { flex-wrap: wrap; gap: 4px 12px; padding-block: 8px; }
  .tabs { order: 3; width: 100%; overflow-x: auto; }
  .snapshot-chip { display: none; }
  .view-opps { grid-template-columns: minmax(0, 1fr); height: auto; padding-block: 12px 0; }
  .filters { display: none; overflow: visible; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); padding: 14px; }
  .filters.open { display: flex; }
  .filters-toggle { display: inline-flex; }
  .results { height: calc(100dvh - 150px); min-height: 420px; }
  .table-head { display: none; }
  .row { grid-template-columns: 72px minmax(0, 1fr) 92px 40px; gap: 8px; align-items: center; }
  .row .c-type, .row .c-sa, .row .c-place { display: none; }
  .row-est .row-sub { display: none; }
  .track-btn .lbl { display: none; }
  .ov-grid { grid-template-columns: minmax(0, 1fr); }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .bar-row { grid-template-columns: minmax(0, 130px) minmax(0, 1fr) 52px; }
  .facts, .crm-grid { grid-template-columns: minmax(0, 1fr); }
  .drawer-body { padding: 0 16px 28px; }
  .pipe-tools { margin-left: 0; width: 100%; }
  .pipe-tools input { flex: 1; width: auto; }
}

/* ---------- categories, estimates, locations ---------- */
.field-label-row { display: flex; justify-content: space-between; align-items: baseline; }
.cat-list { display: flex; flex-direction: column; gap: 2px; max-height: 300px; overflow-y: auto; }
.cat-item { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 8px; align-items: center; font-size: var(--fs-sm); padding: 3px 4px; border-radius: var(--r-sm); cursor: pointer; }
.cat-item:hover { background: var(--surface-2); }
.cat-item input { accent-color: var(--accent); margin: 0; }
.cat-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cat-item .n { font-size: var(--fs-xs); color: var(--muted); font-variant-numeric: tabular-nums; }
.row-cat, .row-est, .row-place { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.cat-name { font-size: var(--fs-sm); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-cat .row-sub, .row-place .row-sub, .row-est .row-sub { font-size: 11px; }
.row-place span:first-child { font-size: var(--fs-xs); color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.est { font-weight: 700; font-size: var(--fs-sm); font-variant-numeric: tabular-nums; white-space: nowrap; }
.est-stated { color: var(--accent); }
.est-rough { color: var(--muted); font-weight: 600; }
.tag-cat { background: var(--accent-soft); color: var(--ink); }
.card-est { color: var(--muted); font-variant-numeric: tabular-nums; }

/* ---------- drawer additions ---------- */
.d-highlights { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.hl { border: 1px solid var(--line); border-radius: var(--r-md); padding: 10px 12px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.hl-label { font-size: var(--fs-xs); font-weight: 600; color: var(--muted); }
.hl-value { font-weight: 800; font-size: var(--fs-lg); line-height: 1.25; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.hl-note { font-size: var(--fs-xs); color: var(--muted); }
.est-line { margin: 0; }
.quote { margin: 0; padding: 8px 12px; border-left: 3px solid var(--line); background: var(--surface-2); border-radius: 0 var(--r-sm) var(--r-sm) 0; font-size: var(--fs-sm); color: var(--ink); overflow-wrap: anywhere; }
.files { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.file { display: grid; grid-template-columns: 44px minmax(0, 1fr); gap: 10px; align-items: center; padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--r-md); }
.file-icon { height: 32px; border-radius: var(--r-sm); background: var(--surface-2); display: grid; place-items: center; font-size: 10px; font-weight: 800; color: var(--muted); letter-spacing: .04em; }
.file-main { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.file-main a { font-weight: 600; overflow-wrap: anywhere; }
.pre { white-space: pre-wrap; overflow-wrap: anywhere; margin: 6px 0; line-height: 1.5; }
.ai { display: flex; flex-direction: column; gap: 10px; }
.ai-summary { margin: 0; font-size: var(--fs-lg); line-height: 1.5; }
.ai-block { border: 1px solid var(--line); border-radius: var(--r-md); padding: 8px 12px; }
.ai-block summary { cursor: pointer; font-weight: 700; font-size: var(--fs-sm); }
.ai-list { margin: 6px 0 2px; padding-left: 20px; display: flex; flex-direction: column; gap: 4px; }
.ai-running { display: flex; gap: 12px; align-items: center; padding: 10px 0; }
.ai-running .spinner { width: 22px; height: 22px; border-width: 3px; flex: none; }
.callout { border: 1px solid var(--line); background: var(--surface-2); border-radius: var(--r-md); padding: 12px 14px; font-size: var(--fs-sm); }
.setup-steps { margin: 8px 0 0; padding-left: 20px; display: flex; flex-direction: column; gap: 4px; }
code { font-family: var(--font-mono); font-size: .9em; background: var(--surface-2); padding: 1px 5px; border-radius: var(--r-sm); }

/* ---------- map ---------- */
.view-map { padding-block: 16px 16px; display: flex; flex-direction: column; height: calc(100dvh - var(--top) - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px) - var(--banner-h, 0px)); }
.map-note { margin: 0; color: var(--muted); font-size: var(--fs-sm); flex: 1 1 320px; min-width: 0; }
.map-wrap { flex: 1; min-height: 360px; border: 1px solid var(--line); border-radius: var(--r-md); overflow: hidden; position: relative; z-index: 0; isolation: isolate; }
#map { width: 100%; height: 100%; background: var(--surface-2); }
.map-pop { display: flex; flex-direction: column; gap: 4px; font-family: var(--font-ui); font-size: 13px; }
.map-pop .muted { color: #667; }
.map-pop .btn { margin-top: 4px; align-self: flex-start; }
.marker-cluster-small, .marker-cluster-medium, .marker-cluster-large { background-color: rgba(11, 110, 95, .25) !important; }
.marker-cluster-small div, .marker-cluster-medium div, .marker-cluster-large div { background-color: rgba(11, 110, 95, .85) !important; color: #fff !important; font-weight: 700; font-family: var(--font-ui); }
@media (max-width: 860px) {
  .d-highlights { grid-template-columns: minmax(0, 1fr); }
  .view-map { height: calc(100dvh - 150px); }
}

.worker-note { margin: 0; font-size: var(--fs-sm); color: var(--muted); display: flex; align-items: center; gap: 6px; }
.worker-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--warn); flex: none; }
.worker-dot.on { background: var(--accent); }

/* ---------- focus, profile, fit ---------- */
.seg { display: grid; grid-template-columns: 1fr 1fr; border: 1px solid var(--line); border-radius: var(--r-md); overflow: hidden; }
.seg-btn { border: 0; background: var(--surface); padding: 7px 8px; font-weight: 700; font-size: var(--fs-sm); cursor: pointer; color: var(--muted); }
.seg-btn + .seg-btn { border-left: 1px solid var(--line); }
.seg-btn[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); }
.btn-sm { padding: 4px 10px; font-size: var(--fs-xs); }
.modal-wide { width: min(720px, 100%); max-height: calc(100dvh - 32px); overflow-y: auto; }
.modal-head { display: flex; justify-content: space-between; align-items: center; }
.fit { border: 1px solid var(--line); border-radius: var(--r-md); padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.fit-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.fit-verdict { font-weight: 800; font-size: var(--fs-lg); padding: 4px 12px; border-radius: 999px; }
.fit-strong { background: var(--accent-soft); color: var(--accent); }
.fit-gaps { background: var(--warn-soft); color: var(--warn); }
.fit-no { background: var(--danger-soft); color: var(--danger); }
.fit-score { font-size: var(--fs-2xl); font-weight: 800; font-variant-numeric: tabular-nums; }
.fit-score small { font-size: var(--fs-sm); color: var(--muted); font-weight: 600; }
.fit-tag { font-size: var(--fs-xs); font-weight: 700; color: var(--muted); }
.plan { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); }
.plan th, .plan td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.plan th { font-size: var(--fs-xs); color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.plan td.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.plan-wrap { overflow-x: auto; }
.blocker { color: var(--danger); font-weight: 600; }
.gap-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.gap-list li { border-left: 3px solid var(--warn); padding: 4px 10px; background: var(--surface-2); border-radius: 0 var(--r-sm) var(--r-sm) 0; }
.gap-list .how { color: var(--muted); font-size: var(--fs-sm); }
@media (max-width: 860px) { #profileBtn { display: none; } }
.chip-build { border-style: dashed; }
.chip-build[aria-pressed="true"] { border-style: solid; }

/* ---------- potential ---------- */
.view-potential { padding-block: 16px 32px; max-width: 1180px; }
.pot-list { display: flex; flex-direction: column; gap: 12px; }
.pot { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); padding: 14px 16px; display: grid; grid-template-columns: 44px minmax(0, 1fr) 230px; gap: 14px; cursor: pointer; }
.pot:hover { border-color: var(--muted); }
.pot-rank { font-size: var(--fs-2xl); font-weight: 800; color: var(--muted); font-variant-numeric: tabular-nums; line-height: 1; }
.pot-main { min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.pot-title { font-weight: 800; font-size: var(--fs-lg); line-height: 1.3; }
.pot-sub { font-size: var(--fs-sm); color: var(--muted); }
.pot-note { white-space: pre-wrap; line-height: 1.5; font-size: var(--fs-md); }
.pot-next { font-size: var(--fs-sm); }
.pot-side { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; font-size: var(--fs-sm); }
.pot-tags { display: flex; gap: 6px; flex-wrap: wrap; }
.tier { font-size: var(--fs-xs); font-weight: 800; padding: 2px 8px; border-radius: 999px; background: var(--surface-2); }
.tier-top { background: var(--accent); color: var(--accent-ink); }
.tier-strong { background: var(--accent-soft); color: var(--accent); }
.tier-look { background: var(--info-soft); color: var(--info); }
.tier-long { background: var(--warn-soft); color: var(--warn); }
.pot-fit { font-weight: 700; }
.pot-actions { display: flex; gap: 8px; margin-top: 4px; }
.pot-empty { padding: 32px; text-align: center; color: var(--muted); border: 1px dashed var(--line); border-radius: var(--r-md); }
@media (max-width: 860px) { .pot { grid-template-columns: 32px minmax(0, 1fr); } .pot-side { grid-column: 2; } }

/* competition */
.comp-head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 10px; }
.comp-badge { font-size: var(--fs-xs); font-weight: 600; padding: 3px 8px; border-radius: 999px; }
.comp-low { background: var(--accent-soft); color: var(--accent); }
.comp-mid { background: var(--warn-soft); color: var(--warn); }
.comp-high { background: var(--danger-soft); color: var(--danger); }
.comp-main { font-size: var(--fs-lg); }
.comp-bars { display: grid; gap: 4px; margin-bottom: 8px; max-width: 420px; }
.comp-bar { display: grid; grid-template-columns: 44px 1fr 28px; align-items: center; gap: 8px; font-size: var(--fs-sm); }
.comp-bar-label { color: var(--muted); font-family: var(--font-mono); font-size: var(--fs-xs); }
.comp-bar-track { height: 10px; background: var(--surface-2); border-radius: 3px; overflow: hidden; }
.comp-bar-fill { display: block; height: 100%; background: var(--info); border-radius: 3px; }
.comp-bar-n { text-align: right; font-variant-numeric: tabular-nums; color: var(--muted); }
.comp-samples { margin: 6px 0; font-size: var(--fs-sm); }
.comp-samples summary { cursor: pointer; color: var(--info); }
.comp-samples ul { margin: 6px 0 0; padding-left: 18px; display: grid; gap: 3px; }

/* environment badge (dev copy) */
.env-badge { margin-left: 8px; font-size: 10px; font-weight: 700; letter-spacing: .06em; padding: 2px 6px; border-radius: 3px; background: var(--warn-soft); color: var(--warn); border: 1px solid var(--warn); }
