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

body {
  font-family: Aptos, 'Segoe UI Variable', 'Segoe UI', sans-serif;
  background:
    radial-gradient(circle at 15% 10%, rgba(20, 184, 166, 0.18), transparent 28rem),
    radial-gradient(circle at 85% 0%, rgba(245, 158, 11, 0.12), transparent 24rem),
    linear-gradient(145deg, #071111 0%, #101417 48%, #18130d 100%);
  color: #e8eee9;
  padding: 1rem;
  max-width: 1200px;
  margin: 0 auto;
  min-height: 100vh;
}

.hero {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 1rem;
  margin: 0.75rem 0 1.5rem;
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 18px;
  padding: 1.25rem;
  background: rgba(9, 13, 13, 0.72);
  box-shadow: 0 24px 90px rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(16px);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

h1 { font-size: clamp(1.6rem, 4vw, 3.25rem); font-weight: 760; letter-spacing: -0.06em; }
h2 { font-size: 1.1rem; font-weight: 600; margin-bottom: 0.75rem; }
h3 { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.05em; color: #71717a; margin-bottom: 0.25rem; }

.eyebrow {
  color: #f59e0b;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  margin-bottom: 0.35rem;
  text-transform: uppercase;
}

.hero-copy {
  color: #9ca3af;
  margin-top: 0.4rem;
  max-width: 680px;
}

.muted { color: #8e9a94; font-size: 0.8rem; }

/* Overview cards */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.card {
  background: linear-gradient(180deg, rgba(24, 30, 29, 0.92), rgba(15, 18, 18, 0.9));
  border: 1px solid rgba(148, 163, 184, 0.16);
  border-radius: 14px;
  padding: 1rem;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.big-number {
  font-size: 2rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: #5eead4;
}

.status-cards {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.status-card {
  min-height: 118px;
}

.card-detail {
  color: #8e9a94;
  font-size: 0.8rem;
  line-height: 1.4;
  margin-top: 0.55rem;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: 999px;
  color: #cbd5e1;
  font-size: 0.82rem;
  font-weight: 700;
  padding: 0.35rem 0.65rem;
}

.status-pill.good,
.status-text.good {
  color: #5eead4;
}

.status-pill.warn,
.status-text.warn {
  color: #fbbf24;
}

.status-pill.bad,
.status-text.bad {
  color: #f87171;
}

/* Panels */
.panel {
  background: rgba(15, 18, 18, 0.86);
  border: 1px solid rgba(148, 163, 184, 0.16);
  border-radius: 14px;
  padding: 1rem;
  margin-bottom: 1rem;
}

.panel-heading {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  margin-bottom: 0.8rem;
}

.panel-heading h2 {
  margin-bottom: 0;
}

.hidden {
  display: none !important;
}

.auth-panel {
  max-width: 520px;
}

.auth-copy {
  margin-bottom: 1rem;
}

.auth-form {
  display: flex;
  gap: 0.75rem;
  align-items: end;
  flex-wrap: wrap;
}

.auth-form label {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.8rem;
  color: #a1a1aa;
}

.auth-form input[type="password"] {
  min-width: 260px;
  background: rgba(5, 8, 8, 0.96);
  border: 1px solid rgba(148, 163, 184, 0.24);
  color: #e8eee9;
  padding: 0.5rem 0.6rem;
  border-radius: 8px;
  font-size: 0.9rem;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0.75rem;
}

.metric-grid div {
  background: rgba(5, 8, 8, 0.56);
  border: 1px solid rgba(148, 163, 184, 0.12);
  border-radius: 12px;
  padding: 0.8rem;
}

.metric-grid strong {
  color: #f8fafc;
  display: block;
  font-size: 1.35rem;
  font-variant-numeric: tabular-nums;
  margin-top: 0.25rem;
}

.metric-label {
  color: #8e9a94;
  display: block;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* Control row */
.control-row {
  display: flex;
  gap: 1rem;
  align-items: end;
  flex-wrap: wrap;
  margin-bottom: 0.75rem;
}

.control-row label {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.8rem;
  color: #a1a1aa;
}

.control-row input[type="text"],
.control-row input[type="number"] {
  background: rgba(5, 8, 8, 0.96);
  border: 1px solid rgba(148, 163, 184, 0.24);
  color: #e8eee9;
  padding: 0.4rem 0.6rem;
  border-radius: 8px;
  font-size: 0.9rem;
  width: 140px;
}

.control-row input[type="range"] {
  width: 160px;
  accent-color: #14b8a6;
}

/* Buttons */
.btn {
  padding: 0.5rem 1.25rem;
  border: none;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s;
}

.btn.primary {
  background: #14b8a6;
  color: #04110f;
}

.btn.primary:hover { background: #2dd4bf; }

.btn.danger {
  background: #ef4444;
  color: #fff;
}

.btn.danger:hover { background: #b91c1c; }

.btn.subtle {
  background: transparent;
  border: 1px solid rgba(148, 163, 184, 0.28);
  color: #e8eee9;
}

.btn.subtle:hover {
  background: rgba(148, 163, 184, 0.12);
}

/* Tables */
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

th, td {
  text-align: left;
  padding: 0.4rem 0.75rem;
  border-bottom: 1px solid rgba(148, 163, 184, 0.12);
}

th {
  color: #9ca3af;
  font-weight: 500;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

td { font-variant-numeric: tabular-nums; }

.state-active { color: #5eead4; }
.state-connecting { color: #fbbf24; }
.state-error { color: #f87171; }
.state-stopped { color: #8e9a94; }

@media (max-width: 720px) {
  .hero {
    align-items: flex-start;
    flex-direction: column;
  }

  .panel-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .auth-form input[type="password"] {
    min-width: 100%;
    width: 100%;
  }

  .header-actions {
    align-items: flex-end;
    flex-direction: column;
  }
}
