/* G20 Economic Monitor — Direction B · Refined Fintech Terminal
   ========================================================================== */

/* ── Geist font ──────────────────────────────────────────────────────────────── */
@font-face {
  font-family: "Geist";
  src: url("https://cdn.jsdelivr.net/npm/geist@1.4.2/dist/fonts/geist-sans/Geist-Variable.woff2") format("woff2-variations");
  font-weight: 100 900;
  font-display: swap;
}
@font-face {
  font-family: "Geist Mono";
  src: url("https://cdn.jsdelivr.net/npm/geist@1.4.2/dist/fonts/geist-mono/GeistMono-Variable.woff2") format("woff2-variations");
  font-weight: 100 900;
  font-display: swap;
}

/* ── Reset ───────────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ── Tokens ──────────────────────────────────────────────────────────────────── */
:root {
  --bg:        #FFFFFF;
  --bg-2:      #FAFAF8;
  --bg-3:      #F4F4F1;

  --ink:       #0A0A0A;
  --ink-2:     #171717;
  --ink-3:     #2A2A2A;

  --text-1:    #0A0A0A;
  --text-2:    #383838;
  --text-3:    #656565;
  --text-4:    #707070;  /* was #959595 — 3.0:1 on white, fails WCAG AA; now 4.95:1 */

  --rule:      #DEDAD4;
  --rule-2:    #CECAC2;
  --rule-on-ink:    rgba(255,255,255,0.10);
  --text-on-ink:    #F5F5F2;
  --text-on-ink-2:  rgba(245,245,242,0.62);
  --text-on-ink-3:  rgba(245,245,242,0.40);

  /* --pos/--neg/--warn below are tuned as dark text on a light background —
     the profile hero is always rendered on var(--ink) regardless of theme,
     so it needs its own light-on-dark variants instead. */
  --pos-on-ink:  #6FCBA8;
  --neg-on-ink:  #F08F8F;
  --warn-on-ink: #E8C063;

  --pos:       #047857;
  --neg:       #B91C1C;
  --warn:      #A16207;
  --info:      #1E40AF;

  --pos-bg:    rgba(4,120,87,0.08);
  --neg-bg:    rgba(185,28,28,0.08);
  --warn-bg:   rgba(161,98,7,0.10);

  /* Status/risk badges: same semantic families as --pos/--neg/--warn/--info
     above, tuned for use as chip text on a light tint (see [data-theme="dark"]
     for the brighter values these swap to on a dark tint). --status-elevated
     is the one tier with no plain-text equivalent — it sits between
     --warn and --neg for risk levels more severe than "watch" but short of
     "high". */
  --status-stable-fg:    var(--pos);
  --status-stable-bg:    rgba(4,120,87,0.12);
  --status-watch-fg:     var(--warn);
  --status-watch-bg:     rgba(161,98,7,0.06);   /* 0.12 measured 4.2:1, fails AA at this text size */
  --status-elevated-fg:  #C2410C;
  --status-elevated-bg:  rgba(194,65,12,0.06);  /* 0.12 measured 4.4:1, fails AA at this text size */
  --status-high-fg:      var(--neg);
  --status-high-bg:      rgba(185,28,28,0.15);
  --status-insulated-fg: var(--info);
  --status-insulated-bg: rgba(30,64,175,0.12);

  --font-sans: "Geist", "Inter Tight", system-ui, -apple-system, sans-serif;
  --font-mono: "Geist Mono", "JetBrains Mono", ui-monospace, monospace;

  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);

  /* ── Spacing ─────────────────────────────────────────────────────────────────
     1:1 tokenization of values already in use across the app (a dense "fintech
     terminal" layout intentionally uses more than a strict 4/8pt grid) — this
     names today's values rather than forcing a stricter scale. For new
     spacing, prefer the 4/8/12/16/20/24/32 subset where a choice is open. */
  --space-1: 1px;   --space-2: 2px;   --space-3: 3px;   --space-4: 4px;
  --space-5: 5px;   --space-6: 6px;   --space-7: 7px;   --space-8: 8px;
  --space-9: 9px;   --space-10: 10px; --space-11: 11px; --space-12: 12px;
  --space-13: 13px; --space-14: 14px; --space-16: 16px; --space-18: 18px;
  --space-20: 20px; --space-22: 22px; --space-24: 24px; --space-28: 28px;
  --space-32: 32px; --space-36: 36px; --space-80: 80px;

  /* ── Radius ──────────────────────────────────────────────────────────────────
     Six distinct component tiers already in consistent use (legend
     dots/swatches, badges/pills, small controls, nav/tabs/chips, list rows,
     cards) — named rather than merged, since collapsing any of them would be
     a visible shape change to real components. */
  --radius-2xs: 2px;  /* legend dots, tiny swatches */
  --radius-xs:  3px;  /* badges, pills, progress-bar fill */
  --radius-sm:  4px;  /* small buttons/inputs */
  --radius-md:  5px;  /* nav rail items, tabs, chips */
  --radius-lg:  6px;  /* larger inputs, list rows, bars */
  --radius-xl:  8px;  /* cards, panels */

  /* Chart.js gridlines/tooltips — read via getComputedStyle at chart-mount
     time (see A.chartTheme() in atoms.js) since Chart.js option colors are
     static once a chart is created. */
  --chart-grid:       rgba(0,0,0,0.04);
  --chart-tooltip-bg: rgba(10,10,10,0.88);
}

/* ── Dark mode tokens ────────────────────────────────────────────────────────── */
[data-theme="dark"] {
  --bg:        #111110;
  --bg-2:      #18180F;
  --bg-3:      #1E1E18;
  --ink:       #090908;
  --ink-2:     #0C0C0B;
  --ink-3:     #181816;
  --text-1:    #F2F0EC;
  --text-2:    #BDB9B1;
  --text-3:    #7A7670;
  --text-4:    #8A8680;  /* was #504C48 — 2.2:1 on dark bg, fails WCAG AA; now 5.2:1 */
  --rule:      #2A2826;
  --rule-2:    #363430;
  --rule-on-ink:   rgba(255,255,255,0.07);
  --text-on-ink:   #F2F0EC;
  --text-on-ink-2: rgba(242,240,236,0.55);
  --text-on-ink-3: rgba(242,240,236,0.35);
  --pos-bg:    rgba(4,120,87,0.12);
  --neg-bg:    rgba(185,28,28,0.12);
  --warn-bg:   rgba(161,98,7,0.14);

  /* Brighter than the light-mode chip colors above (which are tuned as dark
     text on a light tint) — these read correctly as light text on a dark
     tint instead. Same five status tiers, same hue families. */
  --status-stable-fg:    #34d399;
  --status-stable-bg:    rgba(52,211,153,0.16);
  --status-watch-fg:     #FBBF24;
  --status-watch-bg:     rgba(251,191,36,0.16);
  --status-elevated-fg:  #FB923C;
  --status-elevated-bg:  rgba(251,146,60,0.16);
  --status-high-fg:      #F87171;
  --status-high-bg:      rgba(248,113,113,0.18);
  --status-insulated-fg: #3b82f6;
  --status-insulated-bg: rgba(59,130,246,0.16);

  --chart-grid: rgba(255,255,255,0.06);
}

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text-1);
  font-family: var(--font-sans);
  font-size: 13px;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-feature-settings: "ss01", "cv11";
}
a { color: inherit; text-decoration: none; }
button { cursor: pointer; border: none; background: none; font: inherit; color: inherit; }
.num { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.mono { font-family: var(--font-mono); }

/* ── Shell ───────────────────────────────────────────────────────────────────── */
.shell {
  display: grid;
  grid-template-columns: 216px 1fr;
  min-height: 100vh;
}

/* ── Sidebar / Rail ──────────────────────────────────────────────────────────── */
.rail {
  background: var(--ink);
  border-right: 1px solid rgba(255,255,255,0.07);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  z-index: 100;
}

.rail__brand {
  padding: 18px 18px 16px;
  border-bottom: 1px solid var(--rule-on-ink);
  display: flex;
  align-items: center;
  gap: 10px;
}
.rail__mark {
  width: 28px; height: 28px;
  background: #FFFFFF;
  color: var(--ink);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 11px;
  border-radius: 5px;
  letter-spacing: 0.02em;
  flex-shrink: 0;
}
.rail__title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-on-ink);
  letter-spacing: -0.015em;
  line-height: 1.2;
}
.rail__title .badge {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 5px;
  border-radius: 3px;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.12);
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 500;
  color: var(--text-on-ink-2);
  letter-spacing: 0.02em;
  text-transform: uppercase;
  vertical-align: middle;
}
.rail__sub {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-on-ink-3);
  margin-top: 1px;
}

.rail__switch {
  margin: 14px 12px 8px;
  padding: 9px 12px;
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(255,255,255,0.05);
  border-radius: 6px;
  font-size: 12px;
  color: var(--text-on-ink-2);
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
}
.rail__switch:hover { border-color: rgba(255,255,255,0.20); }
.rail__switch-left { display: flex; align-items: center; gap: 8px; }
.rail__switch-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: #5EC78F;
  box-shadow: 0 0 0 3px rgba(94,199,143,0.25);
}
.rail__switch-chev { color: var(--text-on-ink-3); }

.rail__hdr {
  padding: 14px 18px 6px;
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-on-ink-3);
}

.rail__nav { padding: 0 10px; }

.rail__item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  border-radius: 5px;
  font-size: 13px;
  color: var(--text-on-ink-2);
  cursor: pointer;
  transition: background 100ms, color 100ms;
  line-height: 1;
  user-select: none;
}
.rail__item .ic {
  opacity: 0.55;
  width: 14px;
  flex-shrink: 0;
  color: currentColor;
}
.rail__item:hover { background: rgba(255,255,255,0.07); color: var(--text-on-ink); }
.rail__item:hover .ic { opacity: 0.9; }
.rail__item.active { background: #FFFFFF; color: var(--ink); }
.rail__item.active .ic { opacity: 1; color: var(--ink); }
.rail__item .kbd {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-on-ink-3);
  padding: 1px 4px;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 3px;
  background: rgba(255,255,255,0.05);
  line-height: 1;
}
.rail__item.active .kbd {
  color: var(--text-3);
  background: var(--bg-2);
  border-color: var(--rule);
}

.rail__spacer { flex: 1; }

.rail__foot {
  padding: 14px 16px;
  border-top: 1px solid var(--rule-on-ink);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.rail__userbox {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px;
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: 6px;
  background: rgba(255,255,255,0.05);
}
.rail__avatar {
  width: 24px; height: 24px;
  border-radius: 50%;
  background: linear-gradient(135deg, #555 0%, #333 100%);
  flex-shrink: 0;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 600;
}
.rail__user-name { font-size: 12px; font-weight: 500; color: var(--text-on-ink); line-height: 1.2; }
.rail__user-sub { font-size: 10.5px; color: var(--text-on-ink-3); font-family: var(--font-mono); }

/* ── Main column ─────────────────────────────────────────────────────────────── */
.main-col { display: flex; flex-direction: column; min-width: 0; }

/* ── Command bar / Topbar ────────────────────────────────────────────────────── */
.cmdbar {
  background: var(--ink-2);
  border-bottom: 1px solid rgba(255,255,255,0.07);
  padding: 0 24px;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 50;
}

.crumbs {
  font-size: 12.5px;
  color: var(--text-on-ink-3);
  display: flex;
  align-items: center;
  gap: 8px;
}
.crumbs .sep { color: var(--text-on-ink-3); }
.crumbs .here { color: var(--text-on-ink); font-weight: 500; }

.cmd-search {
  flex: 1;
  max-width: 380px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: 6px;
  background: rgba(255,255,255,0.06);
  color: var(--text-on-ink-2);
  font-size: 12.5px;
  cursor: text;
}
.cmd-search:hover { border-color: rgba(255,255,255,0.18); }
.cmd-search .icon { color: var(--text-on-ink-3); flex-shrink: 0; }
.cmd-search .kbd-hint {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-on-ink-3);
  padding: 1px 4px;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 3px;
  background: rgba(255,255,255,0.05);
  line-height: 1;
}

.cmd-actions { display: flex; align-items: center; gap: 8px; }

.live-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 10px;
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: 5px;
  background: rgba(255,255,255,0.06);
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-on-ink-2);
  letter-spacing: 0.02em;
}
.live-pill .dot {
  width: 6px; height: 6px;
  background: #5EC78F;
  border-radius: 50%;
  box-shadow: 0 0 0 3px rgba(94,199,143,0.25);
  animation: pulse 2.5s ease-in-out infinite;
}
@keyframes pulse { 0%,100%{opacity:1;transform:scale(1)} 50%{opacity:.5;transform:scale(0.85)} }

.ask-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: #FFFFFF;
  color: var(--ink);
  border-radius: 6px;
  padding: 7px 13px;
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1;
}
.ask-btn:hover { background: var(--bg-2); }
.ask-btn .ai-glyph {
  width: 14px; height: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* ── Hero (dark section) ─────────────────────────────────────────────────────── */
.hero {
  background: var(--ink);
  color: var(--text-on-ink);
  padding: 28px 28px 24px;
  position: relative;
  overflow: hidden;
}
.hero::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.03) 1px, transparent 1px);
  background-size: 32px 32px;
  background-position: -1px -1px;
  pointer-events: none;
  mask-image: radial-gradient(circle at 80% 0%, rgba(0,0,0,1) 0%, rgba(0,0,0,0.2) 80%);
}
.hero__inner { position: relative; z-index: 1; }

.hero__row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: end;
  gap: 28px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--rule-on-ink);
  margin-bottom: 22px;
}
.hero__eyebrow {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.06em;
  color: var(--text-on-ink-3);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.hero__eyebrow .tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 7px;
  border: 1px solid var(--rule-on-ink);
  border-radius: 3px;
  color: var(--text-on-ink-2);
  font-size: 10px;
  letter-spacing: 0.04em;
}
.hero__eyebrow .tag .dot {
  width: 5px; height: 5px;
  border-radius: 50%;
  background: #5EC78F;
}
.hero__title {
  font-size: 28px;
  font-weight: 500;
  letter-spacing: -0.025em;
  line-height: 1.1;
  color: var(--text-on-ink);
}
.hero__title .accent { color: var(--text-on-ink-2); }
.hero__title .num-callout {
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--pos-on-ink);
  font-size: 28px;
  margin: 0 3px;
}
.hero__filters {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 11px;
}
.hero__filter {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border: 1px solid var(--rule-on-ink);
  border-radius: 5px;
  color: var(--text-on-ink-2);
  background: rgba(255,255,255,0.02);
  cursor: pointer;
}
.hero__filter .lbl-mini { color: var(--text-on-ink-3); margin-right: 4px; }

.hero__stats {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 0;
}
.hero__stat {
  padding: 0 20px;
  border-left: 1px solid var(--rule-on-ink);
}
.hero__stat:first-child { padding-left: 0; border-left: none; }
.hero__stat-lbl {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color: var(--text-on-ink-3);
  margin-bottom: 8px;
}
.hero__stat-val {
  font-size: 22px;
  font-weight: 500;
  letter-spacing: -0.02em;
  color: var(--text-on-ink);
  font-variant-numeric: tabular-nums;
  line-height: 1;
  display: flex;
  align-items: baseline;
  gap: 4px;
}
.hero__stat-val .unit {
  font-size: 11px;
  color: var(--text-on-ink-2);
  font-weight: 400;
  font-family: var(--font-mono);
}
.hero__stat-delta {
  margin-top: 7px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--text-on-ink-2);
  display: flex;
  align-items: center;
  gap: 5px;
}
.delta-pos { color: var(--pos-on-ink); }
.delta-neg { color: var(--neg-on-ink); }
.delta-warn { color: var(--warn-on-ink); }
.delta-mute { color: var(--text-on-ink-3); }

/* ── Page body ───────────────────────────────────────────────────────────────── */
.page-body {
  padding: 24px;
  flex: 1;
}

/* Section heading */
.sec-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 28px 0 14px;
}
.sec-head:first-child { margin-top: 0; }
.sec-head__title {
  font-size: 14.5px;
  font-weight: 700;
  color: var(--text-1);
  letter-spacing: -0.01em;
}
.sec-head__title .count {
  color: var(--text-3);
  font-weight: 400;
  margin-left: 6px;
  font-family: var(--font-mono);
  font-size: 12px;
}
.sec-head__sub {
  margin-left: 12px;
  font-size: 12px;
  color: var(--text-3);
}
.sec-head__actions { display: flex; align-items: center; gap: 6px; }
.sec-head__tab {
  padding: 5px 10px;
  font-size: 12px;
  font-family: var(--font-mono);
  color: var(--text-3);
  border: 1px solid var(--rule);
  border-radius: 5px;
  cursor: pointer;
  background: var(--bg);
  line-height: 1;
}
.sec-head__tab:hover { color: var(--text-1); border-color: var(--rule-2); }
.sec-head__tab.active { background: var(--ink); color: var(--text-on-ink); border-color: var(--ink); }
.sec-head__tab.tab-sparse { opacity: 0.45; }
.sec-head__tab.tab-sparse:hover { opacity: 0.75; }
.sec-head__tab.tab-sparse.active { opacity: 1; }

/* Panel */
.panel {
  background: var(--bg);
  border: 1px solid var(--rule);
  border-radius: 8px;
  overflow: hidden;
}
.panel__head {
  padding: 10px 14px;
  border-bottom: 1px solid var(--rule);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-2);
}
.panel__title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-1);
  letter-spacing: -0.01em;
}
.panel__sub {
  margin-left: 8px;
  font-size: 11.5px;
  color: var(--text-3);
  font-family: var(--font-mono);
}
.panel__meta {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--text-3);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.panel__body { padding: 14px 16px 16px; }

/* ── KPI tiles ───────────────────────────────────────────────────────────────── */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(148px, 1fr));
  gap: 12px;
}
.kpi-tile {
  background: var(--bg);
  border: 1px solid var(--rule);
  border-radius: 8px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: box-shadow 0.15s, transform 0.15s;
}
.kpi-tile:hover { transform: translateY(-1px); box-shadow: 0 4px 14px rgba(0,0,0,0.07); }
.kpi-tile.kpi-pos { border-left: 3px solid var(--pos); }
.kpi-tile.kpi-neg { border-left: 3px solid var(--neg); }
.kpi-tile__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.kpi-tile__lbl {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.04em;
  color: var(--text-3);
}
.kpi-tile__val {
  font-size: 24px;
  font-weight: 600;
  color: var(--text-1);
  letter-spacing: -0.025em;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}
.kpi-tile__val .unit {
  font-size: 12px;
  color: var(--text-3);
  margin-left: 2px;
  font-weight: 400;
  font-family: var(--font-mono);
}
.kpi-tile__delta {
  margin-top: 8px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--text-2);
  display: flex;
  align-items: center;
  gap: 5px;
}
.d-pos { color: var(--pos); }
.d-neg { color: var(--neg); }
.d-warn { color: var(--warn); }
.kpi-tile__spark { margin-top: 10px; }
.kpi-tile__spark svg { display: block; }
.kpi-tile__spark path.spark-line { fill: none; stroke: var(--text-3); stroke-width: 1.1; }
.kpi-tile__spark path.spark-line.pos { stroke: var(--pos); }
.kpi-tile__spark path.spark-line.neg { stroke: var(--neg); }
.kpi-tile__spark circle.dot { fill: var(--text-2); }

/* ── Two-col layout ──────────────────────────────────────────────────────────── */
.row-2 {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: 12px;
}
.row-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 12px;
}

/* ── CSS bar chart ───────────────────────────────────────────────────────────── */
.bar-chart { display: flex; flex-direction: column; gap: 6px; }
.bar-row {
  display: grid;
  grid-template-columns: 110px 1fr 56px;
  align-items: center;
  gap: 12px;
  font-size: 12px;
}
.bar-row__label {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-1);
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.bar-row__flag {
  width: 18px; height: 12px;
  flex-shrink: 0;
  border: 1px solid var(--rule);
  border-radius: 2px;
  background-position: center;
  background-size: cover;
}
.bar-row__track {
  position: relative;
  height: 14px;
  background: var(--bg-3);
  border-radius: 3px;
  overflow: hidden;
}
.bar-row__bar {
  position: absolute;
  top: 0; bottom: 0;
  background: var(--ink-2);
  border-radius: 2px;
  transition: width 0.4s var(--ease-out);
}
.bar-row__bar.bar-pos { background: var(--pos); }
.bar-row__bar.bar-neg { background: var(--neg); }
.bar-row__bar.bar-warn { background: var(--warn); }
.bar-row__zero {
  position: absolute;
  top: -2px; bottom: -2px;
  width: 1px;
  background: var(--text-3);
}
.bar-row__val {
  text-align: right;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 11.5px;
  color: var(--text-1);
  font-weight: 500;
}
.bar-row__val.v-pos { color: var(--pos); }
.bar-row__val.v-neg { color: var(--neg); }
.bar-row__val.v-warn { color: var(--warn); }

/* ── Ranking table ───────────────────────────────────────────────────────────── */
.rank-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
}
.rank-table thead th {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--text-3);
  font-weight: 500;
  padding: 10px 14px;
  background: var(--bg-2);
  border-bottom: 1px solid var(--rule);
  text-align: right;
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.rank-table thead th:nth-child(1),
.rank-table thead th:nth-child(2),
.rank-table thead th:nth-child(3) { text-align: left; }
.rank-table thead th:last-child { text-align: left; }

.rank-table tbody td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--rule);
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  text-align: right;
  color: var(--text-1);
  font-size: 12px;
}
.rank-table tbody tr:last-child td { border-bottom: none; }
.rank-table tbody tr:hover td { background: var(--bg-2); cursor: pointer; }

/* Plain data-table header cell (e.g. Data sources table) */
.tbl-th {
  padding: var(--space-8) var(--space-14);
  text-align: left;
  color: var(--text-3);
  font-weight: 600;
  font-size: 11px;
  letter-spacing: 0.03em;
}

/* Eyebrow-style section heading above a list (e.g. Key risks / Upside factors) */
.eyebrow-lbl {
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-4);
  margin-bottom: var(--space-10);
}

/* Section spacing utility — repeated verbatim across panel/row-2 wrappers */
.mb-20 { margin-bottom: var(--space-20); }
.col-no { text-align: left !important; width: 36px; color: var(--text-3); font-size: 11.5px; }
.col-flag { text-align: left !important; width: 28px; }
.col-name { text-align: left !important; font-family: var(--font-sans) !important; }
.col-spark { text-align: left !important; width: 96px; }

.risk-pill {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: .04em;
  padding: 2px 6px;
  border-radius: 3px;
  white-space: nowrap;
}
.risk-stable   { background: var(--status-stable-bg);   color: var(--status-stable-fg); }
.risk-watch    { background: var(--status-watch-bg);    color: var(--status-watch-fg); }
.risk-elevated { background: var(--status-elevated-bg); color: var(--status-elevated-fg); }
.risk-high     { background: var(--status-high-bg);      color: var(--status-high-fg); }

/* ── AI Economy page ──────────────────────────────────────────────────────────── */
.ai-risk-badge {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: .04em;
  padding: 2px 6px;
  border-radius: 3px;
  text-transform: uppercase;
  white-space: nowrap;
}
.ai-risk-zone          { background: var(--status-high-bg);      color: var(--status-high-fg); }
.ai-risk-managed       { background: var(--status-stable-bg);    color: var(--status-stable-fg); }
.ai-risk-insulated     { background: var(--status-insulated-bg); color: var(--status-insulated-fg); }
.ai-risk-transitioning { background: var(--status-watch-bg);     color: var(--status-watch-fg); }

@keyframes shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
/* Skeleton loader — used during data load instead of spinner */
.skel {
  background: linear-gradient(90deg, var(--bg-2) 25%, var(--bg-3) 50%, var(--bg-2) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s ease-in-out infinite;
  border-radius: 4px;
}
.skel-block {
  border-radius: 8px;
  border: 1px solid var(--rule);
  overflow: hidden;
  background: var(--bg);
}
.skel-hero { height: 148px; margin-bottom: 24px; }
.skel-row  { display: grid; grid-template-columns: repeat(auto-fit, minmax(148px, 1fr)); gap: 12px; margin-bottom: 12px; }
.skel-tile { height: 100px; }
.skel-panel { height: 260px; margin-bottom: 12px; }
.ai-editorial-p { margin: 0 0 14px; line-height: 1.7; font-size: 13px; color: var(--text-2); }
.ai-editorial-p:last-child { margin-bottom: 0; }
.ai-editorial-sidebar { border-left: 1px solid var(--rule); padding-left: 20px; }
.ai-editorial-sidebar__hd { font-family: var(--font-mono); font-size: 10px; text-transform: uppercase;
  letter-spacing: .08em; color: var(--text-4); margin-bottom: 10px; }
.ai-editorial-sidebar__row { display: flex; justify-content: space-between; align-items: baseline;
  padding: 5px 0; border-bottom: 1px solid rgba(0,0,0,.04); font-size: 12px; color: var(--text-2); }
.ai-editorial-sidebar__score { font-family: var(--font-mono); font-size: 11px; color: var(--text-3); }

.ai-driver-block, .ai-risk-block {
  padding: 10px 12px; border-radius: 6px; font-size: 12.5px; line-height: 1.55; margin-bottom: 2px;
}
.ai-driver-block { background: rgba(4,120,87,0.06); border: 1px solid rgba(4,120,87,0.15); }
.ai-risk-block   { background: rgba(161,98,7,0.06);  border: 1px solid rgba(161,98,7,0.15);  }
.ai-driver-block__label { font-family: var(--font-mono); font-size: 10px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .06em; color: var(--pos); margin-bottom: 5px; }
.ai-risk-block__label   { font-family: var(--font-mono); font-size: 10px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .06em; color: var(--warn); margin-bottom: 5px; }
.ai-driver-block__text, .ai-risk-block__text { color: var(--text-2); line-height: 1.55; font-size: 12.5px; }

.ai-reasons-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 5px; }
.ai-reasons-list li { font-size: 12px; color: var(--text-2); line-height: 1.5;
  padding-left: 14px; position: relative; }
.ai-reasons-list li::before { content: '·'; position: absolute; left: 2px;
  color: var(--text-4); font-weight: 700; }
.ai-reasons-list--pos li::before { color: var(--pos); }
.ai-reasons-label { font-family: var(--font-mono); font-size: 10px; color: var(--text-3);
  text-transform: uppercase; letter-spacing: .04em; margin-bottom: 6px; margin-top: 14px; }

.country-cell {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-1);
  font-family: var(--font-sans);
}
.country-cell .sub {
  color: var(--text-3);
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 400;
}
.flag-rect {
  width: 22px; height: 15px;
  border: 1px solid var(--rule);
  background-size: cover;
  background-position: center;
  border-radius: 2px;
  flex-shrink: 0;
  display: inline-block;
}
.v-pos { color: var(--pos); }
.v-neg { color: var(--neg); }
.v-warn { color: var(--warn); }
.v-mute { color: var(--text-3); }
.src-tag { font-size: 9.5px; font-family: var(--font-mono); color: var(--text-4); opacity: .85; }

/* Inline sparkline */
.spark { display: block; }
.spark path.spark-line { fill: none; stroke: var(--text-2); stroke-width: 1.2; vector-effect: non-scaling-stroke; }
.spark path.spark-line.pos { stroke: var(--pos); }
.spark path.spark-line.neg { stroke: var(--neg); }
.spark circle.dot { fill: var(--text-2); }

/* ── Risk register rows ──────────────────────────────────────────────────────── */
.risk-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 11px 16px;
  border-bottom: 1px solid var(--rule);
  font-size: 12.5px;
  cursor: pointer;
}
.risk-row:last-child { border-bottom: none; }
.risk-row:hover { background: var(--bg-2); }
.risk-row__main { display: flex; flex-direction: column; gap: 4px; }
.risk-row__country {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-1);
}
.risk-row__country .flag-rect { width: 16px; height: 11px; }
.risk-row__desc {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--text-3);
  line-height: 1.4;
}
.risk-row__val {
  text-align: right;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 15px;
  font-weight: 500;
  color: var(--text-1);
}
.risk-row__val .sub {
  display: block;
  font-size: 9.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-3);
  font-weight: 400;
  margin-top: 2px;
}

/* ── Country profile ─────────────────────────────────────────────────────────── */
.profile-hero {
  background: var(--ink);
  color: var(--text-on-ink);
  padding: 28px 28px 24px;
  position: relative;
  overflow: hidden;
}
.profile-hero::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.03) 1px, transparent 1px);
  background-size: 32px 32px;
  pointer-events: none;
  mask-image: radial-gradient(circle at 70% 50%, rgba(0,0,0,0.8) 0%, rgba(0,0,0,0.1) 80%);
}
.profile-hero__inner {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 24px;
}
.profile-hero__flag {
  width: 64px; height: 43px;
  border-radius: 4px;
  border: 1px solid rgba(255,255,255,0.15);
  background-size: cover;
  background-position: center;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}
.profile-hero__meta { flex: 1; }
.profile-hero__name {
  font-size: 30px;
  font-weight: 600;
  letter-spacing: -0.03em;
  color: var(--text-on-ink);
  line-height: 1;
}
.profile-hero__region {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color: var(--text-on-ink-3);
  margin-top: 6px;
}
.profile-hero__stats {
  display: flex;
  gap: 32px;
  margin-top: 20px;
  flex-wrap: wrap;
}
.profile-hero__stat-lbl {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color: var(--text-on-ink-3);
  margin-bottom: 5px;
}
.profile-hero__stat-val {
  font-size: 20px;
  font-weight: 500;
  letter-spacing: -0.02em;
  color: var(--text-on-ink);
  font-variant-numeric: tabular-nums;
}

.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  color: var(--text-3);
  padding: 5px 0;
  transition: color 0.15s;
  font-family: var(--font-mono);
  margin-bottom: 0;
}
.back-btn:hover { color: var(--text-1); cursor: pointer; }

/* Analyst commentary block */
.analyst-block {
  background: var(--bg);
  border: 1px solid var(--rule);
  border-radius: 8px;
  overflow: hidden;
}
.analyst-block__head {
  padding: 10px 14px;
  border-bottom: 1px solid var(--rule);
  background: var(--bg-2);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.analyst-block__title {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-2);
  font-weight: 600;
}
.analyst-block__actions { display: flex; align-items: center; gap: 6px; }
.analyst-btn {
  padding: 4px 10px;
  font-size: 11.5px;
  border: 1px solid var(--rule);
  border-radius: 4px;
  background: var(--bg);
  color: var(--text-2);
  cursor: pointer;
  font-family: var(--font-mono);
}
.analyst-btn:hover { background: var(--bg-3); }
.analyst-btn.primary { background: var(--ink); color: var(--text-on-ink); border-color: var(--ink); }
.analyst-body { padding: 14px; min-height: 80px; }
.analyst-textarea {
  width: 100%;
  min-height: 100px;
  resize: vertical;
  border: none;
  outline: none;
  font-family: var(--font-sans);
  font-size: 13px;
  color: var(--text-1);
  line-height: 1.6;
  background: transparent;
}
.analyst-draft {
  font-size: 13px;
  color: var(--text-2);
  line-height: 1.6;
  font-style: italic;
}
.analyst-saved { font-size: 13px; color: var(--text-1); line-height: 1.6; }
.analyst-empty {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--text-4);
}
.analyst-foot {
  padding: 8px 14px;
  border-top: 1px solid var(--rule);
  background: var(--bg-2);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--text-3);
}

.chart-panel {
  background: var(--bg);
  border: 1px solid var(--rule);
  border-radius: 8px;
  overflow: hidden;
}
.chart-panel__head {
  padding: 10px 14px;
  border-bottom: 1px solid var(--rule);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.chart-panel__title { font-size: 12.5px; font-weight: 600; color: var(--text-1); letter-spacing: -0.005em; }
.chart-panel__sub { font-family: var(--font-mono); font-size: 10.5px; color: var(--text-3); }
.chart-panel__body { padding: 12px 14px; height: 180px; position: relative; }

/* vs-median bar chart in profile */
.standing-grid { display: flex; flex-direction: column; gap: 10px; padding: 14px 16px; }
.standing-row { display: flex; align-items: center; gap: 10px; }
.standing-lbl { width: 100px; font-family: var(--font-mono); font-size: 10.5px; color: var(--text-3); }
.standing-bars { flex: 1; display: flex; flex-direction: column; gap: 3px; }
.standing-bar-wrap { position: relative; height: 8px; background: var(--bg-3); border-radius: 3px; overflow: hidden; }
.standing-bar-fill { position: absolute; top: 0; bottom: 0; left: 0; border-radius: 3px; }
.standing-bar-country { background: var(--ink); }
.standing-bar-median { background: var(--text-4); }
.standing-val { width: 50px; text-align: right; font-family: var(--font-mono); font-size: 11px; color: var(--text-1); font-weight: 500; }
.standing-legend { display: flex; align-items: center; gap: 12px; font-family: var(--font-mono); font-size: 10px; color: var(--text-3); padding: 0 16px 12px; }
.standing-legend-dot { width: 8px; height: 8px; border-radius: 2px; }

/* ── OECD-style country analysis sections ────────────────────────────────────── */
.brief-kf {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 6px 16px;
  margin-bottom: 18px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--rule);
}
.brief-kf__row { display: flex; flex-direction: column; gap: 2px; }
.brief-kf__lbl {
  font-size: 10px;
  color: var(--text-4);
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: .05em;
}
.brief-kf__val { font-size: 13px; font-weight: 600; color: var(--text-1); } /* --ink is near-black in dark mode */
.brief-kf__yr  { font-size: 10px; color: var(--text-4); font-family: var(--font-mono); }

.brief-section { margin-bottom: 18px; }
.brief-section:last-child { margin-bottom: 0; }
.brief-section__hd {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: .08em;
  margin-bottom: 7px;
  font-family: var(--font-mono);
  padding-bottom: 5px;
  border-bottom: 1px solid var(--rule);
}
.brief-section__body {
  margin: 0;
  font-size: 13px;
  line-height: 1.75;
  color: var(--text-2);
}
.brief-section__body strong { color: var(--text-1); font-weight: 600; }

/* ── OECD-style country brief panel ─────────────────────────────────────────── */
.country-brief {
  background: var(--bg);
  border: 1px solid var(--rule);
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 20px;
}
.country-brief__head {
  padding: 16px 20px 14px;
  border-bottom: 1px solid var(--rule);
  background: var(--bg-2);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}
.country-brief__headline {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-1); /* --ink is near-black in dark mode; --text-1 matches it in light mode */
  line-height: 1.4;
  margin-bottom: 5px;
  letter-spacing: -0.015em;
}
.country-brief__vintage {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-4);
}
.country-brief__actions { display: flex; gap: 6px; flex-shrink: 0; align-items: flex-start; }
.country-brief__foot {
  padding: 10px 20px;
  border-top: 1px solid var(--rule);
  background: var(--bg-2);
}
/* ── Methodology / data vintage footer ──────────────────────────────────────── */
.brief-methodology { display: flex; flex-direction: column; gap: 8px; }
.brief-method__title {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-4);
  font-weight: 600;
}
.brief-method__grid {
  display: grid;
  grid-template-columns: auto auto auto;
  gap: 3px 14px;
  font-size: 11px;
  color: var(--text-3);
  width: fit-content;
}
.brief-method__grid .m-ind  { color: var(--text-2); font-weight: 500; }
.brief-method__grid .m-src  { color: var(--text-4); font-family: var(--font-mono); font-size: 10px; }
.brief-method__grid .m-yr   { color: var(--text-2); font-family: var(--font-mono); font-size: 10px; font-weight: 600; }
.brief-method__note {
  font-size: 10px;
  color: var(--text-4);
  font-family: var(--font-mono);
  line-height: 1.65;
  border-top: 1px solid var(--rule);
  padding-top: 8px;
  margin-top: 4px;
}
.period-badge {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 3px;
  background: rgba(4,120,87,0.12);
  color: var(--pos);
  letter-spacing: 0.04em;
  vertical-align: middle;
}

/* Section row: text left + chart right */
.country-section-row {
  display: grid;
  grid-template-columns: 55fr 45fr;
  border-bottom: 1px solid var(--rule);
}
.country-section-row:last-of-type { border-bottom: none; }
.country-section__text {
  padding: 20px 22px;
  border-right: 1px solid var(--rule);
}
.country-section__chart {
  padding: 14px 16px;
  background: var(--bg-2);
  display: flex;
  flex-direction: column;
  justify-content: center;
}

/* Chart panels inside section rows */
.chart-panel--mini .chart-panel__body { height: 110px; }

/* Key facts strip inside brief */
.country-brief .brief-kf {
  margin: 16px 20px;
  padding-bottom: 16px;
}

/* Section heading in brief rows */
.country-section__text .brief-section__hd {
  margin-bottom: 10px;
  padding-bottom: 6px;
}

/* Responsive: stack on narrow screens */
@media (max-width: 800px) {
  .country-section-row { grid-template-columns: 1fr; }
  .country-section__text { border-right: none; border-bottom: 1px solid var(--rule); }
}

/* ── Flags page ──────────────────────────────────────────────────────────────── */
.flags-section { margin-bottom: 28px; }
.flags-section-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-1);
  letter-spacing: -0.005em;
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--rule);
}
.flag-item {
  display: grid;
  grid-template-columns: 30px 22px 1fr auto auto;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border-bottom: 1px solid var(--rule);
  background: var(--bg);
  border-radius: 0;
  cursor: pointer;
  font-size: 12.5px;
}
.flag-item:first-child { border-radius: 8px 8px 0 0; }
.flag-item:last-child { border-bottom: none; border-radius: 0 0 8px 8px; }
.flag-item:hover { background: var(--bg-2); }
.flag-item__rank { font-family: var(--font-mono); color: var(--text-3); font-size: 11px; }
.flag-item__name { color: var(--text-1); font-weight: 500; }
.flag-item__desc { font-family: var(--font-mono); font-size: 10.5px; color: var(--text-3); }
.flag-item__val { font-family: var(--font-mono); font-weight: 500; font-size: 13px; text-align: right; }
.flag-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 3px;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.flag-badge.high   { background: var(--neg-bg);  color: var(--neg);  }
.flag-badge.medium { background: var(--warn-bg); color: var(--warn); }
.flag-badge.low    { background: var(--pos-bg);  color: var(--pos);  }

/* ── News page ───────────────────────────────────────────────────────────────── */
.news-list { display: flex; flex-direction: column; gap: 1px; }
.news-item {
  padding: 14px 16px;
  background: var(--bg);
  border-bottom: 1px solid var(--rule);
  display: flex;
  gap: 16px;
}
.news-item:first-child { border-radius: 8px 8px 0 0; }
.news-item:last-child { border-bottom: none; border-radius: 0 0 8px 8px; }
.news-item:hover { background: var(--bg-2); }
.news-item__source {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-3);
  white-space: nowrap;
  padding-top: 2px;
  min-width: 70px;
}
.news-item__body { flex: 1; }
.news-item__title {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-1);
  line-height: 1.4;
  margin-bottom: 4px;
}
.news-item__title a { color: inherit; }
.news-item__title a:hover { color: var(--ink-2); }
.news-item__meta { font-family: var(--font-mono); font-size: 10.5px; color: var(--text-3); }

/* ── Methodology section ─────────────────────────────────────────────────────── */
.methodology {
  margin-top: 28px;
  padding: 18px 20px;
  background: var(--bg-2);
  border: 1px solid var(--rule);
  border-radius: 8px;
  font-size: 12.5px;
  color: var(--text-2);
  line-height: 1.55;
}
.methodology h4 {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-1);
  margin-bottom: 6px;
  font-weight: 600;
}
.methodology a {
  color: var(--text-1);
  border-bottom: 1px solid var(--rule-2);
}
.methodology a:hover { border-color: var(--text-1); }

/* ── Page footer ─────────────────────────────────────────────────────────────── */
.page-foot {
  margin-top: 32px;
  padding: 18px 0 0;
  border-top: 1px solid var(--rule);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--text-3);
  letter-spacing: 0.02em;
}

/* ── News strip (footer) ─────────────────────────────────────────────────────── */
.news-strip {
  background: var(--ink);
  border-top: 1px solid var(--ink-3);
  color: var(--text-on-ink-2);
  display: flex;
  align-items: center;
  height: 30px;
  overflow: hidden;
  flex-shrink: 0;
}
.news-strip__lbl {
  flex-shrink: 0;
  padding: 0 14px;
  height: 100%;
  display: flex;
  align-items: center;
  gap: 7px;
  border-right: 1px solid var(--rule-on-ink);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color: var(--text-on-ink);
}
.news-strip__dot {
  width: 5px; height: 5px;
  background: #5EC78F;
  border-radius: 50%;
  box-shadow: 0 0 0 2px rgba(94,199,143,0.30);
  animation: pulse 2.6s ease-in-out infinite;
}
.news-strip__track {
  display: flex;
  gap: 36px;
  white-space: nowrap;
  padding-left: 16px;
  animation: ticker-scroll 120s linear infinite;
  font-family: var(--font-mono);
  font-size: 11.5px;
}
.news-strip__track:hover { animation-play-state: paused; }
.news-strip__item {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text-on-ink-2);
}
.news-strip__item a { color: inherit; transition: color 0.15s; }
.news-strip__item a:hover { color: var(--text-on-ink); }
.news-strip__src {
  color: var(--text-on-ink-3);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 10px;
}
@keyframes ticker-scroll { from { transform: translateX(0); } to { transform: translateX(-50%); } }

/* ── Loading spinner ─────────────────────────────────────────────────────────── */
.loading-spinner {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 80px 24px;
  gap: 16px;
  color: var(--text-3);
  font-family: var(--font-mono);
  font-size: 12px;
}
.spinner {
  width: 24px; height: 24px;
  border: 2px solid var(--rule);
  border-top-color: var(--ink);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Agent drawer ────────────────────────────────────────────────────────────── */
.agent-drawer-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(10,10,10,0.35);
  backdrop-filter: blur(2px);
}
.agent-drawer-backdrop.open { display: block; }

.agent-drawer {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  width: 420px;
  background: var(--bg);
  border-left: 1px solid var(--rule);
  z-index: 201;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.3s var(--ease-out);
  box-shadow: -8px 0 40px rgba(10,10,10,0.12);
}
.agent-drawer.open { transform: translateX(0); }

.agent-head {
  padding: 16px 20px;
  border-bottom: 1px solid var(--rule);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-2);
}
.agent-head-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-1);
  display: flex;
  align-items: center;
  gap: 8px;
  letter-spacing: -0.01em;
}
.agent-head-icon { color: var(--ink); font-size: 16px; }
.agent-close {
  font-size: 20px;
  color: var(--text-3);
  line-height: 1;
}
.agent-close:hover { color: var(--text-1); }

.agent-input-area {
  padding: 14px 16px;
  border-bottom: 1px solid var(--rule);
  display: flex;
  gap: 8px;
  background: var(--bg);
}
.agent-input {
  flex: 1;
  padding: 8px 12px;
  border: 1px solid var(--rule);
  border-radius: 6px;
  font-family: var(--font-sans);
  font-size: 13px;
  color: var(--text-1);
  background: var(--bg-2);
  outline: none;
  transition: border-color 0.15s;
}
.agent-input:focus { border-color: var(--rule-2); }
.agent-send {
  padding: 8px 14px;
  background: var(--ink);
  color: var(--text-on-ink);
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
}
.agent-send:hover { background: var(--ink-2); }
.agent-send:disabled { opacity: 0.5; cursor: not-allowed; }

.agent-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.agent-msg {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.agent-msg.user { align-items: flex-end; }
.agent-msg-label {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-3);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.agent-msg-text {
  max-width: 94%;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 13px;
  line-height: 1.5;
  background: var(--bg-2);
  border: 1px solid var(--rule);
  color: var(--text-1);
  white-space: pre-wrap;
  overflow-x: auto;
}
.agent-msg-text .ins-block { white-space: normal; }
.agent-msg.user .agent-msg-text {
  background: var(--ink);
  color: var(--text-on-ink);
  border-color: var(--ink);
}

.agent-foot {
  padding: 14px 16px;
  border-top: 1px solid var(--rule);
  background: var(--bg-2);
}
.agent-suggested { display: flex; flex-direction: column; gap: 6px; }
.agent-suggested label {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 2px;
}
.agent-sq {
  text-align: left;
  padding: 8px 12px;
  border: 1px solid var(--rule);
  border-radius: 6px;
  font-size: 12px;
  color: var(--text-2);
  background: var(--bg);
  line-height: 1.4;
  transition: all 100ms;
}
.agent-sq:hover { background: var(--bg-3); color: var(--text-1); border-color: var(--rule-2); }

/* ── Dark mode toggle button ─────────────────────────────────────────────────── */
.dark-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px; height: 32px;
  border-radius: 6px;
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(255,255,255,0.05);
  color: var(--text-on-ink-2);
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.12s, border-color 0.12s;
}
.dark-toggle:hover { background: rgba(255,255,255,0.10); border-color: rgba(255,255,255,0.20); }
.dark-toggle__icon { display: none; }
.dark-toggle__icon--sun  { display: block; }
[data-theme="dark"] .dark-toggle__icon--sun  { display: none; }
[data-theme="dark"] .dark-toggle__icon--moon { display: block; }

/* ── Mobile menu button (hidden on desktop) ──────────────────────────────────── */
.mobile-menu-btn {
  display: none;
  align-items: center;
  justify-content: center;
  width: 36px; height: 36px;
  border-radius: 5px;
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(255,255,255,0.05);
  color: var(--text-on-ink-2);
  cursor: pointer;
  flex-shrink: 0;
}
.mobile-menu-btn:hover { background: rgba(255,255,255,0.10); }

/* Rail backdrop overlay for mobile */
.rail-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 99;
  background: rgba(10,10,10,0.5);
  backdrop-filter: blur(2px);
}
.rail-backdrop.open { display: block; }

/* ── Page fade transition ─────────────────────────────────────────────────────── */
#page-root > * { animation: page-in 0.18s var(--ease-out) both; }
@keyframes page-in {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: none; }
}

/* ── Print ───────────────────────────────────────────────────────────────────── */
@media print {
  .rail, .cmdbar, .news-strip, .agent-drawer, .agent-drawer-backdrop { display: none !important; }
  .shell { grid-template-columns: 1fr; }
  body { background: white; }
}

/* ── Animations ──────────────────────────────────────────────────────────────── */
.hc-enter {
  opacity: 0;
  transform: translateY(10px);
  animation: hc-in 0.4s var(--ease-out) forwards;
}
@keyframes hc-in {
  to { opacity: 1; transform: translateY(0); }
}

/* Stagger for children */
.hc-enter:nth-child(1) { animation-delay: 0ms; }
.hc-enter:nth-child(2) { animation-delay: 60ms; }
.hc-enter:nth-child(3) { animation-delay: 120ms; }
.hc-enter:nth-child(4) { animation-delay: 180ms; }
.hc-enter:nth-child(5) { animation-delay: 240ms; }

/* Countries grid */
.country-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px;
}
.co-card {
  background: var(--bg);
  border: 1px solid var(--rule);
  border-radius: 8px;
  padding: 14px 16px;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s, box-shadow 0.15s, transform 0.15s;
}
.co-card:hover {
  background: var(--bg-2);
  border-color: var(--rule-2);
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(0,0,0,0.07);
}
.co-card__head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.co-flag {
  width: 36px; height: 24px;
  border: 1px solid var(--rule);
  border-radius: 2px;
  background-size: cover;
  background-position: center;
  flex-shrink: 0;
}
.co-name { font-size: 13px; font-weight: 600; color: var(--text-1); }
.co-region { font-family: var(--font-mono); font-size: 10px; color: var(--text-3); margin-top: 2px; text-transform: uppercase; letter-spacing: 0.06em; }
.co-card__stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding-top: 10px;
  border-top: 1px solid var(--rule);
}
.co-stat-label { font-family: var(--font-mono); font-size: 9.5px; color: var(--text-3); margin-bottom: 3px; letter-spacing: 0.06em; text-transform: uppercase; }
.co-stat-value { font-size: 13px; font-weight: 600; color: var(--text-1); font-variant-numeric: tabular-nums; font-family: var(--font-mono); }
.co-stat-value.good { color: var(--pos); }
.co-stat-value.bad  { color: var(--neg); }
.co-stat-value.warn { color: var(--warn); }

/* ── Responsive: tablet (icon-only rail) ─────────────────────────────────────── */
@media (max-width: 900px) {
  .shell { grid-template-columns: 56px 1fr; }

  .rail { width: 56px; overflow: visible; }
  .rail__brand { padding: 14px 0; justify-content: center; gap: 0; border-bottom: none; }
  .rail__mark  { margin: 0; }
  .rail__title, .rail__sub, .rail__hdr, .rail__switch,
  .rail__user-name, .rail__user-sub { display: none; }

  .rail__nav { padding: 0 6px; }
  .rail__item { justify-content: center; padding: 9px 0; gap: 0; }
  .rail__item .ic { opacity: 0.6; width: 16px; }
  .rail__item .kbd { display: none; }
  .rail__item.active .ic { opacity: 1; }

  .rail__foot { padding: 10px 0; align-items: center; gap: 8px; }
  .rail__userbox { padding: 5px; gap: 0; border: none; background: none; justify-content: center; }
  .dark-toggle { width: 28px; height: 28px; }

  .cmdbar { padding: 0 16px; }
  .cmd-search { max-width: 220px; }
}

/* ── Responsive: mobile (slide-in rail, stacked layout) ──────────────────────── */
@media (max-width: 640px) {
  .shell { grid-template-columns: 1fr; }

  .rail {
    position: fixed;
    left: -216px;
    top: 0;
    width: 216px;
    height: 100vh;
    z-index: 100;
    transition: left 0.22s var(--ease-out);
    overflow-y: auto;
    overflow-x: hidden;
  }
  .rail.open { left: 0; }

  /* Restore full rail content on mobile drawer */
  .rail__brand  { padding: 18px 18px 16px; justify-content: flex-start; gap: 10px; border-bottom: 1px solid var(--rule-on-ink); }
  .rail__title, .rail__sub, .rail__hdr, .rail__switch,
  .rail__user-name, .rail__user-sub { display: block; }
  .rail__nav    { padding: 0 10px; }
  .rail__item   { justify-content: flex-start; padding: 7px 10px; gap: 10px; }
  .rail__item .ic { opacity: 0.55; width: 14px; }
  .rail__item .kbd { display: inline-block; }
  .rail__foot   { padding: 14px 16px; align-items: stretch; }
  .rail__userbox{ padding: 7px; gap: 9px; border: 1px solid rgba(255,255,255,0.10); background: rgba(255,255,255,0.05); justify-content: flex-start; }
  .dark-toggle  { width: 32px; height: 32px; }

  /* Show hamburger */
  .mobile-menu-btn { display: flex; }

  /* Stacked layout */
  .page-body  { padding: 16px; }
  .hero       { padding: 20px 16px 16px; }
  .hero__row  { grid-template-columns: 1fr; gap: 16px; }
  .hero__filters { display: none; }
  .hero__stats { grid-template-columns: repeat(3, 1fr); gap: 0; }
  .hero__stat  { padding: 0 12px; }
  .hero__stat-val { font-size: 17px; }

  .row-2, .row-3 { grid-template-columns: 1fr; }

  /* Table: hide less important columns */
  .rank-table th:nth-child(n+7),
  .rank-table td:nth-child(n+7) { display: none; }

  /* Compare page indicator filters wrap tighter */
  .sec-head { flex-wrap: wrap; gap: 8px; margin: 20px 0 12px; }

  .cmd-search { display: none; }
  .cmdbar { padding: 0 16px; gap: 12px; }
  .crumbs { font-size: 12px; }

  .profile-hero { padding: 20px 16px 16px; }
  .profile-hero__stats { gap: 20px; }
  .profile-hero__name { font-size: 22px; }
  .profile-hero__flag { width: 48px; height: 32px; }

  /* AI Economy: 4-up KPI strip → 2-up; editorials stack */
  .ai-kpi-strip, .flags-kpi-strip { grid-template-columns: repeat(2, 1fr) !important; }
  .ai-editorial-grid { grid-template-columns: 1fr !important; gap: 18px !important; }
  .ai-editorial-grid > .ai-editorial-sidebar {
    border-left: none; padding-left: 0;
    border-top: 1px solid var(--rule); padding-top: 16px;
  }

  /* Overview global outlook: stack body + sidebar */
  .outlook-grid { grid-template-columns: 1fr !important; gap: 18px !important; }
  .outlook-grid > div:last-child {
    border-left: none !important; padding-left: 0 !important;
    border-top: 1px solid var(--rule); padding-top: 16px;
  }

  /* Wide data tables scroll horizontally instead of overflowing */
  .table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .table-scroll table { min-width: 520px; }

  /* Risk flags rows: drop the mono description, tighten columns */
  .flag-item { grid-template-columns: 22px 18px 1fr auto; gap: 8px; padding: 10px 12px; }
  .flag-item__desc { display: none; }

  /* News rows: stack source above headline */
  .news-item { flex-direction: column; gap: 4px; }
  .news-item__source { min-width: 0; }

  /* Scenario simulator: stack steppers above the readout */
  .scenario-grid { grid-template-columns: 1fr !important; }
}

/* ══ Presentation legibility ═══════════════════════════════════════════════════
   Lift the smallest labels one step so the dashboard reads on a shared screen.
   "Present" mode (header button, or ?present in the URL) goes further and scales
   the whole page body. */
.bar-row { grid-template-columns: 140px 1fr 62px; font-size: 13px; }
.hero__eyebrow { font-size: 12px; }
.hero__stat-lbl, .kpi-tile__lbl { font-size: 11px; }
.hero__stat-delta, .kpi-tile__delta { font-size: 12px; }
.sec-head__sub, .panel__sub, .panel__meta { font-size: 12px; }
.rank-table { font-size: 13.5px; }
.rank-table thead th { font-size: 11.5px; }
.rank-table tbody td { font-size: 13px; }
.ai-editorial-p { font-size: 14.5px; line-height: 1.7; }
.ai-editorial-sidebar__hd { font-size: 11px; }
.ai-editorial-sidebar__score { font-size: 12px; }
.methodology { font-size: 12.5px; }

.pill-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px; border-radius: 6px; cursor: pointer;
  font-family: var(--font-mono); font-size: 11.5px;
  color: var(--text-on-ink-2, #cfcfcf); background: transparent;
  border: 1px solid rgba(255,255,255,0.18);
}
.pill-btn:hover { border-color: rgba(255,255,255,0.4); color: var(--text-on-ink, #fff); }
.pill-btn[aria-pressed="true"] { background: rgba(255,255,255,0.12); color: var(--text-on-ink, #fff); border-color: rgba(255,255,255,0.45); }

html.present .page-body,
html.present .hero__inner { zoom: 1.14; }
html.present .agent-drawer { zoom: 1.1; }
@media (max-width: 1100px) { html.present .page-body, html.present .hero__inner { zoom: 1; } }

/* Projection outlook */
.projections-page { max-width: 1500px; }
.outlook-hero { position:relative; overflow:hidden; padding:30px; margin:0 0 20px; color:var(--text-on-ink); background:var(--ink); border-radius:var(--radius-lg); }
.outlook-hero::after { content:""; position:absolute; width:330px; height:330px; right:-90px; top:-170px; border:1px solid rgba(255,255,255,.12); border-radius:50%; box-shadow:0 0 0 48px rgba(255,255,255,.025),0 0 0 96px rgba(255,255,255,.018); }
.outlook-hero > * { position:relative; z-index:1; }
.outlook-hero h1 { margin:16px 0 8px; font-size:clamp(34px,5vw,64px); line-height:.95; letter-spacing:-.05em; }
.outlook-hero p { max-width:780px; margin:0; color:var(--text-on-ink-2); font-size:15px; line-height:1.6; }
.outlook-callouts { display:grid; grid-template-columns:repeat(4,1fr); gap:1px; margin-top:26px; background:rgba(255,255,255,.13); border:1px solid rgba(255,255,255,.13); }
.outlook-callouts div { background:var(--ink); padding:15px; font-size:13px; line-height:1.45; }
.outlook-callouts b { color:#fca5a5; font-weight:600; }
.outlook-table th small { display:block; margin-top:3px; font-weight:400; color:var(--text-3); white-space:nowrap; }
.projections-page .table-scroll { overflow-x:auto; -webkit-overflow-scrolling:touch; }
.outlook-table.rank-table thead th, .outlook-table.rank-table tbody td { padding-left:8px; padding-right:8px; }
.outlook-table td { min-width:112px; vertical-align:top; }
.outlook-table td:first-child { min-width:104px; position:sticky; left:0; z-index:2; background:var(--bg); }
.outlook-table .projection-cell { font-size:11px; white-space:normal; }
.outlook-table .projection-cell small, .outlook-table .projection-arrow { white-space:nowrap; }
.outlook-table .projection-cell small { font-size:10px; }
.outlook-table th small { font-size:10px; white-space:normal; }
.projection-cell { display:block; padding:4px 0; font-family:var(--font-mono); white-space:nowrap; }
.projection-cell small { color:var(--text-3); }
.projection-arrow { display:inline-block; margin-left:4px; font-size:10px; }
.projection-arrow.up { color:var(--pos); } .projection-arrow.down { color:var(--neg); }
.projection-chart { position:relative; height:360px; padding:16px; }
.projection-chart.fan { height:390px; }
.projection-controls { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:12px; margin-bottom:14px; }
.projection-controls label { display:grid; gap:6px; color:var(--text-3); font:500 10px var(--font-mono); text-transform:uppercase; letter-spacing:.06em; }
.projection-controls select { width:100%; padding:10px 12px; color:var(--text-1); background:var(--bg); border:1px solid var(--rule); border-radius:4px; font:500 13px var(--font-sans); }
.projection-detail { display:grid; grid-template-columns:minmax(0,2fr) minmax(260px,1fr); gap:14px; margin-bottom:14px; }
.reliability-score { display:inline-flex; padding:5px 8px; margin-bottom:8px; border-radius:3px; font:600 10px var(--font-mono); text-transform:uppercase; letter-spacing:.06em; }
.reliability-score.skill { color:var(--pos); background:color-mix(in srgb,var(--pos) 10%,transparent); }
.reliability-score.baseline { color:var(--warn); background:color-mix(in srgb,var(--warn) 10%,transparent); }
#projection-reliability p { font-size:13px; line-height:1.55; }
#projection-reliability dl { display:grid; gap:0; margin:14px 0; }
#projection-reliability dl div { display:flex; justify-content:space-between; gap:12px; padding:9px 0; border-bottom:1px solid var(--rule); }
#projection-reliability dt { color:var(--text-3); } #projection-reliability dd { margin:0; text-align:right; font-weight:600; }
.scenario-panel { margin-bottom:14px; }
.scenario-grid { display:grid; grid-template-columns:repeat(4,1fr); gap:18px; }
.scenario-slider { display:grid; gap:10px; font-size:12px; }
.scenario-slider span { display:flex; justify-content:space-between; gap:10px; }
.scenario-slider output { color:var(--neg); font:600 11px var(--font-mono); }
.scenario-slider input { width:100%; accent-color:var(--neg); }
.projection-note { padding:0 16px 14px; color:var(--text-3); font-size:11px; }
.projection-mini { min-height:62px; display:flex; align-items:center; padding:0 16px; }
.projection-mini-link { width:100%; display:grid; grid-template-columns:minmax(220px,1fr) auto 120px; align-items:center; gap:18px; color:var(--text-1); text-decoration:none; }
.projection-mini-link span:first-child { display:grid; gap:4px; }
.projection-mini-link small { color:var(--text-3); font:10px var(--font-mono); }
.projection-mini-link span:nth-child(2) { font:600 12px var(--font-mono); }
.projection-mini-link svg { width:120px; height:34px; color:var(--neg); }

@media (max-width:900px) {
  .outlook-callouts,.scenario-grid { grid-template-columns:repeat(2,1fr); }
  .projection-detail { grid-template-columns:1fr; }
}
@media (max-width:600px) {
  .outlook-hero { padding:24px 18px; border-radius:0; margin-left:-16px; margin-right:-16px; }
  .outlook-callouts { grid-template-columns:1fr; }
  .projection-controls { grid-template-columns:1fr; }
  .scenario-grid { grid-template-columns:1fr; }
  .projection-chart,.projection-chart.fan { height:300px; padding:10px 4px; }
  .projection-mini-link { grid-template-columns:1fr auto; gap:8px; padding:10px 0; }
  .projection-mini-link span:nth-child(2) { grid-column:1; }
  .projection-mini-link svg { grid-column:2; grid-row:1 / span 2; width:80px; }
  .outlook-table td { min-width:150px; }
}
@media (max-width: 900px) {
  .about-grid, .ai-kpi-strip { grid-template-columns: repeat(2, 1fr) !important; }
}
@media (max-width: 560px) {
  .about-grid, .ai-kpi-strip { grid-template-columns: 1fr !important; }
}

/* Small screens: keep the page from scrolling sideways */
.kpi-tile__spark svg { max-width: 100%; height: auto; }
@media (max-width: 700px) {
  #present-btn, .live-pill { display: none; }
  .cmd-actions { flex-shrink: 0; }
  .rank-table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .page-body, .hero__inner { overflow-x: hidden; }
}

/* ── Demo polish (design review 2026-10-14) ─────────────────────────────────── */
/* Closed AI drawer: its shadow leaked a white haze down the right edge */
.agent-drawer:not(.open) { box-shadow: none; }

/* KPI / hero sub-lines: flex split text into ragged columns ("▼ 0.3 / pp") */
.kpi-tile__delta, .hero__stat-delta { display: block; line-height: 1.45; }
.kpi-tile__delta svg, .hero__stat-delta svg { vertical-align: -2px; }

/* Country brief: 8 facts fit one row instead of 7 + an orphan */
.brief-kf { grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); }

/* Outlook table: consistent alignment and a uniform two-line cell */
.outlook-table.rank-table thead th { text-align: right; vertical-align: bottom; }
.outlook-table.rank-table thead th:first-child,
.outlook-table.rank-table tbody td:first-child { text-align: left; }
.outlook-table .projection-arrow { display: block; margin-left: 0; }
.outlook-table.rank-table tbody tr:last-child td { border-bottom: none; }
.projections-page .table-scroll { overflow-x: auto; }

@media (max-width: 640px) {
  .hero__stats { row-gap: 18px; }
  .hero__stat:nth-child(3n+1) { padding-left: 0; border-left: none; }
}

/* Projection league table: header and cell alignment agree */
#projection-league .rank-table th:nth-child(n+3) { text-align: right; }
#projection-league .rank-table td:nth-child(-n+2) { text-align: left; }
#projection-league .rank-table td:first-child,
#projection-league .rank-table th:first-child { width: 64px; color: var(--text-3); }

/* ── Analysis page ─────────────────────────────────────────────────────── */
.an-hero {
  background: var(--ink, #0A0A0A);
  color: var(--text-on-ink, #F5F5F2);
  border-radius: 10px;
  padding: 28px 32px 24px;
  margin-bottom: 20px;
}
.an-hero__eyebrow {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  opacity: 0.65;
  margin-bottom: 10px;
}
.an-hero__title { font-size: 30px; font-weight: 600; letter-spacing: -0.03em; line-height: 1.15; margin: 0 0 10px; }
.an-hero__sub { font-size: 14px; line-height: 1.6; max-width: 760px; opacity: 0.82; margin: 0 0 18px; }
.an-toc { display: flex; flex-wrap: wrap; gap: 8px; }
.an-toc a {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: inherit;
  text-decoration: none;
  border: 1px solid rgba(255,255,255,0.22);
  border-radius: 999px;
  padding: 5px 12px;
}
.an-toc a:hover { background: rgba(255,255,255,0.08); }
.an-section { scroll-margin-top: 72px; }
.an-section .panel__head { flex-wrap: wrap; gap: 10px; }
.an-grid { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 28px; align-items: start; }
.an-chart { position: relative; width: 100%; }
.an-text { min-width: 0; }
.an-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; margin-bottom: 14px; }
.an-stat { border: 1px solid var(--rule); border-radius: 8px; padding: 10px 12px; background: var(--bg); }
.an-stat__lbl { font-family: var(--font-mono); font-size: 10.5px; color: var(--text-3); letter-spacing: 0.04em; margin-bottom: 6px; }
.an-stat__val { font-size: 20px; font-weight: 600; letter-spacing: -0.02em; color: var(--text-1); font-variant-numeric: tabular-nums; line-height: 1.1; }
.an-stat__note { font-family: var(--font-mono); font-size: 10.5px; color: var(--text-3); margin-top: 4px; }
.an-read { font-size: 13.5px; line-height: 1.7; color: var(--text-2); margin: 0 0 16px; max-width: 880px; }
.an-read b { color: var(--text-1); }
.an-method {
  border-top: 1px solid var(--rule);
  padding: 12px 20px;
  font-size: 11.5px;
  line-height: 1.6;
  color: var(--text-3);
  background: var(--bg-2);
  border-radius: 0 0 8px 8px;
}
.an-table td:first-child { text-align: left; font-family: var(--font-sans, inherit); }
.an-table tbody tr:hover td { cursor: default; }
.an-table tr.an-muted td { color: var(--text-3); }
.an-heat { border-collapse: separate; border-spacing: 2px; font-family: var(--font-mono); font-size: 10.5px; font-variant-numeric: tabular-nums; margin: 0 auto; }
.an-heat th { font-weight: 500; color: var(--text-3); padding: 2px 4px; white-space: nowrap; }
.an-heat tbody th { text-align: right; padding-right: 8px; font-family: var(--font-sans, inherit); font-size: 12px; color: var(--text-2); }
.an-heat td { width: 34px; min-width: 34px; height: 26px; text-align: center; border-radius: 3px; color: var(--text-1); }
.an-heat td.an-heat__avg { background: var(--bg-2); font-weight: 600; width: 44px; }
@media (max-width: 900px) {
  .an-grid { grid-template-columns: 1fr; }
  .an-hero { padding: 22px 18px; }
  .an-hero__title { font-size: 24px; }
}

/* ── Country profile: position in the G20 ──────────────────────────────── */
.pos-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(440px, 1fr)); gap: 4px 36px; padding: 18px 22px 8px; }
.pos-group { margin-bottom: 14px; }
.pos-group__title {
  font-family: var(--font-mono); font-size: 10.5px; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--text-3); padding-bottom: 6px; margin-bottom: 4px; border-bottom: 1px solid var(--rule);
}
.pos-row { display: grid; grid-template-columns: 150px minmax(0, 1fr) 150px; align-items: center; gap: 14px; padding: 9px 0; }
.pos-row + .pos-row { border-top: 1px dashed var(--rule); }
.pos-lbl { font-size: 12.5px; color: var(--text-1); }
.pos-track { position: relative; height: 30px; }
.pos-line { position: absolute; left: 0; right: 0; top: 11px; height: 6px; border-radius: 3px; background: var(--bg-2); border: 1px solid var(--rule); }
.pos-med { position: absolute; top: 6px; width: 2px; height: 16px; margin-left: -1px; background: var(--text-3); border-radius: 1px; }
.pos-dot {
  position: absolute; top: 7px; width: 14px; height: 14px; margin-left: -7px; border-radius: 50%;
  background: var(--text-1); border: 2px solid var(--bg); box-shadow: 0 0 0 1px var(--text-1);
}
.pos-dot.is-good { background: var(--pos); box-shadow: 0 0 0 1px var(--pos); }
.pos-dot.is-bad { background: var(--neg); box-shadow: 0 0 0 1px var(--neg); }
.pos-end { position: absolute; top: 21px; font-family: var(--font-mono); font-size: 9.5px; color: var(--text-3); white-space: nowrap; }
.pos-end--lo { left: 0; }
.pos-end--hi { right: 0; }
.pos-val { display: flex; flex-direction: column; align-items: flex-end; font-variant-numeric: tabular-nums; }
.pos-val b { font-size: 14px; font-weight: 600; color: var(--text-1); }
.pos-val span { font-family: var(--font-mono); font-size: 10px; color: var(--text-3); margin-top: 2px; text-align: right; }
.pos-legend-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--text-1); margin: 0 4px 0 12px; vertical-align: -1px; }
.pos-legend-dot.is-good { background: var(--pos); }
.pos-legend-dot.is-bad { background: var(--neg); }
.pos-legend-med { display: inline-block; width: 2px; height: 12px; background: var(--text-3); margin: 0 4px 0 12px; vertical-align: -2px; }
@media (max-width: 640px) {
  .pos-grid { grid-template-columns: 1fr; padding: 14px; }
  .pos-row { grid-template-columns: 1fr 110px; }
  .pos-track { grid-column: 1 / -1; order: 3; }
}
.pos-grid + .standing-legend { flex-wrap: wrap; gap: 6px 0; padding: 4px 22px 16px; }

/* ── Prosperity: reading guide ─────────────────────────────────────────── */
.pros-guide { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.pros-guide > div { border: 1px solid var(--rule); border-radius: 8px; padding: 10px 12px; font-size: 12px; line-height: 1.5; color: var(--text-2); background: var(--bg); }
.pros-guide b { display: block; font-family: var(--font-mono); font-size: 10.5px; font-weight: 500; letter-spacing: 0.05em; text-transform: uppercase; color: var(--text-3); margin-bottom: 3px; }
@media (max-width: 900px) { .pros-guide { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* ── Global scope (Phase 2) — built from existing tokens and components ─────── */
.scope-pick { display: inline-flex; align-items: center; gap: 6px; }
.scope-pick__lbl { font-family: var(--font-mono); font-size: 10.5px; color: var(--text-on-ink-3); letter-spacing: .04em; text-transform: uppercase; }
.scope-select {
  appearance: none; -webkit-appearance: none;
  padding-right: 24px; max-width: 220px; text-overflow: ellipsis;
  background-image: linear-gradient(45deg, transparent 50%, currentColor 50%), linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position: calc(100% - 12px) 52%, calc(100% - 8px) 52%;
  background-size: 4px 4px; background-repeat: no-repeat;
}
.scope-select option, .scope-select optgroup { color: var(--text-1); background: var(--bg); font-family: var(--font-sans); }
@media (max-width: 760px) { .scope-pick__lbl { display: none; } .scope-select { max-width: 130px; } }

.worldmap-status {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  pointer-events: none; font-family: var(--font-mono); font-size: 11.5px; color: var(--text-3);
}
.worldmap-status:empty { display: none; }

/* Coverage tier badge — same pill as the risk badges, tier colours from the status tokens */
.tier-pill { margin-left: 6px; vertical-align: 1px; }
.tier-1 { background: var(--status-stable-bg);    color: var(--status-stable-fg); }
.tier-2 { background: var(--status-insulated-bg); color: var(--status-insulated-fg); }
.tier-3 { background: var(--status-watch-bg);     color: var(--status-watch-fg); }

/* Search + filters on Countries / Compare — same field style as the outlook selects */
.filter-bar { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 14px; }
.filter-bar input, .filter-bar select {
  padding: 8px 10px; color: var(--text-1); background: var(--bg);
  border: 1px solid var(--rule); border-radius: 4px; font: 500 12.5px var(--font-sans);
}
.filter-bar input { flex: 1 1 220px; min-width: 160px; }
.filter-bar__count { align-self: center; font-family: var(--font-mono); font-size: 11px; color: var(--text-3); }
.scope-note {
  margin: 0 0 16px; padding: 10px 14px; border: 1px solid var(--rule); border-radius: 4px;
  background: var(--bg-2); font-size: 12.5px; color: var(--text-2);
}
.watch-btn { color: var(--text-on-ink-2); }
.watch-btn[aria-pressed="true"] { color: var(--warn-on-ink); border-color: var(--warn-on-ink); }

/* ── Daily market layer (Phase 3) — reuses the wires strip and risk-pill styles ── */
.market-strip { border-top: 0; border-bottom: 1px solid var(--rule-on-ink); }
.market-strip[hidden] { display: none; }
/* Market ticker: scrolls right to left with the shared ticker-scroll animation; hover pauses it. */
.market-strip .mkt-viewport { flex: 1; min-width: 0; overflow: hidden; height: 100%; display: flex; align-items: center; }
.market-strip .mkt-track { width: max-content; gap: 0; padding-left: 0; animation: ticker-scroll 45s linear infinite; }
.market-strip .mkt-group { display: inline-flex; align-items: center; gap: 22px; padding: 0 11px; }
@media (prefers-reduced-motion: reduce) {
  .market-strip .mkt-track { animation: none; }
  .market-strip .mkt-loop { display: none; }
  .market-strip .mkt-viewport { overflow-x: auto; }
}
.mkt-item { gap: 5px; color: var(--text-on-ink); }
.mkt-chg { font-size: 10.5px; color: var(--text-on-ink-2); }
.mkt-up, .mkt-up-ink { color: var(--pos-on-ink); }
.mkt-down, .mkt-down-ink { color: var(--neg-on-ink); }
.mkt-flat { color: var(--text-on-ink-3); }
.mkt-move { color: var(--text-on-ink-2); }
.mkt-asof { flex-shrink: 0; padding: 0 14px; }
.mkt-hero { margin-top: 12px; }
.mkt-hero .profile-hero__stat-val span { font-size: 11px; font-family: var(--font-mono); margin-left: 4px; }
.mkt-sub { color: var(--text-on-ink-3); }
.mkt-hero-asof { margin-top: 8px; font-family: var(--font-mono); font-size: 10px; color: var(--text-on-ink-3); }
@media (max-width: 760px) { .mkt-asof { display: none; } }

/* ── Global-scale review (2026-10-17): readable at 217 economies, same brand ── */
/* Prosperity filters (wider scopes) */
.pros-filters .panel__body { display: flex; flex-direction: column; gap: 10px; padding: 14px 16px; }
.pros-filters__row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.pros-filters__lbl { width: 72px; flex-shrink: 0; font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-3); }
.pros-filters__row .filter-bar__count { margin-left: auto; }
.pros-filters__row input[type="search"] { flex: 1 1 260px; }
.pros-offscale { margin-top: 8px; font-family: var(--font-mono); font-size: 10.5px; color: var(--text-3); line-height: 1.6; }
.pros-offscale:empty { display: none; }
.pros-offscale b { color: var(--text-2); font-weight: 500; }

/* Long names truncate with an ellipsis (full name on hover) instead of being cut off */
.bar-row__name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* A bar shortened because one value dwarfs the rest: a break mark near its end */
.bar-row__bar--break::after { content: ""; position: absolute; top: -2px; bottom: -2px; right: 12px; width: 4px; background: var(--bg); transform: skewX(-20deg); }

/* Countries: "Show all" after the first page */
.co-more { display: flex; justify-content: center; margin: 18px 0 4px; }
.co-more[hidden] { display: none; }

/* Risk matrix with every economy: a scroll box whose column headers stay visible */
.fx-scroll--tall { max-height: 78vh; overflow: auto; }
.fx-scroll--tall .fx-matrix thead th { position: sticky; top: 0; z-index: 2; }

/* Small screens: nothing scrolls the page sideways */
@media (max-width: 640px) {
  .crumbs { min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
  .crumbs > span:not(.here) { display: none; }
  .cmd-actions { flex-shrink: 1; min-width: 0; gap: 6px; }
  .scope-select { max-width: 112px; }
  .ask-btn { padding-left: 10px; padding-right: 10px; }
  .sec-head { flex-wrap: wrap; row-gap: 8px; }
  .sec-head__actions { flex-wrap: wrap; row-gap: 6px; max-width: 100%; }
  .page-body table:not(.fx-matrix) { display: block; max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .pros-filters__lbl { width: 100%; }
  .prosperity-quadrants { height: 400px !important; }
}
/* Flag detail in wider scopes: top 10 per severity until expanded */
.fx-group:not(.fx-group--all) .fx-item--more { display: none; }
.fx-group .co-more { margin: 10px 0 12px; }
/* Quick search ("/" or header button): same panel, input and row styles as the rest of the app */
.qs-btn { display: inline-flex; align-items: center; gap: 8px; }
.qs-kbd { font-family: var(--font-mono); font-size: 10px; padding: 1px 5px; border: 1px solid var(--rule-on-ink); border-radius: 3px; color: var(--text-on-ink-3); }
.qs-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,0.28); z-index: 90; }
.qs { position: fixed; top: 72px; left: 50%; transform: translateX(-50%); width: min(560px, calc(100vw - 32px)); z-index: 91; box-shadow: 0 18px 48px rgba(0,0,0,0.25); }
.qs[hidden], .qs-backdrop[hidden] { display: none; }
.qs__input { padding: 12px 12px 8px; }
.qs__input input { width: 100%; }
.qs__list { max-height: 360px; overflow: auto; padding: 0 6px 6px; }
.qs__item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 6px; cursor: pointer; color: var(--text-1); font-size: 13px; }
.qs__item.active, .qs__item:hover { background: var(--bg-3); }
.qs__name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qs__meta { font-family: var(--font-mono); font-size: 10.5px; color: var(--text-3); white-space: nowrap; }
.qs__empty { padding: 14px 10px; font-family: var(--font-mono); font-size: 11px; color: var(--text-3); }
.qs__hint { border-top: 1px solid var(--rule); padding: 8px 14px; font-family: var(--font-mono); font-size: 10px; color: var(--text-3); }
@media (max-width: 640px) { .qs-btn__lbl, .qs-kbd { display: none; } .qs-btn::before { content: "⌕"; font-size: 14px; } .qs { top: 60px; } }
/* World map legend: capped colour ramp + outliers note */
.worldmap-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; padding: 10px 16px 12px; border-top: 1px solid var(--rule); font-family: var(--font-mono); font-size: 10.5px; color: var(--text-3); }
.worldmap-legend:empty { display: none; }
.worldmap-legend__ramp { width: 160px; height: 8px; border-radius: 2px; border: 1px solid var(--rule); }
.worldmap-legend__end { color: var(--text-2); white-space: nowrap; }
.worldmap-legend__note { flex: 1 1 320px; line-height: 1.5; }
@media (max-width: 420px) { .scope-select { max-width: 96px; } .cmd-actions { gap: 4px; } .crumbs { flex: 0 1 auto; } }
