:root {
  --surface: #fcfcfb;
  --plane: #f9f9f7;
  --ink: #0b0b0b;
  --ink2: #52514e;
  --muted: #898781;
  --grid: #e1e0d9;
  --line: #c3c2b7;
  --accent: #2a78d6;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  display: flex; flex-direction: column;
  background: var(--plane); color: var(--ink);
  font: 14px/1.35 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
.muted { color: var(--ink2); }
.small { font-size: 12px; }
.mono { font-variant-numeric: tabular-nums; }
.hidden { display: none !important; }

.bar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px;
  padding: 8px 16px; background: var(--surface); border-bottom: 1px solid var(--grid);
}
.brand { font-size: 16px; white-space: nowrap; }
.controls { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; }
.controls label { display: flex; align-items: center; gap: 6px; color: var(--ink2); }
select, button, input[type=range] { font: inherit; }
select {
  padding: 4px 6px; border: 1px solid var(--line); border-radius: 6px; background: #fff; color: var(--ink);
  max-width: 230px;
}
button {
  padding: 4px 9px; border: 1px solid var(--line); border-radius: 6px; background: #fff; color: var(--ink);
  cursor: pointer;
}
button:hover { border-color: var(--ink2); }
.hourctl { display: flex; align-items: center; gap: 6px; }
#hour { width: 220px; }
#hourlabel { min-width: 40px; color: var(--ink); font-weight: 600; }

.valid {
  padding: 4px 16px; background: var(--surface); border-bottom: 1px solid var(--grid);
  color: var(--ink2); font-size: 13px;
}
.valid b { color: var(--ink); }

main { flex: 1; position: relative; min-height: 0; display: flex; flex-direction: column; }
#map { flex: 1; min-height: 300px; background: #e9eef2; }
.leaflet-container { cursor: crosshair; }

.legend {
  min-width: 300px;
  background: rgba(252, 252, 251, 0.94); padding: 8px 10px; border-radius: 8px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, .2); color: var(--ink); max-width: 92vw;
}
.legend .ltitle { font-weight: 600; margin-bottom: 4px; font-size: 12px; }
.legend .lbar { display: flex; height: 12px; border: 1px solid var(--line); }
.legend .lbar span { flex: 1; }
.legend .lticks { display: flex; font-size: 10.5px; color: var(--ink2); margin-top: 2px; }
.legend .lticks span { flex: 1; text-align: left; white-space: nowrap; transform: translateX(-50%); }
.legend .lticks span:first-child { transform: none; }

.panel {
  height: 42%; min-height: 240px; background: var(--surface); border-top: 1px solid var(--grid);
  display: flex; flex-direction: column; padding: 8px 16px 10px;
}
.panel-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.ptitle { font-weight: 600; font-size: 15px; }
.panel-actions { display: flex; align-items: center; gap: 8px; }
.pnow { color: var(--ink2); margin: 4px 0 2px; }
.pnow b { color: var(--ink); }
.chartwrap { position: relative; flex: 1; min-height: 0; }

.foot { padding: 4px 16px; background: var(--surface); border-top: 1px solid var(--grid); }
.msg {
  position: absolute; top: 10px; left: 50%; transform: translateX(-50%); z-index: 1000;
  background: var(--surface); padding: 6px 12px; border-radius: 6px; box-shadow: 0 1px 4px rgba(0,0,0,.25);
}

@media (max-width: 700px) {
  .bar { padding: 8px; }
  #hour { width: 140px; }
  .panel { height: 50%; padding: 8px; }
}
