:root {
  --bg: #f4f6f8;
  --panel-bg: #ffffff;
  --border: #e1e5ea;
  --text: #1a202c;
  --text-muted: #5a6472;
  --accent: #2b6cb0;
  --radius: 10px;
  font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body, #app {
  height: 100%;
  margin: 0;
}

body {
  background: var(--bg);
  color: var(--text);
}

.app-shell {
  display: flex;
  flex-direction: column;
  height: 100vh;
}

.app-header {
  display: flex;
  align-items: center;
  padding: 12px 20px;
  background: #10233f;
  color: #fff;
  box-shadow: 0 1px 4px rgba(0,0,0,0.15);
  z-index: 10;
}

.brand { display: flex; align-items: center; gap: 12px; }

.brand-mark {
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  font-size: 13px;
  padding: 6px 8px;
  border-radius: 6px;
  letter-spacing: 0.02em;
}

.app-header h1 { font-size: 16px; margin: 0; }
.app-header p { font-size: 12px; margin: 2px 0 0; color: #a9c1de; }

.app-body {
  flex: 1;
  display: flex;
  min-height: 0;
}

.sidebar {
  width: 280px;
  flex-shrink: 0;
  padding: 14px;
  overflow-y: auto;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.map-container {
  flex: 1;
  position: relative;
}

.map-view {
  position: absolute;
  inset: 0;
}

.panel {
  background: var(--panel-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
}

.panel h2 {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  margin: 0 0 10px;
}

.layer-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13.5px;
  padding: 5px 0;
  cursor: pointer;
}

.layer-row .unit { color: var(--text-muted); font-size: 11.5px; margin-left: auto; }

.swatch {
  width: 14px; height: 14px;
  border-radius: 3px;
  display: inline-block;
  flex-shrink: 0;
}

.swatch-outline {
  background: transparent;
  border: 2px solid #2f855a;
}

.swatch-dot {
  border-radius: 50%;
  background: #2b6cb0;
}

.search-input {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13.5px;
}

.search-results {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
}

.search-results li {
  padding: 8px 10px;
  display: flex;
  align-items: baseline;
  gap: 8px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.search-results li:last-child { border-bottom: none; }
.search-results li:hover { background: #eef4fb; }

.search-results .dot {
  width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0;
}
.search-results .dot.discharge { background: #2b6cb0; }
.search-results .dot.precipitation { background: #2f855a; }
.search-results .meta { color: var(--text-muted); font-size: 11.5px; margin-left: auto; white-space: nowrap; }

.search-empty { font-size: 12.5px; color: var(--text-muted); margin: 8px 0 0; }

.station-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.station-panel-header h2 {
  font-size: 16px;
  text-transform: none;
  letter-spacing: normal;
  color: var(--text);
  margin: 0;
}

.station-sub { font-size: 12px; color: var(--text-muted); margin: 2px 0 0; }

.close-btn {
  background: none;
  border: none;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  color: var(--text-muted);
  padding: 0 4px;
}
.close-btn:hover { color: var(--text); }

.station-meta, .station-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 12px 0;
  padding: 0;
}
.station-meta div, .station-stats div {
  background: var(--bg);
  border-radius: 6px;
  padding: 6px 8px;
}
.station-meta dt, .station-stats dt {
  font-size: 10.5px;
  text-transform: uppercase;
  color: var(--text-muted);
  margin: 0;
}
.station-meta dd, .station-stats dd {
  font-size: 13px;
  margin: 2px 0 0;
  font-weight: 600;
}

.range-toggle {
  display: flex;
  gap: 6px;
  margin-bottom: 10px;
}
.range-toggle button {
  flex: 1;
  padding: 6px 4px;
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 6px;
  font-size: 12px;
  cursor: pointer;
}
.range-toggle button.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.chart {
  position: relative;
  width: 100%;
}

.chart .axis path, .chart .axis line { stroke: var(--border); }
.chart .axis text { fill: var(--text-muted); font-size: 10.5px; }
.chart .hover-line { stroke: var(--text-muted); stroke-dasharray: 3 3; }

.chart-tooltip {
  position: absolute;
  background: #1a202c;
  color: #fff;
  padding: 6px 8px;
  border-radius: 6px;
  font-size: 11.5px;
  pointer-events: none;
  white-space: nowrap;
  transform: translateY(-100%);
}

.mock-note {
  font-size: 11px;
  color: var(--text-muted);
  font-style: italic;
  margin: 10px 0 0;
}

@media (max-width: 900px) {
  .app-body { flex-direction: column; overflow-y: auto; }
  .sidebar { width: 100%; }
  .map-container { height: 60vh; }
}
