:root {
  --bg: #0f172a;
  --card: #1e293b;
  --line: #334155;
  --text: #f8fafc;
  --muted: #94a3b8;
  --soft: #cbd5e1;
  --cyan: #06b6d4;
  --rose: #f43f5e;
  --amber: #eab308;
  --green: #10b981;
  --violet: #8b5cf6;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { background: var(--bg); color: var(--text); font: 16px/1.55 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif; margin: 0; overflow-x: hidden; }
a { color: var(--cyan); }
strong { color: var(--text); }
h1, h2, h3 { line-height: 1.15; margin: 0; }

.wrap { margin: 0 auto; max-width: 1200px; padding: 0 1rem; }
@media (min-width: 640px) { .wrap { padding: 0 1.5rem; } }

.masthead { background: var(--card); border-bottom: 1px solid var(--line); margin-bottom: 2.5rem; padding: 1.5rem 0 2rem; }
.crumbs { display: flex; font-size: 0.8rem; gap: 1rem; justify-content: space-between; letter-spacing: 0.08em; margin-bottom: 1.5rem; text-transform: uppercase; }
.crumbs a { text-decoration: none; }
.crumbs span { color: var(--muted); }
h1 { font-size: clamp(2rem, 5vw, 3rem); font-weight: 800; letter-spacing: -0.02em; margin-bottom: 1rem; }
.hl, .cyan { color: var(--cyan); }
.rose { color: var(--rose); }
.amber { color: var(--amber); }
.green { color: var(--green); }
.lede { color: var(--soft); font-size: 1.1rem; margin: 0 0 1.75rem; max-width: 52rem; }

.stat-row { border-top: 1px solid var(--line); display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); padding-top: 1.5rem; }
.stat { background: var(--bg); border: 1px solid var(--line); border-radius: 0.6rem; padding: 1rem; text-align: center; }
.stat p { margin: 0; }
.stat-label { color: var(--muted); font-size: 0.75rem; letter-spacing: 0.1em; text-transform: uppercase; }
.stat-value { font-size: 2rem; font-weight: 800; }
.stat-note { color: var(--muted); font-size: 0.85rem; }
.assume { color: var(--muted); font-size: 0.85rem; margin: 1.25rem 0 0; max-width: 60rem; }

main section { margin-bottom: 3.5rem; }
h2 { border-bottom: 2px solid var(--rose); color: var(--rose); display: inline-block; font-size: clamp(1.5rem, 3vw, 1.9rem); margin-bottom: 1rem; padding-bottom: 0.4rem; }
h2 span { color: var(--rose); }
.section-lede { color: var(--soft); font-size: 1.05rem; margin: 0 0 1.5rem; max-width: 52rem; }

.grid { display: grid; gap: 1.25rem; margin-bottom: 1.25rem; }
.two, .one-one { grid-template-columns: 1fr; }
.two-one { grid-template-columns: 1fr; }
.four { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
@media (min-width: 960px) {
  .two, .one-one { grid-template-columns: 1fr 1fr; }
  .two-one { grid-template-columns: 2fr 1fr; }
}

.card { background: var(--card); border: 1px solid var(--line); border-radius: 0.8rem; box-shadow: 0 20px 40px -20px rgba(0, 0, 0, 0.6); min-width: 0; padding: 1.25rem; }
.card + .card { margin-top: 0; }
section > .card { margin-bottom: 1.25rem; }
.card h3 { font-size: 1.15rem; margin-bottom: 0.75rem; }
.card h3.chart-title { font-size: 1rem; font-weight: 600; text-align: center; }
.card p { color: var(--soft); }
.accent-left { border-left: 4px solid var(--cyan); }
.chart { position: relative; width: 100%; }
.scroll-x { overflow-x: auto; }

.ledger, .matrix { border-collapse: collapse; font-size: 0.9rem; width: 100%; }
.ledger td, .ledger th, .matrix td, .matrix th { border-bottom: 1px solid rgba(51, 65, 85, 0.6); padding: 0.5rem 0.4rem; text-align: left; }
.ledger td:last-child, .ledger th:last-child { text-align: right; }
.ledger th, .matrix th { color: var(--muted); font-size: 0.75rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; }
.ledger .total td { border-top: 2px solid var(--line); color: var(--text); font-weight: 700; }
.ledger.compact td:nth-child(2) { text-align: right; }
.matrix td:not(:first-child), .matrix th:not(:first-child) { text-align: right; white-space: nowrap; }
.matrix td.em { color: var(--amber); font-weight: 700; }
.records td:first-child { white-space: normal; }
.neg { color: var(--rose); }

.callout { border-left: 4px solid var(--amber); margin: 1.25rem 0 0; padding-left: 0.9rem; }
.reasons { color: var(--soft); margin: 0 0 1rem; padding-left: 1.2rem; }
.reasons li { margin-bottom: 0.6rem; }
.fine { color: var(--muted) !important; font-size: 0.82rem; margin: 0.75rem 0 0; }

.mini p { margin: 0; }
.mini .kicker { color: var(--muted); font-size: 0.72rem; letter-spacing: 0.1em; margin-bottom: 0.3rem; }
.mini .big { color: var(--cyan); font-size: 1.6rem; font-weight: 800; margin-bottom: 0.4rem; }
.mini p:last-child { font-size: 0.9rem; }
.remember .big { color: var(--amber); }

.fee-strip { display: grid; gap: 0.75rem; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.fee-strip div { background: var(--bg); border: 1px solid var(--line); border-radius: 0.5rem; display: grid; gap: 0.15rem; padding: 0.75rem; }
.fee-strip span { color: var(--muted); font-size: 0.75rem; letter-spacing: 0.06em; text-transform: uppercase; }
.fee-strip b { font-size: 1.3rem; }
.fee-strip small { color: var(--muted); }

/* Hover / focus popovers for definitions. */
.tip { border-bottom: 1px dotted var(--cyan); color: var(--text); cursor: help; position: relative; }
.tip::after {
  background: #020617;
  border: 1px solid var(--line);
  border-radius: 0.5rem;
  bottom: calc(100% + 8px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  color: var(--soft);
  content: attr(data-tip);
  font-size: 0.82rem;
  font-weight: 400;
  left: 50%;
  letter-spacing: normal;
  line-height: 1.45;
  opacity: 0;
  padding: 0.6rem 0.75rem;
  pointer-events: none;
  position: absolute;
  text-align: left;
  text-transform: none;
  transform: translateX(-50%);
  transition: opacity 120ms ease;
  white-space: normal;
  width: min(280px, 80vw);
  z-index: 20;
}
.tip:hover::after, .tip:focus::after, .tip:focus-visible::after { opacity: 1; }
.tip:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }

.method p { color: var(--soft); font-size: 0.92rem; }
.sources { columns: 1; font-size: 0.85rem; line-height: 1.5; margin: 0; padding-left: 1.1rem; }
.sources li { margin-bottom: 0.3rem; }

.foot { border-top: 1px solid var(--line); background: var(--card); padding: 2rem 1rem; text-align: center; }
.foot a { text-decoration: none; }
/* Inside scrolling tables, open popovers downward and keep them inside the card. */
.scroll-x .tip::after { bottom: auto; top: calc(100% + 8px); }
.matrix th .tip::after { left: auto; right: 0; transform: none; }
.matrix td .tip::after { left: 0; transform: none; }
.zoom { display: flex; gap: 0.4rem; justify-content: center; margin: -0.25rem 0 0.75rem; }
.zoom button { background: var(--bg); border: 1px solid var(--line); border-radius: 999px; color: var(--muted); cursor: pointer; font: inherit; font-size: 0.8rem; padding: 0.3rem 0.8rem; }
.zoom button[aria-pressed="true"] { background: var(--cyan); border-color: var(--cyan); color: #04131a; font-weight: 600; }
.zoom button:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }
