/* =========================================================
   V4 Design System — Main Stylesheet
   CardzGroup Analytics Platform
   ---------------------------------------------------------
   Typeface Triad:
     --serif : Newsreader (Soul)
     --sans  : Host Grotesk (Skeleton)
     --mono  : IBM Plex Mono (Precision)
   ========================================================= */

/* --- Custom Properties ---------------------------------- */

:root {
  --serif: "Newsreader", Georgia, serif;
  --sans: "Host Grotesk", system-ui, sans-serif;
  --mono: "IBM Plex Mono", monospace;

  --paper: #f7f1e7;
  --paper-strong: #fffaf4;
  --paper-deep: #efe5d7;
  --ink: #111922;
  --ink-soft: #203241;
  --ink-muted: #67707a;
  --ink-faint: #8a929d;
  --line: rgba(17, 25, 34, 0.12);
  --line-strong: rgba(17, 25, 34, 0.22);
  --card: rgba(255, 250, 244, 0.82);
  --card-strong: rgba(255, 253, 248, 0.94);
  --panel: #101922;
  --panel-soft: #182330;
  --panel-line: rgba(255, 255, 255, 0.08);
  --panel-text: #edf2f5;
  --panel-muted: rgba(237, 242, 245, 0.68);
  --cyan: #4fb8f5;
  --cyan-strong: #0d8bd8;
  --amber: #f1a643;
  --amber-soft: #ffe0b8;
  --green: #3bb47c;
  --red: #d96573;
  --plum: #7365de;
  --sand: #d9c6ab;
  --shadow-lg: 0 28px 90px rgba(17, 25, 34, 0.14);
  --shadow-md: 0 12px 38px rgba(17, 25, 34, 0.10);
  --shadow-sm: 0 4px 14px rgba(17, 25, 34, 0.06);
  --radius-xl: 28px;
  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-sm: 10px;
  --content-width: 1440px;
  --gutter: 28px;
}


/* --- Reset ---------------------------------------------- */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: var(--sans);
  background:
    radial-gradient(circle at top left, rgba(79, 184, 245, 0.12), transparent 32%),
    radial-gradient(circle at 85% 0%, rgba(241, 166, 67, 0.18), transparent 28%),
    linear-gradient(180deg, #faf5ed 0%, #f5eee4 46%, #f1e7d9 100%);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(rgba(17, 25, 34, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(17, 25, 34, 0.03) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(circle at center, black 22%, transparent 90%);
  opacity: 0.3;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}


/* --- Selection ------------------------------------------ */

::selection {
  background: rgba(79, 184, 245, 0.22);
  color: var(--ink);
}


/* --- Custom Scrollbar ----------------------------------- */

::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-thumb {
  background: rgba(17, 25, 34, 0.22);
  border-radius: 999px;
}

::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.2);
}

* {
  scrollbar-width: thin;
  scrollbar-color: rgba(17, 25, 34, 0.22) transparent;
}


/* --- Shell & Layout ------------------------------------- */

.site-shell {
  position: relative;
  z-index: 1;
  max-width: var(--content-width);
  margin: 0 auto;
  padding: 20px var(--gutter) 64px;
}


/* --- Top Bar -------------------------------------------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(20px);
  background: rgba(247, 241, 231, 0.76);
  border-bottom: 1px solid rgba(17, 25, 34, 0.08);
}

.topbar-inner {
  max-width: var(--content-width);
  margin: 0 auto;
  padding: 14px var(--gutter);
  display: flex;
  align-items: center;
  gap: 22px;
}

.brand-lockup {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.brand-logo-link {
  display: flex;
  align-items: center;
}

.brand-logo-full {
  height: 36px;
  width: auto;
  flex-shrink: 0;
}

.brand-logo {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
}

.brand-text {
  display: grid;
  gap: 3px;
}

.brand-kicker {
  color: var(--ink-muted);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}

.brand-title {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.topbar-nav {
  display: flex;
  gap: 6px;
  flex-wrap: nowrap;
  overflow: auto;
  scrollbar-width: none;
}

.topbar-nav::-webkit-scrollbar {
  display: none;
}

.topbar-link {
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 8px 12px;
  color: var(--ink-muted);
  font-size: 12px;
  font-weight: 600;
  transition: 180ms ease;
  white-space: nowrap;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}

.topbar-link:hover,
.topbar-link.is-active,
.topbar-link[aria-current="page"] {
  color: var(--ink);
  border-color: rgba(17, 25, 34, 0.08);
  background: rgba(255, 255, 255, 0.7);
}

.topbar-link:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 2px;
}

.utility-cluster {
  margin-left: auto;
  display: flex;
  gap: 10px;
  align-items: center;
}

.utility-pill {
  border-radius: 999px;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.65);
  border: 1px solid rgba(17, 25, 34, 0.08);
  color: var(--ink-muted);
  font-size: 12px;
}


/* --- Grid Systems --------------------------------------- */

.hero-grid,
.two-up,
.three-up,
.dashboard-grid,
.magazine-grid,
.compare-layout,
.deepdive-grid,
.waterfall-grid {
  display: grid;
  gap: 20px;
}

.hero-grid {
  grid-template-columns: minmax(0, 1.7fr) minmax(320px, 0.9fr);
  align-items: stretch;
  margin-top: 26px;
}

.two-up {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.three-up {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.dashboard-grid {
  grid-template-columns: minmax(0, 1.4fr) minmax(320px, 0.8fr);
}

.magazine-grid {
  grid-template-columns: minmax(0, 1.35fr) minmax(320px, 0.75fr);
}

.compare-layout {
  grid-template-columns: 300px minmax(0, 1fr);
  align-items: start;
}

.deepdive-grid {
  grid-template-columns: minmax(0, 1.25fr) minmax(320px, 0.85fr);
}

.waterfall-grid {
  grid-template-columns: minmax(0, 1.4fr) minmax(320px, 0.8fr);
}

.workspace-grid {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

.analytics-stack {
  display: grid;
  gap: 20px;
}

.span-all {
  grid-column: 1 / -1;
}


/* --- Cards ---------------------------------------------- */

.card,
.hero-card,
.metric-card,
.signal-card,
.chart-card,
.table-card,
.story-card,
.selector-card,
.insight-card {
  background: var(--card);
  border: 1px solid rgba(17, 25, 34, 0.08);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
}

.hero-card {
  overflow: hidden;
  min-height: 420px;
  position: relative;
  padding: 28px;
  background:
    radial-gradient(circle at 15% 20%, rgba(79, 184, 245, 0.18), transparent 32%),
    radial-gradient(circle at 80% 10%, rgba(241, 166, 67, 0.2), transparent 26%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.82), rgba(255, 253, 248, 0.92));
}

.hero-card.hero-dark {
  color: var(--panel-text);
  background:
    radial-gradient(circle at 15% 20%, rgba(79, 184, 245, 0.22), transparent 28%),
    radial-gradient(circle at 75% 10%, rgba(241, 166, 67, 0.26), transparent 22%),
    linear-gradient(180deg, #101922 0%, #141f2a 100%);
  border-color: rgba(255, 255, 255, 0.06);
}

.hero-card::after {
  content: "";
  position: absolute;
  inset: auto -40px -90px auto;
  width: 260px;
  aspect-ratio: 1;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(79, 184, 245, 0.24), transparent 72%);
  filter: blur(8px);
}


/* --- Typography ----------------------------------------- */

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink-muted);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}

.hero-dark .eyebrow {
  color: var(--panel-muted);
}

.display {
  margin: 18px 0 16px;
  font-family: var(--serif);
  font-size: clamp(42px, 5vw, 74px);
  line-height: 0.95;
  letter-spacing: -0.05em;
  font-weight: 540;
}

.lede {
  max-width: 62ch;
  color: var(--ink-soft);
  font-size: 17px;
}

.hero-dark .lede {
  color: rgba(237, 242, 245, 0.74);
}


/* --- Hero Footer & Metrics ------------------------------ */

.hero-footer {
  margin-top: 28px;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.hero-metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 30px;
}

.metric-card {
  padding: 18px;
  display: grid;
  gap: 6px;
}

.metric-label,
.chart-kicker,
.table-kicker {
  color: var(--ink-muted);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-family: var(--mono);
}

.metric-value,
.signal-value,
.stat-value {
  font-size: clamp(30px, 3.2vw, 48px);
  font-weight: 700;
  letter-spacing: -0.04em;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}

.metric-value,
.signal-value,
.mono {
  font-family: var(--mono);
}

.metric-meta,
.signal-meta,
.support-copy {
  color: var(--ink-muted);
  font-size: 13px;
}

.hero-dark .metric-card,
.hero-dark .signal-card,
.panel-dark {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0.01));
  border-color: var(--panel-line);
  box-shadow: none;
}

.hero-dark .metric-label,
.hero-dark .metric-meta,
.hero-dark .signal-meta {
  color: var(--panel-muted);
}

.hero-dark .metric-value,
.hero-dark .signal-value,
.hero-dark .signal-title {
  color: var(--panel-text);
}


/* --- Signal Cards --------------------------------------- */

.signal-stack {
  display: grid;
  gap: 14px;
}

.signal-card {
  padding: 18px;
}

.signal-title {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.03em;
}


/* --- Section Spacing ------------------------------------ */

.section {
  margin-top: 36px;
}

.section.is-major {
  margin-top: 56px;
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 20px;
  margin: 10px 0 16px;
}

.section-title {
  margin: 6px 0 0;
  font-family: var(--serif);
  font-size: clamp(28px, 3vw, 44px);
  line-height: 0.98;
  letter-spacing: -0.04em;
  font-weight: 650;
}

.section-copy {
  max-width: 58ch;
  color: var(--ink-muted);
  font-size: 15px;
}


/* --- Chart & Table Cards -------------------------------- */

.chart-card,
.table-card,
.story-card,
.selector-card,
.insight-card {
  padding: 20px;
}

.chart-head,
.table-head,
.story-head {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 12px;
  margin-bottom: 16px;
}

.chart-title,
.table-title,
.story-title {
  margin: 6px 0 0;
  font-size: 24px;
  line-height: 1.02;
  letter-spacing: -0.04em;
}

.chart-meta {
  color: var(--ink-muted);
  font-size: 13px;
  max-width: 36ch;
}

/*
 * Chart sizing strategy (like Stripe/Linear/Datadog):
 *   - Always fill 100% container width
 *   - Height uses clamp(): minimum for readability, preferred
 *     scales with viewport, maximum prevents overflow
 *   - No aspect-ratio — ECharts fills whatever box it gets
 */
.chart-frame {
  width: 100%;
  height: clamp(300px, 50vh, calc(100vh - 200px));
}

.chart-frame.is-wide {
  height: clamp(340px, 55vh, calc(100vh - 180px));
}

.chart-frame.is-hero {
  height: clamp(380px, 60vh, calc(100vh - 160px));
}

.chart-frame.is-tall {
  height: clamp(360px, 62vh, calc(100vh - 200px));
}

.chart-frame.is-compact {
  height: clamp(220px, 36vh, 400px);
}

/* Chart Controls */
.chart-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 12px;
}

/* Year stepper: arrows + dropdown on a single row */
.chart-controls .select-control {
  width: auto;
  min-width: 80px;
}

.chart-controls .pill-btn {
  padding: 6px 10px;
  min-height: 36px;
  font-size: 13px;
}

.control-label {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-muted);
  font-weight: 600;
}


/* --- Story Items ---------------------------------------- */

.story-list,
.signal-list,
.insight-list {
  display: grid;
  gap: 10px;
}

.story-item,
.insight-item {
  display: grid;
  gap: 4px;
  padding: 16px;
  background: rgba(255, 255, 255, 0.56);
  border: 1px solid rgba(17, 25, 34, 0.08);
  border-radius: var(--radius-md);
}

.story-metric {
  font-family: var(--mono);
  font-size: 15px;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.story-copy {
  color: var(--ink-muted);
  font-size: 14px;
}


/* --- KPI Row -------------------------------------------- */

.kpi-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.kpi-row.is-5col {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.kpi-tile {
  padding: 18px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(17, 25, 34, 0.08);
  background: rgba(255, 255, 255, 0.72);
  display: grid;
  gap: 6px;
}

.kpi-tile em {
  font-style: normal;
  color: var(--ink-muted);
}

.kpi-tile .metric-value,
.kpi-tile .stat-value {
  font-variant-numeric: tabular-nums;
}


/* --- Chips & Filters ------------------------------------ */

.chip-row,
.filter-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.control-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.control-stack {
  display: grid;
  gap: 8px;
}

.inline-select {
  width: auto;
  min-width: 138px;
}

.mini-button,
.toggle-button {
  border: 1px solid rgba(17, 25, 34, 0.12);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.75);
  color: var(--ink);
  padding: 10px 14px;
  font-size: 12px;
  font-weight: 700;
  transition: 160ms ease;
  min-height: 44px;
}

.mini-button:hover,
.toggle-button:hover,
.toggle-button.is-active {
  transform: translateY(-1px);
  background: rgba(79, 184, 245, 0.12);
  border-color: rgba(13, 139, 216, 0.28);
}

.mini-button:focus-visible,
.toggle-button:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 2px;
}

.toggle-cluster {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 999px;
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 700;
  border: 1px solid transparent;
  background: rgba(17, 25, 34, 0.06);
}

.chip-positive {
  color: #145e3c;
  background: rgba(59, 180, 124, 0.16);
}

.chip-negative {
  color: #8c2230;
  background: rgba(217, 101, 115, 0.16);
}

.chip-neutral {
  color: var(--ink-muted);
}


/* --- Pill Button (Glass Pill) --------------------------- */

.pill-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(17, 25, 34, 0.08);
  border-radius: 100px;
  padding: 4px 12px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ink-muted);
  cursor: pointer;
  transition: 180ms ease;
  min-height: 44px;
}

.pill-btn:hover {
  background: rgba(79, 184, 245, 0.1);
  border-color: rgba(13, 139, 216, 0.2);
  color: var(--ink);
}

.pill-btn.is-active {
  background: rgba(79, 184, 245, 0.14);
  border-color: rgba(13, 139, 216, 0.28);
  color: var(--ink);
}

.pill-btn:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 2px;
}

.hero-dark .pill-btn {
  color: var(--panel-muted);
  border-color: rgba(255, 255, 255, 0.1);
}

.hero-dark .pill-btn:hover,
.hero-dark .pill-btn.is-active {
  background: rgba(79, 184, 245, 0.15);
  color: var(--panel-text);
}


/* --- Form Controls -------------------------------------- */

.control,
.select-control,
.search-control {
  width: 100%;
  border-radius: 12px;
  border: 1px solid rgba(17, 25, 34, 0.14);
  background: rgba(255, 255, 255, 0.78);
  color: var(--ink);
  padding: 12px 14px;
  outline: none;
  transition: border-color 180ms ease, box-shadow 180ms ease;
}

.control:focus,
.select-control:focus,
.search-control:focus {
  border-color: rgba(13, 139, 216, 0.55);
  box-shadow: 0 0 0 3px rgba(79, 184, 245, 0.12);
}

.control:focus-visible,
.select-control:focus-visible,
.search-control:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 2px;
}


/* --- Selector Card (Sidebar) ---------------------------- */

.selector-card {
  position: sticky;
  top: 88px;
  display: grid;
  gap: 16px;
}

.customer-list {
  display: grid;
  gap: 8px;
  max-height: 560px;
  overflow: auto;
  padding-right: 4px;
}

.customer-option {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 12px 13px;
  border-radius: 12px;
  border: 1px solid rgba(17, 25, 34, 0.08);
  background: rgba(255, 255, 255, 0.66);
  color: var(--ink);
  transition: 160ms ease;
  min-height: 44px;
}

.customer-option:hover,
.customer-option.is-selected {
  transform: translateY(-1px);
  border-color: rgba(13, 139, 216, 0.28);
  box-shadow: 0 12px 24px rgba(17, 25, 34, 0.08);
}

.customer-option.is-selected {
  background: linear-gradient(180deg, rgba(79, 184, 245, 0.16), rgba(255, 255, 255, 0.92));
}

.customer-option:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 2px;
}

.customer-name {
  font-size: 14px;
  font-weight: 700;
}

.customer-revenue {
  color: var(--ink-muted);
  font-family: var(--mono);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.selected-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.selected-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 999px;
  background: rgba(17, 25, 34, 0.08);
  font-size: 12px;
  font-weight: 700;
}

.selected-pill button {
  border: 0;
  background: transparent;
  color: inherit;
  padding: 0;
  min-width: 24px;
  min-height: 24px;
}


/* --- Tables --------------------------------------------- */

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 12px 10px;
  text-align: left;
  border-bottom: 1px solid rgba(17, 25, 34, 0.08);
  vertical-align: top;
}

th {
  color: var(--ink-muted);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

th.num {
  text-align: right;
  font-family: var(--mono);
}

td {
  font-size: 14px;
}

td.num {
  text-align: right;
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
}

.table-wrap {
  overflow: auto;
}

.table-toolbar {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.table-toolbar .search-control {
  max-width: 280px;
}

.table-sort {
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  padding: 0;
  text-transform: inherit;
  letter-spacing: inherit;
  cursor: pointer;
}

.table-sort:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 2px;
}

.table-sort.is-active {
  color: var(--ink);
}


/* --- Leaderboard Rows ----------------------------------- */

.lb-row {
  display: grid;
  grid-template-columns: 36px 1.5fr 1fr 1fr 0.8fr;
  gap: 10px;
  align-items: center;
  padding: 12px 14px;
  border-bottom: 1px solid rgba(17, 25, 34, 0.06);
  transition: background 160ms ease;
}

.lb-row:hover {
  background: rgba(255, 255, 255, 0.5);
}

.lb-detail-row {
  display: grid;
  grid-template-columns: 36px 1fr;
  gap: 10px;
  padding: 0 14px 14px;
  font-size: 13px;
  color: var(--ink-muted);
  border-bottom: 1px solid rgba(17, 25, 34, 0.06);
}

.lb-detail-row > :first-child {
  grid-column: 2 / -1;
}


/* --- Mover Visualization -------------------------------- */

.mover-bar-track {
  width: 100%;
  height: 8px;
  border-radius: 999px;
  background: rgba(17, 25, 34, 0.06);
  overflow: hidden;
  position: relative;
}

.mover-bar {
  height: 100%;
  border-radius: 999px;
  transition: width 600ms ease;
  min-width: 2px;
}

.mover-bar.is-positive {
  background: var(--green);
}

.mover-bar.is-negative {
  background: var(--red);
}

.mover-value {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}


/* --- Lifecycle Grid ------------------------------------- */

.lifecycle-grid {
  display: grid;
  gap: 2px;
}

.lifecycle-header {
  display: grid;
  grid-template-columns: 120px repeat(auto-fill, minmax(40px, 1fr));
  gap: 2px;
  padding: 4px 0;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-muted);
}

.lifecycle-row {
  display: grid;
  grid-template-columns: 120px repeat(auto-fill, minmax(40px, 1fr));
  gap: 2px;
  align-items: center;
  padding: 3px 0;
  font-size: 12px;
}

.lifecycle-row:hover {
  background: rgba(255, 255, 255, 0.4);
}


/* --- List & Misc Layout --------------------------------- */

.list-split {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.eyebrow-stack {
  display: grid;
  gap: 8px;
}

.link-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 9px 14px;
  border-radius: 999px;
  border: 1px solid rgba(17, 25, 34, 0.12);
  background: rgba(255, 255, 255, 0.8);
  color: var(--ink);
  font-size: 12px;
  font-weight: 700;
  min-height: 44px;
}

.link-chip:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 2px;
}


/* --- Delta Indicators ----------------------------------- */

.delta-up {
  color: #1b7b4e;
}

.delta-down {
  color: #a63b49;
}


/* --- Badge ---------------------------------------------- */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  width: fit-content;
  padding: 7px 11px;
  border-radius: 999px;
  background: rgba(17, 25, 34, 0.06);
  color: var(--ink);
  font-size: 12px;
  font-weight: 700;
}

.badge.is-dark {
  background: rgba(255, 255, 255, 0.08);
  color: var(--panel-text);
}


/* --- Health Score Badge --------------------------------- */

.health-badge {
  display: inline-flex;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 600;
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.03em;
}

.health-excellent {
  background: rgba(59, 180, 124, 0.1);
  color: #3bb47c;
}

.health-healthy {
  background: rgba(79, 184, 245, 0.1);
  color: #4fb8f5;
}

.health-at-risk {
  background: rgba(241, 166, 67, 0.1);
  color: #f1a643;
}

.health-critical {
  background: rgba(217, 101, 115, 0.1);
  color: #d96573;
}


/* --- Info Circle (Hover Tooltip) ------------------------ */

.info-circle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: rgba(17, 25, 34, 0.06);
  color: var(--ink-muted);
  font-size: 10px;
  font-weight: 700;
  cursor: help;
  position: relative;
  vertical-align: middle;
}

/* Portal tooltip — positioned by JS, appended to <body> */
.info-pane-portal {
  position: fixed;
  width: 320px;
  padding: 16px;
  background: rgba(17, 25, 34, 0.96);
  color: #f8f4ee;
  border-radius: 12px;
  font-size: 12px;
  line-height: 1.6;
  font-weight: 400;
  letter-spacing: 0;
  text-transform: none;
  z-index: 2147483647;
  backdrop-filter: blur(20px);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.3);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s ease;
}

.info-pane-portal.is-visible {
  opacity: 1 !important;
}

/* Arrow — positioned via --arrow-left CSS var set by JS */
.info-pane-portal::after {
  content: "";
  position: absolute;
  left: var(--arrow-left, 50%);
  transform: translateX(-50%);
  border: 6px solid transparent;
}

.info-pane-portal--above::after {
  top: 100%;
  border-top-color: rgba(17, 25, 34, 0.96);
}

.info-pane-portal--below::after {
  bottom: 100%;
  border-bottom-color: rgba(17, 25, 34, 0.96);
}

/* Fallback for info-pane still in DOM (hidden, JS takes over) */
.info-pane {
  display: none;
}


/* --- Split Note ----------------------------------------- */

.split-note {
  display: grid;
  gap: 8px;
  padding: 18px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.56);
  border: 1px solid rgba(17, 25, 34, 0.08);
}

.split-note strong {
  font-size: 16px;
  letter-spacing: -0.03em;
}


/* --- Sparkline ------------------------------------------ */

.sparkline {
  display: flex;
  align-items: end;
  gap: 4px;
  height: 42px;
}

.sparkline span {
  flex: 1;
  border-radius: 999px 999px 4px 4px;
  background: linear-gradient(180deg, rgba(79, 184, 245, 0.9), rgba(79, 184, 245, 0.28));
}


/* --- Matrix --------------------------------------------- */

.matrix {
  display: grid;
  gap: 4px;
}

.matrix-row {
  display: grid;
  grid-template-columns: 64px repeat(12, minmax(0, 1fr));
  gap: 4px;
  align-items: center;
}

.matrix-label {
  color: var(--ink-muted);
  font-size: 12px;
  text-align: right;
}

.matrix-cell {
  height: 30px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-family: var(--mono);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}


/* --- Reveal Animation ----------------------------------- */

[data-reveal] {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 420ms ease, transform 420ms ease;
}

[data-reveal].is-visible {
  opacity: 1;
  transform: translateY(0);
}


/* --- Staggered Card Grid Animation ---------------------- */

[data-reveal-stagger] > * {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 420ms ease, transform 420ms ease;
}

[data-reveal-stagger].is-visible > *:nth-child(1) { transition-delay: 0ms; }
[data-reveal-stagger].is-visible > *:nth-child(2) { transition-delay: 60ms; }
[data-reveal-stagger].is-visible > *:nth-child(3) { transition-delay: 120ms; }
[data-reveal-stagger].is-visible > *:nth-child(4) { transition-delay: 180ms; }
[data-reveal-stagger].is-visible > *:nth-child(5) { transition-delay: 240ms; }
[data-reveal-stagger].is-visible > *:nth-child(6) { transition-delay: 300ms; }
[data-reveal-stagger].is-visible > *:nth-child(7) { transition-delay: 360ms; }
[data-reveal-stagger].is-visible > *:nth-child(8) { transition-delay: 420ms; }

[data-reveal-stagger].is-visible > * {
  opacity: 1;
  transform: translateY(0);
}


/* --- Empty State ---------------------------------------- */

.empty-block {
  min-height: 220px;
  display: grid;
  place-items: center;
  color: var(--ink-muted);
  border-radius: var(--radius-lg);
  border: 1px dashed rgba(17, 25, 34, 0.14);
  background: rgba(255, 255, 255, 0.44);
}


/* --- Footer --------------------------------------------- */

.site-footer {
  margin-top: 64px;
  padding: 28px var(--gutter);
  border-top: 1px solid rgba(17, 25, 34, 0.08);
}

.footer-inner {
  max-width: var(--content-width);
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.footer-brand {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-muted);
}

.footer-meta {
  font-size: 12px;
  color: var(--ink-faint);
}

.footer-note {
  margin-top: 28px;
  color: var(--ink-muted);
  font-size: 12px;
  font-family: var(--mono);
}


/* --- Utility Classes ------------------------------------ */

.tabular-nums {
  font-variant-numeric: tabular-nums;
}

.font-serif {
  font-family: var(--serif);
}

.font-mono {
  font-family: var(--mono);
}


/* =========================================================
   STRATEGIC INTELLIGENCE — Mega Stats, Scorecard, Intel Cards
   ========================================================= */

/* --- Mega Stat Hero Row --------------------------------- */

.mega-stat-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
  margin: 24px 0 18px;
}

.mega-stat {
  display: grid;
  gap: 4px;
}

.mega-stat-value {
  font-family: var(--mono);
  font-size: clamp(36px, 4.5vw, 64px);
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.04em;
  font-variant-numeric: tabular-nums;
  color: var(--panel-text);
}

.mega-stat-label {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--panel-muted);
  margin-top: 6px;
}

.mega-stat-sub {
  font-size: 12px;
  color: rgba(237, 242, 245, 0.52);
}


/* --- Scorecard Grid ------------------------------------- */

.scorecard-grid {
  display: grid;
  gap: 2px;
}

.scorecard-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 12px;
  align-items: center;
  padding: 11px 14px;
  background: rgba(255, 255, 255, 0.56);
  border: 1px solid rgba(17, 25, 34, 0.06);
  border-radius: 10px;
  transition: background 160ms ease;
}

.scorecard-row:hover {
  background: rgba(255, 255, 255, 0.78);
}

.scorecard-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-soft);
  letter-spacing: -0.01em;
}

.scorecard-value {
  font-family: var(--mono);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  color: var(--ink-muted);
  text-align: right;
}

.scorecard-grade {
  font-family: var(--mono);
  font-size: 14px;
  font-weight: 700;
  width: 28px;
  text-align: center;
  letter-spacing: 0.05em;
}


/* --- Intelligence Cards --------------------------------- */

.intel-card {
  display: grid;
  gap: 14px;
}

.intel-card-head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.intel-card-title {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.2;
}

.intel-action {
  display: grid;
  gap: 6px;
  padding: 14px 16px;
  border-radius: 10px;
  background: rgba(79, 184, 245, 0.06);
  border: 1px solid rgba(79, 184, 245, 0.12);
}

.intel-action-label {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--cyan-strong);
}

.intel-action-text {
  font-size: 13px;
  color: var(--ink-soft);
  line-height: 1.55;
}


/* --- Health Grid (Small Multiples) ---------------------- */

.small-multiples-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}

.health-cell {
  display: grid;
  gap: 8px;
  padding: 14px 16px;
  background: var(--card);
  border: 1px solid rgba(17, 25, 34, 0.08);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  transition: transform 160ms ease, box-shadow 160ms ease;
}

.health-cell:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.health-cell-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.health-cell-name {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: -0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.health-cell-spark {
  display: flex;
  align-items: flex-end;
  height: 32px;
}

.health-cell-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.health-cell-rev {
  font-family: var(--mono);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  color: var(--ink-soft);
}


/* --- Sparkline Bars (inline mini charts) ---------------- */

.spark-bars {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 100%;
}

.spark-bar {
  flex: 1;
  min-width: 4px;
  border-radius: 2px 2px 0 0;
  transition: height 300ms ease;
}

.spark-growth {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}


/* --- Trajectory Cards ----------------------------------- */

.trajectory-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.trajectory-positive,
.trajectory-negative {
  /* Intentional — inherits from chart-card. No colored borders. */
}


/* --- Recommendation Grid -------------------------------- */

.recommendation-grid {
  display: grid;
  gap: 14px;
}

.recommendation-item {
  display: grid;
  grid-template-columns: 48px 1fr;
  gap: 16px;
  padding: 20px;
  background: var(--card);
  border: 1px solid rgba(17, 25, 34, 0.08);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  transition: transform 160ms ease, box-shadow 160ms ease;
}

.recommendation-item:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.rec-rank {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(17, 25, 34, 0.05);
  font-family: var(--mono);
  font-size: 18px;
  font-weight: 700;
  color: var(--ink-soft);
}

.rec-body {
  display: grid;
  gap: 10px;
}

.rec-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.rec-title {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.25;
}

.rec-impact {
  display: grid;
  gap: 4px;
  padding: 10px 14px;
  border-radius: 8px;
  background: rgba(59, 180, 124, 0.06);
  border: 1px solid rgba(59, 180, 124, 0.1);
}

.rec-impact-value {
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--green);
}


/* =========================================================
   ALERTS PAGE — Alert Cards, Status Badges, Suggestions
   ========================================================= */

.alert-card {
  display: grid;
  gap: 12px;
  padding: 20px;
  background: var(--card);
  border: 1px solid rgba(17, 25, 34, 0.08);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  font-family: var(--mono);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  background: rgba(17, 25, 34, 0.06);
  color: var(--ink-muted);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}

.suggestion-item {
  display: grid;
  gap: 6px;
  padding: 14px 16px;
  background: rgba(255, 255, 255, 0.56);
  border: 1px solid rgba(17, 25, 34, 0.08);
  border-radius: var(--radius-md);
}


/* =========================================================
   CROSS-PAGE — Customer Links, Explorer, Bars, Heatmap
   ========================================================= */

.customer-link {
  color: var(--ink);
  font-weight: 700;
  cursor: pointer;
  transition: color 160ms ease;
}

.customer-link:hover {
  color: var(--cyan-strong);
}

.explorer-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--cyan-strong);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.explorer-link:hover {
  text-decoration: underline;
}


/* --- Heatmap Grid --------------------------------------- */

.heatmap-grid {
  display: grid;
  gap: 3px;
}


/* --- Expand Grid (collapsible rows) --------------------- */

.expand-grid {
  display: grid;
  gap: 2px;
}

.expand-row {
  display: grid;
  grid-template-columns: 36px 1.2fr repeat(3, 1fr) 44px;
  gap: 10px;
  align-items: center;
  padding: 10px 14px;
  border-bottom: 1px solid rgba(17, 25, 34, 0.06);
  cursor: pointer;
  transition: background 160ms ease;
}

.expand-row:hover {
  background: rgba(255, 255, 255, 0.5);
}

.expand-col {
  font-size: 13px;
}

.expand-col.num {
  text-align: right;
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
}


/* --- Bar Visualizations --------------------------------- */

.bar-fill {
  height: 8px;
  border-radius: 999px;
  background: var(--cyan);
  transition: width 500ms ease;
  min-width: 2px;
}

.bar-indicator {
  height: 6px;
  border-radius: 999px;
  transition: width 400ms ease;
  min-width: 2px;
}

.impact-bar-wrap {
  width: 100%;
  height: 8px;
  border-radius: 999px;
  background: rgba(17, 25, 34, 0.06);
  overflow: hidden;
}

.impact-bar {
  height: 100%;
  border-radius: 999px;
  transition: width 500ms ease;
  min-width: 2px;
}


/* =========================================================
   RESPONSIVE — Tablet (1180px)
   ========================================================= */

@media (max-width: 1180px) {
  .hero-grid,
  .dashboard-grid,
  .magazine-grid,
  .compare-layout,
  .deepdive-grid,
  .waterfall-grid,
  .workspace-grid,
  .two-up {
    grid-template-columns: 1fr;
  }

  .three-up {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .selector-card {
    position: static;
  }

  .mega-stat-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .small-multiples-grid {
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  }

  .recommendation-item {
    grid-template-columns: 40px 1fr;
  }

  .kpi-row,
  .hero-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .kpi-row.is-5col {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}


/* =========================================================
   RESPONSIVE — Mobile (760px)
   ========================================================= */

@media (max-width: 760px) {
  :root {
    --gutter: 16px;
  }

  .topbar-inner {
    flex-direction: column;
    align-items: start;
  }

  .utility-cluster {
    margin-left: 0;
    width: 100%;
    flex-wrap: wrap;
  }

  .hero-card {
    padding: 20px;
    min-height: auto;
  }

  .display,
  .section-title {
    line-height: 1.02;
  }

  .three-up {
    grid-template-columns: 1fr;
  }

  .kpi-row,
  .kpi-row.is-5col,
  .hero-metrics {
    grid-template-columns: 1fr;
  }

  .metric-value,
  .signal-value,
  .stat-value {
    font-size: 26px;
  }

  .chart-frame {
    height: clamp(240px, 50vh, calc(100vh - 140px));
  }

  .chart-frame.is-tall,
  .chart-frame.is-hero,
  .chart-frame.is-wide {
    height: clamp(260px, 55vh, calc(100vh - 140px));
  }

  .matrix-row {
    grid-template-columns: 46px repeat(12, minmax(0, 1fr));
  }

  .control-row,
  .table-toolbar {
    justify-content: flex-start;
  }

  .list-split {
    grid-template-columns: 1fr;
  }

  .mega-stat-row {
    grid-template-columns: 1fr;
  }

  .mega-stat-value {
    font-size: 32px;
  }

  .small-multiples-grid {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  }

  .recommendation-item {
    grid-template-columns: 36px 1fr;
    padding: 16px;
  }

  .rec-head {
    flex-direction: column;
    gap: 8px;
  }

  .expand-row {
    grid-template-columns: 28px 1fr 1fr;
  }

  .lb-row {
    grid-template-columns: 28px 1fr 1fr;
  }

  .lifecycle-header,
  .lifecycle-row {
    grid-template-columns: 80px repeat(auto-fill, minmax(30px, 1fr));
  }

  /* Minimum 44px touch targets on mobile */
  .topbar-link,
  .mini-button,
  .toggle-button,
  .pill-btn,
  .chip,
  .link-chip,
  .customer-option,
  .table-sort {
    min-height: 44px;
    min-width: 44px;
  }
}


/* =========================================================
   PRINT
   ========================================================= */

@media print {
  body {
    background: white;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  body::before,
  .topbar {
    display: none;
  }

  .site-shell {
    padding: 0;
    max-width: 100%;
  }

  .hero-grid,
  .two-up,
  .three-up,
  .dashboard-grid,
  .magazine-grid,
  .deepdive-grid,
  .waterfall-grid {
    grid-template-columns: 1fr;
  }

  .hero-card,
  .chart-card,
  .table-card,
  .story-card,
  .selector-card,
  .insight-card,
  .metric-card,
  .signal-card,
  .kpi-tile {
    box-shadow: none;
    break-inside: avoid;
    border-color: rgba(17, 25, 34, 0.1);
  }

  .chart-frame {
    min-height: 260px;
    page-break-inside: avoid;
  }

  [data-reveal] {
    opacity: 1;
    transform: none;
  }

  [data-reveal-stagger] > * {
    opacity: 1;
    transform: none;
  }

  a[href]::after {
    content: none;
  }
}
