/* Reset and base */
*, *::before, *::after { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
  padding: 0;
  font-family: system-ui, -apple-system, sans-serif;
}

/* ── App shell: sidebar + map side-by-side ── */
.app-shell {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* ── Controls sidebar ── */
.controls-panel {
  width: 280px;
  min-width: 280px;
  display: flex;
  flex-direction: column;
  background: #fff;
  border-right: 1px solid #dee2e6;
  overflow-y: auto;
  z-index: 1000;
}

.controls-header {
  padding: 1rem 1rem 0.5rem;
  border-bottom: 1px solid #e9ecef;
  background: #f8f9fa;
}

.app-title {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 1.05rem;
  font-weight: 700;
  margin: 0 0 0.1rem;
  color: #212529;
}

.app-subtitle {
  font-size: 0.75rem;
  color: #6c757d;
  margin: 0;
}

.breadcrumb-nav {
  padding: 0.5rem 1rem;
  background: #edf7dc;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
}

.controls-body {
  padding: 1rem;
  flex: 1;
}

.control-group {
  margin-bottom: 1rem;
}

.control-label {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #6c757d;
  margin-bottom: 0.4rem;
}

/* ── Toggle button groups ── */
.btn-toggle-group {
  display: flex;
  gap: 4px;
}

.btn-toggle-group--wrap {
  flex-wrap: wrap;
}

.btn-toggle {
  flex: 1;
  padding: 0.3rem 0.55rem;
  font-size: 0.78rem;
  font-weight: 500;
  line-height: 1.3;
  border: 1.5px solid #c0d890;
  border-radius: 5px;
  background: #f8fafc;
  color: #495057;
  cursor: pointer;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
  white-space: nowrap;
  text-align: center;
}

.btn-toggle-group--wrap .btn-toggle {
  flex: 0 0 auto;  /* don't stretch when wrapping */
}

.btn-toggle:hover {
  background: #edf7dc;
  border-color: #8cc040;
  color: #4a7a12;
}

.btn-toggle.active {
  background: #5a8c18;
  border-color: #5a8c18;
  color: #fff;
  font-weight: 600;
}

/* ── Custom period slider (noUiSlider) ── */
.period-slider-wrap {
  padding: 0.55rem 0.5rem 0.1rem;
}

.period-slider {
  height: 6px;
}

/* Compact, brand-coloured overrides of the noUiSlider defaults */
.period-slider .noUi-connect {
  background: #74b320;
}

.period-slider .noUi-handle {
  width: 14px;
  height: 14px;
  right: -7px;
  top: -5px;
  border-radius: 50%;
  border: 2px solid #5a8c18;
  background: #fff;
  box-shadow: none;
  cursor: ew-resize;
}

.period-slider .noUi-handle::before,
.period-slider .noUi-handle::after {
  display: none;   /* remove the default grip lines */
}

.period-slider-label {
  margin-top: 0.3rem;
  text-align: center;
  font-size: 0.72rem;
  font-weight: 600;
  color: #4a7a12;
}

.period-slider-label .custom-badge {
  margin-left: 0.3rem;
  padding: 0 0.3rem;
  border-radius: 3px;
  background: #edf7dc;
  color: #3d6614;
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* ── In-app guide (tour / beacons / help modal) ── */

.guide-help-btn {
  position: absolute;
  top: 0.6rem;
  right: 0.6rem;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1.5px solid #c0d890;
  background: #f8fafc;
  color: #4a7a12;
  font-size: 0.8rem;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
}

.guide-help-btn:hover {
  background: #74b320;
  border-color: #5a8f18;
  color: #fff;
}

.controls-header {
  position: relative;   /* anchors the "?" button */
}

/* Driver.js popover: brand accent */
.driver-popover {
  border-top: 3px solid #74b320;
}

.driver-popover .driver-popover-title {
  color: #3d6614;
}

/* First-appearance beacon: pulsing dot + one-line tip */
.guide-beacon {
  position: absolute;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #74b320;
  box-shadow: 0 0 0 rgba(116, 179, 32, 0.5);
  animation: guide-pulse 1.6s infinite;
  z-index: 60;
  pointer-events: none;
}

@keyframes guide-pulse {
  0%   { box-shadow: 0 0 0 0 rgba(116, 179, 32, 0.55); }
  70%  { box-shadow: 0 0 0 9px rgba(116, 179, 32, 0); }
  100% { box-shadow: 0 0 0 0 rgba(116, 179, 32, 0); }
}

.guide-beacon-tip {
  position: absolute;
  padding: 0.2rem 0.5rem;
  background: #3d6614;
  color: #fff;
  font-size: 0.7rem;
  border-radius: 4px;
  white-space: nowrap;
  z-index: 60;
  cursor: pointer;
}

/* Help modal (hand-rolled — Bootstrap JS is not loaded) */
.guide-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(20, 30, 10, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1100;
}

.guide-modal {
  width: min(620px, 92vw);
  max-height: 84vh;
  display: flex;
  flex-direction: column;
  background: #fff;
  border-radius: 8px;
  border-top: 4px solid #74b320;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25);
}

.guide-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.8rem 1.1rem;
  border-bottom: 1px solid #e9ecef;
}

.guide-modal-header h2 {
  margin: 0;
  font-size: 1.05rem;
  color: #3d6614;
}

.guide-modal-close {
  border: none;
  background: none;
  font-size: 1rem;
  color: #6c757d;
  cursor: pointer;
}

.guide-modal-body {
  padding: 0.9rem 1.1rem;
  overflow-y: auto;
  font-size: 0.85rem;
}

.guide-modal-body h3 {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #4a7a12;
  margin: 0.9rem 0 0.35rem;
}

.guide-modal-body ul {
  margin: 0 0 0.4rem;
  padding-left: 1.1rem;
}

.guide-modal-body li {
  margin-bottom: 0.25rem;
}

/* ── Continent filter (sidebar) ── */
.continent-filter {
  font-size: 0.78rem;
  padding: 0.3rem 0.55rem;
  border: 1.5px solid #c0d890;
  border-radius: 5px;
  color: #495057;
}

.continent-filter:disabled {
  opacity: 0.5;
  background: #f1f3f5;
}

/* ── Comparison area buttons ── */
.control-sublabel {
  display: block;
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: rgba(255,255,255,0.45);
  margin-top: 0.6rem;
  margin-bottom: 0.2rem;
}

.btn-toggle--compare {
  font-size: 0.72rem;
  padding: 0.15rem 0.5rem;
  opacity: 0.7;
  border-style: dashed;
}
.btn-toggle--compare:hover { opacity: 1; }
.btn-toggle--compare.active {
  opacity: 1;
  border-style: solid;
}

/* Areas comparison table */
.row-area-active td { font-weight: 600; background: rgba(116,163,59,0.1); }

/* ── Indicator sub-groups ── */
.indicator-group {
  margin-bottom: 0.6rem;
}

.indicator-group-label {
  display: block;
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #adb5bd;
  margin-bottom: 0.3rem;
}

/* ── Country filter chip ── */
.country-filter-bar {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 1rem;
  background: #edf7dc;
  border-bottom: 1px solid #b5d97a;
  font-size: 0.85rem;
  font-weight: 500;
  color: #4a7a12;
}

.country-filter-flag { font-size: 1.1rem; line-height: 1; }

.country-filter-clear {
  margin-left: auto;
  background: none;
  border: none;
  cursor: pointer;
  color: #6c757d;
  font-size: 1rem;
  line-height: 1;
  padding: 0 0.1rem;
}
.country-filter-clear:hover { color: #dc3545; }

/* ── CCAA filter chip (sub-level of country selection) ── */
.admin1-filter-bar {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 1rem 0.35rem 1.5rem;
  background: #f2f8e8;
  border-bottom: 1px solid #c5df9a;
  font-size: 0.8rem;
  color: #4a7a12;
}

.admin1-filter-label {
  font-weight: 600;
  flex-shrink: 0;
}

.admin1-filter-name { flex: 1; }

.admin1-filter-clear {
  background: none;
  border: none;
  cursor: pointer;
  color: #6c757d;
  font-size: 0.9rem;
  padding: 0 0.1rem;
}
.admin1-filter-clear:hover { color: #dc3545; }

/* ── City filter chip (sub-level of CCAA selection) ── */
.city-filter-bar {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 1rem 0.35rem 2.5rem;
  background: #eaf5df;
  border-bottom: 1px solid #b0d080;
  font-size: 0.8rem;
  color: #3d6614;
}
.city-filter-label { font-weight: 600; flex-shrink: 0; }
.city-filter-name  { flex: 1; }
.city-filter-clear {
  background: none; border: none; cursor: pointer;
  color: #6c757d; font-size: 0.9rem; padding: 0 0.1rem;
}
.city-filter-clear:hover { color: #dc3545; }

/* ── Leaf selection chip (selected non-Spain city or organisation) ── */
.leaf-filter-bar {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 1rem 0.35rem 3rem;
  background: #fffbeb;
  border-bottom: 1px solid #f8d86a;
  font-size: 0.8rem;
  color: #78350f;
}

.leaf-filter-icon {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #92400e;
  flex-shrink: 0;
}

.leaf-filter-name {
  flex: 1;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.leaf-filter-clear {
  background: none;
  border: none;
  cursor: pointer;
  color: #6c757d;
  font-size: 0.9rem;
  padding: 0 0.1rem;
}
.leaf-filter-clear:hover { color: #dc3545; }

/* ── Thematic filter bar (holds one chip per active MeSH / Qualifier / Topic) ── */
.thematic-filter-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.3rem;
  padding: 0.4rem 1rem;
  background: #fff8e1;
  border-bottom: 1px solid #f0c040;
}

.thematic-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  background: rgba(120, 90, 0, 0.1);
  border: 1px solid #e8b800;
  border-radius: 4px;
  padding: 0.1rem 0.4rem;
  max-width: 220px;
}

.thematic-chip-type {
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #7a5c00;
  flex-shrink: 0;
}

.thematic-chip-name {
  font-size: 0.76rem;
  color: #3d2800;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.thematic-chip-clear {
  background: none;
  border: none;
  cursor: pointer;
  color: #aaa;
  font-size: 0.95rem;
  padding: 0;
  line-height: 1;
  flex-shrink: 0;
}
.thematic-chip-clear:hover { color: #dc3545; }

.thematic-filter-clear-all {
  margin-left: auto;
  background: none;
  border: none;
  cursor: pointer;
  color: #6c757d;
  font-size: 0.72rem;
  padding: 0 0.15rem;
  white-space: nowrap;
}
.thematic-filter-clear-all:hover { color: #dc3545; }

/* Highlighted row for the active thematic filter in the listing table */
.row-thematic-active td {
  background-color: #fff8e1 !important;
  border-top: 2px solid #f0c040;
  border-bottom: 2px solid #f0c040;
  font-weight: 600;
}

/* Clickable country name cells in the countries table */
.col-country-clickable {
  cursor: pointer;
}
.col-country-clickable:hover {
  color: #4a7a12;
  text-decoration: underline;
}

.comparison-notice {
  padding: 0.75rem 1rem;
  background: #fff3cd;
  border-top: 1px solid #ffc107;
}

/* ── Legend ── */
.legend-container {
  padding: 0.75rem 1rem;
  border-top: 1px solid #e9ecef;
}

.legend-title {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #6c757d;
  margin-bottom: 0.4rem;
}

.legend-gradient {
  height: 10px;
  border-radius: 4px;
  margin-bottom: 0.25rem;
}

.legend-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.7rem;
  color: #6c757d;
}

/* ── Data summary ── */
.data-summary {
  padding: 0.75rem 1rem;
  border-top: 1px solid #e9ecef;
  display: flex;
  gap: 1rem;
}

.summary-stat {
  display: flex;
  flex-direction: column;
}

.summary-label {
  font-size: 0.65rem;
  text-transform: uppercase;
  color: #6c757d;
}

.summary-value {
  font-size: 0.9rem;
  font-weight: 600;
  color: #212529;
}

/* ── Context header (breadcrumb + search + KPI boxes) ── */
.context-header {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 0.5rem 0.75rem;
  background: #74A33B;
  border-bottom: 1px solid rgba(0,0,0,0.15);
}

.map-loading-badge {
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1500;
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.35rem 0.9rem;
  background: rgba(30, 50, 10, 0.82);
  color: #d4edaa;
  border-radius: 20px;
  font-size: 0.76rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  box-shadow: 0 2px 10px rgba(0,0,0,0.3);
  pointer-events: none;
  backdrop-filter: blur(3px);
}

.map-loading-spinner {
  width: 13px;
  height: 13px;
  border: 2px solid rgba(212, 237, 170, 0.3);
  border-top-color: #d4edaa;
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
}

.context-header-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
}

.context-title {
  flex: 1;
  min-width: 0;
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 0.9rem;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Search box ── */
.search-wrap {
  position: relative;
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.search-icon {
  position: absolute;
  left: 0.45rem;
  color: rgba(255,255,255,0.55);
  font-size: 1.05rem;
  pointer-events: none;
  line-height: 1;
}

.search-input {
  width: 150px;
  padding: 0.18rem 1.5rem 0.18rem 1.55rem;
  font-size: 0.78rem;
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: 5px;
  background: rgba(255,255,255,0.09);
  color: #fff;
  outline: none;
  transition: width 0.2s ease, background 0.15s;
}
.search-input::placeholder { color: rgba(255,255,255,0.4); }
.search-input:focus {
  width: 230px;
  background: rgba(255,255,255,0.16);
  border-color: rgba(255,255,255,0.38);
}

.search-clear {
  position: absolute;
  right: 0.35rem;
  background: none;
  border: none;
  color: rgba(255,255,255,0.5);
  cursor: pointer;
  font-size: 1rem;
  padding: 0;
  line-height: 1;
}
.search-clear:hover { color: #fff; }

/* ── Search dropdown ── */
.search-dropdown {
  position: absolute;
  top: calc(100% + 5px);
  right: 0;
  width: 310px;
  max-height: 460px;
  overflow-y: auto;
  background: #fff;
  border: 1px solid #dee2e6;
  border-radius: 6px;
  box-shadow: 0 4px 18px rgba(0,0,0,0.18);
  z-index: 3000;
}

.search-group-label {
  padding: 0.35rem 0.75rem 0.2rem;
  font-size: 0.6rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #adb5bd;
  border-top: 1px solid #f0f0f0;
}
.search-group-label:first-child { border-top: none; }

.search-result-item {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.3rem 0.75rem;
  font-size: 0.82rem;
  cursor: pointer;
  color: #212529;
}
.search-result-item:hover { background: #edf7dc; }

.search-result-sub {
  font-size: 0.72rem;
  color: #6c757d;
  margin-left: auto;
  white-space: nowrap;
  padding-left: 0.5rem;
}

.search-no-results {
  padding: 1rem 0.75rem;
  font-size: 0.82rem;
  color: #6c757d;
  text-align: center;
}

.context-title strong {
  color: #fff;
  font-weight: 700;
}

.ctx-sep {
  color: rgba(255,255,255,0.55);
  margin: 0 0.15rem;
}

.context-kpis {
  display: flex;
  gap: 0.45rem;
  overflow-x: auto;
  scrollbar-width: none;
}
.context-kpis::-webkit-scrollbar { display: none; }

.kpi-box {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 0.2rem 0.7rem;
  background: rgba(255,255,255,0.18);
  border: 1px solid rgba(255,255,255,0.28);
  border-radius: 6px;
  min-width: 86px;
  flex-shrink: 0;
  transition: background 0.12s;
}
.kpi-box:hover {
  background: rgba(255,255,255,0.26);
}

.kpi-label {
  font-size: 0.59rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: rgba(255,255,255,0.65);
  line-height: 1.5;
}

.kpi-value {
  font-size: 0.9rem;
  font-weight: 700;
  color: #fff;
  line-height: 1.25;
}

/* ── Map area (flex column: map pane on top, countries table below) ── */
.map-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}

/* Map pane — left: Leaflet map; right: year chart */
.map-pane {
  flex: 0 0 55%;
  display: flex;
  flex-direction: row;
  overflow: hidden;
}

/* Left half: contains the map and all drill-down overlays */
.map-half {
  flex: 1;
  position: relative;
  overflow: hidden;
  min-width: 0;
}

#world-map {
  width: 100%;
  height: 100%;
}

/* Right half: year-by-year bar chart — 40% of the map pane width */
.chart-half {
  flex: 0 0 40%;
  display: flex;
  flex-direction: column;
  border-left: 1px solid #dee2e6;
  background: #fff;
  overflow: hidden;
}

#year-chart,
#collab-heatmap {
  flex: 1;
  min-height: 0;
}

/* Collaboration view: full-width toggle, disabled indicators, pairs-table title */
.btn-collab-toggle {
  width: 100%;
  text-align: center;
}

.btn-toggle--disabled {
  opacity: 0.35;
  cursor: not-allowed;
  pointer-events: none;
}

.listing-collab-title {
  font-size: 0.78rem;
  font-weight: 700;
  color: #2b5797;
  padding: 0.15rem 0.25rem;
}

/* Countries data table pane — toolbar fixed, scroll area below */
.table-pane {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-top: 2px solid #dee2e6;
}

.table-pane-toolbar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.75rem;
  background: #f8f9fa;
  border-bottom: 1px solid #dee2e6;
}

/* Tabs + ranking-chart button on the left; filters + export on the right. */
.table-pane-toolbar .toolbar-left {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-right: auto;
}

/* Ranking mode toggle — active state matches the sidebar toggles. */
.rank-chart-toggle.active,
.rank-packages-toggle.active {
  background: #5a8c18;
  border-color: #5a8c18;
  color: #fff;
  font-weight: 600;
}

/* "≥ N docs" quick filter select — compact; tinted while a threshold is active. */
.min-docs-select {
  width: auto;
  font-size: 0.75rem;
  padding: 0.25rem 1.6rem 0.25rem 0.5rem;
}

.min-docs-select.active {
  border-color: #5a8c18;
  color: #3d6614;
  font-weight: 600;
}

/* ── Technical-tie ranking packages ── */

/* First row of each package: separator line so the groups read as blocks. */
.countries-table tr.pkg-first > td {
  border-top: 2px solid #a9d96c;
}

/* Shared-range rank cells ("12–17") need a little more room. */
.col-rank-pkg {
  white-space: nowrap;
  color: #4a7a12;
  font-weight: 600;
}

/* ── Listing tab bar (replaces the old table-pane title + sidebar Show/Thematic controls) ── */
.listing-tabs {
  display: flex;
  gap: 2px;
  align-items: center;
  flex-wrap: wrap;
}

.listing-tab {
  padding: 0.2rem 0.65rem;
  font-size: 0.72rem;
  font-weight: 600;
  border: 1px solid #dee2e6;
  border-radius: 4px;
  background: #fff;
  color: #495057;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.1s, color 0.1s, border-color 0.1s;
}

.listing-tab:hover:not(.active) {
  background: #edf7dc;
  border-color: #a9d96c;
  color: #3d6614;
}

.listing-tab.active {
  background: #74b320;
  border-color: #5a8f18;
  color: #fff;
}

.table-scroll-area {
  flex: 1;
  overflow: auto;
}

.countries-table {
  margin-bottom: 0;
  white-space: nowrap;
  font-size: 0.8rem;
}

.countries-table thead th {
  position: sticky;
  top: 0;
  background: #f8f9fa;
  z-index: 2;
  border-bottom: 2px solid #dee2e6 !important;
  font-size: 0.72rem;
  padding: 0.35rem 0.5rem;
}

.countries-table tbody td {
  padding: 0.25rem 0.5rem;
}

.countries-table .col-active {
  background-color: #edf7dc;
}

.countries-table thead th.col-active {
  background-color: #d0e8a0;
  color: #4a7a12;
}

.countries-table thead th.col-sortable {
  cursor: pointer;
  user-select: none;
}

.countries-table thead th.col-sortable:not(.col-active):hover {
  background: #edf7dc;
  color: #4a7a12;
}

.countries-table .col-rank {
  color: #adb5bd;
  width: 2.5rem;
  text-align: right;
}

/* ── Loading overlay ── */
.loading-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.92);
  z-index: 2000;
}

.loading-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid #dee2e6;
  border-top-color: #74b320;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-bottom: 1rem;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.loading-message {
  color: #6c757d;
  font-size: 0.9rem;
}

/* ── Error overlay ── */
.error-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.95);
  z-index: 2000;
}

.error-content {
  text-align: center;
  padding: 2rem;
  max-width: 400px;
}

.error-content h3 { color: #dc3545; }
.error-content code {
  background: #f8f9fa;
  padding: 0.2em 0.4em;
  border-radius: 4px;
  font-size: 0.85em;
}

/* ── Spain panel ── */
.spain-panel {
  display: flex;
  height: 100%;
}

#spain-map {
  flex: 1;
  height: 100%;
}

.orgs-panel {
  width: 400px;
  border-left: 1px solid #dee2e6;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.orgs-title, .panel-title {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 0.95rem;
  font-weight: 700;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid #e9ecef;
  margin: 0;
}

.orgs-filters {
  padding: 0.5rem 1rem;
  border-bottom: 1px solid #e9ecef;
}

.orgs-table-wrapper, .cities-table-wrapper {
  flex: 1;
  overflow-y: auto;
}

/* ── Cities panel ── */
.cities-panel {
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.cities-table-wrapper {
  padding: 0 1rem;
}

/* ── Leaf selection (terminal node in the exploration tree) ── */
.leaf-back-row td {
  cursor: pointer;
  color: #4a7a12;
  font-size: 0.72rem;
  padding: 0.3rem 0.5rem !important;
  border-bottom: 1px solid #dee2e6;
}
.leaf-back-row:hover td { background: #edf7dc; }

.row-leaf-selected td {
  background-color: #fffbeb !important;
  border-top: 2px solid #f59e0b;
  border-bottom: 2px solid #f59e0b;
}

/* Sortable table header */
th[data-sortable] {
  cursor: pointer;
  user-select: none;
}

th[data-sortable]:hover { background: #f8f9fa; }
