:root {
  color-scheme: light;
  --bg: #f6f5f2;
  --surface-1: #fcfcfb;
  --surface-2: #f0efeb;
  --border: #e2e0da;
  --text-primary: #0b0b0b;
  --text-secondary: #52514e;
  --text-muted: #85837d;
  --grid: #e8e6e0;
  --accent: #2a78d6;
  --series-1: #2a78d6;   /* regular / interim / final */
  --series-2: #eb6834;   /* special */
  --series-3: #1baf7a;   /* variable */
  --forecast: #c2378a;   /* projected dividends: same step in dark mode (checked against both surfaces) */
  --critical: #c62828;
  --warning: #b26a00;
  --good: #2e7d32;
  --info: #52514e;
  --mono: ui-monospace, "Cascadia Mono", Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #121211; --surface-1: #1a1a19; --surface-2: #232321; --border: #33332f;
    --text-primary: #f0efec; --text-secondary: #c3c2b7; --text-muted: #8d8c84; --grid: #2b2b28;
    --accent: #3987e5; --series-1: #3987e5; --series-2: #d95926; --series-3: #199e70;
    --critical: #ef5350; --warning: #e0a030; --good: #66bb6a; --info: #c3c2b7;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #121211; --surface-1: #1a1a19; --surface-2: #232321; --border: #33332f;
  --text-primary: #f0efec; --text-secondary: #c3c2b7; --text-muted: #8d8c84; --grid: #2b2b28;
  --accent: #3987e5; --series-1: #3987e5; --series-2: #d95926; --series-3: #199e70;
  --critical: #ef5350; --warning: #e0a030; --good: #66bb6a; --info: #c3c2b7;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text-primary);
  font: 14px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
header.top { display: flex; align-items: center; gap: 24px; padding: 12px 24px;
  border-bottom: 1px solid var(--border); background: var(--surface-1); position: sticky; top: 0; z-index: 5; }
header.top .brand { font-weight: 700; font-size: 17px; letter-spacing: .02em; color: var(--text-primary); }
header.top .brand span { color: var(--text-muted); font-weight: 400; font-size: 13px; margin-left: 8px; }
header.top nav { display: flex; gap: 16px; }
header.top nav a { color: var(--text-secondary); }
header.top nav a.on { color: var(--text-primary); font-weight: 600; }
main { max-width: 1280px; margin: 0 auto; padding: 20px 24px 60px; }
h1 { font-size: 22px; margin: 4px 0 4px; }
h2 { font-size: 16px; margin: 28px 0 10px; }
h3 { font-size: 14px; margin: 16px 0 6px; }
.sub { color: var(--text-secondary); margin: 0 0 16px; max-width: 900px; }
.muted { color: var(--text-muted); }
.mono { font-family: var(--mono); font-size: 12.5px; }
.card { background: var(--surface-1); border: 1px solid var(--border); border-radius: 8px; padding: 14px 16px; }
.grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.tiles { display: flex; gap: 12px; flex-wrap: wrap; margin: 8px 0 4px; }
.tile { background: var(--surface-1); border: 1px solid var(--border); border-radius: 8px; padding: 10px 14px; min-width: 130px; }
.tile .v { font-size: 22px; font-weight: 650; }
.tile .k { color: var(--text-secondary); font-size: 12px; }
.co { display: block; color: inherit; }
.co:hover { border-color: var(--accent); text-decoration: none; }
.co .t { font-weight: 700; font-family: var(--mono); }
.co .n { color: var(--text-secondary); margin-left: 6px; }
.co .lf { color: var(--text-secondary); font-size: 12.5px; margin: 6px 0; min-height: 36px; }
.badges { display: flex; gap: 6px; flex-wrap: wrap; }
.badge { font-size: 11.5px; padding: 1px 7px; border-radius: 10px; border: 1px solid var(--border); color: var(--text-secondary); white-space: nowrap; }
.badge.special { border-color: var(--series-2); }
.badge.crit { border-color: var(--critical); color: var(--critical); }
.badge.warn { border-color: var(--warning); color: var(--warning); }
.badge.good { border-color: var(--good); color: var(--good); }
.pill { display: inline-block; font-size: 11.5px; padding: 0 7px; border-radius: 9px; background: var(--surface-2); color: var(--text-secondary); }
.pill.cancelled, .pill.suspended { background: transparent; border: 1px solid var(--critical); color: var(--critical); }
.pill.forecast, .pill.proposed { border: 1px dashed var(--text-muted); background: transparent; }
.pill.declared { border: 1px solid var(--accent); color: var(--text-primary); background: transparent; }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 5px; vertical-align: 0; }
table { border-collapse: collapse; width: 100%; font-size: 13px; }
th, td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--border); vertical-align: top; }
th { color: var(--text-secondary); font-weight: 600; font-size: 12px; background: var(--surface-2); position: sticky; top: 0; }
tr.ev { cursor: pointer; }
tr.ev:hover td, tr.ev.sel td { background: var(--surface-2); }
td.num { text-align: right; font-variant-numeric: tabular-nums; font-family: var(--mono); }
.derived { color: var(--text-muted); font-style: italic; }
.controls { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 10px 0; }
.controls input[type=range] { flex: 1; min-width: 240px; accent-color: var(--accent); }
.controls .asof { font-family: var(--mono); font-weight: 600; min-width: 220px; }
button { font: inherit; padding: 4px 12px; border-radius: 6px; border: 1px solid var(--border); background: var(--surface-1); color: var(--text-primary); cursor: pointer; }
button:hover { border-color: var(--accent); }
button.primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.chart { width: 100%; background: var(--surface-1); border: 1px solid var(--border); border-radius: 8px; position: relative; }
.chart svg { display: block; width: 100%; }
.chart text { fill: var(--text-secondary); font-size: 11px; }
.legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 12px; color: var(--text-secondary); margin: 6px 2px; }
.legend span { display: inline-flex; align-items: center; gap: 5px; }
.tip { position: absolute; pointer-events: none; background: var(--surface-1); border: 1px solid var(--border);
  border-radius: 6px; padding: 7px 10px; font-size: 12px; box-shadow: 0 4px 14px rgba(0,0,0,.15); max-width: 340px; display: none; z-index: 4; }
.tip b { color: var(--text-primary); }
.two { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 16px; align-items: start; }
@media (max-width: 960px) { .two { grid-template-columns: minmax(0, 1fr); } }   /* minmax: a wide table scrolls in its box, not the page */
.versions { list-style: none; padding: 0; margin: 0; border-left: 2px solid var(--border); }
.versions li { position: relative; padding: 0 0 12px 16px; }
.versions li::before { content: ""; position: absolute; left: -6px; top: 5px; width: 10px; height: 10px; border-radius: 50%;
  background: var(--surface-1); border: 2px solid var(--accent); }
.versions li.cancelled::before, .versions li.suspended::before { border-color: var(--critical); background: var(--critical); }
.versions li.amended::before { border-color: var(--warning); }
.versions .when { font-family: var(--mono); font-size: 12px; color: var(--text-secondary); }
.quote { font-size: 12.5px; color: var(--text-secondary); border-left: 3px solid var(--border); padding: 2px 8px; margin: 4px 0; }
.check { font-size: 12.5px; margin: 3px 0; }
.check .r { font-weight: 600; margin-right: 6px; }
.r.pass { color: var(--good); } .r.fail { color: var(--critical); } .r.warn { color: var(--warning); } .r.info { color: var(--info); }
.flow { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.flow .step { background: var(--surface-2); border-radius: 4px; padding: 1px 7px; font-size: 12px; }
.flow .arr { color: var(--text-muted); }
.note { font-size: 12.5px; color: var(--text-secondary); background: var(--surface-2); border-radius: 6px; padding: 8px 12px; }
.stmt { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 760px) { .stmt { grid-template-columns: 1fr; } header.top { flex-wrap: wrap; gap: 8px 16px; padding: 10px 16px; }
  header.top nav { flex-wrap: wrap; gap: 6px 14px; min-width: 0; } main { padding: 16px; } }
.scroll { max-height: 560px; overflow: auto; border: 1px solid var(--border); border-radius: 8px; }
#events td { white-space: nowrap; }   /* "2027-03-31" never breaks at the hyphen on a phone; the table scrolls instead */
.caltab td { padding: 4px; height: 52px; }
.caltab th { text-align: center; }
.chip { font-size: 11.5px; line-height: 1.3; background: var(--surface-2); border: 1px solid var(--border); border-left: 4px solid var(--series-1);
  border-radius: 4px; padding: 3px 5px; margin: 2px 0; cursor: pointer; font-variant-numeric: tabular-nums; }
.chip:hover, .chip.sel { border-color: var(--accent); }
.chip .d { color: var(--text-muted); font-size: 10.5px; }
.chip .k { color: var(--text-secondary); font-size: 10.5px; }
.chip.nopay { border-style: dashed; border-left-style: solid; }
.chip.cancelled b { text-decoration: line-through; color: var(--critical); }
.chip.forecast, .chip.proposed { background: transparent; border-style: dashed; }
.chip.pol { border-left-color: var(--critical); color: var(--critical); background: transparent; }
footer { color: var(--text-muted); font-size: 12px; margin-top: 40px; border-top: 1px solid var(--border); padding-top: 12px; }
