:root {
  --bg: #0b0e14;
  --bg-2: #0e1219;
  --panel: #141923;
  --panel-2: #1c2230;
  --panel-3: #232a3a;
  --border: #2a3142;
  --border-strong: #394258;
  --fg: #e6edf3;
  --fg-soft: #c9d1d9;
  --muted: #8b95a7;
  --muted-2: #6b7587;
  --accent: #d94646;
  --accent-rgb: 217, 70, 70;
  --accent-soft: #e85f5f;
  --accent-deep: #a02828;
  --accent-2: #b03030;
  --accent-3: #f3a3a3;
}

/* "Red" theme — light red → dark red. */
[data-theme="red"] {
  --accent: #d94646;
  --accent-rgb: 217, 70, 70;
  --accent-soft: #e85f5f;
  --accent-deep: #a02828;
  --accent-2: #b03030;
  --accent-3: #f3a3a3;
}

/* "Blue" theme — light blue → dark blue. */
[data-theme="blue"] {
  --accent: #4a90d9;
  --accent-rgb: 74, 144, 217;
  --accent-soft: #6fb3ff;
  --accent-deep: #155a96;
  --accent-2: #155a96;
  --accent-3: #84c0e8;
}

/* "Yellow" theme — light yellow → brown. */
[data-theme="yellow"] {
  --accent: #b8742d;
  --accent-rgb: 184, 116, 45;
  --accent-soft: #d4a017;
  --accent-deep: #5e3a18;
  --accent-2: #8b5520;
  --accent-3: #f0c14b;
  --gold: #f5d76e;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.35);
  --shadow-lg: 0 12px 40px rgba(0,0,0,0.5);
}

/* ============ Splash ============ */
.splash {
  position: fixed; inset: 0; z-index: 9999;
  background: transparent;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
  animation: splash-in 0.5s ease-out;
}
.splash-door {
  position: absolute; top: 0; bottom: 0; width: 50%;
  background: #0a0d12;
  z-index: 1;
  transition: transform 0.9s cubic-bezier(0.83, 0, 0.17, 1);
}
.splash-door-left { left: 0; border-right: 1px solid rgba(255,255,255,0.04); }
.splash-door-right { right: 0; border-left: 1px solid rgba(255,255,255,0.04); }
.splash-door::before {
  content: "";
  position: absolute; inset: 0;
  background:
    radial-gradient(ellipse 600px 400px at 50% 40%, rgba(255,107,107,0.06) 0%, transparent 70%),
    radial-gradient(ellipse 800px 500px at 50% 100%, rgba(88,166,255,0.05) 0%, transparent 70%);
  pointer-events: none;
}
.splash-door-left::before { background-position: 100% center; transform: translateX(50%); }
.splash-door-right::before { background-position: 0% center; transform: translateX(-50%); }
.splash.dismissed { pointer-events: none; }
.splash.dismissed .splash-door-left  { transform: translateX(-100%); }
.splash.dismissed .splash-door-right { transform: translateX( 100%); }
.splash.dismissed .splash-inner {
  animation: splash-content-out 0.4s ease-in forwards;
}
.splash-inner {
  text-align: center; padding: 0 24px; max-width: 720px;
  position: relative; z-index: 2;
}
.splash-logo {
  width: 220px; height: 220px;
  object-fit: contain;
  border-radius: 28px;
  background: #f3ecd9;
  padding: 6px;
  box-shadow:
    0 0 0 1px rgba(255,255,255,0.08),
    0 20px 60px rgba(0,0,0,0.7);
  animation: splash-pop 0.8s cubic-bezier(.2,.8,.2,1) both;
}
.splash-eyebrow {
  margin-top: 32px; color: var(--accent); letter-spacing: 0.24em;
  font-size: 13px; text-transform: uppercase; font-weight: 800;
  font-family: "Inter", sans-serif;
}
.splash-title {
  margin: 18px auto 18px;
  font-size: 38px;
  color: var(--fg);
  font-weight: 500;
  line-height: 1.15; letter-spacing: -0.025em;
  font-family: "Space Grotesk", sans-serif;
  max-width: 640px;
}
.splash-rule {
  width: 36px; height: 1px;
  background: var(--accent);
  margin: 0 auto 18px;
  opacity: 0.7;
}
.splash-sub {
  color: var(--fg-soft);
  letter-spacing: 0.32em;
  font-size: 13px;
  text-transform: uppercase;
  font-weight: 700;
}
.splash-btn {
  margin-top: 44px;
  background: var(--accent);
  color: #fff;
  border: 1px solid var(--accent);
  padding: 13px 30px;
  font-size: 11px;
  border-radius: 3px;
  cursor: pointer;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  font-weight: 700;
  transition: background 0.2s ease, border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
  font-family: inherit;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 4px 16px rgba(217,70,70,0.25);
}
.splash-btn:hover {
  background: var(--accent-deep);
  border-color: var(--accent-deep);
  box-shadow: 0 8px 24px rgba(217,70,70,0.4);
  transform: translateY(-1px);
}
.splash-btn .splash-btn-arrow {
  transition: transform 0.2s ease;
  font-size: 13px;
}
.splash-btn:hover .splash-btn-arrow { transform: translateX(4px); }

@keyframes splash-in { from { opacity: 0 } to { opacity: 1 } }
@keyframes splash-content-out {
  from { opacity: 1; transform: scale(1); }
  to { opacity: 0; transform: scale(0.94); }
}
@keyframes splash-pop {
  from { opacity: 0; transform: scale(0.78) }
  to { opacity: 1; transform: scale(1) }
}

* { box-sizing: border-box; }
html, body {
  margin: 0; height: 100%;
  background: var(--bg); color: var(--fg);
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ============ Scrollbars ============ */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb {
  background: var(--panel-3);
  border: 2px solid var(--bg);
  border-radius: 6px;
}
::-webkit-scrollbar-thumb:hover { background: var(--border-strong); }

::selection { background: rgba(217,70,70,0.4); color: var(--fg); }

:focus-visible {
  outline: 2px solid var(--accent-2);
  outline-offset: 2px;
  border-radius: 3px;
}
button:focus-visible { outline-offset: 3px; }

/* ============ Topbar ============ */
.topbar {
  display: flex; align-items: center; gap: 24px;
  padding: 14px 28px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  position: relative;
  z-index: 10;
  flex-wrap: wrap;
}

.brand {
  display: flex; align-items: center; gap: 14px;
  text-decoration: none; color: inherit;
  cursor: pointer;
  transition: opacity 0.15s ease;
}
.brand:hover { opacity: 0.85; }
.brand-logo {
  height: 48px; width: 48px;
  object-fit: cover;
  /* Crop slightly inward so the cream padding around the circle doesn't
     dominate at the small topbar size — focus on the African map disc. */
  object-position: center 38%;
  display: block;
  border-radius: 8px;
  background: #f3ecd9;
  box-shadow: 0 0 0 1px rgba(255,255,255,0.08), 0 2px 6px rgba(0,0,0,0.4);
  flex-shrink: 0;
}
.brand-text { display: flex; flex-direction: column; gap: 2px; line-height: 1; }
.brand h1 {
  margin: 0;
  font-size: 22px;
  letter-spacing: 0.18em;
  color: var(--fg);
  font-family: "Space Grotesk", sans-serif;
  font-weight: 700;
  display: inline-flex;
  align-items: baseline;
  line-height: 1;
}
.brand-dot {
  color: var(--accent);
  font-weight: 700;
  margin-left: 1px;
}
.tagline {
  color: var(--fg-soft);
  font-size: 10.5px;
  font-weight: 600;
  font-style: italic;
  letter-spacing: 0.03em;
  margin-top: 4px;
}

.topnav {
  display: flex; gap: 2px;
  margin-left: 8px;
  border-left: 1px solid var(--border);
  padding-left: 16px;
  align-items: center;
  flex-wrap: wrap;
}
.topnav a {
  color: var(--muted);
  text-decoration: none;
  font-size: 11px;
  padding: 7px 13px;
  border-radius: 4px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  transition: color 0.15s ease, background 0.15s ease;
  position: relative;
}
.topnav a:hover { color: var(--fg); }
.topnav a.active {
  color: var(--fg);
}
/* "Next country" pill in the top-bar — Map page only. Sits as a sibling of
   .topnav, right after the Analytics link. Defensive properties guarantee
   the pill never collapses. */
.nav-next-pill {
  display: inline-flex !important;
  visibility: visible !important;
  align-items: center;
  gap: 11px;
  margin: 0;
  padding: 6px 16px 6px 14px;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.02) 0%, transparent 100%),
    var(--panel-2);
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  position: relative;
  white-space: nowrap;
  line-height: 1;
  flex-shrink: 0;
  transition: border-color 0.2s ease, background 0.2s ease, transform 0.2s ease;
}
.nav-next-pill:hover {
  border-color: var(--accent);
  background:
    linear-gradient(180deg, rgba(255,255,255,0.025) 0%, transparent 100%),
    var(--panel-3);
}
.nav-next-pill::before {
  content: "";
  display: inline-block;
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 3px rgba(217, 70, 70, 0.16);
  flex-shrink: 0;
  animation: nav-next-pulse 2.4s ease-in-out infinite;
}
@keyframes nav-next-pulse {
  0%, 100% { box-shadow: 0 0 0 3px rgba(217, 70, 70, 0.16); }
  50%      { box-shadow: 0 0 0 5px rgba(217, 70, 70, 0.04); }
}
.nav-next-pill-label {
  color: var(--muted);
  font-size: 8.5px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  transition: color 0.18s ease;
}
.nav-next-pill:hover .nav-next-pill-label { color: var(--accent); }
.nav-next-pill-divider {
  width: 1px;
  align-self: stretch;
  background: var(--border-strong);
  margin: 4px 0;
}
.nav-next-pill-flag {
  width: 18px; height: auto; aspect-ratio: 3 / 2;
  object-fit: cover;
  border-radius: 2px;
  border: 1px solid rgba(255,255,255,0.15);
  box-shadow: 0 1px 2px rgba(0,0,0,0.4);
  display: block;
  flex-shrink: 0;
}
.nav-next-pill-name {
  font-family: "Space Grotesk", sans-serif;
  font-weight: 600;
  font-size: 11.5px;
  color: var(--fg);
  letter-spacing: 0;
}
@media (max-width: 900px) {
  .nav-next-pill-label,
  .nav-next-pill-divider { display: none; }
  .nav-next-pill { padding: 5px 12px 5px 10px; gap: 8px; }
}

.topnav a.active::after {
  content: ""; position: absolute;
  left: 16px; right: 16px; bottom: 2px;
  height: 2px; background: var(--accent);
  border-radius: 1px;
}

.topstats { display: flex; gap: 0; align-items: stretch; margin-left: auto; }
.topstats > div {
  text-align: right;
  padding: 0 16px;
  position: relative;
  display: flex; flex-direction: column; justify-content: center;
  min-width: 80px;
}
.topstats > div:not(:first-child)::before {
  content: ""; position: absolute; left: 0; top: 18%; bottom: 18%;
  width: 1px; background: var(--border);
}
.topstats > div:last-child { padding-right: 4px; }
.topstats span {
  font-size: 20px;
  font-weight: 600;
  color: var(--fg);
  display: block;
  font-family: "Space Grotesk", sans-serif;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}
.topstats label {
  color: var(--muted-2);
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-weight: 600;
  margin-top: 4px;
  display: block;
}

/* ============ Layout ============ */
main {
  display: grid;
  grid-template-columns: 320px 1fr 340px;
  height: calc(100vh - 64px);
}

/* "Next country" card — sits beneath the Countries list in the sidebar. */
.next-card {
  position: relative;
  margin: 8px 0 0;
  padding: 10px 12px 12px 14px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  overflow: hidden;
}
.next-card::before {
  content: ""; position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 2px;
  background: var(--accent);
}
.next-card-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-weight: 700;
  font-size: 9px;
}
.next-card-eyebrow svg {
  width: 11px;
  height: 11px;
}
.next-card-row {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 1px 0;
}
.next-card-flag {
  width: 26px; height: auto; aspect-ratio: 3 / 2;
  object-fit: cover;
  border-radius: 3px;
  border: 1px solid var(--border-strong);
  box-shadow: 0 1px 2px rgba(0,0,0,0.4), inset 0 0 0 1px rgba(255,255,255,0.04);
  flex-shrink: 0;
  display: block;
}
.next-card-name {
  font-family: "Space Grotesk", sans-serif;
  font-weight: 600;
  font-size: 14px;
  color: var(--fg);
  letter-spacing: -0.01em;
}
.next-card-sub {
  color: var(--muted);
  font-size: 11px;
  font-style: italic;
}

.sidebar, .detail {
  background: var(--panel);
  border-right: 1px solid var(--border);
  padding: 0;
}
.sidebar {
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.sidebar-scroll {
  flex: 1 1 auto;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 14px 16px 8px;
  min-height: 0;
  scroll-behavior: smooth;
  scrollbar-width: thin;
  scrollbar-color: var(--border-strong) transparent;
}
.sidebar-scroll::-webkit-scrollbar { width: 6px; }
.sidebar-scroll::-webkit-scrollbar-track { background: transparent; }
.sidebar-scroll::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 3px;
}
.sidebar-scroll::-webkit-scrollbar-thumb:hover { background: var(--accent); }

/* Floating "scroll for more" button — pinned to the bottom of the sidebar
   above the Africa-Foundation credit. Visible only when there is more
   content below the current viewport. */
.sidebar-scroll-btn {
  position: absolute;
  left: 50%; bottom: 6px;
  transform: translate(-50%, 8px);
  width: 30px; height: 30px;
  background: var(--panel-2);
  border: 1px solid var(--border-strong);
  border-radius: 50%;
  color: var(--fg);
  cursor: pointer;
  font-family: inherit;
  font-size: 13px;
  line-height: 1;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease, background 0.15s ease;
  z-index: 50;
  box-shadow: 0 4px 10px rgba(0,0,0,0.45);
}
.sidebar-scroll-btn.visible {
  opacity: 1;
  pointer-events: auto;
  transform: translate(-50%, 0);
}
.sidebar-scroll-btn:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.sidebar-scroll-btn svg { width: 14px; height: 14px; }
.sidebar { position: relative; }
.detail {
  border-right: none; border-left: 1px solid var(--border);
  display: flex; flex-direction: column;
  padding: 0;
  min-height: 0;
}
.detail-body {
  flex: 1 1 auto;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 16px 14px;
  min-height: 0;
  scrollbar-width: thin;
  scrollbar-color: var(--border-strong) transparent;
}
.detail-body::-webkit-scrollbar { width: 6px; }
.detail-body::-webkit-scrollbar-track { background: transparent; }
.detail-body::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 3px; }
.detail-body::-webkit-scrollbar-thumb:hover { background: var(--accent); }
.detail-body * { min-width: 0; }
.detail-body > div { min-width: 0; }

/* Sidebar section titles (Filters · Years · Legend · Display) — compact,
   accent-colored chapter labels with a soft left-bar and underline so each
   section reads as a clearly separated block without dominating the panel. */
.sidebar h2 {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 12px 0 8px;
  padding: 4px 0 5px 8px;
  font-family: "Space Grotesk", "Inter", sans-serif;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
  border-bottom: 1px solid rgba(var(--accent-rgb), 0.22);
  border-left: 3px solid var(--accent);
  background: linear-gradient(90deg, rgba(var(--accent-rgb), 0.06), transparent 70%);
  border-radius: 3px 0 0 0;
}
.sidebar h2::before {
  content: "";
  display: inline-block;
  width: 5px; height: 5px;
  background: var(--accent);
  border-radius: 50%;
  box-shadow: 0 0 0 2px rgba(var(--accent-rgb), 0.18);
  flex-shrink: 0;
}
.sidebar section:first-child h2 { margin-top: 2px; }
.sidebar section { margin-bottom: 4px; }

/* ============ (i) Info button + popover ============ */
/* Compact circular icon button — clicking it reveals the matching
   .info-popover paragraph beneath. */
.info-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  margin-left: auto;
  padding: 0;
  background: transparent;
  border: 0;
  color: var(--muted);
  cursor: pointer;
  border-radius: 50%;
  transition: color 0.15s ease, background 0.15s ease, transform 0.15s ease;
  flex-shrink: 0;
}
.info-btn svg { width: 16px; height: 16px; display: block; }
.info-btn:hover {
  color: var(--accent);
  background: rgba(var(--accent-rgb), 0.10);
}
.info-btn.open {
  color: #fff;
  background: var(--accent);
}

/* Inline row that hosts a label + the (i) icon (for Meeting Details and
   Leader Biographies in the left sidebar). */
.info-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 6px 0 4px;
  padding: 7px 10px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 7px;
  font-family: inherit;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--fg);
  box-shadow: 0 1px 2px rgba(0,0,0,0.18);
}
.info-row .info-label { flex: 1; }
.info-row .info-btn { margin-left: 0; }
.info-row:hover { border-color: var(--border-strong); }

/* Popover paragraph revealed under a heading / row when the (i) is clicked.
   Closed by default via the `hidden` HTML attribute. */
.info-popover[hidden] { display: none; }
.info-popover {
  animation: info-slide 0.18s ease-out;
}
@keyframes info-slide {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* The Filters h2 layout needs to accommodate the (i) button. */
.sidebar h2 { justify-content: flex-start; }
.sidebar h2 .info-btn { color: var(--accent); opacity: 0.7; }
.sidebar h2 .info-btn:hover { opacity: 1; }

/* Detail-panel headings (entries list) keep the small, muted treatment */
.detail h2 {
  font-size: 10px; text-transform: uppercase; letter-spacing: 0.12em;
  color: var(--muted); margin: 12px 0 6px; font-weight: 600;
}

/* Unified style for the three "primary" info blocks — Filters intro,
   Meeting Details info (sidebar) and Leader Biographies info (right panel).
   All three share identical typography, padding, border, background and
   bold-accent emphasis so they read as a consistent family. */
.sidebar .filter-intro,
.sidebar .how-to-details-hint,
.detail-help .detail-help-hint {
  margin: 0 0 8px;
  padding: 8px 10px;
  font-family: "Inter", system-ui, sans-serif;
  font-size: 11px;
  line-height: 1.5;
  font-weight: 400;
  color: var(--fg-soft);
  background: rgba(var(--accent-rgb), 0.07);
  border: 1px solid rgba(var(--accent-rgb), 0.25);
  border-left: 3px solid var(--accent);
  border-radius: 6px;
  letter-spacing: 0;
  text-transform: none;
}
.sidebar .filter-intro b,
.sidebar .how-to-details-hint b,
.detail-help .detail-help-hint b {
  color: var(--accent);
  font-weight: 700;
}
.sidebar .how-to-details-hint a,
.detail-help .detail-help-hint a,
.sidebar .filter-intro a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
}
.sidebar .how-to-details-hint a:hover,
.detail-help .detail-help-hint a:hover,
.sidebar .filter-intro a:hover { text-decoration: underline; }
.sidebar .how-to-details-hint a {
  color: var(--accent); text-decoration: none; font-weight: 600;
}
.sidebar .how-to-details-hint a:hover { text-decoration: underline; }
.sidebar .how-to-lock {
  display: inline-block;
  margin: 4px 0 0;
  padding: 1px 6px;
  font-size: 10.5px;
  font-weight: 600;
  color: var(--accent);
  background: rgba(var(--accent-rgb), 0.10);
  border: 1px solid rgba(var(--accent-rgb), 0.30);
  border-radius: 4px;
  letter-spacing: 0.02em;
}

/* Empty / locked state for the Countries filter — shown when no Region is
   picked yet, so the visitor knows to choose a region first. */
.sidebar .dataset-list-hint {
  margin: 4px 0;
  padding: 9px 11px;
  font-size: 11px;
  line-height: 1.55;
  color: var(--muted);
  background: rgba(var(--accent-rgb), 0.04);
  border: 1px dashed rgba(var(--accent-rgb), 0.45);
  border-radius: 6px;
}
.sidebar .dataset-list-hint b { color: var(--accent); font-weight: 400; }

/* Inline explanatory note shown inside a filter section (e.g. Scope). */
.sidebar .filter-hint {
  margin: 0 0 7px;
  padding: 6px 9px;
  font-size: 10.5px;
  line-height: 1.45;
  color: var(--muted-2);
  background: rgba(var(--accent-rgb), 0.04);
  border-left: 2px solid rgba(var(--accent-rgb), 0.55);
  border-radius: 0 4px 4px 0;
}
/* Every emphasized term inside an explanation block is bold + accent red,
   matching the intro hint so the whole sidebar speaks the same language. */
.sidebar .filter-hint b,
.sidebar .filter-sub-note b { color: var(--accent); font-weight: 400; }
/* Sub-note on a filter label (small parenthetical clarification). */
.sidebar .filter-sub-note {
  display: block;
  margin-top: 2px;
  font-size: 10.5px;
  font-weight: 400;
  color: var(--muted-2);
  letter-spacing: 0;
  text-transform: none;
  opacity: 0.85;
}

/* ============ Filter rows (unified) ============ */
.sidebar label,
.parent-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 2px 0;
  padding: 5px 9px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 5px;
  color: var(--fg-soft);
  font-size: 11.5px;
  line-height: 1.3;
  cursor: pointer;
  transition: background 0.14s ease, border-color 0.14s ease, color 0.14s ease;
}
.sidebar label:hover,
.parent-row:hover {
  background: var(--panel-2);
  color: var(--fg);
}
.sidebar label:has(input:checked) {
  background: rgba(217,70,70,0.12);
  border-color: rgba(217,70,70,0.4);
  color: var(--fg);
  box-shadow: inset 2px 0 0 var(--accent);
  padding-left: 13px;
}
.sidebar input[type=checkbox] {
  accent-color: var(--accent);
  flex-shrink: 0;
  margin: 0;
  width: 14px; height: 14px;
  cursor: pointer;
}
.sidebar label > span:first-of-type { flex: 1; }
.sidebar label .ds-count {
  margin-left: auto;
  color: var(--muted-2);
  font-size: 10px;
  font-variant-numeric: tabular-nums;
  background: rgba(255,255,255,0.04);
  padding: 1px 7px;
  border-radius: 10px;
  font-weight: 500;
}
.sidebar label:has(input:checked) .ds-count {
  color: var(--accent);
  background: rgba(255,107,107,0.12);
}

/* Collapsible filter buttons — Countries, Leaders, Visits, Agreements. */
.sidebar h2.filter-group.collapsible,
.sidebar h3.filter-group.collapsible {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  margin: 5px 0;
  padding: 8px 11px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 7px;
  font-family: inherit;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--fg);
  cursor: pointer;
  user-select: none;
  text-align: left;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
  box-shadow: 0 1px 2px rgba(0,0,0,0.18);
}
.sidebar h2.filter-group.collapsible:hover,
.sidebar h3.filter-group.collapsible:hover {
  background: var(--panel-3);
  border-color: var(--border-strong);
  color: var(--accent);
}

.sidebar h2.filter-group.collapsible.open,
.sidebar h3.filter-group.collapsible.open {
  background: var(--panel);
  border-color: var(--accent);
  color: var(--accent);
  box-shadow: 0 1px 2px rgba(0,0,0,0.2),
              inset 2px 0 0 var(--accent);
}
.sidebar h2.filter-group.collapsible .chev,
.sidebar h3.filter-group.collapsible .chev {
  width: auto;
  margin-left: 0;
  font-size: 11px;
  color: var(--muted);
  transition: transform 0.18s ease, color 0.15s ease;
  flex-shrink: 0;
}
.sidebar h2.filter-group.collapsible:hover .chev,
.sidebar h3.filter-group.collapsible:hover .chev { color: var(--accent); }
.sidebar h2.filter-group.collapsible.open .chev,
.sidebar h3.filter-group.collapsible.open .chev {
  transform: rotate(90deg);
  color: var(--accent);
}
.filter-section {
  display: none;
  padding: 8px 0 4px;
}
.filter-section.open {
  display: block;
  animation: section-slide 0.2s ease-out;
}
@keyframes section-slide {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

.parent-row { user-select: none; font-weight: 500; }
.parent-row label {
  margin: 0; padding: 0; background: transparent; border: none;
  flex: 1; cursor: pointer;
}
.parent-row label:hover { background: transparent; border: none; }
.parent-row .parent-row-text {
  flex: 1;
  cursor: pointer;
  color: inherit;
}
.parent-row .chev {
  display: inline-block; width: 12px; color: var(--muted);
  font-size: 11px; transition: transform 0.18s ease; flex-shrink: 0;
}
.parent-row.open { border-color: var(--border-strong); }
.parent-row.open .chev { transform: rotate(90deg); color: var(--accent); }

.sub-filters {
  display: none;
  margin: 4px 0 10px 16px;
  padding: 4px 0 4px 12px;
  border-left: 2px solid var(--accent);
}
.sub-filters.open { display: block; animation: sub-slide 0.2s ease-out; }

.sub-divider {
  height: 1px;
  background: var(--border);
  margin: 8px 6px;
}
.sub-filters label { font-size: 12px; padding: 6px 10px; }

/* Small count chip beside each Leader title (e.g. "President 7") and
   beside every filter checkbox — live, cumulative count of entries that
   currently match that option given the rest of the filter state. */
.sidebar label .leader-count,
.sidebar label .filter-count,
.parent-row label .leader-count,
.parent-row label .filter-count {
  flex: 0 0 auto;          /* don't let the chip stretch to fill the row */
  margin-left: auto;       /* push it to the right edge of the label */
  display: inline-block;
  padding: 1px 8px;
  font-size: 10px;
  font-weight: 700;
  line-height: 1.5;
  color: var(--accent);
  background: rgba(var(--accent-rgb), 0.10);
  border: 1px solid rgba(var(--accent-rgb), 0.30);
  border-radius: 999px;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
  white-space: nowrap;
}
/* Greyed-out chip when the matching count is 0. */
.sidebar label .filter-count.zero,
.parent-row label .filter-count.zero {
  color: var(--muted-2);
  background: rgba(255,255,255,0.03);
  border-color: var(--border);
}

@keyframes sub-slide {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

.sidebar select {
  width: 100%;
  background: var(--panel-2);
  color: var(--fg);
  border: 1px solid var(--border);
  padding: 6px 10px;
  border-radius: 5px;
  margin-top: 3px;
  font-size: 12px;
  font-family: inherit;
  cursor: pointer;
  transition: border-color 0.15s;
}
.sidebar select:hover { border-color: var(--border-strong); }
.sidebar select:focus { outline: none; border-color: var(--accent); }

.leader-types,
.dataset-list { display: flex; flex-direction: column; gap: 0; }

/* Polished country rows: flag → name → entry-count pill. */
.dataset-list label {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 6px;
}
.sidebar-flag {
  width: 26px; height: auto; aspect-ratio: 3 / 2;
  object-fit: cover;
  border-radius: 3px;
  border: 1px solid var(--border-strong);
  box-shadow: 0 1px 2px rgba(0,0,0,0.4), inset 0 0 0 1px rgba(255,255,255,0.04);
  flex-shrink: 0;
  display: block;
}
.dataset-list .dataset-name {
  flex: 1;
  font-family: "Space Grotesk", sans-serif;
  font-weight: 600;
  font-size: 13px;
  color: var(--fg);
  letter-spacing: -0.005em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.dataset-list label .ds-count {
  margin-left: 0;
  background: var(--panel-3);
  color: var(--muted);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.06em;
  padding: 3px 8px;
  border-radius: 999px;
  font-variant-numeric: tabular-nums;
}
.dataset-list label:hover .ds-count { color: var(--fg); }
.dataset-list label:has(input:checked) .ds-count {
  background: rgba(217, 70, 70, 0.15);
  color: var(--accent);
}

/* (Countries h2 collapsible button styling is consolidated above.) */

/* Display section: Metric and Color rows, styled to match the filter
   buttons — label pinned left, select pinned right. */
.sidebar label.display-control {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 0 0 6px;
  padding: 6px 10px 6px 12px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 7px;
  cursor: default;
  box-shadow: 0 1px 2px rgba(0,0,0,0.18);
}
.sidebar label.display-control:hover {
  background: var(--panel-2);    /* row itself shouldn't react like a button */
  border-color: var(--border);
  color: var(--fg-soft);
}
.display-control-label {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fg);
  flex-shrink: 0;
}
.sidebar label.display-control select {
  width: auto;
  min-width: 110px;
  max-width: 60%;
  margin: 0;
  padding: 5px 24px 5px 9px;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: normal;
  text-transform: none;
}

/* ============ Year-range slider ============ */
.year-range { padding: 4px 2px 0; }
.year-range input[type=range] {
  width: 100%;
  -webkit-appearance: none; appearance: none;
  background: transparent;
  margin: 4px 0;
}
.year-range input[type=range]::-webkit-slider-runnable-track {
  height: 4px; background: var(--panel-3); border-radius: 2px;
}
.year-range input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  height: 16px; width: 16px;
  background: var(--accent); border: 2px solid var(--panel);
  border-radius: 50%;
  margin-top: -6px;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0,0,0,0.4);
}
.year-labels {
  display: flex; justify-content: space-between;
  color: var(--fg); font-size: 11.5px;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  margin-top: 3px;
}

/* ============ Map ============ */
.map-wrap { position: relative; min-width: 0; min-height: 0; height: 100%; }
.map-wrap > #map { width: 100%; height: 100%; }
#map { background: #06090f; position: relative; }

/* Country Details button (upper-right of map) */
.country-details-btn {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 700;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 14px;
  background: linear-gradient(180deg, rgba(20, 24, 32, 0.96), rgba(12, 14, 20, 0.96));
  color: #f5f5f5;
  border: 1px solid var(--accent, #c92a2a);
  border-radius: 999px;
  font: 600 13px/1 "Inter", system-ui, sans-serif;
  letter-spacing: 0.02em;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35), 0 0 0 1px rgba(255, 255, 255, 0.04) inset;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.country-details-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.06) inset;
  background: linear-gradient(180deg, rgba(28, 32, 40, 0.98), rgba(16, 18, 24, 0.98));
}
.country-details-btn svg { width: 16px; height: 16px; flex-shrink: 0; }
.country-details-btn .cdb-text { font-weight: 700; }
.country-details-btn .cdb-country {
  font-weight: 500;
  opacity: 0.85;
  padding-left: 8px;
  margin-left: 4px;
  border-left: 1px solid rgba(255, 255, 255, 0.18);
  max-width: 180px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.country-details-btn .cdb-lock {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  opacity: 0.85;
}
.country-details-btn .cdb-lock svg { width: 13px; height: 13px; }
.country-details-btn.unlocked .cdb-lock { display: none; }
.country-details-btn[hidden] { display: none; }

/* Country Details modal */
.cd-modal { position: fixed; inset: 0; z-index: 9000; }
.cd-modal[hidden] { display: none; }
.cd-modal-backdrop {
  position: absolute; inset: 0;
  background: rgba(4, 6, 12, 0.72);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
.cd-modal-card {
  position: relative;
  max-width: 980px;
  width: calc(100% - 40px);
  max-height: calc(100vh - 60px);
  margin: 30px auto;
  background: var(--panel, #14171f);
  color: var(--fg, #ececec);
  border: 1px solid var(--border, #2a2f3a);
  border-radius: 14px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.cd-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--border, #2a2f3a);
}
.cd-modal-head-left { display: flex; align-items: center; gap: 14px; }
.cd-flag { width: 44px; height: 30px; object-fit: cover; border-radius: 4px; border: 1px solid rgba(255,255,255,0.1); }
.cd-modal-head h2 { margin: 0; font-size: 20px; font-weight: 700; }
.cd-modal-sub { font-size: 12px; opacity: 0.7; }
.cd-modal-close {
  background: transparent; color: inherit; border: 1px solid var(--border, #2a2f3a);
  width: 34px; height: 34px; border-radius: 8px;
  font-size: 22px; line-height: 1; cursor: pointer;
}
.cd-modal-close:hover { background: rgba(255,255,255,0.06); }
.cd-modal-toolbar {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--border, #2a2f3a);
  background: rgba(255,255,255,0.02);
  flex-wrap: wrap;
}
.cd-search {
  flex: 1; min-width: 200px;
  padding: 8px 12px;
  background: var(--panel-2, #1c2029);
  color: var(--fg);
  border: 1px solid var(--border, #2a2f3a);
  border-radius: 8px;
  font: inherit;
}
.cd-sort {
  padding: 8px 12px;
  background: var(--panel-2, #1c2029);
  color: var(--fg);
  border: 1px solid var(--border, #2a2f3a);
  border-radius: 8px;
  font: inherit;
}
.cd-count { font-size: 12px; opacity: 0.7; }
.cd-modal-body { overflow-y: auto; padding: 16px 20px; flex: 1; }
.cd-empty { text-align: center; padding: 40px 20px; opacity: 0.65; }
.cd-entry {
  border: 1px solid var(--border, #2a2f3a);
  border-radius: 10px;
  padding: 14px 16px;
  margin-bottom: 12px;
  background: rgba(255,255,255,0.02);
}
.cd-entry-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 12px; flex-wrap: wrap;
  margin-bottom: 8px;
}
.cd-entry-leader { font-size: 15px; font-weight: 700; }
.cd-entry-leader .cd-title { font-weight: 400; opacity: 0.7; font-size: 13px; margin-left: 6px; }
.cd-entry-date { font-size: 12px; opacity: 0.75; font-variant-numeric: tabular-nums; }
.cd-entry-meta {
  display: flex; flex-wrap: wrap; gap: 6px 12px;
  font-size: 12px; opacity: 0.85;
  margin-bottom: 10px;
}
.cd-entry-meta b { font-weight: 600; opacity: 0.7; margin-right: 4px; }
.cd-notes-label {
  font-size: 11px; font-weight: 700; letter-spacing: 0.06em;
  text-transform: uppercase; opacity: 0.6;
  margin-bottom: 4px;
}
.cd-notes {
  font-size: 14px; line-height: 1.55;
  padding: 10px 12px;
  border-left: 3px solid var(--accent, #c92a2a);
  background: rgba(255,255,255,0.03);
  border-radius: 4px;
  white-space: pre-wrap;
}
.cd-notes-empty { font-size: 12px; opacity: 0.5; font-style: italic; }
.cd-sources { margin-top: 8px; font-size: 12px; }
.cd-sources a { color: var(--accent, #c92a2a); margin-right: 10px; text-decoration: none; }
.cd-sources a:hover { text-decoration: underline; }
.cd-agreements { margin-top: 8px; font-size: 12px; }
.cd-agreements ul { margin: 4px 0 0; padding-left: 18px; }
.cd-modal-foot {
  display: flex; justify-content: space-between; gap: 12px;
  padding: 10px 20px;
  border-top: 1px solid var(--border, #2a2f3a);
  font-size: 11px; opacity: 0.6;
}
@media (max-width: 720px) {
  .country-details-btn { top: 10px; right: 10px; padding: 8px 12px; font-size: 12px; }
  .country-details-btn .cdb-country { max-width: 100px; }
  .cd-modal-card { margin: 10px auto; max-height: calc(100vh - 20px); width: calc(100% - 20px); }
  .cd-modal-head { padding: 14px; }
  .cd-modal-toolbar { padding: 10px 14px; }
  .cd-modal-body { padding: 12px 14px; }
}
.leaflet-container { background: #06090f; font: inherit; }
/* Polished zoom-control widget — sits top-left of the map, professional
   look matching the rest of the dark UI. */
.leaflet-control-zoom {
  margin: 14px !important;
  border: 0 !important;
  border-radius: 8px !important;
  overflow: hidden;
  box-shadow: 0 4px 14px rgba(0,0,0,0.45) !important;
  background: var(--panel-2) !important;
}
.leaflet-control-zoom a {
  width: 32px !important;
  height: 32px !important;
  line-height: 32px !important;
  background: var(--panel-2) !important;
  color: var(--fg) !important;
  border: 0 !important;
  border-bottom: 1px solid var(--border) !important;
  font-size: 18px !important;
  font-weight: 600 !important;
  font-family: "Inter", system-ui, sans-serif !important;
  transition: background 0.15s ease, color 0.15s ease;
}
.leaflet-control-zoom a:last-child { border-bottom: 0 !important; }
.leaflet-control-zoom a:hover {
  background: var(--accent) !important;
  color: #fff !important;
}
.leaflet-control-zoom a.leaflet-disabled {
  opacity: 0.4 !important;
  cursor: default !important;
}
.leaflet-control-zoom a.leaflet-disabled:hover {
  background: var(--panel-2) !important;
  color: var(--fg) !important;
}
.leaflet-control-attribution {
  background: rgba(11,14,20,0.85) !important;
  color: var(--muted) !important;
  font-size: 10px !important;
  padding: 2px 8px !important;
  border-radius: 4px 0 0 0 !important;
}
.leaflet-control-attribution a { color: var(--muted-2) !important; }

.country-tooltip {
  background: rgba(11,14,20,0.95) !important;
  color: var(--fg) !important;
  border: 1px solid var(--border-strong) !important;
  padding: 8px 12px !important;
  border-radius: 6px !important;
  font-size: 12px !important;
  box-shadow: var(--shadow-md) !important;
}
.leaflet-tooltip-top:before,
.leaflet-tooltip-bottom:before,
.leaflet-tooltip-left:before,
.leaflet-tooltip-right:before { border-color: transparent !important; }

/* ============ Legend ============ */
.legend {}
#legend {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 8px 11px;
}
.legend-row {
  display: flex; align-items: center; gap: 7px;
  margin: 2px 0; font-size: 10.5px; color: var(--fg-soft);
  font-variant-numeric: tabular-nums;
}
.legend-swatch {
  width: 16px; height: 9px;
  border-radius: 2px;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.05);
  flex-shrink: 0;
}

/* ============ Credits ============ */
.credits {
  flex-shrink: 0;
  display: block;
  background: var(--panel-2);
  border-top: 1px solid var(--border);
  padding: 4px 4px 6px;
  color: var(--fg-soft);
  font-size: 10.5px;
  line-height: 1.45;
  min-width: 0;
}
.credits-link {
  text-decoration: none;
  color: var(--fg-soft);
  display: flex;
  padding: 7px 8px;
  border-radius: 5px;
  transition: background 0.15s ease, color 0.15s ease;
  cursor: pointer;
  min-width: 0;
}
.credits-link:hover { background: var(--panel-3); color: var(--fg); }
.credits-link:hover .credits-name { color: var(--accent); }

/* Floating credit panel anchored to a corner of the map */
.map-credit {
  position: absolute;
  z-index: 600;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: rgba(28, 34, 48, 0.92);
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  padding: 12px 14px;
  max-width: 320px;
  color: var(--fg-soft);
  font-size: 11px;
  line-height: 1.55;
  text-decoration: none;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow: 0 6px 22px rgba(0, 0, 0, 0.45);
  transition: background 0.15s ease, border-color 0.15s ease;
}
.map-credit:hover {
  background: rgba(35, 42, 58, 0.95);
  border-color: var(--accent);
  color: var(--fg);
}
.map-credit:hover .credits-label { color: var(--accent); }
.map-credit-bl { left: 16px;  bottom: 16px; }
.map-credit-br { right: 16px; bottom: 16px; }

/* Africa Foundation credit pinned at the bottom of the left sidebar
   (under the Legend section). */
/* Sidebar-pinned Africa Foundation credit — sized identically to the
   "Designed by" box on the right side (uses the global .credits + .credits-link
   styles instead of its own overrides). */
.sidebar-credit {
  flex-shrink: 0;
  margin: 0;
  padding: 6px 6px 8px;
  border-top: 1px solid var(--border);
  background: var(--panel-2);
}
.credits-title {
  color: var(--accent);
  font-weight: 700;
  margin-bottom: 8px;
  font-size: 10px;
  font-family: "Inter", sans-serif;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.credits-org {
  display: flex; align-items: flex-start; gap: 12px;
  margin: 0 0 10px;
}
.credits-logo {
  height: 42px; width: 42px; display: block; flex-shrink: 0;
  border-radius: 5px;
  box-shadow: 0 0 0 1px rgba(255,255,255,0.08);
  object-fit: contain;
  background: #fff;
}
.credits-org > div { min-width: 0; word-break: break-word; }
.credits-row {
  color: var(--fg-soft);
  font-size: 11px;
  line-height: 1.5;
}
.credits-designer {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.credits-designer .credits-logo {
  padding: 3px;
}
.credits-name {
  font-weight: 600;
  color: var(--fg);
  font-size: 11.5px;
  margin-top: 1px;
  overflow-wrap: anywhere;
  line-height: 1.3;
}
.credits-name-link {
  color: inherit;
  text-decoration: none;
  transition: color 0.15s ease;
}
.credits-name-link:hover { color: var(--accent); }
.credits-affil {
  color: var(--muted);
  font-size: 10px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}
.credits-designer-text { flex: 1; min-width: 0; }
.credits-socials {
  display: flex;
  gap: 5px;
  margin: 6px 0 0;
  flex-wrap: wrap;
}
.credits-socials a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 4px;
  background: var(--panel-3);
  color: var(--muted);
  text-decoration: none;
  flex-shrink: 0;
  transition: background 0.15s ease, color 0.15s ease, transform 0.15s ease;
}
.credits-socials a:hover {
  background: var(--accent);
  color: #fff;
}
.credits-socials svg {
  width: 11px;
  height: 11px;
}
.credits-label {
  color: var(--muted-2);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 8.5px;
  display: block;
  margin-bottom: 2px;
  font-weight: 700;
}
.credits-org > div,
.credits-designer > div { line-height: 1.45; }
.credits-researchers {
  list-style: none;
  padding: 0;
  margin: 0;
}
.credits-researchers li {
  padding: 2px 0;
  color: var(--fg-soft);
  font-size: 11px;
  line-height: 1.45;
}
.credits-researchers .role {
  color: var(--muted);
  font-weight: 500;
}

/* Collapsible "Leader Biographies" help block on the right side — mirrors
   the styling of the sidebar's "Country Details" help button. */
.detail-help {
  flex-shrink: 0;
  padding: 6px 8px 0;
  border-top: 1px solid var(--border);
  background: var(--panel);
}
/* When the help block sits at the very top of the right panel, drop the
   top border (the topbar above already supplies the divider) and add a
   bottom border so it visually separates from the entries list below. */
.detail-help.detail-help-top {
  padding: 8px 10px 4px;
  border-top: none;
  border-bottom: 1px solid var(--border);
}
.detail-help h3.filter-group.collapsible {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  margin: 6px 0 6px;
  padding: 9px 12px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 7px;
  font-family: inherit;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fg);
  cursor: pointer;
  user-select: none;
  text-align: left;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
  box-shadow: 0 1px 2px rgba(0,0,0,0.18);
}
.detail-help h3.filter-group.collapsible:hover {
  background: var(--panel-3);
  border-color: var(--border-strong);
  color: var(--accent);
}
.detail-help h3.filter-group.collapsible.open {
  background: var(--panel);
  border-color: var(--accent);
  color: var(--accent);
}
.detail-help h3.filter-group.collapsible .chev {
  font-size: 10px;
  transition: transform 0.18s ease;
  opacity: 0.7;
}
.detail-help h3.filter-group.collapsible.open .chev {
  transform: rotate(90deg);
  opacity: 1;
}
.detail-help .filter-section {
  display: none;
  margin: 0 0 6px;
}
.detail-help .filter-section.open { display: block; }
/* .detail-help .detail-help-hint styling is shared with the Filters intro
   and the sidebar Meeting Details hint — see the unified rule at the top
   of the file (search for "Unified style for the three primary info"). */

/* ============ Detail panel ============ */
.detail-empty {
  color: var(--muted);
  padding: 36px 16px;
  text-align: center;
  font-size: 11.5px;
  line-height: 1.6;
  border: 1px dashed var(--border);
  border-radius: 6px;
  background: var(--panel-2);
  margin-top: 4px;
}
.detail h3 {
  margin: 2px 0 6px;
  font-size: 16px;
  color: var(--fg);
  font-family: "Space Grotesk", sans-serif;
  font-weight: 500;
  letter-spacing: -0.02em;
  overflow-wrap: anywhere;
}
.detail .sub {
  color: var(--muted);
  margin-bottom: 14px;
  font-size: 10.5px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
  letter-spacing: 0.02em;
  line-height: 1.5;
}

.entry {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 11px 13px;
  margin-bottom: 8px;
  transition: border-color 0.15s ease;
  min-width: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.entry:hover { border-color: var(--border-strong); }
.entry .entry-head {
  display: flex; justify-content: space-between; gap: 10px;
  align-items: flex-start;
  flex-wrap: wrap;
}
.entry .leader {
  font-weight: 600; color: var(--fg); font-size: 12.5px;
  line-height: 1.3;
  font-family: "Space Grotesk", sans-serif;
  letter-spacing: -0.005em;
  min-width: 0;
  flex: 1 1 60%;
  overflow-wrap: anywhere;
}
.entry .leader-btn {
  cursor: pointer;
  display: inline-block;
  transition: color 0.15s ease;
}
.entry .leader-btn:hover { color: var(--accent); }

/* ============ Biography popover ============ */
.bio-popover {
  position: fixed;
  width: 420px;
  max-width: calc(100vw - 24px);
  max-height: calc(100vh - 80px);
  background: var(--panel);
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  box-shadow: 0 18px 40px rgba(0,0,0,0.5);
  padding: 16px 18px 18px;
  z-index: 1500;
  font-size: 13px;
  color: var(--fg-soft);
  line-height: 1.55;
  animation: bio-pop 0.18s ease-out;
  overflow-y: auto;
  cursor: move;
  user-select: none;
}
.bio-popover .bio-extract,
.bio-popover a,
.bio-popover button,
.bio-popover input { cursor: auto; user-select: text; }
.bio-popover a, .bio-popover button { cursor: pointer; user-select: none; }
.bio-popover.dragging {
  cursor: grabbing;
  box-shadow: 0 24px 56px rgba(0,0,0,0.65);
  animation: none;
}
@keyframes bio-pop {
  from { opacity: 0; transform: translateY(-4px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0)     scale(1); }
}
.bio-popover[hidden] { display: none; }
.bio-close {
  position: absolute;
  top: 8px; right: 8px;
  background: transparent;
  border: 0;
  font-size: 18px;
  color: var(--muted);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  line-height: 1;
  font-family: inherit;
}
.bio-close:hover { color: var(--accent); background: var(--panel-2); }
.bio-photo-wrap {
  float: left;
  width: 88px; height: 88px;
  margin: 0 14px 6px 0;
  background: var(--panel-2);
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
}
.bio-photo {
  width: 100%; height: 100%;
  object-fit: cover;
  object-position: center 25%;
  display: block;
}
.bio-photo[src=""], .bio-photo[hidden] { display: none; }
.bio-photo-wrap.bio-initials::after {
  content: attr(data-initials);
  font-family: "Space Grotesk", sans-serif;
  font-size: 26px;
  font-weight: 600;
  color: var(--fg);
  letter-spacing: 0.04em;
  background: linear-gradient(135deg, var(--panel-2), var(--panel-3));
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.bio-photo-wrap { position: relative; }
.bio-popover.loading .bio-photo-wrap::before {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(110deg, var(--panel-2) 30%, var(--panel-3) 50%, var(--panel-2) 70%);
  background-size: 200% 100%;
  animation: bio-shimmer 1.4s infinite linear;
}
@keyframes bio-shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
.bio-name {
  font-family: "Space Grotesk", sans-serif;
  font-weight: 600;
  font-size: 15px;
  color: var(--fg);
  letter-spacing: -0.01em;
  margin-bottom: 2px;
}
.bio-desc {
  font-size: 11px;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
  margin-bottom: 8px;
}
.bio-extract {
  margin: 0;
  color: var(--fg-soft);
  font-family: "Source Serif 4", "Georgia", serif;
  font-size: 13.5px;
  line-height: 1.65;
  text-align: justify;
  hyphens: auto;
}
.bio-more {
  display: inline-block;
  clear: both;
  margin-top: 14px;
  padding: 7px 14px;
  background: var(--accent);
  color: #fff;
  border: 1px solid var(--accent);
  border-radius: 5px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  text-decoration: none;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}
.bio-more:hover {
  background: var(--accent-deep);
  border-color: var(--accent-deep);
  transform: translateY(-1px);
}
.bio-more[hidden] { display: none; }
.entry .role {
  color: var(--muted);
  font-size: 10.5px;
  margin-top: 3px;
  letter-spacing: 0.03em;
  font-weight: 500;
}
.entry .date {
  color: var(--muted);
  font-size: 10.5px;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  font-weight: 500;
  flex-shrink: 0;
  letter-spacing: 0.02em;
}
.entry .route {
  color: var(--fg-soft);
  font-size: 11px;
  margin: 9px 0 0;
  padding-top: 9px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
  overflow-wrap: anywhere;
  line-height: 1.45;
}
.entry .route .route-sep {
  color: var(--muted-2);
  font-size: 9.5px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 600;
  margin: 0 3px;
}
.entry .agree {
  font-size: 10.5px;
  color: #6ed085;
  margin-top: 8px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  display: flex; align-items: center; gap: 7px;
}
.entry .agree-dot {
  display: inline-block;
  width: 6px; height: 6px;
  background: #6ed085;
  border-radius: 50%;
  box-shadow: 0 0 0 3px rgba(110, 208, 133, 0.18);
}
.entry .agree-list {
  margin: 4px 0 0 14px; padding: 0;
  color: var(--fg-soft); font-size: 11px;
  line-height: 1.45;
}
.entry .agree-list li { margin: 2px 0; }

/* ============ Archive (sign-in + document library) ============ */
main.archive {
  display: block;
  max-width: 1080px;
  margin: 0 auto;
  padding: 56px 32px 80px;
  height: auto;
  overflow-y: auto;
}

/* Sign-in card */
.archive-auth {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - 220px);
}
.auth-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 36px 40px 30px;
  width: 100%;
  max-width: 480px;
  box-shadow: 0 12px 32px rgba(0,0,0,0.25);
}

/* Side-by-side chooser at the top. Click one to show its form below. */
.auth-chooser {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  border: 1px solid var(--border);
  border-radius: 7px;
  overflow: hidden;
  margin: 4px 0 22px;
}
.auth-choice {
  background: var(--panel-2);
  border: 0;
  padding: 14px 14px 12px;
  text-align: left;
  cursor: pointer;
  font-family: inherit;
  display: flex;
  flex-direction: column;
  gap: 2px;
  position: relative;
  transition: background 0.18s ease, color 0.18s ease;
}
.auth-choice + .auth-choice { border-left: 1px solid var(--border); }
.auth-choice:hover { background: var(--panel-3); }
.auth-choice.active {
  background: var(--panel);
}
.auth-choice.active::before {
  content: "";
  position: absolute;
  left: 0; right: 0; top: 0;
  height: 2px;
  background: var(--accent);
}
.auth-choice-title {
  font-family: "Space Grotesk", sans-serif;
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: -0.005em;
  transition: color 0.18s ease;
}
.auth-choice.active .auth-choice-title { color: var(--fg); }
.auth-choice-sub {
  color: var(--muted-2);
  font-size: 11px;
  font-style: italic;
  letter-spacing: 0.02em;
}
@media (max-width: 480px) {
  .auth-chooser { grid-template-columns: 1fr; }
  .auth-choice + .auth-choice { border-left: 0; border-top: 1px solid var(--border); }
}
.auth-eyebrow {
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.22em;
  font-size: 10px;
  font-weight: 700;
  margin-bottom: 12px;
}
.auth-head h1 {
  margin: 0 0 12px;
  font-family: "Space Grotesk", sans-serif;
  font-size: 24px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--fg);
}
.auth-head p {
  margin: 0 0 20px;
  color: var(--fg-soft);
  font-size: 14px;
  line-height: 1.65;
}
.auth-switch {
  margin-top: 16px;
  text-align: center;
  font-size: 12px;
  color: var(--muted);
}
.auth-link {
  background: transparent;
  border: 0;
  padding: 0;
  margin-left: 4px;
  font-family: inherit;
  font-size: 12px;
  color: var(--accent-2);
  cursor: pointer;
  font-weight: 600;
}
.auth-link:hover { text-decoration: underline; color: var(--accent); }
.auth-form { display: flex; flex-direction: column; gap: 14px; }
.auth-form[hidden] { display: none; }
.auth-form label {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.auth-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted-2);
}
.auth-form input {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--fg);
  padding: 10px 12px;
  font-size: 14px;
  font-family: inherit;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.auth-form input:hover  { border-color: var(--border-strong); }
.auth-form input:focus  {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(217,70,70,0.12);
}
.auth-hint {
  font-size: 11px;
  color: var(--muted);
  font-style: italic;
}
.auth-submit {
  background: var(--accent);
  color: #fff;
  border: 1px solid var(--accent);
  padding: 11px 16px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  border-radius: 6px;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s, transform 0.15s, box-shadow 0.15s;
  margin-top: 4px;
  box-shadow: 0 4px 14px rgba(217,70,70,0.22);
}
.auth-submit:hover  {
  background: var(--accent-deep);
  border-color: var(--accent-deep);
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(217,70,70,0.32);
}
.auth-submit:active { transform: translateY(0); }
.auth-secondary {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
  padding: 6px 12px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  border-radius: 5px;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.auth-secondary:hover {
  background: var(--panel-2);
  border-color: var(--accent);
  color: var(--accent);
}
.auth-message {
  font-size: 12px;
  color: var(--muted);
  min-height: 1em;
  margin-top: 2px;
  line-height: 1.5;
}
.auth-message.error { color: var(--accent); }
.auth-foot {
  margin: 22px 0 0;
  font-size: 12px;
  color: var(--muted);
  text-align: center;
}
.auth-foot a {
  color: var(--accent-2);
  font-weight: 700;
  text-decoration: none;
  transition: color 0.15s ease;
}
.auth-foot a:hover { color: var(--accent); }

/* Authenticated archive view */
.archive-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 28px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.archive-head h1 {
  margin: 4px 0 2px;
  font-family: "Space Grotesk", sans-serif;
  font-size: 24px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--fg);
  line-height: 1.2;
}
.archive-sub {
  color: var(--muted);
  font-size: 12px;
  font-style: italic;
  margin: 0;
  line-height: 1.5;
  max-width: 56ch;
}
.archive-user {
  display: flex; align-items: center; gap: 10px;
  font-size: 11.5px;
}
.archive-user-label {
  color: var(--muted-2);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 9.5px;
  font-weight: 700;
}
.archive-user-email { color: var(--fg); font-weight: 500; font-size: 12px; }

.archive-country { margin-bottom: 48px; }
.archive-country-head {
  display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap;
  margin-bottom: 22px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}
.archive-country-head h2 {
  margin: 0;
  font-family: "Space Grotesk", sans-serif;
  font-size: 22px;
  font-weight: 600;
  color: var(--fg);
  letter-spacing: -0.01em;
}
.archive-country-meta {
  color: var(--muted);
  font-size: 12px;
  font-style: italic;
}

.archive-section { margin-bottom: 24px; }
.archive-section-label {
  color: var(--muted-2);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 9.5px;
  font-weight: 700;
  margin-bottom: 10px;
}
.archive-doc-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 12px;
}
.archive-doc {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 14px 16px;
  color: var(--fg);
  transition: border-color 0.15s ease;
}
.archive-doc:hover { border-color: var(--accent); }
.archive-doc-info { flex: 1; min-width: 0; }
.archive-doc-actions {
  display: inline-flex;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
  flex-shrink: 0;
}
.archive-doc-action {
  display: inline-flex;
  align-items: center;
  padding: 7px 13px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--fg-soft);
  background: transparent;
  text-decoration: none;
  border-left: 1px solid var(--border);
  transition: background 0.15s ease, color 0.15s ease;
}
.archive-doc-action:first-child { border-left: 0; }
.archive-doc-action:hover {
  background: var(--accent);
  color: #fff;
}
.archive-doc-ext {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px; height: 40px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 5px;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--accent-2);
}
.archive-doc:hover .archive-doc-ext {
  border-color: var(--accent);
  color: var(--accent);
}
.archive-doc-title {
  font-weight: 600;
  font-size: 12.5px;
  color: var(--fg);
  line-height: 1.4;
}
.archive-doc-meta {
  font-size: 10.5px;
  color: var(--muted);
  margin-top: 3px;
  line-height: 1.4;
}

/* Change-password modal */
.pw-modal {
  position: fixed; inset: 0;
  background: rgba(11, 14, 20, 0.78);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  animation: pw-fade 0.18s ease-out;
}
.pw-modal[hidden] { display: none; }
.pw-modal-card {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  padding: 28px 32px 26px;
  width: 100%;
  max-width: 440px;
  box-shadow: 0 22px 48px rgba(0,0,0,0.55);
}
.pw-modal-card h2 {
  margin: 0 0 10px;
  font-family: "Space Grotesk", sans-serif;
  font-size: 20px;
  font-weight: 600;
  color: var(--fg);
  letter-spacing: -0.02em;
}
.pw-modal-card p {
  color: var(--fg-soft);
  font-size: 13px;
  margin: 0 0 18px;
  line-height: 1.6;
}
.pw-modal-close {
  position: absolute;
  top: 12px; right: 12px;
  background: transparent;
  border: 0;
  font-size: 22px;
  color: var(--muted);
  cursor: pointer;
  width: 32px; height: 32px;
  border-radius: 6px;
  line-height: 1;
  font-family: inherit;
}
.pw-modal-close:hover {
  background: var(--panel-2);
  color: var(--accent);
}
@keyframes pw-fade {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.archive-country-pending {
  opacity: 0.7;
}
.archive-pending-note {
  background: var(--panel-2);
  border: 1px dashed var(--border);
  border-radius: 6px;
  padding: 18px 22px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.65;
}

/* ============ Sub-region groupings (Archive library) ============ */
/* Each region is a collapsible card. Closed by default — the visitor
   opens a region to reveal the country cards inside. */
.region-block {
  margin: 0 0 12px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  border-left: 4px solid var(--accent);
  overflow: hidden;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}
.region-block:hover { border-color: var(--border-strong); }
.region-block.open {
  border-color: var(--accent);
  box-shadow: 0 4px 14px rgba(0,0,0,0.22);
}

/* The region header is a button (so it's keyboard-accessible). */
.region-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  width: 100%;
  padding: 14px 18px;
  background: transparent;
  border: 0;
  text-align: left;
  cursor: pointer;
  color: inherit;
  font-family: inherit;
  transition: background 0.15s ease;
}
.region-head:hover { background: var(--panel-2); }
.region-block.open .region-head { background: var(--panel-2); }

.region-head-text {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1 1 auto;
  min-width: 0;
}
.region-title {
  margin: 0;
  font-family: "Space Grotesk", "Inter", sans-serif;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.005em;
  color: var(--accent);
  text-transform: none;
  display: flex;
  align-items: center;
  gap: 10px;
}
.region-title::before {
  content: "";
  display: inline-block;
  width: 7px;
  height: 7px;
  background: var(--accent);
  border-radius: 50%;
  box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.18);
  flex-shrink: 0;
}
.region-count {
  font-size: 10px;
  font-weight: 600;
  color: var(--accent);
  background: rgba(var(--accent-rgb), 0.12);
  border: 1px solid rgba(var(--accent-rgb), 0.30);
  padding: 2px 7px;
  border-radius: 999px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.region-sub {
  font-size: 11px;
  color: var(--muted);
  line-height: 1.5;
  font-weight: 400;
  letter-spacing: 0.01em;
}
.region-chevron {
  flex-shrink: 0;
  font-size: 14px;
  color: var(--muted);
  transition: transform 0.22s ease, color 0.15s ease;
  font-weight: 700;
}
.region-block.open .region-chevron {
  transform: rotate(90deg);
  color: var(--accent);
}

/* Cards drawer — closed by default, slides open with the block. */
.region-cards {
  display: none;
  flex-direction: column;
  padding: 0 18px 16px;
  border-top: 1px solid var(--border);
}
.region-block.open .region-cards { display: flex; }
.region-cards .country-card {
  margin: 12px 0 0;
}
.region-cards .country-card:first-child { margin-top: 14px; }

.region-empty {
  margin: 14px 0 0;
  padding: 16px;
  border: 1px dashed var(--border-strong);
  border-radius: 8px;
  background: var(--panel-2);
  color: var(--muted);
  font-size: 11.5px;
  text-align: center;
  font-style: italic;
  letter-spacing: 0.01em;
}

@media (max-width: 720px) {
  .region-head { padding: 12px 14px; }
  .region-title { font-size: 15.5px; }
  .region-sub { font-size: 10.5px; }
  .region-cards { padding: 0 14px 14px; }
}

/* Expandable country card — click the header to reveal the documents. */
.country-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-bottom: 14px;
  overflow: hidden;
  transition: border-color 0.18s ease;
}
.country-card:hover { border-color: var(--border-strong); }
.country-card.open { border-color: var(--accent); }
.country-card-pending { opacity: 0.78; }

.country-header {
  display: flex;
  align-items: center;
  gap: 18px;
  width: 100%;
  background: transparent;
  border: 0;
  padding: 22px 26px;
  text-align: left;
  cursor: pointer;
  font-family: inherit;
  color: var(--fg);
  transition: background 0.18s ease;
}
.country-flag {
  width: 52px; height: auto; aspect-ratio: 3 / 2;
  object-fit: cover;
  border-radius: 5px;
  border: 1px solid var(--border-strong);
  box-shadow: 0 1px 3px rgba(0,0,0,0.4);
  flex-shrink: 0;
  display: block;
}
.country-name-block { flex: 1; min-width: 0; }
.country-header:hover { background: var(--panel-2); }
.country-name-block { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.country-name-block h2 {
  margin: 0;
  font-family: "Space Grotesk", sans-serif;
  font-size: 17px;
  font-weight: 600;
  color: var(--fg);
  letter-spacing: -0.005em;
  line-height: 1.2;
}
.country-meta {
  color: var(--muted);
  font-size: 11px;
  font-style: italic;
  line-height: 1.4;
}
.country-chevron {
  flex-shrink: 0;
  font-size: 14px;
  color: var(--muted);
  transition: transform 0.2s ease, color 0.18s ease;
}
.country-card.open .country-chevron {
  transform: rotate(90deg);
  color: var(--accent);
}

.country-body {
  display: none;
  padding: 4px 26px 24px;
  border-top: 1px solid var(--border);
  animation: country-slide 0.22s ease-out;
}
.country-card.open .country-body { display: block; }
@keyframes country-slide {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}

.archive-release {
  color: var(--accent-2);
  font-weight: 600;
  letter-spacing: 0.04em;
}

/* ============ About Us (about page) ============ */
main.who {
  display: block;
  max-width: 980px;
  margin: 0 auto;
  padding: 64px 32px 96px;
  height: auto;
  overflow-y: auto;
}

.who-hero { margin-bottom: 48px; }
.who-eyebrow {
  color: var(--accent);
  letter-spacing: 0.22em;
  font-size: 11px;
  text-transform: uppercase;
  font-weight: 700;
  margin-bottom: 18px;
}
.who-headline {
  margin: 0 0 24px;
  font-family: "Space Grotesk", sans-serif;
  font-size: 44px;
  line-height: 1.15;
  font-weight: 500;
  color: var(--fg);
  letter-spacing: -0.025em;
  max-width: 18ch;
}
.who-lead {
  font-family: "Source Serif 4", "Georgia", serif;
  font-size: 19px;
  line-height: 1.65;
  color: var(--fg-soft);
  margin: 0 0 24px;
}
.who-lead strong { color: var(--fg); font-weight: 600; }
.who-tags {
  display: flex; flex-wrap: wrap; gap: 8px;
  margin-top: 28px;
}
.who-tag {
  display: inline-block;
  padding: 5px 12px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--fg-soft);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 600;
}

/* Stats banner */
.who-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 0;
  margin: 56px 0;
  padding: 28px 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.who-stat {
  text-align: center;
  padding: 4px 12px;
  border-left: 1px solid var(--border);
}
.who-stat:first-child { border-left: none; }
.who-stat-value {
  font-family: "Space Grotesk", sans-serif;
  font-size: 38px;
  font-weight: 600;
  color: var(--fg);
  letter-spacing: -0.025em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.who-stat-label {
  color: var(--muted-2);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-top: 10px;
  font-weight: 600;
}

/* Numbered section heads */
.who-block { margin-bottom: 64px; }
.who-section-head {
  display: flex;
  align-items: baseline;
  gap: 18px;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}
.who-section-num {
  font-family: "Space Grotesk", sans-serif;
  font-size: 13px;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 0.1em;
  font-variant-numeric: tabular-nums;
}
.who-section-head h2 {
  margin: 0;
  font-family: "Space Grotesk", sans-serif;
  font-size: 22px;
  font-weight: 600;
  color: var(--fg);
  letter-spacing: -0.015em;
}

.who-prose p {
  font-family: "Source Serif 4", "Georgia", serif;
  font-size: 17px;
  line-height: 1.75;
  color: var(--fg-soft);
  margin: 0 0 18px;
}
.who-prose p strong { color: var(--fg); font-weight: 600; }
.who-prose .who-drop::first-letter {
  font-family: "Space Grotesk", sans-serif;
  font-weight: 600;
  font-size: 4em;
  float: left;
  line-height: 0.85;
  margin: 6px 12px 0 -2px;
  color: var(--accent);
}

/* Methodology */
.who-methodology-lead {
  font-family: "Source Serif 4", "Georgia", serif;
  font-size: 16px;
  line-height: 1.7;
  color: var(--fg-soft);
  margin: 0 0 24px;
}
.method-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
  margin-bottom: 32px;
}
@media (max-width: 600px) {
  .method-grid { grid-template-columns: 1fr; }
}
.method-step {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 22px 22px 20px;
  position: relative;
  transition: border-color 0.18s, transform 0.18s;
}
.method-step:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}
.method-num {
  font-family: "Space Grotesk", sans-serif;
  font-size: 13px;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 0.1em;
  margin-bottom: 12px;
  display: inline-block;
  padding: 3px 9px;
  background: rgba(217,70,70,0.10);
  border-radius: 4px;
}
.method-step-title {
  font-family: "Space Grotesk", sans-serif;
  font-size: 15px;
  font-weight: 600;
  color: var(--fg);
  margin-bottom: 10px;
  letter-spacing: -0.01em;
}
.method-step p {
  margin: 0;
  font-size: 13px;
  line-height: 1.65;
  color: var(--fg-soft);
}

.method-categories {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 22px 26px;
}
.method-cat-head {
  font-family: "Space Grotesk", sans-serif;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted-2);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  margin-bottom: 18px;
}
.method-cat-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 18px;
}
@media (max-width: 600px) {
  .method-cat-grid { grid-template-columns: 1fr; }
}
.method-cat {}
.method-cat-name {
  color: var(--accent-2);
  font-family: "Space Grotesk", sans-serif;
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 4px;
}
.method-cat-types {
  color: var(--fg-soft);
  font-size: 12px;
  line-height: 1.6;
}

/* Citation */
.cite-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 24px 28px 28px;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.03),
    0 12px 32px rgba(0,0,0,0.2);
  position: relative;
}

/* Controls toolbar — format selector on the left, action buttons on the right.
   Uses a Linear / Stripe Dashboard-style aesthetic: sentence-case labels,
   muted strokes, refined hover states. */
.cite-controls {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 22px;
  padding-bottom: 22px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.cite-format-block {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1 1 280px;
  min-width: 240px;
  max-width: 360px;
}
.cite-control-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted-2);
}

/* Custom dropdown — appearance:none + custom chevron */
.cite-select-wrap {
  position: relative;
  width: 100%;
}
.cite-select {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  width: 100%;
  background: var(--panel-2);
  color: var(--fg);
  border: 1px solid var(--border);
  padding: 11px 38px 11px 14px;
  border-radius: 6px;
  font-size: 14px;
  font-family: inherit;
  font-weight: 500;
  letter-spacing: 0.01em;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
  line-height: 1.2;
}
.cite-select:hover  { border-color: var(--border-strong); background: var(--panel-3); }
.cite-select:focus  { outline: none; border-color: var(--accent);
                      box-shadow: 0 0 0 3px rgba(217,70,70,0.15); }
.cite-select-chevron {
  position: absolute;
  right: 12px; top: 50%;
  transform: translateY(-50%);
  width: 14px; height: 14px;
  color: var(--muted);
  pointer-events: none;
}
.cite-select:hover ~ .cite-select-chevron { color: var(--fg); }

.cite-spec {
  font-size: 12px;
  font-weight: 400;
  letter-spacing: 0.01em;
  color: var(--muted);
  font-style: italic;
  font-family: "Source Serif 4", "Georgia", serif;
  line-height: 1.4;
}

/* Action buttons — connected button group, Linear-style */
.cite-actions {
  display: inline-flex;
  align-self: flex-end;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0;
  overflow: hidden;
}
.cite-action {
  background: transparent;
  border: 0;
  border-left: 1px solid var(--border);
  color: var(--fg-soft);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.01em;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s ease, color 0.15s ease;
}
.cite-action:first-child { border-left: 0; }
.cite-action:hover {
  background: var(--panel-3);
  color: var(--fg);
}
.cite-action:hover svg { color: var(--accent); }
.cite-action:active { background: var(--panel); }
.cite-action svg {
  display: block;
  flex-shrink: 0;
  width: 15px; height: 15px;
  color: var(--muted);
  transition: color 0.15s ease;
}

/* Citation panel — wraps body + toast feedback */
.cite-panel {
  position: relative;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.015), transparent 60%),
    var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 7px;
  overflow: hidden;
}
.cite-panel::before {
  content: ""; position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 2px;
  background: linear-gradient(180deg, var(--accent) 0%, transparent 60%);
  opacity: 0.5;
}
.cite-content {
  padding: 22px 26px;
  cursor: pointer;
}
.cite-content:hover { background: rgba(255,255,255,0.012); }
.cite-body {
  font-family: "Source Serif 4", "Georgia", serif;
  font-size: 16px;
  line-height: 1.75;
  color: var(--fg);
  margin: 0;
  padding-left: 1.6em;
  text-indent: -1.6em;     /* hanging indent — academic convention */
  hyphens: auto;
}
.cite-body em { color: var(--fg); font-style: italic; }
.cite-link {
  color: var(--accent-2);
  word-break: break-all;
}

/* BibTeX block with subtle syntax highlighting */
.cite-bibtex {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 12.5px;
  line-height: 1.7;
  color: var(--fg-soft);
  margin: 0;
  overflow-x: auto;
  white-space: pre;
}
.cite-bibtex .bib-type  { color: #c89055; font-weight: 600; }
.cite-bibtex .bib-key   { color: var(--accent-2); }
.cite-bibtex .bib-field { color: var(--accent-soft); }
.cite-bibtex .bib-value { color: var(--fg); }

/* Toast confirmation */
.cite-toast {
  position: absolute;
  top: 14px; right: 14px;
  background: var(--fg);
  color: var(--bg);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 7px 12px;
  border-radius: 4px;
  opacity: 0;
  transform: translateY(-8px);
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
  white-space: nowrap;
  box-shadow: 0 4px 14px rgba(0,0,0,0.4);
}
.cite-toast.show {
  opacity: 1;
  transform: translateY(0);
}

/* ============ About page (legacy, still used by section 02) ============ */
main.about {
  display: block;
  max-width: 880px;
  margin: 0 auto;
  padding: 56px 32px 96px;
  height: auto;
  overflow-y: auto;
}
main.about .about-block {
  margin-bottom: 56px;
  padding: 0;
  background: transparent;
  border: none;
  box-shadow: none;
}
main.about .about-block:not(:last-child) {
  padding-bottom: 56px;
  border-bottom: 1px solid var(--border);
}
main.about h2 {
  margin: 0 0 18px;
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.22em;
  font-weight: 700;
  font-family: "Inter", sans-serif;
  position: relative;
  padding-left: 32px;
}
main.about h2::before {
  content: ""; position: absolute;
  left: 0; top: 50%;
  width: 22px; height: 1px;
  background: var(--accent);
}
main.about p {
  margin: 0 0 14px;
  color: var(--fg-soft);
  line-height: 1.75;
  font-size: 15px;
}
main.about strong { color: var(--fg); font-weight: 600; }
main.about p:first-of-type {
  font-size: 17px;
  line-height: 1.7;
  color: var(--fg);
}

.org-card {
  display: grid;
  grid-template-columns: 96px 1fr;
  grid-template-rows: auto;
  column-gap: 24px;
  row-gap: 0;
  padding: 28px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
}
.org-logo {
  grid-column: 1; grid-row: 1 / span 99;
  width: 96px; height: 96px; display: block;
  border-radius: 8px;
  box-shadow: 0 0 0 1px rgba(255,255,255,0.06);
  margin: 0;
  align-self: start;
}
.org-card > *:not(.org-logo) { grid-column: 2; }
.org-name {
  font-size: 24px;
  font-weight: 600;
  color: var(--fg);
  margin: 0 0 12px;
  font-family: "Space Grotesk", sans-serif;
  letter-spacing: -0.02em;
}
.org-card p { margin: 0 0 12px; color: var(--fg-soft); font-size: 14px; line-height: 1.7; }
.org-card p:last-child { margin-bottom: 0; }
.org-link { margin: 18px 0 0; }
.org-link a {
  display: inline-flex;
  align-items: center;
  color: var(--fg);
  text-decoration: none;
  font-weight: 600;
  padding: 10px 18px;
  background: var(--panel-2);
  border: 1px solid var(--border-strong);
  border-radius: 4px;
  transition: background 0.15s, border-color 0.15s;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.org-link a:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.contact-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
  margin-top: 20px;
}
.contact-item {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px 16px;
  transition: border-color 0.15s;
}
.contact-item:hover { border-color: var(--border-strong); }
.contact-label {
  color: var(--muted-2);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-size: 10px;
  margin-bottom: 6px;
  font-weight: 600;
}
.contact-value {
  color: var(--fg);
  font-size: 13px;
  line-height: 1.6;
}
.contact-value a {
  color: var(--accent-2);
  text-decoration: none;
  border-bottom: 1px dashed transparent;
  transition: border-color 0.15s;
}
.contact-value a:hover { border-bottom-color: var(--accent-2); }
.social-list { display: flex; flex-wrap: wrap; gap: 6px 16px; }

.researcher-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
}
@media (max-width: 900px) {
  .researcher-grid { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
}
.researcher {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px 14px 18px;
  transition: border-color 0.18s ease;
  min-width: 0;
}
.researcher:hover { border-color: var(--accent); }
.researcher-role {
  color: var(--accent);
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-weight: 700;
  margin-bottom: 10px;
  line-height: 1.45;
}
.researcher-role span { display: block; }
.researcher-name {
  font-weight: 600;
  color: var(--fg);
  font-size: 14px;
  font-family: "Space Grotesk", sans-serif;
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.researcher-title {
  color: var(--muted);
  font-size: 11px;
  margin-top: 4px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-weight: 600;
}
.researcher-socials {
  display: flex;
  gap: 8px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}
.researcher-socials a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 6px;
  background: var(--panel-2);
  color: var(--muted);
  text-decoration: none;
  transition: background 0.15s ease, color 0.15s ease, transform 0.15s ease;
}
.researcher-socials a:hover {
  background: var(--accent);
  color: #fff;
  transform: translateY(-1px);
}
.researcher-socials svg {
  width: 15px;
  height: 15px;
}
.contact-item .researcher-socials {
  margin-top: 0;
  padding-top: 0;
  border-top: none;
  flex-wrap: wrap;
  gap: 7px;
}
.contact-item .researcher-socials a {
  width: 38px;
  height: 38px;
  border-radius: 7px;
}
.contact-item .researcher-socials svg {
  width: 17px;
  height: 17px;
}

.cat-list {
  color: var(--fg-soft);
  line-height: 1.8;
  padding-left: 20px;
}
.cat-list li { margin-bottom: 6px; }

/* ============ Analytics dashboard ============ */
main.dashboard {
  display: block;
  max-width: 1180px;
  margin: 0 auto;
  padding: 32px 28px 64px;
  height: auto;
  overflow-y: auto;
}

.dash-header { margin-bottom: 24px; }
.dash-head-top {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 18px;
}
.dash-title h1 {
  margin: 0;
  font-size: 28px;
  font-family: "Space Grotesk", sans-serif;
  font-weight: 600;
  color: var(--fg);
  letter-spacing: -0.02em;
}
.dash-subtitle {
  color: var(--muted);
  font-size: 13px;
  font-style: italic;
  margin-left: 2px;
}

.dash-meta {
  display: flex; align-items: center; gap: 14px;
  font-size: 11px;
  color: var(--muted);
}
.dash-live {
  display: inline-flex; align-items: center; gap: 6px;
  font-weight: 700; letter-spacing: 0.16em;
  color: #6ed085;
  font-size: 10px;
}
.dash-live-dot {
  display: inline-block; width: 7px; height: 7px;
  background: #6ed085; border-radius: 50%;
  box-shadow: 0 0 0 3px rgba(110, 208, 133, 0.18);
  animation: dash-pulse 2s infinite ease-in-out;
}
@keyframes dash-pulse {
  0%, 100% { box-shadow: 0 0 0 3px rgba(110, 208, 133, 0.18); }
  50%      { box-shadow: 0 0 0 5px rgba(110, 208, 133, 0.06); }
}
.dash-refreshed {
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.04em;
}
.dash-range {
  display: inline-flex;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 2px;
}
.dash-range button {
  border: 0; background: transparent;
  color: var(--muted);
  padding: 5px 11px; font-size: 11px; font-weight: 600;
  letter-spacing: 0.04em;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  font-family: inherit;
}
.dash-range button:hover { color: var(--fg); }
.dash-range button.active { background: var(--panel-3); color: var(--fg); }

.dash-tabs {
  display: flex; gap: 0;
  border-bottom: 1px solid var(--border);
}
.dash-tab {
  border: 0; background: transparent;
  color: var(--muted);
  padding: 10px 0;
  margin-right: 24px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.02em;
  cursor: pointer;
  font-family: inherit;
  position: relative;
  transition: color 0.15s;
}
.dash-tab:hover { color: var(--fg); }
.dash-tab.active { color: var(--fg); }
.dash-tab.active::after {
  content: "";
  position: absolute; left: 0; right: 0; bottom: -1px;
  height: 2px; background: var(--accent);
  border-radius: 1px;
}

/* Stacked sections — each subsection sits one under the other. */
.dash-section { margin-bottom: 36px; }
.dash-section-head {
  display: flex;
  align-items: baseline;
  gap: 14px;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.dash-section-head h2 {
  margin: 0;
  font-family: "Space Grotesk", sans-serif;
  font-size: 18px;
  font-weight: 600;
  color: var(--fg);
  letter-spacing: -0.01em;
}
.dash-section-sub {
  color: var(--muted);
  font-size: 12px;
  font-style: italic;
}

/* KPI strip */
.kpi-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}
.kpi {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 14px 16px;
  transition: border-color 0.15s, transform 0.15s;
}
.kpi:hover {
  border-color: var(--border-strong);
  transform: translateY(-1px);
}
.kpi-label {
  color: var(--muted-2);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 10px;
  margin-bottom: 8px;
  font-weight: 700;
}
.kpi-value {
  font-family: "Space Grotesk", sans-serif;
  font-size: 30px;
  font-weight: 600;
  color: var(--fg);
  letter-spacing: -0.025em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.kpi-sub {
  color: var(--muted);
  font-size: 11px;
  margin-top: 6px;
}

/* Generic dashboard card */
.dash-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 18px 20px;
  transition: border-color 0.15s;
}
.dash-card:hover { border-color: var(--border-strong); }
.dash-card.kpi-card { padding: 16px 18px; }

.dash-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}
.dash-card-head-left {
  display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap;
}
.dash-card-title {
  font-family: "Space Grotesk", sans-serif;
  font-weight: 600;
  font-size: 14px;
  color: var(--fg);
  letter-spacing: -0.01em;
}
.dash-card-sub {
  color: var(--muted);
  font-size: 12px;
  font-style: italic;
}
.dash-card-link {
  color: var(--muted);
  font-size: 11px;
  text-decoration: none;
  letter-spacing: 0.04em;
  transition: color 0.15s;
}
.dash-card-link:hover { color: var(--accent-2); }

.dash-live-pill {
  display: inline-flex; align-items: center; gap: 6px;
  font-weight: 700; letter-spacing: 0.16em;
  color: #6ed085;
  font-size: 10px;
  background: rgba(110, 208, 133, 0.10);
  padding: 4px 10px; border-radius: 12px;
}

.dash-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}
.dash-grid.two-col {
  grid-template-columns: repeat(auto-fit, minmax(380px, 1fr));
}

.dash-list {
  list-style: none;
  padding: 0;
  margin: 12px 0 0;
  max-height: 280px;
  overflow-y: auto;
}
.dash-list li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 2px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  color: var(--fg-soft);
}
.dash-list li:last-child { border-bottom: none; }
.dash-list li.empty {
  color: var(--muted);
  font-style: italic;
  border-bottom: none;
  justify-content: center;
  padding: 18px 0;
}
.an-list-key { color: var(--fg); }
.an-list-meta {
  color: var(--muted-2);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.chart-wrap {
  position: relative;
  height: 160px;
  margin: 6px 0 4px;
}

/* Looker iframe shell */
.looker-card { padding: 0; overflow: hidden; }
.looker-card .dash-card-head {
  margin: 0; padding: 12px 18px;
  border-bottom: 1px solid var(--border);
  background: var(--panel-2);
}
.looker-wrap {
  position: relative;
  width: 100%;
  background: var(--panel);
  aspect-ratio: 16 / 11;
  min-height: 720px;
}
.looker-wrap iframe {
  width: 100%; height: 100%;
  border: 0;
  display: block;
  background: transparent;
}
.skeleton-iframe {
  position: absolute; inset: 0;
  background:
    linear-gradient(110deg, var(--panel-2) 30%, var(--panel-3) 50%, var(--panel-2) 70%);
  background-size: 200% 100%;
  animation: skel-shimmer 1.6s infinite linear;
  z-index: 1;
  transition: opacity 0.4s ease;
}
.skeleton-iframe.done { opacity: 0; pointer-events: none; }
@keyframes skel-shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.skeleton-line {
  display: inline-block;
  width: 60%; height: 1em;
  background:
    linear-gradient(110deg, var(--panel-2) 30%, var(--panel-3) 50%, var(--panel-2) 70%);
  background-size: 200% 100%;
  animation: skel-shimmer 1.6s infinite linear;
  border-radius: 3px;
  vertical-align: middle;
}

.dash-foot {
  margin-top: 40px;
  padding: 18px 22px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 11px;
  color: var(--fg-soft);
  line-height: 1.65;
  letter-spacing: 0.02em;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.dash-foot-row {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 14px;
  align-items: baseline;
}
.dash-foot-label {
  color: var(--muted-2);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 10px;
  font-weight: 700;
}
.dash-foot code {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 11px;
  color: var(--accent-2);
  background: var(--panel-2);
  padding: 1px 5px;
  border-radius: 3px;
}

.setup-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 22px 26px;
}
.setup-card h3 {
  margin: 0 0 12px;
  color: var(--accent);
  font-size: 15px;
  font-family: "Space Grotesk", sans-serif;
  font-weight: 600;
}
.setup-card p { margin: 0 0 12px; color: var(--fg-soft); line-height: 1.7; }
.setup-card code {
  background: var(--panel-2);
  padding: 2px 6px;
  border-radius: 3px;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 12px;
  color: var(--accent-2);
}
.setup-card a { color: var(--accent-2); }

/* ============ Responsive ============ */
@media (max-width: 1200px) {
  main { grid-template-columns: 290px 1fr 300px; }
}

/* ===========================================================
   Tablet ≤ 1024 px — collapse detail panel, tighten topbar.
   =========================================================== */
@media (max-width: 1024px) {
  main { grid-template-columns: 240px 1fr; }
  .detail { display: none; }
  .topbar { padding: 12px 18px; gap: 18px; }
  .topnav a { padding: 7px 11px; font-size: 11px; }
  .topstats > div { padding: 0 12px; min-width: 76px; }
  .topstats span { font-size: 18px; }
  .topstats label { font-size: 9px; letter-spacing: 0.10em; }
  .brand h1 { font-size: 18px; }
  .brand-logo { height: 36px; }
}

/* ===========================================================
   Small tablet ≤ 900 px — hide topstats, slim tagline.
   =========================================================== */
@media (max-width: 900px) {
  .topstats { display: none; }
  .tagline { font-size: 10px; letter-spacing: 0.02em; }
  .nav-next-pill-label,
  .nav-next-pill-divider { display: none; }
  .nav-next-pill { padding: 5px 12px 5px 10px; gap: 7px; }
}

/* ===========================================================
   Phone ≤ 720 px — sidebar becomes a slide-out drawer + nav
   wraps to its own row.
   =========================================================== */
@media (max-width: 720px) {
  main { grid-template-columns: 1fr; height: calc(100vh - 56px); }
  .topbar { flex-wrap: wrap; gap: 10px; padding: 10px 14px; }
  .topnav { order: 3; width: 100%; border-left: none; padding-left: 0; margin-left: 0; justify-content: space-between; }
  .topnav a { padding: 6px 8px; font-size: 11px; flex: 1; text-align: center; }
  .brand-logo { height: 30px; }
  .brand h1 { font-size: 17px; letter-spacing: 0.14em; }
  .nav-next-pill { display: none !important; }

  /* Map sidebar slides in from the left when toggled open. */
  .sidebar {
    position: fixed;
    top: 110px;
    left: 0;
    bottom: 0;
    width: 86%;
    max-width: 320px;
    transform: translateX(-100%);
    transition: transform 0.28s ease;
    z-index: 50;
    border-right: 1px solid var(--border);
    box-shadow: 4px 0 18px rgba(0,0,0,0.5);
  }
  .sidebar.open { transform: translateX(0); }

  /* Hamburger toggle button — visible only on phones. */
  .sidebar-toggle {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    width: 36px; height: 36px;
    background: var(--panel-2);
    border: 1px solid var(--border-strong);
    border-radius: 6px;
    color: var(--fg);
    cursor: pointer;
    padding: 0;
    margin-right: 6px;
  }
  .sidebar-toggle svg { width: 18px; height: 18px; }
  .sidebar-toggle:hover { background: var(--panel-3); }

  /* Bigger touch targets on phones. */
  .sidebar h2.filter-group.collapsible,
  .sidebar h3.filter-group.collapsible { padding: 13px 14px; }
  .sidebar label, .parent-row { padding: 9px 11px; font-size: 13px; }
  .auth-submit, .auth-secondary, .cite-action { min-height: 40px; }

  /* Splash slimmer on phones. */
  .splash-logo { width: 120px; height: 120px; }
  .splash-title { font-size: 26px; max-width: 90vw; }
  .splash-eyebrow { font-size: 10px; letter-spacing: 0.18em; }
  .splash-sub { font-size: 10px; letter-spacing: 0.24em; }
  .splash-btn { padding: 12px 26px; font-size: 11px; }

  /* About page narrow margins. */
  main.who { padding: 32px 18px 60px; }
  .who-headline { font-size: 28px; }
  .who-lead { font-size: 16px; }

  /* Researcher row stacks 2-up on phones. */
  .researcher-grid { grid-template-columns: 1fr 1fr; }

  /* Analytics dashboard. */
  main.dashboard { padding: 24px 16px 48px; }
  .kpi-strip { grid-template-columns: 1fr 1fr; }
  .dash-grid.two-col,
  .dash-grid { grid-template-columns: 1fr; }
  .dash-head-top { gap: 8px; }
  .dash-foot-row { grid-template-columns: 1fr; gap: 2px; }
  .dash-foot-label { margin-top: 6px; }

  /* Archive sign-in. */
  main.archive { padding: 32px 18px 50px; }
  .auth-card { padding: 26px 22px; }
  .auth-chooser { grid-template-columns: 1fr; }
  .auth-choice + .auth-choice { border-left: 0; border-top: 1px solid var(--border); }

  /* Library country cards. */
  .country-header { padding: 18px 18px; gap: 14px; }
  .country-flag { width: 52px; }
  .country-name-block h2 { font-size: 19px; }
  .country-body { padding: 4px 18px 20px; }
  .archive-doc {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
  .archive-doc-actions { width: 100%; }
  .archive-doc-action { flex: 1; justify-content: center; padding: 10px; font-size: 12px; }
  .archive-head { flex-direction: column; align-items: flex-start; gap: 14px; }
  .archive-user { width: 100%; flex-wrap: wrap; }
  .pw-modal-card { padding: 24px 22px; }

  /* Citation card mobile layout. */
  .cite-card { padding: 18px 18px 22px; }
  .cite-controls { flex-direction: column; align-items: stretch; }
  .cite-actions { width: 100%; }
  .cite-action { flex: 1; justify-content: center; }
  .cite-body { font-size: 15px; line-height: 1.65; }

  /* Map detail panel hidden anyway; ensure no leakage. */
  .detail { display: none; }

  /* Bio popover sized for narrow screens. */
  .bio-popover { width: calc(100vw - 24px); max-width: 380px; }
}

/* ===========================================================
   Small phone ≤ 480 px — stack researchers single-column,
   compress hero typography further.
   =========================================================== */
@media (max-width: 480px) {
  .researcher-grid { grid-template-columns: 1fr; }
  .who-stats { grid-template-columns: 1fr 1fr; }
  .who-stat { padding: 10px 14px; border-left: 0; border-top: 1px solid var(--border); }
  .who-stat:first-child,
  .who-stat:nth-child(2) { border-top: 0; }
  .kpi-strip { grid-template-columns: 1fr; }
  .who-headline { font-size: 24px; }
  .who-lead { font-size: 15px; }
  .topnav a { font-size: 10px; padding: 6px 4px; letter-spacing: 0.04em; }
}

/* Default state: hide the sidebar toggle on desktop. JS will manage
   sidebar.open and a backdrop on mobile. */
.sidebar-toggle { display: none; }
.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 49;
  animation: fade-in 0.2s ease-out;
}
.sidebar-backdrop.visible { display: block; }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
