:root {
  --bg: #0d1117;
  --bg-card: #161b22;
  --bg-elev: #1c2330;
  --border: #2a313c;
  --text: #e6edf3;
  --muted: #8b949e;
  --accent: #3b82f6;
  --ok: #3fb950;
  --warn: #d29922;
  --crit: #f85149;
  --down: #58a6ff;
  --up: #bc8cff;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(0,0,0,.4);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
}

.muted { color: var(--muted); }
.small { font-size: 12px; }
.hidden { display: none !important; }

/* ───────── Login ───────── */
.login-body {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh; padding: 20px;
}
.login-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 16px; padding: 36px 32px; width: 320px;
  display: flex; flex-direction: column; gap: 14px; text-align: center;
  box-shadow: var(--shadow);
}
.login-logo { font-size: 40px; }
.login-card h1 { margin: 0; font-size: 20px; }
.login-card p { margin: 0; }
.login-card input, .login-card button {
  padding: 12px 14px; border-radius: 8px; font-size: 15px;
}
.login-card input {
  background: var(--bg); border: 1px solid var(--border); color: var(--text);
}
.login-card input:focus { outline: 2px solid var(--accent); border-color: var(--accent); }
.login-card button {
  background: var(--accent); color: #fff; border: none; cursor: pointer;
  font-weight: 600;
}
.login-card button:hover { background: #2f6fd6; }
.login-error { color: var(--crit); min-height: 18px; font-size: 13px; }

/* ───────── Topbar ───────── */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 22px; background: var(--bg-card);
  border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 10;
}
.brand { display: flex; align-items: center; gap: 12px; }
.logo { font-size: 26px; }
.title { font-weight: 700; font-size: 16px; }
.subtitle { color: var(--muted); font-size: 12px; }
.topbar-right { display: flex; align-items: center; gap: 22px; }
.stat-inline { display: flex; flex-direction: column; font-size: 12px; }
.stat-inline strong { font-size: 14px; }
.conn-ok { color: var(--ok); }
.conn-bad { color: var(--crit); }
.btn-ghost {
  background: transparent; border: 1px solid var(--border); color: var(--muted);
  padding: 7px 14px; border-radius: 8px; cursor: pointer; font-size: 13px;
}
.btn-ghost:hover { color: var(--text); border-color: var(--muted); }

/* ───────── Alerts ───────── */
.alert-bar {
  margin: 14px 22px 0; padding: 12px 16px; border-radius: var(--radius);
  background: rgba(248,81,73,.08); border: 1px solid rgba(248,81,73,.3);
  display: flex; flex-direction: column; gap: 6px;
}
.alert-item { display: flex; align-items: center; gap: 8px; }
.alert-dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.alert-critical .alert-dot { background: var(--crit); }
.alert-warning .alert-dot { background: var(--warn); }
.alert-info .alert-dot { background: var(--down); }

/* ───────── Grid ───────── */
.grid {
  display: grid; gap: 16px; padding: 18px 22px;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
}
.card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow);
}
.card h2 { margin: 0 0 12px; font-size: 14px; font-weight: 600; }
.card.wide { grid-column: span 2; }
@media (max-width: 720px) { .card.wide { grid-column: span 1; } }

.metric-head { display: flex; justify-content: space-between; align-items: baseline; }
.metric-head h2 { margin: 0; }

/* ───────── Gauge ───────── */
.gauge { position: relative; width: 120px; height: 120px; margin: 8px auto 4px; }
.gauge-svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.gauge-bg { fill: none; stroke: var(--bg-elev); stroke-width: 10; }
.gauge-fg { fill: none; stroke: var(--accent); stroke-width: 10; stroke-linecap: round;
  transition: stroke-dashoffset .4s ease, stroke .4s ease; }
.gauge-label {
  position: absolute; inset: 0; display: flex; align-items: center;
  justify-content: center; flex-direction: column; font-size: 26px; font-weight: 700;
}
.gauge-label small { font-size: 13px; color: var(--muted); font-weight: 400; }

/* ───────── Sparkline ───────── */
.spark { width: 100%; display: block; margin-top: 8px; }

/* ───────── Bars ───────── */
.bar { height: 6px; background: var(--bg-elev); border-radius: 4px; overflow: hidden; margin-top: 10px; }
.bar-fill { height: 100%; width: 0%; background: var(--up); transition: width .4s ease; }

/* ───────── Netzwerk ───────── */
.net-vals { display: flex; justify-content: space-around; margin: 14px 0 4px; }
.net-vals span { font-size: 20px; font-weight: 700; display: block; }
.net-vals small { color: var(--muted); }
.net-down { color: var(--down); }
.net-up { color: var(--up); }

/* ───────── Load ───────── */
.load-row { display: flex; justify-content: space-around; text-align: center; margin: 8px 0; }
.load-row strong { font-size: 20px; display: block; }
.load-row small { color: var(--muted); }
.cores { display: flex; gap: 3px; flex-wrap: wrap; margin-top: 10px; }
.core {
  flex: 1 1 14px; height: 26px; background: var(--bg-elev); border-radius: 3px;
  position: relative; overflow: hidden; min-width: 10px;
}
.core-fill { position: absolute; bottom: 0; left: 0; right: 0; background: var(--accent);
  transition: height .4s ease, background .4s ease; }

/* ───────── Disks ───────── */
.disk-row { margin-bottom: 12px; }
.disk-row:last-child { margin-bottom: 0; }
.disk-meta { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 4px; }
.disk-meta .muted { font-size: 12px; }
.disk-track { height: 8px; background: var(--bg-elev); border-radius: 4px; overflow: hidden; }
.disk-fill { height: 100%; background: var(--ok); transition: width .4s ease; }

/* ───────── Pills ───────── */
.pill-list { display: flex; flex-direction: column; gap: 8px; }
.pill {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px;
  background: var(--bg-elev); border-radius: 8px; font-size: 13px;
}
.pill .dot { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.pill .name { font-weight: 600; }
.pill .meta { color: var(--muted); margin-left: auto; font-size: 12px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 55%; }
.f2b-ips { padding: 2px 4px 4px 19px; word-break: break-all; }
.dot-ok { background: var(--ok); }
.dot-warn { background: var(--warn); }
.dot-crit { background: var(--crit); }
.dot-idle { background: var(--muted); }

/* ───────── Tabelle ───────── */
.proc-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.proc-table th { text-align: left; color: var(--muted); font-weight: 500;
  padding: 6px 8px; border-bottom: 1px solid var(--border); }
.proc-table td { padding: 6px 8px; border-bottom: 1px solid var(--bg-elev); }
.proc-table tr:last-child td { border-bottom: none; }

/* ───────── Logs ───────── */
.logs {
  background: var(--bg); border: 1px solid var(--border); border-radius: 8px;
  padding: 12px; font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 12px; max-height: 240px; overflow: auto; white-space: pre-wrap;
  word-break: break-word; color: #c9d1d9; margin: 0;
}

.footer { padding: 10px 22px 24px; text-align: center; }
