* { box-sizing: border-box; }
body {
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 14px;
  line-height: 1.4;
  color: #1a1a1a;
  overflow: hidden;
}

.map {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: #e8e8e8;
  z-index: 0;
}

.overlay {
  position: fixed;
  z-index: 1000;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(8px);
  border-radius: 8px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.15);
}

.overlay-title {
  top: 12px;
  left: 12px;
  padding: 0.4rem 0.75rem;
}
.overlay-title .title {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 600;
}

.overlay-slider {
  top: 48px;
  left: 12px;
  padding: 0.6rem 0.85rem;
  min-width: 200px;
}
.overlay-slider label {
  display: block;
  margin-bottom: 0.35rem;
  font-size: 0.8rem;
  color: #444;
}
#poverty-slider {
  width: 100%;
  max-width: 180px;
  display: block;
}

.overlay-totals {
  top: 12px;
  right: 12px;
  padding: 0.6rem 0.9rem;
  max-width: 220px;
  max-height: 60vh;
  overflow-y: auto;
}
.totals-title {
  margin: 0 0 0.4rem;
  font-size: 0.85rem;
  font-weight: 600;
}
#totals-list {
  margin: 0;
  padding-left: 1.1rem;
  font-size: 0.8rem;
}
#totals-list li { margin-bottom: 0.2rem; }

.overlay-download-csv {
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  padding: 0.6rem 1.25rem;
  font-size: 1rem;
  font-weight: 600;
  color: #fff;
  background: #1a1a1a;
  border: none;
  cursor: pointer;
  border-radius: 8px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.2);
}
.overlay-download-csv:hover {
  background: #333;
}

.overlay-settings {
  bottom: 12px;
  left: 12px;
  padding: 0.35rem 0.5rem;
  font-size: 0.75rem;
  color: #555;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(0, 0, 0, 0.1);
  cursor: pointer;
  border-radius: 6px;
}
.overlay-settings:hover {
  color: #06c;
  background: #fff;
}

.overlay-sheet-config {
  bottom: 44px;
  left: 12px;
  padding: 0.75rem 1rem;
  max-width: 320px;
}
.sheet-config {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.3rem 0.6rem;
  align-items: center;
}
.sheet-config label { font-size: 0.75rem; color: #555; }
.sheet-config input[type="text"],
.sheet-config input[type="password"] {
  padding: 0.35rem 0.5rem;
  font-size: 0.8rem;
  border: 1px solid #ccc;
  border-radius: 4px;
}
.sheet-config button {
  grid-column: span 2;
  margin-top: 0.25rem;
  padding: 0.4rem 0.6rem;
  font-size: 0.8rem;
  background: #1a1a1a;
  color: #fff;
  border: none;
  border-radius: 4px;
  cursor: pointer;
}
.sheet-config button:hover:not(:disabled) { background: #333; }
.sheet-config button:disabled { opacity: 0.6; }
.hint-header {
  margin: 0.5rem 0 0;
  font-size: 0.7rem;
  color: #666;
}
.hint-header a { color: #06c; }

.map-legend {
  padding: 0.5rem 0.75rem;
  font-size: 0.78rem;
  line-height: 1.45;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(6px);
  border-radius: 6px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.12);
}
.map-legend strong { display: block; margin-bottom: 0.25rem; }
.map-legend-item {
  display: block;
  margin: 0.12rem 0;
}
.map-legend-item i {
  display: inline-block;
  width: 11px;
  height: 11px;
  margin-right: 5px;
  vertical-align: middle;
  border: 1px solid #333;
  border-radius: 1px;
}

@media (max-width: 500px) {
  .overlay-slider { min-width: 160px; }
  .overlay-totals { max-width: 180px; font-size: 0.75rem; }
  .sheet-config { grid-template-columns: 1fr; }
}
