:root {
  --bg: #f4f6f8;
  --panel: #ffffff;
  --text: #1a1f36;
  --muted: #5c667a;
  --accent: #1e5a8a;
  --border: #d8dee9;
  --header-bg: #0f2940;
  --header-text: #f7fafc;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.site-header {
  background: var(--header-bg);
  color: var(--header-text);
  padding: 0.85rem 1.25rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.site-header h1 {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 600;
}

.subtitle {
  margin: 0.15rem 0 0;
  font-size: 0.82rem;
  opacity: 0.85;
}

.site-nav a {
  color: #c5dff5;
  text-decoration: none;
  margin-left: 1rem;
  font-size: 0.88rem;
}

.site-nav a:hover { text-decoration: underline; }

.site-nav .nav-tab {
  padding: 0.35rem 0.65rem;
  border-radius: 4px;
  border: 1px solid transparent;
}

.site-nav .nav-tab.active {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.25);
  color: #ffffff;
  font-weight: 600;
  text-decoration: none;
}

.page-main {
  flex: 1;
  max-width: 1100px;
  width: 100%;
  margin: 0 auto;
  padding: 1rem 1.25rem 1.5rem;
}

.page-intro h2 {
  margin: 0 0 0.5rem;
  font-size: 1.1rem;
  color: var(--accent);
}

.team-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 0.75rem;
}

.team-card h3 {
  margin: 0 0 0.25rem;
  font-size: 1rem;
  color: var(--text);
}

.team-role {
  margin: 0 0 0.65rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--accent);
}

.team-bio {
  margin: 0;
  font-size: 0.84rem;
  line-height: 1.5;
  color: var(--muted);
}

.team-links {
  margin: 0.65rem 0 0;
  font-size: 0.84rem;
}

.team-links a { color: var(--accent); }

.team-more {
  margin-top: 1rem;
  text-align: center;
}

.layout {
  flex: 1;
  display: grid;
  grid-template-columns: 320px 1fr;
  min-height: calc(100vh - 110px);
}

.sidebar {
  background: var(--panel);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  padding: 0.75rem;
}

.panel {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.85rem;
  margin-bottom: 0.75rem;
}

.panel h2, .panel h3 {
  margin: 0 0 0.65rem;
  font-size: 0.95rem;
  color: var(--accent);
}

.panel label {
  display: block;
  font-size: 0.82rem;
  color: var(--muted);
  margin-bottom: 0.35rem;
}

.date-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.date-row select,
#pollutant-select {
  width: 100%;
  padding: 0.45rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 0.9rem;
  margin-bottom: 0.75rem;
}

.date-range {
  font-size: 0.82rem;
  color: var(--muted);
  margin: 0 0 0.65rem;
}

#date-select {
  width: 100%;
  padding: 0.45rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 0.9rem;
  margin-bottom: 0.75rem;
}

.meta-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.meta-grid .label {
  display: block;
  font-size: 0.72rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.meta-grid .value {
  font-size: 0.95rem;
  font-weight: 600;
}

.stats-box {
  font-size: 0.82rem;
  line-height: 1.5;
  color: var(--muted);
}

.hint, .about-text, .data-access {
  font-size: 0.78rem;
  line-height: 1.45;
  color: var(--muted);
  margin: 0.5rem 0 0;
}

.data-access a {
  color: var(--accent, #1a6fb0);
  font-weight: 600;
}

.about-text a { color: var(--accent); }

.legend-bar {
  height: 14px;
  border-radius: 3px;
  border: 1px solid var(--border);
  background: linear-gradient(to right, #440154, #31688e, #35b779, #fde725);
}

.legend-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.78rem;
  color: var(--muted);
  margin-top: 0.25rem;
}

.map {
  min-height: 480px;
  height: 70vh;
  width: 100%;
  background: #e8eef3;
}

.site-footer {
  background: var(--panel);
  border-top: 1px solid var(--border);
  padding: 0.5rem 1rem;
  font-size: 0.78rem;
  color: var(--muted);
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
}

@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { max-height: none; }
  .map { min-height: 55vh; }
}

.leaflet-popup.district-popup-wrap .leaflet-popup-content {
  margin: 10px 14px;
  font-size: 0.88rem;
  line-height: 1.5;
}

.district-popup-value {
  font-weight: 600;
  color: var(--text, #1a1a1a);
}
