:root {
  --bg: #0f1419;
  --surface: #1a2332;
  --border: #2d3a4d;
  --text: #e8edf4;
  --muted: #8b9cb3;
  --accent: #3d9cf0;
  --success: #4ade80;
  --warn: #fbbf24;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Segoe UI", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

.app {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1.5rem;
}

.header .tagline {
  color: var(--muted);
  margin: 0.25rem 0 0;
  font-size: 0.95rem;
}

h1 {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 600;
}

h2 {
  margin: 0 0 1rem;
  font-size: 1.1rem;
  color: var(--muted);
  font-weight: 600;
}

.main {
  display: grid;
  gap: 1.5rem;
  margin-top: 1.5rem;
}

@media (min-width: 900px) {
  .main {
    grid-template-columns: 320px 1fr;
    align-items: start;
  }
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.25rem;
}

.field {
  margin-bottom: 1rem;
}

.field label {
  display: block;
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 0.35rem;
}

.field input[type="range"] {
  width: 100%;
}

.field output {
  float: right;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}

.channels label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.35rem;
}

.hint {
  font-size: 0.8rem;
  color: var(--warn);
  margin: 0.5rem 0 0;
}

.hint.ok {
  color: var(--success);
}

select,
input[type="password"] {
  width: 100%;
  padding: 0.5rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
}

.primary {
  width: 100%;
  padding: 0.75rem 1rem;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
}

.primary:hover {
  filter: brightness(1.08);
}

.primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

#chart {
  width: 100%;
  height: auto;
  max-height: 360px;
  border-radius: 8px;
  background: #0a0e14;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0.75rem;
  margin-top: 1rem;
}

.metric-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.75rem;
}

.metric-card strong {
  display: block;
  font-size: 1.25rem;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}

.metric-card span {
  font-size: 0.75rem;
  color: var(--muted);
}

.narrative {
  margin-top: 1rem;
  padding: 1rem;
  background: var(--bg);
  border-radius: 8px;
  border-left: 3px solid var(--accent);
  font-size: 0.92rem;
}

.narrative.error {
  border-left-color: #f87171;
}

.footer {
  margin-top: 2rem;
  font-size: 0.8rem;
  color: var(--muted);
}
