

/* 0. LANDING SCREEN */
#landing {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  transition: opacity 700ms ease, visibility 700ms ease;
}

#landing.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.landing-bg {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at 50% 35%, rgba(255,255,255,.18) 0%, transparent 55%),
    linear-gradient(160deg, #00a3a6 0%, #007d80 55%, #004f52 100%);
}

.landing-bg::before,
.landing-bg::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(135deg, rgba(255,255,255,.06) 25%, transparent 25%),
    linear-gradient(225deg, rgba(255,255,255,.06) 25%, transparent 25%),
    linear-gradient(315deg, rgba(255,255,255,.06) 25%, transparent 25%),
    linear-gradient(45deg,  rgba(255,255,255,.06) 25%, transparent 25%);
  background-size: 24px 24px;
  opacity: .8;
}

.landing-content {
  position: relative;
  text-align: center;
  color: white;
  padding: 0 1.5rem;
  animation: landingFadeIn 900ms ease both;
}

@keyframes landingFadeIn {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

.landing-drop {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 130px;
  height: 165px;
  margin-bottom: 2rem;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0;
  outline: none;
  transition: transform 220ms cubic-bezier(.4,0,.2,1);
}

.landing-drop svg {
  position: relative;
  z-index: 2;
  width: 100%;
  height: 100%;
  filter: drop-shadow(0 8px 22px rgba(0,0,0,.25));
  animation: dropFloat 3.2s ease-in-out infinite;
}

.landing-drop:hover svg {
  animation-duration: 1.6s;
}

.landing-drop:hover {
  transform: scale(1.05);
}

.landing-drop:active svg {
  transform: scale(0.94);
  transition: transform 120ms ease;
}

@keyframes dropFloat {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50%      { transform: translateY(-10px) rotate(-2deg); }
}

/* Ripples emanating from the drop */
.ripple {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 130px;
  height: 130px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,.5);
  transform: translate(-50%, -50%) scale(0.6);
  opacity: 0;
  z-index: 1;
  pointer-events: none;
  animation: ripple 2.8s ease-out infinite;
}

.ripple-2 { animation-delay: 0.9s; }
.ripple-3 { animation-delay: 1.8s; }

@keyframes ripple {
  0%   { transform: translate(-50%, -50%) scale(0.6); opacity: .7; border-width: 2px; }
  100% { transform: translate(-50%, -50%) scale(2.4); opacity: 0;  border-width: 0.5px; }
}

.landing-title {
  font-family: var(--font-display);
  font-size: clamp(2.5rem, 6vw, 3.8rem);
  font-weight: 700;
  letter-spacing: -.02em;
  line-height: 1;
  color: white;
  text-shadow: 0 3px 16px rgba(0,0,0,.18);
}

.landing-title span {
  font-style: italic;
  font-weight: 600;
  opacity: .85;
}

.landing-sub {
  margin-top: .65rem;
  font-size: clamp(.85rem, 1.5vw, 1rem);
  font-weight: 300;
  color: rgba(255,255,255,.82);
  letter-spacing: .04em;
}

.landing-hint {
  margin-top: 2rem;
  font-size: .68rem;
  letter-spacing: .15em;
  text-transform: uppercase;
  color: rgba(255,255,255,.6);
  animation: hintPulse 2s ease-in-out infinite;
}

@keyframes hintPulse {
  0%, 100% { opacity: .5; }
  50%      { opacity: .95; }
}

.landing-drop:focus-visible {
  outline: 2px solid white;
  outline-offset: 8px;
  border-radius: 50%;
}

/* 1. TOKENS */
:root {
  --brand:        #00a3a6;
  --brand-dark:   #007d80;
  --brand-light:  #e0f5f5;
  --brand-mid:    #b3e8e9;

  --ink:          #1a2630;
  --ink-2:        #3d5260;
  --ink-3:        #7a95a0;
  --ink-4:        #b0c4cb;

  --bg:           #f5f8f8;
  --surface:      #ffffff;
  --surface-2:    #f0f6f6;

  --border:       #dce8ea;
  --border-mid:   #c5d8db;

  --agri:         #00a3a6;
  --industry:     #e07b39;
  --municipal:    #5b8fbd;

  --font-display: 'Playfair Display', Georgia, serif;
  --font-body:    'Plus Jakarta Sans', system-ui, sans-serif;
  --font-mono:    'JetBrains Mono', 'Courier New', monospace;

  --radius:       10px;
  --radius-lg:    16px;
  --shadow:       0 2px 12px rgba(0,100,110,0.08), 0 1px 3px rgba(0,100,110,0.06);
  --shadow-hover: 0 6px 24px rgba(0,100,110,0.14), 0 2px 6px rgba(0,100,110,0.08);
  --transition:   180ms cubic-bezier(.4,0,.2,1);

  --header-h:     72px;
  --status-h:     30px;
  --sidebar-w:    310px;
}

/*  2. RESET & BASE  */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { height: 100%; font-size: 15px; }

body {
  height: 100%;
  font-family: var(--font-body);
  font-weight: 400;
  background: var(--bg);
  color: var(--ink);
  display: grid;
  grid-template-rows: var(--header-h) 1fr var(--status-h);
  overflow: hidden;
}


.mono { font-family: var(--font-mono); }

/*  3. HEADER  */
header {
  background: var(--brand);

  background-image:
    linear-gradient(135deg, rgba(255,255,255,.07) 25%, transparent 25%),
    linear-gradient(225deg, rgba(255,255,255,.07) 25%, transparent 25%),
    linear-gradient(315deg, rgba(255,255,255,.07) 25%, transparent 25%),
    linear-gradient(45deg,  rgba(255,255,255,.07) 25%, transparent 25%);
  background-size: 24px 24px;
  box-shadow: 0 2px 16px rgba(0,120,130,.20);
  z-index: 50;
}

.header-inner {
  height: 100%;
  max-width: 1600px;
  margin: 0 auto;
  padding: 0 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
}

/* Brand */
.header-brand {
  display: flex;
  align-items: center;
  gap: .85rem;
  flex-shrink: 0;
}

.logo-mark {
  width: 34px;
  height: 42px;
  background: rgba(255,255,255,.18);
  border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 5px 7px;
  box-shadow: 0 2px 8px rgba(0,0,0,.15), inset 0 1px 0 rgba(255,255,255,.3);
  animation: float 3s ease-in-out infinite;
}

.logo-mark svg { width: 100%; height: 100%; }

@keyframes float {
  0%,100% { transform: translateY(0); }
  50%      { transform: translateY(-3px); }
}

.brand-text h1 {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 700;
  color: white;
  letter-spacing: -.01em;
  line-height: 1;
}

.brand-text h1 span {

  font-style: italic;
  font-weight: 600;
  opacity: .85;
}

.header-sub {
  font-size: .68rem;
  font-weight: 400;
  color: rgba(255,255,255,.65);
  letter-spacing: .03em;
  margin-top: 2px;
}


.header-controls {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex: 1;
  justify-content: flex-end;
}

.control-label {
  font-size: .65rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: rgba(255,255,255,.7);
  flex-shrink: 0;
}

.slider-wrapper {
  display: flex;
  align-items: center;
  gap: .6rem;
}

.year-bound {
  font-size: .65rem;
  color: rgba(255,255,255,.55);
  letter-spacing: .04em;
}

.slider-track-wrap {
  width: 200px;
}


input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 4px;
  border-radius: 2px;
  background: rgba(255,255,255,.25);
  outline: none;
  cursor: pointer;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: white;
  border: 3px solid var(--brand-dark);
  box-shadow: 0 2px 8px rgba(0,0,0,.25);
  cursor: pointer;
  transition: transform var(--transition), box-shadow var(--transition);
}

input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.15);
  box-shadow: 0 3px 14px rgba(0,0,0,.30);
}

input[type="range"]::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: white;
  border: 3px solid var(--brand-dark);
  cursor: pointer;
}

input[type="range"]::-moz-range-progress {
  background: rgba(255,255,255,.7);
  height: 4px;
  border-radius: 2px;
}


.year-display {
  font-size: 1.75rem;
  font-weight: 600;
  color: white;
  letter-spacing: -.02em;
  min-width: 58px;
  text-align: right;
  text-shadow: 0 2px 12px rgba(0,0,0,.15);
  transition: opacity var(--transition);
}

/*  4. DASHBOARD LAYOUT ─ */
#dashboard {
  display: grid;
  grid-template-columns: 1fr 6px var(--sidebar-w);
  gap: 0;
  overflow: hidden;
  background: var(--bg);
}

/* Resizer between map and side panel */
.resizer {
  position: relative;
  background: var(--border);
  cursor: col-resize;
  user-select: none;
  transition: background var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
}

.resizer:hover,
.resizer.dragging {
  background: var(--brand);
}

.resizer-grip {
  width: 2px;
  height: 36px;
  border-radius: 2px;
  background: var(--ink-4);
  opacity: 0;
  transition: opacity var(--transition);
}

.resizer:hover .resizer-grip,
.resizer.dragging .resizer-grip {
  opacity: 0.85;
  background: white;
}

/*  5. SHARED PANEL STYLES  */
.panel-tag {
  display: inline-block;
  font-size: .62rem;
  letter-spacing: .10em;
  text-transform: uppercase;
  color: var(--brand);
  margin-bottom: .25rem;
}

.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.1rem 1.4rem .85rem;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.panel-head h2 {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.2;
}

.panel-hint {
  padding: .7rem 1.4rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .35rem .9rem;
  font-size: .78rem;
  font-weight: 500;
  color: var(--ink-2);
  border-top: 1px solid var(--border);
  background: linear-gradient(to right, var(--brand-light) 0%, var(--surface) 70%);
}

.hint-item {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
}

.hint-plus {
  font-family: var(--font-mono);
  font-size: .7rem;
  color: var(--ink-3);
}

.hint-sep {
  color: var(--ink-4);
  margin: 0 .15rem;
}

.kbd {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: .68rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 5px;
  background: white;
  color: var(--brand-dark);
  border: 1px solid var(--border-mid);
  box-shadow: 0 1px 0 var(--border-mid), inset 0 -1px 0 rgba(0,0,0,.04);
  letter-spacing: .02em;
  line-height: 1.2;
}


#map-container {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-right: 1px solid var(--border);
  overflow: hidden;
}

#map-viz {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
  background: var(--surface);
}

#map-viz svg {
  width: 100%;
  height: 100%;
  display: block;
  cursor: grab;
}

#map-viz svg:active {
  cursor: grabbing;
}


.map-placeholder {
  text-align: center;
  font-family: var(--font-mono);
  font-size: .72rem;
  color: var(--ink-4);
  letter-spacing: .04em;
  padding: 2rem;
}

/* Map legend */
.legend-wrap {
  display: flex;
  align-items: center;
  gap: .4rem;
  font-size: .60rem;
  font-family: var(--font-mono);
  color: var(--ink-3);
}


.country {
  stroke: var(--border);
  stroke-width: .5px;
  cursor: pointer;
  transition: stroke var(--transition), stroke-width var(--transition), filter var(--transition);
}

.country:hover {
  stroke: var(--brand);
  stroke-width: 1.5px;
  filter: brightness(0.88);
}

.country.selected {
  stroke: var(--brand-dark);
  stroke-width: 2px;
}

.country--nodata { fill: #e8eeef; }

/* 6. TOOLTIP */
.tooltip {
  position: fixed;
  background: var(--surface);
  border: 1px solid var(--border-mid);
  border-radius: var(--radius);
  padding: .6rem .9rem;
  pointer-events: none;
  font-family: var(--font-body);
  font-size: .72rem;
  color: var(--ink);
  box-shadow: var(--shadow-hover);
  z-index: 9999;
  opacity: 0;
  transition: opacity 120ms ease;
  max-width: 180px;
}

.tooltip.visible { opacity: 1; }

.tooltip-name {
  font-family: var(--font-display);
  font-size: .88rem;
  font-weight: 600;
  color: var(--ink);
  display: block;
  margin-bottom: 3px;
}

.tooltip-value {
  font-family: var(--font-mono);
  font-size: .66rem;
  color: var(--brand-dark);
}

/*  7. SIDE PANEL  */
#side-panel {
  background: var(--surface);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--border-mid) transparent;
}

#side-panel::-webkit-scrollbar       { width: 4px; }
#side-panel::-webkit-scrollbar-thumb { background: var(--border-mid); border-radius: 2px; }

.side-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: .75rem;
  padding: 1.1rem 1.2rem .85rem;
  border-bottom: 1px solid var(--border);
}

.side-head h2 {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.25;
}

.btn-clear {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  flex-shrink: 0;
  border-radius: 50%;
  border: 1px solid var(--border-mid);
  background: var(--surface);
  color: var(--ink-3);
  cursor: pointer;
  transition: background var(--transition), color var(--transition), border-color var(--transition);
  margin-top: 4px;
}

.btn-clear svg { width: 10px; height: 10px; }

.btn-clear:hover {
  background: #ffeaea;
  color: #c0392b;
  border-color: #f5b7b1;
}

/* KPI strip */
.kpi-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border-bottom: 1px solid var(--border);
}

.kpi {
  display: flex;
  flex-direction: column;
  padding: .85rem .8rem;
  gap: 2px;
  border-right: 1px solid var(--border);
  transition: background var(--transition);
}

.kpi:last-child { border-right: none; }

.kpi:hover { background: var(--surface-2); }

.kpi--accent .kpi-value { color: var(--brand); }

.kpi-label {
  font-size: .58rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.kpi-value {
  font-family: var(--font-mono);
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--ink);
  line-height: 1;
}


.kpi-value--text {
  font-family: var(--font-body);
  font-size: .95rem;
  font-weight: 600;
  color: var(--brand-dark);
  letter-spacing: -.01em;
}

.kpi-unit {
  font-size: .60rem;
  letter-spacing: .04em;
  color: var(--ink-4);
}

/* Chart boxes */
.chart-box {
  border-bottom: 1px solid var(--border);
  padding: 1rem 1.2rem;
  display: flex;
  flex-direction: column;
  gap: .65rem;
}

.chart-box-head {
  display: flex;
  align-items: flex-start;
  gap: .65rem;
}

.chart-index {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 5px;
  background: var(--brand-light);
  color: var(--brand-dark);
  font-size: .62rem;
  font-weight: 600;
  flex-shrink: 0;
  margin-top: 1px;
}

.chart-box h3 {
  font-family: var(--font-body);
  font-size: .82rem;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.2;
}

.chart-sub {
  font-size: .64rem;
  color: var(--ink-3);
  margin-top: 1px;
}

/* Chart SVG containers */
#doughnut-chart {
  min-height: 195px;
  background: var(--surface-2);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
}

#bar-chart {
  min-height: 175px;
  background: var(--surface-2);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
}

#doughnut-chart svg,
#bar-chart svg {
  width: 100%;
  height: 100%;
  display: block;
}


.chart-placeholder {
  font-family: var(--font-mono);
  font-size: .65rem;
  color: var(--ink-4);
  letter-spacing: .04em;
  text-align: center;
  padding: 1rem;
}

/* D3 axis styles */
.axis path,
.axis line {
  stroke: var(--border-mid);
}

.axis text {
  font-family: var(--font-mono);
  font-size: 8px;
  fill: var(--ink-3);
}


.bar {
  fill: var(--brand);
  opacity: .65;
  rx: 2px;
  transition: opacity var(--transition), fill var(--transition);
}

.bar.current-year {
  fill: var(--brand);
  opacity: 1;
}

.bar:hover { opacity: 1; }

.arc-agri      { fill: var(--agri); }
.arc-industry  { fill: var(--industry); }
.arc-municipal { fill: var(--municipal); }

.source-note {
  padding: .75rem 1.2rem;
  font-size: .62rem;
  color: var(--ink-4);
  letter-spacing: .02em;
  font-style: italic;
  margin-top: auto;
}

/*  8. STATUS BAR  */
#statusbar {
  display: flex;
  align-items: center;
  gap: .65rem;
  padding: 0 1.5rem;
  background: var(--surface);
  border-top: 1px solid var(--border);
  font-size: .60rem;
  color: var(--ink-3);
  letter-spacing: .05em;
}

.statusbar-right { margin-left: auto; color: var(--ink-4); }

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
  background: var(--ink-4);
}

.status-dot.ok      { background: var(--brand); box-shadow: 0 0 6px rgba(0,163,166,.5); }
.status-dot.loading { background: #f0a500; box-shadow: 0 0 6px rgba(240,165,0,.5); animation: blink 1.2s ease-in-out infinite; }
.status-dot.error   { background: #e05050; }

@keyframes blink {
  0%,100% { opacity: 1; }
  50%      { opacity: .35; }
}

/*  9. ANIMATIONS  */
#map-container { animation: fadeUp .45s ease both; }
#side-panel    { animation: fadeUp .45s .08s ease both; }

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/*  10. RESPONSIVE ─ */
@media (max-width: 900px) {
  :root { --sidebar-w: 260px; }
  .slider-track-wrap { width: 140px; }
  .header-sub { display: none; }
}

@media (max-width: 680px) {
  body { overflow: auto; }
  #dashboard {
    grid-template-columns: 1fr;
    grid-template-rows: 360px auto;
  }
  #map-container { border-right: none; border-bottom: 1px solid var(--border); }
  .resizer { display: none; }
  .slider-track-wrap { width: 100px; }
  .header-controls { gap: .6rem; }
}

/*  11. FOCUS  */
:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 3px;
  border-radius: 4px;
}

/*  12. LEGEND & TOOLTIP EXTRAS  */
.donut-legend {
  display: flex;
  justify-content: center;
  gap: 1rem;
  flex-wrap: wrap;
  padding: .2rem 0 0;
  font-size: .65rem;
  font-family: var(--font-mono);
  color: var(--ink-3);
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 5px;
}

.legend-item i {
  width: 8px;
  height: 8px;
  border-radius: 2px;
  display: inline-block;
  opacity: .85;
  flex-shrink: 0;
}

.tooltip-source {
  display: block;
  font-size: .58rem;
  color: var(--ink-4);
  font-style: italic;
  margin-top: 3px;
  letter-spacing: .01em;
}

/*  13. ANIMATION — PLAY BUTTON & FORECAST  */
.btn-play {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,.6);
  background: rgba(255,255,255,.15);
  color: white;
  cursor: pointer;
  flex-shrink: 0;
  transition: background var(--transition), border-color var(--transition), transform var(--transition);
}

.btn-play:hover {
  background: rgba(255,255,255,.28);
  border-color: white;
  transform: scale(1.08);
}

.btn-play svg { width: 12px; height: 12px; }

.btn-play.playing {
  background: rgba(255,255,255,.25);
  border-color: white;
}

.year-predicted {
  color: rgba(255,255,255,.5);
  font-style: italic;
}

.bar.predicted {
  fill: var(--brand);
  opacity: .35;
  stroke: var(--brand);
  stroke-width: 1px;
  stroke-dasharray: 3 2;
}

/*  14. COMPARE PANEL  */
#compare-panel {
  background: var(--surface);
  display: none;
  flex-direction: column;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--border-mid) transparent;
}

.cmp-names {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .75rem;
  padding: .75rem 1.2rem;
  border-bottom: 1px solid var(--border);
}

.cmp-tag {
  font-size: .75rem;
  font-weight: 600;
  padding: .25rem .65rem;
  border-radius: 20px;
  letter-spacing: .03em;
}

.cmp-tag--a {
  background: var(--brand-light);
  color: var(--brand-dark);
}

.cmp-tag--b {
  background: #fdeee5;
  color: #b05a20;
}

.cmp-vs {
  font-size: .65rem;
  color: var(--ink-4);
  letter-spacing: .08em;
}

/* ---- COMPARE: rows with delta ---- */
.cmp-head-actions {
  display: flex;
  gap: .35rem;
  align-items: center;
}

.btn-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  flex-shrink: 0;
  border-radius: 50%;
  border: 1px solid var(--border-mid);
  background: var(--surface);
  color: var(--ink-3);
  cursor: pointer;
  transition: background var(--transition), color var(--transition), border-color var(--transition);
  margin-top: 4px;
}

.btn-icon svg { width: 12px; height: 12px; }

.btn-icon:hover {
  background: var(--brand-light);
  color: var(--brand-dark);
  border-color: var(--brand);
}

.cmp-kpi-rows {
  display: flex;
  flex-direction: column;
  padding: .65rem 1.1rem;
  gap: .55rem;
  border-bottom: 1px solid var(--border);
}

.cmp-row {
  display: flex;
  flex-direction: column;
  gap: .15rem;
}

.cmp-row-label {
  font-size: .58rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.cmp-row-label small {
  font-size: .9em;
  color: var(--ink-4);
  text-transform: none;
  letter-spacing: 0;
}

.cmp-row-values {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: .5rem;
}

.cmp-val {
  font-family: var(--font-mono);
  font-size: 1rem;
  font-weight: 600;
  line-height: 1;
}

.cmp-val--a { color: var(--brand-dark); text-align: left;  }
.cmp-val--b { color: #b05a20;           text-align: right; }

.cmp-val--text {
  font-family: var(--font-body);
  font-size: .85rem;
}

.cmp-delta {
  font-family: var(--font-mono);
  font-size: .7rem;
  font-weight: 600;
  color: var(--ink-3);
  text-align: center;
  white-space: nowrap;
  background: var(--surface-2);
  padding: 2px 6px;
  border-radius: 4px;
  min-width: 46px;
}

.cmp-delta--up   { color: var(--brand-dark); background: var(--brand-light); }
.cmp-delta--down { color: #b05a20;           background: #fdeee5; }
.cmp-delta--neutral { color: var(--ink-4); background: transparent; }

/* ---- COMPARE: donuts side by side ---- */
.cmp-donuts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .65rem;
  margin-top: .25rem;
}

.cmp-donut-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .4rem;
}

.cmp-mini-tag {
  font-size: .65rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 12px;
  letter-spacing: .02em;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cmp-mini-tag--a {
  background: var(--brand-light);
  color: var(--brand-dark);
}

.cmp-mini-tag--b {
  background: #fdeee5;
  color: #b05a20;
}

.cmp-donut {
  width: 100%;
  min-height: 125px;
  background: var(--surface-2);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  overflow: hidden;
}

.cmp-legend {
  display: flex;
  gap: 1rem;
  justify-content: center;
  font-size: .65rem;
  font-family: var(--font-mono);
  color: var(--ink-3);
}

.cmp-bars-wrap {
  min-height: 175px;
  background: var(--surface-2);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  overflow: hidden;
}

.country.selected2 {
  stroke: #e07b39 !important;
  stroke-width: 2px !important;
}


/* ---- HISTORICAL EVENTS CARDS ---- */
.chart-index--event {
  background: #fdeee5;
  color: #b05a20;
}

.events-list {
  display: flex;
  flex-direction: column;
  gap: .45rem;
}

.event-card {
  display: flex;
  align-items: flex-start;
  gap: .65rem;
  padding: .55rem .7rem;
  background: linear-gradient(to right, #fdeee5 0%, var(--surface) 100%);
  border-left: 3px solid #e07b39;
  border-radius: 6px;
  transition: transform var(--transition), box-shadow var(--transition);
  cursor: default;
}

.event-card:hover {
  transform: translateX(2px);
  box-shadow: var(--shadow);
}

.event-year {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: .72rem;
  color: #b05a20;
  background: white;
  padding: 3px 7px;
  border-radius: 4px;
  flex-shrink: 0;
  border: 1px solid #f5d3bb;
  min-width: 42px;
  text-align: center;
}

.event-body {
  flex: 1;
  min-width: 0;
}

.event-label {
  font-size: .72rem;
  color: var(--ink);
  line-height: 1.35;
  font-weight: 500;
}

.event-source {
  display: block;
  font-size: .55rem;
  color: var(--ink-4);
  font-style: italic;
  margin-top: 3px;
  letter-spacing: .01em;
}

.events-empty {
  font-size: .7rem;
  color: var(--ink-4);
  font-style: italic;
  text-align: center;
  padding: 1rem .5rem;
  background: var(--surface-2);
  border-radius: 6px;
}

/* ---- BAR-CHART LEGEND ---- */
.bar-legend {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: .85rem;
  padding-top: .2rem;
  font-size: .62rem;
  font-family: var(--font-mono);
  color: var(--ink-3);
}

.bar-legend .legend-item i {
  width: 10px;
  height: 8px;
  border-radius: 2px;
}

/* ---- EVENT MARKER ON BAR CHART ---- */
.event-pin-line {
  stroke: #e07b39;
  stroke-width: 1.4;
  stroke-dasharray: 4 3;
  opacity: 0.85;
}

.event-pin-dot {
  fill: #e07b39;
  cursor: pointer;
  transition: r var(--transition);
}

.event-pin-dot:hover { r: 7; }