/* ============================================================
   Fluxwell Business Review — "Cluster explorer" variant
   (report-final)

   A single, non-scrolling interactive stage. One persistent field
   of 200 bubbles re-flows between cluster layouts (segment / region
   / health) driven by user interaction — no scroll sections.

   Colour encodes HEALTH, drawn from the brand teal→magenta family:
     teal  (#12C2E9)  = healthy
     amber (#F5A623)  = watch
     magenta (#C471ED)= at risk

   Additive prototype: self-contained, touches nothing else.
   ============================================================ */

:root {
  /* Brand gradient (logo infinity mark) — chrome only */
  --g1: #12C2E9;
  --g2: #6A4CE0;
  --g3: #C471ED;

  /* Health encoding */
  --h-good: #12C2E9;   /* teal      — healthy */
  --h-mid:  #F5A623;   /* amber     — watch   */
  --h-bad:  #C471ED;   /* magenta   — at risk */

  /* Near-black editorial canvas */
  --bg:      #08080E;
  --bg-2:    #0E0E17;
  --panel:   #12121C;
  --hair:    rgba(255,255,255,.08);
  --hair-2:  rgba(255,255,255,.14);

  --ink:     #F5F5FA;
  --ink-2:   #A6A6BC;
  --ink-3:   #6E6E86;

  --stage-pad: clamp(18px, 3.2vw, 52px);
  /* Account-detail layout: cap to a centred band on large screens so the two
     columns don't drift to the viewport edges (see .detail-main/.detail-panel). */
  --detail-max: 1440px;
  --detail-inset: max(var(--stage-pad), calc((100% - var(--detail-max)) / 2));
  --kpi-w: clamp(300px, 30vw, 420px);   /* right rail width, reserved from the field */
  --mast-h: 56px;   /* fixed masthead height (14px pad + 28px logo + 14px pad) */
  --ease: cubic-bezier(.22,.9,.24,1);

  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI",
          "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  /* min-height (not fixed height) so the page can grow past the viewport and
     scroll when embedded in a short iframe — the KPI rail uses fixed pixel
     offsets and would otherwise be clipped on short heights. */
  min-height: 100%;
}

/* ============================================================
   Masthead
   ============================================================ */
.masthead {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 40;
  display: flex; align-items: center; gap: 14px;
  padding: 14px clamp(18px, 3.2vw, 52px);
  background: linear-gradient(180deg, rgba(8,8,14,.92), rgba(8,8,14,.55) 70%, transparent);
  backdrop-filter: blur(6px);
  pointer-events: none;
}
.masthead .logo { width: auto; height: 28px; flex: none; object-fit: contain; display: block; }
.masthead .mast-title { font-size: 12.5px; letter-spacing: .01em; color: var(--ink-2); font-weight: 500; }
.masthead .mast-title b { color: var(--ink); font-weight: 650; }
.masthead::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 1px;
  background: rgba(255,255,255,.10);
  opacity: 0; transition: opacity .6s var(--ease);
}
.masthead.lit::after { opacity: 1; }

/* ============================================================
   App shell + stage (one centred 16:9 stage, no scroll)
   ============================================================ */
/* No card — the whole viewport is the report. The stage fills the page
   below the masthead, full-bleed, with no border / radius / shadow. */
.app {
  min-height: 100vh;
  padding-top: var(--mast-h);
}
.stage {
  position: relative;
  width: 100%;
  height: calc(100vh - var(--mast-h));
  /* floor so the KPI rail + cluster labels never get crushed / clipped on a
     short iframe; taller viewports use the calc height and don't scroll. */
  min-height: 620px;
  padding: var(--stage-pad);
  overflow: hidden;
}
.stage::before {
  content: ""; position: absolute; inset: 0;
  background: radial-gradient(120% 80% at 80% 0%, rgba(106,76,224,.10), transparent 58%);
  pointer-events: none;
}

/* lede */
.lede { position: relative; z-index: 6; max-width: 54%; }
.eyebrow {
  display: flex; width: fit-content; align-items: center; gap: 8px;
  font-size: 11px; font-weight: 600; letter-spacing: .14em;
  text-transform: uppercase; color: var(--ink-3);
  margin: 0 0 12px;
}
.eyebrow .dot { width: 8px; height: 8px; border-radius: 50%; background: linear-gradient(120deg, var(--g1), var(--g3)); }
.title {
  display: inline-block;
  font-size: clamp(22px, 2.9vw, 42px);
  line-height: 1.04; font-weight: 800; letter-spacing: -0.028em;
  margin: 0;
}
/* the "cool" colored underline, back from the scrolling variant */
.title::after {
  content: ""; display: block; height: 4px; width: min(300px, 100%);
  margin-top: 12px; border-radius: 2px;
  background: linear-gradient(90deg, var(--g1), var(--g2) 55%, var(--g3));
}
/* data-true sub-headline */
.sub {
  max-width: 30em;
  margin: 15px 0 0;
  font-size: clamp(13px, 1.05vw, 15px);
  line-height: 1.5; font-weight: 400; color: var(--ink-2);
}
.sub b { color: var(--ink); font-weight: 650; }

/* ============================================================
   Cluster-by control
   ============================================================ */
.controls {
  position: absolute;
  right: var(--stage-pad); top: calc(var(--stage-pad) + 108px);
  display: flex; gap: 8px; align-items: center; flex-wrap: wrap;
  z-index: 7;
}
.controls .flabel {
  font-size: 10px; letter-spacing: .12em; text-transform: uppercase;
  color: var(--ink-3); margin-right: 2px;
}
.chip {
  font: inherit; font-size: 11.5px; font-weight: 600; color: var(--ink-2);
  padding: 7px 13px; border-radius: 999px;
  background: rgba(255,255,255,.04);
  border: 1px solid var(--hair-2);
  cursor: pointer;
  transition: all .25s var(--ease);
}
.chip:hover { color: var(--ink); border-color: rgba(255,255,255,.28); }
.chip.on {
  color: #fff; border-color: transparent;
  background: linear-gradient(100deg, var(--g1), var(--g3));
}

/* health legend — flows under the insight sentence in the lede */
.legend {
  display: flex; gap: 18px; flex-wrap: wrap;
  margin-top: 18px;
  font-size: 11px; color: var(--ink-2);
}
.legend span { display: inline-flex; align-items: center; gap: 7px; }
.legend .sw { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }

/* ============================================================
   Per-group KPI rail (top-right, below the cluster-by control)
   ============================================================ */
.kpis {
  position: absolute;
  right: var(--stage-pad);
  top: calc(var(--stage-pad) + 154px);
  width: var(--kpi-w);
  z-index: 6;
  display: flex; flex-direction: column; gap: 24px;
}
.kpi { display: block; }
.kpi .k-top {
  display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
}
.kpi .k-name { font-size: 17px; font-weight: 700; color: var(--ink); letter-spacing: -.01em; }
.kpi .k-fig { display: flex; align-items: baseline; gap: 8px; }
.kpi .k-val { font-size: clamp(34px, 3.4vw, 48px); font-weight: 400; color: var(--ink); letter-spacing: -.02em; line-height: 1; }
.kpi .k-delta { font-size: 14px; font-weight: 700; letter-spacing: -.01em; }
.kpi .k-delta.up { color: #33B3E2; }
.kpi .k-delta.down { color: #E26A9A; }
.kpi .k-bar {
  position: relative; height: 4px; border-radius: 2px;
  background: #231F34;
  margin: 12px 0 8px;
}
.kpi .k-fill {
  position: absolute; left: 0; top: 0; bottom: 0; border-radius: 999px;
  transition: width .85s var(--ease);
}
.kpi .k-fill.up   { background: linear-gradient(90deg, var(--g1), var(--g2)); }
.kpi .k-fill.down { background: linear-gradient(90deg, var(--g2), var(--h-bad)); }
.kpi .k-tick {
  position: absolute; top: -3px; bottom: -3px; width: 2px;
  background: var(--ink); border-radius: 2px; opacity: .85;
  transform: translateX(-1px);
  transition: opacity .4s var(--ease);
}
.kpi .k-note { font-size: 13px; color: var(--ink-3); }
.kpi .k-note b { color: var(--ink-2); font-weight: 600; }

/* ============================================================
   Bubble field
   ============================================================ */
/* The field is confined to the left region so the KPI rail on the right
   never overlaps a cluster. Bubbles keep their layout; the SVG just draws
   in a narrower box. */
.field {
  position: absolute;
  left: 0;
  top: clamp(232px, 27vh, 292px);   /* clear the eyebrow + title + underline + insight + legend */
  bottom: clamp(70px, 9vh, 100px);   /* leave room for the cluster labels below */
  right: calc(var(--kpi-w) + var(--stage-pad) + 22px);
  z-index: 2;
}

.field .node { cursor: pointer; }
/* morph transition — enabled only after the first bloom-in (.ready),
   so bubbles don't fly in from the origin on load */
.field.ready .node { transition: transform .65s var(--ease), opacity .45s var(--ease); }
/* inner group carries the hover neighbour-push */
.field .node .shift { transition: transform .3s var(--ease); }

/* anchor bubble: ARR shown inside the circle */
.field .b-arr {
  font-size: 11px; font-weight: 400; fill: #fff; letter-spacing: -.02em;
  paint-order: stroke; stroke: rgba(8,8,14,.28); stroke-width: 2px;
  pointer-events: none;
  transition: opacity .4s var(--ease), font-size .28s var(--ease);
}
/* anchor bubble hover: name above + synthesized 13-week line below */
.field .bhover { transition: opacity .25s var(--ease); }
.field .bhover .bh-name {
  font-size: 13px; font-weight: 500; fill: #fff; letter-spacing: -.02em;
  paint-order: stroke; stroke: rgba(8,8,14,.35); stroke-width: 2px; stroke-linejoin: round;
}
.field .bhover .bh-spark {
  stroke: #fff; stroke-width: 2; stroke-opacity: .95;
  stroke-linecap: round; stroke-linejoin: round;
}

/* hero account: a persistent gold name tag above the bubble, always visible in
   every cluster layout so the hero (Northwind) is instantly findable. */
.field .b-hero-tag {
  font-size: 12px; font-weight: 700; fill: #FFD54A; letter-spacing: -.01em;
  paint-order: stroke; stroke: rgba(8,8,14,.9); stroke-width: 3px; stroke-linejoin: round;
  pointer-events: none;
}

/* cluster captions — two lines: group name (cl-label) + size/adoption (cl-sub) */
.field .cl-label {
  font-size: 15px; font-weight: 700; fill: var(--ink); letter-spacing: -.01em;
  paint-order: stroke; stroke: rgba(8,8,14,.9); stroke-width: 3.5px; stroke-linejoin: round;
}
.field .cl-sub {
  font-size: 11.5px; font-weight: 500; fill: var(--ink-2);
  paint-order: stroke; stroke: rgba(8,8,14,.9); stroke-width: 3px; stroke-linejoin: round;
}

/* ============================================================
   Tooltip (ambient bubbles)
   ============================================================ */
.tip {
  position: fixed; z-index: 90; pointer-events: none;
  background: rgba(18,18,28,.96);
  border: 1px solid var(--hair-2);
  border-radius: 9px; padding: 8px 11px;
  font-size: 11.5px; color: var(--ink);
  box-shadow: 0 12px 40px rgba(0,0,0,.5);
  opacity: 0; transform: translateY(4px);
  transition: opacity .15s var(--ease), transform .15s var(--ease);
  max-width: 240px;
}
.tip.show { opacity: 1; transform: none; }
.tip .t-name { font-weight: 700; }
.tip .t-row { color: var(--ink-2); margin-top: 2px; }
.tip .t-row b { color: var(--ink); font-weight: 650; }

/* ============================================================
   Insight card (anchor bubbles) — pinned beside the grown circle
   ============================================================ */
.insight-card {
  position: fixed; z-index: 95; width: 340px; max-width: 80vw;
  background: #12101A;
  border: 1px solid rgba(255,255,255,.07);
  border-radius: 20px; padding: 22px;
  box-shadow: 0 16px 36px rgba(0,0,0,.45);
  opacity: 0; transform: translateY(6px);
  transition: opacity .11s var(--ease), transform .11s var(--ease);
  pointer-events: none;
}
.insight-card.show { opacity: 1; transform: none; pointer-events: auto; }
.insight-card .ic-head { display: flex; flex-direction: column; gap: 4px; margin-bottom: 16px; }
.insight-card .ic-name { font-size: 19px; font-weight: 700; color: var(--ink); letter-spacing: -.02em; }
.insight-card .ic-meta { font-size: 12px; font-weight: 500; color: #8E8C9A; }
.insight-card .ic-insight { font-size: 14px; line-height: 1.5; color: #8E8C9A; }
.insight-card .ic-insight b { color: var(--ink); font-weight: 700; }
.insight-card .ic-label {
  display: block; font-size: 11px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase;
  color: #8E8C9A; margin: 18px 0 12px; padding-top: 18px;
  border-top: 1px solid rgba(255,255,255,.07);
}
/* follow-up: a clean fully-rounded pill (circle ends), text only */
.insight-card .ic-ask {
  font: inherit; text-align: left; cursor: pointer;
  display: inline-flex; align-items: center; max-width: 100%;
  background: #1C172E;
  border: 1px solid rgba(255,255,255,.10); border-radius: 100px;
  padding: 13px 18px; color: var(--ink);
  transition: border-color .2s var(--ease), background .2s var(--ease);
}
.insight-card .ic-ask:hover {
  border-color: rgba(255,255,255,.24);
  background: #241D3C;
}
.insight-card .ic-ask .ic-q { font-size: 13px; font-weight: 600; line-height: 1.4; }
.insight-card .ic-ask.asked { cursor: default; border-color: rgba(255,255,255,.07); background: rgba(255,255,255,.04); }
.insight-card .ic-ask.asked .ic-q { color: var(--ink-2); }
.insight-card .ic-ask.asked .ic-q::before { content: "✓ "; color: var(--g1); font-weight: 700; }

/* ============================================================
   Account detail mode (click a bubble). Two columns over a dim
   hero-bubble accent: LEFT = identity + usage area chart;
   RIGHT = rank + NRR + the recommended Salesforce Flow.
   All cluster chrome fades away.
   ============================================================ */
.stage.detail .lede,
.stage.detail .controls,
.stage.detail .kpis {
  opacity: 0;
  pointer-events: none;
  transition: opacity .35s var(--ease);
}

/* back-to-clusters — plain text button with an arrow icon (top-left) */
.detail-back {
  position: absolute; left: var(--stage-pad); top: var(--stage-pad);
  z-index: 12;
  display: inline-flex; align-items: center; gap: 7px;
  font: inherit; font-size: 12.5px; font-weight: 600; letter-spacing: .01em;
  color: var(--ink-3);
  background: none; border: none; padding: 4px 2px; cursor: pointer;
  opacity: 0; transform: translateY(-4px); pointer-events: none;
  transition: opacity .3s var(--ease), transform .3s var(--ease), color .2s var(--ease);
}
.detail-back .arw { font-size: 15px; line-height: 1; }
.detail-back:hover { color: var(--ink); }
.stage.detail .detail-back {
  opacity: 1; transform: none; pointer-events: auto; transition-delay: .15s;
}

/* decorative background wash — the "supersized bubble" peeking in behind
   everything. background (the health-coloured radial gradient) is set inline
   in JS; here we just place, dim, and animate it. */
.detail-glow {
  position: absolute; inset: 0; z-index: 3; pointer-events: none;
  opacity: 0; transform: scale(0.88); transform-origin: 42% 100%;
  transition: opacity 1s var(--ease) .12s, transform 1.1s var(--ease) .12s;
}
.detail-glow.show { opacity: 1; transform: scale(1); }

/* shared entrance for both columns */
.detail-main, .detail-panel {
  position: absolute; z-index: 10;
  top: calc(var(--stage-pad) + 52px);   /* clears the back button */
  opacity: 0; pointer-events: none;
  transition: opacity .5s var(--ease), transform .5s var(--ease);
}
/* On wide screens, cap the detail layout to a centred max width so the two
   columns stay grouped instead of drifting to the far edges with a void
   between them. Below the cap the inset is just --stage-pad (unchanged). */
.detail-main {
  left: var(--detail-inset);
  bottom: var(--stage-pad);   /* extend to the stage floor so the usage chart can fill the height */
  width: min(44%, 600px);
  transform: translate(-24px, 0);
}
.detail-panel {
  right: var(--detail-inset);
  width: min(37%, 470px);
  max-width: calc(100% - 2 * var(--stage-pad));
  transform: translate(24px, 0);
}
.detail-main.show, .detail-panel.show {
  opacity: 1; transform: translate(0, 0); pointer-events: auto;
}
.detail-main.show { transition-delay: .1s; }
.detail-panel.show { transition-delay: .18s; }

/* ---- LEFT: identity + usage area chart ---- */
.detail-main .dm-head { display: flex; align-items: center; gap: 15px; margin: 0 0 4px; }
.dm-logo {
  width: 46px; height: 46px; flex: none; border-radius: 13px;
  display: grid; place-items: center;
  background: rgba(255,255,255,.05); border: 1px solid var(--hair);
  color: var(--ink);
}
.dm-logo svg { width: 26px; height: 26px; display: block; }
.detail-main .dm-name {
  font-size: clamp(26px, 3.6vw, 48px); line-height: 1.02; font-weight: 800;
  letter-spacing: -.03em; margin: 0; color: var(--ink);
}
.detail-main .dm-eyebrow {
  display: inline-flex; align-items: center; gap: 9px; flex-wrap: wrap;
  font-size: 11px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase;
  color: var(--ink-3); margin: 14px 0 0;
}
.detail-main .dm-eyebrow .dot { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.detail-main .dm-insight {
  font-size: clamp(14px, 1.15vw, 16px); line-height: 1.55;
  color: var(--ink-2); margin: 16px 0 0; max-width: 34em;
}
.detail-main .dm-insight b { color: var(--ink); font-weight: 700; }

/* suggested questions — subtle secondary pills, styled like "Back to clusters" */
.detail-main .dm-ask { margin-top: 22px; }
.detail-main .dm-ask-lab {
  display: block; font-size: 11px; font-weight: 700; letter-spacing: .09em;
  text-transform: uppercase; color: var(--ink-3); margin-bottom: 11px;
}
.detail-main .dm-ask-pills { display: flex; flex-wrap: wrap; gap: 8px; }
.detail-main .dm-q {
  font: inherit; font-size: 12.5px; font-weight: 600; letter-spacing: .01em;
  color: var(--ink-2);
  background: rgba(255,255,255,.04);
  border: 1px solid var(--hair-2); border-radius: 999px;
  padding: 8px 15px; cursor: pointer;
  transition: border-color .2s var(--ease), color .2s var(--ease), background .2s var(--ease);
}
.detail-main .dm-q:hover {
  color: var(--ink); border-color: rgba(255,255,255,.28); background: rgba(255,255,255,.06);
}

.dm-chart { margin-top: 26px; position: relative; }
.dm-chart .ch-top { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.dm-chart .ch-lab { font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); }
.dm-chart .ch-val { font-size: 15px; font-weight: 700; letter-spacing: -.01em; }
.dm-chart .ch-val.up { color: #33B3E2; }
.dm-chart .ch-val.down { color: #E26A9A; }
.dm-chart svg { display: block; width: 100%; height: auto; }

/* hover tooltip — floats above the focused week, nudged up via translate */
.dm-chart .ch-tip {
  position: absolute; left: 0; top: 0; z-index: 3; pointer-events: none;
  min-width: 128px; max-width: 200px; padding: 9px 11px 10px;
  background: rgba(18,18,28,.94); border: 1px solid var(--hair-2);
  border-radius: 10px; box-shadow: 0 10px 30px rgba(0,0,0,.4);
  transform: translate(-50%, calc(-100% - 14px)) scale(.97);
  transform-origin: 50% 100%; opacity: 0; visibility: hidden;
}
.dm-chart .ch-tip.show { opacity: 1; visibility: visible; transform: translate(-50%, calc(-100% - 14px)) scale(1); }
/* flipped below the point when there is no room above (near the chart top) */
.dm-chart .ch-tip.below { transform: translate(-50%, 14px) scale(.97); transform-origin: 50% 0; }
.dm-chart .ch-tip.below.show { transform: translate(-50%, 14px) scale(1); }
.dm-chart .ch-tip-wk { font-size: 10px; font-weight: 600; letter-spacing: .07em; text-transform: uppercase; color: var(--ink-3); }
.dm-chart .ch-tip-val { font-size: 22px; font-weight: 800; letter-spacing: -.02em; color: var(--ink); line-height: 1.05; margin-top: 3px; }
.dm-chart .ch-tip-sub { font-size: 11.5px; font-weight: 600; color: var(--ink-2); margin-top: 2px; }
.dm-chart .ch-tip-ins { font-size: 11px; color: var(--ink-3); margin-top: 5px; }
@media (prefers-reduced-motion: no-preference) {
  .dm-chart .ch-tip { transition: opacity .16s var(--ease), transform .16s var(--ease); }
}

/* ---- RIGHT panel: big KPIs (primary) → rank (secondary) → team → flow ---- */
.detail-panel .k-lab {
  display: block; font-size: 10.5px; font-weight: 600; letter-spacing: .08em;
  text-transform: uppercase; color: var(--ink-3);
}
.detail-panel .dp-kpis {
  display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 20px; margin-bottom: 24px;
}
.detail-panel .dp-kpi { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.detail-panel .dp-kpi .k-val {
  font-size: clamp(26px, 2.6vw, 34px); font-weight: 500; letter-spacing: -.02em;
  color: var(--ink); line-height: 1; white-space: nowrap;
}
/* goal-progress line under each KPI */
.detail-panel .dp-goal {
  height: 4px; border-radius: 999px; background: rgba(255,255,255,.08); overflow: hidden; margin-top: 2px;
}
.detail-panel .dp-goal-fill { height: 100%; width: 0; border-radius: 999px; }
.detail-panel .dp-goal-cap { font-size: 10.5px; font-weight: 600; color: var(--ink-3); }

/* rank — deliberately small / secondary */
.detail-panel .dp-rank {
  font-size: 12px; line-height: 1.5; color: var(--ink-3);
  margin: 0 0 24px; padding-top: 18px; border-top: 1px solid var(--hair);
}
.detail-panel .dp-rank b { color: var(--ink-2); font-weight: 700; }

/* account team + open case, side by side */
.detail-panel .dp-cols {
  display: grid; grid-template-columns: 1fr 1fr; gap: 22px;
  align-items: stretch; margin-bottom: 2px;
}
.detail-panel .dp-team { min-width: 0; }
.detail-panel .dp-case-col { min-width: 0; display: flex; flex-direction: column; }
.detail-panel .tm-lab {
  display: block; font-size: 10.5px; font-weight: 600; letter-spacing: .08em;
  text-transform: uppercase; color: var(--ink-3); margin-bottom: 15px;
}
.detail-panel .tm-row { display: flex; align-items: center; gap: 12px; margin-bottom: 13px; }
.detail-panel .tm-avatar {
  width: 38px; height: 38px; border-radius: 50%; object-fit: cover; flex: none;
  border: 1px solid var(--hair-2); background: var(--panel);
}
.detail-panel .tm-txt { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.detail-panel .tm-name { font-size: 14px; font-weight: 600; color: var(--ink); letter-spacing: -.01em; }
.detail-panel .tm-role { font-size: 11.5px; color: var(--ink-3); }

/* recommended Salesforce Flow CTA */
.detail-panel .dp-flow {
  margin-top: 26px; padding-top: 22px; border-top: 1px solid var(--hair);
  display: flex; flex-direction: column; align-items: flex-start;
}
.detail-panel .dp-flow .f-eyebrow {
  display: block; font-size: 11px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase;
  color: var(--ink-3); margin-bottom: 12px;
}
/* action — a pill, matching the "Back to clusters" button (rounded ends,
   no icon, just the CTA copy). */
.detail-panel .dp-flow .f-btn {
  font: inherit; cursor: pointer;
  display: inline-flex; align-items: center;
  font-size: 12.5px; font-weight: 700; letter-spacing: .01em;
  color: #fff;
  background: linear-gradient(100deg, var(--g1), var(--g2) 55%, var(--g3));
  border: 1px solid rgba(255,255,255,.18); border-radius: 999px;
  padding: 10px 20px;
  box-shadow: 0 6px 18px -8px rgba(106,76,224,.7);
  transition: box-shadow .2s var(--ease), transform .15s var(--ease), filter .2s var(--ease);
}
.detail-panel .dp-flow .f-btn:hover {
  transform: translateY(-1px); filter: brightness(1.08);
  box-shadow: 0 10px 24px -8px rgba(106,76,224,.8);
}
.detail-panel .dp-flow .f-name { font: inherit; }
/* used action — drops the pill chrome and settles into a plain checked-off
   line, with breathing room before the follow-on CTA below it. */
.detail-panel .dp-flow .f-btn.queued {
  cursor: default; transform: none; filter: none;
  background: none; border: none; border-radius: 0;
  padding: 0; margin: 0 0 16px;
  font-size: 12.5px; font-weight: 600;
  color: var(--ink-2); box-shadow: none;
}
.detail-panel .dp-flow .f-btn.queued .f-name::before {
  content: "\2713 "; color: var(--g1); font-weight: 700;
}

/* simple steps — circle bullets, description only. They light up and check
   off one by one when the play is launched. */
.detail-panel .dp-flow .f-steps {
  list-style: none; margin: 15px 0 0; padding: 0;
  transition: opacity .35s var(--ease), transform .35s var(--ease);
}
.detail-panel .dp-flow .f-steps.gone { opacity: 0; transform: translateY(-4px); }
.detail-panel .dp-flow .f-step {
  display: flex; align-items: flex-start; gap: 10px;
  font-size: 12.5px; line-height: 1.45; color: var(--ink-2);
  padding: 5px 0;
  transition: color .3s var(--ease);
}
.detail-panel .dp-flow .f-step.done { color: var(--ink); }
.detail-panel .dp-flow .f-bullet {
  position: relative;
  width: 12px; height: 12px; flex: none; margin-top: 2px; border-radius: 50%;
  border: 1.5px solid var(--hair-2);
  transition: border-color .3s var(--ease), background .3s var(--ease);
}
.detail-panel .dp-flow .f-step.done .f-bullet {
  border-color: transparent;
  background: linear-gradient(120deg, var(--g1), var(--g3));
}
.detail-panel .dp-flow .f-step.done .f-bullet::after {
  content: "\2713"; position: absolute; inset: 0;
  display: grid; place-items: center;
  color: #fff; font-size: 8px; font-weight: 700; line-height: 1;
}

/* logical follow-on action — the gradient pill + its steps slide in together. */
.detail-panel .dp-flow .f-appear {
  opacity: 0; transform: translateY(-4px);
  transition: opacity .35s var(--ease), transform .35s var(--ease),
              box-shadow .2s var(--ease), filter .2s var(--ease);
}
.detail-panel .dp-flow .f-appear.show { opacity: 1; transform: translateY(0); }

/* top-of-screen confirmation toast */
.toast {
  position: fixed; top: 20px; left: 50%; z-index: 60;
  display: inline-flex; align-items: center; gap: 9px;
  padding: 11px 18px 11px 13px; border-radius: 999px;
  background: rgba(20, 24, 33, .92); backdrop-filter: blur(10px);
  border: 1px solid var(--hair-2);
  box-shadow: 0 14px 38px -14px rgba(0, 0, 0, .75);
  color: var(--ink); font-size: 13px; font-weight: 600; letter-spacing: -.01em;
  opacity: 0; pointer-events: none;
  transform: translate(-50%, -14px) scale(.97);
  transition: opacity .5s cubic-bezier(.22,.61,.36,1),
              transform .5s cubic-bezier(.22,.61,.36,1);
}
.toast.show { opacity: 1; transform: translate(-50%, 0) scale(1); }
.toast .toast-ic {
  width: 18px; height: 18px; flex: none; border-radius: 50%;
  display: grid; place-items: center;
  background: linear-gradient(120deg, var(--g1), var(--g3)); color: #fff;
  font-size: 10px; font-weight: 700; line-height: 1;
}

/* linked open case — simplified card (fabricated demo fixture).
   Fills the column so it matches the account-team height beside it. */
.detail-panel .dp-case {
  flex: 1; display: flex; flex-direction: column;
  padding: 12px 14px;
  border: 1px solid var(--hair); border-radius: 12px;
  background: rgba(255,255,255,.02);
}
.detail-panel .dp-case-meta {
  display: flex; align-items: center; gap: 7px;
  font-size: 11px; font-weight: 600; letter-spacing: .02em;
}
.detail-panel .dp-case-id { color: var(--ink); font-weight: 700; }
.detail-panel .dp-case-sep { color: var(--ink-3); }
.detail-panel .dp-case-pri { color: var(--ink-2); }
.detail-panel .dp-case-subj { margin: 9px 0 0; font-size: 13px; line-height: 1.35; color: var(--ink); }
.detail-panel .dp-case-opened { margin: auto 0 0; padding-top: 6px; font-size: 11.5px; color: var(--ink-3); }

@media (prefers-reduced-motion: reduce) {
  * { transition-duration: .001ms !important; animation-duration: .001ms !important; }
}

/* ============================================================
   Selected KPI — the metric the inspector drawer is bound to.
   A soft accent ring on the dark rail card (Data tab only).
   ============================================================ */
.kpi.kpi-selected {
  position: relative;
  border-radius: 14px;
  padding: 14px 16px;
  margin: -14px -16px;
  background: rgba(124, 92, 255, .10);
  box-shadow: 0 0 0 2px rgba(124, 92, 255, .95),
              0 0 0 7px rgba(124, 92, 255, .18);
}

/* ============================================================
   Data view — the report is normally a fixed, no-scroll screen.
   With the inspector open we let the page scroll and reserve
   space below the report (≈ the sheet height) so the reader can
   scroll the selected KPI up, clear of the pinned half-sheet.
   ============================================================ */
body.data-view { height: auto; overflow-y: auto; padding-bottom: 64vh; }
body.data-view .app { height: auto; }
body.data-view .stage { overflow: visible; }

/* ============================================================
   Metric inspector — bottom half-sheet (Tab Next / SLDS light).
   Overlaid on the dark cluster explorer; Data tab only.
   ============================================================ */
.metric-drawer {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 60;
  max-height: 62vh;
  overflow-y: auto;
  background: #ffffff;
  color: #181818;
  border-top: 1px solid #d8dde6;
  border-radius: 14px 14px 0 0;
  box-shadow: 0 -14px 40px rgba(8, 8, 14, .45), 0 -2px 0 rgba(255,255,255,.6);
  padding: 8px 24px 22px;
  font-family: var(--font);
  animation: mdRise .34s cubic-bezier(.22,.9,.24,1) both;
}
.metric-drawer[hidden] { display: none; }
@keyframes mdRise { from { transform: translateY(101%); } to { transform: translateY(0); } }

.metric-drawer .md-handle {
  width: 40px; height: 4px; border-radius: 999px;
  background: #c9cdd6; margin: 6px auto 14px;
}

/* header */
.metric-drawer .md-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 16px; padding-bottom: 16px; border-bottom: 1px solid #e5e7eb;
}
.metric-drawer .md-ident { display: flex; gap: 12px; align-items: flex-start; }
.metric-drawer .md-tile {
  flex: none; width: 30px; height: 30px; border-radius: 7px;
  background: #4E36B1; color: #fff;
  display: flex; align-items: center; justify-content: center;
}
.metric-drawer .md-title-row { display: flex; align-items: center; gap: 10px; }
.metric-drawer .md-title { margin: 0; font-size: 17px; font-weight: 700; letter-spacing: -.01em; color: #181818; }
.metric-drawer .md-badge {
  font-size: 10px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  color: #4E36B1; background: #efe9ff; border: 1px solid #ddd0ff;
  border-radius: 4px; padding: 2px 6px;
}
.metric-drawer .md-model {
  display: flex; align-items: center; gap: 6px; margin-top: 5px; color: #4E36B1;
}
.metric-drawer .md-model code {
  font-family: "SFMono-Regular", ui-monospace, Menlo, Consolas, monospace;
  font-size: 12.5px; color: #54698d;
}
.metric-drawer .md-actions { display: flex; align-items: center; gap: 8px; flex: none; }
.metric-drawer .md-btn {
  display: inline-flex; align-items: center; gap: 6px;
  font: inherit; font-size: 13px; font-weight: 600; color: #0176d3;
  background: #fff; border: 1px solid #c9cdd6; border-radius: 6px;
  padding: 6px 12px; cursor: pointer;
}
.metric-drawer .md-btn:hover { background: #f3f8fd; border-color: #0176d3; }
.metric-drawer .md-close {
  display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; color: #545a63;
  background: #fff; border: 1px solid #c9cdd6; border-radius: 6px; cursor: pointer;
}
.metric-drawer .md-close:hover { background: #f3f3f3; color: #181818; }

/* filter row */
.metric-drawer .md-filters {
  display: flex; align-items: center; gap: 24px; flex-wrap: wrap;
  padding: 16px 0; border-bottom: 1px solid #e5e7eb;
}
.metric-drawer .md-filter { display: flex; align-items: center; gap: 10px; }
.metric-drawer .md-filter-lab {
  font-size: 11px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: #616061;
}
.metric-drawer .md-seg {
  display: inline-flex; background: #f3f2f7; border: 1px solid #e2e0ec;
  border-radius: 8px; padding: 2px;
}
.metric-drawer .md-seg-opt {
  font: inherit; font-size: 12.5px; font-weight: 600; color: #54698d;
  background: transparent; border: 0; border-radius: 6px;
  padding: 5px 12px; cursor: pointer; white-space: nowrap;
}
.metric-drawer .md-seg-opt.on {
  background: #ece7fb; color: #4E36B1; box-shadow: 0 1px 2px rgba(78,54,177,.18);
}
.metric-drawer .md-refreshed {
  margin-left: auto; display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; color: #616061;
}

/* stat tiles */
.metric-drawer .md-stats {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px;
  padding: 18px 0; border-bottom: 1px solid #e5e7eb;
}
.metric-drawer .md-stat {
  background: #f7f8fa; border: 1px solid #e5e7eb; border-radius: 8px; padding: 12px 14px;
}
.metric-drawer .md-stat-lab {
  font-size: 11px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase;
  color: #616061; margin-bottom: 6px;
}
.metric-drawer .md-stat-val { font-size: 22px; font-weight: 700; letter-spacing: -.01em; color: #181818; }
.metric-drawer .md-stat-val.down { color: #dc2626; }

/* formula */
.metric-drawer .md-formula { padding: 16px 0; border-bottom: 1px solid #e5e7eb; }
.metric-drawer .md-sec-lab {
  font-size: 11px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase;
  color: #616061; margin-bottom: 9px;
}
.metric-drawer .md-formula-code {
  display: block; font-family: "SFMono-Regular", ui-monospace, Menlo, Consolas, monospace;
  font-size: 12.5px; color: #2b2b2b; background: #f3f3f3; border: 1px solid #e5e7eb;
  border-radius: 6px; padding: 11px 14px; overflow-x: auto; white-space: pre;
}

/* values table */
.metric-drawer .md-values { padding: 16px 0 0; }
.metric-drawer .md-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.metric-drawer .md-table th {
  text-align: left; font-size: 11px; font-weight: 700; letter-spacing: .04em;
  text-transform: uppercase; color: #616061; padding: 8px 12px; border-bottom: 1px solid #e5e7eb;
}
.metric-drawer .md-table td {
  padding: 9px 12px; border-bottom: 1px solid #f0f1f3; color: #181818;
}
.metric-drawer .md-table tbody tr:last-child td { border-bottom: 0; }
.metric-drawer .md-table .num { text-align: right; }
.metric-drawer .md-table .down { color: #dc2626; font-weight: 600; }
.metric-drawer .md-table .muted { color: #a0a4ab; }
