/* actuarail — focused, data-tool aesthetic. Themeable (Dark / Light / Code). */

/* ---- Structural / non-themed vars ---- */
:root {
  --radius: 6px;
  --radius-sm: 4px;
  --maxw: 1400px;
  --sidebar-w: 248px;
  --mono: ui-monospace, "SF Mono", "Cascadia Code", Menlo, Consolas, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, system-ui, sans-serif;
  --font: var(--sans);
}

/* ---- DARK (default) ---- */
/* Calendar event-type colors. Themed alongside chart palette so the same
   indigo/emerald/amber maps idiomatically per theme. */
:root,
:root[data-theme="dark"] {
  --cal-fed: #818cf8;       /* indigo */
  --cal-treasury: #34d399;  /* emerald */
  --cal-economic: #fbbf24;  /* amber */
}
:root[data-theme="light"] { --cal-fed: #4f46e5; --cal-treasury: #059669; --cal-economic: #d97706; }
:root[data-theme="code"]  { --cal-fed: #ae81ff; --cal-treasury: #a6e22e; --cal-economic: #fd971f; }

:root,
:root[data-theme="dark"] {
  --bg: #0a0e1a;
  --surface: #111827;
  --surface-2: #0d1424;
  --sidebar-bg: #070b14;
  --ink: #f1f5f9;
  --ink-soft: #cbd5e1;
  --ink-faint: #7a8699;
  --border: #1e2638;
  --border-strong: #2d3a52;
  --accent: #38bdf8;           /* sky-400 */
  --accent-deep: #0ea5e9;
  --brand-accent: var(--accent); /* color for the "interest" run in the wordmark */
  --green: #34d399;
  --red: #fb7185;
  --amber: #fbbf24;
  --green-soft: rgba(52, 211, 153, 0.14);
  --red-soft: rgba(251, 113, 133, 0.14);
  --accent-soft: rgba(56, 189, 248, 0.16);
  --accent-area: rgba(56, 189, 248, 0.06);
  --grid: #1a2235;
  --tooltip-bg: #0d1424;
  --tooltip-border: #1e2638;
  --markline: #64748b;
  --chart-line-1: #38bdf8;
  --chart-line-2: #fbbf24;
  --chart-line-3: #34d399;
  --chart-line-4: #e879f9;
  --chart-line-5: #fb7185;
  --font: var(--sans);
}

/* ---- LIGHT ---- */
:root[data-theme="light"] {
  --bg: #ffffff;
  --surface: #fafbfc;
  --surface-2: #f1f5f9;
  --sidebar-bg: #f8fafc;
  --ink: #0f172a;
  --ink-soft: #334155;
  --ink-faint: #64748b;
  --border: #e2e8f0;
  --border-strong: #cbd5e1;
  --accent: #0284c7;           /* sky-600 */
  --accent-deep: #0369a1;
  --brand-accent: var(--accent);
  --green: #059669;
  --red: #dc2626;
  --amber: #d97706;
  --green-soft: rgba(5, 150, 105, 0.12);
  --red-soft: rgba(220, 38, 38, 0.10);
  --accent-soft: rgba(2, 132, 199, 0.12);
  --accent-area: rgba(2, 132, 199, 0.08);
  --grid: #eef2f7;
  --tooltip-bg: #ffffff;
  --tooltip-border: #e2e8f0;
  --markline: #94a3b8;
  --chart-line-1: #0891b2;
  --chart-line-2: #d97706;
  --chart-line-3: #059669;
  --chart-line-4: #c026d3;
  --chart-line-5: #e11d48;
  --font: var(--sans);
}

/* ---- CODE (Monokai-inspired) ---- */
:root[data-theme="code"] {
  --bg: #272822;
  --surface: #1e1f1c;
  --surface-2: #2d2e28;
  --sidebar-bg: #1a1b16;
  --ink: #f8f8f2;
  --ink-soft: #cfcfc2;
  --ink-faint: #75715e;
  --border: #3e3f3a;
  --border-strong: #5b5b50;
  --accent: #a6e22e;
  --accent-deep: #66d9ef;
  --brand-accent: var(--accent);
  --green: #a6e22e;
  --red: #f92672;
  --amber: #fd971f;
  --green-soft: rgba(166, 226, 46, 0.14);
  --red-soft: rgba(249, 38, 114, 0.14);
  --accent-soft: rgba(166, 226, 46, 0.18);
  --accent-area: rgba(166, 226, 46, 0.06);
  --grid: #353630;
  --tooltip-bg: #1e1f1c;
  --tooltip-border: #3e3f3a;
  --markline: #75715e;
  --chart-line-1: #66d9ef;
  --chart-line-2: #fd971f;
  --chart-line-3: #a6e22e;
  --chart-line-4: #ae81ff;
  --chart-line-5: #f92672;
  --font: var(--mono);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); }
a:hover { color: var(--accent-deep); }

/* ============================================================
   Brand wordmark (sidebar + mobile topbar)
   ============================================================ */
.brand {
  display: flex; align-items: center; gap: 9px;
  text-decoration: none; color: var(--ink);
}
.brand-mark {
  display: grid; place-items: center;
  width: 26px; height: 26px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  color: var(--accent);
  flex-shrink: 0;
}
.brand-mark svg path { stroke: var(--accent); }
.brand-word {
  font-weight: 700;
  font-size: 15px;
  letter-spacing: -0.2px;
  font-family: var(--mono);
}
/* The middle "interest" run gets the brand-accent color so the wordmark reads
   us<accent>interest</accent>rates. brand-us kept as alias for older markup. */
.brand-accent,
.brand-us { color: var(--brand-accent); }

/* ============================================================
   App shell — sidebar + main column
   ============================================================ */
.app-shell {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  z-index: 20;
}
.sidebar-brand {
  padding: 16px 18px 14px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.sidebar-nav {
  flex: 1 1 auto;
  padding: 10px 8px;
  display: flex;
  flex-direction: column;
  gap: 1px;
  overflow-y: auto;
}
.sidebar-divider {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 8px 10px;
}
.nav-link {
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px;
  padding: 7px 12px;
  color: var(--ink-soft);
  text-decoration: none;
  font-size: 13.5px;
  border-radius: var(--radius-sm);
  border: 0;
  background: transparent;
  cursor: pointer;
  font-family: var(--font);
  width: 100%;
  text-align: left;
  line-height: 1.35;
  border-left: 2px solid transparent;
  transition: background-color .12s ease, color .12s ease, border-color .12s ease;
}
.nav-link:hover { color: var(--ink); background: var(--surface); }
.nav-link.active {
  color: var(--ink);
  background: var(--accent-soft);
  border-left-color: var(--accent);
}
.nav-parent {
  font-weight: 700;
  color: var(--ink);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.9px;
  padding: 9px 12px 7px;
  margin-top: 10px;
  border-top: 1px solid var(--border);
  border-radius: 0;
}
.nav-group:first-of-type > .nav-parent { border-top: none; margin-top: 4px; }
.nav-parent:hover { color: var(--ink); background: var(--surface); }
.nav-parent .nav-chevron {
  color: var(--ink-faint);
  transition: transform .18s ease;
  display: inline-flex;
  align-items: center;
}
.nav-parent[aria-expanded="true"] .nav-chevron { transform: rotate(90deg); }
.nav-group.has-active > .nav-parent { color: var(--ink); }

/* Collapse/expand uses the grid-template-rows 0fr/1fr trick. The pattern only
   works with a SINGLE direct child of the grid container — otherwise grid
   auto-creates rows for each child and the 0fr constraint only applies to the
   first row, leaving the rest visible. We wrap the child links in a single
   .nav-children-inner div so collapse works reliably across themes / browsers. */
.nav-children {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows .18s ease;
  overflow: hidden;
}
.nav-children > .nav-children-inner { min-height: 0; }
.nav-children-inner {
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.nav-children[data-expanded="true"] { grid-template-rows: 1fr; }
.nav-child {
  font-size: 13px;
  padding: 6px 12px 6px 22px;
  color: var(--ink-soft);
}
.nav-child:hover { color: var(--ink); }
.nav-child.active {
  color: var(--ink);
  background: var(--accent-soft);
  border-left-color: var(--accent);
}

.sidebar-foot {
  border-top: 1px solid var(--border);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex-shrink: 0;
}
.sidebar-version {
  font-size: 11px;
  color: var(--ink-faint);
  font-family: var(--mono);
  letter-spacing: 0.2px;
  text-align: center;
}

/* Theme switcher (now lives in sidebar foot) */
.theme-toggle {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  background: var(--surface); border: 1px solid var(--border-strong);
  color: var(--ink-soft); font-family: inherit;
  font-size: 12px; font-weight: 600;
  padding: 6px 12px; border-radius: var(--radius-sm); cursor: pointer;
  transition: color .12s, background .12s, border-color .12s;
  width: 100%;
}
.theme-toggle:hover { color: var(--ink); border-color: var(--accent); }
.theme-toggle .theme-icon { font-size: 13px; line-height: 1; }
.theme-toggle .theme-name { letter-spacing: 0.2px; }

/* Main column wrapper */
.main-column {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.app {
  max-width: var(--maxw);
  width: 100%;
  margin: 0 auto;
  padding: 28px clamp(18px, 4vw, 40px) 40px;
  min-height: 60vh;
  flex: 1 0 auto;
}
.site-footer {
  max-width: var(--maxw);
  width: 100%;
  margin: 0 auto;
  padding: 14px clamp(18px, 4vw, 40px) 24px;
  border-top: 1px solid var(--border);
  color: var(--ink-faint);
  font-size: 12px;
  display: flex;
  justify-content: flex-start;
  flex-wrap: wrap;
  gap: 8px;
}
.site-footer a { color: var(--ink-soft); text-decoration: underline; text-decoration-color: var(--border-strong); }
.site-footer a:hover { color: var(--accent); }

/* ============================================================
   Mobile topbar + hamburger
   ============================================================ */
.mobile-topbar {
  display: none;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  position: sticky;
  top: 0;
  z-index: 30;
}
.hamburger {
  display: grid;
  place-items: center;
  width: 36px; height: 36px;
  background: transparent;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  cursor: pointer;
  padding: 0;
}
.hamburger-bar {
  display: block;
  width: 16px; height: 2px;
  background: var(--ink);
  border-radius: 1px;
  margin: 2px 0;
}
.sidebar-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  opacity: 0;
  transition: opacity .2s ease;
  z-index: 25;
}
.sidebar-backdrop.show { opacity: 1; }

/* ============================================================
   View header (tight title row on every page)
   ============================================================ */
.view-head {
  margin-bottom: 18px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}
.view-head-row {
  display: flex; align-items: baseline; justify-content: space-between; gap: 16px;
  flex-wrap: wrap;
}
.view-head h1 {
  font-size: 20px;
  margin: 0;
  font-weight: 600;
  letter-spacing: -0.2px;
  color: var(--ink);
}
.view-head .view-updated {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--ink-faint);
  white-space: nowrap;
}
.view-head .view-desc {
  color: var(--ink-soft);
  font-size: 13.5px;
  margin: 4px 0 0;
}
.view-head .view-source {
  color: var(--ink-faint);
  font-size: 12px;
  margin: 6px 0 0;
}
.view-head .view-source a {
  color: var(--ink-faint);
  text-decoration: underline;
  text-decoration-color: var(--border-strong);
}
.view-head .view-source a:hover { color: var(--accent); }

/* ============================================================
   Panels (chart shells)
   ============================================================ */
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
}
.chart { width: 100%; height: 420px; }
.chart-sm { width: 100%; height: 280px; }

/* ============================================================
   Home (compact)
   ============================================================ */
.home-head h1 {
  font-size: 22px;
  margin: 0 0 4px;
  font-weight: 600;
  letter-spacing: -0.3px;
}
.home-head p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 14px;
}
.home-row {
  display: flex; align-items: baseline; gap: 14px;
  margin: 14px 0 10px;
  flex-wrap: wrap;
}
.home-spread-badge {
  font-family: var(--mono);
  font-size: 15px;
  font-weight: 600;
  padding: 4px 12px;
  border-radius: var(--radius-sm);
}
.home-spread-badge.green { background: var(--green-soft); color: var(--green); }
.home-spread-badge.red { background: var(--red-soft); color: var(--red); }
.home-asof {
  color: var(--ink-faint);
  font-family: var(--mono);
  font-size: 12px;
}
.home-links {
  margin: 18px 0 0;
  display: flex; flex-wrap: wrap; gap: 6px 18px;
  font-size: 13.5px;
}
.home-links a { color: var(--accent); text-decoration: none; }
.home-links a:hover { text-decoration: underline; }
.home-source {
  margin: 18px 0 0;
  font-size: 12px;
  color: var(--ink-faint);
}
.home-source a { color: var(--ink-faint); text-decoration: underline; text-decoration-color: var(--border-strong); }
.home-source a:hover { color: var(--accent); }

/* ============================================================
   Curve scrubber controls
   ============================================================ */
.curve-top { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.spread-badge {
  font-family: var(--mono); font-size: 13.5px; font-weight: 600;
  padding: 4px 10px; border-radius: var(--radius-sm);
}
.spread-badge.green { background: var(--green-soft); color: var(--green); }
.spread-badge.red { background: var(--red-soft); color: var(--red); }
.asof { color: var(--ink-faint); font-size: 12px; font-family: var(--mono); }

.quick-views {
  margin: 12px 0 6px;
  padding: 12px 0 0;
  border-top: 1px dashed var(--border);
}
.quick-views-title {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.7px;
  color: var(--ink-faint);
  margin: 0 0 8px;
}
.preset-row {
  display: flex; gap: 6px; flex-wrap: wrap; align-items: center;
  margin-bottom: 8px;
}
.preset-row:last-child { margin-bottom: 0; }
.preset-row-event { gap: 10px; }
.preset-row-label {
  font-size: 11px; color: var(--ink-faint); font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.4px;
  flex: none;
}
.preset-btn {
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  color: var(--ink-soft);
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 500;
  padding: 7px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: color .12s, border-color .12s, background .12s;
}
.preset-btn:hover { color: var(--ink); border-color: var(--accent); background: var(--surface); }
.preset-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.preset-select {
  flex: 1; min-width: 200px;
  background: var(--surface-2); border: 1px solid var(--border-strong); color: var(--ink);
  font-family: inherit; font-size: 12.5px;
  padding: 7px 32px 7px 12px; border-radius: var(--radius-sm); cursor: pointer;
  appearance: none; -webkit-appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8' fill='none' stroke='%237a8699' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'><path d='M1.5 1.75 L6 6.25 L10.5 1.75'/></svg>");
  background-repeat: no-repeat; background-position: right 10px center; background-size: 10px 7px;
}
.preset-select:hover { border-color: var(--accent); }
.preset-select:focus-visible { outline: none; border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.preset-select option { background: var(--surface); color: var(--ink); }

/* Plain numeric input (scenario picker): same tokens as .preset-select but
   no dropdown chevron and no native spin buttons - it's a typed field. */
.num-input {
  background: var(--surface-2); border: 1px solid var(--border-strong); color: var(--ink);
  font-family: inherit; font-size: 12.5px;
  padding: 7px 12px; border-radius: var(--radius-sm);
  appearance: textfield; -moz-appearance: textfield;
}
.num-input::-webkit-outer-spin-button, .num-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.num-input:hover { border-color: var(--accent); }
.num-input:focus-visible { outline: none; border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }

@media (max-width: 560px) {
  .preset-row-time { gap: 6px; }
  .preset-row-time .preset-btn { flex: 1 1 calc(50% - 3px); min-width: 0; }
  .preset-row-event { flex-direction: column; align-items: stretch; }
  .preset-row-event .preset-row-label { margin-bottom: 2px; }
  .preset-select { width: 100%; min-width: 0; }
}

.curves-list { display: flex; flex-direction: column; gap: 6px; margin-top: 12px; }
.curve-row { display: flex; align-items: center; gap: 10px; }
.curve-swatch { width: 10px; height: 10px; border-radius: 2px; flex: none; }
.curve-label { font-family: var(--mono); font-size: 12.5px; min-width: 120px; color: var(--ink-soft); }
.curve-slider { flex: 1; min-width: 140px; accent-color: var(--accent); }
.curve-remove {
  background: none; border: none; color: var(--ink-faint);
  font-size: 16px; cursor: pointer; line-height: 1; padding: 0 4px;
}
.curve-remove:hover { color: var(--red); }
.btn-add {
  margin-top: 10px; background: var(--surface-2);
  border: 1px solid var(--border-strong); color: var(--accent);
  font-size: 12.5px; font-weight: 600;
  padding: 7px 12px; border-radius: var(--radius-sm); cursor: pointer;
  font-family: inherit;
}
.btn-add:hover { border-color: var(--accent); }
.btn-add:disabled { opacity: .5; cursor: default; }

/* ============================================================
   Prose / learn / upcoming
   ============================================================ */
.prose { max-width: none; }
.prose h2 { font-size: 16px; margin: 22px 0 6px; font-weight: 600; }
.prose p { color: var(--ink-soft); font-size: 14px; }
.prose .analogy {
  margin: 12px 0; padding: 12px 16px;
  border-left: 3px solid var(--accent);
  background: var(--surface-2);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: var(--ink-soft);
  font-size: 13.5px;
}
.callout {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin: 14px 0;
}

/* Dot plot "How to read this chart" guide */
.dp-reading-guide { font-size: 13.5px; line-height: 1.6; color: var(--ink-soft); }
.dp-guide-title { margin: 0; font-weight: 700; color: var(--ink); font-size: 14px; }
/* Collapsible guide (v1.20.0): native details/summary keeps it accessible.
   The chevron rotates via the [open] state; content gets breathing room. */
summary.dp-guide-title { cursor: pointer; user-select: none; list-style: none; }
summary.dp-guide-title::-webkit-details-marker { display: none; }
summary.dp-guide-title::before { content: "▸"; display: inline-block; margin-right: 8px; color: var(--accent); transition: transform 0.15s; }
details[open] > summary.dp-guide-title::before { transform: rotate(90deg); }
details.dp-reading-guide[open] > summary.dp-guide-title { margin-bottom: 8px; }
.dp-view-caption { margin: 2px 0 10px; max-width: none; }
.dp-guide-steps { margin: 0; padding-left: 20px; }
.dp-guide-steps li { margin: 6px 0; }
.dp-guide-steps b { color: var(--ink); }
.dp-guide-takeaway { margin: 10px 0 0; color: var(--ink); font-style: italic; }

/* Reference-rates what/why key */
.rate-key { font-size: 13px; line-height: 1.6; color: var(--ink-soft); }
.rate-key-title { margin: 0 0 8px; font-weight: 700; color: var(--ink); font-size: 14px; }
/* Collapsible measure keys (v1.20.1): same pattern as the dot plot guide. */
summary.rate-key-title { margin: 0; cursor: pointer; user-select: none; list-style: none; }
summary.rate-key-title::-webkit-details-marker { display: none; }
summary.rate-key-title::before { content: "▸"; display: inline-block; margin-right: 8px; color: var(--accent); transition: transform 0.15s; }
details[open] > summary.rate-key-title::before { transform: rotate(90deg); }
details.rate-key[open] > summary.rate-key-title { margin-bottom: 8px; }
.rate-key-item { margin: 7px 0; }
.rate-key-item b { color: var(--ink); }
.rate-key-why { display: block; color: var(--ink-faint); font-size: 12.5px; margin-top: 1px; }

/* FOMC list */
.fomc-list { list-style: none; padding: 0; margin: 14px 0; }
.fomc-item {
  display: flex; align-items: center; gap: 14px;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 6px;
  background: var(--surface);
}
.fomc-item.next { border-color: var(--accent); }
.fomc-date { font-family: var(--mono); font-weight: 600; min-width: 140px; font-size: 13px; }

/* Meeting-history rows: color by rate change + mobile-friendly layout (v1.30.0) */
.fomc-item-mtg { border-left-width: 3px; }
.fomc-item-mtg .fomc-decision { color: var(--ink-soft); font-size: 13px; }
.fomc-item-mtg .fomc-links { margin-left: auto; font-size: 12.5px; display: flex; gap: 12px; white-space: nowrap; }
.fomc-item.fomc-hike { border-left-color: var(--red); }
.fomc-item.fomc-cut  { border-left-color: var(--green); }
.fomc-item.fomc-hold { border-left-color: var(--border-strong); }
.fomc-item.fomc-hike .fomc-decision { color: var(--red); font-weight: 600; }
.fomc-item.fomc-cut  .fomc-decision { color: var(--green); font-weight: 600; }
.fomc-legend { display: flex; flex-wrap: wrap; gap: 8px 14px; margin: 2px 0 10px; font-size: 12px; }
.fomc-key { display: inline-flex; align-items: center; gap: 6px; color: var(--ink-soft); }
.fomc-key::before { content: ""; width: 12px; height: 3px; border-radius: 2px; background: var(--border-strong); }
.fomc-key.fomc-hike::before { background: var(--red); }
.fomc-key.fomc-cut::before  { background: var(--green); }
@media (max-width: 560px) {
  .fomc-item-mtg { flex-wrap: wrap; gap: 4px 10px; }
  .fomc-item-mtg .fomc-date { min-width: 0; width: 100%; }
  .fomc-item-mtg .fomc-decision { flex: 1 1 auto; }
  .fomc-item-mtg .fomc-links { margin-left: 0; }
}
.fomc-tag {
  font-size: 10px; padding: 2px 8px; border-radius: 999px;
  background: var(--accent-soft); color: var(--accent);
  font-weight: 700; letter-spacing: 0.4px;
}
.fomc-note { color: var(--ink-faint); font-size: 12.5px; }

.ticker {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 8px; margin: 8px 0 16px;
}
.tick {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
}
.tick .k { font-size: 11px; color: var(--ink-faint); }
.tick .v { font-family: var(--mono); font-size: 16px; font-weight: 600; margin-top: 2px; }
.tick .v.red { color: var(--red); } .tick .v.green { color: var(--green); }

/* ============================================================
   Chart header (title + CSV exports)
   ============================================================ */
.chart-header {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; flex-wrap: wrap;
  margin: 8px 0 6px;
}
.chart-title {
  color: var(--ink-faint);
  font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.6px;
}
.csv-group { display: inline-flex; gap: 4px; flex-wrap: wrap; align-items: center; }
/* Download controls — amber so they stand out from the sky-blue accent
   without fighting it. --amber is themed (dark #fbbf24 / light #d97706 /
   code #fd971f), so this holds up across all three themes. */
.csv-group-label { font-size: 11.5px; color: var(--amber); font-weight: 600; margin-right: 3px; }
.csv-btn {
  background: rgba(251, 191, 36, 0.08);
  border: 1px solid var(--amber);
  color: var(--amber);
  font-family: inherit; font-size: 11.5px; font-weight: 600;
  padding: 5px 9px; border-radius: var(--radius-sm); cursor: pointer;
  display: inline-flex; align-items: center; gap: 4px;
  transition: color .12s, border-color .12s, background .12s;
}
.csv-btn:hover { color: var(--bg); background: var(--amber); border-color: var(--amber); }
.csv-btn:focus-visible { outline: 2px solid var(--amber); outline-offset: 2px; }
.csv-btn .csv-icon { font-size: 12px; line-height: 1; }

/* ============================================================
   Source attribution (under chart and as a bottom block)
   ============================================================ */
.source-caption {
  color: var(--ink-faint);
  font-size: 11.5px;
  margin-top: 8px;
  line-height: 1.5;
}
.source-caption a {
  color: var(--ink-faint);
  text-decoration: underline;
  text-decoration-color: var(--border-strong);
}
.source-caption a:hover { color: var(--accent); text-decoration-color: var(--accent); }

.sources-block { margin-top: 24px; padding-top: 14px; border-top: 1px dashed var(--border); }
.sources-block h3 {
  font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.7px;
  color: var(--ink-faint); margin: 0 0 8px;
}
.sources-block ul { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 3px; }
.sources-block li { color: var(--ink-faint); font-size: 12.5px; }
.sources-block a {
  color: var(--ink-soft);
  text-decoration: underline;
  text-decoration-color: var(--border-strong);
}
.sources-block a:hover { color: var(--accent); text-decoration-color: var(--accent); }

/* ============================================================
   Big-number readout
   ============================================================ */
.big-number {
  display: flex; align-items: baseline; flex-wrap: wrap;
  gap: 12px; margin-bottom: 12px;
}
.big-value {
  font-family: var(--mono);
  font-size: 28px;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.6px;
  font-variant-numeric: tabular-nums;
}
.big-context { color: var(--ink-faint); font-size: 13px; }

/* Release selector (dot plot) */
.release-controls {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin: 6px 0 12px;
}
.release-controls label {
  font-size: 11px; color: var(--ink-faint); font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.4px;
}
.release-controls .preset-select { flex: 1; min-width: 200px; max-width: 360px; }
.release-help { color: var(--ink-faint); font-size: 12px; line-height: 1.5; }
/* Dot Plot v1.12.0 — horizon-filter chip row + transcription-coverage callout */
.dp-horizon-chips { margin: 0 0 14px; }
.dp-horizon-chips .chip { font-size: 12px; }
.dp-dots-empty { margin-top: 8px; }

/* Big-number secondary pills */
.big-secondary { display: flex; gap: 14px; flex-wrap: wrap; margin-left: 4px; }
.big-secondary .pill { display: flex; flex-direction: column; gap: 1px; }
.big-secondary .pill-label {
  font-size: 10px; color: var(--ink-faint); font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.5px;
}
.big-secondary .pill-value {
  font-family: var(--mono); font-size: 15px; font-weight: 600;
  color: var(--ink-soft); letter-spacing: -0.3px;
  font-variant-numeric: tabular-nums;
}

/* Series toggle chips */
.toggle-chips {
  display: flex; gap: 6px; flex-wrap: wrap;
  margin: 4px 0 10px;
}
.chip {
  display: inline-flex; align-items: center; gap: 7px;
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  color: var(--ink-faint);
  font-family: inherit; font-size: 12.5px; font-weight: 500;
  padding: 5px 11px; border-radius: 999px; cursor: pointer;
  transition: color .12s, border-color .12s, background .12s, opacity .12s;
  user-select: none;
}
.chip:hover { color: var(--ink); border-color: var(--accent); }
.chip:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.chip .chip-dot {
  width: 9px; height: 9px; border-radius: 2px;
  background: currentColor; flex: none;
}
.chip.off { opacity: 0.5; background: transparent; }
.chip.off .chip-dot { opacity: 0.45; }
.chip.on { color: var(--ink); background: var(--surface); }

/* Section header (e.g., savings tab). A clear step above the uppercase
   chart-title sub-heads, a step below the 20px page h1. */
.section-head { margin: 28px 0 8px; padding-top: 10px; border-top: 1px dashed var(--border); }
.section-head:first-of-type { margin-top: 4px; padding-top: 0; border-top: none; }
.section-head h2 { font-size: 18px; margin: 0 0 4px; color: var(--ink); font-weight: 700; letter-spacing: -0.3px; }
.section-head p { color: var(--ink-soft); font-size: 13px; margin: 0; }

/* Discontinued-data banner (LIBOR) */
.discontinued-banner {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 10px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.5px;
  padding: 2px 8px; border-radius: 999px;
  background: var(--red-soft); color: var(--red);
  border: 1px solid var(--red-soft);
  margin-left: 6px;
}

/* Reference Rates mode toggle */
.refrates-mode-row {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  margin: 4px 0 10px;
}
.mode-toggle {
  display: inline-flex;
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 2px;
}
.mode-btn {
  background: transparent; border: none; color: var(--ink-faint);
  font-family: inherit; font-size: 12.5px; font-weight: 600;
  padding: 5px 14px; border-radius: var(--radius-sm); cursor: pointer;
  transition: color .12s, background .12s;
}
.mode-btn:hover { color: var(--ink); }
.mode-btn.active { background: var(--accent-soft); color: var(--accent); }
.mode-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.spread-base-wrap { display: inline-flex; align-items: center; gap: 8px; }
.spread-base-wrap label {
  font-size: 11px; color: var(--ink-faint); font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.4px;
}
.spread-base-wrap .preset-select { flex: none; min-width: 160px; max-width: 240px; }

/* Mortgage rates - by-credit-score headline table (v1.27.0) */
.rate-table-title { font-size: 15px; margin: 2px 0 8px; color: var(--ink); }
.rate-table-wrap { overflow-x: auto; margin: 0 0 6px; border: 1px solid var(--border); border-radius: var(--radius-sm); }
.rate-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.rate-table th, .rate-table td { padding: 10px 14px; text-align: left; border-bottom: 1px solid var(--border); white-space: nowrap; }
.rate-table thead th {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.4px;
  color: var(--ink-faint); font-weight: 700; background: var(--surface-2);
  border-bottom: 1px solid var(--border-strong);
}
.rate-table tbody tr:last-child td { border-bottom: none; }
.rate-table .rt-r { text-align: right; }
.rate-table .rt-score { font-weight: 700; color: var(--ink); }
.rate-table .rt-tier { color: var(--ink-faint); font-size: 12px; margin-left: 8px; }
.rate-table .rt-rate { font-variant-numeric: tabular-nums; font-weight: 700; color: var(--ink); }
.rate-table .rt-delta { font-variant-numeric: tabular-nums; color: var(--ink-soft); }
.rate-table tr.rt-best td { background: var(--accent-soft); }
.rate-table tr.rt-best .rt-delta { color: var(--accent); font-weight: 700; }

/* Dot-plot grouped toggle rows (v1.30.1) */
.dp-toggle-row { gap: 8px; margin: 4px 0 6px; }
.dp-toggle-label {
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px;
  color: var(--ink-faint); align-self: center; min-width: 38px;
}

/* Dot-plot meeting scrubber (v1.26.0) */
.dp-scrubber { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 2px 0 12px; }
.dp-scrub-slider { flex: 1; min-width: 160px; accent-color: var(--accent); height: 22px; cursor: pointer; }
.dp-scrub-btn {
  background: var(--surface-2); border: 1px solid var(--border-strong); color: var(--ink-soft);
  font-family: inherit; font-size: 12.5px; font-weight: 600; line-height: 1;
  padding: 7px 11px; border-radius: var(--radius-sm); cursor: pointer;
  transition: color .12s, background .12s, border-color .12s;
}
.dp-scrub-btn:hover { color: var(--ink); border-color: var(--accent); }
.dp-scrub-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.dp-scrub-play { min-width: 78px; }
.dp-scrub-play.playing { background: var(--accent-soft); color: var(--accent); border-color: var(--accent); }
.dp-scrub-btn.on { background: var(--accent-soft); color: var(--accent); border-color: var(--accent); }
.dp-scrub-label { font-size: 12px; font-weight: 600; color: var(--ink-soft); white-space: nowrap; }
@media (max-width: 560px) {
  .dp-scrubber { gap: 8px; }
  .dp-scrub-label { width: 100%; order: 5; color: var(--ink-faint); }
}

/* ============================================================
   Mortgage payment calculator (v1.22.0) - homebuyer centerpiece
   ============================================================ */
.mtg-calc { border-left: 3px solid var(--accent); }
.mtg-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 18px; }
.mtg-field { display: flex; flex-direction: column; gap: 5px; }
.mtg-label { font-size: 12px; font-weight: 600; color: var(--ink-soft); }
.mtg-input {
  width: 100%; box-sizing: border-box;
  background: var(--surface-2); border: 1px solid var(--border-strong);
  color: var(--ink); font-family: inherit; font-size: 15px;
  padding: 9px 12px; border-radius: var(--radius-sm);
}
.mtg-input:focus, .mtg-calc .preset-select:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.mtg-calc .preset-select { width: 100%; box-sizing: border-box; font-size: 15px; }
.mtg-hint { font-size: 12px; color: var(--ink-faint); }
.mtg-down { display: flex; flex-direction: column; gap: 6px; }
.mtg-down-row { display: flex; align-items: center; gap: 12px; }
.mtg-slider { flex: 1; min-width: 0; accent-color: var(--accent); height: 22px; cursor: pointer; }
.mtg-pct-wrap { position: relative; flex: none; width: 86px; }
.mtg-pct.mtg-input { width: 100%; padding-right: 24px; text-align: right; }
.mtg-pct-sign { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); color: var(--ink-faint); font-size: 14px; pointer-events: none; }
.mtg-adv { margin: 12px 0 0; }
.mtg-adv-sum { cursor: pointer; font-size: 12.5px; color: var(--accent); font-weight: 600; list-style: none; }
.mtg-adv-sum::-webkit-details-marker { display: none; }
.mtg-adv-sum::before { content: "+ "; }
.mtg-adv[open] .mtg-adv-sum::before { content: "\2212 "; }
.mtg-adv[open] .mtg-adv-sum { margin-bottom: 10px; }
.mtg-result { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--border); }
.mtg-total { display: flex; flex-direction: column; }
.mtg-total-val { font-size: 34px; font-weight: 800; color: var(--ink); line-height: 1.1; letter-spacing: -0.5px; }
.mtg-total-cap { font-size: 12.5px; color: var(--ink-faint); }
.mtg-rate { margin: 8px 0 4px; font-size: 14px; color: var(--ink-soft); }
.mtg-rate b { color: var(--accent); font-size: 16px; }
.mtg-breakdown { margin-top: 8px; }
.mtg-line { display: flex; justify-content: space-between; align-items: baseline; padding: 5px 0; border-bottom: 1px dashed var(--border); font-size: 13.5px; color: var(--ink-soft); }
.mtg-line:last-child { border-bottom: none; }
.mtg-line b { color: var(--ink); font-weight: 600; }
.mtg-faq { margin-top: 14px; }
.mtg-faq > summary { cursor: pointer; list-style: none; }
.mtg-faq > summary::-webkit-details-marker { display: none; }
.mtg-faq > summary.rate-key-title::before { content: "\25B8"; display: inline-block; margin-right: 8px; color: var(--accent); transition: transform 0.15s; }
.mtg-faq[open] > summary.rate-key-title::before { transform: rotate(90deg); }
.mtg-faq[open] > summary.rate-key-title { margin-bottom: 10px; }
.mtg-qa-wrap { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 22px; }
.mtg-qa { padding: 6px 0; }
.mtg-q { margin: 0 0 2px; font-size: 13.5px; font-weight: 600; color: var(--ink); }
.mtg-a { margin: 0; font-size: 13px; line-height: 1.55; color: var(--ink-soft); }
@media (max-width: 560px) {
  .mtg-grid, .mtg-qa-wrap { grid-template-columns: 1fr; }
  .mtg-total-val { font-size: 30px; }
}

/* Mobile filter rows (v1.19.0): chip clusters become a single horizontally
   swipeable row on small screens. The right-edge fade (.chip-scroll-more,
   toggled by JS) appears only while more chips sit past the edge. */
@media (max-width: 560px) {
  .chip-scroll {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 2px;
    max-width: 100%; /* stay inside the group row; scroll internally */
  }
  .chip-scroll::-webkit-scrollbar { display: none; }
  .chip-scroll .chip { flex: none; white-space: nowrap; }
  .chip-scroll.chip-scroll-more {
    -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 32px), transparent);
    mask-image: linear-gradient(to right, #000 calc(100% - 32px), transparent);
  }
  .refrates-mode-row { gap: 10px; }
  .spread-base-wrap { width: 100%; }
  .spread-base-wrap .preset-select { flex: 1; max-width: none; }
}

/* ============================================================
   Mobile — spread overlay layout fix (v1.12.0)
   ============================================================
   Before v1.12.0 the Inversion Watch (spread) page and the Rate History
   spread-overlay section had everything visually mashed together on
   narrow viewports — big-number readout, mode toggle, chart all ran into
   each other with little breathing room and the 10Y-2Y / Add 10Y-3M pills
   would overlap each other or the chart depending on label length.
   Fixed by:
     • Generous vertical spacing (>= 16px) between readout / toggle / chart.
     • `.refrates-mode-row` becomes vertical-stack on narrow screens with
       full-width pills so the two pills can't overlap.
     • `.mode-toggle` wraps so the pill row can flow onto two lines if
       label text is long; `.mode-btn` height >= 44px per Apple HIG.
     • `.big-number` stacks (no baseline-alignment overflow); the
       secondary pills wrap cleanly underneath.
     • Explicit margin-top on the chart container so it doesn't sit
       directly against the toggle row.
   Tested mentally at iPhone SE (375px), iPhone 14 Pro (393px), iPad
   portrait (768px) — no overlap.
*/
@media (max-width: 768px) {
  .big-number {
    align-items: flex-start;
    gap: 8px 14px;
    margin-bottom: 18px;
  }
  .refrates-mode-row {
    margin: 4px 0 18px;
    gap: 12px;
    flex-wrap: wrap;
    align-items: stretch;
  }
  .mode-toggle {
    flex-wrap: wrap;
    gap: 4px;
    width: 100%;
    box-sizing: border-box;
  }
  .mode-btn {
    flex: 1 1 auto;
    min-height: 44px;
    padding: 10px 14px;
    font-size: 13px;
    text-align: center;
    white-space: nowrap;
  }
  .refrates-mode-row + .chart-header {
    margin-top: 4px;
  }
  /* Both renderSpread and renderRateHistory put a chart directly after
     either the toggle row or the spread toggle-chips row — give it air. */
  .refrates-mode-row + .chart,
  .toggle-chips + .chart,
  .chart-header + .chart {
    margin-top: 8px;
  }
}

@media (max-width: 560px) {
  .big-number {
    flex-direction: column;
    align-items: flex-start;
    margin-bottom: 20px;
  }
  .big-secondary {
    margin-left: 0;
    gap: 12px 18px;
  }
  .refrates-mode-row {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    margin-bottom: 20px;
  }
  .mode-toggle {
    flex-direction: column;
    padding: 4px;
    width: 100%;
  }
  .mode-btn {
    flex: 1 1 100%;
    width: 100%;
    padding: 12px 14px;
    font-size: 13.5px;
  }
}

/* ============================================================
   Mobile breakpoint — sidebar slides in from the left
   ============================================================ */
@media (max-width: 900px) {
  .mobile-topbar { display: flex; }
  .app-shell { display: block; }

  .sidebar {
    position: fixed;
    top: 0; left: 0; bottom: 0;
    height: 100vh;
    width: 84%; max-width: 300px;
    transform: translateX(-100%);
    transition: transform .22s ease;
    z-index: 40;
    box-shadow: 0 0 30px rgba(0,0,0,0.4);
  }
  .sidebar.open { transform: translateX(0); }

  .main-column { display: flex; flex-direction: column; min-height: calc(100vh - 58px); }
}

@media (max-width: 640px) {
  .app { padding: 22px 16px 28px; }
  .view-head h1 { font-size: 18px; }
  .chart { height: 340px; }
  .panel { padding: 12px 12px; }
  .big-value { font-size: 24px; }
  .big-secondary .pill-value { font-size: 14px; }
  .site-footer { padding: 14px 16px 22px; font-size: 11.5px; }
}

/* ============================================================
   SVG icon helper (v1.4.0)
   ============================================================
   Generic inline-icon container. The JS-side svgIcon() helper drops the SVG
   in as innerHTML; CSS handles size + stroke color via currentColor so the
   same icon themes correctly in Dark / Light / Code.
   Per-icon size lives in the .icon-<name> rule, not in the SVG attributes,
   so a single SVG path can serve at multiple sizes if reused. */
.svg-icon { display: inline-flex; align-items: center; justify-content: center; line-height: 1; flex: none; }
.svg-icon svg { display: block; width: 100%; height: 100%; }
.svg-icon svg path,
.svg-icon svg circle {
  stroke: currentColor; stroke-width: 1.5; fill: none;
  stroke-linecap: round; stroke-linejoin: round;
}
.svg-icon.icon-download { width: 12px; height: 12px; }
.svg-icon.icon-chevron  { width: 10px; height: 10px; }
.svg-icon.icon-warning  { width: 13px; height: 13px; }
.svg-icon.icon-moon,
.svg-icon.icon-sun      { width: 14px; height: 14px; }
.svg-icon.icon-info     { width: 13px; height: 13px; }

/* Specific icon-slot overrides — sized to match the previous emoji visual weight */
.csv-btn .svg-icon.csv-icon { width: 12px; height: 12px; color: currentColor; }

/* Theme switcher icon slot */
.theme-toggle .theme-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 16px; height: 16px; color: var(--accent); flex: none;
}
.theme-toggle .theme-icon-text {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
  width: auto;
  letter-spacing: -0.5px;
}
.theme-toggle .svg-icon.theme-icon-svg { width: 14px; height: 14px; }

/* ============================================================
   Economic Calendar
   ============================================================ */
.calendar-panel { padding: 14px 16px 18px; }
.cal-filter-chips { margin: 4px 0 12px; }
.cal-filter-chips .cal-all {
  margin-left: 2px;
  color: var(--ink-faint);
  border-style: dashed;
}
.cal-filter-chips .cal-all:hover { color: var(--accent); border-color: var(--accent); }

.calendar-body { margin-top: 10px; }

/* ---- List view ---- */
.cal-list { display: flex; flex-direction: column; gap: 14px; }
.cal-list-group { display: grid; grid-template-columns: 76px 1fr; gap: 14px; align-items: start; }
.cal-list-date {
  display: flex; flex-direction: column; align-items: center;
  padding: 8px 6px; border-radius: var(--radius-sm);
  background: var(--surface-2);
  border: 1px solid var(--border);
  text-align: center;
}
.cal-list-date.past { opacity: 0.55; }
.cal-list-day { font-family: var(--mono); font-size: 20px; font-weight: 700; color: var(--ink); line-height: 1.1; }
.cal-list-month { font-size: 10.5px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; color: var(--ink-faint); margin-top: 2px; }
.cal-list-dow { font-size: 10.5px; color: var(--ink-faint); margin-top: 1px; }
.cal-list-rows { display: flex; flex-direction: column; gap: 6px; }
.cal-list-row {
  display: grid;
  /* v1.12.0 — grid columns are now: [time | name | type-badge | sens-badge | description].
     The standalone "Source" link was removed because the whole row is a link. */
  grid-template-columns: 60px minmax(160px, 1.3fr) auto auto 1fr;
  gap: 10px; align-items: baseline;
  padding: 8px 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.cal-list-row.past { opacity: 0.65; }
.cal-list-time { font-family: var(--mono); font-size: 11.5px; color: var(--ink-faint); }
.cal-list-name { font-size: 13px; color: var(--ink); font-weight: 500; }
.cal-list-desc { font-size: 12px; color: var(--ink-faint); line-height: 1.5; }
.cal-list-link {
  font-size: 11.5px; color: var(--ink-faint); white-space: nowrap;
  text-decoration: underline; text-decoration-color: var(--border-strong);
}
.cal-list-link:hover { color: var(--accent); text-decoration-color: var(--accent); }

.cal-badge {
  font-size: 9.5px; font-weight: 700; letter-spacing: 0.5px;
  text-transform: uppercase;
  padding: 2px 8px; border-radius: 999px;
  border: 1px solid currentColor;
  background: transparent;
  line-height: 1.4;
  white-space: nowrap;
}

.cal-past { margin-top: 18px; padding-top: 12px; border-top: 1px dashed var(--border); }
.cal-past summary {
  cursor: pointer;
  font-size: 12px; color: var(--ink-faint); font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.4px;
  padding: 4px 0 10px;
}
.cal-past summary:hover { color: var(--accent); }
.cal-past[open] summary { color: var(--ink-soft); }

/* v1.12.0 — Past-events section at the TOP of the calendar list.
   Items inside .cal-past-wrap are muted (use --ink-faint as base color).
   Past date boxes and rows inherit .past styling already defined above. */
.cal-past-wrap { margin-bottom: 12px; }
.cal-past-header {
  color: var(--ink-faint);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin: 0 0 10px;
  padding: 6px 10px;
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  border: 1px dashed var(--border);
  display: inline-block;
}
/* Separator divider between past + upcoming sections in list view. */
.cal-list-divider {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin: 14px 0;
  padding: 8px 10px;
  border-top: 2px solid var(--accent-soft);
  border-bottom: 2px solid var(--accent-soft);
  background: linear-gradient(180deg, transparent, var(--accent-area) 50%, transparent);
}
.cal-list-divider-side {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--ink-soft);
}
.cal-list-divider-mid {
  color: var(--ink-faint);
  font-size: 14px;
}

/* v1.12.0 — Clickable event rows.
   The list row itself is now an <a> wrapping the time / name / badges /
   description. We strip the default <a> styling and treat the whole row
   as a card-like clickable surface. */
.cal-list-row-link {
  text-decoration: none;
  color: inherit;
  cursor: pointer;
  transition: border-color .12s, background .12s;
}
.cal-list-row-link:hover {
  border-color: var(--accent);
  background: var(--surface);
}
.cal-list-row-link:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
/* Past rows: more muted than the existing .past treatment so the eye
   immediately reads them as historical. */
.cal-list-row.past {
  opacity: 0.55;
  background: var(--surface);
}
.cal-list-row.past .cal-list-name { color: var(--ink-faint); }
.cal-list-row.past:hover { opacity: 0.85; }

/* Market-sensitivity badge (1-5). Compact pill, fills like the type
   badge but with a sensitivity-tied color. The 5-tier ramp goes from
   muted (1) → cool (2) → yellow/amber tones (3, 4) → red (5). */
.cal-sens {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.4px;
  padding: 2px 7px;
  border-radius: 999px;
  line-height: 1.4;
  white-space: nowrap;
  min-width: 26px;
  border: 1px solid currentColor;
}
.cal-sens-5 { color: var(--red);                background: var(--red-soft); }
.cal-sens-4 { color: var(--amber);              background: rgba(251, 191, 36, 0.14); }
.cal-sens-3 { color: var(--amber);              background: rgba(251, 191, 36, 0.08); border-style: dashed; }
.cal-sens-2 { color: var(--ink-soft);           background: transparent; }
.cal-sens-1 { color: var(--ink-faint);          background: transparent; border-style: dashed; }

/* Sensitivity key — visible legend for the S1–S5 badge scale. */
.cal-sens-key {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 14px;
  margin: 10px 0 2px;
  font-size: 12px;
  color: var(--ink-soft);
}
.cal-sens-key-label { color: var(--ink-faint); }
.cal-sens-key-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  cursor: default;
}

/* Past-cell muting in grid view */
.cal-cell.past-cell { opacity: 0.55; }
.cal-cell.past-cell.has-events { opacity: 0.65; }
.cal-cell.past-cell .cal-cell-dot { opacity: 0.75; }
.cal-cell.past-cell:hover { opacity: 0.9; }

/* Popover item as clickable link (grid view detail). */
.cal-pop-item-link {
  text-decoration: none;
  color: inherit;
  cursor: pointer;
  transition: background .12s;
  display: grid;
  grid-template-columns: auto auto 60px 1fr;
  gap: 10px; align-items: baseline;
  padding: 6px 8px;
  padding-bottom: 8px;
  border-bottom: 1px dashed var(--border);
  border-radius: var(--radius-sm);
}
.cal-pop-item-link:hover { background: var(--surface-2); }
.cal-pop-item-link:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.cal-pop-item-link:last-child { border-bottom: 0; }

/* ---- Month grid view ---- */
.cal-grid-wrap { display: flex; flex-direction: column; gap: 10px; }
.cal-grid-nav { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.cal-grid-title {
  font-family: var(--mono); font-size: 14px; font-weight: 600;
  color: var(--ink); letter-spacing: -0.2px;
}
.cal-grid-dow {
  display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px;
  font-size: 10.5px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.5px; color: var(--ink-faint);
  padding: 0 2px;
}
.cal-grid-dow span { text-align: center; }
.cal-grid {
  display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px;
}
.cal-cell {
  min-height: 72px;
  padding: 6px 7px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  display: flex; flex-direction: column; gap: 4px;
  font-size: 12px;
}
.cal-cell.blank { background: transparent; border-color: transparent; }
.cal-cell-day { font-family: var(--mono); font-weight: 600; color: var(--ink-soft); font-size: 12px; }
.cal-cell.today { border-color: var(--accent); }
.cal-cell.today .cal-cell-day { color: var(--accent); }
.cal-cell.has-events { cursor: pointer; transition: border-color .12s; }
.cal-cell.has-events:hover { border-color: var(--accent); }
.cal-cell.has-events:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.cal-cell-dots { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.cal-cell-dot { width: 7px; height: 7px; border-radius: 50%; flex: none; }
.cal-cell-more { font-size: 10px; color: var(--ink-faint); font-family: var(--mono); }

.cal-legend { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 4px; }
.cal-legend-item { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--ink-faint); }
.cal-legend-dot { width: 9px; height: 9px; border-radius: 50%; }

.cal-grid-pop {
  margin-top: 10px; padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
}
.cal-grid-pop h3 { margin: 0 0 8px; font-size: 13px; color: var(--ink); font-weight: 600; }
.cal-pop-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.cal-pop-item {
  display: grid;
  /* v1.12.0 — grid columns now: [type-badge | sens-badge | time | name].
     Description still spans all columns via grid-column: 1 / -1 below. */
  grid-template-columns: auto auto 60px 1fr;
  gap: 10px; align-items: baseline;
  padding-bottom: 8px;
  border-bottom: 1px dashed var(--border);
}
.cal-pop-item:last-child { border-bottom: 0; padding-bottom: 0; }
.cal-pop-time { font-family: var(--mono); font-size: 11.5px; color: var(--ink-faint); }
.cal-pop-name { font-size: 13px; color: var(--ink); font-weight: 500; }
.cal-pop-desc { grid-column: 1 / -1; font-size: 12px; color: var(--ink-faint); margin-top: 2px; }

/* Mobile: list view dominates; month grid stays available but de-emphasized */
@media (max-width: 640px) {
  .cal-list-group { grid-template-columns: 60px 1fr; gap: 10px; }
  .cal-list-day { font-size: 17px; }
  .cal-list-row {
    grid-template-columns: 1fr;
    gap: 4px;
  }
  .cal-list-row .cal-list-link { justify-self: start; }
  .cal-list-row .cal-list-time { font-size: 11px; }
  .cal-cell { min-height: 56px; padding: 5px 5px; }
  .cal-grid-dow { font-size: 9.5px; }
}

/* ============================================================
   Explainer block (v1.9.0 — 4-tier)
   ============================================================
   Site-wide explainers — sits below the view header, above the panel.
   Inline always-visible: the beginner-tier headline. "Learn more" opens a
   panel with a 4-tab tier selector (Beginner / Intermediate / Advanced /
   Expert), default Beginner; each tab renders the headline + body for that
   tier. Sources block at the bottom. Uses existing theme variables; quiet,
   not marketing-y. */
.explainer {
  margin: 0 0 18px;
  padding: 12px 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}
.explainer-row {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  flex-wrap: wrap;
}
.explainer-row .svg-icon.explainer-icon {
  width: 14px; height: 14px;
  color: var(--accent);
  margin-top: 3px;
  flex: none;
}
.explainer-inline {
  margin: 0;
  flex: 1 1 320px;
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--ink-soft);
}
.explainer-more {
  background: transparent;
  border: 1px solid var(--border-strong);
  color: var(--ink-soft);
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: color .12s, border-color .12s, background .12s;
  flex: none;
  align-self: flex-start;
}
.explainer-more:hover {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--surface);
}
.explainer-more:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.explainer-more .svg-icon.explainer-chev {
  width: 9px; height: 9px;
  color: currentColor;
  transition: transform .15s ease;
}
.explainer-more.open .svg-icon.explainer-chev {
  transform: rotate(90deg);
}

/* Expanding panel — uses display swap (not grid-row-collapse) because the
   inner content has variable height and a transitioned grid here is jumpy. */
.explainer-panel {
  display: none;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px dashed var(--border);
}
.explainer-panel[data-expanded="true"] {
  display: block;
}

.explainer-section {
  margin: 0 0 14px;
}
.explainer-section:last-child { margin-bottom: 0; }

.explainer-h4 {
  font-size: 13px;
  font-weight: 700;
  margin: 0 0 8px;
  color: var(--ink);
  letter-spacing: -0.1px;
}
.explainer-h5 {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--ink-faint);
  margin: 0 0 6px;
}
/* Tier tabs (v1.9.0). Four buttons side-by-side; active gets the accent
   underline + ink color. Bodies are hidden by default and shown one at a
   time via the `.active` class swapped by the JS. */
.explainer-tabs {
  display: flex;
  gap: 0;
  margin: 0 0 12px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.explainer-tab {
  background: transparent;
  border: 0;
  border-bottom: 2px solid transparent;
  color: var(--ink-faint);
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  padding: 6px 12px;
  margin-bottom: -1px;
  cursor: pointer;
  transition: color .12s, border-color .12s;
}
.explainer-tab:hover { color: var(--ink); }
.explainer-tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}
.explainer-tab:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* v1.10.0 — bodies hold multi-paragraph deep-dives. Constrain max-height
   so very long Expert content scrolls inside the panel rather than pushing
   the page footer way down; widen max-width on desktop so paragraphs have
   a comfortable reading measure without becoming awkwardly narrow. */
.explainer-bodies {
  margin-bottom: 14px;
  max-height: 60vh;
  overflow-y: auto;
  padding-right: 6px;
}
.explainer-tier-body { display: none; }
.explainer-tier-body.active { display: block; }
.explainer-tier-head {
  margin: 0 0 10px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.5;
}
.explainer-tier-body-text {
  margin: 0 0 10px;
  font-size: 13px;
  color: var(--ink-soft);
  line-height: 1.65;
}
.explainer-tier-body-text:last-child {
  margin-bottom: 0;
}

.explainer-sources ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.explainer-sources li {
  font-size: 12px;
  color: var(--ink-faint);
}
.explainer-sources a {
  color: var(--ink-soft);
  text-decoration: underline;
  text-decoration-color: var(--border-strong);
}
.explainer-sources a:hover {
  color: var(--accent);
  text-decoration-color: var(--accent);
}

@media (max-width: 640px) {
  .explainer { padding: 10px 12px; margin-bottom: 14px; }
  .explainer-inline { font-size: 13px; }
  .explainer-more { padding: 4px 8px; font-size: 11.5px; }
  .explainer-bodies { max-height: 70vh; }
  .explainer-tier-body-text { font-size: 12.5px; line-height: 1.6; }
  .explainer-tab { padding: 5px 10px; font-size: 11.5px; }
}

/* Explainer → standalone guide link (v1.14.0) */
.explainer-guide-link { display: inline-block; font-size: 13px; color: var(--accent); text-decoration: none; margin: 0 0 10px; font-weight: 600; }
.explainer-guide-link:hover { text-decoration: underline; }

/* Master Chart group rows (v1.15.0) */
.master-groups { display: flex; flex-direction: column; gap: 8px; margin-bottom: 4px; }
.master-group { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.master-group-label { font-size: 11px; font-weight: 700; letter-spacing: 0.6px; text-transform: uppercase; color: var(--ink-faint); min-width: 128px; }

/* v1.16.0 — curve date picker, recession details, sensitivity filter */
.curve-date-input {
  font-family: var(--mono); font-size: 12.5px; color: var(--ink);
  background: var(--surface-2); border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm); padding: 3px 6px; cursor: pointer;
  color-scheme: dark;
}
:root[data-theme="light"] .curve-date-input { color-scheme: light; }
.curve-date-input:hover { border-color: var(--accent); }
.rec-detail { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border); }
.cal-sens-filter { background: transparent; border: 0; cursor: pointer; font: inherit; color: var(--ink-soft); padding: 2px 4px; border-radius: var(--radius-sm); }
.cal-sens-filter.off { opacity: 0.35; text-decoration: line-through; }
.cal-sens-filter:hover { background: var(--surface); }

/* Featured nav items (Master Chart, Economic Calendar) */
.nav-featured { font-weight: 700; color: var(--ink); }
.nav-featured::after { content: ""; }

/* Sidebar scrollbar: slim, themed, near-invisible until hovered so it
   blends with the nav instead of showing the OS default gutter. */
.sidebar, .sidebar-nav {
  scrollbar-width: thin;                      /* Firefox */
  scrollbar-color: transparent transparent;
}
.sidebar:hover, .sidebar-nav:hover {
  scrollbar-color: var(--border-strong) transparent;
}
.sidebar::-webkit-scrollbar, .sidebar-nav::-webkit-scrollbar { width: 6px; }
.sidebar::-webkit-scrollbar-track, .sidebar-nav::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb, .sidebar-nav::-webkit-scrollbar-thumb {
  background: transparent; border-radius: 999px;
}
.sidebar:hover::-webkit-scrollbar-thumb, .sidebar-nav:hover::-webkit-scrollbar-thumb {
  background: var(--border-strong);
}
.sidebar::-webkit-scrollbar-thumb:hover, .sidebar-nav::-webkit-scrollbar-thumb:hover {
  background: var(--ink-faint);
}

/* Mobile: grouped filter rows stack label-over-chips; each group's chip row
   swipes horizontally (v1.19.0) */
@media (max-width: 560px) {
  .master-group { flex-direction: column; align-items: stretch; gap: 4px; }
  .master-group-label { min-width: 0; }
}

/* Mortgage sub-page tab bar (v1.23.0) */
.mtg-subnav { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 14px; }
.mtg-subnav-item {
  font-size: 13px; font-weight: 600; padding: 6px 13px; border-radius: 999px;
  border: 1px solid var(--border-strong); color: var(--ink-soft);
  text-decoration: none; white-space: nowrap; background: var(--surface-2);
}
a.mtg-subnav-item:hover { color: var(--ink); border-color: var(--accent); }
.mtg-subnav-item.active { background: var(--accent-soft); color: var(--accent); border-color: var(--accent); }
