/* SA Economic Pulse - styles. Palette = the validated dataviz reference palette (8 categorical
   slots, light + dark stepped separately). Chart furniture stays recessive; text never wears
   a series colour. */
:root {
  color-scheme: light;
  --page: #FFF1E0;
  --surface-1: #FFF9F5;
  --ink: #1A1A1A;
  --ink-2: #5B4A3F;
  --muted: #8C7A6B;
  --grid: #F0DFC9;
  --axis: #D9C3A5;
  --border: rgba(26,26,26,0.10);
  --accent: #2a78d6;
  --wash: rgba(42,120,214,0.08);
  --c1: #2a78d6; --c2: #eb6834; --c3: #1baf7a; --c4: #eda100;
  --c5: #e87ba4; --c6: #008300; --c7: #4a3aa7; --c8: #e34948;
  --up: var(--c1); --down: var(--c8);
  --r: 10px; --r-s: 9px; --head-font: Georgia, "Times New Roman", "Noto Serif", serif;
  --shadow: 0 6px 24px rgba(40,20,0,0.16);
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #0d0d0d; --surface-1: #1a1a19; --ink: #ffffff; --ink-2: #c3c2b7; --muted: #898781;
  --grid: #2c2c2a; --axis: #383835; --border: rgba(255,255,255,0.10);
  --accent: #3987e5; --wash: rgba(57,135,229,0.14);
  --c1: #3987e5; --c2: #d95926; --c3: #199e70; --c4: #c98500;
  --c5: #d55181; --c6: #008300; --c7: #9085e9; --c8: #e66767;
  --shadow: 0 6px 24px rgba(0,0,0,0.6);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --page: #0d0d0d; --surface-1: #1a1a19; --ink: #ffffff; --ink-2: #c3c2b7; --muted: #898781;
    --grid: #2c2c2a; --axis: #383835; --border: rgba(255,255,255,0.10);
    --accent: #3987e5; --wash: rgba(57,135,229,0.14);
    --c1: #3987e5; --c2: #d95926; --c3: #199e70; --c4: #c98500;
    --c5: #d55181; --c6: #008300; --c7: #9085e9; --c8: #e66767;
    --shadow: 0 6px 24px rgba(0,0,0,0.6);
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { background: var(--page); color: var(--ink); font: 13.5px/1.4 system-ui, -apple-system, "Segoe UI", sans-serif; }
a { color: var(--accent); }
.serif, h1, h2, h3 { font-family: var(--head-font); }
[hidden] { display: none !important; }

/* ---------- header / nav ---------- */
header.app { position: sticky; top: 0; z-index: 50; background: var(--page); border-bottom: 1px solid var(--grid); padding: 9px 20px 0; }
.hdr-row { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.hdr-title { font-family: var(--head-font); font-size: 17px; font-weight: 700; letter-spacing: -0.01em; }
.hdr-sub { color: var(--muted); font-size: 12px; }
.spacer { flex: 1; }
nav.tabs { display: flex; gap: 3px; margin-top: 8px; overflow-x: auto; }
nav.tabs a { display: inline-flex; align-items: center; gap: 7px; text-decoration: none; border-bottom: 3px solid transparent; border-radius: 9px 9px 0 0; color: var(--ink-2); padding: 10px 15px 8px; font-size: 14px; font-weight: 600; white-space: nowrap; }
nav.tabs a svg.tabic { flex: none; opacity: .75; }
nav.tabs a:hover { color: var(--ink); background: var(--surface-1); }
nav.tabs a:hover svg.tabic { opacity: 1; }
nav.tabs a.active { color: var(--ink); background: var(--surface-1); border-bottom-color: var(--accent); box-shadow: inset 0 1px 0 var(--border), inset 1px 0 0 var(--border), inset -1px 0 0 var(--border); }
nav.tabs a.active svg.tabic { color: var(--accent); opacity: 1; }
main { padding: 14px 20px 56px; max-width: 1500px; margin: 0 auto; }

/* ---------- controls ---------- */
select, input[type="text"], input[type="search"], input[type="number"] {
  background: var(--surface-1); color: var(--ink); border: 1px solid var(--axis); border-radius: 6px;
  padding: 5px 8px; font: inherit; font-size: 13px; max-width: 100%;
}
input:focus-visible, select:focus-visible, button:focus-visible, [tabindex]:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
button { background: var(--surface-1); color: var(--ink); border: 1px solid var(--axis); border-radius: 6px; padding: 5px 11px; font: inherit; font-size: 13px; cursor: pointer; }
button:hover { border-color: var(--muted); }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
button.small { padding: 2px 8px; font-size: 12px; }
button.ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
button.ghost:hover { color: var(--ink); background: var(--wash); }
button:disabled { opacity: .45; cursor: default; }
.seg { display: inline-flex; max-width: 100%; border: 1px solid var(--axis); border-radius: 6px; overflow-x: auto; scrollbar-width: none; background: var(--surface-1); }
.seg button { border: none; border-radius: 0; background: transparent; white-space: nowrap; flex: none; padding: 4px 10px; font-size: 12.5px; color: var(--ink-2); }
.seg button + button { border-left: 1px solid var(--axis); }
.seg button.on { background: var(--accent); color: #fff; }
.seg button:hover:not(.on) { background: var(--wash); }

.filters { display: flex; gap: 8px 12px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.filters .grow { flex: 1 1 260px; min-width: 200px; }
.filters .grow input { width: 100%; }
.filters label.lbl { color: var(--ink-2); font-size: 12px; margin-right: 4px; }
.count { color: var(--muted); font-size: 12px; margin-left: auto; }

.ms { position: relative; display: inline-block; }
.ms > button { display: inline-flex; gap: 6px; align-items: center; }
.ms > button .n { background: var(--accent); color: #fff; border-radius: 9px; font-size: 11px; padding: 0 6px; }
.pop { position: absolute; z-index: 60; top: calc(100% + 4px); left: 0; min-width: 240px; max-height: 340px; overflow: auto; background: var(--surface-1); border: 1px solid var(--axis); border-radius: 8px; box-shadow: var(--shadow); padding: 6px; }
.pop label { display: flex; gap: 8px; align-items: baseline; padding: 4px 6px; border-radius: 5px; cursor: pointer; }
.pop label:hover { background: var(--wash); }
.pop label .c { margin-left: auto; color: var(--muted); font-variant-numeric: tabular-nums; font-size: 12px; }
.pop label.zero { opacity: .45; }
.pop .foot { border-top: 1px solid var(--grid); margin-top: 4px; padding-top: 4px; display: flex; gap: 6px; }

/* ---------- cards / layout ---------- */
.card { background: var(--surface-1); border: 1px solid var(--border); border-radius: var(--r); padding: 12px 14px; min-width: 0; }
.card h3 { margin: 0 0 2px; font-size: 14px; font-weight: 650; }
.card .sub { color: var(--muted); font-size: 12px; margin-bottom: 8px; }
.card-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.card-head .tools { margin-left: auto; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.explorer { display: grid; grid-template-columns: var(--exl, minmax(360px, 0.8fr)) 14px minmax(0, 1.5fr); gap: 0; align-items: start; }
.explorer .listcard { grid-column: 1; min-width: 0; }
.explorer .exsplit { grid-column: 2; }
.explorer .chartcol { grid-column: 3; position: sticky; top: 96px; max-height: calc(100vh - 108px); overflow: auto; }
.exsplit { align-self: stretch; cursor: col-resize; position: relative; min-height: 120px; touch-action: none; outline: none; }
.exsplit::after { content: ''; position: absolute; left: 6px; top: 10px; bottom: 10px; width: 2px; border-radius: 2px; background: var(--grid); transition: background .15s; }
.exsplit:hover::after, .exsplit.drag::after, .exsplit:focus-visible::after { background: var(--accent); }
.explorer.folded { grid-template-columns: 0 0 minmax(0, 1fr); }
.explorer.folded .listcard { display: none; }
.explorer.folded .exsplit { pointer-events: none; }
.explorer.folded .exsplit::after { display: none; }
.explorer.folded .chartcol { position: static; max-height: none; }
@media (max-width: 1050px) {
  .explorer, .explorer.folded { grid-template-columns: 1fr; }
  .explorer .listcard, .explorer.folded .listcard { display: block; grid-column: 1; }
  .exsplit, .foldbtn { display: none; }
  .explorer .chartcol, .explorer.folded .chartcol { grid-column: 1; grid-row: 1; position: static; max-height: none; }
  .explorer .listcard { grid-row: 2; margin-top: 12px; }
}
.empty { color: var(--muted); padding: 22px 8px; text-align: center; }

/* ---------- tables ---------- */
.tablewrap { overflow: auto; max-height: 68vh; }
table.data { border-collapse: collapse; width: 100%; font-size: 13px; }
table.data th, table.data td { padding: 5px 7px; text-align: right; font-variant-numeric: tabular-nums; vertical-align: middle; }
table.data th { position: sticky; top: 0; background: var(--surface-1); color: var(--ink-2); font-weight: 600; font-size: 12px; border-bottom: 1px solid var(--axis); white-space: nowrap; cursor: pointer; user-select: none; z-index: 2; }
table.data th.nosort { cursor: default; }
table.data th .arr { color: var(--accent); margin-left: 3px; }
table.data td.l, table.data th.l { text-align: left; }
table.data tbody tr { border-bottom: 1px solid var(--grid); }
table.data tbody tr.row { cursor: pointer; }
table.data tbody tr.row:hover { background: var(--wash); }
table.data tbody tr.sel { background: var(--wash); }
table.data td.lab { max-width: 340px; text-align: left; }
table.data td.lab .t { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
table.data td .sm { color: var(--muted); font-size: 11.5px; }
table.data td.lab .sm { display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; }
table.data td { white-space: nowrap; }
table.data td.lab { white-space: normal; min-width: 180px; }
.chk { width: 15px; height: 15px; border: 1.5px solid var(--axis); border-radius: 4px; display: inline-block; vertical-align: middle; position: relative; }
tr.sel .chk { border-color: transparent; }
.chk i { position: absolute; inset: -1px; border-radius: 4px; }
.badge { display: inline-block; font-size: 11px; padding: 0 6px; border-radius: 9px; border: 1px solid var(--axis); color: var(--ink-2); white-space: nowrap; }
.badge.sa { border-color: var(--accent); color: var(--accent); }
.badge.trend { border-style: dashed; }
.code { font-variant-numeric: tabular-nums; font-size: 11.5px; color: var(--ink-2); background: var(--wash); border-radius: 4px; padding: 0 5px; white-space: nowrap; }
.moreRow { text-align: center; padding: 8px; }
@media (max-width: 700px) { table.data .hide-s { display: none; } }

/* ---------- chart ---------- */
.legend { display: flex; flex-wrap: wrap; gap: 4px 12px; margin: 6px 0; }
.legend .it { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--ink); max-width: 100%; }
.legend .key { width: 16px; height: 2px; border-radius: 1px; flex: none; }
.legend .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 330px; }
.legend .x { border: none; background: transparent; color: var(--muted); padding: 0 3px; font-size: 14px; line-height: 1; }
.legend .x:hover { color: var(--ink); }
.chartbox { position: relative; }
.chartbox svg { display: block; width: 100%; overflow: visible; }
.chartbox .ax text { fill: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.chartbox .grid line { stroke: var(--grid); stroke-width: 1; }
.chartbox .zero line { stroke: var(--axis); stroke-width: 1; }
.chartbox .xhair { stroke: var(--muted); stroke-width: 1; }
.chartbox .endlab { fill: var(--ink); font-size: 12px; font-weight: 600; }
.chartbox .ytitle { fill: var(--ink-2); font-size: 11.5px; }
.tt { position: absolute; z-index: 20; pointer-events: none; background: var(--surface-1); border: 1px solid var(--axis); border-radius: 8px; box-shadow: var(--shadow); padding: 7px 10px; font-size: 12.5px; min-width: 140px; max-width: 330px; }
.tt .when { color: var(--ink-2); font-size: 11.5px; margin-bottom: 4px; }
.tt .r { display: flex; gap: 8px; align-items: baseline; margin-top: 2px; }
.tt .r .k { width: 12px; height: 2px; flex: none; align-self: center; border-radius: 1px; }
.tt .r .v { font-weight: 650; font-variant-numeric: tabular-nums; color: var(--ink); }
.tt .r .n { color: var(--ink-2); font-size: 11.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.smgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 10px; }
.smgrid .cell { border: 1px solid var(--grid); border-radius: 8px; padding: 6px 8px; min-width: 0; }
.smgrid .cell h4 { margin: 0; font-size: 12.5px; font-weight: 600; display: flex; gap: 6px; align-items: center; }
.smgrid .cell h4 span.t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.smgrid .cell .u { color: var(--muted); font-size: 11.5px; }
.note { background: var(--wash); border-radius: 7px; padding: 6px 10px; font-size: 12.5px; color: var(--ink-2); margin: 6px 0; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.dim { opacity: .55; transition: opacity .15s; }

/* ---------- KPI tiles ---------- */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 8px; margin: 8px 0; }
.tile { border: 1px solid var(--grid); border-radius: 8px; padding: 7px 10px; min-width: 0; }
.tile .label { color: var(--ink-2); font-size: 11.5px; }
.tile .value { font-size: 20px; font-weight: 600; letter-spacing: -0.01em; margin: 1px 0; }
.tile .delta { font-size: 12px; color: var(--ink-2); }
.tile .delta b { font-weight: 650; color: var(--ink); }
.tile .nt { font-size: 11px; color: var(--muted); }
.tile svg { display: block; margin-top: 4px; }

.toast { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); background: var(--ink); color: var(--page); padding: 8px 14px; border-radius: 8px; z-index: 100; font-size: 13px; box-shadow: var(--shadow); }
.pubtable td, .pubtable th { text-align: left !important; }
.muted { color: var(--muted); }
table.data tr.okrow td { background: color-mix(in srgb, var(--c3) 9%, transparent); }
table.data tr.newrow td { background: color-mix(in srgb, var(--c1) 8%, transparent); }
.ok { color: var(--ink); font-weight: 600; }

/* ---------- chips / extra layout ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 5px; }
.chipb { display: inline-flex; align-items: center; gap: 6px; border-radius: 14px; padding: 2px 10px; font-size: 12.5px; color: var(--ink-2); }
.chipb.on { border-color: var(--accent); background: var(--wash); color: var(--ink); }
.chipb .sw { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.chipb:disabled { opacity: .4; cursor: default; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; align-items: start; margin-top: 12px; }
@media (max-width: 1100px) { .grid2 { grid-template-columns: 1fr; } }
/* the income-mix chart and the seasonality table sit side by side at the same width AND the same height; the table's rows stretch to fill the card */
.grid2.seasonrow { align-items: stretch; }
.grid2.seasonrow > .card { display: flex; flex-direction: column; }
.grid2.seasonrow > .card > .stmtwrap, .grid2.seasonrow > .card > .tablewrap, .grid2.seasonrow > .card > div:has(> table.compact) { flex: 1 1 auto; }
.grid2.seasonrow > .card table.compact { height: 100%; }
.grid2.seasonrow > .card table.compact th, .grid2.seasonrow > .card table.compact td { padding: 3px 1px; }
@media (max-width: 1100px) { .grid2.seasonrow > .card table.compact { height: auto; } }
@media (min-width: 1101px) and (max-width: 1420px) { .grid2.seasonrow .heatcell { font-size: 10.5px !important; padding-left: 1px !important; padding-right: 1px !important; }
  .grid2.seasonrow > .card table.compact th, .grid2.seasonrow > .card table.compact td { padding: 3px 0; } }
.page-sub { color: var(--muted); font-size: 12.5px; margin: 2px 0 10px; }
.relevance { font-size: 12.5px; color: var(--ink-2); margin: 0 0 10px; }
table.data tr.child td { color: var(--ink-2); }
table.data tr.child td.lab .t { padding-left: 16px; }
table.data tr.total td { font-weight: 600; }
.foot { color: var(--muted); font-size: 12px; margin-top: 12px; }
.foot summary { cursor: pointer; }
.stack { display: flex; flex-direction: column; gap: 12px; }

.heatcell { display: block; padding: 3px 9px; border-radius: 5px; text-align: right; color: var(--ink); font-variant-numeric: tabular-nums; }

/* ---------- Pulse ---------- */
.pulsegrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 8px; margin-top: 6px; }
.pulsesec { display: flex; flex-direction: column; justify-content: center; gap: 2px; min-width: 0; padding: 8px 11px; border-left: 3px solid var(--accent); background: var(--surface-2, transparent); border-radius: 4px 9px 9px 4px; }
.pulsesec b { font-family: var(--head-font); font-size: 15px; }
.pulsesec span { font-size: 11.5px; color: var(--ink-2); }
.pulsetile { display: block; text-decoration: none; color: var(--ink); border: 1px solid var(--border); border-radius: var(--r-s); padding: 8px 11px; min-width: 0; }
.pulsetile:hover { border-color: var(--muted); }
.pulsetile .lab { font-size: 12.5px; color: var(--ink); display: flex; gap: 6px; align-items: center; }
.pulsetile .big { font-size: 24px; font-weight: 600; letter-spacing: -0.01em; margin: 1px 0 0; }
.pulsetile .small { font-size: 12px; color: var(--ink-2); }
.pulsetile .row { display: flex; align-items: center; justify-content: space-between; gap: 6px; margin-top: 4px; }
.pulsetile .val { font-weight: 600; font-size: 13px; }
.pulsetile .nt { font-size: 11px; color: var(--ink-2); margin-top: 2px; }
.newbadge { font-size: 10px; font-weight: 700; background: var(--accent); color: #fff; border-radius: 8px; padding: 0 6px; }
.heatlegend { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--ink-2); margin: 0 0 10px; }
.heatlegend .bar { width: 120px; height: 10px; border-radius: 5px; background: linear-gradient(90deg, color-mix(in srgb, var(--down) 46%, var(--surface-1)), var(--surface-1), color-mix(in srgb, var(--up) 46%, var(--surface-1))); border: 1px solid var(--border); }
table.compact th, table.compact td { padding: 3px 4px; }

/* ---------- chart export toolbar ---------- */
.chartwrap { position: relative; }
.charttools { position: absolute; top: 0; right: 0; display: flex; gap: 4px; opacity: 0; transition: opacity .15s; z-index: 5; }
.chartwrap:hover .charttools, .chartwrap:focus-within .charttools { opacity: 1; }
@media (hover: none) { .charttools { opacity: .85; } }
.charttools button { padding: 1px 8px; font-size: 11px; background: color-mix(in srgb, var(--surface-1) 92%, transparent); }

/* ---------- modal ---------- */
.modalback { position: fixed; inset: 0; z-index: 90; background: rgba(0,0,0,.45); display: flex; align-items: center; justify-content: center; padding: 20px; }
.modalbox { background: var(--surface-1); border: 1px solid var(--axis); border-radius: 12px; box-shadow: var(--shadow); padding: 14px 16px; width: min(900px, 100%); max-height: 88vh; overflow: auto; }

/* ---------- search-to-add ---------- */
.addsearch { position: relative; display: inline-flex; align-items: center; flex: 1 1 280px; min-width: 220px; max-width: 460px; }
.addsearch .addplus { position: absolute; left: 9px; color: var(--accent); font-weight: 700; pointer-events: none; }
.addsearch .addinp { width: 100%; padding-left: 26px; border-style: dashed; border-color: var(--accent); }
.addlist { position: absolute; z-index: 70; top: calc(100% + 3px); left: 0; right: 0; max-height: 300px; overflow: auto; background: var(--surface-1); border: 1px solid var(--axis); border-radius: 8px; box-shadow: var(--shadow); padding: 3px; }
.addopt { display: flex; gap: 8px; justify-content: space-between; align-items: baseline; padding: 5px 8px; border-radius: 5px; cursor: pointer; }
.addopt.act, .addopt:hover { background: var(--wash); }
.addopt .og { color: var(--muted); font-size: 11.5px; white-space: nowrap; }
.addmsg { padding: 8px; color: var(--muted); font-size: 12.5px; }
.addrow { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; margin: 6px 0; }

/* ---------- map ---------- */
.mapsvg { display: block; width: 100%; max-width: 520px; margin: 0 auto; height: auto; }
.mapsvg .prov { stroke: var(--surface-1); stroke-width: 1.4; transition: opacity .12s; }
.mapsvg .prov:hover, .mapsvg .prov:focus-visible { stroke: var(--ink); stroke-width: 2.2; outline: none; }
.mapsvg .prov.sel { stroke: var(--ink); stroke-width: 3; }
.mapsvg .maplab { font-size: 14px; font-weight: 700; fill: var(--ink); paint-order: stroke; stroke: var(--surface-1); stroke-width: 3px; stroke-linejoin: round; pointer-events: none; }
.mapsvg .mapval { font-size: 12.5px; fill: var(--ink); paint-order: stroke; stroke: var(--surface-1); stroke-width: 3px; stroke-linejoin: round; pointer-events: none; font-variant-numeric: tabular-nums; }
.maplegend { display: flex; align-items: center; justify-content: center; gap: 8px; font-size: 12px; color: var(--ink-2); margin: 4px 0 2px; flex-wrap: wrap; }
.maplegend .ramp { width: 150px; height: 10px; border-radius: 5px; border: 1px solid var(--border); }
.maptwo { display: grid; grid-template-columns: minmax(300px, 520px) 1fr; gap: 14px; align-items: start; }
@media (max-width: 900px) { .maptwo { grid-template-columns: 1fr; } }

/* ---------- heat-map grid ---------- */
.chartbox svg .hmcol, .chartbox svg .hmrow { font-size: 11px; fill: var(--muted); }
.chartbox svg .hmval { font-size: 11px; fill: var(--ink); font-variant-numeric: tabular-nums; pointer-events: none; }
/* ---------- sub-navigation, narrative, band status ---------- */
.subnav { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; margin: 12px 0 4px; }
.narr p { margin: 0 0 8px; line-height: 1.55; }
.narr p:last-child { margin-bottom: 0; }
.narr b { font-weight: 650; }
.pill { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 12px; border: 1px solid var(--border); }
.pill.in { color: var(--ink); border-color: var(--c3); }
.pill.out { color: var(--ink); border-color: var(--c2); }
.bkgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 6px 14px; }
.bkgrid label { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 13px; }
.bkgrid input[type=number] { width: 70px; }

.mapsvg .maplegtxt { font-size: 13px; fill: var(--ink-2); font-variant-numeric: tabular-nums; }

/* ---------- searchable single choice (replaces very long dropdowns) ---------- */
.addsearch.pick .addplus { display: none; }
.addsearch.pick .addinp { padding-left: 10px; padding-right: 26px; border-style: solid; border-color: var(--axis); text-overflow: ellipsis; }
.addsearch.pick::after { content: '\25be'; position: absolute; right: 9px; color: var(--muted); pointer-events: none; font-size: 12px; }
.addsearch.pick .addinp::-webkit-search-cancel-button { display: none; }

/* per-chart controls (line panels) */
.lpbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0 0 6px; }
.lpbar .grow { flex: 1; }
.lpbar .seg button, .lprange .seg button { padding: 2px 9px; font-size: 12px; }
.lprange input { width: 78px; font-size: 12px; padding: 2px 6px; }
.lpchk { font-size: 12px; color: var(--ink-2); display: inline-flex; align-items: center; gap: 3px; cursor: pointer; }
.lplegend { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: center; margin: 2px 0 4px; font-size: 12.5px; }
.lpleg { display: inline-flex; align-items: center; gap: 5px; min-width: 0; }
.lpleg .sw { width: 10px; height: 10px; border-radius: 2px; flex: none; }
.lpleg .nm { max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.axtag { font-size: 10px; font-weight: 700; line-height: 1; padding: 2px 5px; border-radius: 4px; border: 1px solid var(--border); background: transparent; color: var(--ink-2); cursor: pointer; }
.axtag.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.minibtn { font-size: 11.5px; padding: 2px 8px; border: 1px solid var(--border); border-radius: 6px; background: transparent; color: var(--ink-2); cursor: pointer; }
.minibtn:hover { border-color: var(--muted); color: var(--ink); }

/* row pop-ups and the + / tick button */
tr.openable { cursor: pointer; }
tr.openable:hover td { background: var(--wash); }
th.rowaddh, td.rowadd { width: 30px; padding-right: 0; text-align: center; }
.rowaddb { width: 22px; height: 22px; padding: 0; line-height: 1; border-radius: 50%; border: 1px solid var(--axis); background: transparent; color: var(--ink-2); font-size: 14px; cursor: pointer; }
.rowaddb:hover { border-color: var(--accent); color: var(--accent); }
.rowaddb.on { background: var(--accent); border-color: var(--accent); color: #fff; font-size: 12px; }
.serbody { padding: 4px 14px 14px; max-width: 980px; }
.serbody .card.flat { border: none; background: transparent; padding: 0; margin-top: 8px; }
.serfoot { display: flex; gap: 14px; align-items: center; margin-top: 10px; }
.ghostlink { font-size: 12.5px; color: var(--accent); }
.chipsearch { display: flex; flex-wrap: wrap; gap: 6px 8px; align-items: center; }
.chipsearch .addsearch { min-width: 220px; flex: 1 1 220px; max-width: 360px; }
.serhead { font-weight: 600; font-size: 13px; margin: 8px 0 2px; color: var(--ink-2); }

/* explorer: per-series rows and the formula bar */
.serrows { display: flex; flex-direction: column; gap: 4px; margin: 6px 0 6px; }
.serrow { display: flex; align-items: center; gap: 7px; font-size: 12.5px; min-width: 0; flex-wrap: wrap; }
.serrow .ltr { font-family: Consolas, ui-monospace, monospace; color: var(--accent); width: 14px; text-align: center; }
.serrow .key { width: 12px; height: 12px; border-radius: 3px; flex: none; }
.serrow .nm { flex: 1 1 200px; min-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.serrow .rowsel { font-size: 12px; padding: 2px 6px; max-width: 170px; }
.serrow .winin { width: 54px; font-size: 12px; padding: 2px 5px; }
.serrow .x { border: none; background: transparent; color: var(--ink-2); font-size: 16px; cursor: pointer; padding: 0 4px; }
.fxbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 6px 0 8px; }
.fxin { font-family: Consolas, ui-monospace, monospace; width: 330px; max-width: 100%; }
.fxmsg { font-size: 12px; color: var(--ink-2); }
.fxmsg.err { color: var(--c8); font-weight: 600; }
.fxhelp { width: 24px; height: 24px; padding: 0; border-radius: 50%; border: 1px solid var(--axis); background: var(--wash); color: var(--ink); font-weight: 700; font-size: 13px; line-height: 1; cursor: pointer; }
.fxhelp:hover, .fxhelp:focus-visible { border-color: var(--c1); color: var(--c1); }
.fxdoc { font-size: 13px; line-height: 1.5; color: var(--ink); }
.fxdoc h4 { margin: 14px 0 4px; font-size: 13px; }
.fxdoc p { margin: 4px 0; }
.fxdoc code, .fxex { font-family: Consolas, ui-monospace, monospace; font-size: 12px; }
.fxdoc code { background: var(--wash); padding: 1px 5px; border-radius: 4px; }
.fxdoc ul { margin: 4px 0 0; padding-left: 18px; }
.fxdoc li { margin: 3px 0; }
.fxlet { margin: 4px 0; padding-left: 0; list-style: none; columns: 2 280px; }
.fxlet li { margin: 2px 0; break-inside: avoid; }
.fxlet b { display: inline-block; width: 1.4em; font-family: Consolas, ui-monospace, monospace; color: var(--c1); }
.fxtab { width: 100%; border-collapse: collapse; }
.fxtab th { text-align: left; font-size: 12px; color: var(--ink-2); font-weight: 600; padding: 3px 8px 3px 0; border-bottom: 1px solid var(--axis); }
.fxtab td { padding: 4px 8px 4px 0; vertical-align: top; border-bottom: 1px solid var(--grid); }
.fxex { border: 1px solid var(--axis); background: var(--wash); color: var(--ink); border-radius: 6px; padding: 2px 7px; cursor: pointer; text-align: left; }
.fxex:hover, .fxex:focus-visible { border-color: var(--c1); color: var(--c1); }

/* province map card: map beside its ranking */
.mapcard { container-type: inline-size; }
.mapbody { display: grid; grid-template-columns: minmax(300px, 44%) minmax(0, 1fr); gap: 20px; align-items: center; margin-top: 4px; }
.mapbody .mapcol { min-width: 0; }
.mapbody .mapsvg { width: 100%; height: auto; max-height: 560px; }
.rankhead { font-size: 12px; color: var(--ink-2); margin: 0 0 4px; }
@container (max-width: 760px) { .mapbody { grid-template-columns: 1fr; } }

.fresh { margin-bottom: 12px; }
.freshlist { display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; color: var(--ink-2); }
.freshrow b { color: var(--ink); font-weight: 600; }
.scbar { display: flex; justify-content: flex-end; align-items: center; gap: 6px; margin: 0 0 4px; }
.scbar .seg button { padding: 2px 9px; font-size: 12px; }

/* ---- Pulse: sector panels, search, quick view (2026-10-04) */
.pbar { display: flex; gap: 10px 14px; align-items: center; flex-wrap: wrap; margin: 6px 0 8px; }
.psearch { flex: 0 1 320px; min-width: 200px; }
.ppills { display: flex; gap: 6px; flex-wrap: wrap; }
.ppill { display: inline-flex; align-items: center; gap: 6px; border-radius: 16px; padding: 4px 11px; font-size: 12.5px; color: var(--ink-2); background: var(--surface-1); }
.ppill svg { flex: none; }
.ppill.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.pbar2 { display: flex; gap: 8px 12px; align-items: center; flex-wrap: wrap; margin: 0 0 12px; padding: 8px 10px; background: var(--surface-1); border: 1px solid var(--axis); border-radius: var(--r-s); font-size: 12.5px; }
.pbar2 .lbl { color: var(--ink-2); font-size: 12px; }
.pbar2 .grow { flex: 1 1 40px; }
.plegend { display: inline-flex; align-items: center; gap: 6px; color: var(--ink-2); }
.plegend .dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.plegend .dot.up { background: var(--up); } .plegend .dot.down { background: var(--down); }
.phint { color: var(--muted); font-size: 11.5px; }
.pgrid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; align-items: start; margin-bottom: 12px; }
@media (max-width: 1250px) { .pgrid3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 820px) { .pgrid3 { grid-template-columns: minmax(0, 1fr); } }
.psec { background: var(--surface-1); border: 1px solid var(--axis); border-radius: var(--r); padding: 10px 10px 12px; min-width: 0; }
.psec-h { display: flex; align-items: center; gap: 10px; margin: 0 2px 8px; }
.psec-ic { color: var(--accent); display: inline-flex; }
.psec-t { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.psec-t b { font-family: var(--head-font); font-size: 15.5px; }
.psec-t span { font-size: 11.5px; color: var(--ink-2); }
.psec-all { font-size: 12px; white-space: nowrap; text-decoration: none; }
.psec .pulsegrid { grid-template-columns: repeat(auto-fill, minmax(138px, 1fr)); margin-top: 0; }
.pulsetile .spk { margin: 3px 0 1px; }
.pulsetile .spk svg { width: 100%; height: 26px; display: block; }
.pulsetile .val { margin-top: 2px; }
.sectag { display: inline-flex; align-items: center; gap: 4px; color: var(--ink-2); }
a.hdrlink { color: var(--ink-2); font-size: 12.5px; text-decoration: none; border: 1px solid var(--axis); border-radius: 6px; padding: 4px 10px; white-space: nowrap; }
a.hdrlink:hover { color: var(--ink); border-color: var(--muted); background: var(--wash); }

/* phone: keep card-head controls inside the card (2026-10-04) */
.card-head .tools { max-width: 100%; min-width: 0; }
.card-head .tools > span { max-width: 100%; min-width: 0; display: inline-flex; }

/* ---- Pulse: chart workspace beside the tiles (2026-10-04) */
.pwork { display: grid; gap: 12px; grid-template-columns: minmax(0, 1fr); align-items: start; }
.pwork.cp-off .pright { display: none; }
.pleft, .pright { min-width: 0; }
@media (min-width: 1100px) {
  .pwork.cp-side { grid-template-columns: minmax(0, 1.12fr) minmax(0, 1fr); }
  .pwork.cp-side .pright { position: sticky; top: 96px; max-height: calc(100vh - 108px); overflow: auto; }
  .pwork.cp-side .pgrid3 { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 1099px) { .pwork.cp-side .pright { order: -1; } }
.pwork.cp-top .pright { order: -1; }
.pwork.ts-s .psec .pulsegrid, .pwork.ts-s .pulsegrid { grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); }
.pwork.ts-l .psec .pulsegrid, .pwork.ts-l .pulsegrid { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
.pwork.ts-s .pulsetile { padding: 6px 8px; } .pwork.ts-s .pulsetile .big { font-size: 19px; } .pwork.ts-s .pulsetile .nt { display: none; }
.pwork.ts-l .pulsetile .big { font-size: 28px; }
.pwork.nospark .pulsetile .spk { display: none; }
.pulsetile { cursor: pointer; }
.pulsetile.sel { box-shadow: inset 0 0 0 2px var(--selc, var(--accent)); border-color: transparent; }
.playout .lbl { margin-left: 6px; }
.pchart { margin-bottom: 12px; }
.pchart .pcsearch { position: relative; margin: 6px 0 4px; }
.pchart .pcin { width: 100%; }
.pcdrop { position: absolute; z-index: 30; left: 0; right: 0; top: calc(100% + 2px); max-height: 320px; overflow: auto; background: var(--surface-1); border: 1px solid var(--axis); border-radius: 8px; box-shadow: 0 6px 18px rgba(0, 0, 0, .18); }
.pchit { padding: 6px 10px; cursor: pointer; border-bottom: 1px solid var(--grid); }
.pchit:last-child { border-bottom: none; }
.pchit.hi, .pchit:hover { background: var(--wash); }
.pchit .t { font-size: 13px; } .pchit .sm { font-size: 11.5px; color: var(--ink-2); }
.pchit.on .t::after { content: ' ✓'; color: var(--accent); }
.pcnone { padding: 8px 10px; color: var(--ink-2); font-size: 12.5px; }
.pcsug { display: flex; flex-wrap: wrap; gap: 5px 6px; align-items: center; margin: 4px 0 6px; }
.pcsug .lbl { color: var(--ink-2); font-size: 12px; margin-right: 2px; }
.pcchip { font-size: 12px; padding: 2px 9px; border-radius: 13px; border: 1px solid var(--border); background: transparent; color: var(--ink-2); cursor: pointer; }
.pcchip:hover { border-color: var(--muted); color: var(--ink); }
.pcchip.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.pcrows .pcnum { font-weight: 600; font-variant-numeric: tabular-nums; }
.pcrows .pcyoy { color: var(--ink-2); font-size: 11.5px; min-width: 52px; text-align: right; }
.pcrows .pcopen { text-decoration: none; color: var(--ink-2); padding: 0 3px; }
.pcrows .pcopen:hover { color: var(--accent); }
.pcbar { margin: 6px 0 4px; }
.pcbar .small.on { background: var(--wash); border-color: var(--muted); }
.pcset { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; padding: 8px 10px; margin: 4px 0 6px; background: var(--wash); border-radius: 8px; font-size: 12.5px; }
.pcset[hidden] { display: none; }
.pcfield { display: inline-flex; align-items: center; gap: 6px; }
.pcgrid { display: grid; gap: 10px; }
.pcgrid .cell { border: 1px solid var(--grid); border-radius: 8px; padding: 6px 8px; min-width: 0; }
.pcgrid .cell h4 { margin: 0; font-size: 12.5px; font-weight: 600; display: flex; gap: 6px; align-items: center; }
.pcgrid .cell h4 span.t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pcgrid .cell .u { color: var(--muted); font-size: 11.5px; }

/* ---- Theme panel: colours and graph layout (2026-10-04) */
.lkpanel { position: fixed; top: 46px; right: 12px; width: 344px; max-width: calc(100vw - 24px); max-height: calc(100vh - 58px); overflow: auto; z-index: 80; background: var(--surface-1); border: 1px solid var(--axis); border-radius: 12px; box-shadow: var(--shadow); padding: 10px 14px 14px; font-size: 12.5px; }
.lkpanel[hidden] { display: none; }
.lktop { display: flex; align-items: center; gap: 8px; font-family: var(--head-font); font-size: 16px; }
.lktop .grow { flex: 1; }
.lktop .x { border: none; background: transparent; color: var(--ink-2); font-size: 20px; cursor: pointer; padding: 0 4px; }
.lkhead { margin: 12px 0 6px; display: flex; flex-direction: column; }
.lkhead b { font-size: 13px; } .lkhead span { font-size: 11.5px; color: var(--ink-2); }
.lkcards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.lkcard { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 6px 4px; border: 1px solid var(--border); border-radius: 8px; background: transparent; color: var(--ink); font-size: 12px; cursor: pointer; }
.lkcard:hover { border-color: var(--muted); }
.lkcard.on, .lkpal.on { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.lksw { display: inline-flex; border-radius: 5px; overflow: hidden; border: 1px solid var(--border); } .lksw i { width: 20px; height: 20px; display: block; }
.lkpals { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.lkpal { display: flex; flex-direction: column; align-items: stretch; gap: 4px; padding: 6px 7px; border: 1px solid var(--border); border-radius: 8px; background: transparent; color: var(--ink); font-size: 12px; cursor: pointer; text-align: left; }
.lkstrip { display: flex; border-radius: 4px; overflow: hidden; } .lkstrip i { flex: 1; height: 12px; display: block; }
.lkcustom { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 4px; margin: 6px 0 4px; }
.lkcustom input[type=color] { width: 100%; height: 30px; padding: 0; border: 1px solid var(--border); border-radius: 6px; background: transparent; cursor: pointer; }
.lknote { font-size: 11.5px; color: var(--ink-2); margin: 6px 0; } .lknote.warn { color: var(--down); }
.lkfine { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.lkrow { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.lkrow > span { flex: none; color: var(--ink-2); }

/* ---- Pulse: panels in one row share a height; tiles in a panel share a row height (2026-10-04) */
.pgrid3 { align-items: stretch; }
.psec .pulsegrid { grid-auto-rows: 1fr; align-content: start; }

/* ---- Display settings from the Theme panel (attributes on <html>) */
:root[data-round="sharp"] { --r: 3px; --r-s: 2px; }
:root[data-round="round"] { --r: 18px; --r-s: 14px; }
:root[data-head="sans"] { --head-font: system-ui, -apple-system, "Segoe UI", sans-serif; }
:root[data-size="s"] header.app, :root[data-size="s"] main { zoom: .92; }
:root[data-size="l"] header.app, :root[data-size="l"] main { zoom: 1.12; }
:root[data-size="xl"] header.app, :root[data-size="xl"] main { zoom: 1.25; }
:root[data-dens="compact"] main { padding: 8px 14px 40px; }
:root[data-dens="compact"] .card { padding: 8px 10px; }
:root[data-dens="compact"] .grid2, :root[data-dens="compact"] .pgrid3, :root[data-dens="compact"] .pwork { gap: 8px; }
:root[data-dens="compact"] .grid2 { margin-top: 8px; }
:root[data-dens="compact"] .pulsegrid { gap: 5px; }
:root[data-dens="compact"] .pulsetile { padding: 6px 8px; }
:root[data-dens="compact"] .psec { padding: 8px 8px 9px; }
:root[data-dens="compact"] .pbar2 { padding: 5px 8px; margin-bottom: 8px; }

/* ---- Pulse: two tiles per row in a panel; an odd last tile takes the whole row so nothing is left hanging (standard tile size, tiles-only layouts) */
.pwork:not(.cp-side):not(.ts-s):not(.ts-l) .psec .pulsegrid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.pwork:not(.cp-side):not(.ts-s):not(.ts-l) .psec .pulsegrid .pulsetile:last-child:nth-child(odd) { grid-column: 1 / -1; }

/* ---- Overview panels: links in the header */
.psec-links { display: inline-flex; flex-direction: column; align-items: flex-end; gap: 2px; }
button.psec-all { border: none; background: transparent; padding: 0; color: var(--accent); cursor: pointer; font: inherit; font-size: 12px; white-space: nowrap; }
button.psec-all:hover { text-decoration: underline; }

/* ---- High contrast: outlines, underlined links, heavier text (so the style is obvious in light mode too) */
:root[data-page="contrast"] body { font-weight: 500; }
:root[data-page="contrast"] .card, :root[data-page="contrast"] .psec, :root[data-page="contrast"] .pulsetile, :root[data-page="contrast"] .pbar2, :root[data-page="contrast"] .lkpanel, :root[data-page="contrast"] .chartwrap { border: 2px solid var(--ink); }
:root[data-page="contrast"] a { text-decoration: underline; }
:root[data-page="contrast"] nav.tabs a.active { border-bottom-width: 4px; }
:root[data-page="contrast"] button, :root[data-page="contrast"] select, :root[data-page="contrast"] input { border: 2px solid var(--ink); }
:root[data-page="contrast"] .seg button.on, :root[data-page="contrast"] .ppill.on { background: var(--ink); color: var(--surface-1); border-color: var(--ink); }
:root[data-page="contrast"] header.app { border-bottom: 3px solid var(--ink); }

/* the Theme panel is not zoomed (it would outgrow the window and its lower settings could not be reached) */
.lkpanel { max-height: calc(100vh - 58px); overflow-y: auto; overscroll-behavior: contain; }

/* ---- Pulse theme pills: a quieter second level under the main tabs */
.ppills { gap: 5px; align-items: center; }
.pcap { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-right: 2px; }
.ppill { font-size: 12px; padding: 2px 9px; gap: 5px; border: 1px solid var(--border); background: transparent; color: var(--ink-2); font-weight: 400; }
.ppill svg { width: 13px; height: 13px; }
.ppill:hover { border-color: var(--muted); color: var(--ink); }
.ppill.on { background: var(--wash); border-color: var(--accent); color: var(--accent); font-weight: 600; }

h1.hdr-title { margin: 0; }

/* ---------- Series Explorer: filters, chips, group headers, headline figures ---------- */
.filters.facets { margin-bottom: 6px; }
.filters .pcap { color: var(--ink-2); font-size: 12px; font-weight: 600; }
.fchips { display: flex; flex-wrap: wrap; gap: 6px; margin: 2px 0 8px; }
.fchip { border: 1px solid var(--accent); color: var(--accent); background: transparent; border-radius: 999px; padding: 1px 4px 1px 10px; font-size: 12px; cursor: pointer; max-width: 100%; text-align: left; }
.fchip .k { color: var(--ink-2); }
.fchip .x { font-weight: 700; }
.fchip:hover { background: var(--wash); }
.pop { max-width: min(400px, 92vw); }
.pop .mssearch { width: 100%; box-sizing: border-box; margin: 0 0 6px; }
.pop .msbody { max-height: 280px; overflow: auto; }
.pop label .l { min-width: 0; overflow-wrap: anywhere; }
.pop .mshint { padding: 6px; color: var(--muted); font-size: 12px; }
mark { background: color-mix(in srgb, var(--accent) 24%, transparent); color: inherit; border-radius: 2px; padding: 0 1px; }
tr.grp td { background: var(--wash); font-size: 12px; padding: 5px 8px; text-align: left; border-bottom: 1px solid var(--grid); white-space: normal; }
tr.grp0 td { background: color-mix(in srgb, var(--accent) 14%, var(--surface-1)); font-size: 12.5px; padding: 6px 8px; border-top: 1px solid var(--axis); }
tr.grp1 td { padding-left: 14px; font-weight: 600; color: var(--ink-2); background: var(--wash); }
tr.grp .gn { color: var(--muted); font-variant-numeric: tabular-nums; }
.card-head .cnt { color: var(--muted); font-size: 12px; }
.sechead { display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; margin: 12px 0 4px; font-size: 13px; }
.sechead .sub { margin: 0; }
.sechead-r { margin-left: auto; }
.serrows.many { max-height: 226px; overflow: auto; padding-right: 4px; }
.hcards { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }
.hcard { border: 1px solid var(--grid); border-left: 4px solid var(--hc, var(--accent)); border-radius: 8px; padding: 8px 10px; min-width: 0; }
.hcard .hh { display: flex; gap: 6px; align-items: flex-start; }
.hcard .ltr { font-family: Consolas, ui-monospace, monospace; color: var(--accent); }
.hcard .hn { font-size: 12.5px; font-weight: 600; line-height: 1.25; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; min-width: 0; }
.hcard .hv { font-size: 22px; font-weight: 600; letter-spacing: -.01em; margin-top: 4px; }
.hcard .hp { font-size: 12px; color: var(--muted); font-weight: 400; }
.hcard .hu { font-size: 11.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hcard .hd { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; margin-top: 6px; }
.hcard .hm { display: flex; flex-direction: column; min-width: 0; }
.hcard .hm .k { font-size: 10.5px; color: var(--muted); }
.hcard .hm b { font-size: 13px; font-weight: 650; }
.hcard .hm .w { font-size: 10.5px; color: var(--muted); }
.hcard .hf { display: flex; justify-content: space-between; align-items: center; gap: 6px; margin-top: 6px; font-size: 11.5px; color: var(--ink-2); }
.hlt.tablewrap { max-height: 36vh; }
.hl-name { display: flex; gap: 6px; align-items: center; min-width: 0; }
.hl-name .ltr { font-family: Consolas, ui-monospace, monospace; color: var(--accent); width: 14px; text-align: center; flex: none; }
.hl-name .sw { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.hl-name .t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 300px; }
.listcard .card-head .tools button:disabled { opacity: .5; cursor: default; }

.listcard { container-type: inline-size; }
@container (max-width: 730px) { .listcard .hn1 { display: none; } }
@container (max-width: 610px) { .listcard .hn2 { display: none; } }
@container (max-width: 480px) { .listcard .hn3 { display: none; } }
.moreviews { max-width: 190px; }

/* ---------- hover tips, info buttons, keyboard focus ---------- */
.xtip { position: fixed; z-index: 90; width: min(380px, calc(100vw - 16px)); max-height: calc(100vh - 16px); overflow: auto; background: var(--surface-1); color: var(--ink); border: 1px solid var(--axis); border-radius: 10px; box-shadow: var(--shadow); padding: 10px 12px; font-size: 12.5px; line-height: 1.4; pointer-events: none; }
.xtip[hidden] { display: none; }
.xt-t { font-weight: 650; font-size: 13px; }
.xt-p { color: var(--muted); font-size: 11.5px; margin: 2px 0 6px; }
.xt-s { margin-top: 6px; }
.xt-s b, .xt-g b { color: var(--ink); font-weight: 650; }
.xt-s div { color: var(--ink-2); }
.xt-f { margin-top: 8px; padding-top: 6px; border-top: 1px solid var(--grid); display: grid; gap: 2px; }
.xt-f > div { display: grid; grid-template-columns: 66px 1fr; gap: 6px; }
.xt-f .k { color: var(--muted); }
.xt-g { margin-top: 8px; padding-top: 6px; border-top: 1px solid var(--grid); color: var(--ink-2); display: grid; gap: 4px; font-size: 12px; }
.serc { display: flex; gap: 6px; align-items: flex-start; }
.serc-t { flex: 1 1 auto; min-width: 0; }
.tipinfo { flex: none; border: none; background: transparent; color: var(--muted); font-size: 14px; line-height: 1; padding: 0 2px; cursor: pointer; border-radius: 50%; }
.tipinfo:hover, .tipinfo:focus-visible { color: var(--accent); }
tr.row:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.pop .opt:focus-within { background: var(--wash); outline: 2px solid var(--accent); outline-offset: -2px; }
.pop .msbody { overscroll-behavior: contain; max-height: min(320px, 50vh); }
.pop input[type=checkbox] { accent-color: var(--accent); }
.ms > button:focus-visible, .seg button:focus-visible, .moreviews:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.tablewrap { overscroll-behavior: contain; }
.serrows { overscroll-behavior: contain; }

/* ---------- folded descriptions (Data tab) ---------- */
details.about { margin: 2px 0 8px; }
details.about > summary { cursor: pointer; list-style: none; color: var(--muted); font-size: 12px; display: flex; gap: 4px; align-items: baseline; }
details.about > summary::-webkit-details-marker { display: none; }
details.about > summary::before { content: '▸'; color: var(--accent); font-size: 11px; }
details.about[open] > summary::before { content: '▾'; }
details.about .ab-t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
details.about .ab-m { color: var(--accent); flex: none; }
details.about[open] .ab-t, details.about[open] .ab-m { display: none; }
details.about > .sub { margin: 4px 0 0; }
details.notesfold > summary { cursor: pointer; color: var(--accent); font-size: 12.5px; margin-top: 4px; }

/* Pulse overview: every theme shows four tiles; panels in a row share one height and the tiles fill it, so no panel ends in empty space */
.psec { display: flex; flex-direction: column; }
.psec .pulsegrid { flex: 1 1 auto; align-content: stretch; }
.psec .pulsegrid:has(.pulsetile:nth-child(2):last-child) { flex: 0 0 auto; align-content: start; }          /* a theme with only two indicators keeps normal tiles instead of stretching them */

/* ---------- Explorer: conversion menu, date input, correlation matrix ---------- */
.serrow .cnv { max-width: 150px; }
.datein { width: 84px; font-size: 12px; padding: 2px 5px; }
details.corrm { margin-top: 10px; border-top: 1px solid var(--grid); padding-top: 6px; }
details.corrm > summary { cursor: pointer; list-style: none; display: flex; gap: 6px; align-items: baseline; font-size: 13px; }
details.corrm > summary::-webkit-details-marker { display: none; }
details.corrm > summary::before { content: '▸'; color: var(--accent); font-size: 11px; }
details.corrm[open] > summary::before { content: '▾'; }
details.corrm .sub { margin: 0; }
.cmwrap { max-height: 46vh; overflow: auto; margin-top: 6px; }
table.cmtab { width: auto; }
table.cmtab th, table.cmtab td { padding: 3px 6px; text-align: center; font-size: 12px; }
table.cmtab th.rowh { text-align: left; white-space: nowrap; position: sticky; left: 0; background: var(--surface-1); z-index: 1; max-width: 240px; }
table.cmtab th.rowh .sw { display: inline-block; width: 9px; height: 9px; border-radius: 2px; margin: 0 5px; }
table.cmtab th.rowh .t { overflow: hidden; text-overflow: ellipsis; display: inline-block; max-width: 190px; vertical-align: bottom; }
table.cmtab td.cmc { min-width: 40px; font-variant-numeric: tabular-nums; }

/* ---- statement-style tables (National Treasury, Bond holdings, Auctions tabs) */
.stmtwrap { overflow-x: auto; margin-top: 8px; max-width: 100%; }
table.stmt { min-width: 640px; }
table.stmt td, table.stmt th { white-space: nowrap; }
table.stmt td:first-child, table.stmt th:first-child { position: sticky; left: 0; background: var(--surface-1); z-index: 1; text-align: left; }
table.stmt td.lab { max-width: 420px; white-space: normal; min-width: 260px; }
table.stmt th:first-child { z-index: 3; }                                                                                    /* above the date headings that scroll under it (they sit at 2) */
table.stmt td.live { color: var(--accent); }
table.stmt td.b { font-weight: 600; }
table.stmt tr.h td { font-weight: 600; background: var(--wash); border-top: 1px solid var(--axis); color: var(--ink-2); }
table.stmt tr.h td:first-child { background: linear-gradient(var(--wash), var(--wash)), var(--surface-1); }                 /* the sticky label must be opaque, or the figures scrolling under it show through */
table.stmt tr.t td { font-weight: 600; border-top: 1px solid var(--axis); }
table.stmt tr.row:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
table.stmt td.est, table.stmt th.est { background: color-mix(in srgb, var(--accent) 5%, var(--surface-1)); }
table.stmt td.dl { color: var(--ink-2); font-size: 12px; }
table.stmt td.warn { color: var(--down); font-weight: 600; }
table.stmt td.spk { padding: 2px 6px; }
table.stmt td.hm { font-size: 12px; min-width: 56px; }
table.stmt td .sm, table.stmt th .sm { font-size: 10.5px; font-weight: 400; color: var(--muted); display: block; }
.stmtnotes { margin-top: 8px; font-size: 12px; color: var(--ink-2); }
.stmtnotes summary { cursor: pointer; }
.chev { color: var(--accent); }
.curve { min-height: 300px; }
@media (max-width: 640px) {
  .seg { flex-wrap: wrap; max-width: 100%; }                  /* a row of choices wraps instead of running off the screen */
  .lpbar { flex-wrap: wrap; }
  table.stmt td.lab { min-width: 150px; }
}

/* ---------- new data: a dot on the tab, a one-line banner, the detail pop-up (js/releases.js) ---------- */
.newdot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); margin-left: 6px; vertical-align: middle; box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 22%, transparent); }
.relbanner { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 0 0 12px; padding: 7px 12px; border-radius: var(--r-s); background: var(--wash); border-left: 3px solid var(--accent); font-size: 12.5px; color: var(--ink-2); }
.relbanner .newdot { margin: 0; flex: none; }
.relbanner .reltxt { flex: 1 1 320px; min-width: 0; line-height: 1.45; }
.relbanner .relmoved { color: var(--ink); }
.relbanner .relmuted, .relmodal .relmuted { color: var(--muted); }
.relbanner { align-items: flex-start; }
.relbanner .newdot { margin-top: 5px; }
.relbanner button.small:last-child { margin-left: auto; }
.relmodal { min-width: min(560px, 86vw); }
.relmodal td.okc { color: var(--c3); font-weight: 600; }
.relmodal td.neg, .relmodal td.pos { font-variant-numeric: tabular-nums; }
.relmodal td.neg { color: var(--down); }
.relbanner .relblk { position: relative; padding-right: 130px; }
.relbanner .relblk + .relblk { margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--border); }
.relbanner .relblk > button { position: absolute; right: 0; top: 0; }
.relbanner.relbrief { align-items: center; padding: 5px 12px; }
.relbanner .relline { color: var(--ink); }
.relbanner .rellink { white-space: nowrap; }
@media (max-width: 640px) { .relbanner .relblk { padding-right: 0; } .relbanner .relblk > button { position: static; margin-top: 4px; } }
/* the source of a series that is not an official statistic (ASISA) is marked on the series itself */
.srcbadge { display: inline-block; margin-left: 6px; padding: 0 6px; border: 1px solid var(--axis); border-radius: 999px; font-size: 10.5px; font-weight: 600; letter-spacing: .02em; color: var(--ink-2); background: var(--wash); vertical-align: 1px; cursor: help; white-space: nowrap; }
.srcnote { margin: 0 0 10px; border-left: 3px solid var(--accent); line-height: 1.45; display: block; }
/* the Series Explorer view bar: quick views, then a chain of steps */
.viewbar { align-items: center; row-gap: 6px; }
.stepchain { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.stepchip { flex: 0 0 auto; display: inline-flex; align-items: center; gap: 2px; padding: 2px 2px 2px 4px; border: 1px solid var(--border); border-radius: 8px; background: var(--wash); }
.stepchip select { flex: 0 0 auto; width: auto; min-width: 0; border: 0; background: transparent; max-width: 210px; padding: 2px 4px; }
.stepchip .datein { width: 84px; }
.stepchip .stepx { padding: 0 6px; line-height: 1.4; opacity: .75; }
.steparrow { color: var(--muted); }

/* open drop-down lists wear the page colours (a transparent select otherwise opens a white list) */
select option, select optgroup { background-color: var(--surface-1); color: var(--ink); }
select optgroup { font-weight: 700; color: var(--ink-2); }
select option { font-weight: 400; }
/* start-up bar (index.html) and the loading bars of lazily loaded data */
#bootbar { position: fixed; top: 0; left: 0; right: 0; height: 3px; z-index: 200; background: transparent; pointer-events: none; }
#bootbar i { display: block; height: 100%; width: 6%; background: var(--accent); transition: width .5s ease; }
.pbar { height: 6px; border-radius: 3px; background: var(--grid); overflow: hidden; margin-top: 8px; }
.pbar i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .25s ease; }
.pbar.indet i { width: 35%; animation: pbarmove 1.2s ease-in-out infinite; }
@keyframes pbarmove { 0% { margin-left: -35%; } 100% { margin-left: 100%; } }
@media (prefers-reduced-motion: reduce) { .pbar.indet i { animation: none; width: 100%; opacity: .5; } #bootbar i { transition: none; } }

/* legend names that hide and show a series */
.legend .it.off, .lpleg.off { opacity: .45; }
.legend .it.off .nm, .lpleg.off .nm { text-decoration: line-through; }
.lpleg .nm:hover, .lpleg .sw:hover { opacity: .75; }
.legend .it[title^="Click"] .nm:hover { text-decoration: underline; }
