:root {
  --bg: #0a0e14;
  --surface: #131920;
  --surface-elevated: #1a222d;
  --border: #263244;
  --text: #e6edf3;
  --text-soft: #b1bac4;
  --muted: #7d8590;
  /* Asaari brand green */
  --accent: #7AFF57;
  --accent-hover: #8fff6b;
  --accent-dim: rgba(122, 255, 87, 0.12);
  --accent-glow: rgba(122, 255, 87, 0.15);
  --accent-text: #0a0e14;
  --senior: #58a6ff;
  --senior-dim: rgba(88, 166, 255, 0.12);
  --mezzanine: #a371f7;
  --mezzanine-dim: rgba(163, 113, 247, 0.12);
  --junior: #d29922;
  --junior-dim: rgba(210, 153, 34, 0.12);
  --success: #3fb950;
  --warning: #d29922;
  --warning-yellow: #ffc107;
  --warning-yellow-bg: rgba(255, 193, 7, 0.08);
  --warning-yellow-border: rgba(255, 193, 7, 0.3);
  --danger: #f85149;
  --danger-bg: rgba(248, 81, 73, 0.1);
  --danger-border: rgba(248, 81, 73, 0.3);
  --info-bg: rgba(88, 166, 255, 0.1);
  --info-border: rgba(88, 166, 255, 0.3);
  --white: #fff;
  /* Border-radius scale — softened for Asaari brand */
  --radius-xs: 4px;
  --radius-sm: 6px;
  --radius: 12px;
  --radius-lg: 16px;
  --radius-pill: 999px;
  /* Typography scale */
  --text-2xs: 0.65rem;
  --text-xs: 0.7rem;
  --text-sm: 0.78rem;
  --text-base: 0.875rem;
  --text-lg: 1rem;
  --text-xl: 1.15rem;
  --text-2xl: 1.5rem;
  --font-heading: 'Outfit', 'Inter', 'Segoe UI', system-ui, sans-serif;
  --font-sans: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', 'SF Mono', ui-monospace, monospace;
}
* { box-sizing: border-box; }
body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  margin: 0;
  padding: 0;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
.container { max-width: 980px; margin: 0 auto; padding: 1.5rem 1.25rem; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem 1.75rem;
  margin-bottom: 1.25rem;
  transition: border-color 0.2s ease, box-shadow 0.3s ease, transform 0.2s ease;
}
.card:hover {
  border-color: rgba(122, 255, 87, 0.18);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.25), 0 0 0 1px rgba(122, 255, 87, 0.06);
  transform: translateY(-1px);
}
.card h2 { font-family: var(--font-heading); font-size: 1.05rem; margin: 0 0 0.5rem; font-weight: 600; color: var(--text); letter-spacing: -0.01em; }
.card .blurb { color: var(--muted); font-size: 0.875rem; margin-bottom: 1rem; line-height: 1.5; }

#returnsCard.card { padding: 1.25rem 1.5rem; }
#returnsCard .card-title-row { display: flex; flex-direction: column; gap: 0.35rem; margin-bottom: 0.75rem; }
#returnsCard .card-title-row h2 { margin: 0; font-size: 1.05rem; }
#returnsCard .card-title-row .blurb { margin: 0; font-size: 0.8rem; color: var(--muted); font-weight: 400; line-height: 1.4; max-width: 100%; }
.returns-hero {
  background: var(--surface-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow-x: auto;
  overflow-y: visible;
  margin-bottom: 0;
  -webkit-overflow-scrolling: touch;
}
.returns-table { width: 100%; min-width: 480px; border-collapse: collapse; font-size: 0.8rem; table-layout: fixed; }
.returns-table th, .returns-table td { padding: 0.6rem 0.75rem; border-bottom: 1px solid var(--border); font-variant-numeric: tabular-nums; vertical-align: top; }
.returns-table th { color: var(--muted); font-weight: 600; font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.04em; white-space: nowrap; text-align: left; }
.returns-table th.num, .returns-table td.num { text-align: right; }
.returns-table .col-tranche { width: 6rem; min-width: 6rem; }
.returns-table .col-capital { width: 5.5rem; min-width: 5.5rem; }
.returns-table .col-period { min-width: 5rem; width: 5rem; }
.returns-table tbody tr { transition: background 0.1s ease; }
.returns-table tbody tr:hover { background: rgba(255,255,255,0.02); }
.returns-table tr:last-child td { border-bottom: none; }
.returns-table .tranche-name { font-weight: 600; color: var(--text); font-size: 0.85rem; white-space: nowrap; }
.returns-table .tranche-senior .tranche-name { color: var(--senior); }
.returns-table .tranche-mezzanine .tranche-name { color: var(--mezzanine); }
.returns-table .tranche-junior .tranche-name { color: var(--junior); }
.returns-table .period-cell { font-size: 0.78rem; min-width: 4.5rem; }
.returns-table .period-cell .amt { display: block; color: var(--text-soft); margin-bottom: 0.15rem; }
.returns-table .period-cell .pct { display: block; font-weight: 500; }
.returns-table .period-cell .pct.yield-pos { color: var(--success); }
.returns-table .period-cell .pct.yield-neg { color: var(--danger); }
.returns-table .stress { opacity: 0.9; }
.returns-table th.stress-label { color: var(--junior); }
.yield-pos { color: var(--success); font-weight: 500; }
.yield-neg { color: var(--danger); font-weight: 500; }
.returns-footnote { font-size: 0.68rem; color: var(--muted); margin: 0.4rem 0 0; line-height: 1.3; }
.disclaimer { font-size: 0.68rem; color: var(--muted); margin-top: 0.65rem; padding-top: 0.6rem; border-top: 1px solid var(--border); line-height: 1.4; }
.return-explanation { background: var(--accent-dim); padding: 0.6rem 0.85rem; border-radius: var(--radius-sm); font-size: 0.8rem; color: var(--text-soft); margin-bottom: 0.75rem; border-left: 3px solid var(--accent); }
.wallet-connect { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem; margin-bottom: 1rem; }
.wallet-connect .address { font-family: var(--font-mono); font-size: 0.85rem; color: var(--text-soft); letter-spacing: 0.02em; }
.wallet-badge { font-size: 0.7rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); background: var(--surface-elevated); padding: 0.25rem 0.5rem; border-radius: 4px; margin-left: 0.5rem; }
button.wallet-btn {
  background: var(--surface-elevated);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 0.55rem 1.1rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 500;
  transition: background 0.15s ease, border-color 0.15s ease;
}
button.wallet-btn:hover { background: var(--border); border-color: var(--muted); }
button.wallet-btn.primary { background: var(--accent); color: var(--accent-text); border-color: var(--accent); font-weight: 600; }
button.wallet-btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); box-shadow: 0 0 16px var(--accent-glow); }
button.wallet-btn.secondary { background: transparent; color: var(--muted); border-style: dashed; }
button.wallet-btn.secondary:hover { color: var(--text); border-color: var(--muted); }
button.wallet-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.subscribe-amount-field input[type="text"]:focus { outline: none; border-color: var(--accent); background: var(--surface-elevated); }
#settingsForm { max-width: 1200px; }
#settingsForm .settings-section { background: rgba(255,255,255,0.02); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 0.85rem; margin-bottom: 0.75rem; }
#settingsForm .settings-section:last-child { margin-bottom: 0; }
#settingsForm label { display: block; font-size: 0.7rem; font-weight: 600; color: var(--text); margin-bottom: 0.3rem; }
#settingsForm input[type="number"], #settingsForm input[type="text"] { padding: 0.45rem 0.65rem; border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--bg); color: var(--text); font-size: 0.85rem; font-variant-numeric: tabular-nums; width: 100%; transition: border-color 0.2s ease, background 0.2s ease; }
#settingsForm input[type="number"]:focus, #settingsForm input[type="text"]:focus { outline: none; border-color: var(--accent); background: var(--surface-elevated); }
#settingsForm input[type="checkbox"] { width: auto; margin-right: 0.5rem; cursor: pointer; }
#settingsForm input[readonly] { background: var(--surface-elevated); cursor: not-allowed; opacity: 0.7; }
#settingsForm small { display: block; margin-top: 0.25rem; color: var(--muted); font-size: 0.7rem; line-height: 1.3; }
#settingsForm h4 { margin-top: 0; margin-bottom: 0.6rem; font-size: 0.9rem; font-weight: 600; color: var(--text); }
#settingsForm h5 { margin: 0 0 0.5rem 0; font-size: 0.75rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.03em; }
#settingsForm .blurb { font-size: 0.75rem; color: var(--muted); line-height: 1.4; }
#settingsForm .checkbox-group { display: flex; align-items: center; gap: 0.6rem; padding: 0.6rem; background: rgba(255,255,255,0.01); border-radius: var(--radius-sm); border: 1px solid var(--border); transition: background 0.2s ease, border-color 0.2s ease; }
#settingsForm .checkbox-group:hover { background: rgba(255,255,255,0.02); border-color: var(--accent); }
#settingsForm .checkbox-group label { margin-bottom: 0; font-weight: 500; cursor: pointer; user-select: none; font-size: 0.8rem; }
/* ── Settings Accordion ── */
.sa-section { border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 0.75rem; overflow: hidden; animation: monthFadeIn 0.3s ease both; }
.sa-section:nth-child(2) { animation-delay: 0.04s; }
.sa-section:nth-child(3) { animation-delay: 0.08s; }
.sa-section:nth-child(4) { animation-delay: 0.12s; }
.sa-section:nth-child(5) { animation-delay: 0.16s; }
.sa-header { display: flex; align-items: center; justify-content: space-between; padding: 0.7rem 1rem; cursor: pointer; user-select: none; background: var(--surface); }
.sa-header:hover { background: var(--surface-elevated); }
.sa-header-left { display: flex; align-items: center; gap: 0.5rem; }
.sa-header h3 { margin: 0; padding: 0; border: none; font-size: 0.95rem; font-weight: 700; color: var(--text); }
.sa-summary { font-size: 0.72rem; color: var(--muted); font-variant-numeric: tabular-nums; margin-left: 0.5rem; }
.sa-chevron { font-size: 0.7rem; color: var(--muted); transition: transform 0.2s; }
.sa-section.collapsed .sa-chevron { transform: rotate(-90deg); }
.sa-body { padding: 0.85rem 1rem 1rem; }
.sa-section.collapsed .sa-body { display: none; }
/* ── Sticky Save Bar ── */
.settings-save-bar { position: sticky; bottom: 0; z-index: 10; background: var(--surface); border-top: 1px solid var(--border); padding: 0.65rem 1rem; display: flex; align-items: center; gap: 0.75rem; margin-top: 1rem; border-radius: 0 0 var(--radius) var(--radius); }
.settings-save-bar .save-indicator { font-size: 0.75rem; color: var(--muted); flex: 1; }
.settings-save-bar .save-indicator.has-changes { color: var(--warning-yellow); font-weight: 600; }
.settings-save-bar button { min-width: 120px; }
/* ── Live Hint ── */
.live-hint { display: block; margin-top: 0.2rem; font-size: 0.68rem; color: var(--accent); font-variant-numeric: tabular-nums; min-height: 1em; transition: color 0.2s; }
/* ── Changed Field ── */
#settingsForm input.field-changed { border-color: var(--warning-yellow) !important; background: var(--warning-yellow-bg) !important; }
/* ── Compact Perf Fee Grid ── */
.perf-fee-grid { display: grid; grid-template-columns: auto 1fr 1fr 1fr; gap: 0 0.75rem; align-items: center; font-size: 0.8rem; }
.perf-fee-grid .pfg-header { font-size: 0.68rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.03em; padding-bottom: 0.4rem; border-bottom: 1px solid var(--border); }
.perf-fee-grid .pfg-label { font-weight: 600; padding: 0.5rem 0; }
.perf-fee-grid .pfg-label.senior { color: var(--senior); }
.perf-fee-grid .pfg-label.mezzanine { color: var(--mezzanine); }
.perf-fee-grid .pfg-label.junior { color: var(--junior); }
.perf-fee-grid input[type="number"] { width: 100%; }
.perf-fee-grid input[type="checkbox"] { width: auto; }
.wallet-positions { margin-top: 1.1rem; padding-top: 1rem; border-top: 1px solid var(--border); }
.wallet-positions h3 { font-size: 0.8rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; margin: 0 0 0.6rem; color: var(--muted); }
.wallet-positions .row { display: flex; flex-wrap: wrap; gap: 1.25rem 1.5rem; font-size: 0.9rem; }
.wallet-positions .row span { color: var(--muted); }
.wallet-positions .row strong { color: var(--text); font-variant-numeric: tabular-nums; }
.wallet-err { color: var(--danger); font-size: 0.85rem; margin-top: 0.5rem; }
.implied-return-box { margin-top: 1rem; padding: 0.85rem 1rem; background: rgba(255,255,255,0.03); border: 1px solid var(--border); border-radius: var(--radius-sm); }
.implied-return-header { font-size: 0.7rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin-bottom: 0.6rem; }
.implied-return-metrics { display: flex; gap: 1.5rem; flex-wrap: wrap; }
.implied-return-metric { display: flex; flex-direction: column; gap: 0.15rem; }
.implied-return-label { font-size: 0.7rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.implied-return-value { font-size: 1.05rem; font-weight: 600; color: var(--accent); font-variant-numeric: tabular-nums; }
.implied-return-breakdown { font-size: 0.8rem; color: var(--muted); margin-top: 0.55rem; padding-top: 0.45rem; border-top: 1px solid var(--border); display: flex; flex-wrap: wrap; gap: 0.3rem 1.25rem; }
.implied-return-breakdown span { white-space: nowrap; }
.subscribe-section { margin-top: 1.1rem; padding-top: 1rem; border-top: 1px solid var(--border); }
.subscribe-section-title { font-size: 0.8rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); margin: 0 0 0.75rem; }
.tranche-selector { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.6rem; margin-bottom: 0.85rem; }
.tranche-option { all: unset; cursor: pointer; display: flex; flex-direction: column; gap: 0.2rem; padding: 0.7rem 0.85rem; border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--bg); transition: border-color 0.15s, background 0.15s, box-shadow 0.15s; text-align: left; }
.tranche-option:hover { border-color: var(--muted); background: var(--surface-elevated); }
.tranche-option.selected { border-color: var(--accent); background: rgba(99,102,241,0.06); box-shadow: 0 0 0 1px var(--accent); }
.tranche-option[data-tranche="senior"].selected { border-color: var(--senior); box-shadow: 0 0 0 1px var(--senior); }
.tranche-option[data-tranche="mezzanine"].selected { border-color: var(--mezzanine); box-shadow: 0 0 0 1px var(--mezzanine); }
.tranche-option[data-tranche="junior"].selected { border-color: var(--junior); box-shadow: 0 0 0 1px var(--junior); }
.tranche-option-name { font-size: 0.82rem; font-weight: 600; color: var(--text); }
.tranche-option-symbol { font-size: 0.7rem; color: var(--muted); font-family: var(--font-mono); letter-spacing: 0.02em; }
.tranche-option-yield { font-size: 1rem; font-weight: 700; color: var(--accent); font-variant-numeric: tabular-nums; margin: 0.15rem 0; }
.tranche-option[data-tranche="senior"] .tranche-option-yield { color: var(--senior); }
.tranche-option[data-tranche="mezzanine"] .tranche-option-yield { color: var(--mezzanine); }
.tranche-option[data-tranche="junior"] .tranche-option-yield { color: var(--junior); }
.tranche-option-avail { font-size: 0.7rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.tranche-option-avail.sold-out { color: var(--danger); font-weight: 600; }
.tranche-option-risk { font-size: 0.7rem; color: var(--muted); }
.subscribe-amount-row { display: flex; gap: 0.75rem; align-items: end; }
.subscribe-amount-field { flex: 1; }
.subscribe-amount-field label { display: block; font-size: 0.75rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); margin-bottom: 0.35rem; }
.subscribe-amount-field input[type="text"] { width: 100%; padding: 0.6rem 0.75rem; border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--bg); color: var(--text); font-size: 0.95rem; font-variant-numeric: tabular-nums; }
@media (max-width: 640px) { .tranche-selector { grid-template-columns: 1fr; } }
@media (max-width: 520px) { .implied-return-metrics { flex-direction: column; gap: 0.75rem; } .subscribe-amount-row { flex-direction: column; } }
.tranches { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; margin-top: 0.85rem; }
.tranche { background: var(--bg); border-radius: var(--radius); padding: 1.25rem; border-left: 4px solid var(--senior); transition: border-color 0.15s ease; min-width: 0; overflow-wrap: break-word; }
.tranche.mezzanine { border-left-color: var(--mezzanine); }
.tranche.junior { border-left-color: var(--junior); }
.tranche .name { font-weight: 600; margin-bottom: 0.2rem; font-size: 0.95rem; line-height: 1.3; word-wrap: break-word; }
.tranche .symbol { font-size: 0.75rem; color: var(--muted); margin-bottom: 0.4rem; font-variant-numeric: tabular-nums; }
.tranche .pct { font-size: 0.78rem; color: var(--muted); margin-bottom: 0.5rem; line-height: 1.35; }
.tranche .amount { font-size: 1.1rem; margin: 0.5rem 0; font-weight: 600; font-variant-numeric: tabular-nums; }
.tranche .tranche-meta { display: grid; grid-template-columns: auto 1fr; gap: 0.35rem 1rem; font-size: 0.8rem; margin-top: 0.5rem; font-variant-numeric: tabular-nums; }
.tranche .tranche-meta .label { color: var(--muted); }
.tranche .tranche-meta .value { font-weight: 600; color: var(--text); }
.tranche .yield-vs-target { margin-top: 0.75rem; padding: 0.65rem 0.85rem; border-radius: var(--radius-sm); font-size: 0.85rem; font-variant-numeric: tabular-nums; display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 1rem; background: var(--surface-elevated); border: 1px solid var(--border); }
.tranche .yield-vs-target .ytd-label { color: var(--muted); font-weight: 500; }
.tranche .yield-vs-target .ytd-value { font-weight: 700; color: var(--text); }
.tranche .yield-vs-target .target-value { color: var(--text-soft); font-weight: 500; }
.tranche .yield-vs-target .vs-badge { font-size: 0.72rem; font-weight: 600; padding: 0.2rem 0.5rem; border-radius: 4px; white-space: nowrap; }
.tranche .yield-vs-target .vs-badge.above { background: rgba(63, 185, 80, 0.2); color: var(--success); }
.tranche .yield-vs-target .vs-badge.below { background: rgba(248, 81, 73, 0.15); color: var(--danger); }
.tranche .yield-vs-target .vs-badge.on-target { background: rgba(88, 166, 255, 0.15); color: var(--senior); }
.tranche .yield-vs-target .perf-fee-note { font-size: 0.7rem; color: var(--junior); font-weight: 500; margin-left: 0.3rem; cursor: help; opacity: 0.85; }
.tranche .returns-block { margin-top: 0.85rem; padding-top: 0.75rem; border-top: 1px solid var(--border); }
.tranche .returns-block-title { font-size: 0.7rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); margin-bottom: 0.5rem; }
.tranche .returns-by-period { width: 100%; border-collapse: collapse; font-size: 0.82rem; font-variant-numeric: tabular-nums; }
.tranche .returns-by-period th { text-align: left; color: var(--muted); font-weight: 600; font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.03em; padding: 0.35rem 0.6rem 0.25rem 0; border-bottom: 1px solid var(--border); }
.tranche .returns-by-period td { padding: 0.35rem 0.6rem 0.35rem 0; border-bottom: 1px solid var(--border); color: var(--text-soft); }
.tranche .returns-by-period td:first-child { color: var(--text); font-weight: 500; min-width: 4rem; }
.tranche .returns-by-period td.num { text-align: right; color: var(--text); font-weight: 600; }
.tranche .returns-by-period tr.ann-row td { border-bottom: none; padding-top: 0.5rem; border-top: 1px solid var(--border); font-weight: 600; color: var(--text); }
.tranche .returns-by-period tr.ann-row td:first-child { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); }
.tranche .returns-line { font-size: 0.82rem; color: var(--text-soft); margin-top: 0.5rem; line-height: 1.5; word-wrap: break-word; }
.tranche .returns-line strong { color: var(--text); font-weight: 600; }
.tranche-yield-note { font-size: 0.78rem; margin-top: -0.5rem; margin-bottom: 0.75rem; }
/* ── Tranche info panels ── */
#trancheInfoPanels { margin-bottom: 0.75rem; }
#trancheInfoPanels .tranche-info-panel:last-child { margin-bottom: 0; }
.tranche-info-panel {
  display: flex;
  gap: 0.6rem;
  align-items: flex-start;
  background: var(--surface-elevated);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-sm);
  padding: 0.65rem 0.85rem;
  margin-bottom: 0.75rem;
}
.tranche-info-panel .tip-icon {
  flex-shrink: 0;
  width: 1rem;
  height: 1rem;
  margin-top: 0.05rem;
  color: var(--accent);
  opacity: 0.85;
}
.tranche-info-panel .tip-body { flex: 1; min-width: 0; }
.tranche-info-panel .tip-body p {
  margin: 0;
  font-size: var(--text-sm);
  color: var(--text-soft);
  line-height: 1.55;
}
.tranche-info-panel .tip-body p + p { margin-top: 0.3rem; }
.tranche-info-panel .tip-body .tip-label {
  font-size: var(--text-2xs);
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
  display: block;
  margin-bottom: 0.25rem;
  opacity: 0.9;
}
.tranche-info-panel .tip-formula {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  padding: 0.2rem 0.5rem;
  color: var(--text-soft);
  margin: 0.3rem 0 0.35rem;
  white-space: nowrap;
}
.tranche-info-panel .tip-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1rem;
  margin-top: 0.3rem;
}
.tranche-info-panel .tip-meta span {
  font-size: var(--text-2xs);
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 0.25rem;
}
.tranche-info-panel .tip-meta span::before {
  content: '·';
  color: var(--accent);
  font-size: 0.9rem;
  line-height: 1;
}
.tranche-waterfall-tags {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  margin-top: 0.4rem;
}
.tranche-waterfall-tags .wf-tag {
  font-size: var(--text-2xs);
  font-weight: 500;
  padding: 0.18rem 0.5rem;
  border-radius: var(--radius-pill);
  border: 1px solid;
  white-space: nowrap;
}
.wf-tag.senior  { color: var(--senior);    border-color: rgba(88,166,255,0.35); background: var(--senior-dim); }
.wf-tag.mezz    { color: var(--mezzanine); border-color: rgba(163,113,247,0.35); background: var(--mezzanine-dim); }
.wf-tag.junior  { color: var(--junior);    border-color: rgba(210,153,34,0.35); background: var(--junior-dim); }
.tranche .rating-badge { font-size: 0.65rem; padding: 0.18rem 0.4rem; border-radius: 4px; background: var(--surface-elevated); color: var(--muted); cursor: help; margin-left: 0.3rem; font-weight: 500; white-space: nowrap; }
.tranche[title] { cursor: help; }
/* ── Legacy step (kept for error display) ── */
.step { margin-bottom: 0.5rem; font-size: 0.84rem; }
.step-name { font-weight: 500; color: var(--muted); }
.step-result { margin-top: 0.2rem; font-variant-numeric: tabular-nums; }
.step-result.ok { color: var(--success); }
.step-result.err { color: var(--danger); }

/* ── Simulation Progress Bar ── */
.sim-progress { background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 0.6rem 1rem; margin-bottom: 1rem; display: none; }
.sim-progress-label { font-size: 0.78rem; color: var(--muted); margin-bottom: 0.4rem; font-weight: 500; }
.sim-progress-track { height: 6px; background: var(--surface-elevated); border-radius: 3px; overflow: hidden; }
.sim-progress-fill { height: 100%; background: var(--accent); border-radius: 3px; transition: width 0.25s ease; width: 0%; }

/* ── Setup Phase Checklist ── */
.setup-phase { background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 1rem; overflow: hidden; }
.setup-phase-header { display: flex; align-items: center; justify-content: space-between; padding: 0.6rem 1rem; cursor: pointer; user-select: none; }
.setup-phase-header:hover { background: var(--surface-elevated); }
.setup-phase-title { font-size: 0.82rem; font-weight: 600; color: var(--text-soft); display: flex; align-items: center; gap: 0.5rem; }
.setup-phase-title .check-icon { color: var(--success); font-size: 1rem; }
.setup-phase-toggle { font-size: 0.7rem; color: var(--muted); transition: transform 0.2s; }
.setup-phase.collapsed .setup-phase-toggle { transform: rotate(-90deg); }
.setup-phase-body { padding: 0 1rem 0.6rem; }
.setup-phase.collapsed .setup-phase-body { display: none; }
.setup-check { display: flex; align-items: flex-start; gap: 0.5rem; padding: 0.3rem 0; font-size: 0.8rem; color: var(--text-soft); }
.setup-check .check { color: var(--success); flex-shrink: 0; font-size: 0.85rem; line-height: 1.2; }
.setup-check .label { color: var(--muted); font-weight: 500; min-width: 5.5rem; }
.setup-check .detail { color: var(--text-soft); font-variant-numeric: tabular-nums; }

/* ── Running Totals Bar ── */
.running-totals { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.5rem; padding: 0.6rem 0.8rem; background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-sm); margin-bottom: 1rem; position: sticky; top: 0; z-index: 5; }
.running-totals .rt-item { text-align: center; }
.running-totals .rt-label { font-size: 0.65rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; font-weight: 600; }
.running-totals .rt-value { font-weight: 700; font-size: 0.9rem; font-variant-numeric: tabular-nums; }
.running-totals .rt-senior .rt-value { color: var(--senior); }
.running-totals .rt-mezz .rt-value { color: var(--mezzanine); }
.running-totals .rt-junior .rt-value { color: var(--junior); }
.running-totals .rt-total .rt-value { color: var(--text); }

/* ── Month Accordion Card ── */
.month-card { background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-sm); margin-bottom: 0.5rem; overflow: hidden; animation: monthFadeIn 0.3s ease; }
@keyframes monthFadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
.month-card-header { display: flex; align-items: center; gap: 0.6rem; padding: 0.55rem 0.85rem; cursor: pointer; user-select: none; flex-wrap: wrap; }
.month-card-header:hover { background: var(--surface-elevated); }
.month-label { font-weight: 700; font-size: 0.82rem; color: var(--text); min-width: 4.5rem; }
.month-remit { font-size: 0.75rem; color: var(--muted); font-variant-numeric: tabular-nums; margin-right: auto; }
.month-pills { display: flex; gap: 0.35rem; align-items: center; flex-wrap: wrap; }
.month-pill { font-size: 0.72rem; padding: 0.15rem 0.5rem; border-radius: 10px; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.month-pill.senior { background: rgba(88, 166, 255, 0.12); color: var(--senior); }
.month-pill.mezzanine { background: rgba(163, 113, 247, 0.12); color: var(--mezzanine); }
.month-pill.junior { background: rgba(210, 153, 34, 0.12); color: var(--junior); }
.month-pill.payoff { background: var(--warning-yellow-bg); color: var(--warning-yellow); font-size: 0.68rem; }
.month-chevron { font-size: 0.7rem; color: var(--muted); transition: transform 0.2s; margin-left: 0.25rem; }
.month-card.expanded .month-chevron { transform: rotate(90deg); }
.month-card-body { display: none; padding: 0 0.85rem 0.7rem; border-top: 1px solid var(--border); }
.month-card.expanded .month-card-body { display: block; }

/* ── Waterfall Flow Bar ── */
.wf-bar { display: flex; height: 28px; border-radius: 4px; overflow: hidden; margin: 0.6rem 0 0.4rem; font-variant-numeric: tabular-nums; }
.wf-bar .wf-seg { display: flex; align-items: center; justify-content: center; font-size: 0.62rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding: 0 4px; min-width: 0; transition: flex-basis 0.3s ease; }
.wf-seg.fees { background: rgba(125, 133, 144, 0.25); color: var(--muted); }
.wf-seg.reserve { background: rgba(63, 185, 80, 0.2); color: var(--success); }
.wf-seg.senior { background: rgba(88, 166, 255, 0.2); color: var(--senior); }
.wf-seg.mezzanine { background: rgba(163, 113, 247, 0.2); color: var(--mezzanine); }
.wf-seg.junior { background: rgba(210, 153, 34, 0.2); color: var(--junior); }
.wf-legend { display: flex; flex-wrap: wrap; gap: 0.6rem; font-size: 0.72rem; color: var(--text-soft); margin-top: 0.3rem; }
.wf-legend-item { display: flex; align-items: center; gap: 0.25rem; font-variant-numeric: tabular-nums; }
.wf-legend-dot { width: 8px; height: 8px; border-radius: 2px; flex-shrink: 0; }
.wf-detail-row { display: flex; justify-content: space-between; font-size: 0.76rem; padding: 0.15rem 0; color: var(--text-soft); }
.wf-detail-row .wf-d-label { color: var(--muted); }
.wf-detail-row .wf-d-value { font-weight: 600; font-variant-numeric: tabular-nums; }

.summary { display: grid; grid-template-columns: repeat(5, 1fr); gap: 0.65rem; margin-top: 0.85rem; }
.summary-item { background: var(--bg); padding: 0.65rem 0.75rem; border-radius: var(--radius-sm); text-align: center; border: 1px solid transparent; }
.summary-item .label { font-size: 0.68rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; font-weight: 600; }
.summary-item .value { font-weight: 600; font-size: 0.95rem; font-variant-numeric: tabular-nums; }
.toggle-details { background: none; border: none; color: var(--muted); cursor: pointer; font-size: 0.85rem; padding: 0.3rem 0; margin-top: 0.5rem; font-weight: 500; }
.toggle-details:hover { color: var(--text); }
.details-content { margin-top: 0.85rem; }
.interest-breakdown table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
.interest-breakdown th, .interest-breakdown td { text-align: left; padding: 0.5rem 0.6rem; border-bottom: 1px solid var(--border); }
.interest-breakdown th { color: var(--muted); font-weight: 600; font-size: 0.8rem; }
.interest-breakdown td.num { text-align: right; font-variant-numeric: tabular-nums; font-weight: 500; }
.subscription-table-wrap { margin-top: 0.5rem; }
.subscription-table-wrap table { width: 100%; border-collapse: collapse; font-size: 0.875rem; font-variant-numeric: tabular-nums; table-layout: fixed; }
.subscription-table-wrap table th:first-child, .subscription-table-wrap table td:first-child { width: 8rem; }
.subscription-table-wrap th, .subscription-table-wrap td { padding: 0.5rem 0.75rem; text-align: left; border-bottom: 1px solid var(--border); }
.subscription-table-wrap th { color: var(--muted); font-weight: 600; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.03em; }
.subscription-table-wrap th.num, .subscription-table-wrap td.num { text-align: right; }
.subscription-table-wrap td.num { font-weight: 500; }
.subscription-table-wrap .tranche-senior { color: var(--senior); }
.subscription-table-wrap .tranche-mezzanine { color: var(--mezzanine); }
.subscription-table-wrap .tranche-junior { color: var(--junior); }
.loans-table-wrap { max-height: 500px; overflow: auto; margin-top: 0.6rem; border: 1px solid var(--border); border-radius: var(--radius-sm); }
.loans-table { width: 100%; border-collapse: collapse; font-size: 0.8rem; }
.loans-table th, .loans-table td { padding: 0.5rem 0.7rem; text-align: left; border-bottom: 1px solid var(--border); font-variant-numeric: tabular-nums; }
.loans-table th { position: sticky; top: 0; background: var(--surface); color: var(--muted); font-weight: 600; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.03em; z-index: 1; }
.loans-table th.sortable { cursor: pointer; user-select: none; white-space: nowrap; }
.loans-table th.sortable:hover { color: var(--text); }
.loans-table th .sort-arrow { font-size: 0.6rem; margin-left: 0.25rem; opacity: 0.4; }
.loans-table th.sort-active .sort-arrow { opacity: 1; color: var(--accent); }
.loans-table td.num { text-align: right; }
.loans-table tbody tr { transition: background 0.1s ease; }
.loans-table tbody tr:hover { background: rgba(255,255,255,0.02); }
.risk { color: var(--junior); font-weight: 500; }
/* ── Loan Pool Section Layout ── */
.lp-section { animation: monthFadeIn 0.4s ease both; margin-bottom: 0.85rem; }
.lp-section:nth-child(2) { animation-delay: 0.05s; }
.lp-section:nth-child(3) { animation-delay: 0.1s; }
.lp-section:nth-child(4) { animation-delay: 0.15s; }
.lp-section:nth-child(5) { animation-delay: 0.2s; }
.lp-section:nth-child(6) { animation-delay: 0.25s; }
.lp-section:nth-child(7) { animation-delay: 0.3s; }
.lp-section:nth-child(8) { animation-delay: 0.35s; }
.lp-section-header { font-size: 0.78rem; font-weight: 700; color: var(--text); margin: 0 0 0.4rem; letter-spacing: -0.01em; }
.lp-mc-badge { font-size: 0.58rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; padding: 0.1rem 0.35rem; border-radius: 3px; background: rgba(163,113,247,0.15); color: var(--mezzanine); margin-left: 0.25rem; }
.lp-mc-placeholder { cursor: pointer; transition: border-color 0.15s, background 0.15s; }
.lp-mc-placeholder:hover { border-left-color: var(--accent) !important; background: var(--accent-dim); }
.lp-section-divider { border: none; border-top: 1px solid var(--border); margin: 0 0 0.85rem; }
/* ── Loan Pool KPI Grids ── */
.lp-kpi-primary { display: grid; grid-template-columns: repeat(6, 1fr); gap: 0.5rem; margin-bottom: 0.5rem; }
.lp-kpi-primary .overview-kpi { padding: 0.5rem 0.7rem; border-left: 3px solid var(--accent); }
.lp-kpi-primary .overview-kpi .overview-kpi-value { font-size: 1.15rem; }
.lp-kpi-primary .overview-kpi .overview-kpi-label { font-size: 0.68rem; }
.lp-kpi-primary .overview-kpi .overview-kpi-sub { font-size: 0.65rem; }
.lp-kpi-primary .overview-kpi.accent-success { border-left-color: var(--success); }
.lp-kpi-primary .overview-kpi.accent-senior { border-left-color: var(--senior); }
.lp-kpi-primary .overview-kpi.accent-mezzanine { border-left-color: var(--mezzanine); }
.lp-kpi-secondary { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 0.4rem; }
.lp-kpi-secondary .overview-kpi { padding: 0.35rem 0.5rem; }
.lp-kpi-secondary .overview-kpi .overview-kpi-value { font-size: 0.9rem; }
.lp-kpi-secondary .overview-kpi .overview-kpi-label { font-size: 0.6rem; }
.lp-kpi-secondary .overview-kpi .overview-kpi-sub { font-size: 0.6rem; }
.lp-kpi-secondary .overview-kpi.accent-warning { border-left: 3px solid var(--junior); }
/* ── Pool Health Bar ── */
.lp-health-bar { display: flex; align-items: center; gap: 0.65rem; padding: 0.55rem 0.85rem; background: var(--bg); border: 1px solid var(--border); border-left: 3px solid var(--senior); border-radius: var(--radius-sm); font-size: 0.76rem; color: var(--text-soft); font-variant-numeric: tabular-nums; flex-wrap: wrap; }
.lp-health-bar .lp-hb-item { display: flex; align-items: center; gap: 0.3rem; white-space: nowrap; }
.lp-health-bar .lp-hb-sep { color: var(--border); font-size: 0.65rem; }
.lp-health-bar .lp-hb-value { font-weight: 700; color: var(--text); }
.lp-health-bar .lp-hb-label { font-weight: 500; }
/* ── Distribution Section ── */
.lp-dist-label { font-size: 0.82rem; font-weight: 700; color: var(--text); margin-bottom: 0.25rem; margin-top: 0; }
.lp-dist-sub { font-size: 0.72rem; color: var(--muted); margin-bottom: 0.5rem; font-weight: 500; }
.lp-dist-bar { margin-bottom: 0.65rem; }
.lp-dist-table { width: 100%; font-size: 0.75rem; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.lp-dist-table th { text-align: left; font-weight: 600; color: var(--muted); font-size: 0.65rem; text-transform: uppercase; letter-spacing: 0.04em; padding: 0.35rem 0.5rem 0.25rem 0; border-bottom: 1px solid var(--border); }
.lp-dist-table th.num { text-align: right; }
.lp-dist-table td { padding: 0.3rem 0.5rem 0.3rem 0; border-bottom: 1px solid rgba(255,255,255,0.04); color: var(--text-soft); }
.lp-dist-table td.num { text-align: right; color: var(--text); }
.lp-dist-table .lp-dist-dot { width: 8px; height: 8px; border-radius: 2px; padding: 0 !important; vertical-align: middle; }
.lp-dist-table .lp-dist-range { font-weight: 600; color: var(--text); }
.lp-dist-table .lp-dist-tier { font-size: 0.7rem; font-weight: 500; }
.lp-dist-table tbody tr:hover { background: rgba(255,255,255,0.02); }
/* ── Loan Pool Filter Chips ── */
.lp-filters { display: flex; flex-wrap: wrap; gap: 0.4rem; align-items: center; margin-bottom: 0.5rem; }
.lp-filters .lp-chip { display: inline-flex; align-items: center; gap: 0.3rem; padding: 0.3rem 0.65rem; border-radius: var(--radius-sm); font-size: 0.75rem; font-weight: 600; cursor: pointer; border: 1px solid var(--border); background: var(--bg); color: var(--muted); transition: all 0.15s ease; }
.lp-filters .lp-chip:hover { border-color: var(--muted); color: var(--text); }
.lp-filters .lp-chip.active { border-color: var(--accent); color: var(--accent); background: var(--accent-dim); }
.lp-filters .lp-chip .lp-chip-dot { width: 7px; height: 7px; border-radius: 2px; flex-shrink: 0; }
.lp-filters .lp-chip .lp-chip-range { font-size: 0.62rem; color: var(--muted); font-weight: 500; margin-left: 0.15rem; }
.lp-filters .lp-chip-count { font-weight: 400; font-size: 0.68rem; color: var(--muted); margin-left: 0.15rem; }
/* ── Table Search ── */
.lp-table-search { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.5rem; }
.lp-table-search input { flex: 1; max-width: 280px; padding: 0.4rem 0.7rem; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg); color: var(--text); font-size: 0.78rem; outline: none; transition: border-color 0.15s ease; }
.lp-table-search input:focus { border-color: var(--accent); }
.lp-table-search input::placeholder { color: var(--muted); }
/* ── Loan Pool Risk Tier Pill ── */
.lp-tier { font-size: 0.68rem; font-weight: 600; padding: 0.15rem 0.55rem; border-radius: 10px; white-space: nowrap; display: inline-block; min-width: 52px; text-align: center; }
.lp-tier.safe { background: rgba(63, 185, 80, 0.15); color: var(--success); }
.lp-tier.moderate { background: rgba(88, 166, 255, 0.12); color: var(--senior); }
.lp-tier.elevated { background: rgba(163, 113, 247, 0.12); color: var(--mezzanine); }
.lp-tier.high { background: rgba(210, 153, 34, 0.12); color: var(--junior); }
.lp-tier .lp-tier-range { font-size: 0.6rem; font-weight: 500; opacity: 0.85; margin-left: 0.2rem; }
/* ── Loan Table Enhancements ── */
.loans-table tbody tr:nth-child(even) { background: rgba(255,255,255,0.012); }
.loans-table tfoot td { position: sticky; bottom: 0; background: var(--surface); font-weight: 600; font-size: 0.75rem; border-top: 2px solid var(--border); border-bottom: none; color: var(--text); }
/* ── Revenue Tab (compact) ── */
#revenueCard { padding: 1rem 1.25rem; }
#revenueCard h2 { font-size: 0.95rem; margin-bottom: 0.35rem; }
#revenueCard .blurb { font-size: 0.78rem; margin-bottom: 0.75rem; line-height: 1.45; }
#revenueContent { --rv-gap: 1rem; }
.rv-section { animation: monthFadeIn 0.25s ease both; }
.rv-section:nth-child(2) { animation-delay: 0.03s; }
.rv-section:nth-child(3) { animation-delay: 0.06s; }
.rv-section:nth-child(4) { animation-delay: 0.09s; }
.rv-section:nth-child(5) { animation-delay: 0.12s; }
.rv-section:nth-child(6) { animation-delay: 0.15s; }
.rv-section:nth-child(7) { animation-delay: 0.18s; }
.rv-section-heading { font-size: 0.72rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; margin: 0 0 0.5rem; padding-bottom: 0.35rem; border-bottom: 1px solid var(--border); }
.rv-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0.75rem; }
.rv-card { background: var(--bg); border-radius: var(--radius-sm); padding: 0.85rem 1rem; border-left: 3px solid var(--accent); }
.rv-card.upfront { border-left-color: var(--senior); }
.rv-card.recurring { border-left-color: var(--success); }
.rv-card.performance { border-left-color: var(--mezzanine); }
.rv-card.other { border-left-color: var(--junior); }
.rv-card .rv-card-title { font-weight: 600; font-size: 0.82rem; margin-bottom: 0.15rem; }
.rv-card .rv-card-total { font-size: 1.1rem; font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; margin-bottom: 0.25rem; }
.rv-card .rv-card-sub { font-size: 0.68rem; color: var(--muted); margin-bottom: 0.5rem; }
.rv-card .rv-line { display: flex; justify-content: space-between; font-size: 0.76rem; padding: 0.18rem 0; color: var(--text-soft); font-variant-numeric: tabular-nums; }
.rv-card .rv-line .rv-l-label { color: var(--muted); }
.rv-card .rv-line .rv-rate { color: var(--muted); font-size: 0.66rem; }
.rv-card .rv-line .rv-l-value { font-weight: 600; color: var(--text); }
.rv-card .rv-line.disabled { opacity: 0.4; }
.rv-card .rv-line.total-line { padding-top: 0.35rem; margin-top: 0.25rem; border-top: 1px solid var(--border); font-weight: 600; }
.rv-card .rv-line.total-line .rv-l-label { color: var(--text-soft); }
.rv-portfolio-section { background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 1rem 1.1rem; }
.rv-portfolio-table { width: 100%; border-collapse: collapse; font-size: 0.78rem; font-variant-numeric: tabular-nums; }
.rv-portfolio-table th, .rv-portfolio-table td { padding: 0.4rem 0.5rem; text-align: left; border-bottom: 1px solid var(--border); }
.rv-portfolio-table th { font-size: 0.68rem; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.03em; }
.rv-portfolio-table th.num, .rv-portfolio-table td.num { text-align: right; }
.rv-portfolio-table td.num { font-weight: 500; }
.rv-portfolio-table tr.rv-subtotal td { font-weight: 500; }
.rv-portfolio-table tr.rv-total td { font-weight: 600; border-top: 2px solid var(--border); padding-top: 0.5rem; }
.rv-portfolio-table tr.rv-indent td:first-child { padding-left: 1.2rem; }
/* Revenue phase accordion (setup-phase.open) */
.rv-section.setup-phase .phase-header, .rv-card .setup-phase .phase-header { display: flex; align-items: center; gap: 0.4rem; padding: 0.35rem 0; cursor: pointer; user-select: none; font-size: 0.72rem; font-weight: 600; color: var(--text-soft); }
.rv-section.setup-phase .phase-header:hover, .rv-card .setup-phase .phase-header:hover { color: var(--text); }
.rv-section.setup-phase .phase-toggle, .rv-card .setup-phase .phase-toggle { font-size: 0.6rem; color: var(--muted); transition: transform 0.2s; }
.rv-section.setup-phase.open .phase-toggle, .rv-card .setup-phase.open .phase-toggle { transform: rotate(90deg); }
.rv-section.setup-phase .phase-body, .rv-card .setup-phase .phase-body { display: none; padding-top: 0.35rem; }
.rv-section.setup-phase.open .phase-body, .rv-card .setup-phase.open .phase-body { display: block; }
#revenueContent .overview-kpis { grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 0.65rem; margin-bottom: 0.65rem; }
#revenueContent .overview-kpi { padding: 0.6rem 0.75rem; }
#revenueContent .overview-kpi-label { font-size: 0.68rem; margin-bottom: 0.2rem; }
#revenueContent .overview-kpi-value { font-size: 1.05rem; }
#revenueContent .overview-kpi-sub { font-size: 0.65rem; margin-top: 0.15rem; }
#revenueContent .overview-alert { padding: 0.5rem 0.75rem; font-size: 0.76rem; }
#revenueContent .wf-bar { height: 38px; margin: 0.5rem 0 0.5rem; }
#revenueContent .wf-bar .wf-seg { font-size: 0.76rem; min-width: 2rem; padding: 0 0.4rem; }
#revenueContent .wf-legend { gap: 0.75rem; font-size: 0.78rem; margin-top: 0.4rem; }
#revenueContent .wf-legend .wf-legend-item { display: inline-flex; align-items: center; gap: 0.35rem; }
#revenueContent .wf-dot { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 0; flex-shrink: 0; }
/* ── Utility Classes ── */
.form-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; }
.form-grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 0.75rem; }
.form-grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.75rem; }
.form-grid-full { grid-column: 1 / -1; }
.flex-row { display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; }
.wallet-btn--lg { padding: 0.6rem 1.5rem; font-weight: 600; }
.status-text { font-size: var(--text-sm); color: var(--muted); display: none; }
.hidden { display: none; }
.card-title-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.5rem; }
.footer-disclaimer { font-size: 0.7rem; color: var(--muted); text-align: center; padding: 1.5rem 1rem 0; margin-top: 2rem; line-height: 1.5; max-width: 42rem; margin-left: auto; margin-right: auto; }
.footer-disclaimer a { color: var(--accent); text-decoration: none; }
.footer-disclaimer a:hover { text-decoration: underline; }
.tabs-wrap { margin-bottom: 1.25rem; }
.tab-list { display: flex; gap: 0; border-bottom: 1px solid var(--border); margin-bottom: 0; }
.tab-btn {
  padding: 0.65rem 1.25rem;
  font-family: var(--font-heading);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--muted);
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease;
  display: inline-flex;
  align-items: center;
}
.tab-btn:hover { color: var(--text); }
.tab-btn:hover::before { background: var(--border); color: var(--text-soft); }
.tab-btn.active { color: var(--accent); border-bottom-color: var(--accent); }
.tab-panel { display: none; padding-top: 0; }
.tab-panel.active { display: block; }
.risk-tools-nav { display: flex; gap: 0.5rem; margin-bottom: 0.9rem; flex-wrap: wrap; }
.risk-tool-btn {
  padding: 0.45rem 0.8rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-elevated);
  color: var(--text-soft);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.2s ease, color 0.2s ease, background 0.2s ease;
}
.risk-tool-btn:hover { color: var(--text); border-color: var(--muted); }
.risk-tool-btn.active { color: var(--accent); border-color: var(--accent); background: var(--accent-dim); box-shadow: 0 0 10px var(--accent-glow); }
.risk-tool-panel { display: none; }
.risk-tool-panel.active { display: block; }
/* ── Risk Dashboard ── */
.risk-dashboard { background: var(--surface-elevated); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 0.85rem 1rem; margin-bottom: 1rem; }
.risk-dash-row { display: grid; grid-template-columns: repeat(5, 1fr); gap: 0.75rem; margin-bottom: 0.65rem; }
.risk-dash-metric { text-align: center; padding: 0.4rem 0.5rem; border-radius: var(--radius-sm); background: var(--bg); border: 1px solid var(--border); }
.risk-dash-metric-label { font-size: 0.62rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; font-weight: 600; margin-bottom: 0.15rem; }
.risk-dash-metric-value { font-size: 1.05rem; font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; }
.risk-dash-metric-sub { font-size: 0.62rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.risk-dash-workflow { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; font-size: 0.72rem; padding-top: 0.5rem; border-top: 1px solid var(--border); }
.risk-dash-workflow-label { color: var(--muted); font-weight: 500; margin-right: 0.25rem; }
.risk-dash-step { cursor: pointer; color: var(--text-soft); font-weight: 600; display: inline-flex; align-items: center; gap: 0.3rem; padding: 0.2rem 0.5rem; border-radius: 4px; transition: background 0.15s, color 0.15s; }
.risk-dash-step:hover { background: var(--accent-dim); color: var(--accent); }
.risk-dash-step-num { display: inline-flex; align-items: center; justify-content: center; width: 16px; height: 16px; border-radius: 50%; background: var(--accent-dim); color: var(--accent); font-size: 0.6rem; font-weight: 700; }
.risk-dash-arrow { color: var(--muted); font-size: 0.65rem; }
/* ── Risk Tool Header ── */
.risk-tool-header { display: flex; align-items: center; gap: 0.75rem; margin-bottom: 0.15rem; }
.risk-tool-header h2 { margin-bottom: 0; }
.risk-tool-badge { font-size: 0.65rem; font-weight: 600; padding: 0.15rem 0.55rem; border-radius: 4px; background: rgba(210,153,34,0.12); color: var(--junior); text-transform: uppercase; letter-spacing: 0.03em; white-space: nowrap; }
.risk-tool-icon { display: inline-flex; align-items: center; justify-content: center; width: 20px; height: 20px; border-radius: 4px; background: var(--accent-dim); color: var(--accent); font-size: 0.55rem; font-weight: 700; letter-spacing: -0.02em; margin-right: 0.15rem; }
@media (max-width: 640px) { .risk-dash-row { grid-template-columns: repeat(3, 1fr); } }
#overviewCard { font-size: var(--text-base); }
#overviewContent { font-size: var(--text-base); -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
#overviewContent h3 { font-size: 0.95rem; font-weight: 600; letter-spacing: -0.01em; margin-bottom: 0.6rem; margin-top: 0; }
#overviewContent table { font-size: var(--text-sm); font-variant-numeric: tabular-nums; table-layout: auto; }
#overviewContent th { font-size: var(--text-xs); font-weight: 600; padding: 0.4rem 0.5rem; }
#overviewContent td { font-size: var(--text-sm); padding: 0.4rem 0.5rem; }
#overviewContent .blurb { font-size: var(--text-sm); line-height: 1.4; }
#overviewContent .num { font-variant-numeric: tabular-nums; font-weight: 500; text-align: right; }
#overviewContent table th.num, #overviewContent table td.num { text-align: right; white-space: nowrap; }
/* ── Performance KPI Cards ── */
.overview-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 0.75rem; margin-bottom: 0.25rem; }
.overview-kpi { background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 0.75rem 0.85rem; text-align: center; }
.overview-kpi-label { font-size: 0.68rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; font-weight: 600; margin-bottom: 0.3rem; }
.overview-kpi-value { font-size: 1.15rem; font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; }
.overview-kpi-sub { font-size: 0.7rem; color: var(--text-soft); margin-top: 0.15rem; font-variant-numeric: tabular-nums; }
/* ── Performance Alert Banner ── */
.overview-alert { padding: 0.6rem 0.85rem; border-radius: var(--radius-sm); font-size: 0.78rem; margin-bottom: 0.25rem; display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; }
.overview-alert.warning { background: var(--junior-dim); border: 1px solid rgba(210, 153, 34, 0.3); color: var(--warning); }
.overview-alert.error { background: var(--danger-bg); border: 1px solid var(--danger-border); color: var(--danger); }
.overview-alert.info { background: var(--info-bg); border: 1px solid var(--info-border); color: var(--senior); }
.overview-alert-text { font-weight: 500; }
.overview-alert-toggle { background: none; border: 1px solid currentColor; color: inherit; cursor: pointer; font-size: 0.7rem; padding: 0.2rem 0.55rem; border-radius: 4px; white-space: nowrap; font-weight: 600; opacity: 0.8; }
.overview-alert-toggle:hover { opacity: 1; }
.overview-alert-details { display: none; padding: 0.5rem 0.85rem 0.65rem; font-size: 0.75rem; color: var(--text-soft); line-height: 1.55; margin-bottom: 0.5rem; border-left: 3px solid var(--warning); margin-left: 0.4rem; }
.overview-alert-details.visible { display: block; }
/* ── Performance Section Animation ── */
.overview-section { animation: monthFadeIn 0.3s ease both; }
.overview-section:nth-child(2) { animation-delay: 0.04s; }
.overview-section:nth-child(3) { animation-delay: 0.08s; }
.overview-section:nth-child(4) { animation-delay: 0.12s; }
.overview-section:nth-child(5) { animation-delay: 0.16s; }
.overview-section:nth-child(6) { animation-delay: 0.2s; }
.overview-section:nth-child(7) { animation-delay: 0.24s; }
/* ── Performance Collapsible Detail ── */
.ov-detail-toggle { background: none; border: none; color: var(--muted); cursor: pointer; font-size: 0.75rem; padding: 0.35rem 0; font-weight: 500; display: inline-flex; align-items: center; gap: 0.3rem; margin-top: 0.4rem; }
.ov-detail-toggle:hover { color: var(--text-soft); }
.ov-detail-body { display: none; margin-top: 0.4rem; padding-top: 0.4rem; border-top: 1px solid var(--border); }
.ov-detail-body.visible { display: block; }
/* ── Performance Tranche Cards ── */
#overviewContent .perf-tranches { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.85rem; }
#overviewContent .perf-tranche { background: var(--bg); border-radius: var(--radius); padding: 1rem 1.1rem; border-left: 4px solid var(--senior); }
#overviewContent .perf-tranche.mezzanine { border-left-color: var(--mezzanine); }
#overviewContent .perf-tranche.junior { border-left-color: var(--junior); }
#overviewContent .perf-tranche .pt-name { font-weight: 600; font-size: 0.88rem; margin-bottom: 0.15rem; }
#overviewContent .perf-tranche .pt-principal { font-size: 0.75rem; color: var(--muted); margin-bottom: 0.35rem; font-variant-numeric: tabular-nums; }
#overviewContent .perf-tranche .pt-target-vs-actual { font-size: 0.78rem; margin-bottom: 0.6rem; display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem; }
#overviewContent .perf-tranche .pt-target-vs { color: var(--muted); font-variant-numeric: tabular-nums; }
#overviewContent .perf-tranche .pt-target-badge { font-size: 0.68rem; font-weight: 600; padding: 0.15rem 0.45rem; border-radius: 4px; white-space: nowrap; }
#overviewContent .perf-tranche .pt-target-badge.above { background: rgba(63, 185, 80, 0.2); color: var(--success); }
#overviewContent .perf-tranche .pt-target-badge.below { background: rgba(248, 81, 73, 0.15); color: var(--danger); }
#overviewContent .perf-tranche .pt-target-badge.on-target { background: rgba(88, 166, 255, 0.15); color: var(--senior); }
#overviewContent .perf-tranche .pt-total { margin-top: 0.5rem; padding-top: 0.5rem; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 0.2rem; }
#overviewContent .perf-tranche .pt-total-value { font-size: 1.05rem; font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; }
#overviewContent .perf-tranche .pt-total-sub { font-size: 0.72rem; color: var(--muted); font-variant-numeric: tabular-nums; }
#overviewContent .perf-tranche .pt-payoff { margin-top: 0.4rem; font-size: 0.78rem; color: var(--muted); font-variant-numeric: tabular-nums; }
#overviewContent .perf-tranche .pt-payoff-delta { font-size: 0.72rem; font-weight: 600; margin-left: 0.25rem; }
#overviewContent .perf-tranche .pt-payoff-delta.above { color: var(--success); }
#overviewContent .perf-tranche .pt-payoff-delta.below { color: var(--danger); }
#overviewContent .perf-tranche .pt-payoff-delta.at-par { color: var(--senior); }
/* ── Performance totals row ── */
#overviewContent .perf-totals { display: flex; justify-content: space-around; align-items: center; padding: 0.65rem 0.85rem; background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-sm); margin-top: 0.75rem; font-variant-numeric: tabular-nums; }
#overviewContent .perf-totals .pt-t-item { text-align: center; }
#overviewContent .perf-totals .pt-t-label { font-size: 0.65rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.03em; font-weight: 600; }
#overviewContent .perf-totals .pt-t-value { font-weight: 700; font-size: 0.9rem; color: var(--text); }
@media (max-width: 1100px) {
  .lp-kpi-primary { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 900px) {
  .tranches { grid-template-columns: 1fr; }
  #overviewContent .perf-tranches { grid-template-columns: 1fr; }
  .lp-kpi-primary { grid-template-columns: 1fr 1fr; }
  .lp-kpi-secondary { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 640px) {
  .returns-table th:nth-child(n+4), .returns-table td:nth-child(n+4) { display: none; }
  .summary { grid-template-columns: 1fr 1fr; }
  .tranches { grid-template-columns: 1fr; }
  .overview-kpis { grid-template-columns: 1fr 1fr; }
  #overviewContent .perf-tranches { grid-template-columns: 1fr; }
  #overviewContent .perf-totals { flex-wrap: wrap; gap: 0.5rem; }
  /* Loan Pool responsive */
  .lp-kpi-primary { grid-template-columns: 1fr; }
  .lp-kpi-secondary { grid-template-columns: 1fr 1fr; }
  .lp-legend-grid { grid-template-columns: 1fr; }
  .lp-table-search input { max-width: 100%; }
  /* Hide Collateral BTC + Coll USD + Mo. Interest columns on mobile */
  .loans-table th:nth-child(6), .loans-table td:nth-child(6),
  .loans-table th:nth-child(7), .loans-table td:nth-child(7),
  .loans-table th:nth-child(8), .loans-table td:nth-child(8) { display: none; }
  /* Revenue cards stack on mobile */
  .rv-cards { grid-template-columns: 1fr; }
  .rv-portfolio-table { font-size: 0.75rem; }
}
/* Stress Test */
button.wallet-btn:disabled { opacity: 0.55; cursor: not-allowed; pointer-events: none; }
@keyframes stress-spin { to { transform: rotate(360deg); } }
.stress-spinner { display: inline-block; width: 0.9rem; height: 0.9rem; border: 2px solid var(--muted); border-top-color: var(--accent); border-radius: 50%; animation: stress-spin 0.7s linear infinite; vertical-align: middle; margin-right: 0.4rem; }
.stress-config-toggle { display: flex; align-items: center; justify-content: space-between; background: var(--surface-elevated); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 0.75rem 1.25rem; margin-bottom: 1rem; cursor: pointer; user-select: none; transition: border-color 0.2s; }
.stress-config-toggle:hover { border-color: var(--accent); }
.stress-config-toggle .sct-label { font-size: 0.85rem; font-weight: 600; color: var(--text); display: flex; align-items: center; gap: 0.5rem; }
.stress-config-toggle .sct-chevron { font-size: 0.7rem; color: var(--muted); transition: transform 0.25s; }
.stress-config-toggle.open .sct-chevron { transform: rotate(90deg); }
.stress-config-toggle .sct-summary { font-size: 0.75rem; color: var(--muted); display: flex; flex-wrap: wrap; gap: 0.35rem 1rem; }
.stress-config-toggle .sct-summary .sct-pill { background: rgba(88,166,255,0.1); border: 1px solid rgba(88,166,255,0.2); border-radius: 99px; padding: 0.15rem 0.6rem; font-size: 0.7rem; color: var(--accent); white-space: nowrap; }
.stress-config-body { overflow: hidden; max-height: 0; opacity: 0; transition: max-height 0.35s ease, opacity 0.25s ease, margin 0.25s ease; margin-bottom: 0; }
.stress-config-body.open { max-height: 2000px; opacity: 1; margin-bottom: 1rem; }
.stress-config-section { background: var(--surface-elevated); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 1rem 1.25rem; margin-bottom: 1rem; }
.stress-config-section h3 { margin: 0 0 0.75rem; font-size: 0.8rem; font-weight: 600; color: var(--text-soft); text-transform: uppercase; letter-spacing: 0.05em; }
.stress-config-section summary { cursor: pointer; font-size: 0.85rem; font-weight: 600; color: var(--text); padding: 0.25rem 0; list-style: none; display: flex; align-items: center; gap: 0.5rem; }
.stress-config-section summary::-webkit-details-marker { display: none; }
.stress-config-section summary::before { content: '▸'; font-size: 0.7rem; color: var(--muted); transition: transform 0.2s; }
.stress-config-section details[open] > summary::before { transform: rotate(90deg); }
.stress-config-section .stress-input-group { margin-bottom: 1rem; }
.stress-config-section .stress-input-group:last-child { margin-bottom: 0; }
.stress-config-section label { display: block; font-size: 0.75rem; font-weight: 600; color: var(--text-soft); margin-bottom: 0.35rem; }
.stress-config-section input[type="number"], .stress-config-section input[type="range"], .stress-config-section select { padding: 0.5rem 0.65rem; border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--bg); color: var(--text); font-size: 0.9rem; font-variant-numeric: tabular-nums; width: 100%; transition: border-color 0.2s ease; }
.stress-config-section input:focus, .stress-config-section select:focus { outline: none; border-color: var(--accent); }
.stress-config-section input[type="range"] { padding: 0; height: 6px; accent-color: var(--accent); }
.stress-config-section small { display: block; margin-top: 0.25rem; color: var(--muted); font-size: 0.7rem; line-height: 1.35; }
.stress-presets { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-bottom: 1rem; }
.stress-presets .preset-btn { padding: 0.4rem 0.85rem; font-size: 0.78rem; font-weight: 600; border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--bg); color: var(--text-soft); cursor: pointer; transition: all 0.15s ease; }
.stress-presets .preset-btn:hover { background: var(--surface-elevated); color: var(--text); border-color: var(--muted); }
.stress-presets .preset-btn.active { border-color: var(--accent); color: var(--accent); background: var(--accent-dim); }
.stress-cascade-flow-hint { display: flex; align-items: center; gap: 0.35rem; flex-wrap: wrap; font-size: 0.7rem; color: var(--muted); margin-bottom: 0.85rem; padding: 0.5rem 0.75rem; background: rgba(255,255,255,0.02); border-radius: var(--radius-sm); border: 1px dashed var(--border); }
.stress-cascade-flow-hint span { padding: 0.15rem 0.4rem; border-radius: 3px; font-weight: 500; }
.stress-cascade-flow-hint .flow-warn { color: var(--warning); background: rgba(210, 153, 34, 0.12); }
.stress-cascade-flow-hint .flow-mc { color: var(--junior); background: rgba(210, 153, 34, 0.08); }
.stress-cascade-flow-hint .flow-partial { color: var(--danger); background: rgba(248, 81, 73, 0.12); }
.stress-cascade-flow-hint .flow-full { color: var(--danger); background: rgba(248, 81, 73, 0.2); }
.stress-months-row { display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; }
.stress-months-chips { display: flex; flex-wrap: wrap; gap: 0.4rem; min-height: 2.25rem; align-items: center; }
.stress-months-chips .chip { display: inline-flex; align-items: center; gap: 0.35rem; padding: 0.35rem 0.6rem; background: var(--accent-dim); border: 1px solid var(--accent); border-radius: var(--radius-sm); font-size: 0.8rem; font-weight: 600; color: var(--accent); }
.stress-months-chips .chip button { background: none; border: none; color: var(--accent); cursor: pointer; padding: 0 0.15rem; font-size: 1rem; line-height: 1; opacity: 0.8; }
.stress-months-chips .chip button:hover { opacity: 1; color: var(--danger); }
.stress-months-add select { min-width: 8rem; }
.stress-analytics-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 0.75rem; margin-bottom: 1.25rem; }
.stress-analytics-card { padding: 0.85rem; background: var(--surface-elevated); border-radius: var(--radius-sm); border: 1px solid var(--border); }
.stress-analytics-card .a-label { font-size: 0.68rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 0.3rem; }
.stress-analytics-card .a-value { font-size: 1.1rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.stress-analytics-card .a-sub { font-size: 0.7rem; color: var(--muted); margin-top: 0.2rem; }
.sensitivity-grid { width: 100%; border-collapse: collapse; font-size: 0.78rem; font-variant-numeric: tabular-nums; }
.sensitivity-grid th, .sensitivity-grid td { padding: 0.5rem 0.65rem; text-align: right; border-bottom: 1px solid var(--border); }
.sensitivity-grid th { font-size: 0.7rem; text-transform: uppercase; font-weight: 600; color: var(--muted); border-bottom: 2px solid var(--border); }
.sensitivity-grid th:first-child, .sensitivity-grid td:first-child { text-align: left; }
.sensitivity-grid tr.current-scenario { background: rgba(88, 166, 255, 0.08); }
.sev-low { color: var(--success); } .sev-med { color: var(--warning); } .sev-high { color: var(--danger); }
.oc-badge { display: inline-block; padding: 0.1rem 0.35rem; border-radius: 3px; font-size: 0.68rem; font-weight: 600; }
.oc-pass { color: var(--success); background: rgba(63, 185, 80, 0.12); }
.oc-warn { color: var(--warning); background: rgba(210, 153, 34, 0.12); }
.oc-fail { color: var(--danger); background: rgba(248, 81, 73, 0.12); }
@media (max-width: 900px) {
  .form-grid-3 { grid-template-columns: 1fr 1fr; }
  .stress-metrics-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 640px) {
  .form-grid-2, .form-grid-3 { grid-template-columns: 1fr; }
  .stress-metrics-grid { grid-template-columns: 1fr 1fr; }
}

/* ── Risk Glossary: Inline Help Icons ───────────────────────────── */
.term-help {
  display: inline-flex; align-items: center; justify-content: center;
  width: 14px; height: 14px; font-size: 0.55rem; font-weight: 700;
  border-radius: 50%; background: var(--surface-elevated); color: var(--muted);
  cursor: help; margin-left: 0.2rem; vertical-align: middle;
  border: 1px solid var(--border); transition: color 0.15s, border-color 0.15s;
  line-height: 1; font-family: var(--font-sans); text-decoration: none;
}
.term-help:hover { color: var(--accent); border-color: var(--accent); }

/* ── Risk Glossary: Tooltip Popup ───────────────────────────────── */
.term-tooltip {
  position: fixed; z-index: 10001; max-width: 310px;
  padding: 0.55rem 0.75rem; background: var(--surface-elevated);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  color: var(--text); font-size: 0.78rem; line-height: 1.5;
  box-shadow: 0 4px 20px rgba(0,0,0,0.5); pointer-events: none;
  opacity: 0; transition: opacity 0.15s ease;
}
.term-tooltip.visible { opacity: 1; }
.term-tooltip .tt-title { font-weight: 600; color: var(--accent); font-size: 0.72rem; margin-bottom: 0.2rem; }
.term-tooltip .tt-more  { font-size: 0.62rem; color: var(--muted); margin-top: 0.3rem; font-style: italic; }

/* ── Risk Glossary: Sidebar Panel ───────────────────────────────── */
.glossary-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.5);
  z-index: 10000; opacity: 0; pointer-events: none; transition: opacity 0.2s;
}
.glossary-overlay.open { opacity: 1; pointer-events: auto; }

.glossary-sidebar {
  position: fixed; top: 0; right: -385px; width: 375px; height: 100vh;
  background: var(--surface); border-left: 1px solid var(--border);
  z-index: 10001; display: flex; flex-direction: column;
  transition: right 0.25s ease; box-shadow: -4px 0 24px rgba(0,0,0,0.3);
}
.glossary-sidebar.open { right: 0; }

.glossary-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.85rem 1rem; border-bottom: 1px solid var(--border);
  background: var(--surface-elevated);
}
.glossary-header h3 { margin: 0; font-size: 0.95rem; font-weight: 700; color: var(--text); }
.glossary-close {
  background: none; border: none; color: var(--muted); font-size: 1.3rem;
  cursor: pointer; padding: 0 0.3rem; line-height: 1; transition: color 0.15s;
}
.glossary-close:hover { color: var(--text); }

.glossary-search {
  margin: 0.6rem 0.8rem; padding: 0.45rem 0.7rem;
  background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-sm);
  color: var(--text); font-size: 0.8rem; font-family: var(--font-sans);
  outline: none; transition: border-color 0.2s;
}
.glossary-search:focus { border-color: var(--accent); }
.glossary-search::placeholder { color: var(--muted); }

.glossary-body { flex: 1; overflow-y: auto; padding: 0.5rem 0.8rem 1.5rem; }
.glossary-cat {
  font-size: 0.68rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.06em; color: var(--accent); margin: 1rem 0 0.4rem;
  padding-bottom: 0.25rem; border-bottom: 1px solid var(--border);
}
.glossary-cat:first-child { margin-top: 0.3rem; }
.glossary-entry {
  padding: 0.5rem 0; border-bottom: 1px solid rgba(38,50,68,0.4);
}
.glossary-entry:last-child { border-bottom: none; }
.glossary-term { font-weight: 600; font-size: 0.82rem; color: var(--text); margin-bottom: 0.15rem; }
.glossary-short { font-size: 0.76rem; color: var(--text-soft); line-height: 1.45; }
.glossary-long  { font-size: 0.72rem; color: var(--muted); line-height: 1.5; margin-top: 0.25rem; }

/* Glossary trigger button */
.glossary-trigger {
  position: relative;
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--surface-elevated); border: 1px solid var(--border);
  color: var(--muted); font-size: 0.8rem; font-weight: 700;
  cursor: pointer; transition: color 0.15s, border-color 0.15s, background 0.15s;
  font-family: var(--font-sans); margin-left: 0.5rem; flex-shrink: 0;
}
.glossary-trigger:hover { color: var(--accent); border-color: var(--accent); background: var(--accent-dim); }
.glossary-trigger:hover::after {
  content: "Open Risk Glossary";
  position: absolute; bottom: calc(100% + 6px); left: 50%;
  transform: translateX(-50%);
  padding: 0.35rem 0.6rem; font-size: 0.7rem; font-weight: 500;
  background: var(--surface-elevated); border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text);
  white-space: nowrap; pointer-events: none; z-index: 10002;
  box-shadow: 0 2px 12px rgba(0,0,0,0.4);
}

@media (max-width: 640px) {
  .glossary-sidebar { width: 100vw; right: -100vw; }
}

/* ── Login Overlay ──────────────────────────────────────────────── */
.login-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: #050a0e;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  overflow: hidden;
}
.login-overlay::before {
  content: '';
  position: absolute;
  top: -30%;
  left: -20%;
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, rgba(122,255,87,0.06) 0%, transparent 65%);
  pointer-events: none;
}
.login-overlay::after {
  content: '';
  position: absolute;
  bottom: -20%;
  right: -15%;
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, rgba(88,166,255,0.04) 0%, transparent 65%);
  pointer-events: none;
}
.login-overlay.hidden { display: none; }
.login-card {
  position: relative;
  z-index: 1;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2.5rem 2rem 2rem;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 12px 48px rgba(0,0,0,0.5), 0 0 0 1px rgba(122,255,87,0.06);
}
.login-logo {
  text-align: center;
  margin-bottom: 1.75rem;
}
.login-logo svg {
  width: 55px;
  height: 55px;
  margin-bottom: 0.75rem;
}
.login-logo .login-brand-text {
  display: block;
  height: 2rem;
  width: auto;
  margin: 0 auto 0.3rem;
  object-fit: contain;
}
.login-logo .login-subtitle {
  font-size: var(--text-sm);
  color: var(--accent);
  letter-spacing: 0.02em;
}
.login-logo .login-tagline {
  display: block;
  font-size: var(--text-xs);
  color: #7AFF57;
  margin-top: 0.35rem;
  letter-spacing: 0.04em;
  font-weight: 500;
}
.login-field {
  margin-bottom: 1rem;
}
.login-field label {
  display: block;
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-soft);
  margin-bottom: 0.35rem;
}
.login-field input {
  width: 100%;
  padding: 0.65rem 0.85rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: var(--text-base);
  font-family: var(--font-sans);
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  box-sizing: border-box;
}
.login-field input:focus {
  border-color: #7AFF57;
  box-shadow: 0 0 0 2px rgba(122,255,87,0.12);
}
.login-btn {
  width: 100%;
  padding: 0.7rem;
  background: var(--accent);
  color: var(--accent-text);
  border: none;
  border-radius: var(--radius-pill);
  font-size: var(--text-base);
  font-weight: 700;
  font-family: var(--font-heading);
  cursor: pointer;
  transition: background 0.15s, transform 0.1s, box-shadow 0.2s;
  margin-top: 0.5rem;
  letter-spacing: 0.01em;
}
.login-btn:hover { background: var(--accent-hover); box-shadow: 0 0 20px var(--accent-glow), 0 0 40px rgba(122,255,87,0.08); }
.login-btn:active { transform: scale(0.99); }
.login-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}
.login-error {
  background: var(--danger-bg);
  border: 1px solid var(--danger-border);
  color: var(--danger);
  border-radius: var(--radius);
  padding: 0.5rem 0.75rem;
  font-size: var(--text-sm);
  margin-bottom: 1rem;
  display: none;
}
.login-error.visible { display: block; }
.login-footer {
  position: relative;
  z-index: 1;
  text-align: center;
  margin-top: 1.5rem;
  font-size: var(--text-2xs);
  color: var(--muted);
  opacity: 0.6;
}

/* ── App Header Bar (user + logout) ─────────────────────────────── */
.app-header-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0;
  margin-bottom: 0.15rem;
}
.app-header-title {
  font-family: var(--font-heading);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-soft);
  letter-spacing: -0.01em;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.app-header-title .app-header-mark {
  flex-shrink: 0;
  margin-right: 0.4rem;
}
.app-header-title .app-header-brand {
  height: 1.25rem;
  width: auto;
  vertical-align: middle;
}
.app-header-title .app-title-accent {
  color: #7AFF57;
  font-weight: 700;
}
.user-session-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.user-badge {
  font-size: var(--text-xs);
  color: var(--text-soft);
  background: var(--surface-elevated);
  border: 1px solid var(--border);
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-pill);
  display: flex;
  align-items: center;
  gap: 0.35rem;
}
.user-badge .user-role {
  color: var(--accent);
  font-weight: 600;
  text-transform: capitalize;
}
.logout-btn {
  font-size: var(--text-xs);
  color: var(--muted);
  background: transparent;
  border: 1px solid var(--border);
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-pill);
  cursor: pointer;
  font-family: var(--font-sans);
  transition: color 0.15s, border-color 0.15s;
}
.logout-btn:hover {
  color: var(--danger);
  border-color: var(--danger);
}
.header-icon-btn {
  position: relative;
  font-size: 1rem;
  color: var(--muted);
  background: transparent;
  border: 1px solid var(--border);
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
  padding: 0;
  line-height: 1;
}
.header-icon-btn:hover {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-dim);
}
.header-icon-btn:hover::after {
  content: "Settings";
  position: absolute; bottom: calc(100% + 6px); left: 50%;
  transform: translateX(-50%);
  padding: 0.35rem 0.6rem; font-size: 0.7rem; font-weight: 500;
  background: var(--surface-elevated); border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text);
  white-space: nowrap; pointer-events: none; z-index: 10002;
  box-shadow: 0 2px 12px rgba(0,0,0,0.4);
}
.header-icon-btn.active {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-dim);
}

/* ── Asaari Design: Heading typography ────────────────────── */
.tab-panel h2, .risk-tool-header h2, #overviewContent h3 {
  font-family: var(--font-heading);
}

/* ── Asaari Design: Input focus glow ──────────────────────── */
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent) !important;
  box-shadow: 0 0 0 3px var(--accent-glow), 0 0 12px var(--accent-glow);
}

/* ── Asaari Design: Tab numbering badges ─────────────────── */
.tab-btn[data-tab]::before {
  content: attr(data-tab-num);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--surface-elevated);
  color: var(--muted);
  font-size: 0.6rem;
  font-weight: 700;
  margin-right: 0.4rem;
  transition: background 0.15s, color 0.15s;
}
.tab-btn[data-tab].active::before {
  background: var(--accent-dim);
  color: var(--accent);
}

/* ── Asaari Design: Background gradient blobs ────────────── */
.container {
  position: relative;
}
.container::before {
  content: '';
  position: fixed;
  top: -20%;
  left: -10%;
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, rgba(122, 255, 87, 0.03) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}
.container::after {
  content: '';
  position: fixed;
  bottom: -15%;
  right: -5%;
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, rgba(88, 166, 255, 0.025) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}
.container > * { position: relative; z-index: 1; }

/* ── Asaari Design: KPI card accent bar ───────────────────── */
.overview-kpi {
  border-top: 2px solid transparent;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.overview-kpi:hover {
  border-top-color: var(--accent);
  box-shadow: 0 2px 12px rgba(122, 255, 87, 0.08);
}
.overview-kpi.accent-success {
  border-top-color: var(--success);
}
.overview-kpi.accent-success .overview-kpi-value {
  color: var(--success);
}

/* ── Asaari Design: Risk dash metric glow ─────────────────── */
.risk-dash-metric:hover {
  background: rgba(122, 255, 87, 0.04);
  border-radius: var(--radius-sm);
}

/* ── Asaari Design: Tranche color accent bars ─────────────── */
.tranche-senior-accent { border-left: 3px solid var(--senior); }
.tranche-mezzanine-accent { border-left: 3px solid var(--mezzanine); }
.tranche-junior-accent { border-left: 3px solid var(--junior); }

/* ── Asaari Design: Branded footer ────────────────────────── */
.app-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  padding: 1.5rem 0 2rem;
  margin-top: 2rem;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: var(--text-xs);
}
.app-footer svg { opacity: 0.5; }
.app-footer a {
  color: var(--muted);
  text-decoration: none;
  transition: color 0.15s;
}
.app-footer a:hover { color: var(--accent); }
.app-footer .footer-sep { color: var(--border); }

/* ── Lifecycle Pipeline (Simulation) ──────────────────────── */
.lifecycle-pipeline {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.65rem 0.85rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 1rem;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.lp-step {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.3rem 0.6rem;
  border-radius: var(--radius-sm);
  background: var(--surface-elevated);
  border: 1px solid var(--border);
  white-space: nowrap;
  transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
}
.lp-step:hover {
  border-color: var(--accent);
  background: var(--accent-dim);
}
.lp-step.done {
  border-color: var(--accent);
  background: var(--accent-dim);
}
.lp-step.active {
  border-color: var(--accent);
  background: var(--accent-dim);
  box-shadow: 0 0 10px var(--accent-glow);
}
.lp-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent-dim);
  color: var(--accent);
  font-size: 0.6rem;
  font-weight: 700;
  flex-shrink: 0;
}
.lp-step.done .lp-num { background: var(--accent); color: var(--accent-text); }
.lp-step.active .lp-num { background: var(--accent); color: var(--accent-text); }
.lp-label {
  font-family: var(--font-heading);
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-soft);
}
.lp-step.done .lp-label { color: var(--accent); }
.lp-step.active .lp-label { color: var(--text); }
.lp-arrow {
  color: var(--muted);
  font-size: 0.7rem;
  flex-shrink: 0;
  opacity: 0.5;
}

/* ── Simulation Summary (reorganized) ────────────────────── */
.sim-summary-wrap {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
}
.sim-summary-header {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.sim-summary-title {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 0.9rem;
}
.sim-summary-kpis {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border-bottom: 1px solid var(--border);
}
.sim-kpi {
  padding: 0.7rem 1rem;
  text-align: center;
  border-right: 1px solid var(--border);
}
.sim-kpi:last-child { border-right: none; }
.sim-kpi-label {
  font-size: 0.6rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 600;
  margin-bottom: 0.2rem;
}
.sim-kpi-value {
  font-family: var(--font-heading);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
.sim-kpi-sub {
  font-size: 0.62rem;
  color: var(--muted);
  margin-top: 0.1rem;
}
.sim-section {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
}
.sim-section:last-of-type { border-bottom: none; }
.sim-section-head {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}
.sim-section-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--accent-dim);
  color: var(--accent);
  font-size: 0.62rem;
  font-weight: 700;
  flex-shrink: 0;
}
.sim-section-label {
  font-family: var(--font-heading);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-soft);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.sim-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
  font-variant-numeric: tabular-nums;
}
.sim-table tr { border-bottom: 1px solid rgba(38, 50, 68, 0.5); }
.sim-table tr:last-child { border-bottom: none; }
.sim-td-label {
  padding: 0.4rem 0;
  font-weight: 500;
  color: var(--text-soft);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.sim-td-value {
  padding: 0.4rem 0;
  text-align: right;
  font-weight: 600;
  color: var(--text);
}
.sim-td-pct {
  padding: 0.4rem 0.5rem;
  text-align: right;
  font-size: 0.72rem;
  color: var(--muted);
  font-weight: 500;
  width: 50px;
}
.sim-td-muted { color: var(--muted) !important; font-weight: 400 !important; }
.sim-tr-indent td.sim-td-label { padding-left: 1.2rem; }
.sim-tr-total {
  border-top: 2px solid var(--border) !important;
}
.sim-tr-total td { font-weight: 700 !important; color: var(--text) !important; padding-top: 0.5rem !important; }
.sim-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.sim-bar-track {
  display: flex;
  height: 6px;
  border-radius: 3px;
  overflow: hidden;
  background: var(--bg);
  margin-top: 0.5rem;
  gap: 1px;
}
.sim-bar-seg {
  height: 100%;
  border-radius: 3px;
  transition: width 0.3s ease;
}
.sim-recon {
  padding: 0.5rem 1rem 0.65rem;
  font-size: 0.7rem;
  color: var(--muted);
  border-top: 1px solid var(--border);
  background: var(--bg);
}
@media (max-width: 640px) {
  .sim-summary-kpis { grid-template-columns: repeat(2, 1fr); }
  .sim-kpi:nth-child(2) { border-right: none; }
}
