* {
  box-sizing: border-box;
}
body {
  margin: 0;
  font-family: "Segoe UI", system-ui, sans-serif;
  background: #0f1419;
  color: #e6edf3;
}
.api-error-banner {
  background: #8b1a1a;
  color: #fff;
  padding: 0.5rem 1rem;
  font-size: 0.9rem;
  text-align: center;
}
.api-error-banner.hidden {
  display: none;
}
.api-error-banner a {
  color: #7ee787;
}
.app {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}
.header {
  padding: 0.75rem 1rem;
  background: #161b22;
  border-bottom: 1px solid #30363d;
}
.header h1 {
  margin: 0 0 0.25rem 0;
  font-size: 1.25rem;
  font-weight: 600;
}
.subtitle {
  margin: 0 0 0.75rem 0;
  font-size: 0.875rem;
  color: #8b949e;
}
.search-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.search-bar label {
  font-size: 0.875rem;
  color: #8b949e;
}
.search-bar select {
  padding: 0.35rem 0.5rem;
  border: 1px solid #30363d;
  border-radius: 6px;
  background: #0d1117;
  color: #e6edf3;
  font-size: 0.875rem;
  min-width: 8rem;
  max-width: 320px;
}
#discharge-select {
  min-width: 18rem;
}
.main {
  flex: 1;
  display: flex;
  min-height: 0;
}
.map {
  flex: 1;
  min-width: 0;
  min-height: 320px;
}
.map-legend {
  padding: 8px 10px;
  background: rgba(13, 17, 23, 0.9);
  border: 1px solid #30363d;
  border-radius: 6px;
  color: #e6edf3;
  font-size: 12px;
  z-index: 1000;
}
.map-legend strong {
  display: block;
  margin-bottom: 4px;
}
.legend-item {
  display: block;
  margin: 1px 0;
}
.legend-swatch {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 1px solid;
  margin-right: 6px;
  vertical-align: middle;
}
.panel {
  width: 420px;
  max-width: 100%;
  overflow-y: auto;
  background: #161b22;
  border-left: 1px solid #30363d;
  padding: 1rem;
}
.panel .placeholder {
  color: #8b949e;
  font-size: 0.9rem;
}
.panel .content.hidden {
  display: none;
}
.panel .content:not(.hidden) ~ .placeholder {
  display: none;
}
.panel h2 {
  margin: 0 0 0.25rem 0;
  font-size: 1.1rem;
}
.panel .meta {
  margin: 0 0 1rem 0;
  font-size: 0.8rem;
  color: #8b949e;
}
.panel .meta a {
  color: #58a6ff;
}
.panel .meta a:hover {
  text-decoration: underline;
}
.chart-wrap.hidden {
  display: none;
}
.charts {
  display: flex;
  flex-direction: column;
  gap: 0;
}
.chart-wrap {
  background: #0d1117;
  border: 1px solid #30363d;
  border-radius: 8px;
  padding: 0.5rem;
  margin-bottom: 0.25rem;
}
.chart-wrap:last-child {
  margin-bottom: 0;
}
.chart-wrap h3 {
  margin: 0 0 0.35rem 0;
  font-size: 0.9rem;
  font-weight: 600;
  color: #8b949e;
}
.chart-wrap {
  position: relative;
  height: 220px;
}
.chart-wrap canvas {
  width: 100% !important;
  height: 220px !important;
  display: block;
}
.vtec-wrap {
  margin-top: 0.25rem;
  min-height: 220px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
}
.vtec-wrap h3 {
  flex-shrink: 0;
  text-align: left;
}
.vtec-wrap .vtec-img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  display: block;
  flex: 1;
  min-height: 180px;
}
.vtec-wrap .vtec-img.hidden {
  display: none;
}
.vtec-wrap .vtec-no-data {
  flex: 1;
  min-height: 180px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.vtec-wrap .vtec-no-data.hidden {
  display: none;
}
.vtec-no-data {
  margin: 0.5rem 0 0 0;
  font-size: 0.85rem;
  color: #8b949e;
}
.vtec-no-data.hidden {
  display: none;
}
.footer {
  padding: 0.5rem 1rem;
  font-size: 0.75rem;
  color: #6e7681;
  background: #161b22;
  border-top: 1px solid #30363d;
}
@media (max-width: 768px) {
  .main {
    flex-direction: column;
  }
  .panel {
    width: 100%;
    max-height: 50vh;
  }
}
