/* ============================================================================
   CyberMap — stylesheet ("Field Atlas"). Tokens (colours, bands, fonts, motion) live in
   tokens.css, loaded first; this file never uses a raw colour, so light and dark both follow.
   Type: Archivo for words and big numbers (condensed via font-stretch), IBM Plex Mono for
   codes, labels and small figures.
   ========================================================================== */

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font: 15px/1.45 var(--font);
  background: var(--bg);
  color: var(--text);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); }
button, input, select, textarea { font: inherit; color: inherit; }
ul, ol { list-style: none; }

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.num { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.eyebrow { font: 500 12px/1.4 var(--font-mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-dim); }
.muted { color: var(--text-faint); }
.small { font-size: 13px; line-height: 1.5; }
.note { font-size: 14px; color: var(--text-dim); line-height: 1.55; }
.note a, .page-intro a { color: var(--accent); }
.text-link { display: inline-flex; align-items: center; min-height: 44px; color: var(--accent); font-weight: 600; text-decoration: none; }
.text-link:hover { text-decoration: underline; text-underline-offset: 3px; }
.derived { font: 500 11px var(--font-mono); color: var(--text-dim); border: 1px solid var(--border-2); border-radius: 3px; padding: 1px 5px; margin-left: 4px; white-space: nowrap; text-transform: none; letter-spacing: 0; vertical-align: 1px; }
/* A band swatch: colour always sits beside the band's name, never alone. */
.sw { display: inline-block; width: 10px; height: 10px; flex-shrink: 0; font-style: normal; }
.flag-sm { width: 22px !important; height: 16px !important; border-radius: 2px; overflow: hidden; box-shadow: 0 0 0 1px var(--border); background-size: cover; flex-shrink: 0; display: inline-block; }

/* ── Logo ────────────────────────────────────────────────────────────────── */
.mark { display: block; color: var(--text); }
.mark-risk { fill: var(--mark-risk); }
.wordmark { font-size: 21px; font-stretch: 112%; letter-spacing: -0.02em; font-weight: 380; white-space: nowrap; }
.wordmark b { font-weight: 760; }

/* The loading mark: the logo, clipped to its circle, its bands sweeping in turn (risk band last). */
.mark-loading { clip-path: circle(47% at 50% 50%); }
.mark-loading rect { animation: band-sweep 1.3s cubic-bezier(0.4, 0, 0.2, 1) infinite; transform-box: fill-box; transform-origin: left center; }
.mark-loading .b2 { animation-delay: 0.1s; } .mark-loading .b3 { animation-delay: 0.2s; }
.mark-loading .b4 { animation-delay: 0.3s; } .mark-loading .b5 { animation-delay: 0.4s; }
@keyframes band-sweep {
  0% { transform: scaleX(0.08); opacity: 0.35; }
  45%, 60% { transform: scaleX(1); opacity: 1; }
  100% { transform: scaleX(0.08); opacity: 0.35; }
}
.app-loader { position: fixed; inset: 0; z-index: 300; display: grid; place-items: center; background: var(--bg); transition: opacity 0.2s ease, visibility 0.2s;
  animation: loader-give-up 0s linear 15s forwards; } /* never trap the page, whatever went wrong */
@keyframes loader-give-up { to { opacity: 0; visibility: hidden; } }
.app-loader .mark { width: 56px; height: 56px; }
.app-loader.done { opacity: 0; visibility: hidden; }
.loading-inline { display: grid; place-items: center; min-height: calc(100dvh - 200px); }
.loading-inline .mark { width: 40px; height: 40px; }
/* While a lens change is refetching scores, the chip shows the mark. */
.lens-busy { display: none; width: 16px; height: 16px; flex-shrink: 0; }
.controls.busy .lens-busy { display: block; }
@media (prefers-reduced-motion: reduce) { .mark-loading rect { animation: none; } }

/* ── Shell: header + routed views ────────────────────────────────────────── */
.shell { display: flex; flex-direction: column; height: 100vh; height: 100dvh; }
.topbar {
  height: 64px; flex-shrink: 0; display: flex; align-items: center; gap: 28px; padding: 0 32px;
  border-bottom: 1px solid var(--border); background: var(--bg); position: relative; z-index: 40;
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; flex-shrink: 0; }
.brand .mark { width: 28px; height: 28px; }
.topnav { display: flex; align-self: stretch; gap: 24px; }
.topnav a {
  display: flex; align-items: center; color: var(--text-dim); text-decoration: none; font-size: 15px; white-space: nowrap;
  border-bottom: 2px solid transparent; margin-bottom: -1px; transition: color var(--ease);
}
.topnav a:hover { color: var(--text); }
.topnav a.active { color: var(--text); font-weight: 640; border-bottom-color: var(--text); }
.topbar-spacer { flex: 1; }


.typeahead { position: relative; }
.topbar .typeahead { width: 230px; }
/* The Atlas has "Where are you going?" in the page; one search box is enough. */
body[data-route="map"] .topbar .typeahead { display: none; }
body[data-route="map"] .topbar-spacer { flex: 1; }
.topbar .typeahead input {
  width: 100%; height: 40px; background: var(--bg-elev); border: 1px solid var(--border-2); border-radius: 4px;
  color: var(--text); font-size: 14px; padding: 0 32px 0 12px; outline: none; transition: border-color var(--ease);
}
.topbar .typeahead input:focus { border-color: var(--text); }
.typeahead input::placeholder { color: var(--text-faint); }
.kbd { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); font: 500 11px var(--font-mono); color: var(--text-dim); border: 1px solid var(--border-2); border-radius: 3px; padding: 0 5px; pointer-events: none; }
.typeahead-list {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0; min-width: 300px; z-index: 100;
  background: var(--bg-elev); border: 1px solid var(--border-2); border-radius: 6px; box-shadow: var(--shadow); padding: 4px;
}
.typeahead-list[hidden] { display: none; }
.typeahead-list li { display: grid; grid-template-columns: 22px minmax(0, 1fr) auto 36px; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 4px; font-size: 15px; cursor: pointer; }
.typeahead-list li > span:nth-child(2) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.typeahead-list li[aria-selected="true"], .typeahead-list li:hover { background: var(--bg-elev-2); }
.ta-inc { font-size: 13px; color: var(--text-dim); }
.typeahead-list li.ta-empty { display: block; color: var(--text-dim); cursor: default; background: none; }
.list-empty { padding: 16px; font-size: 14px; color: var(--text-dim); }
.table-empty { padding: 24px 16px; text-align: center; color: var(--text-dim); }
.ta-band { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-dim); white-space: nowrap; }
.ta-score { font: 800 22px/1 var(--font); font-stretch: 62%; text-align: right; }

.avatar-menu { position: relative; }
.avatar { width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--border-2); background: var(--bg-elev); color: var(--text); font: 700 13px var(--font); cursor: pointer; }
.avatar:hover { border-color: var(--text); }
.menu { position: absolute; right: 0; top: calc(100% + 8px); min-width: 220px; z-index: 100; background: var(--bg-elev); border: 1px solid var(--border-2); border-radius: 6px; box-shadow: var(--shadow); padding: 6px; }
.menu[hidden] { display: none; }
.menu a, .menu button { display: block; width: 100%; text-align: left; background: none; border: 0; color: var(--text); font-size: 15px; padding: 9px 12px; border-radius: 4px; cursor: pointer; text-decoration: none; }
.menu a:hover, .menu button:hover { background: var(--bg-elev-2); }
.menu-group { border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); margin: 6px 0; padding: 6px 0; }
.menu-label { display: block; padding: 4px 12px; font: 500 11px var(--font-mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-dim); }
.menu [aria-checked="true"] { font-weight: 650; }
.menu [aria-checked="true"]::after { content: ''; float: right; width: 8px; height: 8px; margin-top: 7px; border-radius: 50%; background: var(--accent); }

/* ── Traveller lens: an overlay, so it wears the overlay blue when on ───── */
.controls { position: relative; }
.lens-chip { display: flex; align-items: stretch; min-height: 40px; border: 1px solid var(--border-2); border-radius: 4px; background: var(--bg-elev); overflow: hidden; }
.lens-chip.on { border: 1.5px dashed var(--accent); background: var(--accent-tint); }
.lens-chip-main { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; background: none; border: 0; color: var(--text); padding: 0 12px; cursor: pointer; text-align: left; }
.lens-chip-k { font: 500 11px var(--font-mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-dim); flex-shrink: 0; }
.lens-chip.on .lens-chip-k, .lens-chip.on .lens-chip-v { color: var(--accent); }
.lens-chip-v { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 220px; }
.lens-chip-clear { background: none; border: 0; border-left: 1px solid var(--border-2); color: var(--text-dim); padding: 0 12px; cursor: pointer; }
.lens-chip-clear:hover { color: var(--text); }
.controls .lens-popover { position: absolute; right: 0; top: calc(100% + 8px); width: 340px; z-index: 100; box-shadow: var(--shadow); }
.lens-popover { display: flex; flex-direction: column; gap: 14px; padding: 16px; border: 1px solid var(--border-2); border-radius: 6px; background: var(--bg-elev); }
.lens-popover[hidden] { display: none; }
.lens-note { font-size: 13.5px; color: var(--text-dim); line-height: 1.5; }
.lens-desc { font-size: 12.5px; color: var(--text-dim); line-height: 1.45; }
.lens-switch { display: flex; align-items: center; gap: 10px; font-size: 15px; font-weight: 600; cursor: pointer; min-height: 32px; }
.lens-switch input { accent-color: var(--accent); width: 18px; height: 18px; }
.lens-tag { font: 600 11px var(--font-mono); text-transform: uppercase; letter-spacing: 0.08em; color: var(--accent); margin-right: 8px; }
.control-row { display: flex; flex-direction: column; gap: 6px; }
.control-row .label-row { display: flex; align-items: center; gap: 6px; }
.control-row label { font: 500 11px var(--font-mono); text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-dim); }

select {
  background-color: var(--bg-elev); border: 1px solid var(--border-2); color: var(--text);
  height: 40px; padding: 0 32px 0 12px; border-radius: 4px; font-size: 14px; cursor: pointer;
  outline: none; width: 100%; appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, currentColor 50%), linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position: right 15px center, right 10px center; background-size: 5px 5px; background-repeat: no-repeat;
}
select:hover, select:focus { border-color: var(--text); }

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 18px;
  background: var(--text); color: var(--on-ink); border: 1px solid var(--text); border-radius: 4px;
  font-size: 15px; font-weight: 600; cursor: pointer; white-space: nowrap; transition: opacity var(--ease), background var(--ease);
}
.btn:hover { opacity: 0.88; }
.btn.ghost { background: transparent; color: var(--text); }
.btn.ghost:hover { background: var(--bg-elev-2); opacity: 1; }
.btn.lens-btn { background: transparent; color: var(--accent); border: 1.5px dashed var(--accent); }
.btn.lens-btn:hover { background: var(--accent-tint); opacity: 1; }
.btn.danger { background: transparent; color: var(--danger); border-color: var(--danger); }
.btn.danger:hover { background: var(--bg-elev-2); opacity: 1; }
.btn:disabled { opacity: 0.55; cursor: default; }

/* ── Views ───────────────────────────────────────────────────────────────── */
.views { flex: 1; min-height: 0; position: relative; }
.view { position: absolute; inset: 0; }
.view[hidden] { display: none; }
.view-page { overflow-y: auto; background: var(--bg); }
/* Every page shares the Atlas's frame (1440 wide, 40px gutters), so headings line up from page to page. */
.page { max-width: 1440px; margin: 0 auto; padding: 40px 40px 72px; }
.page-head { margin-bottom: 28px; }
.page-head h2 { margin-top: 6px; font-size: clamp(40px, 5vw, 64px); line-height: 0.98; font-stretch: 78%; font-weight: 780; letter-spacing: -0.02em; }
.page-intro { font-size: 16px; color: var(--text-dim); margin-bottom: 24px; max-width: 72ch; line-height: 1.55; }
.section-title { font-size: 30px; line-height: 1.1; font-stretch: 85%; font-weight: 760; letter-spacing: -0.01em; display: flex; align-items: baseline; gap: 10px; margin-bottom: 14px; }

/* ── Atlas (#/map) ───────────────────────────────────────────────────────── */
.atlas { max-width: 1440px; margin: 0 auto; padding: 40px 40px 72px; }
.notice-bar { display: flex; align-items: center; gap: 10px; margin-bottom: 28px; padding: 10px 14px; border: 1px solid var(--warn); border-radius: 6px; background: color-mix(in srgb, var(--warn) 10%, var(--bg-elev)); color: var(--text); font-size: 14px; line-height: 1.4; }
.notice-bar[hidden] { display: none; }
.notice-bar svg { width: 16px; height: 16px; flex-shrink: 0; color: var(--warn); }
.atlas-hero { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 28px 64px; margin-bottom: 32px; }
.atlas-intro { flex: 1 1 520px; min-width: 0; }
.atlas-title { margin-top: 12px; font-size: clamp(38px, 4.4vw, 60px); line-height: 0.98; font-stretch: 78%; font-weight: 780; letter-spacing: -0.02em; max-width: 18ch; }
.live-word { color: var(--live); }
.dest { flex: 1 1 380px; min-width: 0; display: flex; flex-direction: column; gap: 10px; }
.dest-label { font-size: 17px; font-weight: 640; }
.dest-box { width: auto; display: flex; align-items: center; gap: 12px; height: 60px; padding: 0 18px; background: var(--bg-elev); border: 1.5px solid var(--text); border-radius: 4px; }
.dest-box:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
.dest-box > svg { width: 20px; height: 20px; flex-shrink: 0; }
.dest-box input { flex: 1; min-width: 0; height: 100%; border: 0; background: transparent; font-size: 19px; color: var(--text); outline: none; }
.dest-box .typeahead-list { top: calc(100% + 8px); left: -1.5px; right: -1.5px; }
.dest-hint { font-size: 14px; color: var(--text-dim); }

.atlas-main { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 24px; }
.map-card { margin: 0; min-width: 0; display: flex; flex-direction: column; gap: 14px; padding: 20px; background: var(--bg-elev); border: 1px solid var(--border); border-radius: 6px; }
.map-card-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; min-height: 32px; }
.map-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.map-chip { display: inline-flex; align-items: center; gap: 6px; min-height: 32px; padding: 0 12px; background: transparent; border: 1.5px dashed var(--accent); border-radius: 4px; color: var(--accent); font-size: 13px; font-weight: 600; text-decoration: none; cursor: pointer; }
.map-chip:hover { background: var(--accent-tint); }
.map-chip[aria-pressed="false"] { border-color: var(--border-2); color: var(--text-dim); }
.map-svg-wrap { position: relative; aspect-ratio: 1000 / 386; overflow: hidden; background: var(--ocean); border-radius: 4px; }
#worldMap { width: 100%; height: 100%; display: block; cursor: grab; }
.map-zoom-controls { position: absolute; bottom: 10px; right: 10px; display: flex; flex-direction: column; gap: 4px; }
.zoom-btn { width: 34px; height: 34px; border-radius: 4px; background: var(--bg-elev); border: 1px solid var(--border-2); color: var(--text); font-size: 18px; line-height: 1; cursor: pointer; display: grid; place-items: center; }
.zoom-btn:hover { border-color: var(--text); }
.geo { fill: var(--land); stroke: var(--land-stroke); stroke-width: 0.35; }
.geo.scored { cursor: pointer; }
/* The hover outline is #mapHover, drawn last by map.js so it sits on top of every border. */
#mapHover { stroke: var(--map-hover); stroke-width: 1.2; paint-order: stroke fill; pointer-events: none; }
.geo.sel { stroke: var(--map-hover); stroke-width: 1; }
/* The disputed hatching's presentation attributes live in map.js; CSS overrides them. */
pattern#dh path, pattern#dh-sm path { stroke: var(--hatch); }

.legend { display: flex; flex-direction: column; gap: 14px; }
.legend-scale { display: flex; gap: 3px; }
.legend-scale .legend-item { display: flex; flex-direction: column; min-width: 0; }
.legend-bar { height: 10px; }
.legend-scale .legend-label { margin-top: 8px; font-size: 14px; font-weight: 640; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.legend-range { font-size: 12px; color: var(--text-dim); white-space: nowrap; }
.legend-extra { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 22px; font-size: 14px; }
.legend-extra .legend-item { display: inline-flex; align-items: center; gap: 8px; }
.legend-extra .legend-label { font-weight: 600; }
.legend-dot { width: 22px; height: 10px; flex-shrink: 0; }
.legend-nr { background: radial-gradient(var(--unrated-dot) 0.7px, transparent 1px) 0 0 / 4px 4px, var(--unrated); }
.legend-disputed { background: repeating-linear-gradient(-45deg, var(--hatch) 0 1.5px, transparent 1.5px 5px), var(--band-3); }
.legend-foot { margin-left: auto; font: 12px var(--font-mono); color: var(--text-dim); }

/* The country list beside the map: as tall as the map card, scrolling inside. */
.map-panel { contain: size; min-width: 0; display: flex; flex-direction: column; background: var(--bg-elev); border: 1px solid var(--border); border-radius: 6px; overflow: hidden; }
.map-panel-head { padding: 18px 16px 10px; }
.panel-title { font-size: 17px; font-weight: 720; display: flex; align-items: center; gap: 4px; }
.country-search-wrap { padding: 0 16px 10px; border-bottom: 1px solid var(--border); }
.search-filter-row { display: flex; gap: 6px; align-items: center; }
.search-filter-row input { flex: 1; min-width: 0; height: 38px; background: var(--bg); border: 1px solid var(--border-2); border-radius: 4px; padding: 0 10px; font-size: 14px; outline: none; }
.search-filter-row input:focus { border-color: var(--text); }
.search-filter-row select { width: auto; height: 38px; font-size: 13px; padding-right: 28px; }
.filter-btn { flex-shrink: 0; width: 38px; height: 38px; border-radius: 4px; background: var(--bg); border: 1px solid var(--border-2); color: var(--text); cursor: pointer; display: grid; place-items: center; }
.filter-btn:hover { border-color: var(--text); }
.filter-btn.active { border: 1.5px solid var(--text); background: var(--bg-elev-2); }
.filter-panel { display: none; padding: 12px 0 2px; }
.filter-panel.open { display: block; }
.filter-group { margin-bottom: 10px; }
.filter-group-label { font: 500 11px var(--font-mono); text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-dim); margin-bottom: 6px; }
.filter-chips { display: flex; flex-wrap: wrap; gap: 4px; }
.filter-chip { font-size: 13px; min-height: 30px; padding: 0 10px; border-radius: 4px; cursor: pointer; background: transparent; border: 1px solid var(--border-2); color: var(--text-dim); white-space: nowrap; }
.filter-chip:hover { border-color: var(--text); color: var(--text); }
.filter-chip.active { background: var(--text); border-color: var(--text); color: var(--on-ink); }
.filter-clear { background: none; border: 0; color: var(--accent); font-size: 13px; font-weight: 600; cursor: pointer; min-height: 30px; }
.country-list { flex: 1; min-height: 0; overflow-y: auto; padding: 0 8px 8px; }

/* A ledger row: flag, name over band, the score in condensed figures. */
.country-row {
  display: grid; grid-template-columns: 22px minmax(0, 1fr) auto; align-items: center; gap: 12px;
  min-height: 52px; padding: 6px 8px; border-bottom: 1px solid var(--border); color: inherit; text-decoration: none;
}
.country-row:hover { background: var(--bg-elev-2); }
.country-row.active { background: var(--accent-tint); }
.cinfo { display: flex; flex-direction: column; min-width: 0; }
.cname { font-size: 15px; font-weight: 580; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cband { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--text-dim); }
.cscore { font: 800 26px/1 var(--font); font-stretch: 62%; font-variant-numeric: tabular-nums; text-align: right; min-width: 32px; }
.live-chip { font: 600 12px var(--font-mono); color: var(--live); }

.atlas-lower { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 40px 48px; margin-top: 48px; }
.atlas-col { min-width: 0; }
.col-title { font-size: 24px; font-stretch: 88%; font-weight: 740; }
.col-sub { margin: 4px 0 14px; font-size: 14px; color: var(--text-dim); }
.ledger { border-top: 1px solid var(--border); }
.ledger .country-row { padding-left: 0; padding-right: 0; }
.empty-box { border: 1.5px dashed var(--border-2); border-radius: 6px; padding: 18px 20px; font-size: 14px; color: var(--text-dim); }
.empty-box strong { color: var(--text); }
.empty-box p + p { margin-top: 4px; }
.overlay-box { border-color: var(--accent); }
.mini-signals { border-top: 1px solid var(--border); }
.mini-signals a { display: grid; grid-template-columns: 52px minmax(0, 1fr); gap: 10px; padding: 12px 0; border-bottom: 1px solid var(--border); color: var(--text); text-decoration: none; font-size: 14px; }
.mini-signals a:hover { background: var(--bg-elev-2); }
.mini-signals .live-chip { font: 800 24px/1 var(--font); font-stretch: 62%; }
.about-list { list-style: square; padding-left: 18px; font-size: 14px; color: var(--text-dim); }
.about-list li { margin-bottom: 8px; }

/* ── Tooltips ────────────────────────────────────────────────────────────── */
.map-tooltip {
  position: fixed; pointer-events: none; z-index: 60; opacity: 0; min-width: 170px;
  background: var(--bg-elev); border: 1px solid var(--border-2); border-radius: 6px; padding: 10px 12px;
  box-shadow: var(--shadow); transition: opacity .12s;
}
.tt-name { display: flex; align-items: center; gap: 8px; font-size: 15px; font-weight: 680; }
.tt-score { display: flex; align-items: baseline; gap: 10px; margin-top: 4px; }
.tt-num { font: 800 32px/1 var(--font); font-stretch: 62%; }
.tt-band { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; font-weight: 600; }
.tt-meta { font-size: 12.5px; color: var(--text-dim); margin-top: 4px; }
.tt-live { font-size: 12.5px; color: var(--live); margin-top: 4px; font-weight: 600; }
.tt-hint { font: 11px var(--font-mono); color: var(--text-dim); margin-top: 8px; text-transform: uppercase; letter-spacing: 0.06em; }
.info-dot {
  width: 16px; height: 16px; border-radius: 50%; border: 1px solid var(--border-2); color: var(--text-dim);
  font: italic 700 10px/1 Georgia, serif; display: inline-grid; place-items: center; cursor: help; flex-shrink: 0;
  text-transform: none; letter-spacing: 0; margin-left: 0.35em; vertical-align: 2px;
}
.info-dot:hover, .info-dot:focus-visible { color: var(--accent); border-color: var(--accent); }
.tip {
  position: fixed; z-index: 80; max-width: 290px; pointer-events: none; opacity: 0;
  background: var(--bg-elev); border: 1px solid var(--border-2); border-radius: 6px;
  padding: 10px 12px; font-size: 13px; line-height: 1.5; color: var(--text); box-shadow: var(--shadow); transition: opacity .12s;
}

/* ── Country dossier (#/country/XX) ──────────────────────────────────────── */
.view-country { background: var(--bg); }
.detail { position: absolute; inset: 0; overflow-y: auto; padding: 0 max(40px, calc((100% - 1360px) / 2)) 72px; background: var(--bg); }
.c-head { padding-top: 18px; }
.c-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; }
.crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 14px; color: var(--text-dim); }
.crumbs [aria-current] { color: var(--text); }
.back-link { background: none; border: 0; color: var(--accent); font-weight: 600; cursor: pointer; min-height: 44px; padding: 0 2px; }
.back-link:hover { text-decoration: underline; text-underline-offset: 3px; }
.c-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.c-head .eyebrow { margin-top: 20px; }
.c-title { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px; margin-top: 6px; }
.c-title h2 { display: flex; align-items: center; gap: 18px; font-size: clamp(48px, 6vw, 84px); line-height: 0.95; font-stretch: 75%; font-weight: 800; letter-spacing: -0.025em; }
.flag-lg-icon { width: 54px !important; height: 40px !important; border-radius: 3px; overflow: hidden; box-shadow: 0 0 0 1px var(--border); background-size: cover; flex-shrink: 0; display: inline-block; }
.c-title .sc-band { font-size: 18px; }
.disputed-note { font-size: 14px; font-style: italic; color: var(--text-dim); margin-top: 8px; }
.territory-note { margin-top: 14px; max-width: 72ch; padding: 10px 14px; border-left: 3px solid var(--border-2); background: var(--bg-elev); font-size: 14.5px; line-height: 1.5; }

.modifier-banner { margin-top: 22px; padding: 12px 16px; border: 1.5px dashed var(--accent); border-radius: 6px; background: var(--accent-tint); font-size: 14.5px; line-height: 1.5; }

.dossier { display: flex; flex-wrap: wrap; gap: 40px 64px; padding: 28px 0 44px; border-bottom: 1px solid var(--border); }
.dossier-main { flex: 1.45 1 520px; min-width: 0; }
.dossier-side { flex: 1 1 360px; min-width: 0; display: flex; flex-direction: column; gap: 18px; }
.hero-ccr { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px 28px; }
.hero-ccr .sc-value { font: 820 clamp(140px, 15vw, 216px)/0.78 var(--font); font-stretch: 62%; letter-spacing: -0.04em; font-variant-numeric: tabular-nums; }
.sc-side { display: flex; flex-direction: column; gap: 8px; padding-bottom: 6px; }
.sc-badges { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.sc-band { display: inline-flex; align-items: center; gap: 8px; font-weight: 650; white-space: nowrap; }
.hero-ccr .sc-band { font-size: 30px; font-weight: 720; font-stretch: 90%; }
.hero-ccr .sc-band .sw { width: 18px; height: 18px; }
.hero-ccr .sc-label { font-size: 15px; color: var(--text-dim); display: flex; align-items: center; }
.sc-note { font-size: 14px; color: var(--text-dim); line-height: 1.45; }
.near-chip { font: 600 11px var(--font-mono); text-transform: uppercase; letter-spacing: 0.06em; color: var(--text); border: 1px dashed var(--text-dim); border-radius: 3px; padding: 3px 6px; }

.gauge { margin-top: 30px; max-width: 640px; }
.g-bar { position: relative; display: flex; gap: 2px; height: 12px; }
.g-seg { opacity: 0.5; }
.g-seg.on { opacity: 1; }
.g-mark { position: absolute; top: -10px; width: 2px; height: 32px; margin-left: -1px; background: var(--text); }
.g-mark.ghost { background: transparent; border-left: 2px dashed var(--accent); }
.g-ticks { position: relative; height: 22px; margin-top: 10px; }
.g-tick { position: absolute; transform: translateX(-50%); font-size: 11.5px; color: var(--text-dim); }
.g-tick:first-child { transform: none; }
.g-tick:last-child { transform: translateX(-100%); }
.band-meaning { margin-top: 26px; max-width: 640px; }
.band-meaning p { margin-top: 8px; font-size: 19px; line-height: 1.5; }

.locator { display: block; width: 100%; max-width: 560px; height: auto; background: var(--bg-elev); border: 1px solid var(--border); border-radius: 6px; }
.loc-land { fill: var(--land); }
.loc-country { stroke: var(--map-hover); stroke-width: 1.4; stroke-linejoin: round; }
.loc-ring { fill: none; stroke: var(--map-hover); stroke-width: 1.6; }
.stats { display: flex; flex-direction: column; }
.stat { display: grid; grid-template-columns: minmax(0, 1fr) 72px; align-items: center; gap: 6px 16px; padding: 14px 0; border-top: 1px solid var(--border); }
.stat .sc-label, .stat .rr-k { font-size: 16px; font-weight: 640; display: flex; align-items: center; }
.stat .sc-note, .rr-floor { font-size: 14px; color: var(--text-dim); margin-top: 2px; }
.stat .sc-value, .stat .rr-v { font: 800 44px/1 var(--font); font-stretch: 62%; text-align: right; font-variant-numeric: tabular-nums; }
.stat-bar { grid-column: 1 / -1; height: 4px; background: var(--measure-track); }
.stat-bar span { display: block; height: 100%; background: var(--measure); }
.risk-row.required .rr-floor { color: var(--text); font-weight: 600; }
.cards-note { font-size: 13.5px; color: var(--text-dim); }
.stack-card { padding: 16px 18px; background: var(--bg-elev); border: 1px solid var(--border); border-radius: 6px; }
.waterfall { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; font-size: 14px; }
.waterfall li { display: grid; grid-template-columns: 1fr auto 80px; align-items: baseline; gap: 10px; color: var(--text-dim); }
.waterfall .num { color: var(--text); font-weight: 600; }
.wf-b { text-align: right; }
.wf-off { grid-column: 2 / 4; text-align: right; font-style: italic; }
.wf-total { border-top: 1px solid var(--border-2); padding-top: 6px; font-weight: 700; }
.wf-total .wf-k, .wf-total .wf-b { color: var(--text); }
.dossier-side > .btn { align-self: flex-start; }

.tabs { display: flex; gap: 28px; border-bottom: 1px solid var(--border); }
.tabs [role=tab] { background: none; border: 0; border-bottom: 2px solid transparent; color: var(--text-dim); font-size: 16px; font-weight: 600; min-height: 52px; cursor: pointer; margin-bottom: -1px; }
.tabs [role=tab]:hover { color: var(--text); }
.tabs [role=tab][aria-selected="true"] { color: var(--text); border-bottom-color: var(--text); }
[role=tabpanel][hidden] { display: none; }

.c-section { padding: 40px 0; border-bottom: 1px solid var(--border); }
.c-section:last-child { border-bottom: 0; }
.c-section-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 12px 32px; margin-bottom: 18px; }
.c-section-head .section-title { margin-bottom: 0; }
.c-section-sub { margin-top: 4px; color: var(--text-dim); }
.legend-inline { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 13px; color: var(--text-dim); }
.p-dot-key { width: 12px; height: 12px; border-radius: 50%; background: var(--text); }
.p-avg-key { width: 2px; height: 14px; background: var(--average); margin-left: 10px; }
.p-base-key { width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--accent); margin-left: 10px; }

.pillar-list { border-bottom: 1px solid var(--border); }
.pillar { border-top: 1px solid var(--border); }
.pillar-head {
  width: 100%; display: grid; grid-template-columns: 14px 40px minmax(0, 280px) minmax(0, 1fr) 56px; align-items: center; gap: 16px;
  min-height: 56px; padding: 0 4px; background: none; border: 0; text-align: left; cursor: pointer;
}
.pillar-head:hover { background: var(--bg-elev-2); }
.chev { width: 8px; height: 8px; border-right: 2px solid var(--text-dim); border-bottom: 2px solid var(--text-dim); transform: rotate(-45deg); transition: transform .2s; }
.pillar.open .chev { transform: rotate(45deg); }
.pillar-id { font-size: 12px; color: var(--text-dim); }
.pillar-name { font-size: 16px; font-weight: 580; }
.pillar-note { font: 12px var(--font-mono); color: var(--text-dim); margin-left: 6px; font-weight: 400; }
.p-track { position: relative; height: 20px; }
.p-line { position: absolute; left: 0; right: 0; top: 9px; height: 2px; background: var(--measure-track); }
.p-span { position: absolute; top: 9px; height: 2px; background: var(--text); }
.p-avg { position: absolute; top: 1px; width: 2px; height: 18px; margin-left: -1px; background: var(--average); }
.p-dot, .p-base { position: absolute; top: 3px; width: 14px; height: 14px; margin-left: -7px; border-radius: 50%; }
.p-dot { background: var(--text); box-shadow: 0 0 0 2px var(--bg); }
.p-base { border: 2px solid var(--accent); background: var(--bg); }
.pillar-score { font: 800 28px/1 var(--font); font-stretch: 62%; text-align: right; font-variant-numeric: tabular-nums; }
.pillar-score .ind-empty { font-size: 12px; }
.ind-list { display: none; flex-direction: column; padding: 4px 4px 18px 90px; }
.pillar.open .ind-list { display: flex; }
.pillar-def { padding: 4px 0 10px; }
.ind { display: grid; grid-template-columns: minmax(0, 1fr) 120px 40px; align-items: center; gap: 16px; padding: 12px 0; border-top: 1px solid var(--border); }
.ind-name { display: flex; flex-direction: column; gap: 3px; font-size: 14.5px; }
.ind-id { font-size: 11.5px; color: var(--text-dim); }
.ind-def { font-size: 13px; color: var(--text-dim); line-height: 1.5; max-width: 72ch; }
.ind-track, .bar-track { height: 4px; background: var(--measure-track); overflow: hidden; }
.bar-fill { display: block; height: 100%; background: var(--measure); }
.ind-score { font-size: 13px; text-align: right; }
.ind-empty { grid-column: 2 / 4; font: italic 12.5px var(--font); color: var(--text-dim); white-space: nowrap; text-align: right; }
.data-quality { display: flex; flex-wrap: wrap; gap: 6px 24px; margin-top: 16px; font-size: 14px; color: var(--text-dim); }

.rationale .card-title { font-size: 30px; line-height: 1.1; font-stretch: 85%; font-weight: 760; margin-bottom: 18px; display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px; }
.why-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 32px; }
.why-grid h4 { font-size: 16px; font-weight: 700; margin-bottom: 8px; }
.why-grid li { padding: 10px 0; border-top: 1px solid var(--border); font-size: 15px; }
.why-grid li .num { font-weight: 600; margin-left: 4px; }
.analyst-body p { margin-bottom: 10px; font-size: 15.5px; line-height: 1.6; }

.brief-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 20px; }
.brief-col { padding: 20px 22px 12px; background: var(--bg-elev); border: 1px solid var(--border); border-radius: 6px; }
.brief-col h4 { display: flex; justify-content: space-between; align-items: baseline; font-size: 19px; font-weight: 720; margin-bottom: 8px; }
.brief-col h4 .num { font-size: 12px; font-weight: 500; color: var(--text-dim); }
.brief-col li { display: flex; gap: 12px; padding: 9px 0; border-top: 1px solid var(--border); font-size: 15px; }
.brief-col li::before { content: ''; width: 10px; height: 10px; margin-top: 5px; border: 1.5px solid var(--text); flex-shrink: 0; }

.mit-intro { font-size: 15px; color: var(--text-dim); margin: 28px 0 20px; }
.mit-group { margin-bottom: 40px; }
.mit-count { font-size: 14px; font-weight: 500; color: var(--text-dim); }
/* Measures in two columns of hairline-separated items (one column on narrow screens). */
.mit-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 440px), 1fr)); gap: 0 48px; border-bottom: 1px solid var(--border); }
.mit { padding: 16px 0 18px; border-top: 1px solid var(--border); }
.mit-title { font-size: 16.5px; font-weight: 680; margin-bottom: 6px; }
.mit-body { font-size: 15px; color: var(--text-dim); line-height: 1.6; max-width: 72ch; }

.live-section { padding-top: 36px; }
.empty-state { max-width: 560px; margin: 48px auto; text-align: center; color: var(--text-dim); font-size: 15px; line-height: 1.6; }
.empty-state h2, .empty-state h3 { color: var(--text); margin-bottom: 8px; font-size: 26px; font-stretch: 85%; font-weight: 760; }
.empty-state a { color: var(--accent); }

/* ── Countries table ─────────────────────────────────────────────────────── */
.view-countries { display: flex; flex-direction: column; background: var(--bg); }
.view-countries[hidden] { display: none; }
.table-head { padding: 40px max(40px, calc((100% - 1360px) / 2)) 0; margin-bottom: 18px; }
.table-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; padding: 0 max(40px, calc((100% - 1360px) / 2)) 16px; border-bottom: 1px solid var(--border); }
.table-toolbar > input { width: 260px; height: 40px; background: var(--bg-elev); border: 1px solid var(--border-2); border-radius: 4px; font-size: 14px; padding: 0 12px; outline: none; }
.table-toolbar > input:focus { border-color: var(--text); }
.filter-chips-inline { display: flex; flex-wrap: wrap; gap: 6px 18px; order: 5; flex-basis: 100%; }
.filter-chips-inline .filter-group { margin: 0; display: flex; align-items: center; gap: 8px; }
.filter-chips-inline .filter-group-label { margin: 0; }
.filter-selects { display: none; }
.table-count { font: 13px var(--font-mono); color: var(--text-dim); white-space: nowrap; }
.table-wrap { flex: 1; overflow: auto; padding: 0 max(28px, calc((100% - 1384px) / 2)); }
.ctable { width: 100%; border-collapse: collapse; font-size: 15px; }
.ctable thead th { position: sticky; top: 0; z-index: 2; background: var(--bg); border-bottom: 1px solid var(--border-2); text-align: left; padding: 0; }
.ctable th button { width: 100%; min-height: 44px; background: none; border: 0; color: var(--text-dim); font: 500 11px var(--font-mono); text-transform: uppercase; letter-spacing: 0.08em; text-align: inherit; padding: 0 12px; cursor: pointer; white-space: nowrap; }
.ctable th[aria-sort="ascending"] button, .ctable th[aria-sort="descending"] button { color: var(--text); font-weight: 600; }
.ctable td { padding: 10px 12px; border-bottom: 1px solid var(--border); color: var(--text-dim); white-space: nowrap; }
.ctable td .num { color: var(--text); }
.ctable td:nth-child(3) .num { font: 800 24px/1 var(--font); font-stretch: 62%; }
.ctable tbody tr:hover { background: var(--bg-elev-2); }
.ctable .sc-band { color: var(--text); font-size: 14px; }
.num-col { text-align: right !important; }
.ct-country { display: inline-flex; align-items: center; gap: 10px; color: var(--text); font-weight: 600; text-decoration: none; }
.ct-country:hover { color: var(--accent); }
.star { background: none; border: 0; color: var(--border-2); font-size: 18px; cursor: pointer; min-width: 36px; min-height: 36px; }
.star:hover { color: var(--text-dim); }
.star.on { color: var(--text); }

/* ── Watchlist ───────────────────────────────────────────────────────────── */
.watch-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.card { background: var(--bg-elev); border: 1px solid var(--border); border-radius: 6px; padding: 20px; min-width: 0; }
.card-title { font-size: 20px; font-weight: 720; margin-bottom: 12px; }
.watch-card { display: flex; flex-direction: column; gap: 12px; }
.watch-name { display: flex; align-items: center; gap: 10px; font-size: 18px; font-weight: 680; color: var(--text); text-decoration: none; }
.watch-name:hover { color: var(--accent); }
.watch-score { display: flex; align-items: center; flex-wrap: wrap; gap: 14px; }
.watch-score > .num { font: 800 48px/0.9 var(--font); font-stretch: 62%; color: var(--text) !important; }
.watch-meta { font-size: 13.5px; color: var(--text-dim); }
.watch-actions { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: auto; padding-top: 4px; }
.changes { margin-top: 40px; }
.change { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 18px; padding: 12px 0; border-bottom: 1px solid var(--border); font-size: 15px; color: var(--text-dim); }
.change-country { display: inline-flex; align-items: center; gap: 10px; min-width: 220px; color: var(--text); font-weight: 600; text-decoration: none; }
.change-move { font-weight: 650; color: var(--text); }
.change-cause { font: 12px var(--font-mono); border: 1px solid var(--border-2); border-radius: 3px; padding: 1px 6px; }

/* ── Signals ─────────────────────────────────────────────────────────────── */
.signal-filters { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 8px; }
.signal-filters select { width: auto; }
.signal-filters .table-count { margin-left: auto; }
/* A ledger: what it adds now | where and what happened | severity, source, age. Blue marks the overlay. */
.signal-list { border-top: 1px solid var(--border-2); }
.signal { display: grid; grid-template-columns: 110px minmax(0, 1fr) 220px; gap: 6px 28px; padding: 20px 0; border-bottom: 1px solid var(--border); }
.sig-delta { display: flex; flex-direction: column; gap: 6px; }
.sig-num { font: 800 44px/0.85 var(--font); font-stretch: 62%; color: var(--live); }
.sig-sub { font-size: 12.5px; color: var(--text-dim); }
.sig-where { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; font-size: 13.5px; color: var(--text-dim); margin-bottom: 6px; }
.signal-country { display: inline-flex; align-items: center; gap: 8px; font-weight: 650; color: var(--text); text-decoration: none; }
.signal-country:hover { color: var(--accent); }
.signal-title { font-size: 18px; line-height: 1.35; font-weight: 680; }
.signal-title .sample-tag { vertical-align: 3px; margin-left: 6px; }
.signal-summary { font-size: 15px; color: var(--text-dim); margin-top: 6px; line-height: 1.55; max-width: 72ch; }
.sig-meta { display: flex; flex-direction: column; gap: 4px; font-size: 13.5px; color: var(--text-dim); padding-top: 2px; }
.sig-meta a { color: var(--text-dim); }
.sig-meta a:hover { color: var(--accent); }
.sev { color: var(--text); font-weight: 600; }
.signal.expired .sig-num, .signal.retracted .sig-num { color: var(--text-faint); }
.signal.expired .sig-body, .signal.retracted .sig-body { opacity: 0.75; }
.sample-tag { font: 600 10.5px var(--font-mono); text-transform: uppercase; letter-spacing: 0.08em; color: var(--warn); border: 1px dashed var(--warn); border-radius: 3px; padding: 1px 5px; white-space: nowrap; }
.sample-note { margin-bottom: 18px; display: flex; align-items: center; gap: 8px; }

/* ── Methodology ─────────────────────────────────────────────────────────── */
.methodology { display: grid; grid-template-columns: 200px minmax(0, 760px); gap: 40px; }
.toc { position: sticky; top: 24px; align-self: start; display: flex; flex-direction: column; gap: 2px; border-left: 1px solid var(--border); }
.toc a { font-size: 14px; color: var(--text-dim); text-decoration: none; padding: 6px 12px; }
.toc a:hover { color: var(--text); background: var(--bg-elev-2); }
.prose { font-size: 16px; line-height: 1.65; color: var(--text-dim); }
.prose h2 { font-size: 30px; line-height: 1.1; font-stretch: 85%; font-weight: 760; color: var(--text); margin: 40px 0 12px; scroll-margin-top: 16px; }
.prose h2:first-child { margin-top: 0; }
.prose p, .prose ul { margin-bottom: 14px; }
.prose ul { list-style: square; padding-left: 20px; }
.prose strong { color: var(--text); }
.prose .lead { color: var(--text); font-size: 19px; line-height: 1.5; }
.band-defs { display: flex; flex-direction: column; gap: 14px; margin-bottom: 14px; }
.band-def dt { display: flex; align-items: center; gap: 10px; font-weight: 700; color: var(--text); }
.band-def dt .legend-dot { width: 14px; height: 14px; }
.band-def dd { margin: 4px 0 0 24px; }
.cat-pillar { margin-bottom: 28px; }
.cat-pillar h4 { color: var(--text); font-size: 18px; margin-bottom: 4px; }
.cat-id { font-size: 12px; color: var(--text-dim); }
.cat-table { width: 100%; border-collapse: collapse; font-size: 14px; margin-top: 8px; }
.cat-table th { text-align: left; font: 500 11px var(--font-mono); text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-dim); padding: 8px; border-bottom: 1px solid var(--border-2); }
.cat-table td { padding: 9px 8px; border-bottom: 1px solid var(--border); vertical-align: top; }
.cat-table td:first-child { color: var(--text); white-space: nowrap; }

/* ── Compare ─────────────────────────────────────────────────────────────── */
/* One grid for every row: a label column, then one column per country (plus the add slot). */
.cmp-grid { display: flex; flex-direction: column; }
.cmp-row, .cmp-group { display: grid; grid-template-columns: minmax(220px, 1.2fr) repeat(var(--cols), minmax(0, 1fr)); gap: 0 28px; }
.cmp-row { align-items: center; min-height: 48px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.cmp-heads { align-items: start; min-height: 0; padding: 0 0 20px; border-bottom: 1px solid var(--border-2); }
.cmp-note { font-size: 14px; color: var(--text-dim); line-height: 1.5; max-width: 30ch; }
.cmp-head { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.cmp-head-top { display: flex; align-items: center; justify-content: space-between; gap: 6px; min-height: 32px; }
.cmp-name { display: inline-flex; align-items: center; gap: 8px; min-width: 0; font-size: 17px; font-weight: 680; color: var(--text); text-decoration: none; }
.cmp-name span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cmp-name:hover { color: var(--accent); }
.cmp-remove { flex-shrink: 0; background: none; border: 0; color: var(--text-faint); cursor: pointer; font-size: 14px; min-width: 32px; min-height: 32px; }
.cmp-remove:hover { color: var(--text); }
.cmp-score { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; }
.cmp-ccr { font: 800 64px/0.8 var(--font); font-stretch: 62%; letter-spacing: -0.02em; }
.cmp-add { display: flex; flex-direction: column; gap: 10px; align-self: stretch; justify-content: flex-end; padding: 14px; border: 1.5px dashed var(--border-2); border-radius: 6px; }
.cmp-group { align-items: baseline; padding: 28px 0 10px; border-bottom: 1px solid var(--border-2); }
.cmp-group .eyebrow { color: var(--text); }
.cmp-group .cmp-hint { grid-column: 2 / -1; }
.cmp-hint { font-size: 13px; color: var(--text-dim); font-weight: 400; }
.cmp-label { font-size: 15px; color: var(--text); }
.cmp-label .cmp-hint { display: block; }
.cmp-key .cmp-label { font-weight: 680; }
.cmp-cell { display: grid; grid-template-columns: 34px minmax(0, 1fr); align-items: center; gap: 12px; color: var(--text-dim); }
.cmp-cell .num { font-size: 15px; }
.cmp-key .cmp-cell .num { font: 800 26px/1 var(--font); font-stretch: 62%; }
.cmp-cell.max .num { color: var(--text); font-weight: 700; }
.cmp-key .cmp-cell.max .num { font-weight: 800; }
.cmp-cell.max .bar-fill { background: var(--text); }
.cmp-bar { max-width: 180px; }
.cmp-toggle { display: inline-flex; align-items: center; gap: 12px; background: none; border: 0; color: var(--text); font-size: 15px; cursor: pointer; text-align: left; min-height: 32px; }
.cmp-toggle:hover { color: var(--accent); }
.cmp-toggle .chev { transform: rotate(-45deg); flex-shrink: 0; }
.cmp-row.open .chev { transform: rotate(45deg); }
.cmp-row.open { border-bottom-color: transparent; }
.cmp-ind { min-height: 40px; background: var(--bg-elev); border-bottom-color: var(--bg); }
.cmp-ind .cmp-label { padding-left: 22px; font-size: 14px; color: var(--text-dim); }
.cmp-ind .cmp-cell .num { font-size: 14px; }
.cmp-empty { max-width: 560px; display: flex; flex-direction: column; gap: 18px; font-size: 16px; color: var(--text-dim); line-height: 1.55; }
.cmp-empty .cmp-add { max-width: 360px; }

/* ── Settings ────────────────────────────────────────────────────────────── */
.settings { display: flex; gap: 40px; }
.settings-nav { display: flex; flex-direction: column; gap: 2px; width: 200px; flex-shrink: 0; border-left: 1px solid var(--border); }
.settings-nav a { color: var(--text-dim); text-decoration: none; font-size: 15px; padding: 9px 14px; margin-left: -1px; border-left: 2px solid transparent; }
.settings-nav a:hover { color: var(--text); }
.settings-nav a.active { color: var(--text); font-weight: 650; border-left-color: var(--text); }
.settings-body { flex: 1; min-width: 0; max-width: 640px; display: flex; flex-direction: column; gap: 18px; }
.settings-body h2 { font-size: 30px; line-height: 1.1; font-stretch: 85%; font-weight: 760; }
.settings-body h3 { font-size: 18px; margin-bottom: 6px; }
.settings-body .settings-sub { font: 500 12px var(--font-mono); text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-dim); margin: 8px 0 0; }
.settings-form { display: flex; flex-direction: column; gap: 16px; }
.settings-list li { display: flex; justify-content: space-between; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--border); font-size: 15px; }
.settings-actions { display: flex; flex-direction: column; gap: 18px; }
.form-row { display: flex; align-items: center; gap: 14px; }
.form-status { font-size: 14px; color: var(--ok); }
.form-status.error { color: var(--danger); }

/* ── Fields, modal, toast ────────────────────────────────────────────────── */
.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px 20px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field.full { grid-column: 1 / -1; }
.field .k { font: 500 11px var(--font-mono); text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-dim); }
.field .v { font-size: 15px; color: var(--text); }
.field input, .field textarea, .field select {
  background-color: var(--bg-elev); border: 1px solid var(--border-2); border-radius: 4px;
  color: var(--text); min-height: 44px; padding: 0 12px; font-size: 15px; outline: none; width: 100%;
}
.field input:focus, .field textarea:focus, .field select:focus { border-color: var(--text); }
.field textarea { resize: vertical; min-height: 110px; padding: 10px 12px; }

.overlay { position: fixed; inset: 0; background: rgba(22, 24, 29, 0.5); z-index: 90; display: none; align-items: center; justify-content: center; padding: 24px; }
.overlay.open { display: flex; }
.modal { width: 720px; max-width: 100%; max-height: 86vh; background: var(--bg-elev); border: 1px solid var(--border-2); border-radius: 8px; box-shadow: var(--shadow); display: flex; flex-direction: column; overflow: hidden; }
.modal-head { display: flex; align-items: center; padding: 20px 24px 0; }
.modal-head h3 { font-size: 26px; font-stretch: 85%; font-weight: 760; flex: 1; }
.login-modal { width: 400px; }
.login-body { padding: 14px 24px 24px; }
.login-body .sub { color: var(--text-dim); margin-bottom: 18px; }
.login-status { font-size: 14px; color: var(--text-dim); margin-top: 14px; text-align: center; line-height: 1.6; min-height: 1em; }

.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--text); color: var(--bg); border-radius: 4px; padding: 12px 18px; font-size: 14.5px; font-weight: 600;
  box-shadow: var(--shadow); opacity: 0; transition: all .25s; z-index: 100; pointer-events: none;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast .ok-dot { display: none; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 5px; border: 2px solid var(--bg); }

/* ── Sign-in / no-access page ────────────────────────────────────────────── */
.auth-page { position: fixed; inset: 0; z-index: 150; display: none; background: var(--bg); grid-template-columns: minmax(0, 1.15fr) minmax(400px, 1fr); }
.auth-page.open { display: grid; }
/* The brand side: the Atlas on paper. A faint, unscored world map sits behind the headline. */
.auth-brand { position: relative; overflow: hidden; display: flex; flex-direction: column; padding: 40px 56px; color: var(--text); }
.auth-map { position: absolute; left: -4%; right: -4%; top: 96px; width: 108%; height: auto; pointer-events: none; }
.auth-map path { fill: var(--land); stroke: var(--bg); stroke-width: 0.4; }
.auth-brand-head, .auth-brand-body { position: relative; }
.auth-brand-head { display: flex; align-items: center; gap: 12px; }
.auth-brand .mark { width: 34px; height: 34px; }
.auth-brand .wordmark { font-size: 24px; }
.auth-brand-body { margin-top: auto; max-width: 640px; padding-top: 32px; }
.auth-tagline { margin-top: 14px; font-size: clamp(40px, 4.6vw, 68px); line-height: 0.98; font-stretch: 78%; font-weight: 780; letter-spacing: -0.02em; }
.auth-scale { margin: 32px 0 0; }
.auth-stats { display: flex; gap: 48px; margin: 28px 0 22px; padding-top: 22px; border-top: 1px solid var(--border); }
.auth-stats dt { font: 500 11px var(--font-mono); text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-dim); }
.auth-stats dd { font: 800 56px/1 var(--font); font-stretch: 62%; margin-top: 6px; }
.auth-scope { font-size: 15px; line-height: 1.6; color: var(--text-dim); max-width: 600px; }
.auth-panel { display: flex; align-items: center; justify-content: center; padding: 32px 24px; overflow-y: auto; background: var(--bg-elev-2); border-left: 1px solid var(--border); }
.auth-card { width: 100%; max-width: 420px; padding: 36px 32px 28px; background: var(--bg-elev); border: 1px solid var(--border); border-radius: 6px; box-shadow: 0 1px 3px rgba(22, 24, 29, 0.05); }
.auth-card h2 { font-size: 36px; line-height: 1; font-stretch: 80%; font-weight: 780; letter-spacing: -0.015em; margin-bottom: 24px; }
.auth-primary, .auth-secondary { width: 100%; }
.auth-secondary { margin-top: 14px; }
.auth-hint { font-size: 14px; color: var(--text-dim); line-height: 1.6; margin-top: 10px; }
.auth-or { display: flex; align-items: center; gap: 12px; margin: 26px 0 18px; font-size: 13px; color: var(--text-dim); }
.auth-or::before, .auth-or::after { content: ''; flex: 1; height: 1px; background: var(--border); }
.auth-legal { margin-top: 28px; display: flex; justify-content: center; gap: 8px; font-size: 13px; color: var(--text-dim); }
.auth-legal a { color: var(--text-dim); }
.auth-legal a:hover { color: var(--text); }
#loginForm, #codeForm, #resetRequestForm, #resetPasswordForm { display: flex; flex-direction: column; gap: 14px; }
#resetRequestForm, #resetPasswordForm { margin-top: 18px; }
#loginForm .auth-primary, #codeForm .auth-primary, #resetRequestForm .auth-primary, #resetPasswordForm .auth-primary { margin-top: 4px; }
#loginCode { font: 600 24px var(--font-mono); letter-spacing: 0.3em; text-align: center; }
#loginForm .auth-secondary { margin-top: 0; }
#loginForm[hidden], #loginForm [hidden] { display: none; }
#resetPasswordForm[hidden] { display: none; }

/* The briefing exists only for print (css/print.css). */
.briefing, .print-note { display: none; }

/* A deterrent, not protection: page text can't be selected (so Cmd+A, Cmd+C copy nothing); form
   fields still can. app.js also cancels copy and cut outside form fields. */
body { -webkit-user-select: none; user-select: none; }
input, textarea, [contenteditable] { -webkit-user-select: text; user-select: text; }

/* ── Responsive ──────────────────────────────────────────────────────────── */
.tabbar { display: none; }

@media (max-width: 1320px) {
  .topbar { gap: 20px; padding: 0 24px; }
  .topnav { gap: 18px; }
  .topbar .typeahead { width: 190px; }
  .lens-chip-k { display: none; }
  .lens-chip-v { max-width: 160px; }
}
@media (max-width: 1180px) {
  .topbar .wordmark { display: none; }
  .topnav a { font-size: 14px; }
  .atlas, .page { padding-left: 28px; padding-right: 28px; }
  .detail, .table-head, .table-toolbar { padding-left: 28px; padding-right: 28px; }
  .table-wrap { padding: 0 16px; }
  .atlas-main { grid-template-columns: 1fr; }
  .map-panel { contain: none; height: 520px; }
  .why-grid { grid-template-columns: 1fr; gap: 12px; }
}

/* Small or short screens: the Countries page scrolls as a whole, so the table is never squeezed to
   nothing under its toolbar (a landscape phone has ~260px between header and tab bar). */
@media (max-width: 1024px), (max-height: 600px) {
  .view-countries { display: block; overflow-y: auto; }
  .table-wrap { overflow-x: auto; overflow-y: visible; }
}

/* Tablets: the header keeps its links; the search and lens chip give up room for them. */
@media (max-width: 1024px) {
  .topbar { gap: 14px; padding: 0 16px; }
  .topnav { gap: 14px; }
  .topbar .typeahead { width: auto; flex: 1 1 120px; min-width: 0; }
  .kbd { display: none; }
  .tip { left: 50% !important; transform: translateX(-50%) !important; max-width: calc(100vw - 32px); width: calc(100vw - 32px); }
  .field-grid { grid-template-columns: 1fr; }
}

@media (max-width: 900px) {
  .lens-chip-v { max-width: 110px; }
}

@media (max-width: 760px) {
  /* Phones: the header links move to a bottom tab bar. */
  .topnav { display: none; }
  .topbar { gap: 10px; padding: 0 14px; }
  .tabbar { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 50; height: 62px; background: var(--bg-elev); border-top: 1px solid var(--border); }
  .tabbar a { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; color: var(--text-dim); text-decoration: none; font-size: 11.5px; }
  .tabbar a.active { color: var(--text); font-weight: 700; }
  .tabbar svg { width: 20px; height: 20px; }
  .views { margin-bottom: 62px; }
  .page, .atlas { padding: 24px 16px 48px; }
  /* Phones: the Atlas without the map; the country list is the way in. */
  .map-card { display: none; }
  .atlas-hero { margin-bottom: 20px; }
  .map-panel { height: 460px; }
  .detail { padding: 0 16px 48px; }
  .table-head { padding: 24px 16px 0; }
  .table-toolbar { padding: 0 16px 14px; }
  .table-toolbar > input { width: 100%; }
  .filter-chips-inline { display: none; }
  .filter-selects { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; order: 5; flex-basis: 100%; }
  .filter-selects select { flex: 1 1 140px; width: auto; }
  .table-wrap { padding: 0 4px; }
  .settings { flex-direction: column; gap: 16px; }
  .settings-nav { flex-direction: row; flex-wrap: wrap; width: auto; border-left: 0; border-bottom: 1px solid var(--border); }
  .settings-nav a { white-space: nowrap; border-left: 0; border-bottom: 2px solid transparent; margin: 0 0 -1px; }
  .settings-nav a.active { border-bottom-color: var(--text); }
  .methodology { grid-template-columns: minmax(0, 1fr); }
  /* The indicator catalogue stacks: name, then what it measures, then what it's based on. */
  .cat-table thead { display: none; }
  .cat-table tr { display: block; padding: 10px 0; border-bottom: 1px solid var(--border); }
  .cat-table td { display: block; padding: 2px 0; border: 0; }
  .toc { position: static; flex-direction: row; flex-wrap: wrap; border-left: 0; }
  .cat-table td:first-child { white-space: normal; }
  .controls .lens-popover { position: fixed; left: 12px; right: 12px; top: 72px; width: auto; }
  .topbar .typeahead { flex: 1 1 120px; min-width: 0; }
  .topbar > * { min-width: 0; }
  .avatar, .brand { flex-shrink: 0; }
  .lens-chip-main { padding: 0 10px; }
  .lens-chip-v { max-width: 104px; }
  .c-actions .btn { min-height: 40px; padding: 0 12px; font-size: 14px; }
  .c-title h2 { gap: 12px; }
  .flag-lg-icon { width: 36px !important; height: 27px !important; }
  .pillar-head { grid-template-columns: 12px minmax(0, 1fr) 44px; gap: 10px; padding: 10px 0; }
  .pillar-head .pillar-id { display: none; }
  .pillar-head .p-track { grid-column: 2 / 4; grid-row: 2; }
  .ind-list { padding-left: 0; }
  .ind { grid-template-columns: minmax(0, 1fr) 36px; }
  .ind-track { display: none; }
  .ctable th:nth-child(2), .ctable td:nth-child(2),
  .ctable th:nth-child(5), .ctable td:nth-child(5),
  .ctable th:nth-child(6), .ctable td:nth-child(6),
  .ctable th:nth-child(7), .ctable td:nth-child(7),
  .ctable th:nth-child(8), .ctable td:nth-child(8) { display: none; } /* watch from the country page */
  .ctable td, .ctable th button { padding-left: 8px; padding-right: 8px; }
  .ctable td:first-child { white-space: normal; }
  /* Phones: each row's label sits on its own line above the values. */
  .cmp-row, .cmp-group { grid-template-columns: repeat(var(--n), minmax(0, 1fr)); gap: 4px 12px; }
  .cmp-label, .cmp-note, .cmp-group .eyebrow, .cmp-group .cmp-hint, .cmp-heads .cmp-add { grid-column: 1 / -1; }
  .cmp-heads { gap: 14px 12px; }
  .cmp-name { font-size: 14px; }
  .cmp-ccr { font-size: 44px; }
  .cmp-score .sc-band { font-size: 13px; }
  .cmp-add { padding: 10px; }
  .cmp-cell { grid-template-columns: 1fr; gap: 4px; }
  .cmp-bar { max-width: none; }
  .cmp-ind .cmp-label { padding-left: 0; }
  .signal { grid-template-columns: 64px minmax(0, 1fr); gap: 4px 14px; }
  .sig-num { font-size: 32px; }
  .sig-meta { grid-column: 2; flex-direction: row; flex-wrap: wrap; gap: 2px 14px; }
  .overlay { padding: 12px; }
}

@media (max-width: 900px) {
  .auth-page.open { grid-template-columns: 1fr; grid-template-rows: auto 1fr; overflow-y: auto; }
  .auth-brand { padding: 22px 18px 4px; }
  .auth-brand-body { margin-top: 0; padding-top: 22px; }
  .auth-tagline { font-size: clamp(30px, 6vw, 44px); }
  .auth-map, .auth-stats { display: none; }
  .auth-scope { margin-top: 14px; max-width: 640px; }
  .auth-scale { margin-top: 20px; }
  .auth-panel { align-items: flex-start; justify-content: flex-start; padding: 24px 18px 40px; background: var(--bg); border-left: 0; }
  .auth-card { max-width: 520px; padding: 24px 20px; }
  .auth-scale { max-width: 520px; }
}
@media (max-width: 600px) {
  .auth-scale, .auth-scope { display: none; } /* five labels don't fit a phone's width; keep the form in view */
  .auth-panel { padding-left: 16px; padding-right: 16px; }
}

/* The narrowest phones: the lens and account buttons keep their size, and the search gives way. */
@media (max-width: 360px) {
  .topbar { gap: 8px; padding: 0 12px; }
  .topbar .controls, .avatar-menu { flex-shrink: 0; }
  body:not([data-route="map"]) .topbar-spacer { display: none; }
  .topbar .typeahead input { text-overflow: ellipsis; }
  .lens-chip-main { padding: 0 8px; }
  .lens-chip-v { max-width: 84px; }
}
