/* Webster Scanner - dashboard styles. "Soft Depth" system (see docs/brandbook.md).
   Warm layered surfaces, soft elevation, generous radii, Fraunces display + Inter UI.
   Amber is reserved for the primary CTA, active nav marker and focus. Fonts are self-hosted
   (app/static/fonts, no CDN). */

/* ---------- Fonts (self-hosted variable woff2, latin subset) ---------- */
@font-face { font-family: "Inter"; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url("/static/fonts/inter-latin-wght.woff2") format("woff2"); }
@font-face { font-family: "Fraunces"; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url("/static/fonts/fraunces-latin-wght.woff2") format("woff2"); }

/* ---------- Tokens ---------- */
:root {
  color-scheme: dark;
  --bg: #1A1816;
  --surface: #221F1C;
  --elev: #2A2622;
  --hover: #342F2A;
  --border: rgba(255, 240, 225, 0.08);
  --border-mid: rgba(255, 240, 225, 0.16);   /* secondary button outline (label carries the meaning) */
  --border-strong: #8A8178;      /* form controls: >= 3:1 against surfaces */
  --text: #F4EFE9;
  --text-2: #D8D0C7;
  --muted: #A59C92;
  --accent: #E87C2E;             /* amber: CTA, active nav, focus only */
  --accent-fg: #1A1208;
  --focus: #F08A3C;
  --ok: #6FD08C;      --ok-bg: rgba(111, 208, 140, 0.14);
  --info: #6CB2FF;    --info-bg: rgba(108, 178, 255, 0.14);
  --warn: #E5C14F;    --warn-bg: rgba(229, 193, 79, 0.14);
  --bad: #FF8F85;     --bad-bg: rgba(255, 143, 133, 0.15);
  --vio: #B9A0FF;     --vio-bg: rgba(185, 160, 255, 0.15);
  --neutral: #B5ADA4; --neutral-bg: rgba(255, 240, 225, 0.08);
  --gold: #EBCB6B; --gold-bg: rgba(235, 203, 107, 0.16); --silver: #D3D7DD; --silver-bg: rgba(211, 215, 221, 0.14); --bronze: #E0A074; --bronze-bg: rgba(224, 160, 116, 0.16);
  /* categorical chart palette (>= 3:1 on surface) */
  --c1: #5AA9FF; --c2: #2FCBB0; --c3: #B795FF; --c4: #F27BAE; --c5: #8BD450; --c6: #E3C04A; --c7: #CFC8BF;
  --seq-0: #1d3b36; --seq-1: #238370; --seq-2: #2a9d86; --seq-3: #4fd1b6; --seq-4: #9af0dc;
  --grid: rgba(255, 240, 225, 0.10);
  /* elevation: layered soft shadows (1 = cards, 2 = popovers/dialogs) */
  --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.30), 0 6px 18px rgba(0, 0, 0, 0.22);
  --shadow-2: 0 2px 6px rgba(0, 0, 0, 0.35), 0 18px 44px rgba(0, 0, 0, 0.50);
  --shadow: var(--shadow-2);
  --inner-hl: inset 0 1px 0 rgba(255, 240, 225, 0.05);
  --glow: 0 4px 16px rgba(232, 124, 46, 0.28);
  --topbar-bg: rgba(34, 31, 28, 0.80);
  --scrim: rgba(10, 8, 6, 0.60);
  --row-bg: var(--surface);
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-display: "Fraunces", "Iowan Old Style", Georgia, "Times New Roman", serif;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
  --r-sm: 8px; --r-md: 14px; --r-lg: 18px; --r-pill: 999px;
  --topbar-h: 56px;
}
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #FAF8F5; --surface: #FFFFFF; --elev: #F6F3EE; --hover: #EFEBE4;
  --border: rgba(60, 40, 20, 0.10); --border-mid: rgba(60, 40, 20, 0.18); --border-strong: #8C8379;
  --text: #1C1814; --text-2: #3A332C; --muted: #6A6159;
  --focus: #B34E00;
  --ok: #136A2C;   --ok-bg: rgba(19, 106, 44, 0.10);
  --info: #1450A8; --info-bg: rgba(20, 80, 168, 0.09);
  --warn: #7A5700; --warn-bg: rgba(160, 112, 0, 0.13);
  --bad: #B0221A;  --bad-bg: rgba(176, 34, 26, 0.09);
  --vio: #5A32B0;  --vio-bg: rgba(90, 50, 176, 0.09);
  --neutral: #4A433C; --neutral-bg: rgba(60, 40, 20, 0.07);
  --gold: #6B4E00; --gold-bg: rgba(190, 140, 0, 0.18); --silver: #3F454D; --silver-bg: rgba(90, 100, 115, 0.15); --bronze: #7F3F10; --bronze-bg: rgba(160, 80, 20, 0.14);
  --c1: #1F6FD1; --c2: #0B7F6C; --c3: #7B4FD1; --c4: #C2307A; --c5: #3F7F10; --c6: #94700A; --c7: #5A544D;
  --seq-0: #e3f3ef; --seq-1: #3b9682; --seq-2: #207a67; --seq-3: #12604f; --seq-4: #0a4538;
  --grid: rgba(60, 40, 20, 0.12);
  --shadow-1: 0 1px 2px rgba(60, 40, 20, 0.06), 0 4px 14px rgba(60, 40, 20, 0.05);
  --shadow-2: 0 2px 4px rgba(60, 40, 20, 0.06), 0 14px 36px rgba(60, 40, 20, 0.14);
  --shadow: var(--shadow-2);
  --inner-hl: inset 0 1px 0 rgba(255, 255, 255, 0.9);
  --glow: 0 4px 14px rgba(232, 124, 46, 0.30);
  --topbar-bg: rgba(255, 255, 255, 0.82);
  --scrim: rgba(40, 28, 16, 0.45);
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme]) {
    color-scheme: light;
    --bg: #FAF8F5; --surface: #FFFFFF; --elev: #F6F3EE; --hover: #EFEBE4;
    --border: rgba(60, 40, 20, 0.10); --border-mid: rgba(60, 40, 20, 0.18); --border-strong: #8C8379;
    --text: #1C1814; --text-2: #3A332C; --muted: #6A6159;
    --focus: #B34E00;
    --ok: #136A2C;   --ok-bg: rgba(19, 106, 44, 0.10);
    --info: #1450A8; --info-bg: rgba(20, 80, 168, 0.09);
    --warn: #7A5700; --warn-bg: rgba(160, 112, 0, 0.13);
    --bad: #B0221A;  --bad-bg: rgba(176, 34, 26, 0.09);
    --vio: #5A32B0;  --vio-bg: rgba(90, 50, 176, 0.09);
    --neutral: #4A433C; --neutral-bg: rgba(60, 40, 20, 0.07);
    --gold: #6B4E00; --gold-bg: rgba(190, 140, 0, 0.18); --silver: #3F454D; --silver-bg: rgba(90, 100, 115, 0.15); --bronze: #7F3F10; --bronze-bg: rgba(160, 80, 20, 0.14);
    --c1: #1F6FD1; --c2: #0B7F6C; --c3: #7B4FD1; --c4: #C2307A; --c5: #3F7F10; --c6: #94700A; --c7: #5A544D;
    --seq-0: #e3f3ef; --seq-1: #3b9682; --seq-2: #207a67; --seq-3: #12604f; --seq-4: #0a4538;
    --grid: rgba(60, 40, 20, 0.12);
    --shadow-1: 0 1px 2px rgba(60, 40, 20, 0.06), 0 4px 14px rgba(60, 40, 20, 0.05);
    --shadow-2: 0 2px 4px rgba(60, 40, 20, 0.06), 0 14px 36px rgba(60, 40, 20, 0.14);
    --shadow: var(--shadow-2);
    --inner-hl: inset 0 1px 0 rgba(255, 255, 255, 0.9);
    --glow: 0 4px 14px rgba(232, 124, 46, 0.30);
    --topbar-bg: rgba(255, 255, 255, 0.82);
    --scrim: rgba(40, 28, 16, 0.45);
  }
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 400 14px/1.5 var(--font); font-variant-numeric: tabular-nums;
  font-feature-settings: "cv11", "ss03"; -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
h1, h2, h3, h4 { margin: 0; font-weight: 600; line-height: 1.2; }
h1 { font-family: var(--font-display); font-size: 32px; letter-spacing: -0.015em; font-weight: 500; line-height: 1.12; font-variation-settings: "opsz" 72; }
h2 { font-size: 15px; letter-spacing: -0.005em; }
h3 { font-size: 13.5px; }
p { margin: 0 0 0.6em; }
a { color: var(--text); text-decoration-color: var(--border-strong); text-underline-offset: 2px; }
a:hover { text-decoration-color: currentColor; }
code, .mono { font-family: var(--mono); font-size: 0.92em; }
.muted { color: var(--muted); }
.num { font-variant-numeric: tabular-nums; text-align: right; }
.sr-only { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.hidden, [hidden] { display: none !important; }
:focus { outline: none; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
::selection { background: rgba(232, 124, 46, 0.35); }
body { transition: background-color 200ms ease, color 200ms ease; }
.skip-link { position: absolute; left: 8px; top: -60px; z-index: 300; background: var(--accent); color: var(--accent-fg); padding: 8px 12px; border-radius: var(--r-sm); font-weight: 600; }
.skip-link:focus { top: 8px; }

/* ---------- Top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 50; height: var(--topbar-h);
  display: flex; align-items: center; gap: 24px; padding: 0 24px;
  background: var(--topbar-bg); border-bottom: 1px solid var(--border); box-shadow: var(--shadow-1);
  -webkit-backdrop-filter: saturate(1.4) blur(14px); backdrop-filter: saturate(1.4) blur(14px);
}
.brand { display: flex; align-items: baseline; gap: 8px; text-decoration: none; font-weight: 700; letter-spacing: 0.16em; text-transform: uppercase; font-size: 14px; }
.brand small { font-weight: 400; letter-spacing: 0.08em; font-size: 10.5px; color: var(--muted); }
.nav { display: flex; align-items: center; gap: 4px; height: 100%; }
.nav a {
  position: relative; display: flex; align-items: center; height: 34px; padding: 0 14px; text-decoration: none; border-radius: var(--r-pill);
  color: var(--muted); font-size: 13.5px; font-weight: 500; letter-spacing: 0;
  transition: color 150ms ease, background-color 150ms ease;
}
.nav a:hover { color: var(--text); background: var(--hover); }
.nav a[aria-current="page"] { color: var(--text); background: var(--elev); }
/* active marker: short amber bar hugging the topbar's bottom edge (brandbook: amber = active nav) */
.nav a[aria-current="page"]::after { content: ""; position: absolute; left: 50%; margin-left: -11px; width: 22px; bottom: -11px; height: 2px; border-radius: 2px 2px 0 0; background: var(--accent); }
.topbar .spacer { flex: 1; }
.topbar-actions { display: flex; align-items: center; gap: 6px; }

/* ---------- Page ---------- */
.page { padding: 28px 28px 48px; max-width: 1680px; margin: 0 auto; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head .sub { color: var(--muted); margin-top: 4px; }
.grid { display: grid; gap: 20px; }
.cols-2 { grid-template-columns: 1fr 1fr; }
.cols-main-side { grid-template-columns: minmax(0, 1fr) 380px; align-items: start; }
.ov-top { align-items: stretch !important; }
.stack { display: flex; flex-direction: column; gap: 20px; }
.row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.row.between { justify-content: space-between; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); min-width: 0; box-shadow: var(--inner-hl), var(--shadow-1); }
.card > .tbl-wrap { border-radius: 0 0 var(--r-md) var(--r-md); }
.leads-card > .tbl-wrap { border-radius: var(--r-md); }
.card-h { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 18px; border-bottom: 1px solid var(--border); min-height: 52px; flex-wrap: wrap; }
.card-h h2 { font-size: 15px; font-weight: 600; letter-spacing: -0.005em; color: var(--text); }
.card-b { padding: 18px; }
.card-b.flush { padding: 0; }
.hint { color: var(--muted); font-size: 12px; }

/* ---------- Buttons & form controls ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 34px; padding: 0 14px;
  border: 1px solid var(--border-mid); border-radius: var(--r-sm); background: var(--surface); color: var(--text);
  font: 500 13px/1 var(--font); cursor: pointer; text-decoration: none; white-space: nowrap;
  box-shadow: var(--inner-hl), 0 1px 2px rgba(0, 0, 0, 0.12);
  transition: background 150ms ease, border-color 150ms ease, filter 150ms ease, box-shadow 150ms ease, transform 150ms ease;
}
.btn:hover { background: var(--hover); border-color: var(--border-strong); }
.btn:active { transform: translateY(1px); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; }
.btn.primary { background: linear-gradient(180deg, #F08A3C, #E27526); border-color: #D9691B; color: var(--accent-fg); font-weight: 600; letter-spacing: 0; box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.28), var(--glow); }
.btn.primary:hover { filter: brightness(1.06); background: linear-gradient(180deg, #F08A3C, #E27526); border-color: #D9691B; }
.btn.danger { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 55%, transparent); }
.btn.sm { height: 28px; padding: 0 11px; font-size: 12.5px; }
.btn.icon { width: 34px; padding: 0; }
.btn.sm.icon { width: 28px; }
.btn.ghost { border-color: transparent; background: transparent; box-shadow: none; color: var(--muted); }
.btn.ghost:hover { color: var(--text); background: var(--hover); }
.btn svg, .ico { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.spin { width: 14px; height: 14px; border: 2px solid var(--border-strong); border-top-color: var(--text); border-radius: 50%; animation: spin .8s linear infinite; display: inline-block; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }

input, select, textarea {
  font: 400 13.5px/1.3 var(--font); color: var(--text); background: var(--elev);
  border: 1px solid var(--border-strong); border-radius: var(--r-sm); height: 34px; padding: 0 11px; min-width: 0; max-width: 100%;
  transition: border-color 150ms ease, box-shadow 150ms ease;
}
textarea { height: auto; padding: 9px 11px; resize: vertical; line-height: 1.45; }
select { padding-right: 6px; }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: .8; }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }
input[type="checkbox"], input[type="radio"] { width: 16px; height: 16px; padding: 0; accent-color: var(--accent); }
input[type="number"] { font-variant-numeric: tabular-nums; }
label.field, div.field { display: flex; flex-direction: column; gap: 5px; font-size: 12.5px; font-weight: 500; letter-spacing: 0; color: var(--muted); }
label.field > :not(.lbl):not(.hint), div.field > :not(.lbl):not(.hint) { text-transform: none; letter-spacing: 0; font-weight: 400; color: var(--text); }
label.field.req-miss > .lbl { color: var(--bad); }
label.field.req-miss > :not(.lbl):not(.hint) { border-color: var(--bad); box-shadow: 0 0 0 1px var(--bad); }
label.field .hint { text-transform: none; letter-spacing: 0; font-weight: 400; }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }

/* switch */
.switch { position: relative; display: inline-flex; align-items: center; gap: 10px; cursor: pointer; }
.switch input { appearance: none; -webkit-appearance: none; width: 34px; height: 20px; border-radius: 10px; background: var(--elev); border: 1px solid var(--border-strong); position: relative; padding: 0; cursor: pointer; transition: background 150ms; }
.switch input::after { content: ""; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: var(--muted); transition: transform 150ms, background 150ms; }
.switch input:checked { background: var(--ok-bg); border-color: var(--ok); }
.switch input:checked::after { transform: translateX(14px); background: var(--ok); }

/* ---------- Pills / chips ---------- */
.pill { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 10px; border-radius: var(--r-pill); font-size: 12px; font-weight: 500; white-space: nowrap; background: var(--neutral-bg); color: var(--neutral); }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: none; }
.pill.sq::before { border-radius: 1px; }
.pill.ok { background: var(--ok-bg); color: var(--ok); }
.pill.info { background: var(--info-bg); color: var(--info); }
.pill.warn { background: var(--warn-bg); color: var(--warn); }
.pill.bad { background: var(--bad-bg); color: var(--bad); }
.pill.vio { background: var(--vio-bg); color: var(--vio); }
.pill.live::before { animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .25; } }
.pill.plain::before { display: none; }
.tag { display: inline-block; padding: 0 7px; border-radius: 6px; border: 1px solid var(--border-strong); font-size: 11px; font-weight: 600; line-height: 17px; color: var(--text-2); }
.chip {
  display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 12px; border-radius: var(--r-pill);
  border: 1px solid var(--border-mid); background: transparent; color: var(--text-2); font: 500 12.5px/1 var(--font); cursor: pointer;
  transition: background 150ms ease, color 150ms ease, border-color 150ms ease;
}
.chip:hover { background: var(--hover); }
.chip[aria-pressed="true"], .chip[aria-checked="true"] { background: var(--text); color: var(--bg); border-color: var(--text); }
.chip .sw { width: 14px; height: 3px; border-radius: 2px; background: currentColor; }
.chip.removable { cursor: default; height: 26px; background: var(--elev); }
.chip.removable button { border: 0; background: none; color: var(--muted); cursor: pointer; padding: 0 0 0 2px; font-size: 14px; line-height: 1; }
.chip.removable button:hover { color: var(--text); }

/* ---------- Menu / popover ---------- */
details.menu { position: relative; }
details.menu > summary { list-style: none; cursor: pointer; }
details.menu > summary::-webkit-details-marker { display: none; }
.menu-pop {
  position: absolute; z-index: 60; top: calc(100% + 4px); left: 0; min-width: 190px; max-height: 340px; overflow: auto;
  background: var(--elev); border: 1px solid var(--border-mid); border-radius: var(--r-md); box-shadow: var(--shadow-2); padding: 6px;
}
.menu-pop.right { left: auto; right: 0; }
.menu-pop label { display: flex; align-items: center; gap: 8px; padding: 6px 9px; border-radius: 8px; cursor: pointer; white-space: nowrap; }
.menu-pop label:hover { background: var(--hover); }
.menu-pop hr { border: 0; border-top: 1px solid var(--border); margin: 6px 0; }
.menu-count { display: inline-block; min-width: 18px; padding: 0 5px; border-radius: 9px; background: var(--text); color: var(--bg); font-size: 11px; line-height: 16px; text-align: center; font-weight: 700; }

/* ---------- Tables ---------- */
.tbl-wrap { overflow: auto; }
table.tbl { border-collapse: separate; border-spacing: 0; width: 100%; }
.tbl th, .tbl td { padding: 0 12px; height: 40px; text-align: left; vertical-align: middle; border-bottom: 1px solid var(--border); white-space: nowrap; }
.tbl th {
  position: sticky; top: 0; z-index: 3; background: var(--elev); color: var(--muted); font-size: 12px; font-weight: 600;
  letter-spacing: 0; height: 38px; border-bottom: 1px solid var(--border-mid);
}
.tbl th.sortable { cursor: pointer; user-select: none; }
.tbl th.sortable:hover { color: var(--text); }
.tbl th .sort-btn { all: unset; cursor: pointer; display: inline-flex; align-items: center; gap: 4px; }
.tbl th .sort-btn:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.tbl th[aria-sort="ascending"], .tbl th[aria-sort="descending"] { color: var(--text); }
.tbl th[aria-sort="ascending"] .arr::after { content: "\2191"; }
.tbl th[aria-sort="descending"] .arr::after { content: "\2193"; }
.tbl td.r, .tbl th.r { text-align: right; }
.tbl td.wrap { white-space: normal; }
.tbl tbody tr { background: var(--row-bg); }
.tbl tbody tr { transition: background-color 120ms ease; }
.tbl tbody tr:hover { background: var(--hover); --row-bg: var(--hover); }
.tbl.compact td, .tbl.compact th { height: 32px; }
.tbl tr.clickable { cursor: pointer; }
.tbl .name-cell { display: inline-block; vertical-align: middle; max-width: 250px; overflow: hidden; text-overflow: ellipsis; }
.tbl td.sticky-col, .tbl th.sticky-col { position: sticky; left: 0; z-index: 2; background: var(--row-bg); }
.tbl th.sticky-col { z-index: 4; background: var(--elev); }
.tbl tbody tr.row-active { --row-bg: var(--hover); box-shadow: inset 0 0 0 1px var(--border-strong); }
.tbl tbody tr.row-active td:first-child { box-shadow: inset 3px 0 0 var(--text); }
.tbl tbody tr.row-due { --row-bg: color-mix(in srgb, var(--warn) 9%, var(--surface)); }
.tbl tbody tr.row-due td:first-child { box-shadow: inset 3px 0 0 var(--warn); }
.tbl tbody tr.row-active.row-due td:first-child { box-shadow: inset 3px 0 0 var(--warn); }
.tbl tbody tr.row-dim td { color: var(--muted); }
.tbl-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 18px; border-top: 1px solid var(--border); flex-wrap: wrap; }
.cell-select { height: 28px; font-size: 12.5px; padding: 0 2px 0 6px; background: transparent; border-color: transparent; border-radius: var(--r-sm); cursor: pointer; }
.cell-select:hover { border-color: var(--border-strong); background: var(--elev); }
.cell-input { height: 28px; font-size: 12.5px; width: 84px; padding: 0 6px; background: transparent; border-color: transparent; }
.cell-input:hover { border-color: var(--border-strong); background: var(--elev); }
.cell-input:focus-visible, .cell-select:focus-visible { background: var(--elev); border-color: var(--border-strong); }
.cell-input::placeholder { color: var(--muted); }
.saving { opacity: .55; }
.score-bar { display: inline-block; vertical-align: middle; width: 42px; height: 6px; border-radius: var(--r-pill); background: var(--neutral-bg); margin-left: 8px; position: relative; overflow: hidden; }
.score-bar > i { position: absolute; inset: 0 auto 0 0; background: var(--muted); border-radius: var(--r-pill); }
.due-flag { font-size: 11px; font-weight: 700; color: var(--warn); letter-spacing: 0.04em; margin-left: 6px; }
.fu-note { font-size: 12px; margin-left: 0; min-width: 0; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fu-note.due-flag { font-weight: 600; letter-spacing: 0; }
.bc .fu-note { display: block; margin: 0; }
.fu-line { font-size: 13px; font-weight: 600; color: var(--text); text-transform: none; letter-spacing: 0; }
.kbd { display: inline-block; min-width: 18px; padding: 0 5px; border: 1px solid var(--border-strong); border-bottom-width: 2px; border-radius: 5px; font: 600 11px/16px var(--mono); text-align: center; color: var(--text-2); }

/* ---------- Leads page layout ---------- */
.page-leads { max-width: none; padding: 18px 24px 0; height: calc(100vh - var(--topbar-h) - var(--strip-h, 0px)); display: flex; flex-direction: column; gap: 10px; }
.filterbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-end; }
.filterbar .grow { flex: 1 1 220px; min-width: 200px; }
.filterbar label.field { min-width: 0; }
.filterbar select { max-width: 120px; }
.tbl td > .btn.ghost.sm:first-child { margin-left: -11px; } /* align row-filter buttons with their column header text */
.tbl td a.nm { text-decoration: none; }
.tbl td a.nm:hover { text-decoration: underline; }
.tbl tbody tr { scroll-margin-top: 40px; }
.filterbar input[type="number"] { width: 78px; }
.filterbar .btn-sel { height: 34px; }
.presets { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.leads-card { flex: 1; min-height: 0; display: flex; flex-direction: column; margin-bottom: 14px; }
.leads-card .tbl-wrap { flex: 1; min-height: 0; }
.active-filters { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; min-height: 0; }

/* ---------- KPI / charts ---------- */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 14px; }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); padding: 14px 16px; text-decoration: none; display: block; box-shadow: var(--inner-hl), var(--shadow-1); transition: transform 150ms ease, box-shadow 150ms ease, background-color 150ms ease; }
a.kpi:hover { background: var(--elev); transform: translateY(-1px); box-shadow: var(--inner-hl), var(--shadow-2); }
.kpi .k-label { font-size: 12.5px; font-weight: 500; letter-spacing: 0; color: var(--muted); }
.kpi .k-val { font-size: 30px; font-weight: 600; line-height: 1.15; margin-top: 6px; letter-spacing: -0.025em; }
.kpi .k-delta { font-size: 12px; color: var(--muted); margin-top: 2px; }
.kpi .k-delta b { color: var(--ok); font-weight: 600; }
.kpi .k-delta b.zero { color: var(--muted); }

.funnel { display: flex; flex-direction: column; gap: 8px; }
.fn-row { display: grid; grid-template-columns: 120px minmax(0, 1fr) 150px; gap: 12px; align-items: center; }
.fn-name { font-size: 13px; color: var(--text-2); }
.fn-bar { height: 24px; background: var(--neutral-bg); border-radius: var(--r-pill); position: relative; }
.fn-bar > i { position: absolute; inset: 0 auto 0 0; background: var(--c1); border-radius: var(--r-pill); min-width: 6px; }
.fn-val { font-weight: 600; text-align: right; }
.fn-val small { display: block; font-weight: 400; color: var(--muted); font-size: 11.5px; margin-top: -1px; }
.fn-val .conv { font-weight: 400; color: var(--muted); font-size: 11.5px; margin-left: 6px; }

.chart { position: relative; width: 100%; }
.chart svg { display: block; width: 100%; overflow: visible; }
.chart text { font-family: var(--font); font-variant-numeric: tabular-nums; }
.ch-axis { fill: var(--muted); font-size: 11px; }
.ch-lbl { font-size: 11.5px; font-weight: 600; }
.ch-grid { stroke: var(--grid); stroke-width: 1; }
.chart:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.tip { position: fixed; z-index: 200; pointer-events: none; background: var(--elev); border: 1px solid var(--border-mid); box-shadow: var(--shadow-2); border-radius: 12px; padding: 10px 12px; font-size: 12px; max-width: 280px; }
.tip b { display: block; margin-bottom: 4px; }
.tip .tr { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.tip .tr i { display: inline-block; width: 10px; height: 3px; margin-right: 6px; vertical-align: middle; border-radius: 2px; }

.meters { display: grid; gap: 18px; }
.meter .m-top { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin-bottom: 5px; }
.meter .m-top span:first-child { color: var(--text-2); }
.meter-bar { height: 10px; background: var(--neutral-bg); border-radius: var(--r-pill); position: relative; overflow: hidden; }
.meter-bar > i { position: absolute; inset: 0 auto 0 0; background: var(--c1); border-radius: var(--r-pill); }
.meter.warn .meter-bar > i { background: var(--warn); }
.meter.bad .meter-bar > i { background: var(--bad); background-image: repeating-linear-gradient(135deg, transparent 0 5px, rgba(0,0,0,.25) 5px 7px); }
.meter.warn .meter-bar > i { background-image: repeating-linear-gradient(135deg, transparent 0 8px, rgba(0,0,0,.18) 8px 10px); }
.meter .m-note { font-size: 11.5px; margin-top: 3px; color: var(--muted); }
.meter.warn .m-note { color: var(--warn); }
.meter.bad .m-note { color: var(--bad); }

.stackbar { display: flex; height: 12px; border-radius: var(--r-pill); overflow: hidden; background: var(--neutral-bg); gap: 1px; }
.stackbar > i { display: block; min-width: 0; }
.legend { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 8px; font-size: 12px; color: var(--text-2); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.dl { display: grid; grid-template-columns: max-content 1fr; gap: 6px 14px; margin: 0; }
.dl dt { color: var(--muted); }
.dl dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }

/* ---------- Feed ---------- */
.feed { list-style: none; margin: 0; padding: 0; }
.feed li { display: grid; grid-template-columns: 78px 128px minmax(0, 1fr); gap: 12px; padding: 10px 18px; border-bottom: 1px solid var(--border); align-items: baseline; transition: background-color 120ms ease; }
.feed li:hover { background: var(--elev); }
.feed li:last-child { border-bottom: 0; }
.feed time { color: var(--muted); font-size: 12px; }
.feed .ev-type { font-family: var(--mono); font-size: 11.5px; color: var(--text-2); }
.feed .ev-text { overflow-wrap: anywhere; }
.feed .ev-text .muted { margin-left: 6px; }

/* ---------- States ---------- */
.skeleton { display: block; position: relative; overflow: hidden; background: var(--neutral-bg); border-radius: 8px; min-height: 14px; }
.skeleton::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, transparent, rgba(128,128,128,.14), transparent); transform: translateX(-100%); animation: shimmer 1.4s infinite; }
@keyframes shimmer { to { transform: translateX(100%); } }
.skel-wrap { display: grid; gap: 10px; padding: 18px; }
.state { padding: 32px 18px; text-align: center; color: var(--muted); }
.state b { display: block; color: var(--text-2); margin-bottom: 4px; font-weight: 600; }
.state.err b { color: var(--bad); }
.state .btn { margin-top: 10px; }
.banner { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-radius: var(--r-md); border: 1px solid var(--warn); background: var(--warn-bg); color: var(--text); margin-bottom: 16px; }
.banner b { color: var(--warn); }
.banner.bad { border-color: var(--bad); background: var(--bad-bg); }
.banner.bad b { color: var(--bad); }
.banner .grow { flex: 1; }

/* ---------- Toasts ---------- */
.toasts { position: fixed; z-index: 400; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 8px; width: min(380px, calc(100vw - 32px)); pointer-events: none; }
.toast { pointer-events: auto; display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; background: var(--elev); border: 1px solid var(--border-mid); border-left-width: 4px; border-radius: var(--r-md); box-shadow: var(--shadow-2); animation: toast-in 180ms ease-out; }
.toast.ok { border-left-color: var(--ok); }
.toast.error { border-left-color: var(--bad); }
.toast.info { border-left-color: var(--info); }
.toast .t-msg { flex: 1; overflow-wrap: anywhere; }
.toast .t-x { border: 0; background: none; color: var(--muted); cursor: pointer; font-size: 16px; line-height: 1; padding: 0 2px; }
.toast .t-x:hover { color: var(--text); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

/* ---------- Dialog ---------- */
dialog { color: var(--text); background: var(--surface); border: 1px solid var(--border-mid); border-radius: var(--r-lg); padding: 0; box-shadow: var(--shadow-2); max-width: min(520px, calc(100vw - 32px)); width: 100%; }
dialog::backdrop { background: var(--scrim); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); }
dialog form { padding: 22px; display: grid; gap: 16px; }
dialog h2 { font-family: var(--font-display); font-size: 20px; font-weight: 500; letter-spacing: -0.01em; }
dialog.lightbox { max-width: min(1200px, 96vw); background: var(--bg); }
dialog.lightbox .lb { padding: 12px; display: grid; gap: 8px; max-height: 94vh; }
dialog.lightbox img { max-width: 100%; max-height: 80vh; margin: 0 auto; display: block; object-fit: contain; }
.dlg-actions { display: flex; justify-content: flex-end; gap: 8px; }

/* ---------- Login ---------- */
.page-login { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-card { width: 100%; max-width: 380px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 32px; display: grid; gap: 18px; box-shadow: var(--inner-hl), var(--shadow-2); }
.login-card .brand { font-size: 16px; }
.login-err { color: var(--bad); font-size: 12.5px; min-height: 18px; }

/* ---------- Lead detail ---------- */
.lead-head { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; flex-wrap: wrap; margin-bottom: 16px; }
.lead-head h1 { letter-spacing: -0.015em; font-size: 30px; }
.lead-meta { display: flex; flex-wrap: wrap; gap: 4px 18px; margin-top: 8px; color: var(--text-2); }
.lead-meta .it { display: inline-flex; align-items: center; gap: 6px; }
.crumb { font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.stepper { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 0; list-style: none; margin: 0; padding: 18px; }
.step { position: relative; padding-top: 22px; padding-right: 8px; }
.step::before { content: ""; position: absolute; top: 6px; left: 0; right: 0; height: 2px; background: var(--border-strong); }
.step::after { content: ""; position: absolute; top: 0; left: 0; width: 14px; height: 14px; border-radius: 50%; background: var(--surface); border: 2px solid var(--border-strong); }
.step.done::before { background: var(--ok); }
.step.done::after { background: var(--ok); border-color: var(--ok); }
.step.cur::after { border-color: var(--text); background: var(--text); box-shadow: 0 0 0 4px var(--neutral-bg); }
.step.fail::after { background: var(--bad); border-color: var(--bad); border-radius: 2px; }
.step.skip::after { border-style: dashed; }
.step .s-name { font-weight: 600; }
.step .s-sub { color: var(--muted); font-size: 12px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.sig { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px; border-radius: 8px; border: 1px solid var(--border-strong); background: var(--elev); font-size: 12px; }
.sig b { font-family: var(--mono); font-weight: 600; color: var(--bad); }
.big-score { font-size: 38px; font-weight: 600; line-height: 1; letter-spacing: -0.025em; }
.analysis-grid { display: grid; grid-template-columns: auto 1fr; gap: 14px 24px; align-items: start; }
.findings { margin: 0; padding-left: 18px; }
.findings li { margin: 3px 0; }
.shots { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; }
.shot { border: 1px solid var(--border); border-radius: var(--r-md); background: var(--elev); padding: 0; cursor: zoom-in; color: inherit; text-align: left; overflow: hidden; display: block; width: 100%; box-shadow: var(--shadow-1); transition: box-shadow 150ms ease, border-color 150ms ease; }
.shot:hover { border-color: var(--border-strong); box-shadow: var(--shadow-2); }
.shot .img { height: 140px; background: var(--bg); display: grid; place-items: center; overflow: hidden; }
.shot img { width: 100%; height: 100%; object-fit: cover; object-position: top; }
.shot span { display: block; padding: 6px 8px; font-size: 12px; color: var(--text-2); }
.ba-label { font-size: 12px; font-weight: 600; letter-spacing: 0; text-transform: none; color: var(--muted); margin: 0 0 8px; }
.md { overflow-wrap: anywhere; line-height: 1.6; max-width: 80ch; }
.md h1, .md h2, .md h3, .md h4 { text-transform: none; letter-spacing: 0; margin: 1.1em 0 .4em; }
.md h1 { font-size: 18px; } .md h2 { font-size: 15.5px; } .md h3 { font-size: 14px; } .md h4 { font-size: 13.5px; }
.md > :first-child { margin-top: 0; }
.md ul, .md ol { padding-left: 22px; margin: 0 0 .7em; }
.md code { background: var(--elev); padding: 1px 6px; border-radius: 6px; }
.md pre { background: var(--elev); border: 1px solid var(--border); padding: 12px; border-radius: 12px; overflow: auto; }
.md pre code { background: none; padding: 0; }
.md blockquote { margin: 0 0 .7em; padding: 2px 12px; border-left: 3px solid var(--border-strong); color: var(--text-2); }
.md table { border-collapse: collapse; margin-bottom: .8em; }
.md th, .md td { border: 1px solid var(--border-strong); padding: 4px 8px; }
.md hr { border: 0; border-top: 1px solid var(--border); margin: 1em 0; }
.md-collapse { max-height: 340px; overflow: hidden; position: relative; }
.md-collapse::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 70px; background: linear-gradient(transparent, var(--surface)); }
.form-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 14px; }
.form-grid > *, .sect-fields > * { min-width: 0; }
.sect-fields label.full input { max-width: 240px; }
.form-grid input, .form-grid select, .form-grid textarea { width: 100%; }
.form-grid .full { grid-column: 1 / -1; }
.form-grid.three { grid-template-columns: repeat(3, 1fr); }
.log { list-style: none; margin: 0; padding: 0; max-height: 300px; overflow: auto; }
.log li { padding: 8px 0; border-bottom: 1px solid var(--border); }
.log li:last-child { border-bottom: 0; }
.log .l-h { display: flex; gap: 8px; align-items: center; color: var(--muted); font-size: 12px; margin-bottom: 2px; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }

/* ---------- Bounds picker dialog (settings > Regions) ---------- */
dialog.bounds-dlg { max-width: min(820px, calc(100vw - 24px)); }
.bp-body { padding: 18px; display: grid; gap: 12px; }
.bp-map { height: 420px; max-height: 58vh; border-radius: 12px; background: var(--bg); z-index: 0; }
.bp-map.bp-drawing, .bp-map.bp-drawing .leaflet-interactive { cursor: crosshair; }
.bp-bar { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.bp-read { color: var(--text-2); font-size: 12px; white-space: pre; overflow-x: auto; }
.bp-handle { background: var(--accent); border: 2px solid var(--bg); border-radius: 4px; box-sizing: border-box; cursor: nwse-resize; }
.bp-handle:focus-visible { outline: 2px solid var(--focus); }

/* ---------- Sweep ---------- */
.map-wrap { position: relative; background: var(--bg); border: 1px solid var(--border); border-radius: var(--r-md); }
#map { height: 560px; max-height: 70vh; border-radius: var(--r-md); background: var(--bg); z-index: 0; }
.map-empty { position: absolute; inset: 0; display: grid; place-items: center; z-index: 500; pointer-events: none; color: var(--muted); font-size: 13px; background: color-mix(in srgb, var(--bg) 55%, transparent); border-radius: var(--r-md); }
.map-empty[hidden] { display: none; }
/* Basemap: muted tiles so cells pop. Dark theme inverts the light OSM tiles. */
.map-wrap .leaflet-tile-pane { filter: invert(1) hue-rotate(180deg) grayscale(0.8) saturate(0.6) brightness(0.85) contrast(0.9); }
:root[data-theme="light"] .map-wrap .leaflet-tile-pane { filter: grayscale(0.8) saturate(0.6); }
@media (prefers-color-scheme: light) { :root:not([data-theme]) .map-wrap .leaflet-tile-pane { filter: grayscale(0.8) saturate(0.6); } }
.map-wrap .leaflet-container { font-family: var(--font); }
.map-wrap .leaflet-popup-content-wrapper, .map-wrap .leaflet-popup-tip { background: var(--elev); color: var(--text); box-shadow: var(--shadow-2); }
.map-wrap .leaflet-popup-content { margin: 10px 12px; font-size: 12px; line-height: 18px; }
.map-wrap .leaflet-container a.leaflet-popup-close-button { color: var(--muted); }
.map-wrap .leaflet-bar a { background: var(--elev); color: var(--text); border-color: var(--border-strong); }
.map-wrap .leaflet-bar a:hover { background: var(--hover); }
.map-wrap .leaflet-control-attribution { background: color-mix(in srgb, var(--bg) 80%, transparent); color: var(--muted); }
.map-wrap .leaflet-control-attribution a { color: var(--text-2); }
.map-wrap .leaflet-container:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.legend-grad { display: inline-block; width: 120px; height: 10px; border-radius: 5px; vertical-align: middle; }
.sw-box { width: 14px; height: 14px; border-radius: 4px; display: inline-block; border: 1px solid var(--border-strong); vertical-align: middle; }
.progress { position: relative; width: 90px; height: 8px; background: var(--neutral-bg); border-radius: var(--r-pill); display: inline-block; vertical-align: middle; overflow: hidden; margin-right: 6px; }
.progress > i { position: absolute; inset: 0 auto 0 0; background: var(--c2); }
tr.sel-row { --row-bg: var(--hover); }
tr.sel-row td:first-child { box-shadow: inset 3px 0 0 var(--text); }

/* ---------- Settings ---------- */
.settings-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; align-items: start; }
.sect-fields { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 16px; padding: 18px; }
.sect-fields .full { grid-column: 1 / -1; }
.savebar { position: sticky; bottom: 0; z-index: 40; display: flex; align-items: center; gap: 12px; justify-content: space-between; padding: 12px 18px; background: var(--elev); border: 1px solid var(--border-mid); border-radius: var(--r-md); box-shadow: var(--shadow-2); margin-top: 20px; }
.runbtns { display: flex; flex-wrap: wrap; gap: 8px; padding: 18px; }
.add-row { display: flex; gap: 8px; flex-wrap: wrap; padding: 14px 18px; border-top: 1px solid var(--border); align-items: flex-end; }
.add-row input[type="number"] { width: 92px; }

@media (max-width: 1100px) {
  .cols-main-side, .cols-2, .settings-grid { grid-template-columns: minmax(0, 1fr); }
  .page { padding: 18px; }
  .topbar { padding: 0 14px; gap: 14px; }
  .fn-row { grid-template-columns: 96px minmax(0, 1fr) 128px; }
  .stepper { grid-template-columns: repeat(2, minmax(0, 1fr)); row-gap: 14px; }
}
@media (max-width: 720px) { .brand small { display: none; } .nav a { padding: 0 8px; } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}
@media print { .topbar, .toasts { display: none; } }

/* tag editor */
.tag-box { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; padding: 4px 8px; min-height: 38px; background: var(--elev); border: 1px solid var(--border-strong); border-radius: var(--r-sm); cursor: text; }
.tag-box:focus-within { outline: 2px solid var(--focus); outline-offset: 1px; }
.tag-box input:focus-visible { outline: none; }

/* scheduler chip */
.sched { display: flex; align-items: center; gap: 8px; margin-right: 10px; }
/* daily target / pipeline stock */
.ov-target { grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); margin-bottom: 16px; align-items: stretch; }
.big-frac { font-size: 48px; font-weight: 600; line-height: 1; letter-spacing: -0.03em; }
.big-frac small { font-size: 22px; font-weight: 400; color: var(--muted); }
.seg-bar { display: flex; height: 16px; background: var(--neutral-bg); border-radius: var(--r-pill); overflow: hidden; gap: 2px; margin: 14px 0 8px; }
.seg-bar > i { display: block; min-width: 0; }
.seg-done { background: var(--c2); }
.seg-fly { background: var(--c1); background-image: repeating-linear-gradient(135deg, transparent 0 5px, rgba(0,0,0,.28) 5px 7px); }
.stock { display: grid; gap: 8px; }
.stock-row { display: grid; grid-template-columns: 110px minmax(0, 1fr) 150px; gap: 12px; align-items: center; padding: 7px 10px; border-radius: 10px; border: 1px solid transparent; }
.stock-row .st-bar { height: 8px; background: var(--neutral-bg); border-radius: var(--r-pill); position: relative; overflow: hidden; }
.stock-row .st-bar > i { position: absolute; inset: 0 auto 0 0; background: var(--c1); min-width: 2px; }
.stock-row .st-n { text-align: right; font-weight: 600; }
.stock-row.is-bn { border-color: var(--warn); background: var(--warn-bg); }
.stock-row.is-bn .st-bar > i { background: var(--warn); }
.bn-tag { display: inline-block; margin-left: 6px; padding: 0 6px; font-size: 10.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; border: 1px solid var(--warn); color: var(--warn); border-radius: 6px; }

/* status strip */
.strip { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 16px; padding: 7px 28px; background: var(--bg); border-bottom: 1px solid var(--border); font-size: 12px; line-height: 18px; min-height: 31px; }
.strip .si { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.strip .sl { color: var(--muted); }
.strip .sv { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }
.strip .sv.ok { color: var(--ok); } .strip .sv.bad { color: var(--bad); }
.strip .inert .sv { color: var(--muted); font-weight: 500; }
.strip .sep { width: 1px; height: 14px; background: var(--border-strong); opacity: .6; }
.strip .mini { position: relative; width: 28px; height: 6px; border-radius: var(--r-pill); background: var(--neutral-bg); overflow: hidden; display: inline-block; }
.strip .mini > i { position: absolute; inset: 0 auto 0 0; background: var(--c1); }
.strip .mini > i.fly { background: var(--c2); }
.strip .mini.warn > i { background: var(--warn); background-image: repeating-linear-gradient(135deg, transparent 0 4px, rgba(0,0,0,.25) 4px 6px); }
.strip .mini.bad > i { background: var(--bad); background-image: repeating-linear-gradient(135deg, transparent 0 4px, rgba(0,0,0,.3) 4px 6px); }
.strip .mini.pv > i { background: var(--c2); }
.strip .sv.warn { color: var(--warn); } 
.strip a.att { display: inline-flex; align-items: center; height: 22px; padding: 0 10px; border-radius: var(--r-pill); background: var(--warn-bg); color: var(--warn); font-weight: 600; text-decoration: none; border: 1px solid transparent; }
.strip a.att.err { background: var(--bad-bg); color: var(--bad); }
.strip a.att:hover { border-color: currentColor; }
.strip a.held { color: inherit; text-decoration: none; border-bottom: 1px dotted var(--warn); }
.strip a.held:hover .sv { text-decoration: underline; }
.strip .lj { flex: 1 1 170px; min-width: 0; max-width: 460px; overflow: hidden; text-overflow: ellipsis; }
.strip .lj .sum { color: var(--muted); overflow: hidden; text-overflow: ellipsis; }
.strip .strip-msg { color: var(--muted); }
.strip .pill { height: 18px; font-size: 11px; }
@media (max-width: 1100px) { .strip { padding: 6px 16px; } }

dialog.legend { max-width: min(680px, calc(100vw - 32px)); max-height: 88vh; overflow: auto; }
.lg-row { display: grid; grid-template-columns: 130px minmax(0, 1fr); gap: 12px; padding: 6px 0; border-bottom: 1px solid var(--border); align-items: center; }
.lg-row:last-child { border-bottom: 0; }

/* ---------- Sales ---------- */
.page-sales { max-width: 1500px; }
.q-sec { margin-bottom: 18px; }
.q-sec > h2 { display: flex; align-items: center; gap: 10px; font-size: 15px; letter-spacing: -0.005em; color: var(--text); margin-bottom: 10px; }
.q-none { color: var(--muted); padding: 6px 2px; font-size: 12.5px; }
.q-none b { color: var(--text-2); font-weight: 600; }
.sc { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr) minmax(0, 1.1fr); gap: 20px; padding: 18px 20px; background: var(--surface); border: 1px solid var(--border); border-left: 3px solid var(--border-strong); border-radius: var(--r-md); margin-bottom: 14px; scroll-margin-top: 76px; box-shadow: var(--inner-hl), var(--shadow-1); }
.q-sec.bad .sc { border-left-color: var(--bad); }
.sc.is-active { box-shadow: 0 0 0 2px var(--text-2); }
.sc.flash { animation: flash 2s ease-out; }
@keyframes flash { from { background: var(--ok-bg); } }
.sc.saving { opacity: .6; }
.sc h3 { overflow-wrap: anywhere; min-width: 0; font-size: 16px; letter-spacing: -0.01em; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.sc h3 a { text-decoration: none; }
.sc h3 a:hover { text-decoration: underline; }
.sc .sub { color: var(--muted); font-size: 12px; margin-top: 2px; }
.sc .floor-why { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sc .upsells { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
/* Upsell chips: purple accent via the themed --vio tokens (dark + light). Dashed border + no hover state keeps them non-clickable and distinct from the solid .pill floor badge. */
.upsell-chip { display: inline-flex; align-items: center; height: 20px; padding: 0 9px; border-radius: var(--r-pill); font-size: 11.5px; font-weight: 500; white-space: nowrap; background: var(--vio-bg); color: var(--vio); border: 1px dashed var(--vio); border: 1px dashed color-mix(in srgb, var(--vio) 70%, transparent); cursor: help; }
/* Call guide (sales card): collapsed <details>; fixed lines muted, generated slots normal text; --vio accent on step labels. */
.cg { margin-top: 8px; font-size: 12px; }
.cg-sum { cursor: pointer; display: inline-block; color: var(--vio); font-weight: 600; font-size: 12px; }
.cg-body { margin-top: 6px; padding: 8px 10px; border: 1px solid var(--border); border-left: 3px solid var(--vio); border-radius: 10px; }
.cg-steps { margin: 0; padding-left: 18px; display: grid; gap: 6px; }
.cg-steps li { line-height: 1.45; }
.cg-l { display: block; font-size: 10.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--vio); }
.cg-fixed { color: var(--muted); }
.cg-gen { color: var(--text); font-weight: 500; }
.cg-link { display: block; max-width: 100%; margin-top: 2px; padding: 0; border: 0; background: none; color: var(--accent, var(--vio)); font: inherit; text-align: left; cursor: copy; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-decoration: underline; }
.cg-obj { margin-top: 8px; padding-top: 6px; border-top: 1px solid var(--border); display: grid; gap: 3px; line-height: 1.4; }
.upsell-list { margin-top: 6px; font-size: 12px; }
.upsell-h { color: var(--vio); font-size: 10.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; margin-bottom: 2px; }
.upsell-i { line-height: 1.4; margin-top: 2px; padding-left: 6px; border-left: 2px solid var(--vio-bg); }
.sc .angle { font-size: 14px; font-weight: 500; margin: 8px 0 6px; line-height: 1.4; }
.sc ul.findings { font-size: 12.5px; color: var(--text-2); padding-left: 16px; }
.sc .lastev { margin-top: 8px; font-size: 12px; color: var(--muted); }
.sc .lastev b { color: var(--text-2); }
.sc .blk { display: grid; gap: 8px; align-content: start; min-width: 0; }
.sc .blk-h { font-size: 12px; font-weight: 600; letter-spacing: 0; color: var(--muted); }
.pv { border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px; background: var(--elev); display: grid; gap: 6px; }
.pv.hot { border-color: var(--info); box-shadow: inset 3px 0 0 var(--info); }
.pv .hotflag { font-weight: 700; color: var(--info); font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; }
.btns { display: flex; flex-wrap: wrap; gap: 6px; }
.btn.is-off, .btn.is-off[aria-disabled="true"] { opacity: 1; color: var(--muted); border-style: dashed; cursor: not-allowed; background: transparent; }
.btn.is-off:hover { background: transparent; }
.check-warn { font-size: 12px; border: 1px solid var(--warn); border-radius: 10px; background: var(--warn-bg); padding: 4px 8px; }
.check-warn summary { cursor: pointer; font-weight: 600; color: var(--warn); }
.check-warn ul { margin: 6px 0 2px; padding-left: 16px; color: var(--text); }
.stage-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 12px; }
.stage-row select { height: 28px; }
.log-seg { display: inline-flex; border: 1px solid var(--border-mid); border-radius: var(--r-pill); overflow: hidden; }
.log-seg button { border: 0; background: transparent; color: var(--text-2); padding: 0 14px; height: 30px; cursor: pointer; font: 500 12.5px var(--font); }
.log-seg button[aria-pressed="true"] { background: var(--text); color: var(--bg); }
.board { display: grid; grid-template-columns: repeat(auto-fit, minmax(176px, 1fr)); /* equal tracks; cols below set min-width:0 so long names can't widen them */ gap: 12px; align-items: start; }
.board .col { background: var(--elev); border: 1px solid var(--border); border-radius: var(--r-md); padding: 10px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 6px; min-width: 0; overflow: hidden; }
.board .col h3 { font-size: 12.5px; letter-spacing: 0; font-weight: 600; color: var(--text-2); display: flex; justify-content: space-between; align-items: baseline; gap: 8px; padding: 2px 2px 4px; min-width: 0; }
.board .col h3 > span { flex: none; }
.bc { display: block; text-decoration: none; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 9px 11px; font-size: 12px; min-width: 0; max-width: 100%; box-sizing: border-box; overflow: hidden; box-shadow: var(--shadow-1); transition: border-color 150ms ease, box-shadow 150ms ease; }
.bc:hover { border-color: var(--border-strong); box-shadow: var(--shadow-2); }
.bc b {  font-size: 12.5px; margin-bottom: 2px; overflow: hidden; overflow-wrap: anywhere; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; }
.bc .m { overflow-wrap: anywhere; }
.bc .m { color: var(--muted); }
.bc.due { box-shadow: inset 3px 0 0 var(--warn); }
.score-fn { display: grid; gap: 6px; }
.score-fn .r { display: grid; grid-template-columns: 80px minmax(0, 1fr) 210px; gap: 10px; align-items: center; }
.score-fn .bar { height: 14px; background: var(--neutral-bg); border-radius: var(--r-pill); position: relative; }
.score-fn .bar > i { position: absolute; inset: 0 auto 0 0; background: var(--c1); border-radius: var(--r-pill); min-width: 6px; }
@media (max-width: 1100px) { .sc { grid-template-columns: minmax(0, 1fr); } }
.inactive-warn { grid-column: 1 / -1; padding: 8px 14px; border-radius: 10px; border: 1px solid var(--warn); background: var(--warn-bg); color: var(--text); font-size: 12.5px; }
.inactive-warn b { color: var(--warn); }
.inactive-warn.dormant { border-color: var(--bad); background: var(--bad-bg); }
.inactive-warn.dormant b { color: var(--bad); }

/* ---------- Sales: suggested message (collapsible, full card width) ---------- */
.sug { grid-column: 1 / -1; border: 1px solid var(--border); border-radius: 12px; background: var(--elev); padding: 4px 14px; font-size: 12.5px; }
.sug > summary { cursor: pointer; font-weight: 600; color: var(--text-2); min-height: 28px; display: flex; align-items: center; }
.sug[open] > summary { margin-bottom: 8px; }
.sug-body { display: grid; gap: 10px; padding-bottom: 8px; min-width: 0; }
.sug-tabs { display: flex; flex-wrap: wrap; gap: 4px; border-bottom: 1px solid var(--border); }
.sug-tab { border: 0; border-bottom: 2px solid transparent; background: transparent; color: var(--muted); font: 600 12.5px var(--font); padding: 0 12px; height: 34px; cursor: pointer; margin-bottom: -1px; }
.sug-tab:hover { color: var(--text); }
.sug-tab[aria-selected="true"] { color: var(--text); border-bottom-color: var(--text); }
.sug-panel { display: grid; gap: 10px; min-width: 0; max-width: 820px; }
.sug-hint { margin: 0; }
.sug-choices { display: flex; flex-wrap: wrap; gap: 6px; }
.sug-choice { display: inline-flex; align-items: center; gap: 6px; min-height: 32px; padding: 4px 13px; border-radius: 16px; border: 1px solid var(--border-mid); background: transparent; color: var(--text-2); font: 500 12px var(--font); cursor: pointer; }
.sug-choice:hover { background: var(--hover); }
.sug-choice[aria-pressed="true"] { background: var(--text); color: var(--bg); border-color: var(--text); }
.sug-choice .pill { height: 18px; font-size: 10.5px; }
.sug-pane { display: grid; gap: 8px; min-width: 0; }
.sug-pane textarea, .sug-pane input { width: 100%; }
.sug-when { display: flex; gap: 10px; align-items: center; justify-content: space-between; color: var(--text-2); font-size: 12px; flex-wrap: wrap; }
.sug-copied { color: var(--ok); font-weight: 600; font-size: 11.5px; }
.sug-choice[aria-pressed="true"] .sug-copied { color: inherit; }
.sug-count.over, .sug-over.over { color: var(--bad); font-weight: 600; }
.sug-warn { margin: 0; padding: 8px 12px 8px 28px; border: 1px solid var(--warn); border-radius: 10px; background: var(--warn-bg); color: var(--text); font-size: 12px; }
.perf { grid-column: 1 / -1; margin-top: 4px; }
.perf-h { font-size: 12.5px; font-weight: 600; letter-spacing: 0; color: var(--text-2); margin-bottom: 6px; }

/* ---------- Settings: outreach messages ---------- */
.ot-card { grid-column: 1 / -1; }
.ot-body { padding: 18px; display: grid; gap: 14px; }
.ot-chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.ot-chips .chip { font-family: var(--mono); height: 28px; }
.ot-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 380px), 1fr)); gap: 14px; align-items: start; }
.ot-block { border: 1px solid var(--border); border-radius: var(--r-md); background: var(--elev); padding: 14px; display: grid; gap: 8px; min-width: 0; }
.ot-block h3 { font-size: 13px; }
.ot-block-h { display: flex; justify-content: space-between; gap: 8px; align-items: flex-start; }
.ot-block-h > div { min-width: 0; }
.ot-block-h .btn { flex: none; }
.ot-block textarea, .ot-block input, .ot-body > label textarea { width: 100%; background: var(--surface); }
.ot-block textarea { font-family: var(--mono); font-size: 12.5px; }
.ot-count.over { color: var(--bad); font-weight: 600; }
.sug-choice[aria-pressed="true"] .pill { background: transparent; color: inherit; border: 1px solid currentColor; }

/* ---------- Sales: send email dialog (Stage 1 email sending) ---------- */
.sug-sent { margin-left: 6px; }
.sug-off { margin: 0; }
.sug-off a { color: var(--text); text-decoration: underline; }
.sc .lastev.emailed { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; overflow-wrap: anywhere; }
dialog.send-dlg { max-width: min(640px, calc(100vw - 24px)); max-height: calc(100vh - 24px); max-height: calc(100dvh - 24px); overflow: auto; }
.send-dlg form { min-width: 0; }
.send-dlg input, .send-dlg textarea { width: 100%; }
.send-dlg textarea { min-height: 160px; resize: vertical; line-height: 1.5; }
.sd-from { min-height: 32px; display: flex; align-items: center; padding: 0 10px; border: 1px solid var(--border); border-radius: var(--r-sm); background: var(--elev); color: var(--text-2); font-size: 13px; overflow-wrap: anywhere; }
.sd-over { color: var(--bad); font-weight: 600; }
.sd-err:empty { display: none; }
.send-dlg .dlg-actions { flex-wrap: wrap; align-items: center; }
.sd-keys { margin-right: auto; }
.send-dlg .btn .spin { margin-right: 2px; }
@media (max-width: 520px) { .sd-keys { display: none; } .send-dlg form { padding: 14px; } }

/* ---------- Settings: email sending card ---------- */
.em-card { grid-column: 1 / -1; }
.em-body { padding: 18px; display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); gap: 14px; align-items: start; }
.em-body .full { grid-column: 1 / -1; }
.em-body input[type="text"], .em-body input[type="number"] { width: 100%; }
.em-today { font-size: 13px; color: var(--text-2); }
.em-today b { color: var(--text); }
.sug-choice { flex-wrap: wrap; text-align: left; }
.sug-choice .sug-sent { margin-left: 0; }

/* ---------- Thin sites: content check card (lead detail), settings card ---------- */
.cc-body { display: grid; gap: 12px; }
.cc-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; }
.cc-note { margin: 0; max-width: 70ch; }
.cc-metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(84px, 1fr)); gap: 8px; margin: 0; }
.cc-metrics > div { border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px; }
.cc-metrics dt { color: var(--muted); font-size: 11.5px; }
.cc-metrics dd { margin: 2px 0 0; font-size: 18px; font-weight: 600; font-variant-numeric: tabular-nums; }
.cc-hold { margin: 0 !important; align-items: flex-start; flex-wrap: wrap; }
.cc-hold .acts { display: flex; flex-wrap: wrap; gap: 8px; }
.th-card .th-body { padding: 18px; display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 150px), 1fr)); gap: 14px; align-items: start; }
.th-card .th-body .full { grid-column: 1 / -1; }
.th-card input[type="number"] { width: 100%; max-width: 140px; }

/* Role-aware chrome: admin-only nav links stay invisible until /api/me has answered (no flash for sales users). */
body:not([data-role]) .nav a[data-admin] { visibility: hidden; }
.who { font-size: 13px; color: var(--muted, inherit); padding: 0 8px; max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who[hidden] { display: none; }

/* Sales: read-only "My territory" disclosure */
.terr { margin: 0 0 14px; }
.terr > summary { display: flex; align-items: baseline; gap: 12px; padding: 12px 18px; cursor: pointer; list-style: none; min-height: 42px; align-items: center; }
.terr > summary::-webkit-details-marker { display: none; }
.terr > summary::before { content: "▸"; color: var(--muted); font-size: 11px; }
.terr[open] > summary::before { content: "▾"; }
.terr[open] > summary { border-bottom: 1px solid var(--border); }
.terr-t { font-size: 15px; font-weight: 600; letter-spacing: -0.005em; color: var(--text); }
.terr-sum { font-size: 12.5px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.terr-region + .terr-region, .terr-region + .terr-kw { margin-top: 16px; }
.terr-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 6px; }
.terr-loc { font-size: 11.5px; }
.terr-bar { height: 6px; background: var(--neutral-bg); border-radius: var(--r-pill); overflow: hidden; position: relative; }
.terr-bar > i { position: absolute; inset: 0 auto 0 0; background: var(--c1); border-radius: var(--r-pill); }
.terr-note { font-size: 12px; margin-top: 5px; }
.terr-stats { display: flex; flex-wrap: wrap; gap: 4px 16px; margin-top: 8px; font-size: 12.5px; color: var(--text-2); }
.terr-stat b { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }
.terr-kw { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.terr-kwl { font-size: 12px; }
.terr-chip { display: inline-flex; align-items: center; height: 26px; padding: 0 12px; border-radius: var(--r-pill); border: 1px solid var(--border-mid); background: var(--elev); color: var(--text-2); font-size: 12px; }
.terr-chip.off { color: var(--muted); border-style: dashed; background: transparent; }
.terr-kws, .terr-mapbox { margin-top: 16px; }
.terr-kws { display: grid; gap: 2px; }
.terr-kwr { display: grid; grid-template-columns: minmax(90px, 1.2fr) minmax(80px, 2fr) 38px minmax(120px, 1.6fr); align-items: center; gap: 4px 12px; padding: 5px 0; font-size: 12.5px; border-top: 1px solid var(--border); }
.terr-kwt { display: flex; align-items: center; gap: 6px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); }
.terr-kwp { text-align: right; font-variant-numeric: tabular-nums; color: var(--text-2); }
.terr-kwn { white-space: nowrap; font-size: 12px; }
.terr-kwn b { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }
.terr-kwr.off .terr-kwt, .terr-kwr.off .terr-kwp { color: var(--muted); }
.terr-kwr.off .terr-bar > i { background: var(--muted); }
@media (max-width: 640px) { .terr-kwr { grid-template-columns: 1fr 38px; } .terr-kwr .terr-bar { grid-column: 1 / -1; grid-row: 2; } .terr-kwn { grid-column: 1 / -1; } }
.terr-maph { display: flex; align-items: center; gap: 8px 12px; flex-wrap: wrap; margin-bottom: 8px; }
.terr-maph .chips[hidden] { display: none; }
.terr-maph #tm-mode { margin-left: auto; }
#tm-map { height: 380px; max-height: 60vh; border-radius: 12px; background: var(--bg); z-index: 0; }

/* Sales (admin): Team analytics cards, each also a salesperson filter */
.tm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.tm-card { display: flex; flex-direction: column; gap: 12px; padding: 14px 16px; background: var(--elev); border: 1px solid var(--border); border-radius: var(--r-md); cursor: pointer; min-width: 0; box-shadow: var(--shadow-1); transition: background-color 150ms ease, box-shadow 150ms ease; }
.tm-card:hover { background: var(--hover); box-shadow: var(--shadow-2); }
.tm-card.is-sel { border-color: var(--text); box-shadow: inset 0 0 0 1px var(--text); }
.tm-card.off { opacity: 0.7; }
.tm-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.tm-lbl { font-size: 12px; font-weight: 500; letter-spacing: 0; color: var(--muted); margin-bottom: 4px; }
.tm-note { font-size: 12.5px; color: var(--text-2); margin-top: 4px; }
.tm-note b, .tm-fn b { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }
.tm-note.warn { color: var(--warn); }
.tm-note.bad { color: var(--bad); }
.tm-fns { display: flex; flex-wrap: wrap; gap: 2px 14px; font-size: 12.5px; color: var(--text-2); }
.tm-card .pill b { font-weight: 600; }
.tm-big { font-size: 22px; line-height: 1.2; color: var(--text); margin-bottom: 6px; }
.tm-big b { font-weight: 600; font-variant-numeric: tabular-nums; font-size: 26px; }
.tm-big .muted { font-size: 13px; }
.terr-bar.ok > i { background: var(--ok); }
.terr-bar.warn > i { background: var(--warn); }
.terr-bar.bad > i { background: var(--bad); }
.tm-det { display: flex; flex-direction: column; gap: 3px; padding-top: 10px; border-top: 1px solid var(--border); font-size: 12px; color: var(--muted); }
.tm-det-row { display: flex; justify-content: space-between; gap: 8px; }
.tm-det b { color: var(--text-2); font-weight: 600; font-variant-numeric: tabular-nums; }
.tm-more { font-size: 12px; color: var(--muted); }
.tm-more summary { cursor: pointer; list-style: revert; }

/* Possible-duplicate flag (sales cards, board cards, lead detail). Muted amber via --warn tokens. */
.dup-badge { max-width: 100%; min-width: 0; box-sizing: border-box; overflow: hidden; vertical-align: middle; }
.dup-badge .dup-t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.bc .dup-badge { display: flex; width: fit-content; height: 18px; font-size: 10.5px; margin: 0 0 3px; }
.dup-banner { margin: 8px 0 0; padding: 8px 14px; border-radius: 10px; border: 1px solid var(--warn); background: var(--warn-bg); color: var(--text); font-size: 13px; max-width: 70ch; overflow-wrap: anywhere; }
.dup-banner b { color: var(--warn); }

/* Hosting & email intel block on sales queue cards (brandbook section 6: chips) */
.intel { margin-top: 8px; font-size: 12px; }
.intel-chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.intel-chip { display: inline-flex; align-items: baseline; gap: 6px; max-width: 100%; min-height: 24px; padding: 3px 10px; border-radius: var(--r-pill); background: var(--elev); border: 1px solid var(--border-mid); color: var(--text); line-height: 1.3; }
.intel-k { font-size: 11px; color: var(--muted); flex: none; }
.intel-v { font-weight: 500; overflow-wrap: anywhere; }
.intel-chip.is-muted .intel-v { color: var(--muted); font-weight: 400; }
.intel-flag { white-space: normal; cursor: help; }
.intel-muted { margin-top: 8px; color: var(--muted); }
.intel-more { margin-top: 6px; }
.intel-more > summary { cursor: pointer; display: inline-block; color: var(--text-2); font-weight: 600; font-size: 12px; padding: 2px 0; }
.intel-body { margin-top: 6px; padding: 8px 10px; border: 1px solid var(--border); border-radius: 10px; display: grid; gap: 4px; line-height: 1.45; }
.intel-r { display: grid; grid-template-columns: 96px 1fr; gap: 8px; overflow-wrap: anywhere; }
.intel-rk { color: var(--muted); }
.intel-checked { color: var(--muted); font-size: 11.5px; }
@media (max-width: 520px) { .intel-r { grid-template-columns: 1fr; gap: 0; } }

/* Phone badge + lists (brandbook 6). Text label always present; tint uses existing semantic tokens only. */
.ph { display: inline-flex; align-items: center; flex-wrap: wrap; gap: 4px 8px; min-width: 0; }
.ph-badge { display: inline-flex; align-items: center; gap: 4px; height: 18px; padding: 0 7px; border-radius: var(--r-pill); font-size: 11px; font-weight: 500; white-space: nowrap; background: var(--neutral-bg); color: var(--neutral); }
.ph-badge.ok { background: var(--ok-bg); color: var(--ok); }
.ph-badge.info { background: var(--info-bg); color: var(--info); }
.ph-badge .ico { width: 12px; height: 12px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.ph-hint { font-size: 12px; color: var(--muted); }
.ph-strip { flex-wrap: wrap; gap: 4px 14px; }
.ph-more { display: inline-flex; flex-wrap: wrap; gap: 4px 14px; }
.ph-more[hidden], .ph-rest[hidden] { display: none; }
.ph-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.ph-block { display: grid; gap: 6px; }
.ph-copywrap { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; }
.ph-copy { padding: 0 8px; }
.ph-main { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; }
.ph-rest { display: grid; gap: 6px; padding: 8px 10px; background: var(--elev); border: 1px solid var(--border-mid); border-radius: var(--r-sm); }
.filterbar .check { display: inline-flex; align-items: center; gap: 6px; height: 34px; color: var(--text); white-space: nowrap; }
.filterbar .check input { width: 16px; height: 16px; accent-color: var(--accent); }
@media (max-width: 520px) { .ph-hint { flex-basis: 100%; } }

/* Podium rank badge (yield ranking; brandbook section 6). Text + border, never colour-only. */
.podium { display: inline-flex; align-items: center; height: 20px; padding: 0 8px; border-radius: var(--r-pill); font-size: 11.5px; font-weight: 600; font-variant-numeric: tabular-nums; background: var(--neutral-bg); color: var(--neutral); border: 1px solid transparent; white-space: nowrap; }
.podium.p1 { background: var(--gold-bg); color: var(--gold); border-color: currentColor; }
.podium.p2 { background: var(--silver-bg); color: var(--silver); border-color: currentColor; }
.podium.p3 { background: var(--bronze-bg); color: var(--bronze); border-color: currentColor; }
.pill.early { height: 18px; font-size: 11px; color: var(--muted); }
.yield-sum { margin: 0; padding: 10px 18px; font-size: 13px; color: var(--text-2); border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.yield-sum b { color: var(--text); font-weight: 600; }
.tbl th[title] { cursor: help; text-decoration: underline dotted var(--muted); text-underline-offset: 3px; }
.tbl td.yld { font-weight: 600; color: var(--text); }
.terr-kwy { grid-column: 1 / -1; display: flex; align-items: center; gap: 4px 10px; flex-wrap: wrap; font-size: 12px; color: var(--muted); }
.terr-kwy b { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }

/* ---------- Settings: Optimize dialog (per-salesperson optimizer) ---------- */
dialog.optz-dlg { max-width: min(680px, calc(100vw - 24px)); max-height: calc(100vh - 24px); max-height: calc(100dvh - 24px); overflow: auto; }
.optz-dlg form { min-width: 0; }
.optz-steps, .optz-list, .optz-res { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.optz-step { display: grid; grid-template-columns: 20px 1fr; gap: 10px; align-items: start; color: var(--muted); }
.optz-step.is-running, .optz-step.is-done { color: var(--text); }
.optz-mark { width: 20px; height: 20px; display: inline-flex; align-items: center; justify-content: center; }
.optz-mark.pending { border: 2px solid var(--border-strong); border-radius: 50%; width: 14px; height: 14px; margin: 3px; }
.optz-mark.done { color: var(--ok); }
.optz-mark.failed { color: var(--bad); font-weight: 700; }
.optz-step.is-failed { color: var(--bad); }
.optz-detail { display: block; font-size: 12px; color: var(--muted); }
.optz-sum { margin: 0; color: var(--text-2); }
.optz-card { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; padding: 12px 14px; border: 1px solid var(--border-mid); border-radius: var(--r-md); background: var(--elev); }
.optz-card.is-info { background: transparent; border-style: dashed; border-color: var(--border-strong); }
.optz-card.is-info .optz-t { color: var(--text-2); }
.optz-pick { grid-row: 1 / span 3; padding-top: 2px; }
.optz-card.is-info .optz-pick { display: none; }
.optz-card.is-info { grid-template-columns: 1fr; }
.optz-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.optz-t { font-weight: 600; flex: 1 1 200px; min-width: 0; overflow-wrap: anywhere; }
.optz-d { margin: 0; color: var(--text-2); font-size: 13px; overflow-wrap: anywhere; }
.optz-card .intel-chips { margin-top: 4px; }
.optz-card .intel-chip { background: var(--surface); }
.optz-res li { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; }
.optz-res .optz-d { flex-basis: 100%; }
.optz-err { margin: 0; color: var(--bad); overflow-wrap: anywhere; }
.optz-dlg .dlg-actions { flex-wrap: wrap; }
@media (max-width: 520px) { .optz-dlg form { padding: 14px; } }

/* Recent opens dialog (sales page) */
dialog.ro-dlg { max-width: min(640px, calc(100vw - 24px)); max-height: calc(100vh - 24px); max-height: calc(100dvh - 24px); overflow: auto; }
.ro-wrap { padding: 22px; display: grid; gap: 12px; }
.ro-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; }
.ro-head h2 { margin: 0; }
.ro-note { margin: 0; }
.ro-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.ro-row { display: flex; align-items: center; gap: 8px; border: 1px solid var(--border); border-radius: var(--r-md); background: var(--elev); padding-right: 8px; }
.ro-row:hover { background: var(--hover); }
.ro-row.is-hot { border-color: var(--info); box-shadow: inset 3px 0 0 var(--info); }
.ro-main { flex: 1; min-width: 0; display: grid; gap: 2px; padding: 8px 10px; color: inherit; text-decoration: none; border-radius: var(--r-md); }
.ro-main:focus-visible { outline: 2px solid var(--info); outline-offset: -2px; }
.ro-top { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; }
.ro-name { overflow-wrap: anywhere; }
.ro-meta { font-size: 12px; overflow-wrap: anywhere; }
.ro-row .hotflag { font-weight: 700; color: var(--info); font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; }
.ro-fp { font-size: 11.5px; overflow-wrap: anywhere; }
.ro-ip { font-variant-numeric: tabular-nums; }
.ro-ip[title] { cursor: help; }
.ro-auto { margin-top: 4px; border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface); padding: 8px 12px; }
.ro-auto > summary { cursor: pointer; font-weight: 600; font-size: 13px; }
.ro-auto > summary:focus-visible { outline: 2px solid var(--info); outline-offset: 2px; border-radius: var(--r-sm); }
.ro-auto-note { margin: 6px 0 8px; }
.ro-auto-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.ro-auto-row { display: grid; gap: 2px; padding: 6px 0; border-top: 1px solid var(--border); }
.ro-auto-row .ro-name { color: inherit; font-weight: 600; font-size: 13px; }
@media (max-width: 520px) { .ro-wrap { padding: 14px; } .ro-row { flex-wrap: wrap; } }

/* ---------- Pipeline + Performance (admin) ---------- */
.pl-reps { margin-bottom: 16px; }
.pl-chip { gap: 7px; }
.pl-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--rep, var(--muted)); flex: none; }
.pl-n { font-variant-numeric: tabular-nums; opacity: .75; font-weight: 500; }
.pl-scroll { overflow-x: auto; padding-bottom: 8px; }
.pl-board { display: grid; grid-template-columns: repeat(5, minmax(220px, 1fr)); gap: 12px; align-items: start; min-width: 1120px; }
.pl-board .col { background: var(--elev); border: 1px solid var(--border); border-radius: var(--r-md); padding: 10px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 6px; min-width: 0; }
.pl-board .col h3 { font-size: 12.5px; font-weight: 600; color: var(--text-2); display: flex; justify-content: space-between; align-items: baseline; gap: 8px; padding: 2px 2px 0; }
.pl-sub { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; font-size: 11.5px; color: var(--muted); padding: 0 2px 4px; font-variant-numeric: tabular-nums; }
.pl-stalecount { color: var(--warn); font-weight: 600; }
.pl-meta { display: flex; align-items: center; justify-content: space-between; gap: 6px; margin: 2px 0 4px; }
.pl-owner { display: inline-flex; align-items: center; gap: 5px; height: 20px; padding: 0 8px; border-radius: var(--r-pill); font-size: 11.5px; font-weight: 500; background: var(--elev); border: 1px solid var(--border-mid); color: var(--text-2); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pl-stale { height: 18px; font-size: 10.5px; flex: none; }
.pl-stale::before { display: none; }

.pf-podium { list-style: none; margin: 0 0 20px; padding: 0; display: flex; justify-content: center; align-items: flex-end; gap: 14px; flex-wrap: wrap; }
.pf-pod { flex: 1 1 200px; max-width: 280px; display: grid; gap: 12px; padding: 16px 18px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); box-shadow: var(--shadow-1); }
.pf-pod.p1 { order: 2; padding-top: 28px; padding-bottom: 26px; box-shadow: var(--shadow-2); border-color: var(--gold); background: linear-gradient(180deg, var(--gold-bg), var(--surface) 55%); }
.pf-pod.p2 { order: 1; border-color: var(--silver); }
.pf-pod.p3 { order: 3; border-color: var(--bronze); }
.pf-pod-h { display: flex; align-items: center; gap: 8px; min-width: 0; }
.pf-pod-name { font-weight: 600; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pf-score { font-family: var(--font-display); font-size: 40px; font-weight: 500; line-height: 1; font-variant-numeric: tabular-nums; }
.pf-pod.p1 .pf-score { font-size: 54px; }
.pf-score small { font-family: inherit; font-size: 12px; color: var(--muted); margin-left: 6px; font-weight: 500; }
.pf-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 0; }
.pf-stats dt { font-size: 11.5px; color: var(--muted); }
.pf-stats dd { margin: 0; font-size: 18px; font-weight: 600; font-variant-numeric: tabular-nums; }
.pf-won { font-size: 12.5px; color: var(--text-2); font-variant-numeric: tabular-nums; }
.pf-tbl th.num, .pf-tbl td.num { text-align: right; font-variant-numeric: tabular-nums; }
.pf-tbl tr.pf-top td { background: var(--elev); }
.pf-tbl tfoot th, .pf-tbl tfoot td { font-weight: 600; border-top: 1px solid var(--border-mid); border-bottom: 0; background: var(--elev); text-align: left; }
.pf-tbl tfoot td.num { text-align: right; }
.pf-cap { margin-top: 12px; }
@media (max-width: 640px) { .pf-pod.p1 { order: 0; } .pf-pod.p2, .pf-pod.p3 { order: 0; } .pf-pod { max-width: none; } }
