* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; font-family: -apple-system, "Segoe UI", Roboto, sans-serif; }
body { display: flex; flex-direction: column; background: #14181f; color: #e8e8e8; }

header { padding: 10px 16px 8px; background: #1b202a; border-bottom: 1px solid #2a3140; }
header h1 { margin: 0; font-size: 1.3rem; letter-spacing: 0.5px; }
header h1 .accent { color: #ff8c42; }
header h1 .claim { font-size: 0.8rem; font-weight: 400; color: #9aa4b5; letter-spacing: 0; }

.stats { margin: 6px 0 8px; font-size: 0.82rem; color: #c8d0dd; }
.stats .stat { white-space: nowrap; }
.stats i { width: 10px; height: 10px; border-radius: 50%; display: inline-block; margin-right: 3px; vertical-align: -1px; }
.stats b { color: #fff; }

.controls { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; font-size: 0.85rem; }
.mode-toggle button {
  background: #232a38; color: #e8e8e8; border: 1px solid #2a3140;
  padding: 4px 12px; cursor: pointer; font-size: 0.85rem;
}
.mode-toggle button:first-child { border-radius: 6px 0 0 6px; }
.mode-toggle button:last-child { border-radius: 0 6px 6px 0; margin-left: -1px; }
.mode-toggle button.active { background: #3a4557; border-color: #4a5870; }
.controls select, .controls input {
  background: #232a38; color: #e8e8e8; border: 1px solid #2a3140;
  border-radius: 6px; padding: 4px 8px; font-size: 0.85rem;
}
.controls input { width: 70px; }
.controls label { color: #9aa4b5; }

.legend { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 8px; font-size: 0.75rem; color: #9aa4b5; }
.legend span { display: inline-flex; align-items: center; gap: 4px; }
.legend i { width: 11px; height: 11px; border-radius: 50%; display: inline-block; }

#map { flex: 1; background: #14181f; }
#map.hidden { display: none; }

#table-view { flex: 1; overflow: auto; padding: 0 16px 16px; }
#table-view.hidden { display: none; }
#stations-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; margin-top: 10px; }
#stations-table th {
  text-align: left; color: #9aa4b5; font-weight: 600; padding: 6px 10px 6px 0;
  border-bottom: 1px solid #2a3140; cursor: pointer; user-select: none;
  position: sticky; top: 0; background: #14181f;
}
#stations-table th.sorted { color: #fff; }
#stations-table td { padding: 4px 10px 4px 0; border-bottom: 1px solid #1e242f; }
#stations-table td.num { font-variant-numeric: tabular-nums; }
#stations-table tbody tr { cursor: pointer; }
#stations-table tbody tr:hover { background: #1b202a; }

#about {
  padding: 14px 16px; background: #171c25; border-top: 1px solid #2a3140;
  font-size: 0.82rem; color: #b7c0cf; max-height: 30vh; overflow-y: auto;
}
#about h2 { margin: 0 0 6px; font-size: 0.95rem; color: #e8e8e8; }
#about p { margin: 0 0 8px; max-width: 75rem; line-height: 1.5; }
#about a { color: #8ab4f8; }

#panel {
  position: absolute; top: 170px; right: 12px; z-index: 1000;
  width: 320px; max-height: calc(100% - 200px); overflow-y: auto;
  background: #1b202a; border: 1px solid #2a3140; border-radius: 10px;
  padding: 14px 16px; box-shadow: 0 4px 24px rgba(0,0,0,0.5);
}
#panel.hidden { display: none; }
#panel-close {
  position: absolute; top: 6px; right: 10px; background: none; border: none;
  color: #9aa4b5; font-size: 1.3rem; cursor: pointer;
}
#panel h2 { margin: 0 0 2px; font-size: 1.05rem; }
#panel .meta { font-size: 0.75rem; color: #9aa4b5; margin-bottom: 10px; }
#panel table { width: 100%; border-collapse: collapse; font-size: 0.82rem; }
#panel th { text-align: left; color: #9aa4b5; font-weight: 500; padding: 6px 0 2px; }
#panel td { padding: 2px 0; border-bottom: 1px solid #232a38; }
#panel td.val { text-align: right; font-variant-numeric: tabular-nums; }
#panel td.date { text-align: right; color: #9aa4b5; font-size: 0.75rem; }
.today-vals { display: flex; gap: 14px; margin: 8px 0 4px; font-size: 1rem; }
.today-vals .hot { color: #ff8c42; }
.today-vals .cold { color: #6ec6ff; }
.badge { display: inline-block; padding: 1px 8px; border-radius: 10px; font-size: 0.72rem; margin: 2px 4px 2px 0; }

footer {
  padding: 5px 16px; background: #1b202a; border-top: 1px solid #2a3140;
  font-size: 0.72rem; color: #9aa4b5;
}
footer a { color: #9aa4b5; }
