/* street.css — Street Level Sales Tracker components, layered on base.css (sibling tokens).
 * Design spec: scratch "street-design-spec.md" (2026-10-29). Status buckets, type colours and the heat ramp are
 * the validated palettes from that spec; never reuse a status colour for a type or vice versa. */
:root {
  --b-placed: #4ade80; --b-approved: #60a5fa; --b-pending: #fbbf24; --b-notplaced: #f87171; --b-ended: #94a3b8; --b-other: #64748b;
  --t-mapd: #3987e5; --t-ma: #d95926; --t-pdp: #199e70; --t-ms: #c98500; --t-dental: #d55181; --t-hi: #9085e9; --t-other: #64748b;
  --heat-1: #235a9e; --heat-2: #2f74c9; --heat-3: #4a94ec; --heat-4: #9cc4f5;
}
.tab-count { font: 11px var(--mono); color: var(--muted); margin-left: 4px; }

/* share header */
.share { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; padding: 2px 4px 0; }
.share-period { font-size: 24px; font-weight: 700; letter-spacing: -.02em; line-height: 1.15; }
.share-sub { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.share-sub b { color: var(--text); font-weight: 500; }
.share-right { text-align: right; color: var(--muted); font-size: 12px; line-height: 1.5; }
.share-right .wordmark { color: var(--text); font-weight: 600; letter-spacing: .02em; }
.asof .dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--muted); margin: 0 4px 1px 0; }
.asof .ok .dot { background: var(--green); } .asof .warn .dot { background: var(--warn); } .asof .bad .dot { background: var(--danger); }
.banner { margin: 0; padding: 8px 14px; border-radius: 10px; font-size: 12.5px; border: 1px solid rgba(251,191,36,.4); background: rgba(251,191,36,.08); color: #fde68a; }
.banner.bad { border-color: rgba(248,113,113,.45); background: rgba(248,113,113,.08); color: #fecaca; }

/* KPI tiles + deltas */
.kpis { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.stat[disabled] { cursor: default; }
.stat .stat-label .dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-left: 6px; vertical-align: middle; }
.stat .stat-label .dot.warn { background: var(--warn); } .stat .stat-label .dot.bad { background: var(--danger); }
.stat-value.is-dash { color: var(--muted); }
.stat-row { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.delta { display: inline-flex; align-items: center; gap: 3px; font: 11.5px var(--mono); color: var(--muted); white-space: nowrap; }
.delta .tri { font-size: 9px; }
.delta.up { color: var(--green); } .delta.down { color: var(--danger); } .delta.flat { color: var(--muted); }
.delta.neutral { color: var(--blue); }
.delta.lowvol { border: 1px dashed var(--line); border-radius: 999px; padding: 0 6px; }
.kpi-note { margin: -4px 0 0; padding: 0 4px; color: var(--muted); font-size: 11.5px; }
.stat .link { color: var(--accent); font-size: 11.5px; }

/* chart grid */
.grid12 { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 14px; align-items: stretch; }
.span4 { grid-column: span 4; } .span8 { grid-column: span 8; } .span12 { grid-column: span 12; }
.panel { padding: 12px 16px 12px; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.panel-h { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.panel-h h3 { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.panel-h .sub { color: var(--muted); font-size: 11.5px; }
.panel-h .tools { display: inline-flex; gap: 6px; align-items: center; }
.panel .empty { color: var(--muted); font-size: 12.5px; padding: 14px 0; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.canvas-wrap { position: relative; height: 260px; }
.canvas-wrap canvas { position: absolute; inset: 0; }
.legend { display: flex; flex-wrap: wrap; gap: 10px 14px; font-size: 11.5px; color: var(--muted); }
.legend .sw { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }
.legend .ln { display: inline-block; width: 16px; border-top: 2px dashed var(--muted); margin-right: 5px; vertical-align: 3px; }
.sw.placed, .seg.placed { background: var(--b-placed); } .sw.approved, .seg.approved { background: var(--b-approved); }
.sw.pending, .seg.pending { background: var(--b-pending); } .sw.notplaced, .seg.notplaced { background: var(--b-notplaced); }
.sw.ended, .seg.ended { background: var(--b-ended); } .sw.other, .seg.other { background: var(--b-other); }
.data-table { font-size: 12px; } .data-table th, .data-table td { padding: 4px 8px; }

/* B: segmented mix bar */
.mix { display: flex; height: 28px; border-radius: 6px; overflow: hidden; gap: 2px; background: var(--bg-2); }
.mix.empty-mix { border: 1px dashed var(--line); background: transparent; }
.mix .seg { position: relative; display: flex; align-items: center; justify-content: center; min-width: 0; font: 600 11px var(--mono); color: #0b1220; border: 0; padding: 0; cursor: pointer; }
.mix .seg.ended { color: #0b1220; }
.mix .seg:hover { filter: brightness(1.1); }
.mix .seg.is-active { outline: 2px solid #fff; outline-offset: -2px; }
.mix-legend { display: grid; grid-template-columns: 1fr auto auto; gap: 4px 12px; font-size: 12.5px; }
.mix-legend .row { display: contents; }
.mix-legend .row > * { padding: 3px 0; border-bottom: 1px solid var(--line-soft); }
.mix-legend .row:last-child > * { border-bottom: 0; }
.mix-legend .k { color: var(--muted); display: flex; align-items: center; gap: 7px; background: none; border: 0; font: inherit; cursor: pointer; text-align: left; padding: 3px 0; }
.mix-legend .k:hover, .mix-legend .k.is-active { color: var(--text); }
.mix-legend .n { font: 12.5px var(--mono); text-align: right; }
.mix-legend .p { font: 12px var(--mono); color: var(--muted); text-align: right; }
.mix-foot { color: var(--muted); font-size: 11.5px; }
.mini-mix { display: flex; height: 10px; border-radius: 3px; overflow: hidden; gap: 1px; background: var(--bg-2); width: 100%; min-width: 100px; }
.mini-mix .seg { min-width: 0; }

/* C / D / F ranked bars: reuse .brow with per-type colour. The rows are <button>s: outside a flex column a button
 * shrinks to its content and the 1fr track collapses, so the hosts are flex columns and the row is full width. */
#barsC, #barsD, #barsF { display: flex; flex-direction: column; gap: 3px; }
.panel .brow { width: 100%; }
.brow .bt, .brow .bf { display: block; }
.brow .bf.typed { background: var(--bar, var(--accent)); }
.brow .bp { font: 11.5px var(--mono); color: var(--muted); text-align: right; }
.brow.four { grid-template-columns: minmax(0, 50%) 1fr 40px 44px; }

/* E: heat matrix */
.heat { width: 100%; border-collapse: separate; border-spacing: 3px; font-size: 12px; table-layout: fixed; }
.heat th { color: var(--muted); font-weight: 500; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; padding: 2px 4px; text-align: center; white-space: nowrap; }
.heat th.rh { text-align: right; font: 12px var(--mono); text-transform: none; letter-spacing: 0; color: var(--muted); width: 48px; }
.heat td { padding: 0; }
.heat .cell { width: 100%; height: 34px; border-radius: 6px; border: 1px solid var(--line); background: transparent; color: var(--text); font: 600 12.5px var(--mono); cursor: pointer; padding: 0; }
.heat .cell.h1 { background: var(--heat-1); border-color: transparent; color: #e6ebf5; }
.heat .cell.h2 { background: var(--heat-2); border-color: transparent; color: #fff; }
.heat .cell.h3 { background: var(--heat-3); border-color: transparent; color: #0b1220; }
.heat .cell.h4 { background: var(--heat-4); border-color: transparent; color: #0b1220; }
.heat .cell.flag { box-shadow: 0 0 0 2px var(--warn) inset; }
.heat .cell.is-active { outline: 2px solid #fff; outline-offset: -1px; }
.heat .cell:hover { filter: brightness(1.12); }
.heat tr.rule td, .heat tr.rule th { border-top: 1px dashed var(--warn); padding-top: 3px; }
.heat-foot { display: flex; justify-content: space-between; align-items: center; color: var(--muted); font-size: 11.5px; }
.heat-scale { display: inline-flex; align-items: center; gap: 4px; }
.heat-scale i { display: inline-block; width: 16px; height: 8px; border-radius: 2px; }

/* leaderboard */
.lb { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 12.5px; }
.lb th { position: sticky; top: 0; background: #121c31; color: var(--muted); font-weight: 500; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; padding: 7px 8px; text-align: left; white-space: nowrap; border-bottom: 1px solid var(--line); z-index: 1; }
.lb th button { background: none; border: 0; color: inherit; font: inherit; text-transform: inherit; letter-spacing: inherit; cursor: pointer; padding: 0; }
.lb th.sorted button { color: #5eead4; }
.lb th.num, .lb td.num { text-align: right; }
.lb td { padding: 6px 8px; border-bottom: 1px solid var(--line-soft); white-space: nowrap; vertical-align: middle; }
.lb td.num { font: 12.5px var(--mono); font-variant-numeric: tabular-nums; }
.lb tbody tr { cursor: pointer; } .lb tbody tr:hover td { background: rgba(255,255,255,.025); }
.lb tbody tr.is-active td { background: rgba(20,184,166,.07); }
.lb tr.total td { font-weight: 600; background: rgba(255,255,255,.02); border-top: 1px solid var(--line); cursor: default; }
.lb .rank { color: var(--muted); font: 12px var(--mono); width: 32px; }
.lb .npn { display: block; font: 11px var(--mono); color: var(--muted); }
.lb .bad { color: var(--danger); font-weight: 700; } .lb .zero { color: var(--muted); }
.lb-wrap { overflow: auto; max-height: 520px; }
.lb .micro { font: 11px var(--mono); color: var(--muted); margin-left: 4px; }

/* attention */
.attn-list { display: flex; flex-direction: column; gap: 2px; }
.attn-row { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: center; padding: 6px 8px; border-radius: 8px; background: none; border: 0; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.attn-row:hover { background: var(--card-2); }
.attn-row .who { font-weight: 600; }
.attn-row .meta { display: block; color: var(--muted); font-size: 11.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.age { font: 600 11.5px var(--mono); padding: 1px 8px; border-radius: 999px; background: var(--card-2); color: var(--muted); white-space: nowrap; }
.age.warn { background: rgba(251,191,36,.18); color: var(--warn); } .age.bad { background: rgba(248,113,113,.18); color: var(--danger); }
.attn-h { display: flex; align-items: center; justify-content: space-between; color: var(--muted); font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; margin-top: 6px; }
.count-badge { font: 600 11px var(--mono); padding: 1px 8px; border-radius: 999px; background: rgba(248,113,113,.18); color: var(--danger); }
.count-badge.ok { background: rgba(74,222,128,.15); color: var(--green); }
.allclear { color: var(--green); font-size: 12.5px; padding: 6px 8px; }

/* status chip (icon + text; solid = careCycle, dashed = EnrollHere only) */
.chipst { display: inline-flex; align-items: center; gap: 5px; height: 20px; padding: 0 8px; border-radius: 999px; font-size: 11.5px; font-weight: 500; white-space: nowrap; border: 1px solid transparent; }
.chipst svg { width: 10px; height: 10px; flex: none; }
.chipst.placed { background: rgba(74,222,128,.18); color: var(--b-placed); }
.chipst.approved { background: rgba(96,165,250,.18); color: var(--b-approved); }
.chipst.pending { background: rgba(251,191,36,.18); color: var(--b-pending); }
.chipst.notplaced { background: rgba(248,113,113,.18); color: var(--b-notplaced); }
.chipst.ended { background: rgba(148,163,184,.16); color: var(--b-ended); }
.chipst.other { background: transparent; color: var(--muted); border-color: var(--line); }
.chipst.provisional { border-style: dashed; border-color: currentColor; background: transparent; }
.conflict { color: var(--warn); font-size: 11px; margin-left: 4px; cursor: help; }
.src-line { display: block; color: var(--muted); font-size: 11px; }
.tdot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; vertical-align: 0; background: var(--t-other); }

/* enrollments table */
.enr-tbl { table-layout: fixed; min-width: 1180px; }
.enr-tbl.all-cols { min-width: 1350px; }
.enr-tbl:not(.all-cols) .col-x { display: none; }
.enr-tbl:not(.all-cols) col.col-x { visibility: collapse; }
.enr-tbl th.sticky-col, .enr-tbl td.sticky-col { position: sticky; left: 0; z-index: 2; background: var(--card); box-shadow: 1px 0 0 var(--line); }
.enr-tbl th.sticky-col { z-index: 4; background: #121c31; }
.enr-tbl tbody tr:hover td.sticky-col { background: #141f36; }
.enr-tbl td { white-space: nowrap; }
.enr-tbl.is-loading tbody { opacity: .45; pointer-events: none; }
.enr-tbl th.num, .enr-tbl td.num { text-align: right; }
.w-member { width: 150px; } .w-agent { width: 120px; } .w-carrier { width: 90px; } .w-plan { width: 170px; } .w-type { width: 130px; }
.w-status { width: 160px; } .w-sub { width: 110px; } .w-date { width: 92px; } .w-age { width: 64px; } .w-pid { width: 170px; } .w-state { width: 52px; }
.rowbtn { background: none; border: 0; color: inherit; font: inherit; font-weight: 600; cursor: pointer; padding: 0; text-align: left; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.rowbtn:hover { color: #5eead4; }
.past { color: var(--muted); }
.flag { color: var(--warn); margin-right: 3px; font-size: 10px; }
.pager-num { display: inline-flex; gap: 2px; }
.pager-num button { min-width: 28px; }
.pager-num button.is-on { border-color: rgba(20,184,166,.45); color: #5eead4; background: rgba(20,184,166,.08); }

/* drawer */
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: 380px; max-width: 100vw; background: var(--card); border-left: 1px solid var(--line); box-shadow: -16px 0 40px rgba(0,0,0,.45); z-index: 20; display: flex; flex-direction: column; }
.drawer-h { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.drawer-h h2 { font-size: 16px; }
.drawer-b { padding: 12px 18px 24px; overflow: auto; display: grid; grid-template-columns: 120px 1fr; gap: 8px 12px; font-size: 13px; align-content: start; }
.drawer-b dt { color: var(--muted); font-size: 12px; } .drawer-b dd { margin: 0; overflow-wrap: anywhere; }
.drawer-b .full { grid-column: 1 / -1; color: var(--muted); font-size: 12px; border-top: 1px solid var(--line-soft); padding-top: 8px; }
.scrim { position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 19; }

/* footer */
.foot-def { display: flex; flex-wrap: wrap; gap: 6px 18px; align-items: center; }
.foot-def .unmapped { color: var(--warn); }

/* light presentation theme (print + optional toggle) */
:root[data-theme="light"] { --bg: #f8fafc; --bg-2: #eef2f7; --card: #ffffff; --card-2: #f1f5f9; --line: #d5dde8; --line-soft: #e5eaf1; --text: #0f172a; --muted: #475569;
  --b-placed: #15803d; --b-approved: #1d4ed8; --b-pending: #b45309; --b-notplaced: #b91c1c; --b-ended: #475569; --shadow: 0 1px 2px rgba(15,23,42,.06); color-scheme: light; }
:root[data-theme="light"] body { background: var(--bg); }
:root[data-theme="light"] .topbar { background: rgba(248,250,252,.9); }
:root[data-theme="light"] .tbl th, :root[data-theme="light"] .lb th, :root[data-theme="light"] .enr-tbl th.sticky-col { background: #eef2f7; }
:root[data-theme="light"] .heat .cell.h1, :root[data-theme="light"] .heat .cell.h2 { color: #fff; }
:root[data-theme="light"] .chipst.placed { background: rgba(21,128,61,.12); } :root[data-theme="light"] .chipst.approved { background: rgba(29,78,216,.12); }
:root[data-theme="light"] .chipst.pending { background: rgba(180,83,9,.12); } :root[data-theme="light"] .chipst.notplaced { background: rgba(185,28,28,.12); }
:root[data-theme="light"] .chipst.ended { background: rgba(71,85,105,.12); }
:root[data-theme="light"] .mix .seg, :root[data-theme="light"] .mini-mix .seg { color: #fff; }
:root[data-theme="light"] .tab.is-active, :root[data-theme="light"] .chip.is-active { color: #0f766e; }
:root[data-theme="light"] input[type="date"] { color-scheme: light; }
:root[data-theme="light"] .banner { color: #92400e; background: #fffbeb; border-color: #f59e0b; }
:root[data-theme="light"] .banner.bad { color: #991b1b; background: #fef2f2; border-color: #ef4444; }
:root[data-theme="light"] .heat .cell { color: var(--text); }
:root[data-theme="light"] .heat .cell.h3, :root[data-theme="light"] .heat .cell.h4 { color: #0f172a; }

@media print {
  :root { --bg: #fff; --bg-2: #f1f5f9; --card: #fff; --card-2: #f1f5f9; --line: #cbd5e1; --line-soft: #e2e8f0; --text: #0f172a; --muted: #475569;
    --b-placed: #15803d; --b-approved: #1d4ed8; --b-pending: #b45309; --b-notplaced: #b91c1c; --b-ended: #475569; --shadow: none; }
  body { background: #fff !important; }
  .topbar, .filterbar, .table-toolbar .toolbar-controls, .pager, .drawer, .scrim, .toast, .banner, #btnExport, .btn, details:not([open]) { display: none !important; }
  .app { padding: 0; gap: 10px; max-width: none; }
  .card, .panel, .stat { break-inside: avoid; box-shadow: none; }
  .canvas-wrap { height: 240px; }
  .table-wrap { max-height: none; overflow: visible; }
  .lb-wrap { max-height: none; }
  .heat .cell, .mix .seg, .mini-mix .seg, .bf, .sw { print-color-adjust: exact; -webkit-print-color-adjust: exact; }
  .print-only { display: block !important; }
}
.print-only { display: none; color: var(--muted); font-size: 11px; }

/* responsive */
@media (max-width: 1200px) { .span8 { grid-column: span 12; } .span4 { grid-column: span 6; } .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 1100px) { .share-period { font-size: 20px; } }
@media (max-width: 720px) {
  .topbar { height: auto; min-height: 52px; flex-wrap: wrap; row-gap: 6px; padding: 8px 12px; }
  .topbar .who { display: none; } .topbar-right { margin-left: auto; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } .stat-value { font-size: 20px; }
  .span4, .span8, .span12 { grid-column: span 12; }
  .share { flex-direction: column; align-items: flex-start; } .share-right { text-align: left; }
  .lb th:nth-child(6), .lb td:nth-child(6), .lb th:nth-child(7), .lb td:nth-child(7) { display: none; }
  .drawer { width: 100vw; }
  .presets { overflow-x: auto; max-width: 100%; }
}
@media (prefers-reduced-motion: reduce) { .sk { animation: none; } * { transition: none !important; } }
