:root {
  --bg: #0d0f12;
  --panel: #14181d;
  --panel-2: #1a1f26;
  --line: #262c35;
  --fg: #e6e9ee;
  --muted: #8b95a3;
  --accent: #6ea8fe;
  --ok: #3fb950;
  --warn: #d29922;
  --crit: #f85149;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 15px/1.5 ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
}

body.centered {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

h1 { font-size: 22px; margin: 0 0 4px; }
h2 { font-size: 15px; margin: 0 0 12px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }

.sub { color: var(--muted); margin: 0 0 20px; }
.hint { color: var(--muted); font-size: 13px; }
.empty { color: var(--muted); }

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 24px; border-bottom: 1px solid var(--line); background: var(--panel);
}
.brand { font-weight: 700; color: var(--fg); }
.topbar nav { display: flex; gap: 16px; align-items: center; }

main { max-width: 1100px; margin: 0 auto; padding: 24px; }
main.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px;
  padding: 32px; width: min(420px, 92vw); text-align: center;
}
main.card .stack { display: block; text-align: left; margin-bottom: 12px; color: var(--muted); font-size: 13px; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; margin-bottom: 28px; }

.host {
  display: block; background: var(--panel); border: 1px solid var(--line);
  border-radius: 10px; padding: 14px; color: var(--fg);
}
.host:hover { border-color: var(--accent); text-decoration: none; }
.host-head { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.host-name { font-weight: 600; }
.host-ip { color: var(--muted); font-size: 12px; margin-left: auto; font-variant-numeric: tabular-nums; }

.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); flex: 0 0 auto; }
.host.online .dot { background: var(--ok); }
.host.offline .dot { background: var(--crit); }
.host.pending .dot { background: var(--warn); }

.metrics { display: grid; gap: 6px; }
.metric { display: grid; grid-template-columns: 40px 1fr 46px; align-items: center; gap: 8px; font-size: 12px; }
.metric .label { color: var(--muted); }
.metric .val { text-align: right; font-variant-numeric: tabular-nums; }
.bar { height: 6px; background: var(--panel-2); border-radius: 3px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--ok); }
.bar i.warn { background: var(--warn); }
.bar i.crit { background: var(--crit); }

.host-foot { display: flex; gap: 12px; margin-top: 12px; color: var(--muted); font-size: 12px; }
.tags { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.tag { background: var(--panel-2); border: 1px solid var(--line); border-radius: 999px; padding: 1px 8px; font-size: 11px; color: var(--muted); }

.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 18px; margin-bottom: 16px; }
.panel.danger { border-color: #4a1f1f; }

.host-form { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; align-items: end; }
.host-form label, .stack { display: grid; gap: 4px; font-size: 13px; color: var(--muted); }
.host-form .wide { grid-column: 1 / -1; }
.host-form button { grid-column: 1 / -1; justify-self: start; }

input, textarea {
  background: var(--panel-2); border: 1px solid var(--line); color: var(--fg);
  border-radius: 6px; padding: 8px 10px; font: inherit; width: 100%;
}
input:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; }

button {
  background: var(--panel-2); border: 1px solid var(--line); color: var(--fg);
  border-radius: 6px; padding: 8px 14px; font: inherit; cursor: pointer;
}
button:hover { border-color: var(--accent); }
button.primary { background: var(--accent); border-color: var(--accent); color: #0d0f12; font-weight: 600; width: 100%; }
button.danger { background: var(--crit); border-color: var(--crit); color: #fff; }
button.danger-outline { border-color: #4a1f1f; color: var(--crit); }
button.linkish { background: none; border: none; color: var(--accent); padding: 0; }

.badge { font-size: 11px; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); vertical-align: middle; }
.badge.online { color: var(--ok); border-color: var(--ok); }
.badge.offline { color: var(--crit); border-color: var(--crit); }
.badge.pending { color: var(--warn); border-color: var(--warn); }

.notice { background: var(--panel-2); border: 1px solid var(--warn); border-radius: 8px; padding: 14px; margin-bottom: 16px; }
.token, .cmd { display: block; background: #000; border: 1px solid var(--line); border-radius: 6px; padding: 10px; margin: 8px 0; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; overflow-x: auto; word-break: break-all; }

table { width: 100%; border-collapse: collapse; font-size: 13px; }
table th { text-align: left; color: var(--muted); font-weight: 500; }
.kv th { width: 120px; padding: 6px 0; }
.kv td { padding: 6px 0; font-variant-numeric: tabular-nums; }
.rows th, .rows td { padding: 8px 10px; border-bottom: 1px solid var(--line); }
.rows tbody tr:last-child td { border-bottom: none; }

.status { min-height: 20px; margin-top: 12px; color: var(--muted); font-size: 13px; }
.status.error { color: var(--crit); }

@media (max-width: 600px) {
  .host-form { grid-template-columns: 1fr; }
}
