/* =============================================================================
   Funnel health — Jill Wise's four views (views/funnel.js)
   -----------------------------------------------------------------------------
   Loaded after growth-coach.css and uses only its tokens: no colour is defined
   here. Every rule below that sets both a background and a text colour is a
   pairing already asserted in apps/admin/api/tests/test_theme_contrast.py, and
   that test also scans this file (CustomerFunnelStylesheetTests).

   Conventions carried through every chart:
   - Violet (--accent) is always the actual rate. --warning at low opacity is
     the gap area between it and a target; the dashed --ink-faded edge is
     always the target. The binding handoff is marked by its tinted cell and
     label, never by recolouring its rate. In the channel x-ray (Jill's
     "orange = below target") a bar below its target is --warning-deep.
   - Fewer than 20 people entering: a pale fill with a violet outline, opaque,
     so it never blends with the gap area behind it.
   - An unmeasured stage is a dashed, empty box with words in it. It never gets
     a bar, so it can never be read as zero.
   ============================================================================= */

/* ── Frame: range, trust line, tabs, stage filter ────────────────────────── */
.fn-head { display: flex; flex-wrap: wrap; gap: 10px 18px; align-items: center; margin-bottom: 6px; }
.fn-range, .fn-phases { display: flex; flex-wrap: wrap; gap: 7px; }
.fn-phases { margin: 12px 0 16px; }
.fn-trust { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 11.5px; color: var(--ink-faded); }
.fn-tabs {
  display: flex; flex-wrap: wrap; gap: 2px;
  margin-top: 14px; border-bottom: 1px solid var(--rule);
}
.fn-tab {
  font: inherit; font-size: 14px; font-weight: 500;
  color: var(--ink-soft);
  background: transparent;
  border: 0; border-bottom: 2px solid transparent;
  padding: 10px 14px; margin-bottom: -1px;
  cursor: pointer;
}
.fn-tab:hover { color: var(--ink); }
.fn-tab.is-active { color: var(--accent-deep); border-bottom-color: var(--accent); font-weight: 650; }
.fn-tab:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
@media (pointer: coarse) { .fn-tab { min-height: 44px; } }

/* ── Cards and type ──────────────────────────────────────────────────────── */
.fn-card { margin-bottom: 16px; }
.fn-h2 { font-size: 16px; font-weight: 700; margin: 0 0 10px; color: var(--ink); letter-spacing: -0.01em; }
.fn-h3 { font-size: 14px; font-weight: 650; margin: 16px 0 8px; color: var(--ink); }
.fn-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.fn-row.fn-start { justify-content: flex-start; }
.fn-row > .fn-h2 { margin-bottom: 0; }
.fn-card > .fn-row:first-child { margin-bottom: 10px; }
.fn-mt { margin-top: 10px; }
.fn-soft { color: var(--ink-soft); font-size: 13px; line-height: 1.5; }
.fn-small { color: var(--ink-faded); font-size: 12px; margin: 2px 0; }
.fn-under { color: var(--ink-faded); font-size: 11.5px; line-height: 1.5; margin: 14px 0 0; }
.fn-num { font-variant-numeric: tabular-nums; font-size: 12px; color: var(--ink-soft); white-space: nowrap; }
.fn-r { text-align: right !important; }
.fn-error { color: var(--danger-deep); font-size: 13px; }
.fn-big { font-size: 24px; font-weight: 700; color: var(--ink); margin: 2px 0 4px; }
.fn-link {
  font: inherit; font-size: 12.5px; font-weight: 600;
  color: var(--accent-deep); background: transparent;
  border: 0; padding: 0; cursor: pointer; text-align: left;
}
.fn-link:hover { text-decoration: underline; }
.fn-empty { border-style: dashed; }
.fn-two { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 16px; align-items: start; }
@media (max-width: 900px) { .fn-two { grid-template-columns: 1fr; } }
.fn-tablewrap { overflow-x: auto; }
.fn-details > summary { cursor: pointer; color: var(--accent-deep); font-size: 13px; font-weight: 600; }
.fn-details[open] > summary { margin-bottom: 10px; }
.fn-total td { font-weight: 650; }

/* ── Legend ──────────────────────────────────────────────────────────────── */
.fn-legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 11.5px; color: var(--ink-soft); margin: 4px 0 14px; align-items: center; }
.fn-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--accent); margin-right: 5px; vertical-align: middle; }
.fn-dot.is-gap { background: var(--warning); }
.fn-dot.is-below { background: var(--warning-deep); }
.fn-dot.is-thin { background: var(--accent-soft); box-shadow: inset 0 0 0 1.5px var(--accent); }
.fn-targetkey { display: inline-block; width: 16px; border-top: 2px dashed var(--ink-faded); margin-right: 5px; vertical-align: middle; }

/* ── Funnel flow: ribbons ────────────────────────────────────────────────── */
.fn-flowcols { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 230px), 1fr)); gap: 14px; }
.fn-flowcell { min-width: 0; padding: 12px; border-radius: var(--radius); display: flex; flex-direction: column; gap: 6px; }
/* The binding constraint is the only tinted cell: one emphasised thing is
   found instantly, three are not. Muted text inside it moves to --ink-soft,
   because --ink-faded is not a legal pairing on a tint. */
.fn-flowcell.is-binding { background: var(--warning-soft); }
.fn-flowcell.is-binding .fn-flowlabel,
.fn-flowcell.is-binding .fn-output span,
.fn-flowcell.is-binding .fn-gapmetric,
.fn-flowcell.is-binding .fn-flags { color: var(--ink-soft); }
.fn-flowlabel { font-size: 12.5px; color: var(--ink-soft); }
.fn-flowlabel strong { display: block; font-size: 19px; line-height: 1.25; font-weight: 700; color: var(--ink); margin-top: 2px; }
.fn-ribbon { display: block; width: 100%; height: 150px; overflow: visible; }
.fn-flowcols.is-phase { grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 460px)); }
.fn-flowcols.is-phase .fn-ribbon { height: 190px; }
.fn-rb-actual { fill: var(--accent); }
/* Small sample: an outline on a pale fill, opaque so it never mixes with the
   gap area behind it. */
.fn-rb-actual.is-thin { fill: var(--accent-soft); stroke: var(--accent); stroke-width: 1.5; vector-effect: non-scaling-stroke; }
.fn-rb-target { fill: var(--warning); opacity: 0.45; }
.fn-rb-edge { fill: none; stroke: var(--ink-faded); stroke-width: 1.5; stroke-dasharray: 4 4; vector-effect: non-scaling-stroke; }
.fn-noribbon {
  height: 150px; box-sizing: border-box;
  display: flex; flex-direction: column; justify-content: center; gap: 6px;
  padding: 14px; border: 1.5px dashed var(--rule-strong); border-radius: var(--radius);
  background: var(--surface-sunk); color: var(--ink-soft); font-size: 12.5px; line-height: 1.45;
}
.fn-noribbon b { color: var(--ink); font-size: 14px; }
.fn-flowcols.is-phase .fn-noribbon { height: 190px; }
.fn-output { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; font-size: 12px; color: var(--ink-faded); }
.fn-output strong { font-size: 19px; font-weight: 700; color: var(--ink); }
.fn-gaplabel {
  display: flex; justify-content: space-between; gap: 6px; align-items: center;
  padding: 7px 10px; border-radius: var(--radius-sm);
  background: var(--surface); color: var(--warning-deep); font-size: 12px;
}
.fn-gapmetric { font-size: 12px; color: var(--ink-soft); }
.fn-hint { font-size: 12px; color: var(--ink-soft); line-height: 1.45; }
.fn-hint .btn { margin-top: 6px; }
.fn-flags { list-style: none; margin: 2px 0 0; padding: 0; font-size: 11.5px; color: var(--ink-faded); line-height: 1.45; }
.fn-flags li { padding-left: 10px; position: relative; margin-top: 3px; }
.fn-flags li::before { content: ''; position: absolute; left: 0; top: 0.6em; width: 4px; height: 4px; border-radius: 50%; background: var(--ink-faded); }
.fn-phasecta { align-self: flex-start; margin-top: auto; }
.fn-cta-link { text-decoration: none; }

/* ── Who brings the attention ────────────────────────────────────────────── */
.fn-sourcerows { display: grid; gap: 6px; }
.fn-source-row { display: grid; grid-template-columns: minmax(90px, 150px) minmax(0, 1fr) 84px; gap: 12px; align-items: center; min-height: 32px; font-size: 13px; color: var(--ink); }
.fn-source-row > .fn-num { text-align: right; }
.fn-sourcebar { position: relative; height: 12px; background: var(--surface-sunk); border-radius: 4px; }
.fn-sourcebar.is-pair { height: 9px; }
.fn-sourcebar.is-pair + .fn-sourcebar.is-pair { margin-top: 3px; }
.fn-barfill { height: 100%; border-radius: 3px; background: var(--accent); }
.fn-barfill.is-second { background: var(--accent-deep); }
.fn-barfill.is-unknown { background: var(--ink-faded); }
.fn-barfill.is-gap { background: var(--warning-deep); }
/* Fewer than 20 people entering: drawn, but visibly provisional. */
.fn-barfill.is-thin { background: var(--accent-soft); box-shadow: inset 0 0 0 1.5px var(--accent); }
.fn-barfill.is-gap.is-thin { background: var(--warning-soft); box-shadow: inset 0 0 0 1.5px var(--warning-deep); }
.fn-rule { position: absolute; top: -4px; bottom: -4px; border-left: 2px dashed var(--ink-faded); }
.fn-inline-cta { margin-top: 10px; }

/* ── Constraint / coach card ─────────────────────────────────────────────── */
/* Tinted card: body text is --ink and --ink-soft only (both asserted on
   --accent-soft); the eyebrow is --accent-deep on its own tint. */
.fn-coach { background: var(--accent-soft); border-left: 3px solid var(--accent); color: var(--ink); }
.fn-coach .fn-soft, .fn-coach .fn-under, .fn-coach .fn-small { color: var(--ink-soft); }
.fn-coach .badge.warning { border-color: transparent; }
.fn-eyebrow { font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; font-weight: 700; color: var(--accent-deep); }
.fn-coach-head { font-size: 16px; font-weight: 700; color: var(--ink); margin: 10px 0 6px; }
.fn-coach-body { font-size: 13.5px; color: var(--ink-soft); line-height: 1.55; margin: 0 0 10px; }
.fn-coach-sub { font-size: 12px; font-weight: 700; color: var(--ink); margin: 12px 0 4px; }
.fn-signals { margin: 0 0 12px; padding-left: 18px; font-size: 13px; color: var(--ink-soft); line-height: 1.5; }
.fn-signals li { margin-bottom: 6px; }
.fn-signals b { color: var(--ink); }
.fn-signals .btn { margin-left: 4px; }
.fn-blind { margin: 8px 0 0; padding-left: 18px; font-size: 13px; color: var(--ink-soft); line-height: 1.6; }
.fn-blind b { color: var(--ink); }

/* ── Channel x-ray ───────────────────────────────────────────────────────── */
.fn-matrix { overflow-x: auto; }
.fn-matrixrow {
  display: grid; grid-template-columns: minmax(110px, 1.1fr) repeat(3, minmax(120px, 1fr)) 80px;
  gap: 14px; align-items: center; min-height: 44px; padding: 4px 0;
  border-bottom: 1px solid var(--rule-soft); min-width: 640px;
}
.fn-matrixrow.is-header { font-size: 11.5px; color: var(--ink-soft); border-bottom-color: var(--rule); padding: 8px 0; align-items: end; }
.fn-matrixrow.is-header small { color: var(--ink-faded); font-size: 11px; }
.fn-matrixrow.is-total { border-bottom: 0; border-top: 1px solid var(--rule); font-weight: 650; }
.fn-xlabel { font-size: 13px; color: var(--ink); }
.fn-xlabel small { display: block; font-size: 11px; color: var(--ink-faded); font-weight: 400; }
.fn-xlabel .fn-flag-small { display: inline; margin-left: 4px; color: var(--warning-deep); }
.fn-xcell { font-size: 12px; color: var(--ink); }
.fn-xcell > span { display: flex; justify-content: space-between; gap: 6px; margin-bottom: 4px; font-variant-numeric: tabular-nums; }
.fn-xcell > span small { color: var(--ink-faded); font-size: 11px; }
.fn-xcell .fn-sourcebar { height: 10px; }
.fn-xcell.is-empty { font-size: 11.5px; color: var(--ink-faded); font-style: italic; }
.fn-salescol { text-align: right; }
.fn-channel-foot { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; margin-top: 12px; font-size: 11.5px; color: var(--ink-faded); }
.fn-minifunnel { display: flex; flex-direction: column; gap: 5px; padding: 6px 4px; }
.fn-band {
  display: flex; align-items: center; justify-content: center; gap: 10px; min-height: 46px;
  background: var(--accent-soft); color: var(--accent-deep);
  clip-path: polygon(0 0, 100% 0, 94% 100%, 6% 100%);
  font-size: 13px;
}
.fn-band strong { font-size: 18px; font-weight: 700; }
.fn-band.is-gap { background: var(--warning-soft); color: var(--warning-deep); }
.fn-band.is-unmeasured { background: var(--surface-sunk); color: var(--ink-soft); clip-path: none; border: 1.5px dashed var(--rule-strong); border-radius: var(--radius-sm); }
.fn-gapnote { text-align: center; font-size: 11.5px; color: var(--warning-deep); }
.fn-gapnote.is-calm { color: var(--ink-soft); }
/* Amber note: --warning-deep and --ink on --warning-soft, both asserted. */
.fn-statusnote {
  background: var(--warning-soft); color: var(--warning-deep);
  border-radius: var(--radius-sm); padding: 14px; margin: 12px 0; font-size: 13px; line-height: 1.5;
}
.fn-statusnote strong { display: block; font-size: 15px; font-weight: 700; color: var(--ink); margin-bottom: 4px; }
.fn-statusnote .fn-soft, .fn-statusnote span { color: var(--ink-soft); }
.fn-statusnote.is-calm { background: var(--surface-sunk); color: var(--ink-soft); }

/* ── Conversion gaps: shared-scale columns ───────────────────────────────── */
.fn-gapcols { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 170px), 1fr)); gap: 16px; align-items: start; margin-top: 40px; }
.fn-gapcol { min-width: 0; }
.fn-colplot { position: relative; height: 220px; margin: 0 10px; border-bottom: 1px solid var(--rule-strong); }
.fn-gridline { position: absolute; left: 0; right: 0; border-top: 1px solid var(--rule-soft); }
.fn-col-actual { position: absolute; bottom: 0; left: 20%; width: 40%; min-height: 2px; background: var(--accent); border-radius: 5px 5px 0 0; }
.fn-col-actual.is-thin { background: var(--accent-soft); box-shadow: inset 0 0 0 1.5px var(--accent); }
.fn-col-gap { position: absolute; left: 20%; width: 40%; background: var(--warning); opacity: 0.45; }
.fn-col-target { position: absolute; left: 0; right: 0; border-top: 2px dashed var(--ink-faded); }
.fn-col-target span { position: absolute; right: 0; top: -19px; font-size: 11px; color: var(--ink-faded); background: var(--surface); padding-left: 4px; }
/* Centred over the bar, clear of the right-aligned target label. */
.fn-col-value { position: absolute; left: 10%; width: 60%; margin-bottom: 4px; text-align: center; font-size: 20px; font-weight: 700; color: var(--ink); }
.fn-colplot.is-empty { border: 1.5px dashed var(--rule-strong); border-radius: var(--radius-sm); background: var(--surface-sunk); }
.fn-colplot.is-empty .fn-gridline { display: none; }
.fn-col-empty { position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: center; gap: 6px; padding: 12px; font-size: 12px; color: var(--ink-soft); text-align: center; }
.fn-col-empty b { color: var(--ink); font-size: 13.5px; }
.fn-columnlabel { display: inline-block; margin-top: 10px; text-align: left; }
.fn-gapcol .fn-gapmetric { margin-top: 6px; }
.fn-gapcol.is-binding .fn-gapmetric { color: var(--warning-deep); font-weight: 600; }
.fn-axis { display: flex; justify-content: space-between; gap: 8px; font-size: 11.5px; color: var(--ink-faded); margin: 8px 10px 4px; }

/* ── What-if composer ────────────────────────────────────────────────────── */
.fn-lever { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 8px; }
.fn-lever select.input { width: auto; min-width: 180px; flex: 0 1 auto; }
.fn-pct-input { width: 90px !important; }
.fn-horizon { width: auto !important; }
.fn-inline { display: inline-flex; align-items: center; gap: 6px; margin: 0; font-size: 13px; font-weight: 500; }
.fn-assumptions { margin: 6px 0 0; padding-left: 18px; font-size: 12px; color: var(--ink-soft); line-height: 1.5; }

/* ── Stage drill-down ────────────────────────────────────────────────────── */
.fn-breadcrumb { font-size: 12.5px; color: var(--ink-faded); margin: 4px 0 10px; }
.fn-phase-title { font-size: 22px; font-weight: 750; margin: 0 0 4px; color: var(--ink); letter-spacing: -0.015em; }
.fn-phase-title:focus { outline: none; }
.fn-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); gap: 12px; margin: 14px 0 16px; }
.fn-stat { padding: 14px; background: var(--surface); border: 1px solid var(--rule-soft); border-radius: var(--radius); box-shadow: var(--shadow-xs); }
.fn-stat strong { display: block; font-size: 22px; font-weight: 700; color: var(--ink); margin: 4px 0; letter-spacing: -0.01em; }
.fn-stat .fn-small { color: var(--ink-faded); }
.fn-evidence { padding: 10px 0; border-bottom: 1px solid var(--rule-soft); }
.fn-evidence:last-child { border-bottom: 0; }
.fn-evidence strong { font-weight: 650; color: var(--ink); font-size: 13.5px; }
.fn-plan { margin: 0 0 12px; padding-left: 20px; font-size: 13px; color: var(--ink-soft); line-height: 1.55; }
.fn-plan li { margin-bottom: 6px; }
.fn-plan b { color: var(--ink); }

/* ── Goals & targets ─────────────────────────────────────────────────────── */
.fn-field { margin-bottom: 12px; min-width: 0; }
.fn-fieldrow { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 12px; }
.fn-fieldrow.is-three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 560px) { .fn-fieldrow, .fn-fieldrow.is-three { grid-template-columns: 1fr; } }
.fn-target { padding: 12px 0; border-bottom: 1px solid var(--rule-soft); }
.fn-target:last-of-type { border-bottom: 0; }
.fn-target-value { font-size: 14px; color: var(--ink); margin: 8px 0 2px; }
.fn-target .fn-row { gap: 8px; }
.fn-target .fn-row.fn-start { margin-top: 8px; }
.fn-rationale { flex: 1 1 180px; width: auto !important; min-width: 0; }

/* ── Small screens ───────────────────────────────────────────────────────── */
@media (max-width: 680px) {
  .fn-source-row { grid-template-columns: 88px minmax(0, 1fr) 70px; gap: 8px; }
  .fn-gapcols { gap: 8px; margin-top: 32px; }
  .fn-colplot { margin: 0 4px; height: 190px; }
  .fn-col-value { font-size: 16px; }
  .fn-ribbon, .fn-noribbon { height: 120px; }
}

/* ── Goal-led front door (views/goal-plan.js) ────────────────────────────── */
.gp-flag { border-left-width: 5px; }
.gp-card .gp-progress { margin: 14px 0 6px; }
.gp-card .gp-progress-label { margin: 0 0 6px; font-size: 14px; color: var(--ink); }
.gp-steps { margin: 6px 0 4px; padding-left: 20px; display: grid; gap: 8px; font-size: 14px; line-height: 1.5; color: var(--ink); }
.gp-steps .badge { margin-left: 6px; vertical-align: baseline; }
.gp-card.gp-tone-warn { border-left: 3px solid var(--warning); }
.gp-card.gp-tone-good { border-left: 3px solid var(--accent); }
.gp-add { margin-top: 12px; padding: 14px; background: var(--surface-sunk); border-radius: var(--radius-sm); }
.gp-batches { list-style: none; margin: 6px 0 0; padding: 0; display: grid; gap: 6px; font-size: 13px; color: var(--ink-soft); }
.gp-batches li { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.gp-more { margin-top: 16px; }
.gp-more > summary { cursor: pointer; font-size: 13px; font-weight: 700; color: var(--accent-deep); padding: 8px 0; }
.gp-more[open] > summary { margin-bottom: 8px; }

/* ── Scoreboard (views/goal-plan.js) ─────────────────────────────────────── */
.gp-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; }
.gp-tools { display: flex; gap: 8px; flex-wrap: wrap; }
.gp-headline { font-size: 22px; line-height: 1.25; max-width: 40ch; }
.gp-edit { margin: 14px 0; padding: 14px; background: var(--surface-sunk); border-radius: var(--radius-sm); }
.gp-grid { display: grid; grid-template-columns: minmax(240px, 320px) 1fr; gap: 28px; align-items: start; margin: 18px 0 8px; }
@media (max-width: 760px) { .gp-grid { grid-template-columns: 1fr; } }

/* The ring. */
.gp-ringwrap { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.gp-ringbox { position: relative; width: min(100%, 280px); aspect-ratio: 1; }
.gp-ring { width: 100%; height: 100%; display: block; }
.gp-ring-track { fill: none; stroke: var(--surface-sunk); stroke-width: 16; }
.gp-ring-fill { fill: none; stroke: var(--accent); stroke-width: 16; stroke-linecap: round; transition: stroke-dashoffset 1.1s cubic-bezier(.2,.8,.2,1); }
.gp-ring-fill.is-ahead, .gp-ring-fill.is-done { stroke: var(--success); }
.gp-ring-fill.is-behind { stroke: var(--warning); }
.gp-ring-tick { stroke: var(--ink); stroke-width: 3; stroke-linecap: round; }
.gp-ringcenter { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 2px; }
.gp-ringcenter strong { font-size: clamp(26px, 5vw, 38px); font-weight: 800; color: var(--ink); font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.gp-ringsmall { font-size: 12.5px; color: var(--ink-soft); }
.gp-ringpct { font-size: 15px; font-weight: 700; color: var(--accent-deep); }
.gp-ringstatus { margin: 0; font-size: 14px; font-weight: 700; color: var(--ink); text-align: center; }
.gp-ringstatus.is-ahead, .gp-ringstatus.is-done { color: var(--success-deep); }
.gp-ringstatus.is-behind { color: var(--warning-deep); }
.gp-ringnote { margin: 0; font-size: 13px; color: var(--ink-soft); text-align: center; max-width: 30ch; }
.gp-ringwrap.is-empty .gp-ring-fill { stroke: transparent; }
.gp-stones { display: flex; gap: 6px; }
.gp-stone { font-size: 11.5px; font-weight: 700; padding: 3px 9px; border-radius: 999px; background: var(--surface-sunk); color: var(--ink-faded); }
.gp-stone.is-hit { background: var(--success-soft); color: var(--success-deep); }
.gp-bump { animation: gp-bump .5s ease-out; }
@keyframes gp-bump { 0% { transform: scale(1); } 40% { transform: scale(1.12); } 100% { transform: scale(1); } }
.gp-celebrate .gp-ring { animation: gp-glow 1.6s ease-out; }
.gp-celebrate .gp-stone.is-hit { animation: gp-pop .6s ease-out; }
@keyframes gp-glow { 0% { filter: drop-shadow(0 0 0 transparent); } 30% { filter: drop-shadow(0 0 16px var(--success)); } 100% { filter: drop-shadow(0 0 0 transparent); } }
@keyframes gp-pop { 0% { transform: scale(.6); } 60% { transform: scale(1.25); } 100% { transform: scale(1); } }

/* The math. */
.gp-math { min-width: 0; }
.gp-mathlines { margin: 6px 0 4px; padding-left: 18px; display: grid; gap: 6px; font-size: 14px; line-height: 1.5; color: var(--ink); }
.gp-steps { margin: 6px 0 4px; padding-left: 20px; display: grid; gap: 8px; font-size: 14px; line-height: 1.5; color: var(--ink); }
.gp-steps .badge { margin-left: 6px; vertical-align: baseline; }
.gp-impact { margin: 12px 0 4px; padding: 12px 14px; background: var(--success-soft); color: var(--success-deep); border-radius: var(--radius-sm); font-size: 13.5px; line-height: 1.5; display: grid; gap: 2px; }
.gp-impact strong { color: var(--ink); font-size: 14px; }
.gp-confidence { margin: 10px 0 0; font-size: 12.5px; color: var(--ink-soft); line-height: 1.5; }

/* Stage cards: the funnel overview, one click from each stage's detail. */
.gp-stages { list-style: none; margin: 8px 0 0; padding: 0; display: flex; align-items: stretch; gap: 0; flex-wrap: wrap; row-gap: 14px; }
.gp-offroute { margin: 10px 0 0; max-width: 72ch; }
.gp-stagewrap { display: flex; align-items: center; flex: 1 1 200px; min-width: 190px; }
.gp-link { display: flex; flex-direction: column; align-items: center; justify-content: center; min-width: 74px; padding: 0 6px; font-size: 12px; color: var(--ink-soft); text-align: center; line-height: 1.3; }
.gp-link::before { content: "→"; font-size: 18px; color: var(--ink-ghost); }
.gp-rate { font-weight: 700; color: var(--ink); }
.gp-rate i { font-style: normal; color: var(--accent-deep); }
.gp-est { font-size: 10.5px; color: var(--ink-faded); }
.gp-stage { flex: 1; text-align: left; display: grid; gap: 6px; padding: 14px; border-radius: var(--radius); border: 1.5px solid var(--rule); background: var(--surface); cursor: pointer; font: inherit; color: inherit; transition: transform .15s ease, box-shadow .15s ease; }
.gp-stage:hover, .gp-stage:focus-visible { transform: translateY(-2px); box-shadow: var(--shadow-xs); outline: none; border-color: var(--accent); }
.gp-stagename { font-size: 12.5px; font-weight: 700; color: var(--ink-soft); }
.gp-stagenums { display: flex; align-items: baseline; gap: 6px; }
.gp-stagenums strong { font-size: 28px; font-weight: 800; color: var(--ink); font-variant-numeric: tabular-nums; }
.gp-stagenums i { font-style: normal; font-size: 14px; color: var(--ink-faded); }
.gp-minibar { display: block; height: 7px; border-radius: 999px; background: var(--surface-sunk); overflow: hidden; }
.gp-minibar > span { display: block; height: 100%; background: var(--accent); border-radius: 999px; transition: width 1s ease; }
.gp-minibar.is-empty { background: repeating-linear-gradient(90deg, var(--surface-sunk) 0 6px, transparent 6px 10px); }
.gp-stagepace { font-size: 12px; color: var(--ink-faded); min-height: 1em; }
.gp-flagtag { justify-self: start; font-size: 11px; font-weight: 700; padding: 2px 9px; border-radius: 999px; background: var(--warning-soft); color: var(--warning-deep); }
.gp-flagtag.is-good { background: var(--success-soft); color: var(--success-deep); }
.gp-stage.is-weakest { border-color: var(--warning); background: var(--warning-soft); animation: gp-pulse 2.4s ease-in-out infinite; }
.gp-stage.is-good { border-color: var(--success); }
.gp-flagtag.is-low { background: var(--warning-soft); color: var(--warning-deep); }
.gp-flagtag.is-fix { background: var(--danger-soft); color: var(--danger-deep); }
.gp-flagtag.is-muted { background: var(--surface-sunk); color: var(--ink-faded); }
.gp-whynot { font-size: 11px; color: var(--ink-faded); line-height: 1.35; }
.pr-card { display: grid; gap: 10px; }
.pr-levers { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px; margin-top: 6px; }
.pr-lever { padding: 14px 16px; border-radius: 14px; border: 1.5px solid var(--rule); background: var(--surface); display: grid; gap: 6px; align-content: start; }
.pr-lever.is-off { opacity: .75; border-style: dashed; }
.pr-field { display: grid; gap: 4px; }
.pr-field label { font-size: 12.5px; font-weight: 700; color: var(--ink-soft); }
.pr-result { margin-top: 12px; padding: 16px 18px; border-radius: 14px; border: 1.5px solid var(--rule); border-left: 4px solid var(--accent-deep); background: var(--surface); display: grid; gap: 8px; }
.pr-head { margin: 0; font-size: 17px; font-weight: 800; color: var(--ink); line-height: 1.35; }
.pr-skipped { margin: 0; padding-left: 18px; font-size: 13px; color: var(--ink-soft); line-height: 1.5; }
.gp-attention { flex: 1 1 100%; }
.gp-lanes { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; font-size: 12.5px; color: var(--ink-soft); line-height: 1.45; }
.gp-lanes b { color: var(--ink); }
.gp-laneextra { color: var(--ink-faded); }
.gp-lanenote { display: block; margin-top: 2px; font-size: 11.5px; color: var(--warning-deep); }
.gp-fix { margin-top: 18px; padding: 16px 18px; border-radius: 14px; border: 1.5px solid var(--rule); border-left: 4px solid var(--accent-deep); background: var(--surface); display: grid; gap: 6px; }
.gp-fix.is-clear { border-left-color: var(--success); }
.gp-fixhead { margin: 0; font-size: 18px; font-weight: 800; color: var(--ink); line-height: 1.3; }
.gp-fixbody { margin: 0; font-size: 14.5px; color: var(--ink-soft); line-height: 1.5; }
.gp-fixprov { margin: 0; font-size: 12px; color: var(--ink-faded); }
.gp-fix .fn-row { margin-top: 6px; }
.gp-two { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px; margin-top: 14px; }
.gp-insight { padding: 14px 16px; border-radius: 14px; border: 1.5px solid var(--rule); background: var(--surface); }
.gp-insight ul { margin: 6px 0 0; padding-left: 18px; font-size: 13.5px; color: var(--ink-soft); line-height: 1.5; display: grid; gap: 6px; }
.gp-stage.is-low { border-color: var(--warning); }
.gp-stage.is-fixfirst { border-color: var(--danger); background: var(--danger-soft); animation: gp-pulse-fix 2.4s ease-in-out infinite; }
.gp-stage.pace-behind .gp-stagepace { color: var(--warning-deep); font-weight: 700; }
.gp-stage.pace-ahead .gp-stagepace { color: var(--success-deep); font-weight: 700; }
@keyframes gp-pulse-fix { 0%, 100% { box-shadow: 0 0 0 0 transparent; } 50% { box-shadow: 0 0 0 6px var(--danger-soft); } }
@keyframes gp-pulse { 0%, 100% { box-shadow: 0 0 0 0 transparent; } 50% { box-shadow: 0 0 0 6px var(--warning-soft); } }

/* Ticker, actions. */
.gp-ticker ul { list-style: none; margin: 6px 0 0; padding: 0; display: grid; gap: 6px; }
.gp-sale { display: flex; align-items: baseline; gap: 10px; font-size: 13.5px; padding: 8px 12px; border-radius: var(--radius-sm); background: var(--surface-sunk); }
.gp-sale strong { color: var(--success-deep); font-variant-numeric: tabular-nums; }
.gp-sale i { margin-left: auto; font-style: normal; color: var(--ink-faded); font-size: 12px; }
.gp-sale.is-new { animation: gp-new 2.4s ease-out; }
@keyframes gp-new { 0% { background: var(--success-soft); transform: translateX(-8px); } 100% { background: var(--surface-sunk); transform: none; } }
.gp-updated { margin: 14px 0 0; font-size: 11.5px; color: var(--ink-faded); text-align: right; }

/* TV mode: the page is the fullscreen element. */
#page-funnel.gp-tv { overflow: auto; background: var(--paper); padding: 28px 40px; }
#page-funnel.gp-tv .gp-headline { font-size: 34px; max-width: 36ch; }
#page-funnel.gp-tv .gp-ringbox { width: min(100%, 420px); }
#page-funnel.gp-tv .gp-ringcenter strong { font-size: clamp(40px, 6vw, 64px); }
#page-funnel.gp-tv .gp-stagenums strong { font-size: 40px; }
#page-funnel.gp-tv .gp-stagename, #page-funnel.gp-tv .gp-mathlines, #page-funnel.gp-tv .gp-steps { font-size: 16px; }
#page-funnel.gp-tv .gp-actions, #page-funnel.gp-tv .fn-head, #page-funnel.gp-tv .fn-tabs, #page-funnel.gp-tv .fn-phases { display: none; }
#page-funnel.gp-dark { --paper: var(--ink-surface); --surface: var(--ink-surface-soft); --surface-sunk: var(--ink-surface-raised);
  --ink: var(--ink-on-dark); --ink-soft: var(--ink-on-dark-muted); --ink-faded: var(--ink-on-dark-muted); --ink-ghost: var(--ink-on-dark-muted);
  --rule: var(--rule-on-dark); --warning-soft: var(--ink-surface-raised); --warning-deep: var(--warning); --success-soft: var(--ink-surface-raised);
  --danger-soft: var(--ink-surface-raised); --danger-deep: var(--danger);
  --success-deep: var(--success); --accent-soft: var(--ink-surface-raised); --accent-deep: var(--accent); color: var(--ink-on-dark); }

@media (prefers-reduced-motion: reduce) {
  .gp-ring-fill, .gp-minibar > span, .gp-stage { transition: none; }
  .gp-stage.is-weakest, .gp-stage.is-fixfirst, .gp-bump, .gp-celebrate .gp-ring, .gp-celebrate .gp-stone.is-hit, .gp-sale.is-new { animation: none; }
}

/* ── The living funnel (views/living-funnel.js) ───────────────────────────
   Built to Jill's mockup (docs/specs/updates/2026-11-30-living-funnel-three-
   accounts/mockup/living-funnel.html), its colours mapped to these tokens. A
   guess is dashed; an unmeasured box has words and no number; the constraint
   is a red box labelled "Your constraint". */
#living-funnel-content { display: flex; flex-direction: column; gap: 22px; }
.lf-head { display: flex; flex-direction: column; gap: 4px; }
.lf-kicker { font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--accent-deep); }
.lf-title { margin: 4px 0; font-size: 30px; font-weight: 800; letter-spacing: -.02em; line-height: 1.15; }
.lf-lede { margin: 0; color: var(--ink-soft); font-size: 15px; max-width: 680px; }
.lf-offer { margin: 0; font-size: 20px; }

/* This week's call: the one dark box. */
.lf-call {
  background: var(--ink-surface); color: var(--ink-on-dark);
  border-radius: var(--radius-lg); padding: 18px 22px;
  display: flex; flex-direction: column; gap: 12px;
}
.lf-call-label { font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-on-dark-muted); }
.lf-verdict { margin: 0; font-size: 18px; font-weight: 700; line-height: 1.5; }
.lf-calls { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px; }
.lf-callbox { background: var(--ink-surface-raised); color: var(--ink-on-dark); border-radius: var(--radius); padding: 10px 12px; font-size: 14px; line-height: 1.45; }
.lf-callbox b { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: .07em; color: var(--ink-on-dark-muted); }

/* Four number cards in one row. */
.lf-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; }
.lf-stat { display: flex; flex-direction: column; gap: 6px; padding: 16px 18px; }
.lf-stat-label { font-size: 13px; font-weight: 600; color: var(--ink-soft); }
.lf-stat-value { font-size: 26px; font-weight: 800; letter-spacing: -.02em; }
.lf-stat-value.is-none { font-size: 16px; font-weight: 700; color: var(--ink-soft); letter-spacing: 0; }
.lf-stat-note { font-size: 13px; font-weight: 600; color: var(--ink-soft); }

/* How people become customers. */
.lf-panel { display: flex; flex-direction: column; gap: 14px; padding: 22px; }
.lf-flowbox { overflow-x: auto; padding: 2px; }
.lf-flow { display: flex; gap: 22px; min-width: max-content; align-items: stretch; }
.lf-col { display: flex; flex-direction: column; gap: 8px; justify-content: center; position: relative; width: 170px; }
.lf-col + .lf-col::before { content: "\2192"; position: absolute; left: -17px; top: calc(50% - 10px); color: var(--ink-soft); }
.lf-node {
  background: var(--surface); border: 2px solid var(--rule); border-radius: 12px;
  padding: 10px 12px; display: flex; flex-direction: column; gap: 3px; color: inherit;
}
.lf-node.is-guess { border-style: dashed; border-color: var(--rule-strong); }
.lf-node.is-constraint { border-color: var(--danger); background: var(--danger-soft); }
.lf-constraint-label { font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--danger-deep); }
.lf-n { font-size: 22px; font-weight: 800; }
.lf-muted { font-size: 13px; color: var(--ink-soft); }
.lf-how { font-size: 12px; color: var(--ink-soft); }
.lf-tag { align-self: flex-start; font-size: 12px; font-weight: 700; border-radius: 6px; padding: 3px 8px; }
.lf-tag.is-guess { background: var(--info-soft); color: var(--info-deep); }
.lf-tag.is-find { background: var(--accent-soft); color: var(--accent-deep); }
.lf-pathrow + .lf-pathrow { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--rule); }

/* The coach's drawing for the owner, and the staff strip: both at the bottom. */
.lf-draft { border: 2px dashed var(--accent-deep); display: flex; flex-direction: column; gap: 10px; }
.lf-draft .lf-panel { box-shadow: none; }
.lf-answer { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; margin-top: 4px; padding-top: 14px; border-top: 1px solid var(--rule); }
.lf-fix { display: flex; flex-direction: column; gap: 4px; flex: 1 1 280px; min-width: 0; }
.lf-fix textarea { width: 100%; font: inherit; }
.lf-error { flex-basis: 100%; margin: 0; color: var(--danger-deep); }
.lf-why { margin: 4px 0 4px; font-size: 13px; }
.lf-why summary { cursor: pointer; font-weight: 650; }
.lf-paths, .lf-history { margin: 6px 0 0; padding-left: 18px; font-size: 13px; color: var(--ink-soft); }
.lf-staff { border: 1px dashed var(--rule-strong); border-radius: var(--radius); padding: 10px 14px; font-size: 13px; color: var(--ink-soft); }
.lf-staff summary { cursor: pointer; font-weight: 650; }
.lf-staff-actions { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; margin-top: 10px; }
.lf-version { margin-top: 10px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
@media (max-width: 700px) { .lf-title { font-size: 24px; } }
a.lf-node { text-decoration: none; }
a.lf-node:hover { border-color: var(--accent-deep); }
a.lf-node:focus-visible { outline: 2px solid var(--accent-deep); outline-offset: 2px; }

/* ── Content (views/content.js) ───────────────────────────────────────────
   The Content view of Jill's mockup, on these tokens. A check against the
   owner's normal is a pill: green well above it, amber well below, a dash
   with its reason when there is nothing to compare. */
#content-content { display: flex; flex-direction: column; gap: 22px; }
.ct-head { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-end; justify-content: space-between; }
.ct-tabs { display: flex; gap: 6px; flex-wrap: wrap; background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); padding: 4px; }
.ct-tab { border: 0; background: transparent; color: var(--ink-soft); }
.ct-tab[aria-selected="true"] { background: var(--ink-surface); color: var(--ink-on-dark); }
.ct-banner {
  background: var(--ink-surface); color: var(--ink-on-dark); border-radius: var(--radius-lg);
  padding: 18px 22px; display: flex; flex-wrap: wrap; gap: 18px; align-items: center;
}
.ct-banner > div { flex: 1 1 380px; display: flex; flex-direction: column; gap: 4px; }
.ct-banner-text { font-size: 16px; line-height: 1.5; }
.ct-back { color: var(--ink-on-dark); font-weight: 600; font-size: 14px; border: 1px solid var(--rule-on-dark); border-radius: var(--radius-sm); padding: 12px 16px; text-decoration: none; }
.ct-back:focus-visible { outline: 2px solid var(--ink-on-dark); outline-offset: 2px; }
.lf-stat-note.is-good { color: var(--success-deep); }
.lf-stat-note.is-warn { color: var(--warning-deep); }
.ct-filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.ct-chip {
  font: inherit; cursor: pointer; border-radius: 999px; min-height: 36px; padding: 0 14px;
  font-size: 13px; font-weight: 600; background: var(--surface); color: var(--ink-soft); border: 1px solid var(--rule-strong);
}
.ct-chip[aria-pressed="true"] { background: var(--ink-surface); color: var(--ink-on-dark); border-color: var(--ink-surface); }
.ct-building { margin: 0; }
.ct-split { display: flex; flex-wrap: wrap; gap: 20px; align-items: flex-start; }
.ct-main { flex: 999 1 500px; min-width: 0; display: flex; flex-direction: column; gap: 10px; }
.ct-rows { display: flex; flex-direction: column; gap: 10px; }
.ct-col-head { display: flex; justify-content: space-between; gap: 14px; padding: 0 12px; font-size: 12px; font-weight: 700; color: var(--ink-soft); letter-spacing: .04em; text-transform: uppercase; flex-wrap: wrap; }
.ct-row {
  font: inherit; color: inherit; text-align: left; cursor: pointer; width: 100%;
  background: var(--surface); border: 2px solid var(--rule); border-radius: 12px; padding: 12px;
  display: flex; gap: 14px; align-items: center; flex-wrap: wrap;
}
.ct-row[aria-pressed="true"] { border-color: var(--accent-deep); }
.ct-row:focus-visible { outline: 2px solid var(--accent-deep); outline-offset: 2px; }
.ct-thumb { flex: 0 0 48px; width: 48px; height: 72px; border-radius: var(--radius-sm); background: var(--rule); }
.ct-row-body { flex: 1 1 220px; min-width: 0; display: flex; flex-direction: column; gap: 5px; }
.ct-row-meta { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.ct-row-title { font-size: 15px; font-weight: 700; }
.ct-type { font-size: 12px; font-weight: 700; border-radius: 6px; padding: 3px 8px; }
.ct-type.t-feed { background: var(--info-soft); color: var(--info-deep); }
.ct-type.t-reel { background: var(--accent-soft); color: var(--accent-deep); }
.ct-type.t-trial { background: var(--ink-surface); color: var(--ink-on-dark); }
.ct-pills { display: flex; gap: 6px; flex-wrap: wrap; }
.ct-pill { font-family: var(--font-mono); font-size: 12px; border-radius: 6px; padding: 4px 7px; min-width: 44px; text-align: center; white-space: nowrap; background: var(--surface-sunk); color: var(--ink-soft); }
.ct-pill.is-up { background: var(--success-soft); color: var(--success-deep); }
.ct-pill.is-down { background: var(--warning-soft); color: var(--warning-deep); }
.ct-side { flex: 1 1 420px; min-width: 0; display: flex; flex-direction: column; gap: 14px; padding: 22px; }
.ct-side-head { display: flex; flex-direction: column; gap: 6px; }
.ct-side-title { font-size: 18px; font-weight: 700; line-height: 1.35; }
.ct-preview { border-radius: 12px; background: var(--surface-sunk); display: flex; flex-direction: column; }
.ct-placeholder { min-height: 160px; display: flex; align-items: center; justify-content: center; padding: 16px; text-align: center; font-weight: 700; }
.ct-open { align-self: center; margin: 0 0 12px; font-weight: 600; font-size: 14px; color: var(--accent-deep); }
.ct-copybox { background: var(--surface-sunk); color: var(--ink); border-radius: var(--radius); padding: 12px 14px; display: flex; flex-direction: column; gap: 6px; font-size: 14px; line-height: 1.5; white-space: pre-line; }
.ct-copy-label { color: var(--ink-soft); }
.ct-metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.ct-metric { background: var(--surface-sunk); color: var(--ink); border-radius: var(--radius); padding: 8px 10px; display: flex; flex-direction: column; gap: 2px; }
.ct-metric b { font-size: 15px; }
.ct-velocity { display: flex; flex-direction: column; gap: 8px; }
.ct-velocity-label { font-size: 13px; font-weight: 700; color: var(--ink-soft); }
.ct-chart { position: relative; height: 130px; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; align-items: end; border-bottom: 1px solid var(--rule-strong); padding: 0 4px; }
.ct-normal { position: absolute; left: 0; right: 0; bottom: 34px; border-top: 2px dashed var(--ink-ghost); }
.ct-normal-label { position: absolute; right: 4px; bottom: 38px; font-size: 11px; color: var(--ink-soft); background: var(--surface); padding: 0 4px; }
.ct-bar-col { display: flex; flex-direction: column; align-items: center; gap: 6px; justify-content: flex-end; height: 100%; font-family: var(--font-mono); font-size: 12px; }
.ct-bar { width: 100%; max-width: 56px; border-radius: 6px 6px 0 0; }
.ct-bar.is-up { background: var(--success); }
.ct-bar.is-down { background: var(--warning); }
.ct-bar.is-even { background: var(--info); }
.ct-bar.is-empty { height: 4px; border-radius: 4px; background: var(--rule); }
.ct-axis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; padding: 0 4px; font-size: 12px; color: var(--ink-soft); text-align: center; }
.ct-you { border-top: 1px solid var(--rule); padding-top: 16px; display: flex; flex-direction: column; gap: 10px; }
.ct-you-label { color: var(--ink); }
.ct-you textarea { font: inherit; width: 100%; min-height: 64px; border: 1px solid var(--rule-strong); border-radius: var(--radius-sm); padding: 8px; background: var(--surface-sunk); color: var(--ink); }
.ct-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.ct-empty p { margin: 0; color: var(--ink-soft); }
@media (max-width: 700px) { .ct-side, .ct-main { flex-basis: 100%; } }
