/* ==========================================================================
   SolvaDesk Real Estate Deal Desk — Institutional Wealth Theme (Light Mode)
   Palette: Crisp Slate-Ivory (#f8fafc / #ffffff), Deep Navy Ink (#0f172a),
   Royal Institutional Blue (#1d4ed8), Forest Wealth Green (#047857)
   ========================================================================== */

:root {
  --bg-canvas: #f8fafc;
  --bg-surface: #ffffff;
  --bg-ivory: #fafaf7;
  --bg-subtle: #f1f5f9;

  --ink-navy: #0f172a;
  --ink-body: #1e293b;
  --ink-secondary: #475569;
  --ink-muted: #64748b;

  --border-hairline: #e2e8f0;
  --border-strong: #cbd5e1;
  --border-ivory: #e5e4dc;

  --blue-primary: #1d4ed8;
  --blue-hover: #1e40af;
  --blue-tint: #eff6ff;
  --blue-border: #bfdbfe;

  --green-wealth: #047857;
  --green-hover: #065f46;
  --green-tint: #ecfdf5;
  --green-border: #a7f3d0;

  --amber-warn: #b45309;
  --amber-tint: #fffbeb;
  --amber-border: #fde68a;

  --red-loss: #b91c1c;
  --red-tint: #fef2f2;
  --red-border: #fecaca;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;

  --shadow-card: 0 1px 2px rgba(15, 23, 42, 0.04), 0 4px 12px rgba(15, 23, 42, 0.03);
  --shadow-elevated: 0 12px 32px rgba(15, 23, 42, 0.12), 0 2px 6px rgba(15, 23, 42, 0.06);

  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-serif: Georgia, Cambria, "Times New Roman", Times, serif;
}

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  color: var(--ink-navy);
  background-color: var(--bg-canvas);
  background-image: linear-gradient(180deg, #ffffff 0%, #f8fafc 280px);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.tabular {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
}

a {
  color: var(--blue-primary);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

/* Top Institutional Header & Breadcrumb */
.topbar {
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border-hairline);
  position: sticky;
  top: 0;
  z-index: 40;
}

.topbar-inner {
  max-width: 1320px;
  margin: 0 auto;
  padding: 0.7rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: var(--ink-secondary);
}

.breadcrumb-brand {
  font-weight: 700;
  color: var(--ink-navy);
  letter-spacing: -0.01em;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.breadcrumb-brand:hover {
  color: var(--blue-primary);
  text-decoration: none;
}

.brand-mark {
  width: 20px;
  height: 20px;
  border-radius: 4px;
  background: var(--ink-navy);
  color: #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.breadcrumb-sep {
  color: var(--border-strong);
}

.breadcrumb-current {
  color: var(--ink-muted);
  font-weight: 500;
}

.toolbar-actions {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  flex-wrap: wrap;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.42rem;
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  line-height: 1.2;
  padding: 0.52rem 0.85rem;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
  white-space: nowrap;
}

.btn svg {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
}

.btn-outline {
  background: var(--bg-surface);
  color: var(--ink-body);
  border-color: var(--border-strong);
}

.btn-outline:hover {
  background: var(--bg-subtle);
  border-color: #94a3b8;
}

.btn-excel {
  background: var(--green-tint);
  color: var(--green-wealth);
  border-color: var(--green-border);
}

.btn-excel:hover {
  background: #d1fae5;
  border-color: #6ee7b7;
}

.btn-pro {
  background: var(--ink-navy);
  color: #ffffff;
  border-color: var(--ink-navy);
}

.btn-pro:hover {
  background: #1e293b;
}

.pro-pill {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0.12rem 0.36rem;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.18);
  color: #fde68a;
  font-weight: 700;
}

/* Main Container & Hero */
.container {
  max-width: 1320px;
  margin: 0 auto;
  padding: 1.5rem 1.25rem 3.5rem;
}

.deal-hero {
  margin-bottom: 1.35rem;
  border-bottom: 1px solid var(--border-hairline);
  padding-bottom: 1.25rem;
}

.hero-top {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1.25rem;
  flex-wrap: wrap;
}

.kicker {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--blue-primary);
  margin-bottom: 0.35rem;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.deal-hero h1 {
  margin: 0;
  font-size: clamp(1.5rem, 2.5vw, 2.05rem);
  font-weight: 800;
  letter-spacing: -0.025em;
  color: var(--ink-navy);
  line-height: 1.2;
}

.hero-subtitle {
  margin: 0.45rem 0 0;
  font-size: 0.95rem;
  color: var(--ink-secondary);
  max-width: 740px;
}

/* Instant Strategy Mode Switcher */
.strategy-bar {
  margin-top: 1.15rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.mode-switcher {
  display: inline-flex;
  background: var(--bg-subtle);
  border: 1px solid var(--border-hairline);
  border-radius: var(--radius-md);
  padding: 0.25rem;
  gap: 0.25rem;
}

.mode-tab {
  border: none;
  background: transparent;
  color: var(--ink-secondary);
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  padding: 0.58rem 1.05rem;
  border-radius: 7px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  transition: all 0.16s ease;
}

.mode-tab:hover {
  color: var(--ink-navy);
}

.mode-tab.active {
  background: var(--bg-surface);
  color: var(--blue-primary);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.08);
}

.mode-badge {
  font-size: 0.68rem;
  font-weight: 700;
  padding: 0.1rem 0.42rem;
  border-radius: 4px;
  background: var(--blue-tint);
  color: var(--blue-primary);
}

.preset-strip {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.preset-label {
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--ink-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.preset-chip {
  font-family: inherit;
  font-size: 0.76rem;
  font-weight: 600;
  padding: 0.34rem 0.68rem;
  border-radius: 999px;
  border: 1px solid var(--border-hairline);
  background: var(--bg-surface);
  color: var(--ink-secondary);
  cursor: pointer;
  transition: all 0.14s ease;
}

.preset-chip:hover {
  border-color: var(--blue-border);
  color: var(--blue-primary);
  background: var(--blue-tint);
}

.preset-chip.active {
  border-color: var(--blue-primary);
  background: var(--blue-tint);
  color: var(--blue-primary);
}

/* Deal Desk Two-Column Layout */
.desk-grid {
  display: grid;
  grid-template-columns: 400px minmax(0, 1fr);
  gap: 1.35rem;
  align-items: start;
}

@media (max-width: 1040px) {
  .desk-grid {
    grid-template-columns: 1fr;
  }
}

.card {
  background: var(--bg-surface);
  border: 1px solid var(--border-hairline);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
}

.inputs-panel {
  padding: 1.2rem;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 0.85rem;
  margin-bottom: 1rem;
  border-bottom: 1px solid var(--border-hairline);
}

.panel-title {
  margin: 0;
  font-size: 0.96rem;
  font-weight: 700;
  color: var(--ink-navy);
  letter-spacing: -0.01em;
}

.reset-link {
  background: none;
  border: none;
  padding: 0;
  font-family: inherit;
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--blue-primary);
  cursor: pointer;
}

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

.input-group-section {
  margin-bottom: 1.15rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--bg-subtle);
}

.input-group-section:last-child {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}

.group-heading {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--ink-muted);
  margin: 0 0 0.75rem;
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.7rem;
  margin-bottom: 0.7rem;
}

.field-row.single {
  grid-template-columns: 1fr;
}

.field-row:last-child {
  margin-bottom: 0;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.28rem;
}

.field label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--ink-body);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.25rem;
}

.field-hint {
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--ink-muted);
}

.input-wrap {
  position: relative;
  display: flex;
  align-items: center;
  background: var(--bg-surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.input-wrap:focus-within {
  border-color: var(--blue-primary);
  box-shadow: 0 0 0 3px rgba(29, 78, 216, 0.12);
}

.affix {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--ink-muted);
  padding: 0 0.58rem;
  user-select: none;
  white-space: nowrap;
}

.affix-prefix {
  padding-right: 0.2rem;
}

.affix-suffix {
  padding-left: 0.2rem;
}

.input-wrap input,
.input-wrap select {
  width: 100%;
  border: none;
  background: transparent;
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--ink-navy);
  padding: 0.5rem 0.6rem;
  outline: none;
  font-variant-numeric: tabular-nums;
  min-width: 0;
}

.input-wrap .affix-prefix + input {
  padding-left: 0.2rem;
}

/* Unit toggle inside input (e.g., % vs $) */
.unit-switch {
  display: inline-flex;
  border-left: 1px solid var(--border-hairline);
  padding: 0.18rem;
  gap: 0.12rem;
  background: var(--bg-canvas);
  border-radius: 0 5px 5px 0;
}

.unit-btn {
  border: none;
  background: transparent;
  font-family: inherit;
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--ink-muted);
  padding: 0.24rem 0.45rem;
  border-radius: 4px;
  cursor: pointer;
}

.unit-btn.active {
  background: var(--blue-primary);
  color: #ffffff;
}

/* Segmented radio for Cash vs Hard Money */
.segmented-toggle {
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: var(--bg-subtle);
  padding: 0.2rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-hairline);
  margin-bottom: 0.7rem;
}

.seg-btn {
  border: none;
  background: transparent;
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--ink-secondary);
  padding: 0.42rem 0.5rem;
  border-radius: 4px;
  cursor: pointer;
}

.seg-btn.active {
  background: var(--bg-surface);
  color: var(--blue-primary);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
}

.cash-invested-callout {
  margin-top: 0.85rem;
  background: var(--bg-ivory);
  border: 1px solid var(--border-ivory);
  border-radius: var(--radius-md);
  padding: 0.75rem 0.9rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.cash-invested-callout .callout-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--ink-secondary);
}

.cash-invested-callout .callout-sub {
  display: block;
  font-size: 0.7rem;
  color: var(--ink-muted);
  font-weight: 400;
}

.cash-invested-callout .callout-val {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--ink-navy);
}

/* Right Results Column */
.results-stack {
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
  min-width: 0;
}

/* KPI Strip */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.8rem;
}

.kpi-grid.flip-kpis {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

@media (max-width: 1200px) {
  .kpi-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .kpi-grid.flip-kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .kpi-grid,
  .kpi-grid.flip-kpis {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 400px) {
  .kpi-grid,
  .kpi-grid.flip-kpis {
    grid-template-columns: 1fr;
  }
}

.kpi-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-hairline);
  border-radius: var(--radius-md);
  padding: 0.95rem 1rem;
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 0.35rem;
}

.kpi-card.highlight-positive {
  border-color: var(--green-border);
  background: linear-gradient(180deg, #f6fef9 0%, #ffffff 65%);
}

.kpi-card.highlight-negative {
  border-color: var(--red-border);
  background: linear-gradient(180deg, #fffafa 0%, #ffffff 65%);
}

.kpi-label {
  font-size: 0.73rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ink-muted);
}

.kpi-value {
  font-size: 1.48rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--ink-navy);
  line-height: 1.15;
}

.kpi-value.wealth-green {
  color: var(--green-wealth);
}

.kpi-value.loss-red {
  color: var(--red-loss);
}

.kpi-value.inst-blue {
  color: var(--blue-primary);
}

.kpi-meta {
  font-size: 0.74rem;
  color: var(--ink-secondary);
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 0.12rem 0.44rem;
  border-radius: 999px;
  letter-spacing: 0.02em;
}

.status-pill.pass {
  background: var(--green-tint);
  color: var(--green-wealth);
  border: 1px solid var(--green-border);
}

.status-pill.warn {
  background: var(--amber-tint);
  color: var(--amber-warn);
  border: 1px solid var(--amber-border);
}

.status-pill.fail {
  background: var(--red-tint);
  color: var(--red-loss);
  border: 1px solid var(--red-border);
}

/* Section Cards inside Right Column */
.analysis-card {
  padding: 1.25rem;
}

.card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.card-head h2 {
  margin: 0;
  font-size: 1.02rem;
  font-weight: 700;
  color: var(--ink-navy);
  letter-spacing: -0.01em;
}

.card-head p {
  margin: 0.2rem 0 0;
  font-size: 0.8rem;
  color: var(--ink-muted);
}

/* Monthly Cash Flow Ledger Strip (Rental) */
.monthly-breakdown-bar {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.75rem;
  padding: 0.85rem;
  background: var(--bg-canvas);
  border: 1px solid var(--border-hairline);
  border-radius: var(--radius-md);
  margin-bottom: 1.1rem;
}

@media (max-width: 720px) {
  .monthly-breakdown-bar {
    grid-template-columns: 1fr 1fr;
  }
}

.mb-item {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.mb-label {
  font-size: 0.72rem;
  color: var(--ink-muted);
  font-weight: 600;
}

.mb-val {
  font-size: 0.96rem;
  font-weight: 700;
  color: var(--ink-navy);
}

/* Horizon Milestones + SVG Projection Chart */
.horizon-summary-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.85rem;
  margin-bottom: 1rem;
}

@media (max-width: 640px) {
  .horizon-summary-grid {
    grid-template-columns: 1fr;
  }
}

.milestone-box {
  padding: 0.85rem 1rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-hairline);
  background: var(--bg-ivory);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.milestone-box .m-tag {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--blue-primary);
}

.milestone-box .m-main {
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--ink-navy);
  margin-top: 0.15rem;
}

.milestone-box .m-sub {
  font-size: 0.75rem;
  color: var(--ink-secondary);
  text-align: right;
}

.chart-controls {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.chart-legend {
  display: flex;
  align-items: center;
  gap: 1rem;
  font-size: 0.76rem;
  color: var(--ink-secondary);
  font-weight: 600;
}

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 2px;
  display: inline-block;
  margin-right: 0.35rem;
  vertical-align: middle;
}

.svg-chart-wrap {
  position: relative;
  width: 100%;
  background: #ffffff;
  border: 1px solid var(--border-hairline);
  border-radius: var(--radius-md);
  padding: 0.75rem 0.5rem 0.35rem;
}

.projection-svg {
  width: 100%;
  height: auto;
  display: block;
  overflow: visible;
}

.chart-tooltip {
  margin-top: 0.6rem;
  padding: 0.55rem 0.85rem;
  border-radius: var(--radius-sm);
  background: var(--bg-subtle);
  font-size: 0.78rem;
  color: var(--ink-body);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
}

/* Amortization & Cash Flow Table */
.table-scroll {
  width: 100%;
  overflow-x: auto;
  max-height: 440px;
  overflow-y: auto;
  border: 1px solid var(--border-hairline);
  border-radius: var(--radius-md);
}

.proforma-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.81rem;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.proforma-table th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--bg-subtle);
  color: var(--ink-secondary);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.65rem 0.75rem;
  border-bottom: 1px solid var(--border-strong);
  white-space: nowrap;
}

.proforma-table th:first-child,
.proforma-table td:first-child {
  text-align: left;
  position: sticky;
  left: 0;
  background: inherit;
  z-index: 1;
}

.proforma-table th:first-child {
  z-index: 3;
  background: var(--bg-subtle);
}

.proforma-table tbody tr {
  background: #ffffff;
  border-bottom: 1px solid var(--border-hairline);
}

.proforma-table tbody tr:nth-child(even) {
  background: #fcfcfd;
}

.proforma-table tbody tr.milestone-row {
  background: var(--blue-tint);
  font-weight: 700;
}

.proforma-table tbody tr:hover {
  background: #f1f5f9;
}

.proforma-table td {
  padding: 0.56rem 0.75rem;
  color: var(--ink-body);
  white-space: nowrap;
}

.val-pos {
  color: var(--green-wealth);
  font-weight: 600;
}

.val-neg {
  color: var(--red-loss);
  font-weight: 600;
}

/* Mode B: 70% Rule MAO Banner */
.mao-check-banner {
  border-radius: var(--radius-lg);
  padding: 1.15rem 1.25rem;
  border: 1px solid var(--border-hairline);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.2rem;
  flex-wrap: wrap;
}

.mao-check-banner.mao-pass {
  background: var(--green-tint);
  border-color: var(--green-border);
}

.mao-check-banner.mao-fail {
  background: var(--amber-tint);
  border-color: var(--amber-border);
}

.mao-title-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
  margin-bottom: 0.25rem;
}

.mao-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 800;
  color: var(--ink-navy);
}

.mao-desc {
  margin: 0;
  font-size: 0.83rem;
  color: var(--ink-body);
}

.mao-numbers {
  display: flex;
  align-items: center;
  gap: 1.4rem;
  flex-wrap: wrap;
}

.mao-stat {
  text-align: right;
}

.mao-stat span {
  display: block;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ink-secondary);
}

.mao-stat strong {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--ink-navy);
}

/* Mode B: Deal Cost Waterfall */
.stacked-arv-bar {
  height: 26px;
  width: 100%;
  background: var(--bg-subtle);
  border-radius: var(--radius-sm);
  overflow: hidden;
  display: flex;
  margin-bottom: 1.1rem;
  border: 1px solid var(--border-hairline);
}

.arv-seg {
  height: 100%;
  transition: width 0.25s ease;
}

.waterfall-list {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.wf-row {
  display: grid;
  grid-template-columns: minmax(170px, 1.3fr) minmax(120px, 2fr) 115px 68px;
  align-items: center;
  gap: 0.75rem;
  padding: 0.58rem 0.75rem;
  border-radius: var(--radius-sm);
  background: var(--bg-canvas);
  border: 1px solid var(--border-hairline);
  font-size: 0.84rem;
}

@media (max-width: 680px) {
  .wf-row {
    grid-template-columns: 1fr auto;
  }
  .wf-bar-track,
  .wf-pct {
    display: none;
  }
}

.wf-row.wf-total {
  background: var(--green-tint);
  border-color: var(--green-border);
  font-weight: 700;
}

.wf-row.wf-total.is-loss {
  background: var(--red-tint);
  border-color: var(--red-border);
}

.wf-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 600;
  color: var(--ink-navy);
}

.wf-swatch {
  width: 10px;
  height: 10px;
  border-radius: 2px;
  flex-shrink: 0;
}

.wf-bar-track {
  height: 10px;
  background: #e2e8f0;
  border-radius: 999px;
  overflow: hidden;
}

.wf-bar-fill {
  height: 100%;
  border-radius: 999px;
}

.wf-amount {
  text-align: right;
  font-weight: 700;
}

.wf-pct {
  text-align: right;
  font-size: 0.76rem;
  color: var(--ink-muted);
}

/* Below-the-Fold Educational & SEO Reference */
.reference-section {
  margin-top: 2.75rem;
  padding-top: 2.25rem;
  border-top: 1px solid var(--border-hairline);
}

.section-header {
  max-width: 760px;
  margin-bottom: 1.35rem;
}

.section-header h2 {
  margin: 0.25rem 0 0.4rem;
  font-size: 1.4rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.section-header p {
  margin: 0;
  color: var(--ink-secondary);
  font-size: 0.92rem;
}

.formula-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

@media (max-width: 780px) {
  .formula-grid {
    grid-template-columns: 1fr;
  }
}

.formula-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-hairline);
  border-radius: var(--radius-md);
  padding: 1.2rem;
  box-shadow: var(--shadow-card);
}

.formula-card h3 {
  margin: 0 0 0.4rem;
  font-size: 1rem;
  font-weight: 700;
  color: var(--ink-navy);
}

.formula-eq {
  display: block;
  margin: 0.6rem 0;
  padding: 0.6rem 0.8rem;
  background: var(--bg-ivory);
  border-left: 3px solid var(--blue-primary);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.8rem;
  color: var(--ink-navy);
  overflow-x: auto;
}

.formula-card p {
  margin: 0;
  font-size: 0.85rem;
  color: var(--ink-secondary);
  line-height: 1.55;
}

/* FAQ Accordion */
.faq-list {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}

.faq-item {
  background: var(--bg-surface);
  border: 1px solid var(--border-hairline);
  border-radius: var(--radius-md);
  padding: 0.95rem 1.15rem;
}

.faq-item summary {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--ink-navy);
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.faq-item summary::-webkit-details-marker {
  display: none;
}

.faq-item summary::after {
  content: "+";
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--blue-primary);
  flex-shrink: 0;
}

.faq-item[open] summary::after {
  content: "−";
}

.faq-item p {
  margin: 0.65rem 0 0;
  font-size: 0.88rem;
  color: var(--ink-secondary);
  line-height: 1.6;
}

/* Footer */
.site-footer {
  margin-top: 3rem;
  padding: 1.5rem 1.25rem;
  border-top: 1px solid var(--border-hairline);
  background: #ffffff;
  font-size: 0.8rem;
  color: var(--ink-muted);
}

.footer-inner {
  max-width: 1320px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

/* Hidden utility */
.hidden {
  display: none !important;
}

/* Toast Notification */
.toast {
  position: fixed;
  bottom: 1.4rem;
  right: 1.4rem;
  background: var(--ink-navy);
  color: #ffffff;
  padding: 0.68rem 1rem;
  border-radius: var(--radius-md);
  font-size: 0.83rem;
  font-weight: 600;
  box-shadow: var(--shadow-elevated);
  z-index: 90;
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.toast.visible {
  opacity: 1;
  transform: translateY(0);
}

/* Pro Lender Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.52);
  backdrop-filter: blur(3px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  z-index: 100;
}

.modal-dialog {
  background: var(--bg-surface);
  border: 1px solid var(--border-hairline);
  border-radius: var(--radius-lg);
  max-width: 520px;
  width: 100%;
  padding: 1.5rem;
  box-shadow: var(--shadow-elevated);
}

.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.85rem;
}

.modal-header h3 {
  margin: 0.2rem 0 0;
  font-size: 1.15rem;
  color: var(--ink-navy);
}

.modal-close {
  border: none;
  background: var(--bg-subtle);
  color: var(--ink-secondary);
  width: 30px;
  height: 30px;
  border-radius: 6px;
  font-size: 1.1rem;
  cursor: pointer;
}

.modal-feature-list {
  margin: 0.85rem 0 1.15rem;
  padding: 0.85rem 1rem 0.85rem 2rem;
  background: var(--bg-ivory);
  border: 1px solid var(--border-ivory);
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  color: var(--ink-body);
}

.modal-feature-list li {
  margin-bottom: 0.38rem;
}

.modal-feature-list li:last-child {
  margin-bottom: 0;
}

.modal-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.6rem;
  flex-wrap: wrap;
}

@media print {
  .topbar,
  .preset-strip,
  .reference-section,
  .site-footer,
  .modal-backdrop {
    display: none !important;
  }
  .desk-grid {
    grid-template-columns: 320px 1fr;
  }
}
