* { box-sizing: border-box; margin: 0; padding: 0; }

body { font-family: sans-serif; }

#map { width: 100vw; height: 100vh; }

/* Modal overlay */
#modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}
#modal-overlay.open { display: flex; }

#modal {
  background: #fff;
  border-radius: 6px;
  width: min(480px, 92vw);
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 8px 32px rgba(0,0,0,0.3);
}

#modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid #e0e0e0;
  flex-shrink: 0;
}

#modal-title { font-size: 1.1rem; font-weight: 600; }

#modal-close {
  background: none;
  border: none;
  font-size: 1.4rem;
  cursor: pointer;
  color: #666;
  line-height: 1;
}
#modal-close:hover { color: #000; }

#modal-body {
  overflow-y: auto;
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Pie chart section */
#chart-section {
  display: flex;
  gap: 24px;
}

.chart-block {
  flex: 1;
  min-width: 0;
}

.chart-block h3 {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #555;
  margin-bottom: 10px;
}

.chart-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.pie-canvas-wrap {
  width: 150px;
  height: 150px;
  flex-shrink: 0;
}

.chart-legend {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.78rem;
}

.legend-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.legend-swatch {
  width: 10px;
  height: 10px;
  border-radius: 2px;
  flex-shrink: 0;
}

.legend-label { flex: 1; color: #333; }

.legend-pct { color: #666; font-variant-numeric: tabular-nums; }

/* Municipality detail section */
#detail-section h2 {
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 14px;
}

#detail-section h2 a {
  color: #1a1a1a;
  text-decoration: none;
}

#detail-section h2 a:hover { text-decoration: underline; }

.detail-mail-domain {
  font-size: 0.82rem;
  color: #666;
  margin: 4px 0 10px;
}

.metadata-list {
  list-style: disc;
  margin: 6px 0 12px;
  padding-left: 18px;
}
.metadata-list li {
  font-size: 0.8rem;
  color: #555;
  margin-bottom: 2px;
}
.metadata-list li strong {
  color: #333;
}

.detail-question {
  font-size: 0.82rem;
  font-weight: 600;
  color: #444;
  margin: 12px 0 6px;
}

.dns-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.dns-list li {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-size: 0.82rem;
  color: #222;
}

.dns-host {
  color: #555;
  font-family: monospace;
  font-size: 0.78rem;
  word-break: break-all;
}

.tier-badge {
  font-size: 0.68rem;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 10px;
  white-space: nowrap;
  flex-shrink: 0;
}

.tier-hyperscaler { background: #fde8e8; color: #c0392b; }
.tier-eu          { background: #e8f0fe; color: #1a5cb8; }
.tier-domestic    { background: #e8fdf0; color: #1a7a3f; }
.tier-us          { background: #fff3e8; color: #b35e00; }
.tier-other       { background: #f0f0f0; color: #555;    }

.no-records { font-size: 0.82rem; color: #999; font-style: italic; }

/* Map legend */
.map-legend {
  background: rgba(255,255,255,0.92);
  border-radius: 6px;
  padding: 10px 13px;
  box-shadow: 0 1px 5px rgba(0,0,0,0.25);
  font-size: 0.78rem;
  line-height: 1.5;
}
.map-legend h4 {
  margin: 0 0 7px;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #444;
}
.map-legend .legend-row {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 4px;
}
.map-legend .dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 1.5px solid #fff;
  box-shadow: 0 0 0 1px rgba(0,0,0,0.2);
  flex-shrink: 0;
}

/* Dataset picker (top-right) */
.dataset-picker {
  background: rgba(255,255,255,0.92);
  border-radius: 6px;
  padding: 6px 10px;
  box-shadow: 0 1px 5px rgba(0,0,0,0.25);
}
.dataset-picker select {
  font-size: 0.82rem;
  border: none;
  background: transparent;
  cursor: pointer;
  outline: none;
  min-width: 180px;
}

/* BeLibre logo */
.map-logo {
  background: rgba(255,255,255,0.92);
  border-radius: 6px;
  padding: 6px 10px;
  box-shadow: 0 1px 5px rgba(0,0,0,0.25);
}
.map-logo img {
  display: block;
  height: 36px;
  width: auto;
}

/* Charts panel (permanent, bottom-right above legend) */
.charts-panel {
  background: rgba(255,255,255,0.92);
  border-radius: 6px;
  padding: 10px 13px;
  box-shadow: 0 1px 5px rgba(0,0,0,0.25);
}
.charts-panel h4 {
  margin: 0 0 8px;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #444;
}
.charts-row {
  display: flex;
  gap: 20px;
}
.pie-canvas-wrap canvas { cursor: pointer; }
.chart-legend .legend-row {
  cursor: pointer;
  border-radius: 3px;
  padding: 2px 4px;
  margin: 0 -4px;
  transition: background 0.15s;
}
.chart-legend .legend-row:hover    { background: rgba(0,0,0,0.06); }
.chart-legend .legend-row.active   { background: rgba(0,0,0,0.10); font-weight: 600; }
