@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=IBM+Plex+Mono:wght@400;500&display=swap');

/* ============================================================
   LoansFlow tools × Blackout Ledger
   Deep-black canvas, graphite cards, neon-green accent
   reserved for results & data. Numbers glow.
   ============================================================ */

:root {
  --canvas: #0a0a0b;
  --surface: #151617;
  --surface-hover: #1c1d1f;
  --ink: #ffffff;
  --ink-secondary: #e8e8ec;
  --muted: #7d7d86;
  --fog: #9a9aa3;
  --accent: #34d59a;
  --accent-glow: rgba(52, 213, 154, 0.4);
  --accent-border: rgba(52, 213, 154, 0.25);
  --amber: #ffb020;
  --danger: #ef4444;
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.15);
  --principal: #34d59a;
  --interest: #ffb020;
  --gold: var(--amber);
  --gold-soft: rgba(255, 176, 32, 0.6);
  --sidebar: #0c0c0d;
  --pill: 999px;
  --ease: cubic-bezier(0.19, 1, 0.22, 1);
  --dur: 0.8s;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  background: var(--canvas);
  color: var(--ink-secondary);
  font-family: 'Inter', system-ui, sans-serif;
  font-weight: 400;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

.app {
  display: grid;
  grid-template-columns: 300px 1fr;
  min-height: 100vh;
}

.main-wrap {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

/* ---------- Sidebar: dark surface ---------- */

.sidebar {
  background: var(--sidebar);
  color: var(--ink);
  padding: 2rem 1.5rem 2rem;
  display: flex;
  flex-direction: column;
  gap: 1.75rem;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  border-right: 1px solid var(--line);
}

.brand {
  line-height: 1.1;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--line);
  animation: brandIn 0.7s var(--ease) both;
}
.brand a {
  color: inherit;
  text-decoration: none;
  display: inline-flex;
  line-height: 0;
}
.brand a img {
  display: block;
  height: 2.1rem;
  width: auto;
  border-radius: 0;
}
.brand span {
  display: block;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.62rem;
  font-weight: 400;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--accent);
  margin-top: 0.6rem;
}

.steps { list-style: none; display: flex; flex-direction: column; gap: 0.2rem; }
.step {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  padding: 0.8rem 0.65rem;
  cursor: pointer;
  border-radius: 0;
  transition: background var(--dur) var(--ease), transform var(--dur) var(--ease), opacity var(--dur) var(--ease);
  opacity: 0.55;
}
.step:hover {
  background: rgba(255, 255, 255, 0.04);
  opacity: 0.85;
  transform: translateX(2px);
}
.step.active {
  opacity: 1;
  background: rgba(52, 213, 154, 0.1);
  box-shadow: inset 2px 0 0 var(--accent);
}
.step-no {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.72rem;
  font-weight: 400;
  color: var(--accent);
  min-width: 1.6rem;
  font-variant-numeric: tabular-nums;
}
.step-label { font-size: 0.9rem; font-weight: 500; }

.sidebar-foot {
  margin-top: auto;
  font-size: 0.66rem;
  font-weight: 400;
  line-height: 1.7;
  color: rgba(255, 255, 255, 0.3);
  border-top: 1px solid var(--line);
  padding-top: 1.1rem;
}

/* ---------- Main column ---------- */

.main {
  padding: 2.75rem 3.5rem 4rem;
  max-width: 920px;
  animation: riseIn 0.6s var(--ease) both;
}

.eyebrow {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.7rem;
  font-weight: 400;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 0.65rem;
}

h1 {
  font-family: 'Inter', sans-serif;
  font-weight: 600;
  font-size: clamp(2rem, 3.4vw, 2.9rem);
  letter-spacing: -0.02em;
  line-height: 1.05;
  margin-bottom: 0.6rem;
  color: var(--ink);
}

.sub {
  color: var(--muted);
  font-size: 1.02rem;
  max-width: 52ch;
  margin-bottom: 2.25rem;
  line-height: 1.6;
}

/* ---------- Panels: dark surface, hairline borders ---------- */

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 0;
  overflow: hidden;
}

.field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
  padding: 1.75rem;
}
.field { display: flex; flex-direction: column; gap: 0.4rem; }
.field.full { grid-column: 1 / -1; }

label {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.7rem;
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.input-wrap {
  display: flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 0;
  background: var(--canvas);
  overflow: hidden;
  transition: border-color var(--dur) var(--ease);
}
.input-wrap:focus-within { border-color: var(--accent); }
.input-wrap span {
  padding: 0.7rem 0.75rem;
  background: var(--surface);
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 400;
  font-variant-numeric: tabular-nums;
  border-right: 1px solid var(--line);
}
.input-wrap span:last-child:not(:first-child) {
  border-right: none;
  border-left: 1px solid var(--line);
}

input, select {
  border: none;
  outline: none;
  padding: 0.7rem 0.8rem;
  font-family: 'Inter', sans-serif;
  font-size: 0.95rem;
  font-variant-numeric: tabular-nums;
  width: 100%;
  background: transparent;
  color: var(--ink);
}
input:focus, select:focus { background: rgba(52, 213, 154, 0.08); }
select option { background: var(--surface); color: var(--ink); }

.actions {
  padding: 1.25rem 1.75rem 1.75rem;
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  flex-wrap: wrap;
  border-top: 1px solid var(--line);
}

/* ---------- Buttons: full-pill only ---------- */

button {
  font-family: 'Inter', sans-serif;
  font-weight: 500;
  font-size: 0.9rem;
  padding: 0.8rem 1.9rem;
  border-radius: var(--pill);
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform var(--dur) var(--ease), background var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
button:hover { transform: translateY(-1px); }
.btn-primary {
  background: var(--accent);
  color: var(--canvas);
}
.btn-primary:hover { background: #2bc48a; }
.btn-ghost {
  background: transparent;
  border-color: var(--line-strong);
  color: var(--ink);
}
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }
button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- Results: neon-green headline with glow ---------- */

.headline-figure {
  padding: 2.25rem 1.75rem 1.75rem;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, #101315, var(--surface));
  border-left: 1px solid var(--accent-border);
}
.headline-figure .label {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.7rem;
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
  margin-bottom: 0.4rem;
}
.headline-figure .value {
  font-family: 'Inter', sans-serif;
  font-weight: 600;
  font-size: clamp(2.6rem, 5vw, 3.6rem);
  letter-spacing: -0.02em;
  color: var(--accent);
  text-shadow: 0 0 30px var(--accent-glow);
  font-variant-numeric: tabular-nums;
  animation: figurePop 0.7s var(--ease) both;
}
.headline-figure .value small {
  font-family: 'Inter', sans-serif;
  font-size: 1rem;
  font-weight: 500;
  color: var(--muted);
  text-shadow: none;
}

.breakdown { padding: 1.75rem; }
.bar {
  display: flex;
  height: 30px;
  border-radius: 0;
  overflow: hidden;
  margin-bottom: 1.5rem;
  border: 1px solid var(--line);
}
.bar .seg { height: 100%; transition: width 0.6s var(--ease); }

.legend { display: flex; flex-wrap: wrap; gap: 1.5rem; margin-bottom: 1.75rem; }
.legend-item { display: flex; align-items: center; gap: 0.5rem; font-size: 0.88rem; color: var(--ink-secondary); }
.swatch { width: 11px; height: 11px; border-radius: 0; flex-shrink: 0; }

.line-item {
  display: flex;
  justify-content: space-between;
  padding: 0.85rem 0;
  border-bottom: 1px solid var(--line);
  font-size: 0.95rem;
  color: var(--ink-secondary);
}
.line-item:last-child { border-bottom: none; font-weight: 600; color: var(--ink); }
.line-item .num { font-variant-numeric: tabular-nums; }

.ledger-table-wrap { max-height: 480px; overflow-y: auto; border-top: 1px solid var(--line); }
.ledger-export { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 0.75rem 0.25rem 0.75rem 1rem; }
.ledger-export span { color: var(--muted); font-size: 0.72rem; }
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
  font-variant-numeric: tabular-nums;
}
thead th {
  position: sticky;
  top: 0;
  background: var(--surface);
  text-align: right;
  padding: 0.75rem 1rem;
  font-family: 'IBM Plex Mono', monospace;
  font-weight: 400;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
}
thead th:first-child, tbody td:first-child { text-align: left; }
tbody td {
  padding: 0.6rem 1rem;
  text-align: right;
  border-bottom: 1px solid var(--line);
  color: var(--ink-secondary);
}
tbody tr:hover { background: rgba(52, 213, 154, 0.04); }
.yr-strip {
  display: inline-block;
  width: 60px;
  height: 8px;
  border-radius: 0;
  overflow: hidden;
  vertical-align: middle;
  margin-right: 0.5rem;
}
.yr-strip span { display: inline-block; height: 100%; }

.compare-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; padding: 1.75rem; }
.compare-col { padding: 1.35rem; border: 1px solid var(--line); background: var(--surface); }
.compare-col.new {
  background: rgba(52, 213, 154, 0.06);
  border: 1px solid var(--accent-border);
}
.compare-col h3 {
  font-family: 'Inter', sans-serif;
  font-weight: 500;
  font-size: 1.1rem;
  margin-bottom: 1rem;
  color: var(--ink);
}
.compare-row {
  display: flex;
  justify-content: space-between;
  padding: 0.6rem 0;
  font-size: 0.9rem;
  border-bottom: 1px dashed var(--line);
  color: var(--ink-secondary);
}
.compare-row .num { font-variant-numeric: tabular-nums; }

.savings-callout {
  margin: 0 1.75rem 1.75rem;
  padding: 1.6rem 1.75rem;
  background: linear-gradient(135deg, #0c1a16, #0a2e22);
  color: var(--ink);
  border-radius: 0;
  border: 1px solid var(--accent-border);
}
.savings-callout .label {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.7rem;
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--accent);
  margin-bottom: 0.4rem;
}
.savings-callout .value {
  font-family: 'Inter', sans-serif;
  font-weight: 600;
  font-size: 1.85rem;
  font-variant-numeric: tabular-nums;
  color: var(--accent);
  text-shadow: 0 0 20px var(--accent-glow);
}

.afford-result { padding: 2rem; text-align: center; }
.afford-result .value {
  font-family: 'Inter', sans-serif;
  font-weight: 600;
  font-size: 2.5rem;
  color: var(--accent);
  text-shadow: 0 0 25px var(--accent-glow);
  font-variant-numeric: tabular-nums;
}
.dti-bar {
  height: 10px;
  border-radius: 0;
  background: var(--line);
  overflow: hidden;
  margin: 1.5rem auto 0.5rem;
  max-width: 400px;
}
.dti-bar .fill { height: 100%; border-radius: 0; }
.dti-note { font-size: 0.82rem; color: var(--muted); }

/* ---------- Ad slots ---------- */

.ad-slot {
  margin: 1.75rem 0;
  min-height: 90px;
  padding: 0.65rem 0.85rem 0.85rem;
  border: 1px dashed var(--accent-border);
  border-radius: 0;
  text-align: center;
  background: var(--surface);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  transition: min-height 0.2s ease, padding 0.2s ease, opacity 0.2s ease;
}
.ad-slot .ad-label {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.62rem;
  font-weight: 400;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
  align-self: flex-start;
}
.ad-slot .ad-size {
  font-size: 0.78rem;
  color: var(--muted);
}
.ad-slot .adsbygoogle {
  width: 100%;
  max-width: 100%;
}
.ad-slot[data-ad-state="empty"] {
  display: none !important;
  min-height: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  border: none !important;
}
.ad-slot[data-ad-state="filled"] {
  border-style: solid;
  border-color: var(--accent-border);
  background: rgba(255, 255, 255, 0.03);
}
.ad-slot--leaderboard {
  margin: 1.25rem 1.25rem 0;
  min-height: 90px;
}
.ad-slot--sidebar {
  margin: 1rem 0;
  min-height: 250px;
}
.ad-slot--incontent {
  max-width: 336px;
  margin-left: auto;
  margin-right: auto;
  min-height: 250px;
}

/* ---------- Article / legal content ---------- */

.article {
  padding: 2.25rem;
  border-top: 1px solid var(--line);
}
.article h2 {
  font-family: 'Inter', sans-serif;
  font-weight: 500;
  font-size: 1.25rem;
  margin-bottom: 0.85rem;
  margin-top: 1.6rem;
  letter-spacing: -0.01em;
  color: var(--ink);
}
.article h2:first-child { margin-top: 0; }
.article p {
  font-size: 0.95rem;
  line-height: 1.7;
  color: var(--muted);
  margin-bottom: 1rem;
  max-width: 70ch;
}
.article ul {
  margin: 0 0 1rem 1.2rem;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.7;
}
.article li { margin-bottom: 0.35rem; }
.article strong { color: var(--ink); font-weight: 500; }

.faq-item { border-bottom: 1px solid var(--line); }
.faq-item:last-child { border-bottom: none; }
.faq-q {
  padding: 1.1rem 0;
  font-weight: 500;
  font-size: 0.95rem;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--ink);
}
.faq-q .mark {
  font-size: 1.1rem;
  font-weight: 400;
  color: var(--accent);
  transition: transform 0.4s var(--ease);
}
.faq-a {
  padding: 0 0 1.1rem;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.65;
  display: none;
  max-width: 65ch;
}
.faq-item.open .faq-a { display: block; }
.faq-item.open .mark { transform: rotate(45deg); }

/* ---------- Line of credit draws ---------- */

.draws-panel { padding: 0 1.75rem 1rem; }
.draw-row {
  display: grid;
  grid-template-columns: 100px 1fr 36px;
  gap: 0.75rem;
  align-items: center;
  margin-bottom: 0.6rem;
}
.draw-row .input-wrap { margin: 0; }
.btn-remove {
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  background: var(--canvas);
  border-radius: 0;
  cursor: pointer;
  color: var(--danger);
  font-size: 1rem;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}
.btn-remove:hover {
  background: var(--danger);
  color: #fff;
  border-color: var(--danger);
}
.btn-add-row {
  background: transparent;
  border: 1px dashed var(--line);
  color: var(--muted);
  padding: 0.6rem 1rem;
  border-radius: 0;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  width: 100%;
  margin-top: 0.4rem;
}
.btn-add-row:hover { border-color: var(--accent); color: var(--ink); }
.draw-hint {
  font-size: 0.75rem;
  color: var(--muted);
  margin-bottom: 0.75rem;
}
.over-limit-flag { color: var(--danger); font-weight: 600; }

/* ---------- Market news ---------- */

.news-card {
  padding: 1.5rem 1.75rem;
  border-bottom: 1px solid var(--line);
}
.news-card:last-child { border-bottom: none; }
.news-meta {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.68rem;
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--accent);
  margin-bottom: 0.4rem;
}
.news-card h3 {
  font-family: 'Inter', sans-serif;
  font-weight: 500;
  font-size: 1.1rem;
  margin-bottom: 0.5rem;
  color: var(--ink);
}
.news-card p {
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.6;
  margin-bottom: 0.6rem;
  max-width: 65ch;
}
.news-card a {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--accent);
  text-decoration: none;
  transition: color var(--dur) var(--ease);
}
.news-card a:hover { color: var(--ink); }

.rate-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}
.rate-strip .rate-cell {
  flex: 1;
  min-width: 130px;
  padding: 1.25rem 1.5rem;
  border-right: 1px solid var(--line);
}
.rate-strip .rate-cell:last-child { border-right: none; }
.rate-cell .label {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.68rem;
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
  margin-bottom: 0.3rem;
}
.rate-cell .value {
  font-family: 'Inter', sans-serif;
  font-weight: 600;
  font-size: 1.5rem;
  font-variant-numeric: tabular-nums;
  color: var(--accent);
  text-shadow: 0 0 15px var(--accent-glow);
}
.rate-cell .rate-note {
  margin-top: 0.35rem;
  font-size: 0.62rem;
  letter-spacing: 0.02em;
  color: var(--muted);
  line-height: 1.35;
}
.rate-strip--loading .value {
  color: var(--muted);
  font-weight: 400;
  text-shadow: none;
}

/* ---------- Footer (tools) ---------- */

.site-footer {
  max-width: 840px;
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid var(--line);
}
.footer-cols {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 2rem;
  margin-bottom: 2rem;
}
.footer-col h4 {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.68rem;
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--accent);
  margin-bottom: 0.75rem;
}
.footer-col p, .footer-col a {
  font-size: 0.85rem;
  color: var(--muted);
  line-height: 1.6;
}
.footer-col a {
  display: block;
  text-decoration: none;
  margin-bottom: 0.4rem;
  cursor: pointer;
  transition: color var(--dur) var(--ease);
}
.footer-col a:hover { color: var(--ink); }
.footer-legal {
  font-size: 0.75rem;
  color: var(--muted);
  line-height: 1.7;
  padding: 1.5rem 0 3rem;
  border-top: 1px solid var(--line);
}

/* ---------- Legal modal ---------- */

.legal-modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(10, 10, 11, 0.85);
  z-index: 50;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  backdrop-filter: blur(4px);
}
.legal-modal.open { display: flex; }
.legal-modal-inner {
  background: var(--surface);
  max-width: 600px;
  max-height: 80vh;
  overflow-y: auto;
  padding: 2.5rem;
  border-radius: 0;
  border: 1px solid var(--line);
}
.legal-modal-inner h2 {
  font-family: 'Inter', sans-serif;
  font-weight: 500;
  font-size: 1.4rem;
  margin-bottom: 1rem;
  color: var(--ink);
}
.legal-modal-inner p {
  font-size: 0.9rem;
  line-height: 1.7;
  color: var(--muted);
  margin-bottom: 1rem;
}
.legal-modal-close {
  margin-top: 1rem;
  background: var(--accent);
  color: var(--canvas);
  border: none;
  padding: 0.6rem 1.5rem;
  border-radius: var(--pill);
  cursor: pointer;
  font-weight: 500;
}

.tools-topbar {
  display: none;
}

/* ---------- Scenario workflow bar ---------- */
.workflow-bar {
  margin-bottom: 1.5rem;
  padding: 1rem 1.15rem;
  background: linear-gradient(135deg, rgba(52, 213, 154, 0.1), rgba(21, 22, 23, 0.92) 42%);
  border: 1px solid var(--accent-border);
  display: grid;
  grid-template-columns: minmax(150px, 1.15fr) 1.5fr auto;
  align-items: center;
  gap: 1rem;
}
.workflow-heading { display: flex; align-items: center; gap: 0.65rem; min-width: 0; }
.workflow-heading strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink); font-size: 0.9rem; }
.workflow-kicker, .chart-kicker {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.13em;
  color: var(--accent);
  margin-bottom: 0.28rem;
}
.workflow-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 12px var(--accent-glow); flex: 0 0 auto; }
.snapshot-stats { display: flex; gap: 1rem; min-width: 0; }
.snapshot-stat { border-left: 1px solid var(--line-strong); padding-left: 0.9rem; min-width: 0; }
.snapshot-stat span, .snapshot-detail span { display: block; color: var(--muted); font-size: 0.64rem; text-transform: uppercase; letter-spacing: 0.08em; white-space: nowrap; }
.snapshot-stat strong { display: block; margin-top: 0.2rem; color: var(--ink); font-size: 0.96rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
.workflow-actions { display: flex; justify-content: flex-end; gap: 0.45rem; flex-wrap: wrap; }
.btn-utility { background: transparent; border: 1px solid var(--line-strong); color: var(--ink-secondary); border-radius: var(--pill); padding: 0.5rem 0.75rem; font-size: 0.7rem; white-space: nowrap; cursor: pointer; }
.btn-utility:hover { border-color: var(--accent); color: var(--accent); }
.btn-utility--accent { background: var(--accent); border-color: var(--accent); color: var(--canvas); }
.btn-utility--accent:hover { background: var(--ink); border-color: var(--ink); color: var(--canvas); }
.snapshot-panel { grid-column: 1 / -1; display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 1rem; border-top: 1px solid var(--line); padding-top: 0.9rem; }
.snapshot-panel p { max-width: 44ch; color: var(--muted); font-size: 0.76rem; line-height: 1.5; }
.snapshot-detail { border-left: 1px solid var(--line); padding-left: 0.85rem; }
.snapshot-detail strong { display: block; margin-top: 0.25rem; color: var(--ink); font-size: 0.8rem; }

/* ---------- Interactive charts ---------- */
.chart-card { margin: 0 1.75rem 1.75rem; padding: 1.25rem; border: 1px solid var(--line); background: rgba(10, 10, 11, 0.34); }
.chart-card--wide { margin-top: 1.25rem; }
.chart-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; }
.chart-card h2 { color: var(--ink); font-size: 1rem; font-weight: 500; }
.chart-hint, .chart-caption { color: var(--muted); font-size: 0.68rem; }
.donut-chart-wrap { display: grid; grid-template-columns: 200px 1fr; align-items: center; gap: 1.25rem; }
.donut-chart { width: 200px; height: 200px; overflow: visible; }
.chart-segment { cursor: pointer; transition: stroke-width 0.2s ease, filter 0.2s ease; }
.chart-segment:hover, .chart-segment.active, .chart-point:hover { stroke-width: 30px; filter: drop-shadow(0 0 5px var(--accent-glow)); }
.donut-total { fill: var(--ink); font-size: 20px; font-weight: 600; }
.donut-caption { fill: var(--muted); font-size: 10px; }
.chart-legend { display: grid; gap: 0.55rem; }
.chart-legend-item { display: grid; grid-template-columns: 10px 1fr auto; align-items: center; gap: 0.5rem; border: 0; background: transparent; color: var(--ink-secondary); padding: 0.35rem 0; text-align: left; cursor: pointer; font-size: 0.76rem; }
.chart-legend-item:hover { color: var(--accent); }
.chart-legend-item strong { color: var(--ink); font-variant-numeric: tabular-nums; }
.chart-color { width: 9px; height: 9px; display: block; }
.chart-tooltip { min-height: 1rem; margin-top: 0.6rem; color: var(--accent); font-family: 'IBM Plex Mono', monospace; font-size: 0.7rem; opacity: 0; transition: opacity 0.2s ease; }
.chart-tooltip.visible { opacity: 1; }
.chart-tabs { display: flex; gap: 0.2rem; border: 1px solid var(--line); padding: 0.2rem; }
.chart-tab { border: 0; background: transparent; color: var(--muted); padding: 0.35rem 0.55rem; font-size: 0.68rem; cursor: pointer; }
.chart-tab.active { background: var(--accent); color: var(--canvas); }
.line-chart-wrap { width: 100%; overflow-x: auto; }
.line-chart { display: block; width: 100%; min-width: 520px; height: auto; overflow: visible; }
.chart-axis { stroke: var(--line-strong); stroke-width: 1; }
.chart-line { fill: none; stroke: var(--accent); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.chart-area { fill: rgba(52, 213, 154, 0.1); }
.chart-point { fill: var(--canvas); stroke: var(--accent); stroke-width: 2; cursor: pointer; }
.chart-axis-label { fill: var(--muted); font-family: 'IBM Plex Mono', monospace; font-size: 10px; }
.chart-caption { display: flex; justify-content: space-between; gap: 1rem; }
.chart-empty { color: var(--muted); font-size: 0.8rem; padding: 1rem 0; }

/* ---------- Printable report ---------- */
.print-report { display: none; }
.print-report-header { display: flex; justify-content: space-between; align-items: flex-start; border-bottom: 2px solid #111; padding-bottom: 1.25rem; margin-bottom: 1.5rem; }
.print-report h1 { color: #111; font-size: 2.2rem; margin: 0.25rem 0; }
.print-report p, .print-report small { color: #555; font-size: 0.78rem; line-height: 1.5; }
.print-report-mark { color: #111; font-weight: 700; font-size: 1rem; line-height: 0.85; letter-spacing: 0.1em; text-align: right; }
.print-report-mark span { color: #15966b; }
.print-report-context { display: flex; justify-content: space-between; padding: 0.8rem 0; border-bottom: 1px solid #ccc; color: #555; font-size: 0.8rem; }
.print-report-context strong { color: #111; }
.print-report-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.8rem; margin: 1.2rem 0; }
.print-report-card { border: 1px solid #ccc; padding: 0.9rem; }
.print-report-card span { display: block; color: #555; font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.08em; }
.print-report-card strong { display: block; color: #111; font-size: 1.25rem; margin: 0.25rem 0; }
.print-report-table { border-top: 1px solid #111; border-bottom: 1px solid #111; }
.print-report-table div { display: flex; justify-content: space-between; padding: 0.55rem 0; border-bottom: 1px solid #ddd; color: #555; font-size: 0.82rem; }
.print-report-table div:last-child { border-bottom: 0; }
.print-report-table strong { color: #111; }
.print-report-foot { margin-top: 1.5rem; }
.print-report-section { color: #111; font-size: 0.8rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; margin: 1.4rem 0 0.6rem; }
.print-report table { width: 100%; border-collapse: collapse; margin: 0.4rem 0 1.2rem; }
.print-report th { background: #f3f3f4; color: #333; font-size: 0.62rem; text-transform: uppercase; letter-spacing: 0.05em; padding: 0.45rem 0.6rem; border: 1px solid #ddd; text-align: right; font-weight: 600; }
.print-report td { color: #111; font-size: 0.72rem; padding: 0.4rem 0.6rem; border: 1px solid #ddd; text-align: right; font-variant-numeric: tabular-nums; }
.print-report th:first-child, .print-report td:first-child { text-align: left; }
.print-report tbody tr { break-inside: avoid; }

@media print {
  body.printing-report { background: #fff; color: #111; }
  body.printing-report > *:not(#printReportMount) { display: none !important; }
  body.printing-report #printReportMount { display: block !important; }
  body.printing-report .print-report { display: block; padding: 0.25in; font-family: Arial, sans-serif; }
  @page { margin: 0.35in; size: letter; }
}

/* ---------- Scenario compare modal ---------- */
.compare-modal { display: none; position: fixed; inset: 0; background: rgba(10, 10, 11, 0.85); z-index: 50; align-items: center; justify-content: center; padding: 2rem; backdrop-filter: blur(4px); }
.compare-modal.open { display: flex; }
.compare-modal-inner { background: var(--surface); width: min(880px, 94vw); max-height: 84vh; overflow-y: auto; padding: 2.25rem; border: 1px solid var(--line); }
.compare-modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; margin-bottom: 0.75rem; }
.compare-modal-head h2 { color: var(--ink); font-size: 1.4rem; font-weight: 500; margin: 0; }
.compare-note { color: var(--muted); font-size: 0.8rem; line-height: 1.6; max-width: 62ch; margin: 0; }
.compare-actions { display: flex; gap: 0.6rem; align-items: center; margin: 1.1rem 0; flex-wrap: wrap; }
.compare-empty { border: 1px dashed var(--line-strong); padding: 1.4rem; color: var(--muted); font-size: 0.82rem; line-height: 1.6; margin-bottom: 1rem; }
.compare-empty p { margin: 0; }
.compare-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 0.9rem; }
.compare-card { border: 1px solid var(--line); padding: 1rem; background: rgba(10, 10, 11, 0.34); }
.compare-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 0.75rem; margin-bottom: 0.85rem; }
.compare-card-head strong { color: var(--ink); font-size: 0.82rem; display: block; }
.compare-card-actions { display: flex; gap: 0.35rem; }
.compare-stats { flex-direction: column; gap: 0.5rem; }
.compare-stats .snapshot-stat { border-left: none; padding-left: 0; border-top: 1px solid var(--line); padding-top: 0.45rem; }

/* ---------- Motion ---------- */

@keyframes brandIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}
@keyframes riseIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: none; }
}
@keyframes figurePop {
  from { opacity: 0; transform: scale(0.97); }
  to { opacity: 1; transform: none; }
}

@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .sidebar {
    position: relative;
    height: auto;
    flex-direction: column;
    padding: 1.1rem 1rem;
  }
  .steps {
    flex-direction: row;
    overflow-x: auto;
    gap: 0.15rem;
    padding-bottom: 0.25rem;
  }
  .step { min-width: max-content; }
  .sidebar-foot { display: none; }
  .ad-slot--sidebar { display: none !important; }
  .main { padding: 1.5rem 1.15rem 2.5rem; }
  .field-grid, .compare-grid { grid-template-columns: 1fr; }
  h1 { font-size: 1.75rem; }
  .footer-cols { grid-template-columns: 1fr 1fr; }
  .workflow-bar { grid-template-columns: 1fr; }
  .snapshot-stats { justify-content: space-between; }
  .workflow-actions { justify-content: flex-start; }
  .snapshot-panel { grid-template-columns: 1fr; }
  .snapshot-detail { border-left: 0; border-top: 1px solid var(--line); padding: 0.75rem 0 0; }
  .donut-chart-wrap { grid-template-columns: 1fr; justify-items: center; }
  .chart-card { margin-left: 1rem; margin-right: 1rem; }
  .chart-caption { flex-direction: column; gap: 0.25rem; }
  .rate-strip { flex-direction: column; }
  .rate-strip .rate-cell {
    border-right: none;
    border-bottom: 1px solid var(--line);
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
  }
}
