:root {
  --bg: #ffffff;
  --fg: #101828;
  --muted: #5d6b82;
  --line: #e4e7ec;
  --card: #f6f8fb;
  --accent: #1d4ed8;
  --c1: #1d4ed8;
  --c2: #c2410c;
  --c3: #7c3aed;
  --c4: #0f766e;
  --band: rgba(15, 118, 110, 0.13);
  --fan: rgba(124, 58, 237, 0.16);
  --grid: rgba(16, 24, 40, 0.08);
  --space-section: 44px;
  /* BCB operation types. Sales above zero: strong tones; purchases, buybacks, reverse swaps: light tones of the same hue.
     Rollovers: a quiet neutral grey. No red or green. */
  --t-roll: #b8bfca;
  --t-unc: #64748b;
  --t-swap: #1d4ed8;
  --t-rev: #93b4f5;
  --t-spot: #c2410c;
  --t-spotb: #f3b48f;
  --t-repo: #7c3aed;
  --t-repob: #c9b3f7;
  --t-loan: #a16207;
  --t-fwd: #e5c77a;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1115;
    --fg: #e6e9ef;
    --muted: #98a2b3;
    --line: #262b36;
    --card: #171b23;
    --accent: #7aa2ff;
    --c1: #7aa2ff;
    --c2: #fbbf24;
    --c3: #c4b5fd;
    --c4: #5eead4;
    --band: rgba(94, 234, 212, 0.14);
    --fan: rgba(167, 139, 250, 0.24);
    --grid: rgba(230, 233, 239, 0.09);
    --t-roll: #4b5263;
    --t-unc: #8b95a7;
    --t-swap: #7aa2ff;
    --t-rev: #3b5aa8;
    --t-spot: #fb923c;
    --t-spotb: #8a4a24;
    --t-repo: #a78bfa;
    --t-repob: #5b4691;
    --t-loan: #eab308;
    --t-fwd: #7c6a2e;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-variant-numeric: tabular-nums;
}
a { color: var(--accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.wrap { max-width: 980px; margin: 0 auto; padding: 0 16px 48px; }

/* ---- top bar and tabs ---- */
.bar {
  display: flex; flex-wrap: wrap; align-items: center; column-gap: 20px;
  border-bottom: 1px solid var(--line);
}
.brand { font-weight: 700; color: var(--fg); text-decoration: none; letter-spacing: -0.01em; padding: 12px 0; }
.tabs { display: flex; gap: 4px; }
.tab {
  display: inline-flex; align-items: center; min-height: 48px; padding: 0 10px;
  color: var(--muted); text-decoration: none; font-size: 15px; font-weight: 500;
  border-bottom: 3px solid transparent; margin-bottom: -1px;
}
.tab:hover { color: var(--fg); }
.tab[aria-current="page"] { color: var(--fg); font-weight: 600; border-bottom-color: var(--accent); }
.lang { margin-left: auto; font-size: 14px; padding: 12px 0; }
@media (max-width: 559px) {
  /* Row 1: wordmark and language. Row 2: the tabs, full width. */
  .tabs { order: 3; width: 100%; }
  .tab { flex: 1; justify-content: center; min-height: 44px; }
}

/* ---- type and spacing ---- */
h1 { font-size: 1.5rem; line-height: 1.25; margin: 24px 0 16px; letter-spacing: -0.01em; }
h2 { font-size: 1.15rem; margin: 0 0 10px; }
h3 { font-size: 0.95rem; margin: 24px 0 8px; color: var(--muted); font-weight: 600; }
section { padding-top: var(--space-section); }
section.top { padding-top: 0; }
.note { font-size: 13px; color: var(--muted); margin: 8px 0 0; max-width: 72ch; }
.lead { color: var(--muted); margin: -6px 0 6px; max-width: 72ch; }
.runline { font-size: 14px; margin: 0; }
.unavailable { color: var(--muted); background: var(--card); border-radius: 8px; padding: 14px; margin: 6px 0; }
.loading { color: var(--muted); font-size: 13px; margin: 0; padding-top: 12px; }

/* ---- header cards ---- */
.quotes { display: grid; grid-template-columns: 1fr; gap: 12px; }
.quote, .card { background: var(--card); border-radius: 10px; padding: 14px 16px; }
.quote .label, .card .label { font-size: 14px; color: var(--muted); }
.quote .value { font-size: 2.25rem; font-weight: 700; line-height: 1.15; letter-spacing: -0.02em; }
.quote .meta, .card .meta { font-size: 13px; color: var(--muted); }
.tag { display: inline-block; font-size: 11px; border: 1px solid var(--line); border-radius: 4px; padding: 0 5px; margin-left: 2px; }
.changes { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 12px 0 0; padding-top: 10px; border-top: 1px solid var(--line); }
.chg { margin: 0; min-width: 0; }
.chg dt { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chg dd { margin: 0; font-size: 1.1rem; font-weight: 700; }
.chg dd.since { font-size: 12px; font-weight: 400; color: var(--muted); white-space: nowrap; }

/* ---- facts ---- */
.facts { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.facts li { background: var(--card); border-radius: 8px; padding: 12px 14px; }
.facts b { font-weight: 700; }

/* ---- range and horizon buttons ---- */
.ranges { display: flex; gap: 6px; margin: 0 0 10px; flex-wrap: wrap; }
.ranges button {
  font: inherit; font-size: 13px; min-height: 32px; min-width: 44px; padding: 4px 10px; border-radius: 6px; cursor: pointer;
  background: var(--card); color: var(--fg); border: 1px solid var(--line);
}
.ranges button:hover { border-color: var(--muted); }
.ranges button[aria-pressed="true"] { background: var(--fg); color: var(--bg); border-color: var(--fg); }
@media (pointer: coarse) {
  .ranges button { min-height: 44px; min-width: 48px; font-size: 14px; }
}

/* ---- charts and legends ---- */
.chart { margin: 0; }
.panel + .panel { margin-top: 6px; }
.plot { height: var(--h, 300px); width: 100%; position: relative; }
.lg { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 14px; font-size: 13px; min-height: 22px; margin-bottom: 4px; }
.lg-h { color: var(--muted); font-weight: 600; }
.lg-i { white-space: nowrap; }
.lg-i b { font-weight: 600; }
.lg-i small, .lg-r { color: var(--muted); font-size: 12px; font-weight: 400; }
.sw { display: inline-block; width: 12px; height: 3px; border-radius: 2px; background: var(--sw); vertical-align: middle; margin-right: 5px; }
.sw.dash { background: repeating-linear-gradient(90deg, var(--sw) 0 4px, transparent 4px 7px); }
.sw.dot { width: 8px; height: 8px; border-radius: 50%; }
.uplot, .uplot * { font-family: inherit; }

/* ---- focus card and AI summary ---- */
.split { display: grid; gap: 24px; }
@media (min-width: 760px) { .split { grid-template-columns: minmax(0, 1fr) minmax(0, 340px); align-items: start; } }
.ai h2 { font-size: 1rem; }
.ai dl { margin: 10px 0; }
.ai-row { display: flex; justify-content: space-between; gap: 12px; padding: 4px 0; }
.ai-row dt { color: var(--muted); }
.ai-row dd { margin: 0; text-align: right; }
.ai-row small { color: var(--muted); }
.ai p { margin: 6px 0 0; }

/* ---- tables ---- */
table { border-collapse: collapse; width: 100%; font-size: 14px; }
th, td { text-align: right; padding: 6px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
th:first-child { text-align: left; }
th small, td small { display: block; font-size: 11px; color: var(--muted); font-weight: 400; }
table.focus { max-width: 520px; }

/* ---- footer ---- */
footer { margin-top: var(--space-section); border-top: 1px solid var(--line); padding-top: 20px; font-size: 14px; }
footer h2 { font-size: 1rem; }
.sources { padding-left: 18px; margin: 0 0 12px; }
.sources li { margin: 3px 0; }
.asof { color: var(--muted); font-size: 13px; }
.advice { color: var(--muted); }

/* ---- prediction page ---- */
.cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 12px; }
@media (min-width: 760px) { .cards { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.cons-card { border-top: 3px solid transparent; }
.cons-card.sel { border-top-color: var(--accent); }
.cons-card .value { font-size: 1.6rem; font-weight: 700; line-height: 1.2; letter-spacing: -0.01em; }

.cmp-key { display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: 13px; color: var(--muted); margin: 8px 0; }
.cmp-key i { display: inline-block; vertical-align: middle; margin-right: 6px; }
.cmp-rows { list-style: none; margin: 0; padding: 0; }
.cmp-rows.baselines { margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--line); }
.cmp-row, .cmp-axis { display: grid; grid-template-columns: minmax(0, 1fr) 4.6em; align-items: end; column-gap: 8px; }
.cmp-name { grid-column: 1 / -1; font-size: 12px; line-height: 1.2; color: var(--fg); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding-top: 4px; }
.k-baseline .cmp-name { color: var(--muted); }
.cmp-track { position: relative; height: 16px; overflow: hidden; }
.cmp-val { font-size: 12px; text-align: right; color: var(--muted); line-height: 16px; }
.cmp-axis .cmp-name { display: none; }
.cmp-axis .cmp-track { height: 18px; overflow: visible; }
.cmp-tick { position: absolute; transform: translateX(-50%); font-size: 11px; color: var(--muted); white-space: nowrap; }
.cmp-range { position: absolute; top: 7px; height: 2px; background: var(--c1); opacity: 0.55; border-radius: 1px; }
.cmp-dot { position: absolute; top: 3px; width: 10px; height: 10px; margin-left: -5px; border-radius: 50%; background: var(--c1); }
.k-decision .cmp-dot { border-radius: 1px; transform: rotate(45deg) scale(0.9); background: var(--c3); }
.k-decision .cmp-range { background: var(--c3); }
.k-baseline .cmp-dot { background: var(--bg); border: 2px solid var(--muted); }
.cmp-ref { position: absolute; top: 0; bottom: 0; width: 0; border-left: 2px solid var(--fg); opacity: 0.85; }
.cmp-ref.ptax { border-left: 1px dashed var(--muted); opacity: 1; }
i.ref { width: 14px; height: 0; border-top: 2px solid var(--fg); }
i.ref.ptax { border-top: 1px dashed var(--muted); }
i.mk { width: 9px; height: 9px; border-radius: 50%; background: var(--c1); }
i.mk.k-decision { border-radius: 1px; transform: rotate(45deg); background: var(--c3); }
i.mk.k-baseline { background: var(--bg); border: 2px solid var(--muted); }
@media (min-width: 640px) {
  .cmp-row, .cmp-axis { grid-template-columns: 210px minmax(0, 1fr) 4.6em; align-items: center; }
  .cmp-name { grid-column: auto; font-size: 13px; padding-top: 0; }
  .cmp-axis .cmp-name { display: block; }
  .cmp-track { height: 22px; }
  .cmp-range { top: 10px; }
  .cmp-dot { top: 6px; }
  .cmp-val { line-height: 22px; }
}

.empty { background: var(--card); border-radius: 10px; padding: 20px 18px; color: var(--muted); }
.empty p { margin: 0; max-width: 60ch; }

details.all { margin-top: var(--space-section); }
details.all > summary {
  cursor: pointer; font-weight: 600; font-size: 1.05rem; padding: 12px 14px; background: var(--card); border-radius: 8px;
  min-height: 44px;
}
details.all[open] > summary { margin-bottom: 10px; }
.narrow-only { display: none; }
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 12px 0; }
table.pred .model { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; overflow-wrap: anywhere; }
table.pred td.status { white-space: nowrap; }
table.pred td small { white-space: nowrap; }
table.pred tbody tr:not(.st-ok) { color: var(--muted); }
table.pred tr.consensus { background: var(--card); font-weight: 600; }
table.pred tr.sep th { text-align: left; padding-top: 16px; font-size: 13px; color: var(--muted); }
@media (max-width: 699px) {
  /* One horizon at a time on a narrow screen; the control above the table selects it. */
  .narrow-only { display: block; }
  table.pred:not([data-h="d30"]) .h-d30,
  table.pred:not([data-h="m6"]) .h-m6,
  table.pred:not([data-h="y1"]) .h-y1,
  table.pred:not([data-h="y5"]) .h-y5 { display: none; }
  table.pred tr.sep th { white-space: nowrap; }
}

@media (min-width: 640px) {
  .quotes { grid-template-columns: 1fr 1fr; }
  h1 { font-size: 1.8rem; }
}
@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; transition: none !important; }
}
.cons-card .range span { display: block; font-size: 11px; }

/* ---- tabs: short labels on a narrow screen ---- */
.t-short { display: none; }
@media (max-width: 559px) {
  .tab .t-short { display: inline; }
  .tab .t-long { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .tab { padding: 0 6px; }
}

/* ---- BCB tab ---- */
.bcb-cards { grid-template-columns: repeat(1, minmax(0, 1fr)); }
@media (min-width: 560px) { .bcb-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 900px) { .bcb-cards { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.card .value { font-size: 1.5rem; font-weight: 700; line-height: 1.2; letter-spacing: -0.01em; }
.card p.meta { margin: 6px 0 0; }
.types { list-style: none; margin: 6px 0 0; padding: 0; font-size: 13px; color: var(--muted); }
.types li { margin: 2px 0; }
.bcb-card h2 { margin-bottom: 2px; }
.kv { margin: 10px 0 4px; display: grid; gap: 4px 24px; grid-template-columns: 1fr; }
@media (min-width: 640px) { .kv { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.kv-row { display: flex; justify-content: space-between; gap: 12px; padding: 4px 0; }
.kv-row dt { color: var(--muted); }
.kv-row dd { margin: 0; text-align: right; }
.kv-row small { color: var(--muted); font-size: 12px; margin-left: 4px; }
.mat { list-style: none; margin: 8px 0 0; padding: 0; }
.mat-row { display: grid; grid-template-columns: 7.5em minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 4px 0; font-size: 14px; }
.mat-track { position: relative; height: 14px; }
.mat-bar, .mat-rolled { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 2px; }
.mat-bar { background: var(--t-swap); }
.mat-rolled { background: var(--t-roll); }
.mat-val { text-align: right; white-space: nowrap; }
.mat-val small { display: block; color: var(--muted); font-size: 12px; }
@media (max-width: 559px) { .mat-row { grid-template-columns: 6.5em minmax(0, 1fr); } .mat-val { grid-column: 1 / -1; text-align: left; } }
table.auctions td, table.auctions th { white-space: nowrap; }
table.auctions th[scope="row"] { font-weight: 500; }
@media (max-width: 559px) { .lg-i { white-space: normal; } }
/* Scroll shadows: a cue that a wide table has more columns. */
.table-scroll {
  background:
    linear-gradient(to right, var(--bg) 30%, transparent) left / 24px 100% no-repeat local,
    linear-gradient(to left, var(--bg) 30%, transparent) right / 24px 100% no-repeat local,
    radial-gradient(farthest-side at 0 50%, rgba(16, 24, 40, 0.18), transparent) left / 12px 100% no-repeat scroll,
    radial-gradient(farthest-side at 100% 50%, rgba(16, 24, 40, 0.18), transparent) right / 12px 100% no-repeat scroll;
}
