:root {
  /* Warm neutral palette (surfaces, hairlines, ink) */
  --bg: #faf8f4;
  --surface: #fdfcfa;
  --surface-hover: #f4f1eb;
  --pill: #efece6;
  /* The blue a nationally representative country shows on the map: REP_FILL
     (#82AEF3 in app.js) at 35% over the land colour. Reused by the
     "Nationally Rep" control so the colour itself says what it selects —
     keep in step with REP_FILL and the land fill if either changes. */
  --rep-shade: #d1dff5;
  --rep-edge: #82aef3;
  --border: #e6e1d8;
  --border-strong: #d6d0c5;
  --ink: #22211e;
  --muted: #76726a;
  --faint: #a8a39a;

  /* Brand accent */
  --teal: #0e7c7b;
  --teal-hover: #0b6362;

  /* Soft status tints */
  --good-bg: #e2f0dc;
  --good-ink: #2d6a27;
  --plan-bg: #f3ebdc;
  --plan-ink: #86602a;
  --ongoing-bg: #e3edf5;
  --ongoing-ink: #2f5d85;

  --radius-card: 16px;
  --radius-control: 10px;
  --shadow-float: 0 1px 2px rgba(34, 33, 30, 0.04), 0 8px 24px rgba(34, 33, 30, 0.08);
  --font: "Geist", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

/* Leaflet's own CSS sets a hardcoded font-family on .leaflet-container,
   which would otherwise override the inherited Geist for everything it
   renders (the map itself, country-name tooltips, zoom controls). */
.leaflet-container {
  font-family: var(--font);
}

#app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  min-height: 320px;
}

/* ---------- Header ---------- */
#header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  gap: 12px;
  flex-wrap: wrap;
}

#brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Droplets only, no wordmark: a lockup with type under it can't be read at
   header size without making the header noticeably deeper. The full
   WISE Scales.org logo lives in assets/logo-wordmark.png for use somewhere
   it can be shown large enough to read. */
#brand-logo {
  height: 30px;
  width: auto;
  flex-shrink: 0;
}

#brand h1 {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 0;
  line-height: 1.2;
}

#subtitle {
  margin: 2px 0 0;
  font-size: 12px;
  color: var(--muted);
}

#header-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

#stats {
  font-size: 12.5px;
  color: var(--muted);
  display: flex;
  gap: 14px;
  white-space: nowrap;
}

/* Reads as a sentence opener, so it sits closer to the first figure than
   the figures do to each other. */
.stats-lead { margin-right: -6px; }

#stats b {
  color: var(--ink);
  font-weight: 600;
}

#submit-open {
  border: 1px solid var(--ink);
  background: var(--ink);
  color: #fff;
  font-family: inherit;
  /* Label is roughly twice as long as the old "Submit data", so the padding
     is tightened and the type eased down half a pixel — enough to hold the
     button near its previous footprint without shrinking the text to the
     point where it stops reading as the primary action. */
  font-size: 12.5px;
  font-weight: 500;
  border-radius: var(--radius-control);
  padding: 8px 12px;
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.15s;
}

#submit-open:hover { background: #3a3833; }

/* ---------- Submission modal ---------- */
#submit-overlay {
  position: absolute;
  inset: 0;
  z-index: 900;
  background: rgba(34, 33, 30, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

#submit-overlay.hidden { display: none; }

#submit-modal {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  box-shadow: 0 24px 64px rgba(34, 33, 30, 0.18);
  padding: 24px;
  width: 500px;
  max-width: 100%;
  max-height: 100%;
  overflow-y: auto;
}

#submit-modal h2 {
  margin: 0 0 6px;
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.01em;
  padding-right: 28px;
}

.submit-intro {
  margin: 0 0 18px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--muted);
}

.submit-intro a { color: var(--ink); }

#submit-close,
#detail-close {
  position: absolute;
  top: 14px;
  right: 14px;
  border: 1px solid var(--border);
  background: var(--surface);
  width: 28px;
  height: 28px;
  border-radius: 50%;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  color: var(--muted);
  transition: background 0.15s;
}

#submit-close:hover,
#detail-close:hover { background: var(--surface-hover); color: var(--ink); }

#submit-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

#submit-form label {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--ink);
}

#submit-form input,
#submit-form select,
#submit-form textarea {
  border: 1px solid var(--border);
  border-radius: var(--radius-control);
  padding: 9px 11px;
  font-size: 13px;
  font-family: inherit;
  color: var(--ink);
  background: #fff;
  transition: border-color 0.15s, box-shadow 0.15s;
}

#submit-form input::placeholder,
#submit-form textarea::placeholder { color: var(--faint); }

#submit-form input:focus,
#submit-form select:focus,
#submit-form textarea:focus {
  outline: none;
  border-color: var(--border-strong);
  box-shadow: 0 0 0 3px var(--pill);
}

.form-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 12px;
}

/* Long option text (e.g. "Healthcare Facility (HCF) - WISE") would
   otherwise size a select wider than its grid column. */
#submit-form select { width: 100%; min-width: 0; }

#submit-send {
  border: none;
  background: var(--ink);
  color: #fff;
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  border-radius: var(--radius-control);
  padding: 11px 18px;
  cursor: pointer;
  margin-top: 6px;
  transition: background 0.15s;
}

#submit-send:hover { background: #3a3833; }
#submit-send:disabled { background: var(--faint); cursor: default; }

#submit-status {
  font-size: 13px;
  margin: 0;
  color: var(--good-ink);
  font-weight: 500;
}

#submit-status.error { color: #9c3b35; }
#submit-status.hidden { display: none; }

@media (max-width: 480px) {
  .form-row { grid-template-columns: 1fr; }
}

/* ---------- Map ---------- */
#map-wrap {
  position: relative;
  flex: 1;
  min-height: 0;
}

#map {
  position: absolute;
  inset: 0;
  background: #20B2AA;
}

.country-label {
  background: none;
  border: none;
  box-shadow: none;
  padding: 0;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.01em;
  color: #4d4a44;
  pointer-events: none;
  white-space: nowrap;
}

.country-label::before { display: none; }

#map.labels-hidden .country-label { display: none; }

/* Zoom control: match the other floating controls */
.leaflet-bar {
  border: 1px solid var(--border) !important;
  border-radius: var(--radius-control) !important;
  box-shadow: var(--shadow-float) !important;
  overflow: hidden;
}

.leaflet-bar a,
.leaflet-bar a:hover {
  width: 34px !important;
  height: 34px !important;
  line-height: 32px !important;
  background: var(--surface);
  color: var(--ink);
  border-bottom-color: var(--border) !important;
}

.leaflet-control-zoom-in,
.leaflet-control-zoom-out {
  font: 400 18px/32px var(--font) !important;
}

.leaflet-bar a:hover { background: var(--surface-hover); }

/* ---------- Filter panel ---------- */
#filter-panel {
  position: absolute;
  top: 14px;
  left: 14px;
  z-index: 500;
  background: rgba(253, 252, 250, 0.97);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 14px;
  box-shadow: var(--shadow-float);
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 272px;
  max-width: calc(100% - 28px);
  max-height: calc(100% - 28px);
  backdrop-filter: blur(8px);
  transition: width 0.15s, padding 0.15s;
}

#panel-toggle {
  position: absolute;
  top: 50px;
  right: -14px;
  z-index: 501;
  width: 28px;
  height: 28px;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 50%;
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(34, 33, 30, 0.08);
  transition: color 0.15s;
}

#panel-toggle:hover { color: var(--ink); }

#panel-toggle svg { transition: transform 0.15s; }

#filter-panel.collapsed {
  width: auto;
  padding: 6px;
}

#filter-panel.collapsed #panel-toggle {
  position: static;
  box-shadow: none;
  border: none;
}

#filter-panel.collapsed #panel-toggle svg { transform: rotate(180deg); }

#panel-body {
  display: flex;
  flex-direction: column;
  gap: 6px;
  overflow-y: auto;
  min-height: 0;
}

#filter-panel.collapsed #panel-body { display: none; }

/* Search */
#search-wrap {
  position: relative;
  margin-bottom: 8px;
}

#search-input {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius-control);
  padding: 9px 36px 9px 12px;
  font-size: 13px;
  font-family: inherit;
  color: var(--ink);
  background: #fff;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

#search-input::placeholder { color: var(--faint); }

#search-input:focus {
  border-color: var(--border-strong);
  box-shadow: 0 0 0 3px var(--pill);
}

#search-btn {
  position: absolute;
  top: 50%;
  right: 4px;
  transform: translateY(-50%);
  width: 28px;
  height: 28px;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

#search-btn:hover { background: var(--pill); color: var(--ink); }

#search-results {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  z-index: 700;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow-float);
  max-height: 280px;
  overflow-y: auto;
  padding: 4px;
}

#search-results.hidden { display: none; }

.search-group-title {
  font-size: 11px;
  color: var(--faint);
  font-weight: 500;
  padding: 8px 10px 2px;
}

.search-result {
  display: block;
  width: 100%;
  text-align: left;
  border: none;
  background: none;
  border-radius: 8px;
  padding: 7px 10px;
  font-size: 13px;
  font-family: inherit;
  color: var(--ink);
  cursor: pointer;
}

.search-result:hover { background: var(--surface-hover); }

.search-result .result-sub {
  display: block;
  font-size: 11.5px;
  color: var(--muted);
  margin-top: 1px;
  word-break: break-all;
}

.search-empty {
  padding: 10px;
  font-size: 13px;
  color: var(--muted);
}

/* ----- Filter panel type scale -------------------------------------
   Three deliberate levels, so the eye can skip straight to whichever it
   needs:
     1. "Filter by"  — the one sentence-case heading, 13px semibold ink
     2. GROUP LABELS — 10px uppercase tracked, faint: signposts, not content
     3. controls     — 12.5px, the only things at full ink that you act on
   Secondary actions (check all / learn more) sit below all three at 11px.
   ------------------------------------------------------------------- */
.filter-title {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -0.005em;
  color: var(--ink);
  text-transform: none;
  margin-bottom: 2px;
}

#tools-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-top: 14px;
}

/* The scale heading carries .filter-subtitle like Sample Type and Status,
   so all three group labels read at the same weight; its own top margin
   would fight the flex row's baseline alignment. */
#tools-header .filter-subtitle { margin: 0; }

.tools-bulk {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  color: var(--faint);
}

.tools-bulk button {
  border: none;
  background: none;
  padding: 0;
  font-family: inherit;
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
}

.tools-bulk button:hover { color: var(--ink); }

/* Level 2. Tracked uppercase at a small size reads as a signpost without
   needing weight or darkness, which keeps the controls underneath the most
   prominent thing in each group. */
.filter-subtitle {
  font-size: 10px;
  color: var(--faint);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin: 14px 0 0;
}

/* Segmented pills (Week / Month style) */
#status-toggle,
#datatype-toggle {
  display: flex;
  gap: 4px;
}

.status-btn {
  flex: 1 1 auto;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: var(--radius-control);
  padding: 7px 8px;
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.status-btn:hover {
  background: var(--surface-hover);
  color: var(--ink);
}

.status-btn.active {
  background: var(--pill);
  border-color: var(--border-strong);
  color: var(--ink);
  font-weight: 600;
}

/* Scale checklist */
.tool-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.tool-option {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 12.5px;
  line-height: 1.35;
  color: var(--ink);
  cursor: pointer;
  padding: 5px 6px;
  margin: 0 -6px;
  border-radius: 8px;
  transition: background 0.15s;
}

.tool-option:hover { background: var(--surface-hover); }

.tool-option input {
  accent-color: var(--ink);
  width: 14px;
  height: 14px;
  margin: 0;
  flex-shrink: 0;
}

.tool-swatch {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
}

#tools-learn-more {
  display: block;
  margin-top: 14px;
  padding-top: 11px;
  border-top: 1px solid var(--border);
  font-size: 11.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--muted);
  text-decoration: underline;
  text-decoration-color: var(--border-strong);
  text-underline-offset: 2px;
}

#tools-learn-more:hover {
  color: var(--ink);
  text-decoration-color: var(--ink);
}

/* Groups are separated by the label's own top margin rather than rules:
   with three groups, three hairlines chopped the panel into slabs and
   competed with the panel's own border. */
#tool-list + .filter-subtitle { margin-top: 16px; }

/* ---------- Floating map buttons ---------- */
#expand-btn,
#globe-btn {
  position: absolute;
  top: 14px;
  z-index: 500;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-control);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--ink);
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
  box-shadow: var(--shadow-float);
  transition: background 0.15s;
}

#expand-btn { right: 14px; }
#globe-btn { right: 58px; }

#expand-btn:hover,
#globe-btn:hover { background: var(--surface-hover); }

#globe {
  position: absolute;
  inset: 0;
  display: none;
  /* The canvas paints the globe and its own sea colour; this is the space
     around the sphere, which matches the page rather than the ocean. */
  background: var(--bg);
}

#globe.active { display: block; }

/* ---------- Detail card ---------- */
#detail-card {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 600;
  width: 340px;
  max-width: calc(100% - 28px);
  max-height: calc(100% - 28px);
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-float);
  padding: 20px;
}

#detail-card.hidden { display: none; }

.detail-country {
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.015em;
  line-height: 1.2;
  margin: 0 0 4px;
  padding-right: 32px;
}

.detail-summary {
  font-size: 13px;
  color: var(--muted);
  margin: 0 0 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.detail-filter-note {
  background: var(--pill);
  border-radius: var(--radius-control);
  padding: 9px 12px;
  font-size: 12.5px;
  color: var(--ink);
  margin-bottom: 12px;
  word-break: break-word;
}

/* Each entry reads as its own soft card, like the metric tiles */
.entry {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
  padding: 12px 14px;
  margin-bottom: 8px;
}

.entry-group {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
  margin-bottom: 8px;
  overflow: hidden;
}

.entry-group summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 12px 14px;
  cursor: pointer;
  list-style: none;
  transition: background 0.15s;
}

.entry-group summary::-webkit-details-marker { display: none; }

.entry-group summary:hover { background: var(--surface-hover); }

.group-chev {
  display: inline-flex;
  align-items: center;
  vertical-align: -3px;
  transition: transform 0.15s;
}

.entry-group[open] .group-chev { transform: rotate(180deg); }

.entry-group[open] .count-verb { display: none; }

.entry-group .group-title {
  font-size: 14px;
  font-weight: 600;
  flex: 1;
}

.entry-group .group-count {
  font-size: 11.5px;
  font-weight: 500;
  color: var(--muted);
  background: var(--pill);
  border-radius: 999px;
  padding: 4px 10px;
  white-space: nowrap;
}

/* Entries nested inside a group: flat rows separated by hairlines */
.entry-group .entry {
  border: none;
  border-top: 1px solid var(--border);
  border-radius: 0;
  margin: 0;
  background: none;
}

.badge-row {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-bottom: 8px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 500;
  padding: 3px 8px;
  border-radius: 999px;
  line-height: 1.3;
}

.badge.completed { background: var(--good-bg); color: var(--good-ink); }
.badge.planned { background: var(--plan-bg); color: var(--plan-ink); }
.badge.ongoing { background: var(--ongoing-bg); color: var(--ongoing-ink); }
.badge.tool,
.badge.rep {
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--border);
}

.badge-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

.entry-loc {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.35;
  margin: 0 0 3px;
}

.entry-meta {
  font-size: 12.5px;
  color: var(--muted);
  margin: 0 0 8px;
}

.entry-links {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  font-size: 12.5px;
  margin-top: 4px;
}

.entry-links a {
  color: var(--ink);
  text-decoration: underline;
  text-decoration-color: var(--border-strong);
  text-underline-offset: 2px;
}

.entry-links a:hover { text-decoration-color: var(--ink); }

.info-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--ink) !important;
  border-radius: var(--radius-control);
  padding: 6px 12px;
  font-size: 12.5px;
  font-weight: 500;
  text-decoration: none !important;
  transition: background 0.15s;
}

.info-btn:hover { background: var(--surface-hover); }

.info-btn-arrow {
  color: var(--muted);
  font-size: 12px;
}

/* Country poster: click-through to the DOI, washed out on hover with a
   centered "Open" pill (the iframe swallows pointer events, so the cover
   sits above it and carries the click). */
.poster {
  position: relative;
  display: block;
  margin-top: 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  background: #fff;
  aspect-ratio: 8.5 / 11;
  text-decoration: none !important;
}

/* The poster eases up into place as the card opens, so it reads as arriving
   rather than being there all along. */
@keyframes poster-rise {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}

.poster { animation: poster-rise 0.45s 0.1s ease-out both; }

@media (prefers-reduced-motion: reduce) {
  .poster { animation: none; }
}

.poster-media {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  object-fit: cover;
  object-position: top;
  pointer-events: none;
}

/* Canva's viewer paints its own toolbar along the bottom of the frame;
   overhang it past the card's clipped edge so the thumbnail is just poster. */
iframe.poster-media {
  height: calc(100% + 42px);
  object-fit: none;
}

.poster-cover {
  position: absolute;
  inset: 0;
  background: rgba(253, 252, 250, 0);
  transition: background 0.15s;
}

.poster-open {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(34, 33, 30, 0.72);
  color: #fff;
  font-size: 12.5px;
  font-weight: 500;
  padding: 7px 14px;
  border-radius: 999px;
  opacity: 0;
  transition: opacity 0.15s;
  pointer-events: none;
}

.poster:hover .poster-cover { background: rgba(253, 252, 250, 0.72); }
.poster:hover .poster-open,
.poster:focus-visible .poster-open { opacity: 1; }

.poster:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

/* The longer label plus the three stat figures no longer fit on one line on
   a phone, so let them stack rather than run off the right edge. */
@media (max-width: 620px) {
  #header-right {
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px 12px;
  }
}

@media (max-width: 480px) {
  #header { padding: 8px 12px; }
  #subtitle { display: none; }
  #stats { font-size: 11px; gap: 8px; }
  #submit-open { font-size: 12px; padding: 7px 11px; }
  #filter-panel { max-width: 220px; padding: 10px; }
  .status-btn { padding: 6px 4px; font-size: 11px; }
  #detail-card { width: calc(100% - 28px); }
}

/* ---------- Globe view: inverted filter panel ----------
   The globe sits on the page's pale ground rather than the 2D map's teal
   sea, so the near-white panel had nothing to separate it from the
   backdrop. In globe mode it flips to the warm grey used for body text,
   with the type knocked out in white — same layout and spacing, inverted
   values. Tints are expressed as white at a given alpha so every piece
   stays in step with the panel colour. */
body.globe-mode #filter-panel {
  background: rgba(118, 114, 106, 0.97);
  border-color: rgba(255, 255, 255, 0.18);
  box-shadow: 0 1px 2px rgba(34, 33, 30, 0.12), 0 8px 24px rgba(34, 33, 30, 0.18);
}

body.globe-mode .filter-title { color: #fff; }
body.globe-mode .filter-subtitle { color: rgba(255, 255, 255, 0.6); }

/* Search */
body.globe-mode #search-input {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.22);
  color: #fff;
}
body.globe-mode #search-input::placeholder { color: rgba(255, 255, 255, 0.55); }
body.globe-mode #search-input:focus {
  border-color: rgba(255, 255, 255, 0.45);
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.12);
}
body.globe-mode #search-btn { color: rgba(255, 255, 255, 0.75); }
body.globe-mode #search-btn:hover {
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
}

/* Segmented controls */
body.globe-mode .status-btn {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.2);
  color: rgba(255, 255, 255, 0.78);
}
body.globe-mode .status-btn:hover {
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
}
body.globe-mode .status-btn.active {
  background: rgba(255, 255, 255, 0.92);
  border-color: rgba(255, 255, 255, 0.92);
  color: #22211e;
}

/* Scale checklist */
body.globe-mode .tool-option { color: #fff; }
body.globe-mode .tool-option:hover { background: rgba(255, 255, 255, 0.1); }
body.globe-mode .tool-option input { accent-color: #fff; }
body.globe-mode .tools-bulk { color: rgba(255, 255, 255, 0.5); }
body.globe-mode .tools-bulk button { color: rgba(255, 255, 255, 0.75); }
body.globe-mode .tools-bulk button:hover { color: #fff; }

/* Footer link and the collapse handle */
body.globe-mode #tools-learn-more {
  color: rgba(255, 255, 255, 0.8);
  border-top-color: rgba(255, 255, 255, 0.22);
  text-decoration-color: rgba(255, 255, 255, 0.45);
}
body.globe-mode #tools-learn-more:hover {
  color: #fff;
  text-decoration-color: #fff;
}
body.globe-mode #panel-toggle {
  background: rgba(118, 114, 106, 0.97);
  border-color: rgba(255, 255, 255, 0.22);
  color: rgba(255, 255, 255, 0.8);
}
body.globe-mode #panel-toggle:hover { color: #fff; }

/* ---------- "Nationally Rep" carries the map's own shading colour ----------
   Shaded territories and this control are the same idea, so they use the
   same blue: hovering previews it, selecting fills the pill with the exact
   tint the countries take. */
#datatype-toggle .status-btn[data-datatype="national"]:hover {
  background: rgba(130, 174, 243, 0.2);
  border-color: rgba(130, 174, 243, 0.55);
  color: var(--ink);
}

#datatype-toggle .status-btn[data-datatype="national"].active {
  background: var(--rep-shade);
  border-color: var(--rep-edge);
  color: var(--ink);
}

/* Same colour against the inverted globe-view panel, where the default
   active state is a plain white pill. */
body.globe-mode #datatype-toggle .status-btn[data-datatype="national"]:hover {
  background: rgba(130, 174, 243, 0.4);
  border-color: rgba(209, 223, 245, 0.7);
  color: #fff;
}

body.globe-mode #datatype-toggle .status-btn[data-datatype="national"].active {
  background: var(--rep-shade);
  border-color: var(--rep-shade);
  color: #22211e;
}
