:root {
  --bg: #10141a;
  --bg-vignette: #0a0d11;
  --surface: #1a2029;
  --surface-2: #212934;
  --border: #2a3340;
  --text: #e7e9ec;
  --text-muted: #8b95a3;
  --safelight: #ff6b47;
  --ok: #3ecf72;
  --ok-dim: #1f4d33;
  --warn: #f5a623;
  --warn-dim: #4d3a14;
  --error: #ef4b4b;
  --error-dim: #4d1f1f;
  --font-display: 'Space Grotesk', sans-serif;
  --font-body: 'Inter', sans-serif;
  --font-mono: 'IBM Plex Mono', monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: radial-gradient(circle at 50% -10%, #1b232d 0%, var(--bg) 45%, var(--bg-vignette) 100%);
  color: var(--text);
  font-family: var(--font-body);
  min-height: 100vh;
}

.grain {
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.035;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  z-index: 0;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 28px 40px 20px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: rgba(16, 20, 26, 0.88);
  backdrop-filter: blur(8px);
  z-index: 10;
}

.eyebrow {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.18em;
  color: var(--safelight);
  display: block;
  margin-bottom: 4px;
}

.topbar h1 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 26px;
  margin: 0;
  letter-spacing: -0.01em;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 28px;
}

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

.stat-num {
  font-family: var(--font-mono);
  font-size: 22px;
  font-weight: 600;
}

.stat-label {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

#stat-online { color: var(--ok); }
#stat-warn { color: var(--warn); }
#stat-offline { color: var(--text-muted); }

.clock {
  font-family: var(--font-mono);
  font-size: 14px;
  color: var(--text-muted);
  border-left: 1px solid var(--border);
  padding-left: 24px;
}

.grid {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 18px;
  padding: 28px 40px 60px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 20px;
  position: relative;
  overflow: hidden;
  transition: border-color 0.3s ease;
}

.card::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--ok);
}

.card.level-warning::before { background: var(--warn); }
.card.level-error::before { background: var(--error); }
.card.level-offline::before { background: var(--text-muted); }

.card.level-error { border-color: rgba(239, 75, 75, 0.4); }
.card.level-offline { opacity: 0.55; }

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

.card-name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 17px;
  margin: 0;
}

.card-loc {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-family: var(--font-mono);
  padding: 4px 10px;
  border-radius: 20px;
  white-space: nowrap;
  background: var(--ok-dim);
  color: var(--ok);
}

.status-pill .dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.status-pill.warning { background: var(--warn-dim); color: var(--warn); }
.status-pill.error { background: var(--error-dim); color: var(--error); }
.status-pill.offline { background: var(--surface-2); color: var(--text-muted); }

.status-text {
  font-size: 13px;
  color: var(--text-muted);
  margin: 10px 0 16px;
  line-height: 1.4;
  min-height: 18px;
}

.media-row {
  margin-bottom: 16px;
}

.media-label {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 6px;
  font-family: var(--font-mono);
}

.media-track {
  height: 10px;
  border-radius: 6px;
  background: var(--surface-2);
  overflow: hidden;
  position: relative;
  border: 1px solid var(--border);
}

.media-fill {
  height: 100%;
  border-radius: 6px 0 0 6px;
  background: linear-gradient(90deg, #2f9e5c, var(--ok));
  transition: width 0.4s ease;
}

.media-fill.low { background: linear-gradient(90deg, #b8791a, var(--warn)); }
.media-fill.critical { background: linear-gradient(90deg, #b23a3a, var(--error)); }

.meta-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 14px;
  padding-top: 14px;
  border-top: 1px dashed var(--border);
}

.meta-item .k {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 2px;
}

.meta-item .v {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text);
}

.last-seen {
  position: absolute;
  top: 18px;
  right: 20px;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-muted);
}

.empty-state {
  text-align: center;
  padding: 100px 20px;
  color: var(--text-muted);
}

.empty-title {
  font-family: var(--font-display);
  font-size: 18px;
  color: var(--text);
  margin-bottom: 6px;
}

.empty-sub {
  font-size: 13px;
}

@media (max-width: 560px) {
  .topbar { flex-direction: column; align-items: flex-start; gap: 14px; padding: 20px; }
  .topbar-right { width: 100%; justify-content: space-between; }
  .grid { padding: 20px; }
}
