* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  color: #1d1d1f;
  background: #fafafa;
}

header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 1rem;
  background: #2a2f3e;
  color: #f0f0f0;
  height: 48px;
  flex-shrink: 0;
}
header h1 { font-size: 1rem; font-weight: 600; margin: 0; }
.status { font-size: 0.85rem; opacity: 0.85; }
.status.error { color: #ffb4a9; }

main {
  display: flex;
  height: calc(100vh - 48px);
}

#sidebar {
  width: 280px;
  flex-shrink: 0;
  background: #f5f5f7;
  padding: 1rem;
  overflow-y: auto;
  border-right: 1px solid #ddd;
}
#sidebar h2 {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #555;
  margin: 1rem 0 0.4rem 0;
}
#sidebar h2:first-of-type { margin-top: 0; }
#sidebar select,
#sidebar input,
#sidebar button {
  width: 100%;
  padding: 0.4rem 0.5rem;
  border: 1px solid #ccc;
  border-radius: 4px;
  font: inherit;
  background: white;
  margin-bottom: 0.4rem;
}
#sidebar label {
  display: block;
  font-size: 0.85rem;
  margin-bottom: 0.25rem;
  color: #444;
}
#sidebar button {
  background: #2271b1;
  color: white;
  border: none;
  cursor: pointer;
  font-weight: 500;
  margin-top: 0.5rem;
}
#sidebar button:hover { background: #195a8e; }

#info {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid #ddd;
  font-size: 0.8rem;
  color: #555;
  white-space: pre-wrap;
}

#content {
  flex: 1;
  display: grid;
  grid-template-rows: 55fr 45fr;
  min-width: 0;
}

#map {
  width: 100%;
  height: 100%;
  background: #e0e7ee;
}

#bottom {
  display: grid;
  grid-template-rows: 220px 1fr;
  min-height: 0;
  border-top: 1px solid #ddd;
  background: white;
}
#chart-wrap {
  padding: 0.5rem 1rem;
  border-bottom: 1px solid #ddd;
  position: relative;
  min-height: 0;
}
#table-wrap {
  overflow: auto;
  padding: 0.5rem 1rem;
}

.station-marker {
  width: 14px; height: 14px;
  border-radius: 50%;
  background: #d63638;
  border: 2px solid white;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease;
}
.station-marker:hover { transform: scale(1.3); }
.station-marker.selected {
  background: #2271b1;
  width: 18px; height: 18px;
  box-shadow: 0 1px 6px rgba(34, 113, 177, 0.6);
}
.station-marker.no-data { background: #888; }

.maplibregl-popup-content { font-size: 0.85rem; padding: 0.6rem 0.8rem; }
.maplibregl-popup-content strong {
  display: block;
  margin-bottom: 0.2rem;
  font-size: 0.95rem;
  color: #1d1d1f;
}

table.dataTable { font-size: 0.8rem; }
table.dataTable td, table.dataTable th { padding: 4px 6px; }
table.dataTable thead th { background: #f0f0f3; }
