/* ============================================================
   CORNERSTONE — Builder Dashboard Design System
   Foundations stylesheet. Tokens are the single source of truth.
   ============================================================ */

:root {
  /* ---- Brand (Purple Sequential — primary = Purple 700) ---- */
  --brand: #5346A0;           /* purple-700 — primary */
  --brand-hover: #40367B;     /* purple-900 */
  --brand-active: #352C66;
  --brand-border: #7C71C0;    /* purple-500 — accent and focus borders */
  --brand-weak: #F6F5FB;      /* purple-100 */
  --teal: #117CA5;          /* secondary brand (table header) */
  --teal-weak: #E4F1F7;

  /* ---- Purple Sequential (site primary ramp) ---- */
  --purple-100: #F6F5FB;
  --purple-200: #C9C2E8;
  --purple-300: #9389CF;
  --purple-500: #7C71C0;
  --purple-700: #5346A0;
  --purple-900: #40367B;
  --purple-accent: #6A59B8;  /* progress bars, point tooltips */
  --slate: #8B90A8;          /* muted periwinkle labels (corp cards) */

  /* ---- Neutrals ---- */
  --ink-900: #2A2B32;
  --ink-700: #4A4D57;
  --ink-500: #6B7280;
  --ink-400: #8A909C;
  --ink-300: #B7BCC6;
  --line:    #E6E8EC;
  --line-weak: #EEF0F3;
  --surface: #FFFFFF;
  --sunken:  #F7F8FA;
  --rail:    #2A2B32;
  --rail-hover: #3A3B45;

  /* ---- Semantic / status ---- */
  --success: #32AE3E;  --success-bg: #F4FAF5;
  --warning: #F0A530;  --warning-bg: #FEF4E4;
  --danger:  #E33131;  --danger-bg:  #FFF5F6;
  --info:    var(--brand);  --info-bg:    var(--brand-weak);

  /* ---- Data-viz Rich Media (Sales Overview cool palette — canonical series) ---- */
  --dv-tour:     #5B54CC;  /* 3D Tour */
  --dv-video:    #908AF0;  /* Community Video */
  --dv-floorplan:#78A2E4;  /* Interactive Floor Plan */
  --dv-upload:   #6CC6C6;  /* Video Upload */
  --dv-virtual:  #A8E8EA;  /* Virtual Tour Link */
  --dv-compare:  var(--brand);          /* Total Listing Views (line) */

  /* ---- Data-viz categorical ramps (6 shades per hue, mirroring blue/purple) ---- */
  --dv-orange-100:#FEF6F2; --dv-orange-200:#FAD3BC; --dv-orange-300:#F4AE85; --dv-orange-500:#EE8E5C; --dv-orange-700:#C96A3A; --dv-orange-900:#8F461F;
  --dv-green-100:#F4FAF5;  --dv-green-200:#C5E9C9;  --dv-green-300:#6BCF76;  --dv-green-500:#32AE3E;  --dv-green-700:#258A2F;  --dv-green-900:#165C1C;
  --dv-gold-100:#FAF8F0;   --dv-gold-200:#E5D7AB;   --dv-gold-300:#CDB56F;   --dv-gold-500:#A58D43;   --dv-gold-700:#7D6A30;   --dv-gold-900:#53461D;
  --dv-pink-100:#FEF2F8;   --dv-pink-200:#FABDDB;   --dv-pink-300:#F58CC3;   --dv-pink-500:#F067AF;   --dv-pink-700:#C7418A;   --dv-pink-900:#91245F;
  --dv-aqua-100:#F3FAF9;   --dv-aqua-200:#C0E0DF;   --dv-aqua-300:#93C9C7;   --dv-aqua-500:#67B5B3;   --dv-aqua-700:#46908E;   --dv-aqua-900:#2C625F;
  --dv-teal-100:#EEF6FA;   --dv-teal-200:#A9D3E1;   --dv-teal-300:#5CA8C4;   --dv-teal-500:#2E8FB3;   --dv-teal-700:#117CA5;   --dv-teal-900:#0A5271;

  /* ---- Report section colors (200 fills + 900 ink) ---- */
  --sec-listing: var(--dv-teal-200);
  --sec-listing-ink: var(--dv-teal-900);
  --sec-engage: var(--dv-pink-200);
  --sec-engage-ink: var(--dv-pink-900);
  --sec-leads: var(--dv-gold-200);
  --sec-leads-ink: var(--dv-gold-900);
  --sec-spend: var(--dv-green-200);
  --sec-spend-ink: var(--dv-green-900);

  /* ---- Motion ---- */
  --motion-micro: 120ms;      /* hover, focus, button press */
  --motion-standard: 200ms;   /* dropdowns, tooltips, tab swaps */
  --motion-chart: 600ms;      /* bars grow, lines draw, rings fill */
  --ease-out: cubic-bezier(.22,.61,.36,1);
  --ease-in-out: cubic-bezier(.65,.05,.36,1);

  /* ---- Elevation ---- */
  --e1: 0 1px 2px rgba(20,23,28,.06), 0 1px 1px rgba(20,23,28,.04);
  --e2: 0 2px 8px rgba(20,23,28,.08);
  --e3: 0 10px 28px rgba(20,23,28,.14);
  --e4: 0 18px 44px rgba(20,23,28,.18);

  /* ---- Radius ---- */
  --r-sm: 4px; --r-md: 6px; --r-lg: 8px; --r-xl: 12px; --r-pill: 999px;

  /* ---- Type ---- */
  --font: "Lato", system-ui, -apple-system, sans-serif;
  --body-sm-font-size: 13px;
  --body-sm-font-weight: 400;
  --body-sm-line-height: 1.55;
  --label-font-size: 12px;
  --label-font-weight: 400;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 92px; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink-700);
  background: var(--surface);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* Chart axis / tick labels — use Cornerstone type (not browser serif fallback) */
svg text {
  font-family: var(--font);
  font-weight: var(--body-sm-font-weight, 400);
}
h1,h2,h3,h4 { color: var(--ink-900); margin: 0; font-weight: 700; letter-spacing: -.01em; }
p { margin: 0; }
a { color: var(--brand); text-decoration: none; }
::selection { background: var(--brand-weak); }

/* ============================================================
   APP CHROME
   ============================================================ */
.topbar {
  position: sticky; top: 0; z-index: 50;
  height: 60px; display: flex; align-items: center; gap: 24px;
  padding: 0 28px;
  background: rgba(255,255,255,.86);
  backdrop-filter: saturate(160%) blur(10px);
  border-bottom: 1px solid var(--line);
}
.brand-lockup { display: flex; align-items: center; gap: 11px; }
.brand-mark {
  width: 30px; height: 30px; border-radius: 7px;
  background: var(--purple-900); display: grid; place-items: center; flex: none;
}
.brand-mark svg { width: 17px; height: 17px; }
.brand-name { font-weight: 800; font-size: 16px; color: var(--ink-900); letter-spacing: -.02em; }
.brand-name b { color: var(--brand); font-weight: 800; }
.topbar .ver {
  font-size: 11px; font-weight: 700; color: var(--ink-400);
  border: 1px solid var(--line); border-radius: var(--r-pill);
  padding: 3px 9px; letter-spacing: .02em;
}
.topbar nav { display: flex; gap: 28px; margin-left: 24px; height: 100%; align-items: stretch; }
.topbar nav a {
  display: flex; align-items: center;
  font-size: 14px; font-weight: 500; color: var(--ink-700); letter-spacing: .01em;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.topbar nav a:hover { color: var(--brand); }
.topbar nav a.on { color: var(--brand); font-weight: 700; border-bottom-color: var(--brand); }
.topbar .search {
  margin-left: auto; display: flex; align-items: center; gap: 8px;
  width: 232px; height: 36px; padding: 0 12px;
  background: var(--sunken); border: 1px solid var(--line); border-radius: var(--r-md);
  color: var(--ink-400); font-size: 13px;
}
.topbar .search kbd {
  margin-left: auto; font-family: var(--font); font-size: 11px; font-weight: 700;
  background: #fff; border: 1px solid var(--line); border-radius: 4px; padding: 1px 6px; color: var(--ink-400);
}

/* Sidenav flush left; content + TOC centered in remaining space */
.layout {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  width: 100%;
}
.content-shell {
  display: grid;
  grid-template-columns: minmax(0, 1040px) 200px;
  justify-content: center;
  width: 100%;
  max-width: 1240px;
  margin: 0 auto;
  min-width: 0;
}

/* ---- Left nav (Ant Design–style hierarchy) ---- */
.sidenav {
  position: sticky; top: 60px; align-self: start;
  height: calc(100vh - 60px); overflow-y: auto;
  padding: 20px 12px 60px 16px;
  border-right: 1px solid var(--line);
  background: #fafafa;
}
.sidenav a {
  display: block; padding: 8px 16px; border-radius: var(--r-md);
  font-size: 14px; font-weight: 500; color: var(--ink-700); line-height: 1.35;
}
.sidenav > a { margin: 1px 0; }
.sidenav a:hover { color: var(--brand); }
.sidenav a.active { background: var(--brand-weak); color: var(--brand); font-weight: 700; }

.nav-group { margin-top: 8px; }
.nav-group-title,
.nav-subgroup-title {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  width: 100%; padding: 8px 16px; border: 0; background: transparent; cursor: pointer;
  font-family: var(--font); font-size: 14px; font-weight: 700; color: var(--ink-900);
  text-align: left; border-radius: var(--r-md); line-height: 1.35;
}
.nav-group-title:hover,
.nav-subgroup-title:hover { color: var(--brand); }
.nav-group-title .chev,
.nav-subgroup-title .chev {
  width: 14px; height: 14px; flex: none; color: var(--ink-400);
  transition: transform .2s var(--ease-out);
}
.nav-group:not(.open) > .nav-group-title .chev,
.nav-subgroup:not(.open) > .nav-subgroup-title .chev { transform: rotate(-90deg); }
.nav-group-body { display: none; padding-left: 0; }
.nav-group.open > .nav-group-body { display: block; }
.nav-subgroup { margin: 2px 0; }
.nav-subgroup-title {
  font-weight: 600; color: var(--ink-700); font-size: 13.5px; padding-left: 24px;
}
.nav-subgroup-body { display: none; padding-left: 12px; }
.nav-subgroup.open > .nav-subgroup-body { display: block; }
.nav-group-body > a { padding-left: 24px; }
.nav-subgroup-body a { padding-left: 28px; font-size: 13.5px; }

.doc-links {
  list-style: none; padding: 0; margin: 16px 0 0;
  display: flex; flex-direction: column; gap: 8px;
}
.doc-links a { font-size: 15px; font-weight: 600; }
.sec-sub code, .note code {
  font-family: ui-monospace, Menlo, monospace; font-size: 0.9em;
  background: var(--sunken); border: 1px solid var(--line); border-radius: 4px; padding: 1px 5px;
}

/* ---- Right TOC ---- */
.toc { position: sticky; top: 60px; align-self: start; height: calc(100vh - 60px); overflow-y: auto; padding: 30px 24px; }
.toc .lbl { font-size: 11px; font-weight: 800; letter-spacing: .09em; text-transform: uppercase; color: var(--ink-400); margin-bottom: 12px; }
.toc a { display: block; font-size: 12.5px; color: var(--ink-400); padding: 5px 0 5px 12px; border-left: 2px solid var(--line-weak); line-height: 1.3; }
.toc a:hover { color: var(--brand); }
.toc a.active { color: var(--brand); border-left-color: var(--brand); font-weight: 700; }

/* ---- Main ---- */
main { padding: 56px 56px 120px; min-width: 0; }
section { scroll-margin-top: 80px; padding-bottom: 16px; }
section + section { margin-top: 60px; padding-top: 4px; }

.eyebrow { font-size: var(--label-font-size); font-weight: var(--label-font-weight); letter-spacing: .1em; text-transform: uppercase; color: var(--brand); margin-bottom: 14px; }
h1.page { font-size: 40px; letter-spacing: -.025em; }
.lede { font-size: 18px; line-height: 1.55; color: var(--ink-500); max-width: 60ch; margin-top: 16px; }
h2.sec { font-size: 27px; letter-spacing: -.02em; }
.sec-sub { font-size: 15.5px; line-height: 1.6; color: var(--ink-500); max-width: 64ch; margin-top: 10px; }
h3.sub { font-size: 16px; margin: 34px 0 14px; }
h3.sub .meta { font-weight: 500; color: var(--ink-400); font-size: 13px; margin-left: 8px; }
.rule { height: 1px; background: var(--line); border: 0; margin: 30px 0; }
.note { font-size: 13.5px; line-height: 1.55; color: var(--ink-500); margin-top: 10px; }
.note b { color: var(--ink-700); }

/* ============================================================
   COLOR SWATCHES
   ============================================================ */
.swatch-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(176px,1fr)); margin-top: 16px; }
.swatch {
  border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden;
  background: #fff; cursor: pointer; transition: box-shadow .15s, transform .15s;
}
.swatch:hover { box-shadow: var(--e2); transform: translateY(-2px); }
.swatch .chip { height: 92px; }
.swatch .meta { padding: 11px 13px 13px; }
.swatch .nm { font-size: 13.5px; font-weight: 700; color: var(--ink-900); }
.swatch .var { font-size: 11.5px; color: var(--ink-400); font-family: ui-monospace, "SF Mono", Menlo, monospace; margin-top: 3px; }
.swatch .hex { font-size: 12px; color: var(--ink-500); font-family: ui-monospace, "SF Mono", Menlo, monospace; margin-top: 7px; display: flex; align-items: center; gap: 6px; text-transform: uppercase; }
.swatch .hex .copied { color: var(--success); font-weight: 700; font-family: var(--font); }

/* ramp (single row, joined) */
.ramp { display: flex; border-radius: var(--r-lg); overflow: hidden; border: 1px solid var(--line); margin-top: 16px; }
.ramp .stop { flex: 1; padding: 16px 14px 18px; cursor: pointer; min-height: 104px; display: flex; flex-direction: column; justify-content: flex-end; }
.ramp .stop .s-nm { font-size: 12px; font-weight: 800; }
.ramp .stop .s-hex { font-size: 11px; font-family: ui-monospace, Menlo, monospace; margin-top: 3px; opacity: .85; }

/* data-viz categorical shade ramps */
#dv-ramps { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(480px,1fr)); margin-top: 16px; }
.dv-ramp-group .ramp { margin-top: 8px; }
.dv-ramp-label { display: flex; align-items: center; gap: 8px; font-size: var(--label-font-size); font-weight: var(--label-font-weight); color: var(--ink-900); }
.dv-ramp-label .sw { width: 14px; height: 14px; border-radius: 4px; flex: none; }
.dv-ramp-label code { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 11.5px; font-weight: 500; color: var(--ink-400); }

/* data-viz categorical pills */
.dv-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(220px,1fr)); margin-top: 16px; }
.dv-item { display: flex; align-items: center; gap: 13px; border: 1px solid var(--line); border-radius: var(--r-lg); padding: 13px 15px; background: #fff; cursor: pointer; }
.dv-item:hover { box-shadow: var(--e1); }
.dv-dot { width: 34px; height: 34px; border-radius: 9px; flex: none; }
.dv-item .nm { font-size: 13.5px; font-weight: 700; color: var(--ink-900); }
.dv-item .var { font-size: 11.5px; color: var(--ink-400); font-family: ui-monospace, Menlo, monospace; margin-top: 2px; }

/* semantic rows */
.sem-row { display: flex; align-items: center; gap: 16px; padding: 14px 0; border-top: 1px solid var(--line-weak); }
.sem-row:first-child { border-top: 0; }
.sem-sw { display: flex; gap: 8px; }
.sem-sw i { width: 30px; height: 30px; border-radius: 7px; display: block; }
.sem-meta { flex: 1; }
.sem-meta .nm { font-size: 14px; font-weight: 700; color: var(--ink-900); }
.sem-meta .desc { font-size: 13px; color: var(--ink-500); margin-top: 2px; }
.sem-meta .codes { font-size: 11.5px; color: var(--ink-400); font-family: ui-monospace, Menlo, monospace; margin-top: 4px; }

/* ============================================================
   TYPOGRAPHY SPECIMENS
   ============================================================ */
.type-row { display: grid; grid-template-columns: 200px 1fr; gap: 28px; align-items: center; padding: 20px 0; border-top: 1px solid var(--line-weak); }
.type-row:first-child { border-top: 0; }
.type-row .spec { font-size: 12.5px; color: var(--ink-400); line-height: 1.7; }
.type-row .spec .t { color: var(--ink-900); font-weight: 700; display: block; font-size: 13.5px; }
.type-row .spec code { font-family: ui-monospace, Menlo, monospace; font-size: 11.5px; }
.type-row .sample { color: var(--ink-900); min-width: 0; }

.ty-display { font-size: 40px; font-weight: 400; letter-spacing: -.025em; line-height: 1.05; }
.ty-h1 { font-size: 32px; font-weight: 700; letter-spacing: -.02em; }
.ty-h2 { font-size: 24px; font-weight: 700; letter-spacing: -.015em; }
.ty-h3 { font-size: 20px; font-weight: 700; }
.ty-h4,
.ty-title { font-size: 17px; font-weight: 700; }
.ty-h5 { font-size: 15px; font-weight: 700; line-height: 20px; letter-spacing: 0; }
.ty-bodyL { font-size: 16px; font-weight: 400; line-height: 1.55; }
.ty-body { font-size: 14px; font-weight: 400; line-height: 1.55; }
.ty-body-sm { font-size: var(--body-sm-font-size); font-weight: var(--body-sm-font-weight); line-height: var(--body-sm-line-height); }
.ty-label { font-size: var(--label-font-size); font-weight: var(--label-font-weight); letter-spacing: .08em; text-transform: uppercase; }
.ty-caption { font-size: 12px; font-weight: 400; color: var(--ink-500); }
.ty-metric { font-size: 46px; font-weight: 400; letter-spacing: -.02em; }
.ty-metric-sm { font-size: 24px; font-weight: 400; letter-spacing: -.02em; line-height: 1; }

.weights { display: flex; gap: 30px; flex-wrap: wrap; margin-top: 18px; }
.weights div { font-size: 30px; color: var(--ink-900); }
.weights span { display: block; font-size: 12px; font-weight: 600; color: var(--ink-400); margin-top: 4px; letter-spacing: .02em; }

/* ============================================================
   SPACING / RADIUS / ELEVATION
   ============================================================ */
.space-row { display: flex; align-items: center; gap: 18px; padding: 9px 0; }
.space-row .bar { background: var(--brand-weak); border: 1px solid var(--purple-200); height: 22px; border-radius: 3px; }
.space-row .lab { font-size: 13px; font-weight: 700; color: var(--ink-900); width: 56px; }
.space-row .px { font-size: 12.5px; color: var(--ink-400); font-family: ui-monospace, Menlo, monospace; }

.radius-grid, .elev-grid { display: grid; gap: 18px; grid-template-columns: repeat(auto-fill, minmax(150px,1fr)); margin-top: 16px; }
.radius-card, .elev-card { text-align: center; }
.radius-card .box { height: 92px; background: #fff; border: 1.5px solid var(--brand-border); }
.elev-card .box { height: 92px; background: #fff; border-radius: var(--r-lg); border: 1px solid var(--line-weak); }
.radius-card .nm, .elev-card .nm { font-size: 13px; font-weight: 700; color: var(--ink-900); margin-top: 12px; }
.radius-card .px, .elev-card .px { font-size: 12px; color: var(--ink-400); font-family: ui-monospace, Menlo, monospace; margin-top: 2px; }

/* ============================================================
   ICONOGRAPHY
   ============================================================ */
.icon-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(96px,1fr)); margin-top: 16px; }
.icon-cell { border: 1px solid var(--line); border-radius: var(--r-lg); padding: 18px 10px 12px; text-align: center; background: #fff; }
.icon-cell svg { width: 24px; height: 24px; color: var(--ink-700); }
.icon-cell .nm { font-size: 11px; color: var(--ink-400); margin-top: 12px; }

/* ============================================================
   COMPONENTS GALLERY
   ============================================================ */
.demo {
  border: 1px solid var(--line); border-radius: var(--r-xl); background: var(--sunken);
  padding: 30px; margin-top: 16px; display: flex; flex-wrap: wrap; gap: 18px; align-items: center;
}
.demo.col { flex-direction: column; align-items: stretch; }
.demo.center { justify-content: center; }

/* buttons */
.btn { font-family: var(--font); font-size: 14px; font-weight: 700; border-radius: var(--r-md); padding: 0 18px; height: 40px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; cursor: pointer; border: 1px solid transparent; transition: background .12s, box-shadow .12s, color .12s, border-color .12s; }
.btn svg { width: 16px; height: 16px; flex: none; }
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-hover); }
.btn-secondary { background: #fff; color: var(--brand); border-color: var(--brand-border); }
.btn-secondary:hover { background: var(--brand-weak); }
.btn-tertiary,
.btn-ghost { background: transparent; color: var(--ink-700); border-color: var(--line); }
.btn-tertiary:hover,
.btn-ghost:hover { background: var(--sunken); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #c62828; }
.btn-danger-secondary { background: var(--danger-bg); color: var(--danger); border-color: transparent; }
.btn-danger-secondary:hover { background: #ffe4e6; }
.btn-danger-tertiary { background: transparent; color: var(--danger); border-color: transparent; }
.btn-danger-tertiary:hover { background: var(--danger-bg); }
.btn-disabled,
.btn:disabled { background: var(--line); color: var(--ink-300); cursor: not-allowed; border-color: transparent; pointer-events: none; }
.btn-selected { box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--brand); }
.btn-loading { min-width: 40px; padding: 0 14px; pointer-events: none; }
.btn-spinner {
  width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid rgba(255,255,255,.35); border-top-color: #fff;
  animation: btn-spin .7s linear infinite;
}
@keyframes btn-spin { to { transform: rotate(360deg); } }
.btn-sm { height: 32px; padding: 0 14px; font-size: 13px; }
.btn-sm svg { width: 14px; height: 14px; }
.btn-md { height: 40px; padding: 0 18px; font-size: 14px; }
.btn-md svg { width: 16px; height: 16px; }
.btn-lg { height: 48px; padding: 0 22px; font-size: 15px; }
.btn-lg svg { width: 18px; height: 18px; }

.btn-h { font-size: 15px; font-weight: 700; color: var(--ink-900); margin: 28px 0 14px; }
.btn-guide {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px;
}
.btn-guide-card {
  border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden;
  background: #fff;
}
.btn-guide-demo {
  display: flex; align-items: center; justify-content: center;
  min-height: 88px; background: var(--sunken); border-bottom: 1px solid var(--line);
}
.btn-guide-body { padding: 16px 18px 18px; }
.btn-guide-title { font-size: 14px; font-weight: 800; color: var(--ink-900); margin-bottom: 6px; }
.btn-guide-body p { font-size: 13px; line-height: 1.55; color: var(--ink-500); margin: 0; }
.btn-demo { flex-wrap: wrap; gap: 20px 28px; align-items: flex-start; }
.btn-spec { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.btn-cap { font-size: 11.5px; font-weight: 700; color: var(--ink-400); letter-spacing: .02em; }

/* ---- Motion docs ---- */
.motion-list { margin: 16px 0 0; padding-left: 1.2em; color: var(--ink-500); font-size: 14.5px; line-height: 1.65; max-width: 68ch; }
.motion-list li + li { margin-top: 8px; }
.motion-list b { color: var(--ink-900); font-weight: 700; }
.motion-principles {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-top: 22px;
}
.motion-principle {
  border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; background: #fff;
}
.motion-principle-demo {
  position: relative; display: flex; align-items: center; justify-content: center;
  min-height: 120px; background: var(--sunken); border-bottom: 1px solid var(--line); gap: 10px;
}
.motion-principle-title { font-size: 15px; font-weight: 800; color: var(--ink-900); padding: 16px 18px 0; }
.motion-principle p { font-size: 13px; line-height: 1.55; color: var(--ink-500); margin: 8px 18px 18px; }
.motion-demo-press:active { transform: translateY(1px) scale(.97); }
.motion-demo-list { display: flex; flex-direction: column; gap: 6px; width: 88px; }
.motion-demo-list span {
  display: block; height: 10px; border-radius: 3px; background: var(--brand);
  transform-origin: left center; opacity: .35; transform: scaleX(.35);
}
.motion-demo-list.run span { animation: motionListIn var(--motion-standard) var(--ease-out) forwards; }
.motion-demo-list.run span:nth-child(1) { animation-delay: 0ms; }
.motion-demo-list.run span:nth-child(2) { animation-delay: 40ms; }
.motion-demo-list.run span:nth-child(3) { animation-delay: 80ms; }
.motion-demo-list.exit span { animation: motionListOut 120ms var(--ease-out) forwards; }
@keyframes motionListIn { to { opacity: 1; transform: scaleX(1); } }
@keyframes motionListOut { to { opacity: .2; transform: scaleX(.2); } }
.motion-demo-menu {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--font); font-size: 14px; font-weight: 700; color: var(--brand);
  background: #fff; border: 1px solid var(--line); border-radius: var(--r-md);
  padding: 10px 14px; cursor: pointer;
}
.motion-demo-menu svg { width: 16px; height: 16px; transition: transform var(--motion-standard) var(--ease-out); }
.motion-demo-menu.open svg { transform: rotate(180deg); }
.motion-demo-menu.fancy svg { transition: transform .6s cubic-bezier(.68,-.55,.27,1.55); }
.motion-demo-menu.fancy.open svg { transform: rotate(540deg); }
.motion-replay {
  font-family: var(--font); font-size: 12px; font-weight: 700; color: var(--brand);
  background: #fff; border: 1px solid var(--line); border-radius: var(--r-md);
  padding: 5px 10px; cursor: pointer;
}
.motion-replay:hover { background: var(--brand-weak); }
.motion-principle-demo .motion-replay { position: absolute; right: 10px; bottom: 10px; }
.motion-compare { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; }
.motion-compare.bad .motion-demo-menu { color: var(--danger); border-color: #f0c4c8; }
.motion-enter-exit { align-items: flex-start; flex-wrap: wrap; }
.motion-panel {
  display: flex; flex-direction: column; gap: 8px; min-width: 200px;
  padding: 14px; border: 1px solid var(--line); border-radius: var(--r-lg); background: #fff;
}
.motion-panel-item {
  padding: 10px 12px; border-radius: var(--r-md); background: var(--brand-weak); color: var(--brand);
  font-size: 13px; font-weight: 700;
  transition: opacity var(--motion-standard) var(--ease-out), transform var(--motion-standard) var(--ease-out);
}
.motion-panel.out .motion-panel-item {
  opacity: 0; transform: translateY(-6px);
  transition-duration: 120ms;
}
.motion-tokens { display: flex; flex-direction: column; gap: 12px; margin-top: 18px; }
.motion-token {
  display: grid; grid-template-columns: 140px minmax(0,1fr) auto; gap: 16px; align-items: center;
  border: 1px solid var(--line); border-radius: var(--r-lg); padding: 14px 16px; background: #fff;
}
.motion-token-track {
  position: relative; height: 36px; border-radius: var(--r-md); background: var(--sunken);
  border: 1px solid var(--line-weak); overflow: hidden;
}
.motion-token-track.tall { height: 44px; }
.motion-token-track i {
  position: absolute; top: 50%; left: 10px; width: 14px; height: 14px; margin-top: -7px;
  border-radius: 50%; background: var(--brand); box-shadow: var(--e2);
}
.motion-token-track i.run-micro { animation: motionDot 120ms var(--ease-out) forwards; }
.motion-token-track i.run-standard { animation: motionDot 200ms var(--ease-out) forwards; }
.motion-token-track i.run-chart { animation: motionDot 600ms var(--ease-in-out) forwards; }
@keyframes motionDot { from { left: 10px; } to { left: calc(100% - 24px); } }
.motion-token-meta .nm { font-size: 14px; font-weight: 800; color: var(--ink-900); }
.motion-token-meta code {
  display: inline-block; margin-top: 4px;
  font-family: ui-monospace, Menlo, monospace; font-size: 12px; color: var(--ink-400);
}
.motion-token-meta .note { margin-top: 4px; }

@media (max-width: 980px) {
  .btn-guide { grid-template-columns: 1fr; }
  .motion-principles { grid-template-columns: 1fr; }
  .motion-token { grid-template-columns: 1fr; }
}

/* dropdown / select */
.field { display: inline-flex; align-items: center; gap: 10px; }
.field .flab { font-size: var(--label-font-size); font-weight: var(--label-font-weight); letter-spacing: .08em; text-transform: uppercase; color: var(--ink-400); }
.select { display: inline-flex; align-items: center; gap: 14px; height: 42px; padding: 0 14px; background: #fff; border: 1px solid var(--line); border-radius: var(--r-md); font-size: 14px; color: var(--ink-900); font-weight: 500; cursor: pointer; box-shadow: var(--e1); }
.select svg { width: 14px; height: 14px; color: var(--ink-400); transition: transform var(--motion-standard) var(--ease-out); }

/* functional select dropdown */
.selectbox { position: relative; display: inline-block; }
.selectbox .select { justify-content: space-between; }
.selectbox.open .select { border-color: var(--brand-border); box-shadow: 0 0 0 3px var(--brand-weak); }
.selectbox.open .select svg { transform: rotate(180deg); }
.select-menu {
  position: absolute; top: calc(100% + 6px); left: 0; min-width: 100%; width: max-content; max-width: 340px;
  background: #fff; border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--e3); padding: 6px; z-index: 30;
  transform-origin: top left; opacity: 0; visibility: hidden; transform: translateY(-6px) scale(.98);
  transition: opacity var(--motion-standard) var(--ease-out), transform var(--motion-standard) var(--ease-out), visibility 0s linear var(--motion-standard);
}
.select-menu:has(.dd-search) { padding: 8px; width: 340px; max-width: 86vw; }
.select-menu .dd-search { display: flex; align-items: center; gap: 10px; height: 44px; padding: 0 14px; border: 1px solid var(--brand-border); border-radius: var(--r-md); margin-bottom: 6px; }
.select-menu .dd-search input { border: 0; outline: 0; flex: 1; font-family: var(--font); font-size: 14.5px; color: var(--ink-900); background: transparent; min-width: 0; }
.select-menu .dd-search svg { width: 17px; height: 17px; color: var(--ink-400); flex: none; }
.select-menu-list { max-height: 290px; overflow-y: auto; margin: 0 -2px; }
.select-menu-list .dd-empty { padding: 14px; text-align: center; color: var(--ink-400); font-size: 14px; }
.selectbox.open .select-menu, .crumb.open .select-menu, .crumb-dd.open .select-menu { opacity: 1; visibility: visible; transform: translateY(0) scale(1); transition: opacity var(--motion-standard) var(--ease-out), transform var(--motion-standard) var(--ease-out), visibility 0s; }
.select-opt { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: var(--r-md); font-size: 14px; color: var(--ink-900); cursor: pointer; white-space: nowrap; transition: background-color var(--motion-micro) var(--ease-out), color var(--motion-standard) var(--ease-out); }
.select-opt:hover { background: var(--brand-weak); color: var(--brand); }
.select-opt.sel {
  background: var(--brand-weak);
  color: var(--brand);
  font-weight: 700;
}
.select-opt .check,
.select-opt .box { display: none; }
/* multi-select checkbox */
.selectbox[data-select="multi"] .select-opt .box {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 18px;
  height: 18px;
  border: 1.5px solid var(--ink-300);
  border-radius: var(--r-sm);
  background: #fff;
  transition: background-color var(--motion-micro) var(--ease-out), border-color var(--motion-micro) var(--ease-out);
}
.selectbox[data-select="multi"] .select-opt .box svg {
  width: 12px;
  height: 12px;
  color: #fff;
  opacity: 0;
  transition: opacity var(--motion-micro) var(--ease-out);
}
.selectbox[data-select="multi"] .select-opt.sel .box {
  background: var(--purple-500);
  border-color: var(--purple-500);
}
.selectbox[data-select="multi"] .select-opt.sel .box svg { opacity: 1; }
.selectbox[data-select="multi"] .select-opt.sel {
  background: #fff;
  color: var(--ink-900);
  font-weight: 700;
}
.selectbox[data-select="multi"] .select-opt:hover {
  background: var(--brand-weak);
  color: var(--brand);
}

/* tabs */
/* tabs — chart underline (default) + report pills */
.tabs { display: flex; gap: 24px; border-bottom: 1px solid var(--line); width: 100%; background: transparent; padding: 0; border-radius: 0; }
.tabs .tab { font-size: 14px; font-weight: 400; letter-spacing: 0; text-transform: none; color: var(--ink-400); padding: 0 2px 14px; position: relative; cursor: pointer; transition: color var(--motion-standard) var(--ease-out); }
.tabs .tab:hover { color: var(--brand); }
.tabs .tab.on { color: var(--brand); font-weight: 700; }
.tabs .tab::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 3px; background: var(--brand); border-radius: 3px 3px 0 0; transform: scaleX(0); transform-origin: center; opacity: 0; transition: transform var(--motion-standard) var(--ease-out), opacity var(--motion-standard) var(--ease-out); }
.tabs .tab.on::after { transform: scaleX(1); opacity: 1; }

/* report section pills (dashboard overview/engagement header) */
.tabs.tabs-pills {
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 8px;
  border-bottom: 0;
  background: transparent;
}
.tabs.tabs-pills .tab {
  padding: 8px 12px;
  font-size: 15px;
  font-weight: 400;
  border-radius: var(--r-md);
}
.tabs.tabs-pills .tab::after { display: none; }
.tabs.tabs-pills .tab.on {
  font-weight: 400;
  color: var(--brand);
  background: var(--brand-weak);
}

/* dashboard report tabs alias */
.tabs.dash-report-tabs {
  flex-wrap: nowrap;
  align-items: center;
  gap: 4px 8px;
  border-bottom: 0;
  background: transparent;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}
.tabs.dash-report-tabs .tab {
  flex: none;
  white-space: nowrap;
  padding: 8px 12px;
  font-size: 15px;
  font-weight: 400;
  letter-spacing: 0;
  text-transform: none;
  text-decoration: none;
  border-radius: var(--r-md);
}
.tabs.dash-report-tabs .tab::after { display: none; }
.tabs.dash-report-tabs .tab.on {
  font-weight: 400;
  color: var(--brand);
  background: var(--brand-weak);
}

/* searchable dropdown menu */
.dd { position: relative; display: inline-block; }
.dd-trigger { display: inline-flex; align-items: center; gap: 10px; font-size: 15px; font-weight: 700; color: var(--brand); background: var(--brand-weak); cursor: pointer; padding: 10px 14px; border-radius: var(--r-md); }
.dd-trigger:hover { color: var(--brand-hover); }
.dd-trigger svg { width: 18px; height: 18px; transition: transform var(--motion-standard) var(--ease-out); }
.dd.open .dd-trigger svg { transform: rotate(180deg); }
.ddmenu { position: absolute; top: calc(100% + 8px); left: 0; width: 340px; max-width: 86vw; background: #fff; border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--e3); padding: 8px; z-index: 30;
  transform-origin: top left; opacity: 0; visibility: hidden; transform: translateY(-6px) scale(.98);
  transition: opacity var(--motion-standard) var(--ease-out), transform var(--motion-standard) var(--ease-out), visibility 0s linear var(--motion-standard); }
.dd.open .ddmenu { opacity: 1; visibility: visible; transform: translateY(0) scale(1); transition: opacity var(--motion-standard) var(--ease-out), transform var(--motion-standard) var(--ease-out), visibility 0s; }
.ddmenu .dd-search { display: flex; align-items: center; gap: 10px; height: 44px; padding: 0 14px; border: 1px solid var(--brand-border); border-radius: var(--r-md); margin-bottom: 6px; }
.ddmenu .dd-search input { border: 0; outline: 0; flex: 1; font-family: var(--font); font-size: 14.5px; color: var(--ink-900); background: transparent; }
.ddmenu .dd-search svg { width: 17px; height: 17px; color: var(--ink-400); }
.dd-list { max-height: 290px; overflow-y: auto; margin: 0 -2px; }
.dd-opt { position: relative; padding: 10px 16px 10px 38px; border-radius: var(--r-md); cursor: pointer; transition: background-color var(--motion-micro) var(--ease-out); }
.dd-opt .nm { font-size: 15px; color: var(--ink-900); line-height: 1.25; }
.dd-opt:hover { background: var(--brand-weak); }
.dd-opt:hover .nm { color: var(--brand); }
.dd-opt.sel { background: var(--brand-weak); }
.dd-opt.sel .nm { color: var(--brand); font-weight: 700; }
.dd-opt .check { position: absolute; left: 13px; top: 50%; width: 16px; height: 16px; color: var(--ink-900); opacity: 0; transform: translateY(-50%); pointer-events: none; }
.dd-opt.sel .check { opacity: 1; }
.dd-empty { padding: 18px; text-align: center; color: var(--ink-400); font-size: 14px; }

/* KPI tiles — dashboard engagement layout */
.kpi {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  box-sizing: border-box;
  width: 100%;
  min-width: 190px;
  max-width: 280px;
  min-height: 168px;
  padding: 18px 20px 14px;
  background: #fff;
  color: var(--ink-900);
  text-align: left;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--e2);
}
.kpi .kpi-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.kpi .v { margin-top: 12px; font-size: 30px; font-weight: 700; letter-spacing: -.02em; line-height: 1; }
.kpi .trend { flex: none; margin-top: 0; }
.kpi .l {
  min-width: 0;
  margin-top: 0;
  color: var(--ink-700);
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: none;
}
.kpi .kpi-bottom {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  margin-top: auto;
}
.kpi .kpi-previous {
  flex: 1 1 52%;
  color: var(--ink-400);
  font-size: 12px;
  line-height: 1.35;
}
.kpi .kpi-spark {
  flex: 0 0 48%;
  width: 48%;
  height: 44px;
  margin: 0;
  color: var(--success);
}
.kpi.down .kpi-spark,
.kpi:has(.trend.down) .kpi-spark { color: var(--danger); }
.kpi .kpi-spark svg { display: block; width: 100%; height: 100%; }
.kpi-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); align-items: stretch; gap: 16px; }
.kpi-row.metric-tiles { grid-template-columns: repeat(2, minmax(190px, 240px)); }
@media (max-width: 720px) {
  .kpi-row { grid-template-columns: 1fr; }
  .kpi-row.metric-tiles { grid-template-columns: minmax(0, 1fr); }
  .kpi { max-width: none; }
}

/* completion card with status header + progress */
.cc { background: #fff; border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; width: 100%; max-width: 300px; box-shadow: var(--e1); }
.kpi-row .cc { max-width: none; }
.cc .bar { height: 5px; }
.cc .bd { padding: 18px 20px 20px; }
.cc .hd { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.cc .hd .t { font-size: 19px; font-weight: 700; color: var(--ink-900); }
.cc .item { border: 1px solid var(--line); border-radius: var(--r-md); padding: 12px 14px; margin-top: 12px; }
.cc .item.err { border-color: #F6CFCF; background: var(--danger-bg); }
.cc .item .rowt { display: flex; align-items: center; justify-content: space-between; font-size: 14px; font-weight: 600; color: var(--ink-900); }
.cc .item .qm { width: 16px; height: 16px; color: var(--ink-300); }
.cc .pbar { display: flex; align-items: center; gap: 14px; margin-top: 10px; }
.cc .track { flex: 1; height: 7px; background: var(--line); border-radius: var(--r-pill); overflow: hidden; }
.cc .track i { display: block; height: 100%; border-radius: var(--r-pill); }
.cc .pct { font-size: 15px; font-weight: 700; color: var(--ink-900); width: 42px; text-align: right; }
.cc-status { margin: 14px 0 0; font-size: 13px; font-weight: 600; line-height: 1.4; }
.cc-status.success { color: var(--success); }
.cc-status.warning { color: #C4841A; }
.cc-status.danger { color: var(--danger); }
.cc-item-solo { display: flex; flex-direction: column; gap: 8px; align-items: stretch; }
.cc-item-solo .item {
  margin-top: 0; background: #fff;
  border: 1px solid var(--line); border-radius: var(--r-md); padding: 12px 14px;
}
.cc-item-solo .item.err { border-color: #F6CFCF; background: var(--danger-bg); }
.cc-item-solo .rowt { display: flex; align-items: center; justify-content: space-between; font-size: 14px; font-weight: 600; color: var(--ink-900); }
.cc-item-solo .pbar { display: flex; align-items: center; gap: 14px; margin-top: 10px; }
.cc-item-solo .track { flex: 1; height: 7px; background: var(--line); border-radius: var(--r-pill); overflow: hidden; }
.cc-item-solo .track i { display: block; height: 100%; border-radius: var(--r-pill); }
.cc-item-solo .pct { font-size: 15px; font-weight: 700; color: var(--ink-900); width: 42px; text-align: right; }
.prog-accent-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; align-items: stretch; }
.prog-accent-spec {
  display: flex; flex-direction: column; align-items: center; gap: 0;
  background: #fff; border: 1px solid var(--line); border-radius: var(--r-lg);
  overflow: hidden; padding-bottom: 14px;
}
.prog-accent-spec .prog-accent-bar {
  height: 5px; width: 100%; border-radius: 0; margin: 0;
}
.prog-accent-spec .btn-cap { padding-top: 16px; }
@media (max-width: 720px) {
  .prog-accent-row { grid-template-columns: 1fr; }
}

/* status ring */
.ring-row { display: flex; gap: 40px; flex-wrap: wrap; }
.ring { text-align: center; }
.ring .cap { font-size: 12px; font-weight: 700; color: var(--ink-500); margin-top: 8px; }

/* gauge */
.gauge-wrap { text-align: center; }
.gauge-val { font-size: 26px; font-weight: 400; color: var(--ink-900); margin-top: -6px; }

/* table — horizontally scrollable with frozen first column */
.tbl-wrap { position: relative; width: 100%; border: 1px solid var(--line); border-radius: var(--r-lg); background: #fff; }
.tbl-scroll { overflow-x: auto; border-radius: var(--r-lg); }
table.tbl { width: 100%; min-width: 860px; border-collapse: separate; border-spacing: 0; font-size: 13.5px; }
table.tbl thead th.grouphdr { background: var(--teal); color: #fff; font-size: 14px; font-weight: var(--body-sm-font-weight); line-height: var(--body-sm-line-height); letter-spacing: 0; padding: 9px 16px; text-align: left; }

/* overview section header rows (pastel bands) */
table.tbl tr.sec-hdr > td {
  padding: 0;
  border-bottom: 0;
}
table.tbl tr.sec-hdr .sec-hdr-pin {
  position: sticky;
  left: 0;
  width: fit-content;
  max-width: 100%;
  padding: 9px 16px;
  font-size: var(--label-font-size);
  font-weight: var(--label-font-weight);
  letter-spacing: .04em;
  text-transform: uppercase;
  box-sizing: border-box;
}
table.tbl tr.sec-listing > td { background: var(--sec-listing); }
table.tbl tr.sec-listing .sec-hdr-pin { color: var(--sec-listing-ink); }
table.tbl tr.sec-engage > td { background: var(--sec-engage); }
table.tbl tr.sec-engage .sec-hdr-pin { color: var(--sec-engage-ink); }
table.tbl tr.sec-leads > td { background: var(--sec-leads); }
table.tbl tr.sec-leads .sec-hdr-pin { color: var(--sec-leads-ink); }
table.tbl tr.sec-spend > td { background: var(--sec-spend); }
table.tbl tr.sec-spend .sec-hdr-pin { color: var(--sec-spend-ink); }
table.tbl thead th { background: var(--sunken); color: var(--ink-400); font-size: 14px; font-weight: var(--body-sm-font-weight); line-height: var(--body-sm-line-height); letter-spacing: 0; text-transform: none; text-align: right; padding: 13px 16px; border-bottom: 1px solid var(--line); vertical-align: bottom; }
table.tbl thead th.l { text-align: left; }
table.tbl td { padding: 14px 16px; text-align: right; border-bottom: 1px solid var(--line-weak); color: var(--ink-700); white-space: nowrap; }
table.tbl td.l { text-align: left; }
table.tbl td .blink { color: var(--ink-900); font-weight: 700; }
table.tbl td .sub { color: var(--ink-400); font-size: 11.5px; letter-spacing: .04em; }
table.tbl tr.total td { background: #F3F6FB; font-weight: 700; color: var(--ink-900); border-bottom: 0; }
/* frozen first column */
table.tbl .freeze { position: sticky; left: 0; z-index: 2; background: #fff; }
table.tbl thead .freeze { z-index: 3; background: var(--sunken); }
table.tbl tr.total .freeze { background: #F3F6FB; }
table.tbl .freeze::after { content: ""; position: absolute; top: 0; right: 0; bottom: -1px; width: 14px; transform: translateX(100%); pointer-events: none; background: linear-gradient(90deg, rgba(20,23,28,.07), transparent); opacity: 0; transition: opacity .2s; }
.tbl-wrap.scrolled table.tbl .freeze::after { opacity: 1; }
/* frozen last column */
table.tbl .freeze-end { position: sticky; right: 0; z-index: 2; background: #F3F6FB; }
table.tbl thead .freeze-end { z-index: 3; background: #F3F6FB; }
table.tbl .freeze-end::before { content: ""; position: absolute; top: 0; left: 0; bottom: -1px; width: 14px; transform: translateX(-100%); pointer-events: none; background: linear-gradient(270deg, rgba(20,23,28,.07), transparent); opacity: 0; transition: opacity .2s; }
.tbl-wrap:not(.atend) table.tbl .freeze-end::before { opacity: 1; }
/* right-edge scroll affordance */
.tbl-next { position: absolute; top: 7px; right: 0; width: 30px; height: 30px; border-radius: var(--r-sm); background: #fff; color: var(--ink-700); display: grid; place-items: center; cursor: pointer; z-index: 4; box-shadow: -3px 0 12px rgba(20,23,28,.16), 0 1px 4px rgba(20,23,28,.22); }
.tbl-next svg { width: 16px; height: 16px; }
.tbl-next:hover { color: var(--brand); }
.tbl-wrap.atend .tbl-next { display: none; }
/* left-edge scroll affordance (appears after scrolling right) */
.tbl-prev { position: absolute; top: 7px; left: 0; width: 30px; height: 30px; border-radius: var(--r-sm); background: #fff; color: var(--ink-700); display: none; place-items: center; cursor: pointer; z-index: 5; box-shadow: 3px 0 12px rgba(20,23,28,.16), 0 1px 4px rgba(20,23,28,.22); }
.tbl-prev svg { width: 16px; height: 16px; }
.tbl-prev:hover { color: var(--brand); }
.tbl-wrap.scrolled .tbl-prev { display: grid; }

/* breadcrumb — single line, never wraps */
.crumbs { display: flex; align-items: center; gap: 4px; width: 100%; flex-wrap: nowrap; white-space: nowrap; }
.crumb { position: relative; display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 10px; border-radius: var(--r-md); font-size: 14px; color: var(--ink-700); cursor: pointer; flex: none; white-space: nowrap; }
.crumb { transition: background-color var(--motion-standard) var(--ease-out), color var(--motion-standard) var(--ease-out); }
button.crumb {
  margin: 0;
  border: 0;
  background: transparent;
  font: inherit;
  font-family: var(--font);
  appearance: none;
}
.crumb:hover, .crumb.sel:hover, .crumb.muted:hover { color: var(--brand); background: var(--brand-weak); }
.crumb:hover .caret { color: var(--brand); }
.crumb .caret { transition: transform var(--motion-standard) var(--ease-out); }
.crumb.open .caret { transform: rotate(180deg); }
.crumb.open { color: var(--brand); background: var(--brand-weak); }
.crumb.open .caret { color: var(--brand); }
.crumb .select-menu { top: calc(100% + 8px); font-weight: 400; }
.crumb .select-menu .select-opt { color: var(--ink-900); }
.crumb .select-menu .select-opt.sel { color: var(--brand); }
.crumb.sel { font-weight: 700; color: var(--brand); background: transparent; }
.crumb.muted { color: var(--slate); background: transparent; }
.crumb.muted:hover { color: var(--brand); background: var(--brand-weak); }
/* back link keeps icon sizing; filter chips use a simple clear × */
.crumb > .x {
  display: none;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  margin: 0 8px 0 0;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--ink-400);
  flex: none;
  cursor: pointer;
  appearance: none;
  font: inherit;
  position: relative;
  z-index: 2;
  transition: color var(--motion-micro) var(--ease-out), background-color var(--motion-micro) var(--ease-out);
}
.crumb.sel > .x { display: inline-flex; }
.crumb > .x svg { width: 14px; height: 14px; display: block; pointer-events: none; }
.crumb:hover > .x,
.crumb.open > .x,
.crumb.sel > .x {
  color: var(--ink-400);
  background: transparent;
}
.crumb > .x:hover {
  color: var(--brand);
  background: var(--brand-weak);
}
.crumb .crumb-face {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 30px;
  padding: 0 10px;
  border-radius: var(--r-md);
  transition: background-color var(--motion-standard) var(--ease-out), color var(--motion-standard) var(--ease-out);
}
.crumb.crumb-dd {
  gap: 0;
  padding: 0;
  background: transparent;
}
.crumb.crumb-dd:hover,
.crumb.crumb-dd.sel:hover,
.crumb.crumb-dd.muted:hover,
.crumb.crumb-dd.open {
  background: transparent;
}
.crumb.crumb-dd .crumb-face:hover,
.crumb.crumb-dd.open .crumb-face {
  color: var(--brand);
  background: var(--brand-weak);
}
.crumb.crumb-dd .crumb-face:hover .caret,
.crumb.crumb-dd.open .crumb-face .caret {
  color: var(--brand);
}
/* down-triangle caret */
.crumb .caret { width: 16px; height: 16px; flex: none; color: var(--ink-400); }
.crumb.sel .caret { color: var(--brand); }
/* thin vertical divider after "Back to Corporations" */
.crumb-divider { width: 1px; height: 24px; background: var(--line); flex: none; margin: 0 6px; }
/* separator between selectable crumbs */
.crumb-sep {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  padding: 0 6px;
  color: var(--ink-300);
  flex: none;
  font-size: 14px;
  font-weight: 400;
  line-height: 1;
  user-select: none;
}
.crumb-sep svg { width: 16px; height: 16px; display: block; }

/* corporation card */
.corp { width: 290px; background: #fff; border: 1px solid var(--line); border-radius: 16px; overflow: hidden; box-shadow: var(--e2); }
.corp .top { padding: 16px 20px 14px; }
.corp .top .nm { font-size: 17px; font-weight: 700; color: var(--ink-900); letter-spacing: -.01em; }
.corp .top .id { font-size: 12.5px; color: var(--slate); margin-top: 3px; font-weight: 500; }
.corp .stats { display: grid; grid-template-columns: 1fr 1fr; border-top: 1px solid var(--line); }
.corp .stats > div { padding: 18px 12px; text-align: center; position: relative; }
.corp .stats > div + div::before { content: ""; position: absolute; left: 0; top: 16px; bottom: 16px; width: 1px; background: var(--line); }
.corp .stats .n { color: var(--ink-900); }
.corp .stats .k { font-size: var(--label-font-size); font-weight: var(--label-font-weight); letter-spacing: .04em; text-transform: uppercase; color: var(--slate); margin-top: 9px; white-space: nowrap; }

/* tooltip */
.ttip { background: #fff; border-radius: var(--r-lg); box-shadow: var(--e3); padding: 16px 20px; width: 250px; }
.ttip .tt-hd { text-align: center; font-size: 15px; font-weight: 700; color: var(--ink-900); padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.ttip .tt-total { display: flex; justify-content: space-between; font-size: 14px; font-weight: 700; color: var(--ink-900); margin: 12px 0 8px; }
.ttip .tt-row { display: flex; align-items: center; gap: 9px; font-size: 12.5px; padding: 4px 0; }
.ttip .tt-row i { width: 9px; height: 9px; border-radius: 2px; }
.ttip .tt-row .tt-n { color: var(--ink-700); flex: 1; }
.ttip .tt-row .tt-p { font-weight: 700; color: var(--ink-900); }
.ttip .tt-row .tt-c { color: var(--ink-400); }
.pin { background: var(--brand); color: #fff; border-radius: var(--r-md); padding: 8px 12px; text-align: center; font-size: 12px; box-shadow: var(--e2); }
.pin b { display: block; font-size: 17px; }

/* badges */
.badge { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; padding: 4px 10px; border-radius: var(--r-pill); }
.badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.badge.s { color: #1F8A2B; background: var(--success-bg); }
.badge.w { color: #B97608; background: var(--warning-bg); }
.badge.d { color: #C42727; background: var(--danger-bg); }
.badge.i { color: var(--brand); background: var(--brand-weak); }

/* trend pills (up / down delta) */
.trend {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 10px;
  border-radius: var(--r-pill);
  font-size: 12px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  white-space: nowrap;
}
.trend svg {
  width: 14px;
  height: 14px;
  flex: none;
}
.trend.up { color: #1F8A2B; background: var(--success-bg); }
.trend.down { color: #C42727; background: var(--danger-bg); }

/* combined breadcrumb / tabs / nav-rail layout */
.nav-rail-row, .nav-list-row { display: flex; gap: 22px; align-items: flex-start; }
.nav-rail-note { flex: 1; min-width: 220px; padding-top: 6px; }
.nav-rail-note .rail-note-t { font-size: 15px; font-weight: 800; color: var(--ink-900); }
.nav-rail-note .note { margin-top: 8px; max-width: 46ch; }

/* section navigation list */
.nav-list { width: 280px; background: #fff; border: 1px solid var(--line); border-radius: var(--r-lg); padding: 8px; box-shadow: var(--e1); }
.nav-item { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 11px 14px; border-radius: var(--r-md); font-size: 14px; font-weight: 500; color: var(--ink-700); cursor: pointer; text-decoration: none; transition: background-color var(--motion-micro) var(--ease-out), color var(--motion-standard) var(--ease-out); }
.nav-item:hover { background: var(--brand-weak); color: var(--brand); }
.nav-item.on { background: var(--brand-weak); color: var(--brand); font-weight: 700; }
.nav-item svg { width: 14px; height: 14px; flex: none; opacity: 0; transition: opacity var(--motion-micro) var(--ease-out); }
.nav-item.on svg { opacity: 1; }

/* light nav rail demo */
.rail-demo { background: #fff; border: 1px solid var(--line); border-radius: var(--r-lg); width: 64px; height: 620px; padding: 0 0 16px; display: flex; flex-direction: column; align-items: center; gap: 12px; overflow: hidden; box-shadow: var(--e1); }
.rail-demo .rail-head { width: 100%; display: flex; flex-direction: column; align-items: center; padding: 14px 0; margin-bottom: 4px; background: transparent; }
.rail-demo .logo { width: 28px; height: 28px; display: grid; place-items: center; }
.rail-demo .logo img { width: 28px; height: 28px; display: block; }
.rail-demo .rail-group { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.rail-demo .ic { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; color: var(--ink-400); cursor: pointer; }
.rail-demo .ic svg { width: 22px; height: 22px; }
.rail-demo .ic:hover { color: var(--brand); background: var(--brand-weak); }
.rail-demo .ic.on { background: var(--brand-weak); color: var(--brand); }
.rail-demo .ic.on:hover { color: var(--brand); background: var(--brand-weak); }
.rail-demo .ic.faded { color: var(--ink-300); opacity: .8; }
.rail-demo .ic.faded:hover { opacity: 1; color: var(--brand); }
.rail-demo .rail-spacer { flex: 1; }
.rail-demo .rail-div { width: 30px; height: 1px; background: var(--line); flex: none; }

/* charts */
.chart-card { width: 100%; background: #fff; border: 1px solid var(--line); border-radius: var(--r-xl); padding: 24px 26px; box-shadow: var(--e1); }
.chart-card h4 { font-size: 16px; margin-bottom: 18px; }
.legend { display: flex; flex-wrap: wrap; gap: 18px; margin-top: 16px; }
.legend span { display: inline-flex; align-items: center; gap: 7px; font-size: 12px; color: var(--ink-500); }
.legend i { width: 10px; height: 10px; border-radius: 50%; }

/* ---- viz building blocks ---- */
.viz-blocks {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px; margin-top: 8px; margin-bottom: 8px;
}
.viz-block {
  background: #fff; border: 1px solid var(--line); border-radius: var(--r-xl);
  padding: 20px 20px 16px; box-shadow: var(--e1); display: flex; flex-direction: column; gap: 10px;
}
.viz-block-hd { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px 12px; }
.viz-block-hd h4 { font-size: 15px; font-weight: 800; color: var(--ink-900); margin: 0; }
.viz-block-hd .meta { font-size: 12.5px; font-weight: 500; color: var(--ink-400); }
.viz-block-body { min-height: 180px; }
.viz-block-pie { display: flex; align-items: center; gap: 18px; justify-content: center; flex-wrap: wrap; }

/* donut center label (engagement hero) */
.donut-wrap {
  position: relative;
  display: grid;
  place-items: center;
  flex: none;
}
.donut-wrap > [data-donut] { position: relative; z-index: 0; }
.donut-center {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  pointer-events: none;
  text-align: center;
}
.donut-center-l {
  margin: 0;
  font-size: 10px;
  font-weight: var(--label-font-weight);
  letter-spacing: 0;
  text-transform: none;
  color: var(--ink-400);
  line-height: 1;
}
.donut-center-v {
  margin: 0;
  font-size: 30px;
  font-weight: 700;
  letter-spacing: -.03em;
  line-height: 1;
  color: var(--ink-900);
  font-variant-numeric: tabular-nums;
}
.viz-block .note { margin-top: 0; font-size: 12.5px; }
.pie-legend.compact .pl-row { margin-bottom: 10px; }
.pie-legend.compact .pl-nm { font-size: 13px; }
.pie-legend.compact .pl-v { font-size: 12px; }

.tag { display: inline-block; font-size: 11px; font-weight: 700; font-family: ui-monospace, Menlo, monospace; color: var(--ink-500); background: var(--sunken); border: 1px solid var(--line); border-radius: 4px; padding: 2px 7px; }

/* ---- funnel (rounded trapezoid via SVG) ---- */
.funnel { width: 100%; max-width: 760px; }
.fstep { color: #fff; padding: 34px 70px 36px; position: relative; }
.fstep.gold { margin-top: 10px; }
.fstep > svg.ftrap { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 0; }
.fstep > .ftop, .fstep > .flinks { position: relative; z-index: 1; }
.fstep .ftop { display: grid; grid-template-columns: 1fr minmax(170px,auto) 1fr; align-items: center; gap: 16px; }
.fstep .flabel { font-size: var(--label-font-size); font-weight: var(--label-font-weight); letter-spacing: .12em; text-align: center; white-space: nowrap; }
.fstep .fside { font-size: 13.5px; line-height: 1.35; text-align: center; }
.fstep .fside .big { font-size: 22px; font-weight: 400; display: block; }
.fstep .fmid { text-align: center; }
.fstep .fmid .v { font-size: 36px; font-weight: 400; letter-spacing: -.02em; line-height: 1.05; }
.fstep .fmid .sub { font-size: 12px; color: var(--line); margin-top: 7px; display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.fstep .fspark { justify-self: end; margin-right: 46px; }
.fstep .flinks { text-align: center; margin-top: 22px; display: flex; gap: 26px; justify-content: center; }
.fstep .flinks a { color: var(--line); font-size: 13px; font-weight: 400; text-decoration: underline; text-underline-offset: 3px; white-space: nowrap; }
.fstep .icirc { width: 14px; height: 14px; }

/* ---- horizontal flow funnel ---- */
.funnel-flow {
  --ff-1: var(--dv-teal-300);
  --ff-2: var(--dv-pink-300);
  --ff-3: var(--dv-gold-300);
  --ff-4: var(--dv-green-300);
  --ff-listing: var(--dv-teal-100);
  --ff-engage: var(--dv-pink-100);
  --ff-leads: var(--dv-gold-100);
  --ff-spend: var(--dv-green-100);
  --ff-listing-ink: var(--sec-listing-ink);
  --ff-engage-ink: var(--sec-engage-ink);
  --ff-leads-ink: var(--sec-leads-ink);
  --ff-spend-ink: var(--sec-spend-ink);
  --ff-listing-spark: var(--dv-teal-500);
  --ff-engage-spark: var(--dv-pink-500);
  --ff-leads-spark: var(--dv-gold-500);
  --ff-spend-spark: var(--dv-green-500);
  width: 100%;
  position: relative;
}
.funnel-flow .ff-rail {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  position: relative;
  z-index: 1;
}
.funnel-flow .ff-stage {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 260px;
  padding: 8px 14px 140px 14px;
  cursor: pointer;
  outline: none;
  transition: background-color 280ms var(--ease-out);
}
.funnel-flow .ff-stage + .ff-stage {
  border-left: 1px solid var(--line);
}
.funnel-flow .ff-stage:hover,
.funnel-flow .ff-stage:focus-visible,
.funnel-flow .ff-stage.is-hot {
  background: rgba(20, 23, 28, 0.025);
}
.funnel-flow .ff-stage.is-active {
  border-left-color: transparent;
  cursor: default;
}
.funnel-flow .ff-stage.is-active + .ff-stage {
  border-left-color: transparent;
}
.funnel-flow .ff-meta {
  padding: 4px 0 0;
  opacity: 1;
  transform: translateY(0);
  transition: opacity 360ms var(--ease-out), transform 360ms var(--ease-out);
}
.funnel-flow .ff-stage.is-active .ff-meta {
  opacity: 0;
  transform: translateY(-6px);
  pointer-events: none;
}
.funnel-flow .ff-card {
  position: absolute;
  left: 14px;
  right: 14px;
  top: 8px;
  z-index: 2;
  display: flex;
  flex-direction: column;
  background: var(--ff-card, var(--sec-leads));
  color: var(--ff-card-ink, var(--sec-leads-ink));
  border-radius: var(--r-md);
  padding: 14px 14px 12px;
  box-shadow: var(--e2);
  min-height: 0;
  opacity: 0;
  transform: translateY(10px) scale(0.98);
  pointer-events: none;
  transition: opacity 420ms var(--ease-out), transform 420ms var(--ease-out), background-color 420ms var(--ease-out), color 320ms var(--ease-out), box-shadow 320ms var(--ease-out);
}
.funnel-flow .ff-stage.is-active .ff-card {
  opacity: 1;
  transform: none;
  pointer-events: auto;
}
.funnel-flow .ff-stage[data-tone="listing"] { --ff-card: var(--ff-listing); --ff-card-ink: var(--ff-listing-ink); --ff-spark: var(--ff-listing-spark); }
.funnel-flow .ff-stage[data-tone="engage"] { --ff-card: var(--ff-engage); --ff-card-ink: var(--ff-engage-ink); --ff-spark: var(--ff-engage-spark); }
.funnel-flow .ff-stage[data-tone="leads"] { --ff-card: var(--ff-leads); --ff-card-ink: var(--ff-leads-ink); --ff-spark: var(--ff-leads-spark); }
.funnel-flow .ff-stage[data-tone="spend"] { --ff-card: var(--ff-spend); --ff-card-ink: var(--ff-spend-ink); --ff-spark: var(--ff-spend-spark); }
.funnel-flow .ff-label {
  font-size: var(--label-font-size);
  font-weight: var(--label-font-weight);
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--ink-500);
  line-height: 1.3;
}
.funnel-flow .ff-value {
  margin-top: 6px;
  font-size: 32px;
  font-weight: 600;
  letter-spacing: -.02em;
  color: var(--ink-900);
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.funnel-flow .ff-card .ff-label {
  color: inherit;
  opacity: 0.72;
}
.funnel-flow .ff-card .ff-value {
  color: inherit;
  margin-top: 8px;
  font-size: 24px;          /* Heading 2 */
  font-weight: 600;
  letter-spacing: -.015em;
  line-height: 1.15;
  opacity: 1;
}
.funnel-flow .ff-spark {
  margin-top: 12px;
  width: 70%;
  height: 36px;
  flex: none;
  color: var(--ff-spark, var(--ff-card-ink));
}
.funnel-flow .ff-spark svg {
  display: block;
  width: 100%;
  height: 100%;
}
.funnel-flow .ff-sub {
  margin-top: 10px;
  padding-top: 0;
  font-size: 13px;
  font-weight: 500;
  color: inherit;
  opacity: 0.72;
}
.funnel-flow .ff-pct {
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: auto;
  margin-top: 0;
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
  color: var(--ink-400);
  font-variant-numeric: tabular-nums;
  transition: color 280ms var(--ease-out), top 520ms var(--ease-in-out);
  pointer-events: none;
  z-index: 1;
  transform: translateY(-100%);
}
.funnel-flow .ff-explore {
  margin-top: 10px;
  padding-top: 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: inherit;
  font-size: 13px;
  font-weight: 700;
  width: fit-content;
  opacity: 0.9;
  transition: opacity 200ms var(--ease-out);
}
.funnel-flow .ff-explore:hover { color: inherit; opacity: 1; }
.funnel-flow .ff-explore svg {
  width: 14px;
  height: 14px;
  flex: none;
}
.funnel-flow .ff-viz {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 8px;
  height: 120px;
  pointer-events: none;
  z-index: 0;
}
.funnel-flow .ff-svg {
  width: 100%;
  height: 100%;
  display: block;
  overflow: visible;
}
.funnel-flow.is-opening-pending .ff-viz {
  opacity: 0;
  clip-path: inset(0 100% 0 0);
}
.funnel-flow.is-opening-pending .ff-meta,
.funnel-flow.is-opening-pending .ff-pct {
  opacity: 0;
}
.funnel-flow.is-opening .ff-viz {
  animation: funnelFlowReveal 900ms var(--ease-out) both;
}
.funnel-flow.is-opening .ff-meta {
  animation: funnelFlowMetaReveal 520ms var(--ease-out) both;
}
.funnel-flow.is-opening .ff-pct {
  animation: funnelFlowFade 520ms var(--ease-out) both;
}
.funnel-flow.is-opening .ff-stage:nth-child(2) .ff-meta,
.funnel-flow.is-opening .ff-stage:nth-child(2) .ff-pct { animation-delay: 80ms; }
.funnel-flow.is-opening .ff-stage:nth-child(3) .ff-meta,
.funnel-flow.is-opening .ff-stage:nth-child(3) .ff-pct { animation-delay: 160ms; }
.funnel-flow.is-opening .ff-stage:nth-child(4) .ff-meta,
.funnel-flow.is-opening .ff-stage:nth-child(4) .ff-pct { animation-delay: 240ms; }
@keyframes funnelFlowReveal {
  from {
    opacity: 0;
    clip-path: inset(0 100% 0 0);
  }
  to {
    opacity: 1;
    clip-path: inset(0 0 0 0);
  }
}
@keyframes funnelFlowMetaReveal {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
@keyframes funnelFlowFade {
  from { opacity: 0; }
  to { opacity: 1; }
}
.funnel-flow .ff-svg path[data-role="fill"],
.funnel-flow .ff-svg path:not([data-role]) {
  transition: opacity 380ms var(--ease-out), fill 480ms var(--ease-in-out), filter 380ms var(--ease-out), d 520ms var(--ease-in-out);
  pointer-events: auto;
  cursor: pointer;
}
@media (prefers-reduced-motion: reduce) {
  .funnel-flow.is-opening .ff-viz,
  .funnel-flow.is-opening .ff-meta,
  .funnel-flow.is-opening .ff-pct {
    animation: none;
  }
}
.funnel-flow .ff-svg path[data-role^="edge"] {
  pointer-events: none;
  transition: d 520ms var(--ease-in-out), stroke 480ms var(--ease-in-out);
}
.funnel-flow.is-interacting .ff-svg path[data-role="fill"],
.funnel-flow.is-interacting .ff-svg path:not([data-role]) {
  opacity: 0.42;
}
.funnel-flow.is-interacting .ff-svg path[data-role="fill"].is-hot,
.funnel-flow.is-interacting .ff-svg path[data-role="fill"].is-active,
.funnel-flow.is-interacting .ff-svg path:not([data-role]).is-hot,
.funnel-flow.is-interacting .ff-svg path:not([data-role]).is-active,
.funnel-flow .ff-svg path[data-role="fill"]:hover,
.funnel-flow .ff-svg path:not([data-role]):hover {
  opacity: 1;
  filter: brightness(0.97) saturate(1.05);
}

@media (max-width: 900px) {
  .funnel-flow .ff-rail {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  .funnel-flow .ff-stage,
  .funnel-flow .ff-stage + .ff-stage {
    border-left: 0;
    border-top: 1px solid var(--line);
    padding: 14px 0 0;
    min-height: 0;
  }
  .funnel-flow .ff-stage:first-child { border-top: 0; padding-top: 0; }
  .funnel-flow .ff-card {
    position: relative;
    left: auto;
    right: auto;
    top: auto;
  }
  .funnel-flow .ff-stage.is-active .ff-meta { display: none; }
  .funnel-flow .ff-viz { display: none; }
  .funnel-flow .ff-pct {
    position: static;
    left: auto;
    right: auto;
    top: auto !important;
    margin-top: 8px;
    transform: none;
  }
}

/* ---- pie + legend ---- */
.pie-card { display: flex; align-items: center; gap: 36px; background: #fff; border: 1px solid var(--line); border-radius: var(--r-lg); padding: 26px 32px; box-shadow: var(--e2); }
.pie-legend { flex: 1; }
.pie-legend .pl-row { display: grid; grid-template-columns: 4px 1fr; column-gap: 13px; margin-bottom: 16px; }
.pie-legend .pl-row:last-child { margin-bottom: 0; }
.pie-legend .tick { width: 4px; border-radius: 2px; grid-row: 1 / 3; align-self: stretch; }
.pie-legend .pl-nm { font-size: 15px; font-weight: 600; color: var(--ink-900); white-space: nowrap; }
.pie-legend .pl-v { grid-column: 2; font-size: 13.5px; color: var(--ink-500); margin-top: 2px; }

/* ---- survey result banner (illustration) ---- */
.banner { display: grid; grid-template-columns: 210px 1fr auto 230px; align-items: center; gap: 28px; border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; background: #fff; }
.banner + .banner { margin-top: 16px; }
.banner.good { background: linear-gradient(180deg,#fff 60%,#EAF6EE); }
.banner.warn { background: linear-gradient(180deg,#fff 60%,#FBF3E3); }
.banner.bad  { background: linear-gradient(180deg,#fff 60%,#EEF1F6); }
.banner image-slot { width: 100%; height: 150px; }
.banner .btext { padding: 10px 0; }
.banner .btext h4 { font-size: 24px; letter-spacing: -.015em; }
.banner .btext p { font-size: 15px; line-height: 1.55; color: var(--ink-500); margin-top: 10px; max-width: 42ch; }
.banner .bring { padding-right: 8px; }

/* ---- survey responses + progress bars ---- */
.survey { display: flex; align-items: center; gap: 34px; flex-wrap: wrap; }
.count-box { border: 1px solid var(--line); border-radius: var(--r-lg); padding: 18px 30px; text-align: center; }
.count-box .n { font-size: 36px; font-weight: 400; color: var(--ink-900); line-height: 1; }
.count-box .k { font-size: var(--label-font-size); font-weight: var(--label-font-weight); letter-spacing: .06em; text-transform: uppercase; color: var(--ink-500); margin-top: 8px; line-height: 1.3; }
.bars { flex: 1; min-width: 320px; }
.bar-row { display: flex; align-items: center; gap: 16px; padding: 8px 0; }
.bar-row .lab { width: 150px; font-size: var(--label-font-size); font-weight: var(--label-font-weight); color: var(--ink-700); }
.bar-row .track { flex: 1; height: 10px; background: var(--line-weak); border-radius: var(--r-pill); overflow: hidden; }
.bar-row .track i { display: block; height: 100%; background: var(--purple-accent); border-radius: var(--r-pill); }
.bar-row .val { width: 46px; text-align: right; font-size: 16px; font-weight: 700; color: var(--ink-900); }
.bars .bar-sep { height: 1px; background: var(--line); margin: 10px 0; }

/* ---- shared chart hover tooltip ---- */
.chart-tip {
  position: fixed; z-index: 9999; pointer-events: none;
  background: #fff; color: var(--ink-900); font-family: "Lato", sans-serif; font-size: 13px;
  padding: 8px 12px; border-radius: 10px; border: 1px solid var(--line); box-shadow: var(--e3);
  line-height: 1.5; white-space: nowrap; width: max-content; max-width: min(280px, calc(100vw - 16px));
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px) scale(.96);
  will-change: left, top, opacity, transform;
  transition:
    opacity 200ms var(--ease-out),
    transform 220ms var(--ease-out),
    left 180ms cubic-bezier(.22, .8, .28, 1),
    top 180ms cubic-bezier(.22, .8, .28, 1),
    visibility 0s linear 220ms;
}
.chart-tip.is-on {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
  transition:
    opacity 200ms var(--ease-out),
    transform 220ms var(--ease-out),
    left 180ms cubic-bezier(.22, .8, .28, 1),
    top 180ms cubic-bezier(.22, .8, .28, 1),
    visibility 0s linear 0s;
}
.chart-tip.is-leaving {
  opacity: 0;
  visibility: hidden;
  transform: translateY(4px) scale(.98);
  transition:
    opacity 160ms var(--ease-out),
    transform 160ms var(--ease-out),
    visibility 0s linear 160ms;
}
.chart-tip .tt-title { font-size: 15px; font-weight: 800; color: var(--ink-900); text-align: center; padding-bottom: 9px; margin-bottom: 9px; border-bottom: 1px solid var(--line); }
.chart-tip .tt-total { display: flex; justify-content: space-between; align-items: center; font-weight: 800; font-size: 14px; color: var(--ink-900); margin-bottom: 9px; }
.chart-tip .tt-k { color: var(--ink-400); font-weight: 800; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; margin-bottom: 6px; }
.chart-tip b { color: var(--ink-900); }
.chart-tip .tt-r { display: flex; align-items: center; gap: 9px; }
.chart-tip .tt-r + .tt-r { margin-top: 5px; }
.chart-tip .tt-r i { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.chart-tip .tt-r .nm { font-weight: 600; color: var(--ink-700); }
.chart-tip .tt-r .v { font-weight: 800; margin-left: auto; padding-left: 16px; color: var(--ink-900); }
.chart-tip .tt-r .c { color: var(--ink-400); font-weight: 600; padding-left: 8px; }

/* ---- purple point tooltip on area chart (interactive) ---- */
.area-demo { position: relative; width: 100%; max-width: 560px; }
.area-demo .pdot, .area-demo .pline, .area-demo .ptip { pointer-events: none; }
.ptip { position: absolute; background: var(--purple-accent); color: #fff; border-radius: 12px; padding: 9px 18px; text-align: center; box-shadow: var(--e2); transform: translate(22px, -50%); transition: left .14s ease-out, top .14s ease-out; }
.ptip .pd { font-size: 13px; opacity: .92; white-space: nowrap; }
.ptip b { display: block; font-size: 19px; font-weight: 700; margin-top: 1px; }
.ptip::before { content: ""; position: absolute; left: -7px; top: 50%; transform: translateY(-50%); border: 7px solid transparent; border-right-color: var(--purple-accent); border-left: 0; }
.ptip.flip { transform: translate(calc(-100% - 22px), -50%); }
.ptip.flip::before { left: auto; right: -7px; border: 7px solid transparent; border-left-color: var(--purple-accent); border-right: 0; }
.area-demo .pdot { position: absolute; width: 13px; height: 13px; border-radius: 50%; background: var(--purple-accent); border: 3px solid #fff; box-shadow: 0 0 0 1px var(--purple-accent); transform: translate(-50%, -50%); transition: left .14s ease-out, top .14s ease-out; }
.area-demo .pline { position: absolute; width: 2px; background: var(--purple-accent); opacity: .5; transform: translateX(-50%); transition: left .14s ease-out, top .14s ease-out, height .14s ease-out; }

/* ---- ROI calculator (sliders + linked inputs) ---- */
.roi-calc { display: flex; flex-direction: column; align-items: stretch; gap: 6px; width: 100%; }
.roi-card { width: 100%; min-width: 0; border: 1px solid var(--line); border-radius: var(--r-lg); background: #fff; box-shadow: var(--e1); display: flex; flex-direction: column; }
.roi-card .rc-hd { text-align: center; font-size: 16px; font-weight: 700; color: var(--ink-900); padding: 15px; border-bottom: 1px solid var(--line); }
.roi-card .rc-bd { padding: 22px 22px 20px; flex: 1; display: flex; flex-direction: column; }
.roi-arrow { align-self: center; color: var(--ink-300); flex: 0 0 auto; }
.roi-arrow svg { width: 22px; height: 22px; display: block; transform: rotate(90deg); }
.rc-slabel { font-size: var(--label-font-size); font-weight: var(--label-font-weight); color: var(--ink-700); margin-bottom: 16px; }
input[type=range].roi { -webkit-appearance: none; appearance: none; width: 100%; height: 6px; border-radius: var(--r-pill); background: var(--line); outline: none; cursor: pointer; }
input[type=range].roi::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 17px; height: 17px; border-radius: 50%; background: var(--purple-500); border: 3px solid #fff; box-shadow: 0 0 0 6px rgba(124,113,192,.18), var(--e1); }
input[type=range].roi::-moz-range-thumb { width: 14px; height: 14px; border-radius: 50%; background: var(--purple-500); border: 3px solid #fff; box-shadow: 0 0 0 6px rgba(124,113,192,.18); }
.eq { display: flex; align-items: flex-start; justify-content: center; gap: 22px; margin-top: auto; padding-top: 24px; flex-wrap: wrap; }
.eq .cell { display: grid; grid-template-rows: 40px auto; align-items: center; justify-items: center; row-gap: 10px; }
.eq .val { font-size: 15px; font-weight: 600; color: var(--ink-900); }
.eq .val.derived { border-bottom: 1.5px dashed var(--ink-300); padding-bottom: 2px; }
.eq .box { font-family: inherit; appearance: none; -webkit-appearance: none; border: 1px solid var(--brand-border); border-radius: var(--r-md); padding: 8px 8px; width: 70px; color: var(--brand); font-weight: 700; font-size: 15px; text-align: center; background: #fff; outline: none; }
.eq .box:hover { border-color: var(--brand-hover); }
.eq .box:focus { border-color: var(--brand-border); box-shadow: 0 0 0 3px var(--brand-weak); }
.eq .op { font-size: 17px; color: var(--ink-400); align-self: flex-start; height: 40px; display: flex; align-items: center; }
.eq .cap { font-size: var(--label-font-size); font-weight: var(--label-font-weight); letter-spacing: .06em; text-transform: uppercase; color: var(--ink-400); white-space: nowrap; line-height: 1.2; }
.roi-res { padding: 28px 22px; text-align: center; flex: 1; display: flex; flex-direction: column; justify-content: center; }
.roi-res .rr-top { display: flex; align-items: center; justify-content: center; gap: 16px; }
.roi-res .rr-num { font-size: 16px; font-weight: 600; color: var(--ink-900); border-bottom: 1.5px dashed var(--ink-300); padding-bottom: 2px; }
.roi-res .rr-cap { font-size: var(--label-font-size); font-weight: var(--label-font-weight); letter-spacing: .05em; text-transform: uppercase; color: var(--ink-400); margin-top: 8px; }
.roi-res .rr-big { font-size: 46px; font-weight: 400; color: var(--ink-900); letter-spacing: -.02em; margin-top: 18px; transition: color .25s ease; }

/* ---- standalone slider ---- */
.slider-field { width: 100%; max-width: 440px; }
.slider-field .sf-top { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 13px; }
.slider-field .sf-label { font-size: var(--label-font-size); color: var(--ink-700); font-weight: var(--label-font-weight); }
.slider-field .sf-val { font-size: 15px; font-weight: 700; color: var(--brand); font-variant-numeric: tabular-nums; }

/* ---- smoother interaction transitions ---- */
.sidenav a, .toc a, .topbar nav a, .crumb, .rail-demo .ic, .pie-legend .pl-row,
.field .select, .badge, .flinks a, .nav-group-title, .nav-subgroup-title { transition: color var(--motion-standard) var(--ease-out), background-color var(--motion-standard) var(--ease-out), border-color var(--motion-standard) var(--ease-out), box-shadow var(--motion-standard) var(--ease-out); }
.swatch, .dv-item, .icon-cell, .corp, .kpi, .banner, .chart-card, .cc, .count-box { transition: box-shadow .22s var(--ease-out), transform .22s var(--ease-out), border-color var(--motion-standard) var(--ease-out); }
.btn, .select, .pin { transition: background-color var(--motion-micro) var(--ease-out), box-shadow var(--motion-micro) var(--ease-out), color var(--motion-micro) var(--ease-out), transform var(--motion-micro) var(--ease-out); }
.btn:active { transform: translateY(1px); }
.icon-cell:hover { box-shadow: var(--e1); transform: translateY(-2px); border-color: var(--line); }
.corp:hover, .chart-card:hover, .count-box:hover { box-shadow: var(--e2); }
input[type=range].roi { transition: background var(--motion-micro) var(--ease-out); }
input[type=range].roi::-webkit-slider-thumb { transition: box-shadow var(--motion-micro) var(--ease-out), transform var(--motion-micro) var(--ease-out); }
input[type=range].roi:active::-webkit-slider-thumb { transform: scale(1.12); box-shadow: 0 0 0 8px rgba(124,113,192,.18), var(--e1); }
.eq .val, .eq .box, .rr-num { transition: color .25s var(--ease-out), border-color var(--motion-standard) var(--ease-out); }
.tbl-next { transition: background-color var(--motion-micro) var(--ease-out), opacity var(--motion-standard) var(--ease-out); }

/* ---- tooltip / popover reveal (standard 200ms) ---- */
@keyframes tipIn { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }
.ttip, .pin { animation: tipIn var(--motion-standard) var(--ease-out); }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}

footer { border-top: 1px solid var(--line); margin-top: 90px; padding: 30px 0 0; color: var(--ink-400); font-size: 13px; display: flex; justify-content: space-between; align-items: center; width: 100%; gap: 16px; flex-wrap: wrap; }

@media (max-width: 1180px){
  .layout { grid-template-columns: 240px minmax(0, 1fr); }
  .content-shell { grid-template-columns: minmax(0, 1fr); max-width: 1040px; }
  .toc { display: none; }
}
@media (max-width: 880px){
  .layout { grid-template-columns: 1fr; }
  .content-shell { max-width: none; }
  .sidenav { display: none; }
  main { padding: 36px 24px 90px; }
  .topbar nav { display: none; }
}
