:root {
  color-scheme: dark;
  --bg: #09111f;
  --surface: #111b2e;
  --surface-soft: #15233b;
  --text: #eef4ff;
  --muted: #aab8d1;
  --border: #243552;
  --ok: #15c67f;
  --warn: #f4b740;
  --crit: #ff6363;
  --accent: #5aa7ff;
  --shadow: 0 12px 32px rgba(0, 0, 0, 0.28);
  --radius: 18px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: linear-gradient(180deg, #08101c 0%, #0b1628 100%);
  color: var(--text);
}

button,
input {
  font: inherit;
}

.page-shell {
  max-width: 1280px;
  margin: 0 auto;
  padding: 20px;
}

.topbar,
.hero-grid,
.status-grid,
.chart-grid {
  display: grid;
  gap: 18px;
}

.topbar {
  grid-template-columns: 1fr auto;
  align-items: center;
  margin-bottom: 18px;
}

.topbar h1,
.hero-card h2,
.panel-card h3,
.section-head h2,
.login-card h1 {
  margin: 0;
}

.eyebrow {
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 12px;
  margin-bottom: 6px;
}

.topbar-actions,
.range-switch {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.primary-btn,
.secondary-btn,
.range-btn {
  border: 1px solid var(--border);
  background: var(--surface-soft);
  color: var(--text);
  border-radius: 12px;
  padding: 10px 14px;
  cursor: pointer;
}

.primary-btn {
  background: linear-gradient(180deg, #5da9ff, #3d7fe9);
  border-color: transparent;
  font-weight: 600;
}

.danger-btn {
  background: rgba(255, 99, 99, 0.12);
}

.range-btn.active {
  background: rgba(90, 167, 255, 0.2);
  border-color: var(--accent);
}

.hero-grid {
  grid-template-columns: 1.3fr 1fr;
  margin-bottom: 18px;
}

.hero-card,
.panel-card,
.login-card {
  background: rgba(17, 27, 46, 0.95);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  border-radius: var(--radius);
  padding: 20px;
}

.hero-main-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.hero-summary {
  color: var(--muted);
  margin-top: 12px;
  margin-bottom: 12px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 96px;
  padding: 8px 12px;
  border-radius: 999px;
  font-weight: 700;
}

.status-ok {
  background: rgba(21, 198, 127, 0.15);
  color: #74ffc0;
}

.status-warning {
  background: rgba(244, 183, 64, 0.14);
  color: #ffd983;
}

.status-critical {
  background: rgba(255, 99, 99, 0.16);
  color: #ff9e9e;
}

.counter-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.counter-card,
.status-tile {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px;
}

.counter-value {
  font-size: 28px;
  font-weight: 800;
}

.diagnostics-list {
  list-style: none;
  margin: 10px 0 0;
  padding: 0;
  display: grid;
  gap: 10px;
}

.diagnostics-list li {
  padding: 12px 14px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
  color: var(--muted);
  border: 1px solid var(--border);
}

.status-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-bottom: 18px;
}

.status-meta {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
}

.status-title {
  font-size: 18px;
  font-weight: 700;
}

.status-note,
.subtle {
  color: var(--muted);
}

.issue-list {
  margin: 12px 0 0;
  padding-left: 18px;
  color: var(--muted);
}

.chart-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-bottom: 18px;
}

.chart-box {
  min-height: 260px;
}

.chart-svg {
  width: 100%;
  height: 240px;
}

.chart-legend {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

.legend-swatch {
  width: 10px;
  height: 10px;
  border-radius: 999px;
}

.section-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-bottom: 12px;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.results-table {
  width: 100%;
  border-collapse: collapse;
  background: rgba(17, 27, 46, 0.95);
}

.results-table th,
.results-table td {
  text-align: left;
  padding: 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

.results-table th {
  color: var(--muted);
  font-weight: 600;
  background: rgba(255, 255, 255, 0.02);
}

.mono {
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 12px;
}

.login-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 20px;
}

.login-shell {
  width: min(100%, 460px);
}

.brand-block {
  display: flex;
  gap: 14px;
  align-items: center;
  margin-bottom: 18px;
}

.brand-badge {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  background: linear-gradient(180deg, #5da9ff, #3d7fe9);
  color: white;
  font-weight: 800;
}

.login-form {
  display: grid;
  gap: 14px;
}

.login-form label {
  display: grid;
  gap: 8px;
}

.login-form input {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  padding: 12px 14px;
}

.form-error {
  margin: 0;
  color: #ff9e9e;
}

.login-hint {
  margin-top: 18px;
  color: var(--muted);
}

.login-hint code {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 2px 6px;
}

@media (max-width: 980px) {
  .hero-grid,
  .chart-grid,
  .status-grid {
    grid-template-columns: 1fr;
  }

  .topbar {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .page-shell {
    padding: 14px;
  }

  .counter-strip {
    grid-template-columns: 1fr;
  }

  .section-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .hero-main-head {
    flex-direction: column;
    align-items: flex-start;
  }
}
