:root {
  --bg:        #0b0c0e;
  --bg-2:      #111316;
  --bg-3:      #16191d;
  --line:      #21252b;
  --line-2:    #2d333b;
  --text:      #e6e8eb;
  --muted:     #8b9098;
  --muted-2:   #5b6068;
  --accent:    #d2ff3a;        /* electric lime — strong signal, single accent */
  --accent-2:  #9fd400;
  --danger:    #ff6262;
  --ok:        #4ade80;
  --warn:      #f59e0b;
  --radius:    10px;
  --mono:      'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  --serif:     'Fraunces', ui-serif, Georgia, serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--mono);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  /* Subtle vignette + grid */
  background-image:
    radial-gradient(ellipse at top, rgba(210, 255, 58, 0.04), transparent 60%),
    linear-gradient(to right, rgba(255,255,255,0.015) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255,255,255,0.015) 1px, transparent 1px);
  background-size: auto, 48px 48px, 48px 48px;
  min-height: 100vh;
}

.mono { font-family: var(--mono); }
.muted { color: var(--muted); }
.accent { color: var(--accent); }
.hidden { display: none !important; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: inline-block; max-width: 100%; }

/* --- Top bar ------------------------------------------------------------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 28px;
  border-bottom: 1px solid var(--line);
  background: rgba(11, 12, 14, 0.85);
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 10;
}
.brand { display: flex; align-items: center; gap: 14px; }
.brand h1 {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 22px;
  letter-spacing: -0.01em;
  margin: 0;
}
.brand .dot {
  width: 10px; height: 10px;
  background: var(--accent);
  border-radius: 50%;
  box-shadow: 0 0 12px var(--accent);
  animation: pulse 2.4s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%      { opacity: 0.5; transform: scale(0.85); }
}
.back {
  color: var(--muted);
  text-decoration: none;
  font-size: 20px;
  padding: 0 6px;
  border: 1px solid var(--line);
  border-radius: 6px;
  transition: color .15s, border-color .15s;
}
.back:hover { color: var(--text); border-color: var(--line-2); }

.topbar-right { display: flex; align-items: center; gap: 14px; }

/* --- Container & summary stats ------------------------------------------ */
.container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 32px 28px 80px;
}

.summary {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 36px;
}
.stat {
  background: var(--bg-2);
  padding: 22px 24px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.stat-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
}
.stat-value {
  font-size: 32px;
  font-weight: 500;
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
}

/* --- Section headings --------------------------------------------------- */
.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 18px;
}
.section-head h2 {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 18px;
  margin: 0;
  letter-spacing: -0.005em;
}

/* --- Stations grid (dashboard) ----------------------------------------- */
.stations-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
}
.station-card {
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px 22px;
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
  gap: 14px;
  transition: border-color .15s, transform .15s, background .15s;
  position: relative;
  overflow: hidden;
}
.station-card:hover {
  border-color: var(--line-2);
  background: var(--bg-3);
  transform: translateY(-1px);
}
.station-card .card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}
.station-card .name {
  font-family: var(--serif);
  font-size: 18px;
  font-weight: 500;
  letter-spacing: -0.005em;
  margin: 0;
  word-break: break-word;
}
.station-card .status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid var(--line);
  white-space: nowrap;
}
.status.online  { color: var(--ok); border-color: rgba(74,222,128,0.3); }
.status.offline { color: var(--danger); border-color: rgba(255,98,98,0.3); }
.status .pip { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.status.online .pip { box-shadow: 0 0 6px currentColor; }

.station-card .numbers {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.station-card .num-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
  margin-bottom: 2px;
}
.station-card .num-value {
  font-size: 26px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}
.station-card .num-value.current { color: var(--accent); }

.station-card .meta-row {
  display: flex;
  justify-content: space-between;
  padding-top: 12px;
  border-top: 1px dashed var(--line);
  color: var(--muted);
  font-size: 11px;
}
.station-card .type-tag {
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

/* --- Buttons ------------------------------------------------------------ */
.btn {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.04em;
  background: var(--bg-2);
  color: var(--text);
  border: 1px solid var(--line-2);
  padding: 8px 14px;
  border-radius: 6px;
  cursor: pointer;
  transition: background .15s, border-color .15s, color .15s;
}
.btn:hover { background: var(--bg-3); border-color: var(--muted-2); }
.btn.primary {
  background: var(--accent);
  color: #0a0b0d;
  border-color: var(--accent);
}
.btn.primary:hover { background: var(--accent-2); border-color: var(--accent-2); }
.btn.danger {
  color: var(--danger);
  border-color: rgba(255,98,98,0.3);
}
.btn.danger:hover { background: rgba(255,98,98,0.08); border-color: var(--danger); }
.btn.ghost { background: transparent; }

/* --- Dialog ------------------------------------------------------------- */
dialog {
  background: var(--bg-2);
  border: 1px solid var(--line-2);
  border-radius: var(--radius);
  color: var(--text);
  padding: 0;
  max-width: 440px;
  width: 90vw;
}
dialog::backdrop {
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(4px);
}
dialog form { padding: 26px; display: flex; flex-direction: column; gap: 18px; }
dialog h3 {
  margin: 0;
  font-family: var(--serif);
  font-weight: 500;
  font-size: 20px;
}
dialog label { display: flex; flex-direction: column; gap: 6px; }
dialog label > span {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
}
dialog input {
  font-family: var(--mono);
  font-size: 14px;
  background: var(--bg);
  border: 1px solid var(--line-2);
  color: var(--text);
  padding: 10px 12px;
  border-radius: 6px;
  outline: none;
}
dialog input:focus { border-color: var(--accent); }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; }
.error {
  color: var(--danger);
  font-size: 12px;
  padding: 8px 10px;
  background: rgba(255,98,98,0.08);
  border-radius: 6px;
}

/* --- Empty state -------------------------------------------------------- */
.empty {
  border: 1px dashed var(--line-2);
  border-radius: var(--radius);
  padding: 60px 20px;
  text-align: center;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

/* --- Station detail page ------------------------------------------------ */
.meta-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 36px;
}
.meta-grid > div {
  background: var(--bg-2);
  padding: 16px 22px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
.meta-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
}

.chart-section {
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
}
.chart-section .section-head { margin-bottom: 22px; }

.range-picker {
  display: inline-flex;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
}
.range {
  font-family: var(--mono);
  font-size: 12px;
  background: transparent;
  color: var(--muted);
  border: 0;
  border-right: 1px solid var(--line);
  padding: 6px 12px;
  cursor: pointer;
  transition: background .15s, color .15s;
}
.range:last-child { border-right: 0; }
.range:hover { color: var(--text); }
.range.active { background: var(--accent); color: #0a0b0d; }

.chart-wrap {
  position: relative;
  width: 100%;
  height: 320px;
  margin-bottom: 16px;
}
#chart {
  width: 100%;
  height: 100%;
  display: block;
}
.chart-grid-line { stroke: var(--line); stroke-width: 1; }
.chart-axis-label { fill: var(--muted); font-size: 11px; font-family: var(--mono); }
.chart-line-current { fill: none; stroke: var(--accent); stroke-width: 2; }
.chart-area-current { fill: var(--accent); opacity: 0.08; }
.chart-line-peak { fill: none; stroke: var(--muted); stroke-width: 1.5; stroke-dasharray: 4 4; }

.legend {
  display: flex;
  gap: 24px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
}
.legend span { display: inline-flex; align-items: center; gap: 8px; }
.swatch { width: 14px; height: 2px; display: inline-block; }
.swatch.current { background: var(--accent); }
.swatch.peak { background: var(--muted); border-top: 1px dashed var(--muted); height: 0; }

/* --- Responsive --------------------------------------------------------- */
@media (max-width: 720px) {
  .topbar { padding: 14px 16px; }
  .container { padding: 20px 16px 60px; }
  .summary { grid-template-columns: repeat(2, 1fr); }
  .stat-value { font-size: 24px; }
  .stations-grid { grid-template-columns: 1fr; }
  .brand h1 { font-size: 18px; }
}
