:root {
  /* --- Color tokens --- */
  --bg-base: #10131a;
  --bg-surface: #171b24;
  --bg-surface-raised: #1e2430;
  --border: #2a3140;
  --border-soft: #232a37;

  --text-primary: #e4e7ed;
  --text-secondary: #8b93a7;
  --text-faint: #5b6274;

  --accent: #3fcfca;
  --accent-dim: #2a938f;
  --accent-glow: rgba(63, 207, 202, 0.35);

  --led-running: #5fbf8f;
  --led-running-glow: rgba(95, 191, 143, 0.55);
  --led-stopped: #e2626b;
  --led-stopped-glow: rgba(226, 98, 107, 0.5);
  --led-other: #e0b04a;
  --led-other-glow: rgba(224, 176, 74, 0.5);

  --font-ui: "Space Grotesk", system-ui, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg-base);
  color: var(--text-primary);
  font-family: var(--font-ui);
  min-height: 100vh;
}

body {
  background-image:
    radial-gradient(circle at 15% 0%, rgba(63, 207, 202, 0.06), transparent 45%),
    radial-gradient(circle at 85% 100%, rgba(63, 207, 202, 0.04), transparent 40%);
  background-attachment: fixed;
}

::selection { background: var(--accent-glow); color: var(--text-primary); }

/* --- Topbar --- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 18px 28px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, var(--bg-surface), var(--bg-base));
  flex-wrap: wrap;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand h1 {
  font-size: 15px;
  letter-spacing: 0.18em;
  font-weight: 600;
  margin: 0;
  color: var(--text-primary);
}

.brand-led {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--led-running);
  box-shadow: 0 0 8px var(--led-running-glow);
  animation: pulse 2.4s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.45; }
}

.topbar-stats {
  display: flex;
  gap: 28px;
}

.stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 56px;
}

.stat-value {
  font-family: var(--font-mono);
  font-size: 20px;
  font-weight: 600;
  color: var(--text-primary);
}

.stat-label {
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin-top: 2px;
}

.poll-status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-secondary);
}

.poll-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--led-other);
  box-shadow: 0 0 6px var(--led-other-glow);
}

.poll-dot.ok { background: var(--accent); box-shadow: 0 0 6px var(--accent-glow); }
.poll-dot.error { background: var(--led-stopped); box-shadow: 0 0 6px var(--led-stopped-glow); }

/* --- Main / controls --- */
main {
  padding: 22px 28px 40px;
  max-width: 1280px;
  margin: 0 auto;
}

.controls {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 18px;
}

.search-wrap {
  position: relative;
  flex: 1 1 260px;
  min-width: 220px;
}

.search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-faint);
  pointer-events: none;
}

#search {
  width: 100%;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px 10px 36px;
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 13px;
  outline: none;
  transition: border-color 0.15s ease;
}

#search:focus {
  border-color: var(--accent-dim);
  box-shadow: 0 0 0 3px rgba(63, 207, 202, 0.12);
}

#search::placeholder { color: var(--text-faint); }

.filter-group {
  display: flex;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}

.filter-btn {
  appearance: none;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 500;
  padding: 9px 14px;
  cursor: pointer;
  border-right: 1px solid var(--border-soft);
  transition: background 0.15s ease, color 0.15s ease;
}

.filter-btn:last-child { border-right: none; }

.filter-btn:hover { color: var(--text-primary); background: var(--bg-surface-raised); }

.filter-btn.active {
  color: var(--bg-base);
  background: var(--accent);
}

/* --- Table --- */
.table-wrap {
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  background: var(--bg-surface);
}

table {
  width: 100%;
  border-collapse: collapse;
}

thead th {
  text-align: left;
  font-size: 10.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-faint);
  font-weight: 600;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-surface-raised);
}

.col-status { width: 36px; }
.col-type { width: 90px; }
.col-ip { width: 220px; }

tbody tr {
  border-bottom: 1px solid var(--border-soft);
  transition: background 0.12s ease;
}

tbody tr:last-child { border-bottom: none; }

tbody tr:not(.empty-row):hover { background: var(--bg-surface-raised); }

td {
  padding: 11px 16px;
  font-size: 13px;
  color: var(--text-primary);
  vertical-align: middle;
}

.empty-row td {
  color: var(--text-faint);
  text-align: center;
  padding: 36px 16px;
  font-family: var(--font-mono);
  font-size: 12px;
}

/* status LED */
.led {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--led-other);
  box-shadow: 0 0 6px var(--led-other-glow);
}

.led.running { background: var(--led-running); box-shadow: 0 0 7px var(--led-running-glow); }
.led.stopped { background: var(--led-stopped); box-shadow: none; opacity: 0.85; }

/* type badge */
.type-badge {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.04em;
  padding: 3px 7px;
  border-radius: 5px;
  border: 1px solid var(--border);
  color: var(--text-secondary);
}

.type-badge.vm { color: #8fb8e0; border-color: rgba(143, 184, 224, 0.35); }
.type-badge.lxc { color: #c7a8e8; border-color: rgba(199, 168, 232, 0.35); }
.type-badge.container { color: var(--accent); border-color: rgba(63, 207, 202, 0.35); }

.name-cell { font-weight: 500; }
.host-cell { color: var(--text-secondary); font-family: var(--font-mono); font-size: 12.5px; }

.ip-chip {
  font-family: var(--font-mono);
  font-size: 12.5px;
  background: var(--bg-base);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 3px 8px;
  color: var(--text-primary);
  display: inline-block;
  margin: 2px 4px 2px 0;
  cursor: pointer;
  transition: border-color 0.12s ease, color 0.12s ease;
}

.ip-chip:hover { border-color: var(--accent-dim); color: var(--accent); }

.no-ip { color: var(--text-faint); font-family: var(--font-mono); font-size: 12px; }

.detail-cell { color: var(--text-faint); font-family: var(--font-mono); font-size: 11.5px; }

/* --- Empty state / error --- */
.empty-state {
  text-align: center;
  padding: 40px 0;
  color: var(--text-faint);
  font-family: var(--font-mono);
  font-size: 13px;
}

.error-banner {
  margin-top: 16px;
  padding: 12px 16px;
  border: 1px solid rgba(226, 98, 107, 0.4);
  background: rgba(226, 98, 107, 0.08);
  color: #f0a3a8;
  border-radius: 8px;
  font-family: var(--font-mono);
  font-size: 12.5px;
}

footer {
  text-align: center;
  padding: 20px;
  color: var(--text-faint);
  font-size: 11.5px;
  font-family: var(--font-mono);
  border-top: 1px solid var(--border-soft);
}

/* subtle scanline texture for the NOC feel, purely decorative */
.scanline-overlay {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.012) 0px,
    rgba(255, 255, 255, 0.012) 1px,
    transparent 1px,
    transparent 3px
  );
  z-index: 1000;
}

@media (prefers-reduced-motion: reduce) {
  .brand-led { animation: none; }
}

/* --- Responsive --- */
@media (max-width: 720px) {
  .topbar { padding: 14px 16px; }
  .topbar-stats { gap: 16px; }
  main { padding: 16px; }
  .col-detail { display: none; }
  thead th:nth-child(4), td:nth-child(4) { display: none; } /* host column on very small screens */
}

/* keyboard focus visibility */
a:focus-visible,
button:focus-visible,
input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
