/* Facets Novum HQ — internal portal design system v1.
   Quiet, dense, dashboard-grade. Light and dark are both first-class:
   tokens on :root, dark via prefers-color-scheme, and the header toggle
   stamps data-theme which wins in both directions. AA contrast throughout. */

:root {
  --bg: #F6F7F9;
  --surface: #FFFFFF;
  --text: #1A2330;
  --muted: #5A6A7A;
  --line: #DDE3EA;
  --accent: #1B5FA8;
  --ok: #1E7B4F;
  --err: #B3261E;
  --radius: 10px;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #10151C;
    --surface: #1A212B;
    --text: #E8EDF3;
    --muted: #9AA8B8;
    --line: #2A3543;
    --ok: #4CC38A;
    --err: #F2B8B5;
  }
}
:root[data-theme="light"] {
  --bg: #F6F7F9; --surface: #FFFFFF; --text: #1A2330; --muted: #5A6A7A;
  --line: #DDE3EA; --ok: #1E7B4F; --err: #B3261E;
}
:root[data-theme="dark"] {
  --bg: #10151C; --surface: #1A212B; --text: #E8EDF3; --muted: #9AA8B8;
  --line: #2A3543; --ok: #4CC38A; --err: #F2B8B5;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

a { color: var(--accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

.skip {
  position: absolute; left: -999px; top: 8px; background: var(--surface);
  padding: 8px 14px; border-radius: 6px; z-index: 10;
}
.skip:focus { left: 8px; }

/* ── Header ── */
.bar {
  position: sticky; top: 0; z-index: 5;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.bar-in {
  max-width: 1080px; margin: 0 auto; padding: 10px 20px;
  display: flex; align-items: center; gap: 20px;
}
.brand { font-weight: 700; text-decoration: none; color: var(--text); }
.brand span { color: var(--accent); }
.bar nav a { text-decoration: none; color: var(--muted); font-weight: 500; }
.bar nav a:hover { color: var(--text); }
.bar-r { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.who { color: var(--muted); font-size: 13px; }
.out { font-size: 13px; }
.theme {
  background: none; border: 1px solid var(--line); color: var(--text);
  border-radius: 999px; width: 30px; height: 30px; cursor: pointer; font-size: 14px;
}

/* ── Main ── */
main { max-width: 1080px; margin: 0 auto; padding: 28px 20px 64px; }
h1 { font-size: 26px; margin: 0 0 4px; text-wrap: balance; }
h2 { font-size: 17px; margin: 28px 0 8px; }
h3 { font-size: 15px; margin: 18px 0 6px; }
.sub { color: var(--muted); margin: 0 0 20px; }
.crumb { font-size: 13px; color: var(--muted); margin: 0 0 10px; }
.crumb a { color: var(--muted); }
.note { font-size: 13px; color: var(--muted); }
.err { color: var(--err); font-weight: 600; }

/* ── Cards grid ── */
.grid {
  display: grid; gap: 16px;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
}
.card {
  display: block; background: var(--surface); border: 1px solid var(--line);
  border-top: 3px solid var(--accent);
  border-radius: var(--radius); padding: 18px 18px 16px;
  text-decoration: none; color: var(--text);
  transition: transform .12s ease, box-shadow .12s ease;
}
.card:hover { transform: translateY(-2px); box-shadow: 0 6px 18px rgba(0,0,0,.08); }
.card h2 { margin: 0 0 2px; font-size: 18px; }
.tag { color: var(--muted); margin: 0 0 12px; font-size: 14px; }

.count { display: flex; flex-direction: column; gap: 2px; border-top: 1px dashed var(--line); padding-top: 10px; }
.count strong { font-size: 16px; font-variant-numeric: tabular-nums; }
.count.live strong { color: var(--ok); }
.count span { color: var(--muted); font-size: 13px; }
.count.off strong { color: var(--muted); }

/* ── Section page ── */
.section { background: var(--surface); border: 1px solid var(--line); border-top: 3px solid var(--accent); border-radius: var(--radius); padding: 26px 26px 30px; }
.pitch { max-width: 68ch; }
.scroll { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: 14px; }
th, td { text-align: left; padding: 8px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 600; }
td { font-variant-numeric: tabular-nums; }

details.repo { border: 1px solid var(--line); border-radius: 8px; margin: 8px 0; padding: 0 14px; }
details.repo summary { cursor: pointer; padding: 12px 0; font-weight: 600; }
details.repo[open] summary { border-bottom: 1px solid var(--line); }
.proof { font-size: 13px; color: var(--muted); }
.links { padding-left: 18px; }

/* ── Login ── */
.login-wrap { min-height: 78vh; display: grid; place-items: center; padding: 20px; }
.login {
  width: 100%; max-width: 380px; background: var(--surface);
  border: 1px solid var(--line); border-radius: 14px; padding: 30px;
}
.login h1 { font-size: 22px; }
.login .hq { color: var(--accent); }
.login label { display: block; margin: 14px 0 4px; font-size: 13px; color: var(--muted); }
.login input {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--bg); color: var(--text); font-size: 15px;
}
.login button {
  margin-top: 18px; width: 100%; padding: 11px; border: 0; border-radius: 8px;
  background: var(--accent); color: #fff; font-size: 15px; font-weight: 600; cursor: pointer;
}
.login button:hover { filter: brightness(1.06); }

.foot { max-width: 1080px; margin: 0 auto; padding: 18px 20px 30px; color: var(--muted); font-size: 12.5px; }

/* ── Revenue board ──
   A waterfall the eye can trust: numbers carry the truth (real table,
   right-aligned, tabular-nums), the cascade bar under each product shows
   kept / direct costs / processing as widths against the largest gross.
   Zeros stay quiet (muted) so the first real dollar visibly lights up. */
.rev-title { margin-top: 40px; }
.rev {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 6px 18px 16px;
}
.revt th, .revt td { border-bottom: 0; }
.revt thead th { border-bottom: 1px solid var(--line); font-size: 12.5px; letter-spacing: .04em; text-transform: uppercase; }
.revt .num { text-align: right; white-space: nowrap; }
.revt td.num { font-size: 15px; }
.revt td.net { font-weight: 700; }
.revt .zero { color: var(--muted); font-weight: 400; }
.revt .neg { color: var(--err); }
.rev-row td { padding-top: 14px; padding-bottom: 2px; vertical-align: top; }
.pname { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.pname .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--pacc, var(--accent)); flex: none; }
.pnote { display: block; color: var(--muted); font-size: 12.5px; margin: 2px 0 0 17px; max-width: 46ch; }
.rev-bar td { padding: 6px 12px 12px; border-bottom: 1px solid var(--line); }
.revt tbody tr:last-of-type td { border-bottom: 0; }
.track {
  display: flex; height: 8px; border-radius: 999px; overflow: hidden;
  background: color-mix(in srgb, var(--line) 55%, transparent);
}
.seg { height: 100%; min-width: 2px; transition: width .5s ease; }
.seg.keep { background: var(--pacc, var(--accent)); }
.seg.cost { background: #C77A1E; opacity: .85; }
.seg.fee  { background: var(--err); opacity: .55; }
.revt tfoot th, .revt tfoot td { border-top: 2px solid var(--line); font-weight: 700; padding-top: 12px; }
.rev .note { margin: 12px 0 0; }
.rev code { font-size: 12px; background: var(--bg); border: 1px solid var(--line); border-radius: 4px; padding: 1px 5px; }
.revt .na { color: var(--muted); font-size: 13px; }

/* Aaron's commission shares one hue everywhere it appears. */
:root { --aaron: #7C5CD6; }
:root[data-theme="dark"] { --aaron: #9B82E8; }
@media (prefers-color-scheme: dark) { :root { --aaron: #9B82E8; } }
:root[data-theme="light"] { --aaron: #7C5CD6; }
.seg.aaron { background: var(--aaron); }
/* Semantic dots set the same custom property the .legend .dot rule reads,
   so no later rule can flatten them back to the accent fallback. */
.dot.aaron { --pacc: var(--aaron); }
.dot.keep { --pacc: var(--ok); }
.dot.cost { --pacc: #C77A1E; }
.dot.fee { --pacc: var(--err); opacity: .7; }

/* ── Display options ── */
.rev-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.rev-views { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; padding: 3px; background: var(--surface); }
.rv-btn {
  border: 0; background: none; color: var(--muted); font: inherit; font-size: 13px;
  font-weight: 600; padding: 5px 14px; border-radius: 999px; cursor: pointer;
}
.rv-btn.is-on { background: var(--accent); color: #fff; }
.rv-btn:not(.is-on):hover { color: var(--text); }

/* ── Share view (donut) ── */
.donut-wrap { display: flex; align-items: center; gap: 34px; flex-wrap: wrap; padding: 22px 6px 10px; }
.donut { width: 210px; height: 210px; flex: none; }
.donut-ring { stroke: color-mix(in srgb, var(--line) 60%, transparent); }
.donut-big { font-size: 4.6px; font-weight: 700; fill: var(--text); font-variant-numeric: tabular-nums; }
.donut-small { font-size: 2.5px; fill: var(--muted); letter-spacing: .04em; }
.legend { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 9px; min-width: 260px; }
.legend li { display: flex; align-items: center; gap: 9px; font-size: 14px; }
.legend .dot { width: 10px; height: 10px; border-radius: 3px; background: var(--pacc, var(--accent)); flex: none; }
.legend .lg-num { margin-left: auto; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; padding-left: 18px; }
.legend.cols { max-width: 560px; }

/* ── Split view ── */
.split-wrap { padding: 26px 6px 10px; }
.split-bar {
  display: flex; height: 30px; border-radius: 9px; overflow: hidden; margin-bottom: 18px;
  background: color-mix(in srgb, var(--line) 55%, transparent);
}
.split-bar .seg { min-width: 3px; }
.split-bar .seg.keep { background: var(--ok); }

@media (max-width: 560px) {
  .donut-wrap { justify-content: center; }
  .legend { min-width: 0; width: 100%; }
}

/* Handout download (section pages) */
.dl-row { display: flex; flex-wrap: wrap; gap: 10px; }
.dl-btn {
  display: inline-block; background: var(--accent); color: #fff;
  font-weight: 600; font-size: 14px; text-decoration: none;
  padding: 9px 18px; border-radius: 999px;
}
.dl-btn:hover { filter: brightness(1.08); }
.dl-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

/* Password reveal toggle (fleet rule 2026-08-25: every password field is tap-to-reveal) */
.login .pw-wrap { position: relative; }
.login .pw-wrap input { padding-right: 62px; }
.login .pw-toggle {
  position: absolute; top: 50%; right: 8px; transform: translateY(-50%);
  width: auto; margin: 0; padding: 4px 10px; border: 0; border-radius: 6px;
  background: none; color: var(--muted); font-size: 12.5px; font-weight: 600; cursor: pointer;
}
.login .pw-toggle:hover { color: var(--text); filter: none; }

/* ── Darrell-only HQ infrastructure block (Forjance section) ── */
.private {
  margin-top: 34px; border: 1.5px solid var(--accent); border-radius: var(--radius);
  padding: 18px 22px 22px; background: var(--surface);
}
.private-tag {
  display: inline-block; font-size: 11px; font-weight: 700; letter-spacing: .06em;
  text-transform: uppercase; color: #fff; background: var(--accent);
  padding: 3px 10px; border-radius: 999px; margin-bottom: 10px;
}
.hq-charts { display: grid; gap: 18px; margin: 14px 0 20px; }
.hq-charts figure { margin: 0; border: 1px solid var(--line); border-radius: 10px; padding: 12px; background: var(--bg); }
.hq-charts figcaption { font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.hq-charts svg { width: 100%; height: auto; display: block; }
.plan-body h2 { margin-top: 26px; font-size: 21px; }
.plan-body h3 { margin-top: 20px; font-size: 16.5px; }
.plan-body h4 { margin-top: 16px; font-size: 14.5px; }
.plan-body p, .plan-body li { line-height: 1.6; font-size: 14.5px; overflow-wrap: break-word; }
.plan-body ul, .plan-body ol { padding-left: 24px; }
.plan-body li { margin: 5px 0; }
.plan-body code {
  background: var(--bg); border: 1px solid var(--line); border-radius: 4px;
  padding: 1px 5px; font-size: 13px;
}
.plan-body table { border-collapse: collapse; margin: 10px 0; }
.plan-body th, .plan-body td { border: 1px solid var(--line); padding: 7px 10px; font-size: 13.5px; text-align: left; }
.plan-body th { background: var(--bg); }

.private details.plan-fold { border: 1px solid var(--line); border-radius: 10px; margin-top: 14px; padding: 0 16px; background: var(--bg); }
.private details.plan-fold > summary { cursor: pointer; font-weight: 700; padding: 13px 0; color: var(--accent); }
.private details.plan-fold[open] > summary { border-bottom: 1px solid var(--line); }
.private .dl-row { margin: 12px 0 2px; }

/* ── Sales panel (comms row 103) ─────────────────────────────────────── */
.sales-summary { display: grid; grid-template-columns: repeat(5, minmax(0,1fr)); gap: 10px; margin: 14px 0 18px; }
.sales-summary .sum { background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 8px 8px; text-align: center; }
.sales-summary .sum strong { display: block; font-size: 20px; font-variant-numeric: tabular-nums; }
.sales-summary .sum span { color: var(--muted); font-size: 12.5px; }
.sales-summary .sum.hot { border-top: 3px solid var(--accent); }
.sales-summary .sum.hot strong { color: var(--accent); }
.sales-summary .sum.win strong { color: var(--ok); }
.lead { border-top: 1px solid var(--line); padding: 14px 2px; }
.lead-row { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: baseline; }
.lead .who { font-weight: 600; }
.lead .org { color: var(--muted); font-size: 13.5px; }
.lead .subj { margin: 2px 0 0; font-size: 14.5px; }
.lead .meta { color: var(--muted); font-size: 12.5px; font-variant-numeric: tabular-nums; }
.lead .spacer { flex: 1; }
.lead-foot { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 10px; }
.chip { border: 1px solid var(--line); border-radius: 999px; padding: 2px 11px; font-size: 12.5px; color: var(--muted); background: transparent; cursor: pointer; font: inherit; }
.chip[aria-pressed="true"] { font-weight: 600; }
.chip.st-new[aria-pressed="true"] { background: var(--accent); color: #fff; border-color: var(--accent); }
.chip.st-replied[aria-pressed="true"], .chip.st-scheduled[aria-pressed="true"] { color: var(--accent); border-color: var(--accent); }
.chip.st-scheduled[aria-pressed="true"] { box-shadow: inset 0 0 0 1px var(--accent); }
.chip.st-won[aria-pressed="true"] { color: var(--ok); border-color: var(--ok); }
.chip.st-lost[aria-pressed="true"] { color: var(--muted); border-color: var(--muted); text-decoration: line-through; }
.reply { border: 1px solid var(--accent); color: var(--accent); border-radius: 8px; padding: 5px 14px; font-size: 13.5px; text-decoration: none; }
.reply:hover { background: var(--accent); color: #fff; }
details.touches { margin-top: 8px; }
details.touches summary { cursor: pointer; color: var(--muted); font-size: 13px; }
.touchlog { margin: 8px 0 0; padding: 0; list-style: none; font-size: 13.5px; }
.touchlog li { padding: 5px 0 5px 14px; border-left: 2px solid var(--line); margin-left: 4px; }
.touchlog .t { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; display: block; }
.addtouch { margin: 8px 0 2px 4px; display: flex; gap: 8px; }
.addtouch input { flex: 1; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--text); padding: 6px 10px; font: inherit; font-size: 13.5px; }
.addtouch button { border: 1px solid var(--line); background: transparent; color: var(--text); border-radius: 8px; padding: 6px 12px; font: inherit; font-size: 13.5px; cursor: pointer; }
.salesfoot { color: var(--muted); font-size: 12.5px; margin-top: 18px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
@media (max-width: 560px) { .sales-summary { gap: 6px; } .sales-summary .sum strong { font-size: 17px; } }

/* Sales panel how-to fold + empty hint */
details.howto { border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg); padding: 10px 14px; margin: 0 0 16px; }
details.howto summary { cursor: pointer; font-weight: 600; font-size: 14px; }
details.howto p { font-size: 13.5px; margin: 10px 0 0; }
.touch-empty { color: var(--muted); font-size: 13px; margin: 8px 0 0 4px; }

/* ── BAA register summary tiles (Darrell-only, EMRFlow section) ── */
.baa-tiles { display: flex; flex-wrap: wrap; gap: 10px; margin: 14px 0 10px; }
.baa-tile {
  display: inline-flex; align-items: baseline; gap: 6px;
  border: 1px solid var(--c); border-left: 4px solid var(--c);
  border-radius: 8px; padding: 7px 13px; background: var(--bg);
  font-size: 13px; color: var(--fg-muted); white-space: nowrap;
}
.baa-tile b { font-size: 19px; font-weight: 700; color: var(--c); font-variant-numeric: tabular-nums; }
.note.baa-stale {
  border-left: 4px solid #b3261e; padding-left: 12px; color: var(--fg);
}
@media (prefers-color-scheme: dark) {
  .baa-tile { background: transparent; }
}

/* People lists behind a count (Aaron, 2026-09-01: clicking the number never
   showed the actual people). The count headline is a link now, so it needs to
   read as one. */
.count strong a { color: inherit; text-decoration: underline; text-underline-offset: 3px; }
.count strong a:hover { text-decoration-thickness: 2px; }
.empty { color: var(--muted); margin: 16px 0; }
.muted { color: var(--muted); }

/* The status counters are filter links now (Aaron, 2026-09-01: "click on one
   scheduled and see only the scheduled leads"), so they need to look and
   behave like controls: inherited color, no underline, a visible focus ring,
   and a clear pressed state for the active filter. */
a.sum { text-decoration: none; color: inherit; cursor: pointer; }
a.sum:hover { border-color: var(--accent, currentColor); }
a.sum:focus-visible { outline: 2px solid var(--accent, currentColor); outline-offset: 2px; }
a.sum.on { border-color: var(--accent, currentColor); border-width: 2px; }

/* What the visitor typed on the contact form. Shown under the lead's subject so
   a rep has the phone number and the message without opening anything. */
.leaddetail { margin: 4px 0 0; font-size: 13.5px; color: var(--muted); }
.leaddetail a { color: inherit; }
.leadsaid { margin: 6px 0 0; font-size: 13.5px; }
.leadsaid strong { color: var(--muted); font-weight: 600; }
