:root {
  --bg: #0f1419;
  --panel: #1a222c;
  --line: #2b3642;
  --text: #e7eef6;
  --muted: #93a4b5;
  --accent: #3d8bfd;
  --accent-2: #5ad4a0;
  --accent-3: #e2b340;
  --accent-4: #c084fc;
  --danger: #e35d6a;
  --ok: #3cb371;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "IBM Plex Sans", "Segoe UI", sans-serif;
  background: radial-gradient(1200px 600px at 10% -10%, #1b2a3a 0%, var(--bg) 55%);
  color: var(--text);
  min-height: 100vh;
}
.hidden { display: none !important; }
.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}
.login-card {
  width: min(380px, 100%);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 24px;
  display: grid;
  gap: 12px;
}
.login-card h1 { margin: 0; font-size: 1.4rem; }
.login-card label { display: grid; gap: 6px; font-size: 0.9rem; color: var(--muted); }
.login-card input, .top-actions select, button {
  border: 1px solid var(--line);
  background: #10171f;
  color: var(--text);
  border-radius: 8px;
  padding: 10px 12px;
  font: inherit;
}
button {
  background: var(--accent);
  border-color: transparent;
  cursor: pointer;
}
button.ghost { background: transparent; border-color: var(--line); }
.error { color: var(--danger); min-height: 1.2em; margin: 0; }
.muted { color: var(--muted); margin: 0; }

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  backdrop-filter: blur(8px);
  background: rgba(15, 20, 25, 0.88);
  z-index: 10;
}
.top-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.pill {
  margin-left: 8px;
  font-size: 0.75rem;
  padding: 2px 8px;
  border-radius: 999px;
  background: #243041;
  color: var(--muted);
}
.layout {
  display: grid;
  gap: 16px;
  padding: 16px 20px 40px;
}
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px;
}
.card h2 { margin: 0 0 12px; font-size: 1.05rem; }
.card h3 { margin: 0 0 10px; font-size: 0.9rem; color: var(--muted); font-weight: 600; }
.host-block {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px;
  margin-bottom: 12px;
  background: #121920;
}
.host-block:last-child { margin-bottom: 0; }
.host-block h3 { margin-top: 0; }
.metric-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
}
.metric {
  background: #121920;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
}
.metric .label { color: var(--muted); font-size: 0.78rem; }
.metric .value { font-size: 1.25rem; font-weight: 650; margin-top: 4px; }
.metric .value.warn { color: #e2b340; }
.metric .value.bad { color: var(--danger); }
.metric .value.good { color: var(--ok); }
.table-wrap { overflow: auto; margin-top: 12px; }
table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
th, td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { color: var(--muted); font-weight: 600; }

.charts-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-top: 14px;
}
.chart-panel {
  background: #10171f;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px;
  min-height: 220px;
}
.chart-panel.wide { grid-column: 1 / -1; }
.chart-empty {
  display: grid;
  place-items: center;
  min-height: 160px;
  color: var(--muted);
  font-size: 0.85rem;
}
.chart-svg {
  width: 100%;
  height: auto;
  display: block;
}
.chart-svg .grid-line { stroke: #243041; stroke-width: 1; }
.chart-svg .axis-label { fill: var(--muted); font-size: 10px; }
.chart-svg .value-label {
  fill: var(--text);
  font-size: 11px;
  font-weight: 600;
  paint-order: stroke;
  stroke: #10171f;
  stroke-width: 3px;
  stroke-linejoin: round;
}
.chart-svg .bar { transition: opacity 0.15s ease; }
.chart-svg .bar:hover { opacity: 0.85; }
.chart-svg .line {
  fill: none;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.chart-svg .area { opacity: 0.18; }
.chart-svg .dot { stroke: #10171f; stroke-width: 1.5; }
.chart-legend {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 8px;
  font-size: 0.75rem;
  color: var(--muted);
}
.chart-legend span { display: inline-flex; align-items: center; gap: 6px; }
.chart-legend i {
  width: 10px;
  height: 10px;
  border-radius: 2px;
  display: inline-block;
}

.split { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 14px; }
.log-list {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 280px;
  overflow: auto;
  background: #10171f;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 12px;
}
.log-list li {
  border-bottom: 1px solid var(--line);
  padding: 8px 0;
  font-size: 0.78rem;
  color: #c4d0dc;
  word-break: break-all;
}
.log-list li:last-child { border-bottom: none; }
.status-line {
  padding: 0 20px 24px;
  color: var(--muted);
  font-size: 0.8rem;
}
@media (max-width: 900px) {
  .charts-grid, .split { grid-template-columns: 1fr; }
  .chart-panel.wide { grid-column: auto; }
  .topbar { align-items: flex-start; flex-direction: column; }
}
