:root {
  color-scheme: dark;
  --bg: #07111f;
  --panel: #0d1b2d;
  --panel-2: #12243a;
  --text: #e8f1ff;
  --muted: #91a5be;
  --line: #24415f;
  --accent: #67e8f9;
  --accent-2: #a78bfa;
  --good: #35d07f;
  --warn: #fbbf24;
  --bad: #fb7185;
  --radius: 18px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background:
    radial-gradient(circle at top left, rgba(103, 232, 249, .16), transparent 34rem),
    radial-gradient(circle at 80% 10%, rgba(167, 139, 250, .14), transparent 30rem),
    var(--bg);
  color: var(--text);
}

.hero {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  padding: 34px clamp(18px, 4vw, 56px) 22px;
  align-items: flex-end;
}

.eyebrow { color: var(--accent); letter-spacing: .14em; text-transform: uppercase; font-size: 12px; margin: 0 0 8px; }
h1 { margin: 0; font-size: clamp(30px, 5vw, 64px); line-height: .95; }
h2 { margin: 0 0 14px; font-size: 18px; }
.sub { color: var(--muted); max-width: 780px; }
.hero-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }

select, input, button, .admin-link {
  border: 1px solid var(--line);
  background: rgba(13, 27, 45, .88);
  color: var(--text);
  border-radius: 12px;
  padding: 10px 12px;
  font: inherit;
}

select { min-width: 260px; }
input { min-width: 240px; }
button, .admin-link { cursor: pointer; text-decoration: none; }
button:hover, .admin-link:hover { border-color: var(--accent); }

main { padding: 0 clamp(18px, 4vw, 56px) 44px; }
.summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}
.stat, .card {
  background: linear-gradient(180deg, rgba(18, 36, 58, .92), rgba(13, 27, 45, .92));
  border: 1px solid rgba(103, 232, 249, .14);
  border-radius: var(--radius);
  box-shadow: 0 16px 42px rgba(0,0,0,.22);
}
.stat { padding: 16px; }
.stat .label { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .08em; }
.stat .value { font-size: 28px; font-weight: 700; margin-top: 8px; }
.stat .small { color: var(--muted); font-size: 12px; margin-top: 5px; }

.tabs { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0 18px; }
.tab.active { background: linear-gradient(135deg, rgba(103,232,249,.24), rgba(167,139,250,.18)); border-color: var(--accent); }
.panel { display: none; }
.panel.active { display: block; }
.grid { display: grid; gap: 16px; margin-bottom: 16px; }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.card { padding: 18px; min-width: 0; }
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 14px; }
.toolbar.dense {
  align-items: end;
  gap: 12px;
}
.toolbar label {
  color: var(--muted);
  display: grid;
  font-size: 12px;
  gap: 5px;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.filters-card { margin-bottom: 16px; }

.chart { width: 100%; height: auto; min-height: 270px; display: block; }
.chart.tall { min-height: 460px; }
svg text { fill: var(--text); font-size: 11px; }
.axis, .grid-line { stroke: var(--line); stroke-width: 1; }
.grid-line { opacity: .6; }
.muted { fill: var(--muted); color: var(--muted); }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 9px 8px; border-bottom: 1px solid rgba(145,165,190,.18); text-align: left; vertical-align: top; }
th { color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.pill { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; padding: 2px 8px; color: var(--muted); margin: 2px 3px 2px 0; }
.profile-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.profile-item { background: rgba(7,17,31,.45); border-radius: 12px; padding: 10px; }
.profile-item .k { color: var(--muted); font-size: 12px; }
.profile-item .v { font-size: 18px; margin-top: 4px; }

.card-head {
  align-items: flex-start;
  display: flex;
  gap: 14px;
  justify-content: space-between;
  margin-bottom: 10px;
}

.chart-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
}

.chart-tools button {
  border-radius: 999px;
  font-size: 12px;
  padding: 7px 10px;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  margin-top: 10px;
}

.legend span {
  align-items: center;
  color: var(--muted);
  display: inline-flex;
  font-size: 12px;
  gap: 6px;
  cursor: default;
  transition: opacity .15s ease, color .15s ease;
}

.legend i {
  border-radius: 99px;
  display: inline-block;
  height: 9px;
  width: 22px;
}

.series-line,
.series-dot,
.series-bar,
.series-label {
  transition: opacity .15s ease, stroke-width .15s ease, filter .15s ease;
}

svg.has-hover .series-line,
svg.has-hover .series-dot,
svg.has-hover .series-bar,
svg.has-hover .series-label,
.legend.has-hover span {
  opacity: .18;
}

svg.has-hover .is-hovered.series-line {
  filter: drop-shadow(0 0 8px rgba(103, 232, 249, .45));
  opacity: 1;
  stroke-width: 4;
}

svg.has-hover .is-hovered.series-dot,
svg.has-hover .is-hovered.series-bar,
svg.has-hover .is-hovered.series-label,
.legend.has-hover .is-hovered {
  color: var(--text);
  opacity: 1;
}

.round-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.round-card {
  background: rgba(7,17,31,.45);
  border: 1px solid rgba(145,165,190,.14);
  border-radius: 16px;
  padding: 14px;
}

.round-card h3 {
  margin: 0 0 10px;
}

.round-sessions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.session-pill {
  align-items: flex-start;
  display: grid;
  gap: 2px;
  min-width: 110px;
  text-align: left;
}

.session-pill.active {
  background: linear-gradient(135deg, rgba(103,232,249,.24), rgba(167,139,250,.18));
  border-color: var(--accent);
}

.session-pill span {
  color: var(--muted);
  font-size: 11px;
}

.mini-stats {
  color: var(--muted);
  display: grid;
  font-size: 12px;
  gap: 4px;
  margin-top: 12px;
}

@media (max-width: 920px) {
  .hero { align-items: flex-start; flex-direction: column; }
  .hero-actions { justify-content: flex-start; width: 100%; }
  .summary-grid, .grid.two { grid-template-columns: 1fr; }
  select, input { width: 100%; min-width: 0; }
  .card-head { flex-direction: column; }
  .chart-tools { justify-content: flex-start; }
}

.stack {
  display: grid;
  gap: .75rem;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: .75rem;
  margin-top: 1rem;
}

button.primary,
button.success,
button.danger,
button.warning,
button.secondary {
  border: 0;
  color: #f8fbff;
  cursor: pointer;
  font-weight: 800;
  padding: .85rem 1.05rem;
}

button.primary { background: #5865f2; }
button.success { background: #16a34a; }
button.danger { background: #dc2626; }
button.warning { background: #d97706; }
button.secondary {
  background: rgba(255,255,255,.09);
  border: 1px solid rgba(255,255,255,.16);
}

.status-badge {
  border-radius: 999px;
  display: inline-flex;
  font-weight: 900;
  letter-spacing: .06em;
  margin: .5rem 0 1rem;
  padding: .55rem .9rem;
}

.status-badge.running { background: rgba(34, 197, 94, .18); color: #86efac; }
.status-badge.stopped { background: rgba(248, 113, 113, .18); color: #fecaca; }
.status-badge.error { background: rgba(251, 191, 36, .18); color: #fde68a; }
.status-badge.neutral,
.status-badge.unknown { background: rgba(148, 163, 184, .18); color: #cbd5e1; }

.log-box {
  background: rgba(0, 0, 0, .26);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 1rem;
  color: #c7d2fe;
  min-height: 10rem;
  overflow: auto;
  padding: 1rem;
  white-space: pre-wrap;
}
