/* ============================================================
   Customer Lifetime Value Tool – App-Specific Styles
   Extends shared/css/main.css
   ============================================================ */

/* ── Loading Banner ── */
.loading-banner {
  background: var(--app-card-bg);
  border: 1px solid var(--app-border);
  border-left: 4px solid var(--app-accent);
  border-radius: 8px;
  padding: 0.75rem 1.25rem;
  margin-bottom: 1.5rem;
}
.loading-banner__content {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-weight: 500;
  color: var(--app-text);
}
.loading-spinner {
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 2.5px solid var(--app-border);
  border-top-color: var(--app-accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  flex-shrink: 0;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Quick-start pulse highlight ── */
@keyframes clv-highlight-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(2, 132, 199, 0); }
  50% { box-shadow: 0 0 0 4px rgba(2, 132, 199, 0.35); }
}
.highlight-pulse {
  animation: clv-highlight-pulse 0.9s ease-in-out 2;
  border-radius: var(--border-radius, 6px);
}

/* ── CLV Model Cards (dual-panel overview) ── */
.clv-model-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin: 1.25rem 0;
}
@media (max-width: 768px) {
  .clv-model-grid { grid-template-columns: 1fr; }
}
.clv-model-card {
  border-radius: 8px;
  padding: 1.1rem 1.25rem;
  border: 1px solid var(--app-border);
  min-width: 0; /* prevent grid blowout so overflow-x:auto works on equations */
}
.clv-model-card--retention {
  background: #f0f9ff;
  border-color: #bae6fd;
}
.clv-model-card--spend {
  background: #f0fdf4;
  border-color: #bbf7d0;
}
.clv-model-card__header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}
.clv-model-icon { font-size: 1.25rem; }
.equation {
  background: var(--app-bg);
  border: 1px solid var(--app-border);
  border-radius: 6px;
  padding: 1rem 1.5rem;
  margin: 0.75rem 0;
  overflow-x: auto;
}
/* KaTeX display blocks inside the main equation box */
.equation .katex-display {
  margin: 0.3rem 0;
  overflow-x: auto;
  overflow-y: hidden;
}
.equation-small {
  background: rgba(0,0,0,0.035);
  border-radius: 5px;
  padding: 0.6rem 0.9rem;
  margin-top: 0.5rem;
  /* KaTeX inherits font-size from parent — no transform hack needed */
  font-size: 0.83em;
  overflow-x: auto;
  line-height: 1.5;
}
/* Left-align multi-line display equations in the model sub-cards */
.equation-small .katex-display {
  text-align: left;
  margin: 0.2rem 0;
  overflow-x: auto;
  overflow-y: hidden;
}

/* ── Equation Definitions Block ── */
.equation-definitions {
  background: #f8f9fb;
  border-radius: var(--border-radius, 6px);
  padding: 0.85rem 1rem;
  margin: 0.85rem 0 0.25rem;
  border-left: 3px solid rgba(44, 62, 80, 0.2);
}
.equation-definitions > strong {
  display: block;
  margin-bottom: 0.35rem;
  font-size: 0.875rem;
  color: var(--app-text);
}
.equation-definitions ul {
  margin: 0;
  padding-left: 1.25rem;
  list-style: disc;
}
.equation-definitions li {
  font-size: 0.875rem;
  line-height: 1.6;
  color: var(--app-text);
  padding: 0.1rem 0;
}
.equation-definitions.compact {
  padding: 0.7rem 0.85rem;
  margin-top: 0.6rem;
  border-left-color: rgba(3, 155, 229, 0.3);
  background: rgba(240, 249, 255, 0.5);
}

/* ── Segment Lift Breakdown ── */
.sim-segment-lift {
  margin: 1rem 0;
  background: #f8f9fb;
  border: 1px solid var(--app-border);
  border-radius: 6px;
  padding: 0.85rem 1rem;
}
.sim-segment-lift__header {
  font-weight: 600;
  font-size: 0.92rem;
  margin-bottom: 0.35rem;
  color: var(--app-text);
}
.sim-segment-lift__hint {
  font-size: 0.82rem;
  color: #64748b;
  margin: 0 0 0.65rem;
  line-height: 1.5;
}
.seg-lift-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}
.seg-lift-table th {
  text-align: left;
  padding: 0.3rem 0.5rem;
  border-bottom: 2px solid var(--app-border);
  color: #475569;
  font-weight: 600;
}
.seg-lift-table td {
  padding: 0.35rem 0.5rem;
  border-bottom: 1px solid #f1f5f9;
  vertical-align: middle;
}
.seg-lift-table td.num { text-align: right; font-variant-numeric: tabular-nums; }
.seg-dot {
  display: inline-block;
  width: 10px; height: 10px;
  border-radius: 50%;
  margin-right: 0.4rem;
  vertical-align: middle;
}
.seg-lift-bar-wrap {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  justify-content: flex-end;
}
.seg-lift-bar {
  height: 8px;
  border-radius: 3px;
  min-width: 2px;
}
.seg-lift-bar.positive { background: #16a34a; }
.seg-lift-bar.negative { background: #ef4444; }

/* Per-segment linkage table sub-headers */
.linkage-lever-header { text-align: center; border-bottom: 1px solid #e2e8f0; padding: 0.3rem 0.5rem; }
.linkage-sub { text-align: center; font-size: 0.78rem; color: #64748b; font-weight: 500; padding: 0.2rem 0.4rem; }

/* ── Sim Inline Chart ── */
.sim-inline-chart {
  margin: 1.25rem 0 0.5rem;
  min-height: 260px;
}

/* ── Model Linkage Panel ── */
.sim-model-linkage {
  margin: 1rem 0;
  background: #f8f9fb;
  border: 1px solid var(--app-border);
  border-radius: 6px;
  padding: 0.85rem 1rem;
}
.sim-model-linkage:empty { display: none; }
.sim-model-linkage__header {
  font-weight: 600;
  font-size: 0.92rem;
  margin-bottom: 0.35rem;
  color: var(--app-text);
}
.sim-model-linkage__hint {
  font-size: 0.82rem;
  color: #64748b;
  margin: 0 0 0.65rem;
  line-height: 1.5;
}
.linkage-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}
.linkage-table th {
  text-align: left;
  padding: 0.3rem 0.5rem;
  border-bottom: 2px solid var(--app-border);
  color: #475569;
  font-weight: 600;
}
.linkage-table td {
  padding: 0.35rem 0.5rem;
  border-bottom: 1px solid #f1f5f9;
  vertical-align: middle;
}
.linkage-col { font-weight: 500; }
.linkage-change {
  font-weight: 400;
  font-size: 0.8rem;
  color: #0284c7;
  margin-left: 0.4rem;
  background: #e0f2fe;
  border-radius: 3px;
  padding: 0 0.3rem;
}
.linkage-badge {
  display: inline-block;
  font-size: 0.78rem;
  border-radius: 4px;
  padding: 0.15rem 0.45rem;
}
.linkage-badge--sig  { background: #dcfce7; color: #15803d; }
.linkage-badge--ns   { background: #f1f5f9; color: #94a3b8; }

/* ── Scenario Description Box ── */
.scenario-description {
  margin-top: 1rem;
  padding: 1rem 1.25rem;
  background: #f8fafc;
  border-radius: 8px;
  border: 1px solid var(--app-border);
  line-height: 1.6;
}
.scenario-description h3 { margin-bottom: 0.5rem; font-size: 1rem; }
.scenario-meta-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.5rem;
  margin: 0.75rem 0;
}
.scenario-meta-item {
  background: white;
  border: 1px solid var(--app-border);
  border-radius: 6px;
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
}
.scenario-meta-item strong { display: block; font-size: 0.75rem; color: var(--app-muted); text-transform: uppercase; letter-spacing: 0.04em; }

/* ── Upload actions ── */
.upload-actions {
  margin-top: 0.75rem;
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

/* ── Column Mapping ── */
.mapping-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem 1.5rem;
  margin-bottom: 1.5rem;
}
@media (max-width: 640px) { .mapping-grid { grid-template-columns: 1fr; } }
.mapping-row {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}
.mapping-row label { font-weight: 500; font-size: 0.9rem; }
.required-star { color: #ef4444; }
.optional-tag { font-weight: 400; font-size: 0.8rem; color: var(--app-muted); }

.marketing-cols-section,
.customer-attr-section {
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--app-border);
}
.marketing-cols-section h3,
.customer-attr-section h3 { margin-bottom: 0.4rem; font-size: 1rem; }

.checkbox-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.5rem;
}
.checkbox-grid label {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--app-bg);
  border: 1px solid var(--app-border);
  border-radius: 6px;
  padding: 0.35rem 0.7rem;
  font-size: 0.875rem;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.checkbox-grid label:hover { border-color: var(--app-accent); background: #f0f9ff; }
.checkbox-grid input[type="checkbox"]:checked + span,
.checkbox-grid label:has(input:checked) { border-color: var(--app-accent); background: #e0f2fe; }
.checkbox-grid label.col-reserved {
  opacity: 0.38;
  cursor: not-allowed;
  pointer-events: none;
  text-decoration: line-through;
}

/* ── Config grid ── */
.config-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.25rem;
  margin-bottom: 1.5rem;
}
.config-item label { font-weight: 600; display: block; margin-bottom: 0.25rem; }
.config-hint { font-size: 0.8rem; margin: 0 0 0.5rem; }
.slider-input-pair {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.slider-input-pair input[type="range"] { flex: 1; }
.compact-input { width: 70px; padding: 0.35rem 0.5rem; text-align: center; }
.input-unit { font-size: 0.85rem; color: var(--app-muted); white-space: nowrap; }
.input-with-symbol {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}
.currency-symbol { font-weight: 600; font-size: 1rem; }

.run-btn {
  font-size: 1rem;
  padding: 0.7rem 2rem;
  margin-top: 0.5rem;
}
.run-hint { margin-top: 0.5rem; font-size: 0.85rem; }

/* ── Marketing Cost Declaration ── */
.section-divider {
  border: none;
  border-top: 1px solid var(--app-border, #e5e7eb);
  margin: 1.5rem 0 1.25rem;
}
#cost-declaration-wrapper h3 {
  margin-bottom: 0.4rem;
  font-size: 1rem;
}
.cost-declaration-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.9rem;
  margin: 0.9rem 0 1rem;
}
.cost-declaration-item {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 200px;
  background: var(--app-bg, #f9fafb);
  border: 1px solid var(--app-border, #e5e7eb);
  border-radius: 8px;
  padding: 0.6rem 0.8rem;
}
.cost-decl-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--app-text, #1e293b);
}
.cost-decl-hint {
  font-size: 0.72rem;
  color: var(--app-muted, #8a9ab0);
  font-style: italic;
  line-height: 1.3;
  margin-bottom: 0.3rem;
}
.cost-zero-note {
  font-size: 0.72rem;
  color: #b45309;
  font-weight: 500;
}
.cost-confirm-label {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  font-size: 0.85rem;
  cursor: pointer;
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: 8px;
  padding: 0.6rem 0.8rem;
  margin-bottom: 1rem;
}
.cost-confirm-label input[type="checkbox"] {
  margin-top: 0.15rem;
  flex-shrink: 0;
  accent-color: #2563eb;
}

/* ── KPI Strip ── */
.kpi-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}
.kpi-card {
  flex: 1;
  min-width: 130px;
  background: var(--app-bg);
  border: 1px solid var(--app-border);
  border-radius: 8px;
  padding: 0.85rem 1rem;
  text-align: center;
}
.kpi-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--app-accent);
  line-height: 1.2;
}
.kpi-label {
  font-size: 0.78rem;
  color: var(--app-muted);
  margin-top: 0.2rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* ── Result Tabs ── */
.result-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  border-bottom: 2px solid var(--app-border);
  margin-bottom: 1.25rem;
}
.result-tab {
  padding: 0.55rem 1rem;
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--app-muted);
  transition: color 0.15s, border-color 0.15s;
}
.result-tab:hover { color: var(--app-text); }
.result-tab.active {
  color: var(--app-accent);
  border-bottom-color: var(--app-accent);
}
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ── Chart containers ── */
.chart-container {
  width: 100%;
  height: 420px;     /* explicit height so Plotly responsive mode measures correctly */
  min-height: 380px;
  margin: 0.75rem 0 1.5rem; /* extra bottom gap separates chart from table/text below */
}
.chart-controls {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
  flex-wrap: wrap;
}
.chart-controls label { font-weight: 500; font-size: 0.9rem; }

/* ── Coefficient Tables ── */
.coef-tab-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1rem;
}
.coef-seg-selector-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.9rem;
}
.coef-seg-selector-row.hidden { display: none; }
.coef-seg-select {
  padding: 0.35rem 0.7rem;
  border: 1px solid var(--app-border);
  border-radius: 6px;
  background: white;
  font-size: 0.875rem;
  cursor: pointer;
}
.coef-fallback-badge {
  display: inline-block;
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fcd34d;
  border-radius: 4px;
  padding: 0.1rem 0.45rem;
  font-size: 0.78rem;
  font-weight: 600;
  vertical-align: middle;
  cursor: help;
}
/* ── Trajectory stats strip ─────────────────────────── */
#trajectory-stats-row {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin: 0.5rem 0 0.25rem;
  padding: 0.4rem 0.25rem;
}
.traj-stat {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  background: #f0f9ff;
  border: 1px solid #bae6fd;
  border-radius: 6px;
  padding: 0.3rem 0.75rem;
  font-size: 0.82rem;
}
.traj-stat__label { color: #64748b; }
.traj-stat__value { font-weight: 700; color: #0c4a6e; }
.traj-stat__value--mean { color: #0284c7; }
.traj-stat--iqr { background: #f0fdf4; border-color: #bbf7d0; }
.traj-stat--iqr .traj-stat__value { color: #166534; }
/* Per-segment row inside stats strip */
.traj-stat-group {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  padding: 0.3rem 0.75rem;
  font-size: 0.82rem;
}
.traj-stat-group__label {
  font-weight: 600;
  color: #1e293b;
  margin-right: 0.4rem;
  border-right: 1px solid #cbd5e1;
  padding-right: 0.4rem;
}

.coef-tables-wrapper {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}
@media (max-width: 900px) { .coef-tables-wrapper { grid-template-columns: 1fr; } }
.coef-table-block h3 { margin-bottom: 0.4rem; font-size: 1rem; }
.coef-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  margin-top: 0.5rem;
}
.coef-table th {
  background: var(--app-bg);
  border-bottom: 2px solid var(--app-border);
  padding: 0.45rem 0.6rem;
  text-align: left;
  font-weight: 600;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}
.coef-table td {
  padding: 0.4rem 0.6rem;
  border-bottom: 1px solid var(--app-border);
  vertical-align: middle;
}
.coef-table tr:last-child td { border-bottom: none; }
.coef-table .sig { color: #16a34a; font-weight: 600; }
.coef-table .insig { color: var(--app-muted); }
.coef-table .coef-name { font-family: monospace; font-size: 0.82rem; }
.coef-table .positive { color: #0369a1; }
.coef-table .negative { color: #dc2626; }
.model-stats-row {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  margin-top: 0.75rem;
  font-size: 0.82rem;
  color: var(--app-muted);
}
.model-stat { padding: 0.2rem 0.5rem; background: var(--app-bg); border-radius: 4px; border: 1px solid var(--app-border); }

/* ── Segment Table ── */
.segment-table-wrapper {
  overflow-x: auto;
  margin-top: 1rem;
}
.segment-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}
.segment-table th {
  background: var(--app-bg);
  border-bottom: 2px solid var(--app-border);
  padding: 0.5rem 0.75rem;
  text-align: left;
  font-weight: 600;
}
.segment-table td {
  padding: 0.45rem 0.75rem;
  border-bottom: 1px solid var(--app-border);
}
.segment-bar-cell { min-width: 120px; }
.segment-bar {
  height: 10px;
  background: var(--app-accent);
  border-radius: 4px;
  transition: width 0.4s ease;
}

/* ── Customer Table ── */
.table-controls {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 0.75rem;
  align-items: center;
}
.search-input {
  padding: 0.45rem 0.75rem;
  border: 1px solid var(--app-border);
  border-radius: 6px;
  font-size: 0.875rem;
  flex: 1;
  min-width: 200px;
}
.customer-table-wrapper {
  overflow-x: auto;
  max-height: 480px;
  overflow-y: auto;
}
.customer-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}
.customer-table th {
  position: sticky;
  top: 0;
  background: var(--app-card-bg);
  border-bottom: 2px solid var(--app-border);
  padding: 0.45rem 0.6rem;
  text-align: left;
  font-weight: 600;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  cursor: pointer;
  white-space: nowrap;
}
.customer-table th:hover { background: var(--app-bg); }
.customer-table td {
  padding: 0.35rem 0.6rem;
  border-bottom: 1px solid var(--app-border);
}
.customer-table tr:hover td { background: #f8fafc; }
.clv-bar-cell { min-width: 100px; }
.clv-mini-bar {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.82rem;
}
.clv-mini-bar__fill {
  height: 8px;
  background: var(--app-accent);
  border-radius: 3px;
  min-width: 2px;
}

/* ── Simulation / What-If ── */
.levers-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
  margin: 1rem 0;
}
.lever-card {
  background: var(--app-bg);
  border: 1px solid var(--app-border);
  border-radius: 8px;
  padding: 0.9rem 1rem;
}
.lever-card__label { font-weight: 600; font-size: 0.9rem; margin-bottom: 0.4rem; }
.lever-card__hint { font-size: 0.78rem; color: var(--app-muted); margin-bottom: 0.6rem; }
.lever-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}
.lever-row input[type="range"] { flex: 1; }
.lever-select {
  flex: 1;
  padding: 0.4rem 0.6rem;
  border: 1px solid var(--app-border);
  border-radius: 6px;
  background: white;
  font-size: 0.875rem;
  color: var(--app-text);
  cursor: pointer;
}
.lever-value {
  font-weight: 700;
  font-size: 0.9rem;
  min-width: 50px;
  text-align: right;
  color: var(--app-accent);
}

.targeting-section { margin: 0.75rem 0; }
.targeting-label { display: flex; align-items: center; gap: 0.5rem; font-weight: 500; cursor: pointer; }
#target-segment-selector { margin-top: 0.5rem; padding-left: 1.5rem; }

.costs-grid {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--app-border);
}
.costs-grid h3 { margin-bottom: 0.25rem; font-size: 0.95rem; }
#cost-inputs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 0.75rem;
}
.cost-input-group {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  min-width: 180px;
}
.cost-input-group label { font-size: 0.85rem; font-weight: 500; }
.cost-input-row {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}
.cost-hint {
  font-size: 0.75rem;
  color: var(--muted, #8a9ab0);
  font-style: italic;
  line-height: 1.3;
}

.sim-actions {
  display: flex;
  gap: 0.75rem;
  margin-top: 1.25rem;
  flex-wrap: wrap;
}
.sim-results { margin-top: 1.5rem; }

/* ── CLV Hero Banner (What-If lead story) ─────────────────────── */
.clv-hero-banner {
  background: linear-gradient(135deg, #f0f9ff 0%, #f0fdf4 100%);
  border: 1.5px solid #bae6fd;
  border-radius: 12px;
  padding: 1rem 1.5rem 1.1rem;
  margin-bottom: 1rem;
  transition: border-color 0.2s, background 0.2s;
}
.clv-hero-banner[data-lift="negative"] {
  background: linear-gradient(135deg, #fff7f7 0%, #fef2f2 100%);
  border-color: #fca5a5;
}
.clv-hero__eyebrow {
  font-size: 0.70rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--app-muted);
  margin-bottom: 0.8rem;
}
.clv-hero__compare {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}
.clv-hero__pole { text-align: center; flex: 0 0 auto; min-width: 120px; }
.clv-hero__pole-value {
  font-size: 1.9rem;
  font-weight: 800;
  color: var(--app-accent);
  line-height: 1.1;
}
.clv-hero__pole--scenario .clv-hero__pole-value { color: #0f766e; }
.clv-hero-banner[data-lift="negative"] .clv-hero__pole--scenario .clv-hero__pole-value { color: #dc2626; }
.clv-hero__pole-label {
  font-size: 0.73rem;
  color: var(--app-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-top: 0.2rem;
}
.clv-hero__middle {
  flex: 1;
  display: flex;
  justify-content: center;
  min-width: 140px;
}
.clv-hero__lift-badge {
  background: #fff;
  border: 2px solid #86efac;
  border-radius: 10px;
  padding: 0.5rem 1.2rem 0.45rem;
  text-align: center;
  min-width: 130px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}
.clv-hero-banner[data-lift="negative"] .clv-hero__lift-badge { border-color: #fca5a5; }
.clv-hero__lift-value {
  display: block;
  font-size: 1.65rem;
  font-weight: 800;
  line-height: 1.15;
}
.clv-hero__lift-value--positive { color: #16a34a; }
.clv-hero__lift-value--negative { color: #dc2626; }
.clv-hero__lift-pct {
  display: block;
  font-size: 0.95rem;
  font-weight: 700;
  margin-top: 0.05rem;
}
.clv-hero__lift-pct--positive { color: #16a34a; }
.clv-hero__lift-pct--negative { color: #dc2626; }
.clv-hero__lift-label {
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--app-muted);
  margin-top: 0.3rem;
}
.sim-secondary-grid {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 1.25rem;
}

.sim-kpi-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}
.sim-kpi {
  flex: 1;
  min-width: 130px;
  background: var(--app-bg);
  border: 1px solid var(--app-border);
  border-radius: 8px;
  padding: 0.8rem 1rem;
  text-align: center;
}
.sim-kpi--highlight {
  background: #f0fdf4;
  border-color: #86efac;
}
.sim-kpi__value {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--app-accent);
}
.sim-kpi--highlight .sim-kpi__value { color: #16a34a; }
.sim-kpi__value.positive { color: #16a34a; }
.sim-kpi__value.negative { color: #dc2626; }
.sim-kpi__hint {
  font-size: 0.72rem;
  color: var(--app-muted);
  font-style: italic;
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
  display: inline;
}
.sim-kpi__label {
  font-size: 0.77rem;
  color: var(--app-muted);
  margin-top: 0.2rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
/* ── Zero-cost assumption warning ──────────────────────────────── */
.sim-zero-cost-warning {
  background: #fffbeb;
  border: 1px solid #f59e0b;
  border-left: 4px solid #f59e0b;
  border-radius: 6px;
  padding: 10px 14px;
  margin-bottom: 12px;
  font-size: 0.88rem;
  color: #92400e;
  line-height: 1.5;
}

.sim-narrative {
  font-size: 0.9rem;
  line-height: 1.7;
  padding: 0.5rem 0;
}

/* ── Scenario Comparison (in tab) ── */
.scenario-compare-intro {
  padding: 0.75rem 1rem;
  background: #f0f9ff;
  border-radius: 6px;
  border: 1px solid #bae6fd;
  margin-bottom: 1rem;
  font-size: 0.9rem;
}
.scenario-compare-summary {
  padding: 1rem;
  background: #f0fdf4;
  border-radius: 6px;
  border: 1px solid #86efac;
  margin-top: 1rem;
  font-size: 0.9rem;
  line-height: 1.6;
}

/* ── Strategic Summary Card ──────────────────────────────── */
.strategic-summary {
  background: linear-gradient(135deg, #f0f9ff 0%, #f5f3ff 100%);
  border: 1px solid #bae6fd;
  border-radius: 10px;
  padding: 1.25rem 1.5rem;
  margin: 1rem 0 1.5rem;
}
.strategic-summary__header {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 1rem;
}
.strategic-summary__icon { font-size: 1.4rem; }
.strategic-summary__title {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  color: #0c4a6e;
}
.summary-insight {
  background: white;
  border-radius: 8px;
  border: 1px solid #e0e7ef;
  padding: 0.85rem 1rem;
  margin-bottom: 0.75rem;
}
.summary-insight:last-child { margin-bottom: 0; }
.summary-insight__header {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
  flex-wrap: wrap;
}
.summary-insight__icon { font-size: 1.1rem; }
.summary-insight__label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.15em 0.55em;
  border-radius: 999px;
  background: #f1f5f9;
  color: #64748b;
}
.summary-insight__label.signal-good  { background: #dcfce7; color: #15803d; }
.summary-insight__label.signal-warn  { background: #fef9c3; color: #a16207; }
.summary-insight__label.signal-bad   { background: #fee2e2; color: #b91c1c; }
.summary-insight__label.signal-neutral { background: #f1f5f9; color: #475569; }
.summary-insight__headline {
  font-weight: 600;
  font-size: 0.92rem;
  color: #1e293b;
}
.summary-insight__detail {
  margin: 0;
  font-size: 0.88rem;
  line-height: 1.65;
  color: #374151;
}

/* ── Lever Analysis Tab ──────────────────────────────────── */
.lever-seg-row {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-wrap: wrap;
  margin-bottom: 0.75rem;
  padding: 0.5rem 0.75rem;
  background: #f0f9ff;
  border: 1px solid #bae6fd;
  border-radius: 6px;
  font-size: 0.875rem;
}
.lever-seg-row label {
  font-weight: 600;
  color: #0369a1;
  white-space: nowrap;
}
.lever-seg-select {
  padding: 0.25rem 0.5rem;
  border: 1px solid #bae6fd;
  border-radius: 5px;
  font-size: 0.875rem;
  background: white;
  color: #1e293b;
  cursor: pointer;
}
.lever-seg-note {
  font-size: 0.78rem;
  color: #64748b;
}
.lever-matrix-legend {
  display: flex;
  gap: 1.25rem;
  flex-wrap: wrap;
  margin-top: 0.5rem;
  padding: 0.4rem 0;
  font-size: 0.82rem;
  color: #374151;
  align-items: center;
}
.lever-legend-dot {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  margin-right: 0.25rem;
  vertical-align: middle;
}
.role-badge {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.15em 0.55em;
  border-radius: 999px;
  white-space: nowrap;
}
.role-badge--dual-driver       { background: #dbeafe; color: #1d4ed8; }
.role-badge--retention-driver  { background: #dcfce7; color: #15803d; }
.role-badge--spend-driver      { background: #fef9c3; color: #a16207; }
.role-badge--not-significant   { background: #f1f5f9; color: #9ca3af; }
.sig { color: #16a34a; font-weight: 700; font-size: 0.9em; }
.insig { opacity: 0.45; }

/* ── CLV Distribution Tab ───────────────────────────────── */
.dist-stats-row {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  margin-top: 0.75rem;
  padding: 0.75rem 0;
  border-top: 1px solid #e5e7eb;
  border-bottom: 1px solid #e5e7eb;
}
.dist-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 80px;
}
.dist-stat__val {
  font-size: 1.2rem;
  font-weight: 700;
  color: #1e293b;
}
.dist-stat__lbl {
  font-size: 0.75rem;
  color: #64748b;
  text-align: center;
}
.interpretation-block {
  padding: 0.75rem 1rem;
  background: #f8fafc;
  border-left: 3px solid #0284c7;
  border-radius: 0 6px 6px 0;
  margin-top: 0.75rem;
}
.interpretation-block__text {
  margin: 0;
  font-size: 0.875rem;
  line-height: 1.7;
  color: #1e293b;
}
.triage-summary-card {
  background: #fff7ed;
  border: 1px solid #fed7aa;
  border-radius: 8px;
  padding: 0.75rem 1rem;
  font-size: 0.88rem;
  line-height: 1.65;
  color: #1c1917;
}
.clv-bar-cell { min-width: 140px; }
.clv-mini-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.82rem;
}
.clv-mini-bar__fill {
  height: 8px;
  border-radius: 4px;
  flex-shrink: 0;
}
.clv-mini-bar__fill--risk { background: #f97316; }

/* ── Misc ── */
.hidden { display: none !important; }
.muted { color: var(--app-muted); font-size: 0.875rem; }
code {
  background: rgba(0,0,0,0.06);
  border-radius: 3px;
  padding: 0.1em 0.35em;
  font-size: 0.88em;
  font-family: 'Courier New', monospace;
}

/* ============================================================
   CLV Conceptual Overview Section
   ============================================================ */
.clv-concept-section .card {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}
.clv-concept-section > h2 {
  margin-bottom: 0.5rem;
}

/* ── Why CLV Animated Diagram ── */
/* ── Hero canvas animation ── */
.clv-hero-figure {
  margin: 1.25rem 0;
  padding: 1rem 0.75rem 0.75rem;
  background: linear-gradient(135deg, #f0f9ff 0%, #f0fdf4 100%);
  border: 1px solid var(--app-border);
  border-radius: 12px;
}
.clv-hero-canvas {
  display: block;
  width: 100%;
  max-width: 720px;
  min-height: 222px;
  margin: 0 auto;
  border-radius: 6px;
}
.clv-hero-fig-caption {
  text-align: center;
  font-size: 0.8rem;
  color: var(--app-muted);
  margin-top: 0.6rem;
  line-height: 1.5;
}
.clv-hero-intv-tag {
  display: inline-block;
  background: #fef3c7;
  border: 1px solid #fcd34d;
  border-radius: 4px;
  padding: 0 0.3rem;
  font-size: 0.75rem;
  vertical-align: middle;
}

/* ── Data Needs Grid ── */
.clv-data-needs-grid {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  margin: 0.75rem 0;
}
.clv-data-need {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  background: #f8f9fb;
  border-radius: 7px;
  padding: 0.75rem 0.9rem;
  border-left: 3px solid var(--app-accent, #0284c7);
  font-size: 0.875rem;
  line-height: 1.6;
}
.clv-data-need__icon {
  font-size: 1.25rem;
  flex-shrink: 0;
  padding-top: 0.05rem;
}

/* ── Collapsible HOW CLV IS CALCULATED ── */
.clv-calc-details {
  border: none;
  outline: none;
}
.clv-calc-details > summary {
  list-style: none;
  cursor: pointer;
  user-select: none;
}
.clv-calc-details > summary::-webkit-details-marker { display: none; }
.clv-calc-summary-heading {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  margin: 0;
  cursor: pointer;
}
.clv-calc-summary-heading::before {
  content: '▶';
  font-size: 0.65em;
  color: var(--app-accent, #0284c7);
  transition: transform 0.2s ease;
  display: inline-block;
}
.clv-calc-details[open] .clv-calc-summary-heading::before {
  transform: rotate(90deg);
}
.clv-calc-hint {
  font-size: 0.78rem;
  font-weight: 400;
  color: var(--app-muted);
  font-style: italic;
  letter-spacing: 0;
  text-transform: none;
}
.clv-calc-details > summary:hover .clv-calc-summary-heading {
  color: var(--app-accent, #0284c7);
}
.clv-calc-details > summary:hover .clv-calc-hint {
  color: var(--app-accent, #0284c7);
}

/* ============================================================
   What-If Component Breakdown
   ============================================================ */
.sim-component-breakdown { margin: 0.75rem 0; }
.sim-component-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}
@media (max-width: 600px) {
  .sim-component-grid { grid-template-columns: 1fr; }
}
.sim-component-card {
  background: #f8f9fb;
  border: 1px solid var(--app-border);
  border-radius: 8px;
  padding: 0.85rem 1rem;
}
.sim-component-card__label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--app-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 0.5rem;
}
.sim-component-card__compare {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.sim-comp-val {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--app-text);
  display: block;
}
.sim-comp-sublabel {
  font-size: 0.72rem;
  color: var(--app-muted);
  display: block;
}
.sim-comp-arrow {
  font-size: 1.25rem;
  color: var(--app-muted);
  flex-shrink: 0;
}
.sim-comp-delta {
  margin-top: 0.5rem;
  font-size: 0.85rem;
  font-weight: 600;
}
.sim-comp-delta.positive { color: #16a34a; }
.sim-comp-delta.negative { color: #dc2626; }

/* ============================================================
   Customer Spotlight
   ============================================================ */
.spl-inputs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.1rem 2.5rem;
  margin-bottom: 1.5rem;
}
.spl-input-block {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.spl-input-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}
.spl-input-label {
  font-size: 0.82rem;
  font-weight: 700;
  color: #374151;
}
.spl-signal {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  white-space: nowrap;
}
.spl-signal.sig-low  { background: #fee2e2; color: #b91c1c; }
.spl-signal.sig-mid  { background: #e0f2fe; color: #0369a1; }
.spl-signal.sig-high { background: #dcfce7; color: #15803d; }
.spl-section {
  margin-bottom: 1.4rem;
}
.spl-section-label {
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #6b7280;
  margin-bottom: 0.75rem;
  padding-bottom: 0.35rem;
  border-bottom: 1px solid #e5e7eb;
}
.spl-input-block--wide {
  grid-column: 1 / -1;
}
.spl-input-sublabel {
  font-size: 0.77rem;
  color: #6b7280;
  margin: 0.1rem 0 0.5rem;
}
.spl-slider-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.spl-range-edge {
  font-size: 0.72rem;
  color: #9ca3af;
  flex-shrink: 0;
  min-width: 28px;
  text-align: center;
}
.spotlight-slider {
  flex: 1;
  accent-color: #0284c7;
  cursor: pointer;
}
.spotlight-number {
  width: 74px;
  padding: 0.25rem 0.4rem;
  border: 1px solid var(--app-border);
  border-radius: 5px;
  font-size: 0.85rem;
  flex-shrink: 0;
}
/* Categorical pill-buttons */
.spl-cat-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}
.spl-cat-option {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.3rem 0.75rem;
  border: 1.5px solid #d1d5db;
  border-radius: 999px;
  font-size: 0.8rem;
  cursor: pointer;
  background: #f9fafb;
  transition: background 0.12s, border-color 0.12s;
  user-select: none;
}
.spl-cat-option:hover { border-color: #60a5fa; background: #eff6ff; }
.spl-cat-option--selected {
  background: #eff6ff;
  border-color: #3b82f6;
  color: #1d4ed8;
}
.spl-cat-radio { display: none; }
.spl-cat-name  { font-weight: 600; }
.spl-cat-pct   { font-size: 0.72rem; color: #6b7280; }
.spl-cat-option--selected .spl-cat-pct { color: #3b82f6; }

/* Results panel */
.spotlight-results-panel {
  border-top: 1px solid #e5e7eb;
  padding-top: 1.25rem;
  margin-top: 0.5rem;
}
.spotlight-kpis {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}
.spl-chart-wrap {
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 1rem 1.25rem;
}
.spl-chart-label {
  font-size: 0.78rem;
  color: #6b7280;
  margin-bottom: 0.6rem;
}
.spl-bar-chart {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 90px;
}
.spl-bar-wrap {
  flex: 1;
  height: 100%;
  display: flex;
  align-items: flex-end;
  cursor: default;
}
.spl-bar {
  width: 100%;
  background: #3b82f6;
  border-radius: 2px 2px 0 0;
  min-height: 2px;
  transition: height 0.18s ease;
}
.spl-bar--neg {
  background: #ef4444;
  border-radius: 0 0 2px 2px;
  align-self: flex-start;
}
.spl-chart-axis {
  display: flex;
  justify-content: space-between;
  font-size: 0.72rem;
  color: #9ca3af;
  margin-top: 0.3rem;
}
@media (max-width: 720px) {
  .spotlight-kpis   { grid-template-columns: 1fr 1fr; }
  .spl-inputs-grid  { grid-template-columns: 1fr; }
}

