/* SGA Practice S-Curve — light, executive-grade UI */
:root {
  --bg: #f7f8fa;
  --panel: #ffffff;
  --ink: #0f172a;
  --ink-mid: #334155;
  --ink-soft: #64748b;
  --ink-faint: #94a3b8;
  --line: #e5e7eb;
  --line-soft: #f1f2f4;
  --accent: #0b2545;
  --accent-light: #1e3a5f;

  --s1: #94a3b8;
  --s2: #60a5fa;
  --s3: #10b981;
  --s4: #f59e0b;
  --s5: #8b5cf6;

  --rev: #2563eb;
  --ebi: #10b981;

  --danger: #ef4444;
  --warn: #f59e0b;
  --pass: #10b981;

  --shadow-sm: 0 1px 2px rgba(15,23,42,0.04);
  --shadow-md: 0 2px 8px rgba(15,23,42,0.06), 0 1px 2px rgba(15,23,42,0.04);
  --radius: 10px;
  --radius-sm: 6px;

  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Monaco, Consolas, monospace;
  --sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial;
}

* { box-sizing: border-box; }
html, body { margin:0; padding:0; }
body {
  font-family: var(--sans);
  color: var(--ink);
  background: var(--bg);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ====== HEADER ====== */
.app-header { background: #fff; border-bottom: 1px solid var(--line); }
.header-inner {
  max-width: 1440px; margin: 0 auto; padding: 18px 28px;
  display: flex; align-items: center; justify-content: space-between;
}
.brand { display: flex; align-items: center; gap: 14px; }
.brand-mark {
  width: 44px; height: 44px; border-radius: 10px;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-light) 100%);
  color: white; display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 14px; letter-spacing: 1px;
}
.app-title { font-size: 17px; font-weight: 600; letter-spacing: -0.01em; }
.app-subtitle { font-size: 12px; color: var(--ink-soft); margin-top: 2px; }
.header-meta { display: flex; gap: 24px; }
.meta-row { display: flex; flex-direction: column; align-items: flex-end; }
.meta-label { font-size: 11px; color: var(--ink-faint); text-transform: uppercase; letter-spacing: 0.05em; }
.meta-value { font-size: 16px; font-weight: 600; font-variant-numeric: tabular-nums; }

/* ====== TABS ====== */
.tab-bar { background: #fff; border-bottom: 1px solid var(--line); }
.tab-inner { max-width: 1440px; margin: 0 auto; padding: 0 28px; display: flex; gap: 4px; }
.tab {
  background: none; border: 0; padding: 14px 18px;
  font-family: inherit; font-size: 13px; font-weight: 500; color: var(--ink-soft);
  cursor: pointer; position: relative;
  border-bottom: 2px solid transparent;
  transition: all 0.15s;
}
.tab:hover { color: var(--ink); }
.tab.active { color: var(--ink); border-bottom-color: var(--accent); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ====== MAIN ====== */
.app-main {
  max-width: 1440px; margin: 0 auto; padding: 20px 28px 40px;
}

/* ====== KPI BAND ====== */
.kpi-band {
  display: flex; align-items: center; gap: 20px;
  margin-bottom: 18px;
}
.curve-toggle {
  display: inline-flex; background: #fff; border: 1px solid var(--line);
  border-radius: 8px; padding: 3px; box-shadow: var(--shadow-sm);
}
.curve-btn {
  background: none; border: 0; padding: 8px 14px;
  font-family: inherit; font-size: 13px; font-weight: 500; color: var(--ink-soft);
  cursor: pointer; border-radius: 6px;
  display: inline-flex; align-items: center; gap: 8px;
  transition: all 0.15s;
}
.curve-btn:hover { color: var(--ink); }
.curve-btn.active { background: var(--ink); color: #fff; }
.curve-dot { width: 8px; height: 8px; border-radius: 50%; }
.curve-dot.revenue { background: var(--rev); }
.curve-dot.ebitda { background: var(--ebi); }
.curve-dot.pbi { background: #2563eb; }
.curve-dot.di { background: #7c3aed; }

.kpi-cards {
  display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; flex: 1;
}
.kpi-card {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 10px 14px; box-shadow: var(--shadow-sm);
  cursor: pointer; transition: all 0.15s;
}
.kpi-card:hover { border-color: var(--ink-faint); }
.kpi-card.active { border-color: var(--accent); background: var(--line-soft); }
.kpi-stage { display: flex; align-items: center; gap: 8px; font-size: 11px; font-weight: 600; color: var(--ink-soft); }
.kpi-stage::before {
  content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--s1);
}
.kpi-card[data-stage="S1"] .kpi-stage::before { background: var(--s1); }
.kpi-card[data-stage="S2"] .kpi-stage::before { background: var(--s2); }
.kpi-card[data-stage="S3"] .kpi-stage::before { background: var(--s3); }
.kpi-card[data-stage="S4"] .kpi-stage::before { background: var(--s4); }
.kpi-card[data-stage="S5"] .kpi-stage::before { background: var(--s5); }
.kpi-count { font-size: 22px; font-weight: 700; letter-spacing: -0.02em; margin-top: 2px; font-variant-numeric: tabular-nums; }
.kpi-pct { font-size: 11px; color: var(--ink-faint); }

/* ====== WORKSPACE ====== */
.workspace {
  display: grid; grid-template-columns: 1fr 380px; gap: 20px;
  margin-bottom: 18px;
}
.chart-card, .detail-panel {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.chart-card { padding: 18px; }
.chart-header {
  display: flex; justify-content: space-between; align-items: flex-start;
  margin-bottom: 12px;
}
.chart-title { font-size: 16px; font-weight: 600; letter-spacing: -0.01em; }
.chart-subtitle { font-size: 12px; color: var(--ink-soft); margin-top: 2px; }
.chart-controls { display: flex; gap: 14px; }
.chk { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--ink-mid); cursor: pointer; }
.chk input { margin: 0; }

.chart-wrapper { position: relative; }
#scurve { width: 100%; height: 520px; display: block; }
.chart-legend {
  display: flex; gap: 16px; justify-content: center;
  margin-top: 8px; font-size: 11px; color: var(--ink-soft);
}
.legend-item { display: inline-flex; align-items: center; gap: 6px; }
.legend-swatch { width: 10px; height: 10px; border-radius: 50%; }

/* ====== DETAIL PANEL ====== */
.detail-panel { padding: 20px; overflow-y: auto; max-height: calc(520px + 36px); }
.panel-empty { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 24px 0; }
.empty-icon { font-size: 28px; color: var(--ink-faint); margin-bottom: 10px; }
.empty-title { font-size: 14px; font-weight: 600; margin-bottom: 6px; }
.empty-text { font-size: 12px; color: var(--ink-soft); max-width: 260px; line-height: 1.5; }

.portfolio-summary {
  margin-top: 24px; padding-top: 18px;
  border-top: 1px solid var(--line); width: 100%;
  text-align: left;
}
.summary-head { font-size: 11px; font-weight: 600; color: var(--ink-faint); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 10px; }
.summary-metric { margin-bottom: 14px; }
.metric-label { font-size: 12px; color: var(--ink-soft); }
.metric-value { font-size: 24px; font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; color: var(--accent); }
.summary-lever-dist { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.dist-row { display: flex; justify-content: space-between; font-size: 12px; }
.dist-label { color: var(--ink-mid); }
.dist-value { font-weight: 600; color: var(--ink); font-variant-numeric: tabular-nums; }

/* detail states */
.practice-detail { display: flex; flex-direction: column; gap: 14px; }
.practice-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.practice-name { font-size: 16px; font-weight: 600; letter-spacing: -0.01em; }
.practice-code { font-size: 11px; color: var(--ink-faint); font-family: var(--mono); margin-top: 2px; }
.stage-row { display: flex; gap: 8px; }
.stage-chip { padding: 4px 8px; border-radius: 12px; font-size: 11px; font-weight: 600; display: inline-flex; align-items: center; gap: 5px; }
.stage-chip.s1 { background: #f1f5f9; color: #475569; }
.stage-chip.s2 { background: #dbeafe; color: #1d4ed8; }
.stage-chip.s3 { background: #d1fae5; color: #047857; }
.stage-chip.s4 { background: #fef3c7; color: #a16207; }
.stage-chip.s5 { background: #ede9fe; color: #6d28d9; }
.stage-chip-label { opacity: 0.8; font-weight: 500; }

.progress-block { margin-top: 4px; }
.progress-label { display: flex; justify-content: space-between; font-size: 11px; color: var(--ink-soft); margin-bottom: 4px; }
.progress-bar { height: 6px; background: var(--line-soft); border-radius: 3px; overflow: hidden; }
.progress-fill { height: 100%; border-radius: 3px; transition: width 0.4s; }

.section-head { font-size: 11px; font-weight: 600; color: var(--ink-faint); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 6px; }

.explanation { background: var(--line-soft); border-radius: 8px; padding: 12px; font-size: 13px; color: var(--ink-mid); }
.explanation.why-not { background: #fef3c7; color: #713f12; }

.gates { display: flex; flex-direction: column; gap: 4px; margin-top: 6px; }
.gate-row { display: flex; justify-content: space-between; align-items: center; padding: 6px 10px; border-radius: 6px; font-size: 12px; }
.gate-row.pass { background: #ecfdf5; color: #065f46; }
.gate-row.warn { background: #fef3c7; color: #78350f; }
.gate-row.fail { background: #fef2f2; color: #991b1b; }
.gate-status { font-size: 11px; font-weight: 600; }

/* THE LEVER */
.lever-card {
  background: linear-gradient(135deg, #fef9c3 0%, #fef3c7 100%);
  border: 1px solid #fcd34d;
  border-radius: 10px;
  padding: 14px;
  margin-top: 4px;
}
.lever-kicker { font-size: 10px; font-weight: 700; color: #92400e; text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 4px; }
.lever-title { font-size: 15px; font-weight: 600; color: #78350f; margin-bottom: 8px; }
.lever-impact-row { display: flex; align-items: baseline; gap: 8px; margin-bottom: 10px; }
.lever-impact { font-size: 26px; font-weight: 700; letter-spacing: -0.02em; color: #78350f; font-variant-numeric: tabular-nums; }
.lever-impact-unit { font-size: 11px; color: #a16207; text-transform: uppercase; letter-spacing: 0.05em; }
.lever-move { display: flex; gap: 14px; background: rgba(255,255,255,0.7); padding: 8px 10px; border-radius: 6px; font-size: 12px; color: #78350f; }
.lever-move-col { display: flex; flex-direction: column; }
.lever-move-label { font-size: 10px; color: #a16207; text-transform: uppercase; letter-spacing: 0.05em; }
.lever-move-val { font-weight: 600; font-variant-numeric: tabular-nums; }
.lever-rationale { font-size: 12px; color: #78350f; margin-top: 10px; }
.lever-playbook { margin-top: 10px; padding-top: 10px; border-top: 1px solid #fcd34d; }
.lever-playbook-head { font-size: 10px; font-weight: 700; color: #92400e; text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 6px; }
.lever-playbook ul { margin: 0; padding-left: 18px; font-size: 12px; color: #78350f; }
.lever-playbook li { margin-bottom: 4px; }

.metric-bars { display: flex; flex-direction: column; gap: 6px; margin-top: 4px; }
.metric-bar-row { display: grid; grid-template-columns: 90px 1fr 50px; align-items: center; gap: 8px; font-size: 11px; }
.metric-bar-label { color: var(--ink-soft); }
.metric-bar-track { height: 6px; background: var(--line-soft); border-radius: 3px; overflow: hidden; position: relative; }
.metric-bar-fill { height: 100%; border-radius: 3px; background: var(--accent-light); }
.metric-bar-value { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; color: var(--ink); }

/* ====== FILTER BAR ====== */
.filter-bar {
  display: flex; gap: 16px; align-items: center;
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 10px 14px; box-shadow: var(--shadow-sm);
}
.search-box { flex: 0 0 320px; }
.search-box input {
  width: 100%; padding: 8px 12px; border: 1px solid var(--line);
  border-radius: 6px; font-family: inherit; font-size: 13px;
  background: var(--bg);
}
.search-box input:focus { outline: none; border-color: var(--accent); background: #fff; }
.stage-filters { display: flex; gap: 6px; }
.stage-filter {
  padding: 6px 10px; border: 1px solid var(--line); border-radius: 6px;
  font-family: inherit; font-size: 12px; font-weight: 500; color: var(--ink-mid);
  background: #fff; cursor: pointer;
  display: inline-flex; align-items: center; gap: 5px;
}
.stage-filter:hover { border-color: var(--ink-faint); }
.stage-filter.active { background: var(--ink); color: #fff; border-color: var(--ink); }
.stage-filter::before { content:''; width: 6px; height: 6px; border-radius: 50%; }
.stage-filter[data-stage="all"]::before { display: none; }
.stage-filter[data-stage="S1"]::before { background: var(--s1); }
.stage-filter[data-stage="S2"]::before { background: var(--s2); }
.stage-filter[data-stage="S3"]::before { background: var(--s3); }
.stage-filter[data-stage="S4"]::before { background: var(--s4); }
.stage-filter[data-stage="S5"]::before { background: var(--s5); }

/* ====== TOOLTIP ====== */
.scurve-tooltip {
  position: fixed; pointer-events: none; z-index: 100;
  background: #0f172a; color: #fff; border-radius: 8px; padding: 10px 12px;
  font-size: 12px; box-shadow: 0 4px 20px rgba(0,0,0,0.3);
  opacity: 0; transition: opacity 0.12s;
  max-width: 260px;
}
.scurve-tooltip.visible { opacity: 1; }
.tt-name { font-weight: 600; margin-bottom: 4px; font-size: 13px; }
.tt-row { display: flex; justify-content: space-between; gap: 10px; color: #cbd5e1; }
.tt-divider { height: 1px; background: #1e293b; margin: 6px 0; }
.tt-lever { font-size: 11px; color: #fcd34d; margin-top: 6px; }

/* ====== METHODOLOGY ====== */
.methodology { max-width: 820px; margin: 0 auto; padding: 20px 0; }
.method-block { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; margin-bottom: 16px; box-shadow: var(--shadow-sm); }
.method-block h2 { font-size: 16px; font-weight: 600; margin: 0 0 10px; letter-spacing: -0.01em; }
.method-block p { margin: 0 0 10px; color: var(--ink-mid); }
.method-block p:last-child { margin-bottom: 0; }
.stage-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.stage-def { display: flex; gap: 12px; padding: 12px; background: var(--bg); border-radius: 8px; font-size: 13px; line-height: 1.5; }
.stage-badge { width: 28px; height: 28px; border-radius: 6px; color: #fff; display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; flex-shrink: 0; }
.stage-badge.s1 { background: var(--s1); }
.stage-badge.s2 { background: var(--s2); }
.stage-badge.s3 { background: var(--s3); }
.stage-badge.s4 { background: var(--s4); }
.stage-badge.s5 { background: var(--s5); }
.weights-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.weight-col h3 { font-size: 13px; font-weight: 600; margin: 0 0 8px; color: var(--ink-mid); }
.weight-row { display: grid; grid-template-columns: 1fr 40px 80px; align-items: center; gap: 8px; font-size: 12px; padding: 4px 0; }
.weight-row .bar { height: 5px; background: var(--line-soft); border-radius: 3px; }
.weight-row .bar-fill { height: 100%; background: var(--accent-light); border-radius: 3px; }
.weight-pct { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
.hypothesis-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin: 10px 0; }
.hypothesis-grid ul { margin: 6px 0 0; padding-left: 20px; font-size: 13px; color: var(--ink-mid); }
.lever-list { margin: 0; padding-left: 20px; }
.lever-list li { margin-bottom: 6px; font-size: 13px; }
.callout { background: var(--bg); border-left: 3px solid var(--accent); padding: 10px 14px; border-radius: 0 6px 6px 0; font-size: 13px; color: var(--ink-mid); margin-top: 12px !important; }

/* ====== LEVERBOARD ====== */
.leverboard-head { padding: 20px 0 10px; }
.leverboard-head h2 { margin: 0; font-size: 20px; letter-spacing: -0.01em; }
.leverboard-head p { margin: 4px 0 0; color: var(--ink-soft); font-size: 13px; }
.leverboard-table-wrap {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; box-shadow: var(--shadow-sm);
}
.leverboard-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.leverboard-table th {
  background: var(--bg); padding: 10px 12px; text-align: left;
  font-weight: 600; color: var(--ink-mid); font-size: 11px;
  text-transform: uppercase; letter-spacing: 0.05em;
  border-bottom: 1px solid var(--line);
  cursor: pointer; user-select: none;
}
.leverboard-table th:hover { color: var(--ink); }
.leverboard-table th.desc::after { content: ' ↓'; }
.leverboard-table th.asc::after { content: ' ↑'; }
.leverboard-table td { padding: 10px 12px; border-bottom: 1px solid var(--line-soft); }
.leverboard-table tr:last-child td { border-bottom: 0; }
.leverboard-table tr:hover td { background: var(--bg); cursor: pointer; }
.leverboard-table td.num { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
.leverboard-table td.impact { color: var(--accent); font-weight: 700; }

/* ====== Financial header card (in detail panel) ====== */
.fin-row { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 6px; margin-bottom: 4px; }
.fin-cell { background: var(--line-soft); border-radius: 8px; padding: 10px 12px; }
.fin-cell.highlight { background: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 100%); }
.fin-label { font-size: 10px; font-weight: 600; color: var(--ink-faint); text-transform: uppercase; letter-spacing: 0.05em; }
.fin-value { font-size: 18px; font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; margin-top: 2px; letter-spacing: -0.01em; }
.fin-sub { font-size: 10px; color: var(--ink-soft); margin-top: 2px; }

/* ====== 4-view stage row ====== */
.fourview { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.fv-box { background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; cursor: pointer; transition: all 0.12s; }
.fv-box:hover { border-color: var(--accent); box-shadow: var(--shadow-sm); }
.fv-box.fv-nodata { background: var(--line-soft); cursor: default; opacity: 0.6; }
.fv-source { font-size: 10px; font-weight: 600; color: var(--ink-faint); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 4px; }
.fv-stage { font-size: 14px; font-weight: 600; display: flex; align-items: center; gap: 6px; }
.fv-bar { height: 4px; background: var(--line-soft); border-radius: 2px; margin-top: 6px; overflow: hidden; }
.fv-barfill { height: 100%; border-radius: 2px; }
.fv-barfill.s1 { background: var(--s1); }
.fv-barfill.s2 { background: var(--s2); }
.fv-barfill.s3 { background: var(--s3); }
.fv-barfill.s4 { background: var(--s4); }
.fv-barfill.s5 { background: var(--s5); }
.fv-empty { font-size: 11px; color: var(--ink-faint); margin-top: 4px; }

/* ====== Divergence row ====== */
.divergence-row { display: flex; justify-content: space-between; font-size: 12px; padding: 6px 10px; background: #fff7ed; border-left: 3px solid #f97316; border-radius: 4px; }
.div-delta.pos { color: #059669; font-weight: 700; }
.div-delta.neg { color: #dc2626; font-weight: 700; }
.divergence-meaning { font-size: 11px; color: var(--ink-soft); padding: 0 10px 6px; }

/* ====== Projected margin row ====== */
.projected-margin { display: flex; align-items: center; gap: 10px; background: rgba(255,255,255,0.7); padding: 10px 12px; border-radius: 6px; margin-bottom: 10px; }
.pm-old { font-size: 18px; font-weight: 700; color: #92400e; font-variant-numeric: tabular-nums; opacity: 0.6; }
.pm-arrow { color: #78350f; font-size: 16px; }
.pm-new { font-size: 22px; font-weight: 800; color: #065f46; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.pm-delta { margin-left: auto; font-size: 11px; font-weight: 600; color: #065f46; background: #d1fae5; padding: 4px 8px; border-radius: 4px; }

/* ====== Math transparency block ====== */
.math-block { background: rgba(255,255,255,0.75); border: 1px solid rgba(252, 211, 77, 0.6); border-radius: 8px; padding: 10px 12px; margin: 10px 0; }
.math-head { font-size: 10px; font-weight: 700; color: #92400e; text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 8px; }
.math-table { width: 100%; border-collapse: collapse; font-size: 11px; font-family: var(--mono); }
.math-table tr td { padding: 3px 0; }
.math-table tr td.ms-label { color: #78350f; padding-right: 10px; }
.math-table tr td.ms-value { color: #0f172a; font-weight: 600; white-space: nowrap; text-align: right; padding-right: 10px; }
.math-table tr td.ms-note { color: #a16207; font-size: 10px; font-style: italic; }
.math-table tr:last-child td { font-weight: 700; border-top: 1px solid rgba(146, 64, 14, 0.3); padding-top: 6px; }

/* ====== Other levers list ====== */
.other-levers { display: flex; flex-direction: column; gap: 4px; }
.other-lever { display: flex; justify-content: space-between; align-items: center; padding: 8px 10px; border-radius: 6px; font-size: 12px; background: var(--line-soft); }
.other-lever.revenue { border-left: 3px solid var(--rev); }
.other-lever.expense { border-left: 3px solid var(--ebi); }
.ol-head { display: flex; align-items: center; gap: 8px; }
.ol-type { font-size: 10px; padding: 2px 6px; background: var(--bg); border-radius: 3px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--ink-soft); }
.ol-name { font-weight: 500; }
.ol-src { font-size: 10px; color: var(--ink-faint); }
.ol-impact { font-weight: 700; color: var(--accent); font-variant-numeric: tabular-nums; }

/* ====== Lever type/source chips ====== */
.type-chip { padding: 3px 7px; border-radius: 4px; font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }
.type-chip.revenue { background: #dbeafe; color: #1d4ed8; }
.type-chip.expense { background: #d1fae5; color: #047857; }
.source-chip { padding: 3px 7px; border-radius: 4px; font-size: 10px; font-weight: 600; }
.source-chip.pbi { background: #ede9fe; color: #6d28d9; }
.source-chip.di { background: #fef3c7; color: #a16207; }

/* ====== Lever card types ====== */
.lever-card.expense { background: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 100%); border-color: #34d399; }
.lever-card.expense .lever-kicker { color: #065f46; }
.lever-card.expense .lever-title,
.lever-card.expense .lever-rationale { color: #064e3b; }
.lever-card.expense .lever-impact { color: #065f46; }
.lever-card.expense .lever-playbook { border-top-color: #34d399; }

/* ====== Comparison grid ====== */
.cmp-kpi-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 16px; }
.cmp-kpi { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; box-shadow: var(--shadow-sm); }
.cmp-kpi .kpi-count { font-size: 26px; font-weight: 700; letter-spacing: -0.02em; color: var(--accent); font-variant-numeric: tabular-nums; }
.cmp-kpi .kpi-label { font-size: 11px; color: var(--ink-soft); margin-top: 2px; text-transform: uppercase; letter-spacing: 0.05em; }

.comparison-table-wrap { background: #fff; border: 1px solid var(--line); border-radius: 10px; overflow: auto; box-shadow: var(--shadow-sm); }
.comparison-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.comparison-table th { background: var(--bg); padding: 10px 10px; text-align: left; font-weight: 600; color: var(--ink-mid); font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em; border-bottom: 1px solid var(--line); cursor: pointer; white-space: nowrap; }
.comparison-table th:hover { color: var(--ink); }
.comparison-table th.desc::after { content: ' ↓'; }
.comparison-table th.asc::after { content: ' ↑'; }
.comparison-table td { padding: 8px 10px; border-bottom: 1px solid var(--line-soft); white-space: nowrap; }
.comparison-table td.num { text-align: right; font-variant-numeric: tabular-nums; }
.comparison-table td.impact { color: #065f46; font-weight: 700; }
.comparison-table td.pill { font-weight: 600; }
.comparison-table tbody tr:hover td { background: var(--bg); cursor: pointer; }

.div-chip { padding: 2px 6px; border-radius: 3px; font-size: 11px; font-weight: 600; }
.div-chip.pos { background: #d1fae5; color: #065f46; }
.div-chip.neg { background: #fee2e2; color: #b91c1c; }

.cell-title { font-weight: 500; }
.cell-sub { font-size: 10px; color: var(--ink-faint); }

/* ====== Four-view method grid ====== */
.four-view-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.fv-cell { background: var(--line-soft); border-radius: 8px; padding: 12px 14px; }
.fv-cell .fv-label { font-size: 13px; font-weight: 600; color: var(--ink); margin-bottom: 4px; }
.fv-cell .fv-desc { font-size: 12px; color: var(--ink-soft); }

/* ====== Correlation matrix ====== */
.cm-summary { font-size: 12px; color: var(--ink-soft); margin-bottom: 10px; }
.cm-table { width: 100%; border-collapse: collapse; font-size: 12px; margin: 10px 0; }
.cm-table th { text-align: left; padding: 6px 8px; background: var(--bg); color: var(--ink-mid); font-weight: 600; font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em; border-bottom: 1px solid var(--line); }
.cm-table td { padding: 6px 8px; border-bottom: 1px solid var(--line-soft); }
.cm-metric { font-family: var(--mono); color: var(--ink-mid); font-size: 11px; }
.cm-cell { text-align: right; font-family: var(--mono); font-variant-numeric: tabular-nums; }
.cm-cell.cm-strong { background: #d1fae5; color: #065f46; font-weight: 700; }
.cm-cell.cm-mod    { background: #fef9c3; color: #713f12; font-weight: 600; }
.cm-cell.cm-weak   { background: #fef2f2; color: #991b1b; }
.cm-cell.cm-noise  { background: var(--line-soft); color: var(--ink-faint); }
.cm-cell.na        { background: transparent; color: var(--ink-faint); }
.cm-n              { text-align: right; color: var(--ink-soft); font-family: var(--mono); }
.verdict { display: inline-block; padding: 2px 7px; border-radius: 4px; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; }
.verdict.keep { background: #d1fae5; color: #065f46; }
.verdict.ctx  { background: #fef9c3; color: #92400e; }
.verdict.drop { background: #fee2e2; color: #991b1b; }

/* ====== Method pre block ====== */
.math-pre { background: var(--bg); padding: 10px 14px; border-radius: 6px; font-family: var(--mono); font-size: 11px; white-space: pre-wrap; border-left: 3px solid var(--accent); color: var(--ink-mid); margin: 8px 0; }

/* small screens: stack panel below chart */
@media (max-width: 1100px) {
  .workspace { grid-template-columns: 1fr; }
  .detail-panel { max-height: none; }
  .kpi-cards { grid-template-columns: repeat(5, 1fr); }
}
