/**
 * Budget Tools — interactive calculators (Insights sub-page)
 * Always light theme — intentionally ignores data-theme="dark"
 * shared.css is NOT loaded here, so we redefine the new semantic
 * tokens locally with light-theme values. Otherwise the Step 3
 * cleanup pass (which references var(--accent-cyan), --bg-surface,
 * etc.) leaves the active tab transparent + invisible.
 */
:root {
  --ml-bg-top:      #e4eaf6;
  --ml-bg-mid:      #eef2fb;
  --ml-card:        #ffffff;
  --ml-card-border: rgba(99, 102, 241, 0.14);
  --ml-shadow:      0 4px 6px rgba(15, 23, 42, 0.04), 0 12px 28px rgba(15, 23, 42, 0.08), 0 0 0 1px rgba(148, 163, 184, 0.12);
  --ml-shadow-hover:0 8px 16px rgba(15, 23, 42, 0.06), 0 22px 48px rgba(15, 23, 42, 0.12);
  --ml-text:        #0f172a;
  --ml-muted:       #475569;
  --ml-page-inset:  clamp(16px, 3vw, 36px);
  --ml-page-max:    min(1680px, calc(100vw - var(--ml-page-inset) * 2));
  --ml-accent-a:    #6366f1;
  --ml-accent-b:    #0284c7;
  --ml-accent-bright:#0ea5e9;
  --ml-accent-c:    #10b981;
  --ml-accent-d:    #f59e0b;
  --ml-radius:      18px;
  --ml-radius-sm:   12px;
  --ml-border-line: #e2e8f0;
  --ml-font:        'Plus Jakarta Sans', ui-sans-serif, system-ui, sans-serif;

  /* Semantic tokens (light-theme values — page is always light) */
  --bg-page:        #f1f6fc;
  --bg-surface:     #ffffff;
  --bg-elevated:    #e9eff7;
  --border-line:    #dfe6f0;
  --text-primary:   #0f172a;
  --text-secondary: #475569;
  --text-muted:     #94a3b8;
  --accent-cyan:    #0891b2;
  --accent-gold:    #d97706;
  --status-success: #059669;
  --status-danger:  #dc2626;
  --shadow-card:    0 1px 3px rgba(15, 23, 42, 0.06);
}

/* Beat Tailwind preflight / shell: lock typography to app font inside Budget Tools */
body.budget-tools,
body.budget-tools .ml-page,
body.budget-tools .ml-page input,
body.budget-tools .ml-page button,
body.budget-tools .ml-page textarea,
body.budget-tools .ml-page select {
  font-family: var(--ml-font);
  font-feature-settings: 'kern' 1, 'liga' 1;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.ml-page {
  background: var(--bg-page);
  color: var(--ml-text);
  min-height: calc(100vh - var(--shell-h, 68px));
  padding-bottom: 32px;
}

/* ── Shell: full-width workspace ── */
.bt-shell {
  width: 100%;
  max-width: var(--ml-page-max);
  margin: 0;
  padding: 0 var(--ml-page-inset);
}

.bt-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  padding: 18px 0 14px;
  border-bottom: 1px solid var(--ml-border-line);
}

.bt-top__copy { flex: 1; min-width: 0; }

.bt-top__badge {
  flex-shrink: 0;
  align-self: flex-start;
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #0369a1;
  background: #e0f2fe;
  border: 1px solid rgba(8, 145, 178, 0.25);
}

.ml-main,
.bt-main {
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 0 0 28px;
}

/* legacy wrappers */
.ml-page-intro,
.ml-tabbar-outer { display: none; }

.ml-page-title {
  font-size: clamp(1.5rem, 2.8vw, 2rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--ml-text);
  margin: 0 0 6px;
  line-height: 1.15;
}

.ml-page-desc {
  font-size: var(--fs-base);
  color: var(--ml-muted);
  margin: 0;
  line-height: 1.55;
  max-width: 70ch;
}

/* ── Tabs: full-width grid ── */
.bt-tabs-wrap {
  position: sticky;
  top: var(--shell-h, 68px);
  z-index: 40;
  padding: 12px 0 14px;
  background: linear-gradient(180deg, var(--bg-page) 80%, rgba(241, 246, 252, 0));
}

.bt-tabs,
.ml-tabbar.bt-tabs {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(104px, 1fr));
  gap: 6px;
  margin: 0;
  padding: 6px;
  background: #fff;
  border-radius: 14px;
  border: 1px solid var(--ml-border-line);
  box-shadow: 0 2px 12px rgba(15, 23, 42, 0.05);
  overflow: visible;
}

@media (max-width: 900px) {
  .bt-tabs,
  .ml-tabbar.bt-tabs {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}
@media (max-width: 540px) {
  .bt-tabs,
  .ml-tabbar.bt-tabs {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .bt-top { flex-direction: column; }
}

/* ── Panel layout ── */
.bt-panel { display: flex; flex-direction: column; gap: 16px; }

.bt-panel-head {
  display: flex;
  align-items: flex-start;
  gap: 14px;
}

.bt-panel-head__text { flex: 1; min-width: 0; }

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

@media (max-width: 900px) {
  .bt-kpi-row { grid-template-columns: 1fr; }
}

.bt-kpi {
  padding: 16px 18px;
  border-radius: var(--ml-radius);
  background: #fff;
  border: 1px solid var(--ml-border-line);
  box-shadow: var(--shadow-card);
}

.bt-kpi--accent {
  background: linear-gradient(135deg, #ecfeff, #f0f9ff);
  border-color: rgba(8, 145, 178, 0.22);
}

.bt-kpi__val {
  display: block;
  margin-top: 4px;
  font-size: clamp(1.5rem, 3.5vw, 2rem);
  font-weight: 900;
  letter-spacing: -0.03em;
  color: var(--ml-text);
  font-variant-numeric: tabular-nums;
}

.bt-kpi--income .ml-disclaimer {
  margin-top: 6px;
  display: block;
}

.bt-subs-grid {
  display: grid;
  grid-template-columns: minmax(280px, 0.42fr) minmax(0, 1fr);
  gap: 14px;
  align-items: stretch;
}

@media (max-width: 1000px) {
  .bt-subs-grid { grid-template-columns: 1fr; }
}

.bt-subs-toolbar { display: flex; flex-direction: column; gap: 10px; }

.bt-toolbar-label {
  margin: 0;
  font-size: var(--fs-xs);
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ml-muted);
}

.bt-subs-table {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.bt-subs-table .ml-sub-rows {
  flex: none;
}

/* Two-column calculators */
.bt-split {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  align-items: start;
}

@media (min-width: 960px) {
  .bt-split {
    grid-template-columns: minmax(0, 1.15fr) minmax(300px, 0.85fr);
    gap: 18px;
  }
  /* Debt is the one panel whose RIGHT card carries the dense content -- payoff stats,
     the 48-bar balance trajectory, the insight. The default ratio put the thin
     balance/APR input card in the wide column and squeezed the trajectory into 470px. */
  .bt-split--results-wide {
    grid-template-columns: minmax(0, 0.82fr) minmax(340px, 1.18fr);
  }
  .bt-split > .ml-glass:last-child:not(:only-child),
  .bt-split > .ml-donut-wrap,
  .bt-split > .ml-glass--results {
    position: sticky;
    top: 148px;
    align-self: start;
  }
}

/* legacy */
.ml-tool-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  align-items: start;
}

/* ── PAGE HEADER (breadcrumb) — legacy paths ── */
.ml-page-header-outer {
  max-width: min(1600px, 95vw);
  margin: 0 auto;
  padding: 0 clamp(16px, 4vw, 36px);
}

.ml-page-header {
  padding: 24px 0 20px;
  border-bottom: 1px solid var(--ml-border-line);
}

.ml-breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
}

.ml-breadcrumb a {
  color: var(--ml-accent-b);
  text-decoration: none;
}
.ml-breadcrumb a:hover { text-decoration: underline; }

.ml-breadcrumb-sep {
  color: var(--ml-muted);
  font-size: 12px;
}

.ml-breadcrumb-current {
  color: var(--ml-text);
  font-weight: 700;
}

/* ── TAB BAR (legacy class hooks for JS) ── */
.ml-tabbar-outer {
  display: none;
}

.ml-tabbar:not(.bt-tabs) {
  display: flex;
  gap: 6px;
  overflow-x: auto;
}

.ml-tab {
  flex-shrink: unset;
  width: 100%;
  text-align: center;
  padding: 11px 8px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: #334155;
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  letter-spacing: -0.01em;
  white-space: nowrap;
  transition: color 0.15s, background 0.15s, border-color 0.15s;
}

.ml-tab:hover {
  color: var(--ml-text);
  background: #f8fafc;
  border-color: #e2e8f0;
}

.ml-tab.is-active {
  color: #fff;
  font-weight: 700;
  background: var(--accent-cyan);
  border-color: transparent;
  box-shadow: 0 2px 8px rgba(8, 145, 178, 0.22);
}

/* ── PANELS ── */
.ml-panels { }

.ml-panel { display: block; }

/* !important prevents any other stylesheet from showing hidden panels */
.ml-panel--hidden { display: none !important; }

/* legacy grid — bt-split replaces this in markup */
.ml-tool-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  align-items: start;
}

/* ── GLASS CARD ── */
.ml-glass {
  background: var(--ml-card);
  border-radius: var(--ml-radius);
  border: 1px solid var(--ml-border-line);
  box-shadow: var(--shadow-card);
  padding: clamp(16px, 2.5vw, 22px);
  position: relative;
  overflow: hidden;
}

.ml-glass::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--accent-cyan);
  opacity: 0.9;
  border-radius: var(--ml-radius) var(--ml-radius) 0 0;
  pointer-events: none;
}

.ml-sub-summary {
  display: none;
}

.ml-sub-summary-stat {
  padding: 14px 16px;
  border-radius: var(--ml-radius-sm);
  background: #f8fafc;
  border: 1px solid var(--ml-border-line);
}

.ml-sub-summary-stat--primary {
  background: linear-gradient(135deg, #ecfeff, #f0f9ff);
  border-color: rgba(8, 145, 178, 0.22);
}

.ml-sub-summary-lbl {
  display: block;
  font-size: var(--fs-xs);
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ml-muted);
  margin-bottom: 4px;
}

.ml-sub-summary-val {
  display: block;
  font-size: clamp(1.35rem, 4vw, 1.65rem);
  font-weight: 900;
  letter-spacing: -0.03em;
  color: var(--ml-text);
  font-variant-numeric: tabular-nums;
}

.ml-sub-summary-meta {
  display: block;
  margin-top: 2px;
  font-size: 12px;
  font-weight: 700;
  color: var(--ml-muted);
}

.ml-sub-list-head {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ml-muted);
  padding-top: 4px;
  border-top: 1px solid var(--ml-border-line);
}

.ml-sub-controls {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* ── TOOL HEAD ── */
.ml-tool-head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 12px;
}

.ml-tool-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--fs-2xl);
  flex-shrink: 0;
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.18);
}

.ml-tool-icon--subs { background: #6366f1; }
.ml-tool-icon--pay  { background: #0284c7; }
.ml-tool-icon--apr  { background: #dc2626; }
.ml-tool-icon--cry  { background: #d97706; }
.ml-tool-icon--ef   { background: #059669; }
.ml-tool-icon--rvb  { background: #d97706; }
.ml-tool-icon--budget { background: #0891b2; }
.ml-tool-icon--nw   { background: #059669; }

.ml-tool-title {
  font-size: 1.05rem;
  font-weight: 800;
  margin: 0 0 4px;
  letter-spacing: -0.025em;
  color: var(--ml-text);
}

.ml-tool-sub {
  font-size: 14px;
  color: #334155;
  margin: 0;
  line-height: 1.5;
}

.ml-viz-title {
  margin: 0 0 6px;
  font-size: var(--fs-xs);
  font-weight: 800;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: #475569;
}

.ml-viz-hint {
  margin: 0 0 12px;
  font-size: 13px;
  font-weight: 500;
  color: var(--ml-muted);
  line-height: 1.45;
}

.ml-inline-viz {
  margin-top: 14px;
  padding: 14px;
  border-radius: var(--ml-radius-sm);
  background: var(--bg-elevated);
  border: 1px solid var(--border-line);
}

.ml-totals-line {
  margin-top: 16px;
  margin-bottom: 0;
  font-size: 13px;
  font-weight: 600;
  color: #334155;
  line-height: 1.5;
}

/* ── YEARLY HERO CARD ─ wake-up number — keeps its gradient on purpose ── */
/* Year-card is now a small chip on the controls row (no hero) */
.ml-sub-year-card {
  flex: 0 0 auto;
  align-self: flex-end;
  padding: 8px 14px;
  min-width: 132px;
  border-radius: 14px;
  background:
    radial-gradient(circle at 12% 0%, rgba(244, 114, 182, 0.22), transparent 42%),
    linear-gradient(135deg, rgba(255, 255, 255, 0.96), rgba(245, 243, 255, 0.94));
  border: 1px solid rgba(168, 85, 247, 0.24);
  box-shadow: 0 6px 16px rgba(124, 58, 237, 0.08);
  text-align: right;
}
.ml-sub-year-card span,
.ml-sub-year-card small {
  display: block;
  color: #64748b;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.ml-sub-year-card strong {
  display: block;
  margin: 2px 0 1px;
  color: #581c87;
  font-size: 18px;
  font-weight: 900;
  letter-spacing: -0.03em;
}

.ml-totals-line strong {
  font-weight: 800;
  color: var(--ml-text);
  font-variant-numeric: tabular-nums;
}

/* ── FORM FIELDS ── */
.ml-field {
  margin-bottom: 10px;
}

.ml-sub-controls .ml-field {
  margin-bottom: 0;
}

.ml-field label {
  display: block;
  font-size: var(--fs-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #334155;
  margin-bottom: 5px;
}

.ml-input {
  width: 100%;
  max-width: 100%;
  padding: 10px 12px;
  border-radius: var(--ml-radius-sm);
  border: 1.5px solid var(--ml-border-line);
  background: #ffffff;
  color: var(--ml-text);
  font-size: 15px;
  font-weight: 600;
  font-family: inherit;
  font-variant-numeric: tabular-nums;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.ml-input--full {
  max-width: 100%;
}

.ml-input:focus {
  outline: none;
  border-color: var(--ml-accent-b);
  box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.18);
}

/* ── SLIDER ── */
.ml-slider-row {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.ml-slider {
  flex: 1;
  min-width: 160px;
  height: 7px;
  border-radius: 999px;
  appearance: none;
  background: var(--bg-elevated);
}

.ml-slider::-webkit-slider-thumb {
  appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #ffffff;
  border: 2px solid var(--ml-accent-b);
  box-shadow: 0 3px 12px rgba(14, 165, 233, 0.35);
  cursor: grab;
}

.ml-slider-val {
  font-family: ui-monospace, monospace;
  font-weight: 800;
  font-size: 14px;
  min-width: 52px;
  color: var(--ml-accent-b);
}

/* ── BIG NUMBER ── */
.ml-big-number {
  font-size: clamp(2rem, 5vw, 2.75rem);
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.03em;
  color: var(--text-primary);
  line-height: 1.1;
}

/* ── INSIGHT CALLOUT ── */
.ml-insight {
  margin-top: 10px;
  padding: 10px 14px;
  border-radius: var(--ml-radius-sm);
  background: var(--bg-elevated);
  border: 1px solid var(--border-line);
  border-left: 3px solid var(--status-success);
  font-size: var(--fs-sm);
  font-weight: 600;
  line-height: 1.5;
  color: var(--text-primary);
}
.ml-insight:empty { display: none; }

.ml-disclaimer {
  font-size: var(--fs-xs);
  color: var(--ml-muted);
  margin-top: 8px;
  line-height: 1.45;
}

.ml-sub-rows {
  display: flex;
  flex-direction: column;
  gap: 8px;
  /* Grow with the page — no nested scroll that hides subscription rows. */
  max-height: none;
  overflow: visible;
  padding-right: 0;
}

.ml-sub-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 96px 36px;
  grid-template-rows: auto auto;
  gap: 8px 8px;
  align-items: center;
  padding: 12px;
  background: #ffffff;
  border: 1px solid var(--ml-border-line);
  border-radius: 12px;
}

.ml-sub-row > input:first-of-type {
  grid-column: 1;
  grid-row: 1;
}

.ml-sub-row > input:nth-of-type(2) {
  grid-column: 2;
  grid-row: 1;
}

.ml-sub-row > .ml-btn-sm {
  grid-column: 3;
  grid-row: 1;
}

.ml-sub-row-burn {
  grid-column: 1 / -1;
  grid-row: 2;
  display: grid;
  gap: 4px;
  min-width: 0;
}

.ml-sub-row-burn span {
  color: var(--ml-muted);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

@media (max-width: 480px) {
  .ml-sub-row {
    grid-template-columns: minmax(0, 1fr) 80px 36px;
  }
}

.ml-sub-row input[type="text"] {
  max-width: none;
  width: 100%;
  padding: 8px 10px;
  font-size: 14px;
}

@media (max-width: 540px) {
  .ml-sub-summary { grid-template-columns: 1fr; }
  .ml-tab { padding: 9px 12px; font-size: 12px; }
}

.ml-sub-row .ml-bar-track {
  height: 9px;
  background: rgba(168, 85, 247, 0.16);
}

.ml-sub-row .ml-bar-fill {
  background: var(--accent-cyan);
  box-shadow: none;
}

.ml-btn-sm {
  border: none;
  border-radius: 10px;
  width: 36px;
  height: 36px;
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
  background: rgba(239, 68, 68, 0.1);
  color: #ef4444;
  transition: background 0.15s;
}
.ml-btn-sm:hover { background: rgba(239, 68, 68, 0.22); }

/* ── CHIPS ── */
.ml-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 0;
}

.ml-chip {
  border: 1px solid rgba(148, 163, 184, 0.45);
  background: #fff;
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  color: var(--ml-text);
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
  font-family: inherit;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}
.ml-chip:hover {
  border-color: var(--ml-accent-a);
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.15);
  transform: translateY(-1px);
}

.ml-btn-add {
  border: none;
  cursor: pointer;
  padding: 10px 16px;
  border-radius: var(--ml-radius-sm);
  font-weight: 800;
  font-size: 13px;
  font-family: inherit;
  background: var(--accent-cyan);
  color: #fff;
  box-shadow: 0 4px 14px rgba(8, 145, 178, 0.2);
}
.ml-btn-add:hover { filter: brightness(1.05); }

/* ── BAR CHART ── */
.ml-bar-chart {
  margin-top: 4px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.ml-bar-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px 12px;
  align-items: center;
  font-size: 13px;
  font-weight: 600;
  color: var(--ml-text);
}

.ml-bar-name {
  font-weight: 700;
  letter-spacing: -0.02em;
}

.ml-bar-item .ml-bar-amt {
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: #0284c7;
  font-size: 13px;
  text-align: right;
}

.ml-bar-track {
  grid-column: 1 / -1;
  height: 11px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.22);
  overflow: hidden;
  box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.06);
}

.ml-bar-fill {
  height: 100%;
  border-radius: inherit;
  background: var(--accent-cyan);
  transition: width 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ── DONUT ── */
.ml-donut-wrap {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 12px;
}
.ml-donut { width: 180px; height: 180px; }

.ml-donut-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  margin-top: 14px;
  font-size: 12px;
  font-weight: 600;
  color: var(--ml-text);
}
.ml-donut-legend--stack {
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  max-width: 220px;
  margin-left: auto;
  margin-right: auto;
}
.ml-legend-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  display: inline-block;
  margin-right: 6px;
}

/* ── PROGRESS BAR ── */
.ml-progress-wrap {
  height: 11px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.22);
  overflow: hidden;
}
.ml-progress-fill {
  height: 100%;
  border-radius: inherit;
  background: var(--status-success);
  transition: width 0.45s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ── CHECKBOX ── */
.ml-check-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-top: 10px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ml-text);
  cursor: pointer;
}
.ml-check-row input {
  margin-top: 3px;
  width: 16px;
  height: 16px;
  accent-color: var(--ml-accent-a);
}

/* ── SECTION KICKER ── */
.ml-section-kicker {
  margin: 0 0 6px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ml-accent-b);
}

/* ── PAYOFF CARD ── */
.ml-payoff-mode {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}
.ml-payoff-mode .ml-chip.is-active {
  border-color: transparent;
  color: #fff;
  background: var(--accent-cyan);
  box-shadow: 0 2px 8px rgba(8, 145, 178, 0.22);
}

.ml-payoff-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 16px 0 14px;
}
.ml-payoff-stat {
  padding: 13px 14px;
  border-radius: var(--ml-radius-sm);
  background: rgba(99, 102, 241, 0.05);
  border: 1px solid rgba(99, 102, 241, 0.14);
}
.ml-payoff-stat--wide { grid-column: 1 / -1; }
.ml-payoff-stat__lbl {
  display: block;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ml-muted);
  margin-bottom: 5px;
}
.ml-payoff-stat__val {
  font-size: 1.2rem;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  color: var(--ml-text);
}

.ml-payoff-chart-wrap { margin-top: 8px; }
.ml-payoff-chart-title {
  display: block;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ml-muted);
  margin-bottom: 10px;
}
.ml-payoff-chart {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 3px;
  height: 112px;
  padding: 10px 8px 8px;
  border-radius: var(--ml-radius-sm);
  background: rgba(148, 163, 184, 0.07);
  border: 1px solid var(--ml-border-line);
}
.ml-payoff-chart.is-empty {
  align-items: center;
  justify-content: center;
  color: var(--ml-muted);
  font-size: 12px;
  font-weight: 600;
}
.ml-payoff-col {
  flex: 1;
  min-width: 0;
  height: 100%;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.ml-payoff-bar {
  width: 100%;
  max-width: 14px;
  margin: 0 auto;
  border-radius: 6px 6px 2px 2px;
  background: var(--status-danger);
  opacity: 0.75;
  transition: height 0.45s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ── INLINE LINKS ── */
.ml-back, .ml-inline-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 700;
  color: var(--ml-accent-b);
  text-decoration: none;
}
.ml-back:hover, .ml-inline-link:hover { text-decoration: underline; }
.ml-payoff-card .ml-inline-link { display: inline-block; margin-top: 14px; }

/* ── FOOTER ── */
.ml-footer-note {
  text-align: left;
  margin-top: 28px;
  padding-top: 16px;
  border-top: 1px solid var(--ml-border-line);
  font-size: 12px;
  color: var(--ml-muted);
  line-height: 1.6;
}


/* ── Milestone / drawdown ladders ────────────────────────────────────────────
   These replaced two "results" cards that held a single sentence and a link,
   floating vertically centred in a 470px column with nothing else in it. */
.bt-ladder { display: flex; flex-direction: column; gap: 2px; margin-top: 10px; }
.bt-ladder__row {
  display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
  padding: 10px 0; border-bottom: 1px solid var(--ml-line, rgba(15,23,42,.08));
}
.bt-ladder__row:last-child { border-bottom: 0; }
.bt-ladder__k { font-size: var(--fs-sm); font-weight: 700; color: var(--ml-ink, #0f172a); }
.bt-ladder__v {
  font-size: var(--fs-sm); font-weight: 800; font-variant-numeric: tabular-nums;
  color: var(--ml-muted); text-align: right;
}
.bt-ladder__v b { color: var(--ml-ink, #0f172a); font-weight: 850; }
.bt-ladder__row--hit .bt-ladder__k,
.bt-ladder__row--hit .bt-ladder__v b { color: #059669; }
.bt-ladder__row--warn .bt-ladder__v b { color: #b45309; }
.bt-ladder__row--crit .bt-ladder__v b { color: #be123c; }
