/* customer-analytics.css: only solution-customer-analytics.html uses these rules. What we do (the customer base by
   spend and churn risk, two segments and what they are worth) and What we build (four screens the teams work with),
   the owner's picks of 2026-10-22 (docs/superpowers/plans/2026-10-22-solutions-blocks.md). Tokens only; the rough
   panel (docs/EMPHASIS-PATTERNS.md); mono only for ids, scores, times and axis values; drawing labels ≥11px. */
.cax-panel {
  position: relative; isolation: isolate; overflow: hidden; border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-card);
  background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 6%, transparent), transparent 38%), var(--surface-solid);
}
.cax-panel::before { content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none; background-image: var(--grain); background-size: 140px 140px; opacity: .05; mix-blend-mode: overlay; }
.cax-head { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 14px; padding: 16px 24px 14px; border-bottom: 1px solid var(--border); }
.cax-head b { font: 500 15px/1.2 var(--font-display); letter-spacing: -.01em; color: var(--text); }
.cax-head span { font-size: 13px; color: var(--text-faint); }
.cax-head em { margin-left: auto; font-style: normal; font-size: 13px; color: var(--text-muted); font-variant-numeric: tabular-nums; }

/* a score on a 0–1 ruler with the 0.50 line: the mark wears the segment colour, the figure stays in text ink */
.x-rl { display: grid; grid-template-columns: minmax(0, 1fr) 34px; gap: 10px; align-items: center; color: color-mix(in srgb, var(--text) 45%, transparent); }
.x-rl.warn { color: var(--warn-text); }
.x-rl.pos { color: var(--pos-text); }
.x-rl .r { position: relative; height: 12px; }
.x-rl .r::before { content: ""; position: absolute; left: 0; right: 0; top: 50%; height: 1px; background: color-mix(in srgb, var(--text) 18%, transparent); }
.x-rl .r i { position: absolute; left: 50%; top: 3px; width: 1px; height: 6px; background: color-mix(in srgb, var(--text) 34%, transparent); }
.x-rl .r em { position: absolute; top: 1px; width: 3px; height: 10px; margin-left: -1px; background: currentColor; }
.x-rl b { font: 500 12.5px var(--font-mono); font-variant-numeric: tabular-nums; text-align: right; color: var(--text); }

/* ================= W1 · the base by spend and churn risk ================= */
.wmap-body { display: grid; grid-template-columns: minmax(0, 1fr) 300px; }
.wmap-fig { padding: 18px 14px 12px 18px; min-width: 0; border-right: 1px solid var(--border); }
.wmap-svg { display: block; width: 100%; height: auto; overflow: visible; }
.wmap-svg .gl { stroke: color-mix(in srgb, var(--text) 7%, transparent); }
.wmap-svg .ax { stroke: color-mix(in srgb, var(--text) 30%, transparent); }
.wmap-svg .tk { font-family: var(--font-mono); font-size: 11px; fill: var(--text-faint); }
.wmap-svg .at { font-family: var(--font-body); font-size: 12px; fill: var(--text-faint); }
.wmap-svg .at.sub { display: none; }
.wmap-svg .th { stroke: color-mix(in srgb, var(--text) 34%, transparent); stroke-dasharray: 3 3; }
.wmap-svg .thl { font-family: var(--font-body); font-size: 11.5px; fill: var(--text-muted); }
.wmap-svg .mk { fill: color-mix(in srgb, var(--text) 26%, transparent); transition: transform .9s var(--ease-in-out) var(--d, 0s), fill .45s var(--ease), opacity .3s var(--ease); }
.wmap-svg .mk.ar { fill: var(--warn-text); }
.wmap-svg .mk.up { fill: var(--pos-text); }
.wmap-svg .reg { stroke-width: 1; transition: opacity .5s var(--ease); }
.wmap-svg .reg.ar { fill: color-mix(in srgb, var(--warn-text) 8%, transparent); stroke: color-mix(in srgb, var(--warn-text) 60%, transparent); }
.wmap-svg .reg.up { fill: color-mix(in srgb, var(--pos-text) 8%, transparent); stroke: color-mix(in srgb, var(--pos-text) 60%, transparent); }
.wmap-svg .lab { transition: opacity .45s var(--ease) .15s; }
.wmap-svg .lab .ln { font-family: var(--font-body); font-size: 13px; font-weight: 500; }
.wmap-svg .lab.ar .ln { fill: var(--warn-text); }
.wmap-svg .lab.up .ln { fill: var(--pos-text); }
.wmap-svg .lab .lv { font-family: var(--font-body); font-size: 12px; fill: var(--text-muted); }
.wmap-svg .lab.up .ln, .wmap-svg .lab.up .lv, .wmap-svg .thl { paint-order: stroke; stroke: var(--surface-solid); stroke-width: 4px; stroke-linejoin: round; }   /* labels lie on the marks: a ground-coloured edge keeps them clear */
.wmap.pre .wmap-svg .mk, .wmap.pre .wmap-svg .reg, .wmap.pre .wmap-svg .lab { transition: none; }
.wmap.armed:not(.scored) .wmap-svg .mk { fill: color-mix(in srgb, var(--text) 26%, transparent); }
.wmap.armed:not(.scored) .wmap-svg .reg, .wmap.armed:not(.scored) .wmap-svg .lab { opacity: 0; }
.wmap[data-focus="ar"] .wmap-svg .mk:not(.ar), .wmap[data-focus="up"] .wmap-svg .mk:not(.up) { opacity: .2; }
.wmap[data-focus="ar"] .wmap-svg .up, .wmap[data-focus="up"] .wmap-svg .ar:not(.mk) { opacity: .25; }
.wmap-side { display: flex; flex-direction: column; padding: 18px 22px; min-width: 0; }
.wmap-seg { padding: 16px 0; border-bottom: 1px solid var(--border); transition: opacity .3s var(--ease); }
.wmap-seg:first-child { padding-top: 0; }
.wmap-st { display: flex; align-items: center; gap: 9px; font: 500 14.5px/1.25 var(--font-display); letter-spacing: -.01em; color: var(--text); }
.wmap-st i { flex: none; width: 8px; height: 8px; background: var(--warn-text); }
.wmap-seg.up .wmap-st i { background: var(--pos-text); }
.wmap-big { display: flex; align-items: baseline; gap: 8px; margin-top: 10px; }
.wmap-big b { font: 500 36px/1 var(--font-display); letter-spacing: -.03em; color: var(--text); font-variant-numeric: tabular-nums; }
.wmap-big span { font-size: 14px; color: var(--text-muted); }
.wmap-seg dl { display: grid; gap: 7px; margin: 14px 0 0; }
.wmap-seg dl div { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; font-size: 13.5px; line-height: 1.35; }
.wmap-seg dt { color: var(--text-muted); }
.wmap-seg dd { margin: 0; color: var(--text); text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.wmap-note { margin: auto 0 0; padding-top: 14px; font-size: 13px; line-height: 1.5; color: var(--text-faint); }
.wmap[data-focus="ar"] .wmap-seg.up, .wmap[data-focus="up"] .wmap-seg.ar { opacity: .4; }
.wmap-seg { cursor: default; }


/* ================= B · the artifacts the teams work with (shared by B1 and B2) ================= */
.x-h { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding-bottom: 10px; border-bottom: 1px solid var(--border); }
.x-h b { font: 500 14.5px/1.2 var(--font-display); letter-spacing: -.01em; color: var(--text); }
.x-h span { font-size: 12.5px; color: var(--text-faint); white-space: nowrap; font-variant-numeric: tabular-nums; }
.x-dh, .x-ch, .x-sh, .x-th { font-size: 12px; color: var(--text-faint); padding: 9px 0 7px; }
.x-dh, .x-dr { display: grid; grid-template-columns: minmax(0, 1fr) 40% 38px 38px; gap: 12px; align-items: center; }
.x-dh span:nth-child(2) { text-align: center; }
.x-dh span:last-child { text-align: right; }
.x-dr { height: 36px; border-top: 1px solid var(--border); font-size: 13.5px; color: var(--text); }
.x-dr .lab { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.x-dr .trk { position: relative; align-self: stretch; }
.x-dr .trk::before { content: ""; position: absolute; left: 50%; top: 0; bottom: 0; width: 1px; background: color-mix(in srgb, var(--text) 24%, transparent); }
.x-dr .trk i { position: absolute; top: 13px; height: 10px; width: var(--w); border-radius: 2px; transition: transform .5s var(--ease) var(--k, 0s); }
.x-dr .trk i.pos { left: 50%; background: var(--pos-text); transform-origin: left center; }
.x-dr .trk i.neg { right: 50%; background: var(--warn-text); transform-origin: right center; }
.x-dr .val { font: 500 12.5px var(--font-mono); text-align: right; font-variant-numeric: tabular-nums; }
.x-dr .sh { font-size: 12.5px; color: var(--text-muted); text-align: right; font-variant-numeric: tabular-nums; }
.x-ch, .x-cu { display: grid; grid-template-columns: 64px minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1.05fr); gap: 14px; align-items: center; }
.x-cu { height: 38px; border-top: 1px solid var(--border); font-size: 13px; }
.x-cu code { font: 400 12px var(--font-mono); color: var(--text-muted); }
.x-cu .to { color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.x-sh, .x-sg { display: grid; grid-template-columns: minmax(0, 1.25fr) 48px minmax(0, 1fr) 40px; gap: 12px; align-items: center; }
/* the number columns are narrow: their headings end on the numbers and run left into the empty space, not into the next heading */
.x-sh span:nth-child(2), .x-sh span:last-child { text-align: right; justify-self: end; white-space: nowrap; }
.x-sg { height: 46px; border-top: 1px solid var(--border); font-size: 13px; color: var(--text); }
.x-sg .lab { position: relative; display: flex; align-items: center; gap: 8px; height: 28px; min-width: 0; }
.x-sg .lab::before { content: ""; position: absolute; left: -4px; top: 0; bottom: 0; width: calc(var(--w) + 4px); border-radius: 3px; background: color-mix(in srgb, var(--text) 7%, transparent); }
.x-sg .lab span { position: relative; padding-left: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.x-sg .n { text-align: right; color: var(--text); font-variant-numeric: tabular-nums; }
.x-sg .to { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }
.x-sg .to em { font-style: normal; font-size: 12px; color: var(--text-faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.x-sg .tm { font: 400 12px var(--font-mono); text-align: right; color: var(--text-faint); }
.x-trw { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 18px; align-items: end; padding: 12px 0 6px; }
.x-tr { display: block; width: 100%; height: auto; overflow: visible; color: var(--warn-text); }
.x-tr .gl { stroke: color-mix(in srgb, var(--text) 7%, transparent); }
.x-tr .s0 { stop-color: currentColor; stop-opacity: .24; }
.x-tr .s1 { stop-color: currentColor; stop-opacity: .02; }
.x-tr .ln { fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linejoin: round; stroke-linecap: round; stroke-dasharray: 1; stroke-dashoffset: 0; transition: stroke-dashoffset 1s var(--ease) .1s; }
.x-tr .ar { transition: opacity .6s var(--ease) .5s; }
.x-tr .end { fill: currentColor; stroke: var(--surface-solid); stroke-width: 2; transition: opacity .3s var(--ease) 1s; }
.x-trv { display: flex; flex-direction: column; gap: 2px; text-align: right; padding-bottom: 4px; }
.x-trv b { font: 500 28px/1 var(--font-display); letter-spacing: -.03em; color: var(--text); font-variant-numeric: tabular-nums; }
.x-trv span { font-size: 12.5px; color: var(--text-muted); white-space: nowrap; }
.x-th, .x-tp { display: grid; grid-template-columns: minmax(0, 1fr) 52px minmax(0, 1fr) 68px; gap: 12px; align-items: center; }
.x-th span:nth-child(2), .x-th span:last-child { text-align: right; }
.x-tp { height: 36px; border-top: 1px solid var(--border); font-size: 13px; color: var(--text); }
.x-tp .lab, .x-tp .se { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.x-tp .ch { font: 500 12.5px var(--font-mono); text-align: right; font-variant-numeric: tabular-nums; color: var(--text-muted); }
.x-tp .ch.neg { color: var(--warn-text); }
.x-tp .ch.pos { color: var(--pos-text); }
.x-tp .se { color: var(--text-muted); }
.x-tp code { font: 400 11.5px var(--font-mono); text-align: right; color: var(--text-faint); white-space: nowrap; }
.x-cu, .x-sg, .x-tp { transition: opacity .4s var(--ease) var(--k, 0s), transform .4s var(--ease) var(--k, 0s); }
/* armed by the script (xa), played on entering view (xp): without a script the screens simply show */
.xa:not(.xp) .x-dr .trk i { transform: scaleX(0); }
.xa:not(.xp) .x-cu, .xa:not(.xp) .x-sg, .xa:not(.xp) .x-tp { opacity: 0; transform: translateY(4px); }
.xa:not(.xp) .x-tr .ln { stroke-dashoffset: 1; transition: none; }
.xa:not(.xp) .x-tr .ar, .xa:not(.xp) .x-tr .end { opacity: 0; transition: none; }

/* ================= B1 · four screens on an uneven grid ================= */
.bscr { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 20px; }
.bscr-nps { grid-column: span 7; }
.bscr-churn { grid-column: span 5; }
.bscr-seg { grid-column: span 5; }
.bscr-soc { grid-column: span 7; }
.bscr-cell { display: flex; flex-direction: column; padding: 22px 24px 24px; min-width: 0; transition: border-color .4s var(--ease); }
.bscr-cell:hover { border-color: color-mix(in srgb, var(--accent) 36%, var(--border)); }
.bscr-art { flex: 1; min-width: 0; }
.bscr-txt { margin-top: 26px; }
.bscr-txt h3 { font: 500 18.5px/1.25 var(--font-display); letter-spacing: -.015em; color: var(--text); text-wrap: balance; }
.bscr-txt p { margin-top: 6px; font-size: 15px; line-height: 1.6; color: var(--text-muted); max-width: 60ch; text-wrap: pretty; }

/* the segments are buttons: hover or a tap shows one segment on the map and dims the rest of the base */
button.wmap-st { appearance: none; background: none; border: 0; padding: 0; margin: 0; width: 100%; min-height: 32px; text-align: left; cursor: pointer; }
button.wmap-st::after { content: ""; margin-left: auto; width: 7px; height: 7px; border-right: 1.5px solid var(--text-faint); border-bottom: 1.5px solid var(--text-faint); transform: rotate(-45deg); transition: transform .25s var(--ease), border-color .25s var(--ease); }
button.wmap-st:hover::after, button.wmap-st[aria-pressed="true"]::after { border-color: var(--text); transform: rotate(-45deg) translate(2px, 2px); }
button.wmap-st[aria-pressed="true"] { color: var(--text); }
.wmap-svg.phone { display: none; }

@media (max-width: 1240px) {
  .bscr-nps, .bscr-churn, .bscr-seg, .bscr-soc { grid-column: span 6; }
}
@media (max-width: 1080px) {
  .wmap-body { grid-template-columns: minmax(0, 1fr); }
  .wmap-fig { border-right: 0; border-bottom: 1px solid var(--border); }
  .wmap-side { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); column-gap: 28px; }
  .wmap-seg, .wmap-seg:first-child { padding: 0 0 14px; }
  .wmap-note { grid-column: 1 / -1; }
}
/* below 960px two cards a row leave the tables under 420px: their names would end in an ellipsis, so the cards stack */
@media (max-width: 959px) {
  .bscr-nps, .bscr-churn, .bscr-seg, .bscr-soc { grid-column: 1 / -1; }
}
@media (max-width: 640px) {
  .cax-head { padding: 14px 16px 12px; }
  .cax-head em { margin-left: 0; }
  .wmap-svg:not(.phone) { display: none; }
  .wmap-svg.phone { display: block; }
  /* one segment at a time: the two names become a switch under the map, the picked one's figures below it
     (At-risk until Upsell is picked); both stay in the HTML */
  .wmap-side { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); column-gap: 0; padding: 0 16px 16px; }
  .wmap-seg, .wmap-seg:first-child { display: contents; }
  button.wmap-st { grid-row: 1; min-height: 48px; padding: 0 10px; justify-content: center; font-size: 14px; border-bottom: 1px solid var(--border); color: var(--text-muted); }
  .wmap-seg.up button.wmap-st { grid-column: 2; }
  button.wmap-st::after { display: none; }
  .wmap:not([data-focus="up"]) .wmap-seg.ar button.wmap-st, .wmap[data-focus="up"] .wmap-seg.up button.wmap-st { color: var(--text); border-bottom-color: var(--text); }
  .wmap-big, .wmap-seg dl { grid-column: 1 / -1; }
  .wmap-big { grid-row: 2; margin-top: 16px; }
  .wmap-seg dl { grid-row: 3; margin-top: 12px; }
  .wmap:not([data-focus="up"]) .wmap-seg.up :is(.wmap-big, dl), .wmap[data-focus="up"] .wmap-seg.ar :is(.wmap-big, dl) { visibility: hidden; }
  .wmap-note { grid-row: 4; }
  /* the four screens: a row to swipe, the next one peeking */
  .bscr { grid-template-columns: none; grid-auto-flow: column; grid-auto-columns: 86%; gap: 12px; overflow-x: auto; overscroll-behavior-x: contain; scroll-snap-type: x mandatory; scrollbar-width: none; margin: 0 calc(-1 * var(--gutter)); padding: 0 var(--gutter) 4px; scroll-padding: 0 var(--gutter); }
  .bscr::-webkit-scrollbar { display: none; }
  .bscr-nps, .bscr-churn, .bscr-seg, .bscr-soc { grid-column: auto; scroll-snap-align: start; }
  .wmap-fig { padding: 14px 8px 8px; }
  .x-dh, .x-dr { grid-template-columns: minmax(0, 1fr) 36% 38px; }
  .x-dh span:last-child, .x-dr .sh { display: none; }
  .x-sh, .x-sg { grid-template-columns: minmax(0, 1fr) 44px minmax(0, .8fr); }
  .x-sh span:last-child, .x-sg .tm { display: none; }
  .x-th, .x-tp { grid-template-columns: minmax(0, 1fr) 48px minmax(0, 1fr); }
  .x-th span:last-child, .x-tp code { display: none; }
  .bscr { gap: 16px; }
  .bscr-cell { padding: 18px 16px 20px; }
  .x-cu .x-rl .r, .x-ch span:nth-child(3), .x-cu .x-rl:nth-of-type(2) { display: none; }
  .x-ch, .x-cu { grid-template-columns: 64px 44px minmax(0, 1fr); }
  .x-cu .x-rl { grid-template-columns: 1fr; }
  /* the cards are as wide as a phone allows: a long name takes a second line instead of an ellipsis */
  .x-dr, .x-tp { height: auto; min-height: 36px; padding-block: 6px; }
  .x-cu { height: auto; min-height: 38px; padding-block: 6px; }
  .x-sg { height: auto; min-height: 46px; padding-block: 6px; }
  .x-sg .lab { height: auto; min-height: 28px; padding-block: 5px; }
  .x-dr .trk i { top: calc(50% - 5px); }
  .x-dr .lab, .x-sg .lab span, .x-sg .to em, .x-cu .to, .x-tp .lab, .x-tp .se { white-space: normal; overflow: visible; text-overflow: clip; line-height: 1.3; text-wrap: balance; }
}
@media (prefers-reduced-motion: reduce) {
  .wmap-svg .mk, .wmap-svg .reg, .wmap-svg .lab, .wmap-seg, .x-dr .trk i, .x-cu, .x-sg, .x-tp, .x-tr * { transition: none !important; }
}
