:root {
  --bg: #0a0a0f;
  --surface: #12121a;
  --panel: #1a1a24;
  --card: #1e1e2e;
  --border: #2a2a3a;
  --text: #e8e8f0;
  --muted: #8a8aa0;
  --accent: #4fc3f7;
  --accent-dim: #3a9bc4;
  --warn: #ffb74d;
  --danger: #ef5350;
  --success: #66bb6a;
  --info: #9575cd;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

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

html, body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

header {
  background: var(--surface);
  padding: 0.75rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

header h1 {
  font-size: 1.1rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

header .meta {
  color: var(--muted);
  font-size: 0.8rem;
  margin-top: 0.1rem;
}

nav a {
  color: var(--muted);
  text-decoration: none;
  margin-left: 1.5rem;
  font-size: 0.85rem;
  font-weight: 500;
  transition: color 0.2s;
}

nav a:hover, nav a.active {
  color: var(--accent);
}

main {
  padding: 1.5rem;
  max-width: 1400px;
  margin: 0 auto;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.grid-2 { grid-template-columns: repeat(auto-fit, minmax(380px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }

.card {
  background: var(--card);
  border-radius: 0.75rem;
  padding: 1.25rem;
  border: 1px solid var(--border);
  transition: border-color 0.2s;
}

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

.card h3 {
  margin: 0 0 0.75rem;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  font-weight: 600;
}

.metric {
  font-size: 2rem;
  font-weight: 700;
  color: var(--text);
}

.metric.small { font-size: 1.25rem; }

.metric-label {
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 0.25rem;
}

.status-dot {
  display: inline-block;
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 999px;
  margin-right: 0.4rem;
}

.status-online { background: var(--success); }
.status-offline { background: var(--danger); }
.status-idle { background: var(--warn); }

.badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 600;
}

.badge-ok { background: rgba(102,187,106,0.15); color: var(--success); }
.badge-warn { background: rgba(255,183,77,0.15); color: var(--warn); }
.badge-alert { background: rgba(239,83,80,0.15); color: var(--danger); }
.badge-info { background: rgba(149,117,205,0.15); color: var(--info); }

.badge-accent { background: rgba(79,195,247,0.15); color: var(--accent); }

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

th, td {
  text-align: left;
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid var(--border);
}

th {
  color: var(--muted);
  font-weight: 500;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.right { text-align: right; }

.chart-wrap {
  height: 220px;
  position: relative;
}

.section-title {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 1rem;
  color: var(--text);
}

.section-subtitle {
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 1.5rem;
}

.app-card {
  background: var(--card);
  border-radius: 0.75rem;
  padding: 1.25rem;
  border: 1px solid var(--border);
  margin-bottom: 1rem;
}

.app-card h4 {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: var(--accent);
}

.app-card p {
  font-size: 0.85rem;
  color: var(--muted);
  line-height: 1.5;
}

.stat-highlight {
  display: inline-block;
  background: var(--surface);
  border-radius: 0.5rem;
  padding: 0.5rem 1rem;
  margin-top: 0.75rem;
  border: 1px solid var(--border);
}

.stat-highlight .value {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--accent);
}

.stat-highlight .label {
  font-size: 0.7rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.empty-state {
  color: var(--muted);
  font-size: 0.85rem;
  padding: 2rem;
  text-align: center;
}

.btn {
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 0.4rem 0.8rem;
  border-radius: 0.4rem;
  cursor: pointer;
  font-size: 0.8rem;
  font-family: var(--font);
  transition: all 0.2s;
}

.btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

a.row-link {
  color: var(--accent);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 500;
}

a.row-link:hover {
  text-decoration: underline;
}

.filters {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
  align-items: center;
}

select {
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 0.35rem 0.75rem;
  border-radius: 0.4rem;
  font-family: var(--font);
  font-size: 0.85rem;
}

.param-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 0.5rem;
}

.param-item {
  background: var(--surface);
  border-radius: 0.5rem;
  padding: 0.75rem;
  border: 1px solid var(--border);
}

.param-item .name {
  font-size: 0.8rem;
  color: var(--muted);
}

.param-item .unit {
  font-size: 0.7rem;
  color: var(--muted);
  opacity: 0.7;
}

.progress-bar {
  height: 4px;
  background: var(--surface);
  border-radius: 2px;
  margin-top: 0.5rem;
  overflow: hidden;
}

.progress-bar .fill {
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
  transition: width 0.3s;
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg);
}

::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--muted);
}

@media (max-width: 768px) {
  header { flex-direction: column; align-items: flex-start; gap: 0.5rem; }
  nav { margin-left: 0; }
  nav a { margin-left: 0; margin-right: 1rem; }
  main { padding: 1rem; }
  .grid { grid-template-columns: 1fr; }
}
