:root {
  --bg: #020617;
  --bg-elev: #0b1220;
  --panel: #0f172a;
  --panel-2: #111827;
  --border: #1e293b;
  --border-strong: #334155;
  --text: #f8fafc;
  --muted: #94a3b8;
  --faint: #64748b;
  --accent: #22c55e;
  --accent-dim: rgba(34, 197, 94, 0.14);
  --accent-ink: #052e16;
  --danger: #ef4444;
  --danger-dim: rgba(239, 68, 68, 0.12);
  --warn: #f59e0b;
  --warn-dim: rgba(245, 158, 11, 0.12);
  --ok: #22c55e;
  --ok-dim: rgba(34, 197, 94, 0.12);
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 1px 0 rgba(255,255,255,0.04) inset, 0 18px 50px rgba(0,0,0,0.35);
  --font: "IBM Plex Sans", system-ui, -apple-system, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --pad: clamp(16px, 3vw, 28px);
  --max: 1120px;
  --ease: 180ms ease;
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background:
    radial-gradient(900px 480px at 0% -10%, rgba(34, 197, 94, 0.07), transparent 55%),
    radial-gradient(700px 400px at 100% 0%, rgba(56, 189, 248, 0.05), transparent 50%),
    var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code, .mono { font-family: var(--mono); font-size: 0.86em; }
button, .btn { font-family: inherit; }
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.skip {
  position: absolute; left: -999px; top: 0;
  background: var(--accent); color: var(--accent-ink); padding: 8px 12px; z-index: 100;
}
.skip:focus { left: 12px; top: 12px; }

/* —— auth —— */
.auth {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: var(--pad);
}
.auth-card {
  width: min(400px, 100%);
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) + 2px);
  padding: 28px 26px 22px;
  box-shadow: var(--shadow);
}
.auth-brand { margin-bottom: 22px; }
.stack { display: grid; gap: 14px; }
label { display: grid; gap: 6px; color: var(--muted); font-size: 0.9rem; font-weight: 500; }
input {
  width: 100%;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--bg);
  color: var(--text);
  padding: 12px 14px;
  font-size: 1rem;
  transition: border-color var(--ease), box-shadow var(--ease);
}
input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}
.alert {
  background: var(--danger-dim);
  border: 1px solid rgba(239, 68, 68, 0.35);
  color: #fecaca;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  margin-bottom: 14px;
  font-size: 0.92rem;
}
.fine { color: var(--faint); font-size: 0.8rem; margin: 18px 0 0; }

/* —— chrome —— */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 12px var(--pad);
  border-bottom: 1px solid var(--border);
  background: rgba(2, 6, 23, 0.82);
  backdrop-filter: blur(12px);
}
.brand, .auth-brand, .topbar-right, .who, .pulse, .title-row, .card-top, .actions, .summary {
  display: flex;
  align-items: center;
}
.brand { gap: 12px; }
.mark {
  width: 36px; height: 36px;
  border-radius: 10px;
  display: grid; place-items: center;
  font-family: var(--mono);
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--accent);
  background: var(--accent-dim);
  border: 1px solid rgba(34, 197, 94, 0.25);
}
.brand-text { display: flex; flex-direction: column; gap: 1px; }
.brand-name { font-weight: 600; letter-spacing: -0.02em; line-height: 1.2; }
.brand-sub { color: var(--faint); font-size: 0.75rem; font-family: var(--mono); }
.topbar-right { gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.who { gap: 8px; color: var(--muted); font-size: 0.9rem; }
.who-name { color: var(--text); font-weight: 500; }
.chip {
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  color: var(--muted);
  background: var(--bg-elev);
}
.pulse { gap: 8px; color: var(--muted); font-size: 0.78rem; font-family: var(--mono); }
.pulse .dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.5);
  animation: pulse 2.4s ease-out infinite;
}
.pulse.stale .dot { background: var(--warn); animation: none; }
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.45); }
  70% { box-shadow: 0 0 0 10px rgba(34, 197, 94, 0); }
  100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); }
}
@media (prefers-reduced-motion: reduce) {
  .pulse .dot { animation: none; }
  * { transition: none !important; }
}

/* —— buttons —— */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 40px;
  padding: 0 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--panel-2);
  color: var(--text);
  font-weight: 550;
  font-size: 0.9rem;
  cursor: pointer;
  text-decoration: none;
  transition: background var(--ease), border-color var(--ease), transform var(--ease);
}
.btn:hover { border-color: #475569; background: #1a2438; text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.55; cursor: wait; }
.btn.primary {
  background: var(--accent);
  color: var(--accent-ink);
  border-color: transparent;
  font-weight: 650;
}
.btn.primary:hover { filter: brightness(1.05); background: var(--accent); }
.btn.ghost { background: transparent; min-height: 36px; }
.btn.wide { width: 100%; min-height: 44px; }
.btn.tiny { min-height: 32px; padding: 0 10px; font-size: 0.8rem; }

/* —— layout —— */
.shell {
  width: min(var(--max), calc(100% - 2 * var(--pad)));
  margin: 0 auto;
  padding: 28px 0 56px;
}
.intro {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: flex-end;
  flex-wrap: wrap;
  margin-bottom: 32px;
}
.eyebrow {
  margin: 0 0 8px;
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
}
.intro h1 {
  margin: 0 0 8px;
  font-size: clamp(1.6rem, 3.2vw, 2.15rem);
  letter-spacing: -0.035em;
  font-weight: 650;
  line-height: 1.15;
}
.lede { margin: 0; max-width: 36rem; color: var(--muted); }
.summary {
  gap: 10px;
  flex-wrap: wrap;
}
.stat {
  min-width: 76px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--panel);
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.stat.host { min-width: 120px; }
.stat-n {
  font-family: var(--mono);
  font-size: 1.35rem;
  font-weight: 600;
  letter-spacing: -0.03em;
  color: var(--ok);
  line-height: 1.1;
}
.stat-n.bad { color: var(--danger); }
.stat-n.muted { color: var(--muted); }
.stat-n.sm { font-size: 1.05rem; color: var(--text); }
.stat-l { font-size: 0.72rem; color: var(--faint); text-transform: uppercase; letter-spacing: 0.05em; }

.block { margin-bottom: 34px; }
.block-head { margin-bottom: 14px; }
.block-head h2 {
  margin: 0 0 4px;
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.block-head p { margin: 0; color: var(--faint); font-size: 0.88rem; }

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 12px;
}
.cards.toolcore {
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}
.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 16px 14px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 168px;
  transition: border-color var(--ease);
}
.card:hover { border-color: #2d3b52; }
.card.tool { min-height: 190px; }
.card[data-status="down"] { border-color: rgba(239, 68, 68, 0.35); }
.card-top { justify-content: space-between; gap: 10px; align-items: flex-start; }
.title-row { gap: 8px; flex-wrap: wrap; }
.card h3 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}
.kind {
  font-size: 0.7rem;
  color: var(--faint);
  font-family: var(--mono);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.badge {
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 2px 7px;
  border-radius: 999px;
  border: 1px solid rgba(34, 197, 94, 0.3);
  color: var(--accent);
  background: var(--accent-dim);
}
.badge.b {
  border-color: rgba(56, 189, 248, 0.3);
  color: #38bdf8;
  background: rgba(56, 189, 248, 0.12);
}
.status {
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--muted);
  white-space: nowrap;
}
.status.s-up { color: var(--ok); background: var(--ok-dim); border-color: rgba(34,197,94,0.3); }
.status.s-down { color: var(--danger); background: var(--danger-dim); border-color: rgba(239,68,68,0.35); }
.status.s-external { color: var(--muted); background: rgba(148,163,184,0.08); }
.blurb {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  flex: 1;
}
.meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  align-items: center;
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--faint);
}
.cname { color: var(--faint); max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.actions {
  gap: 8px;
  flex-wrap: wrap;
  margin-top: auto;
  padding-top: 4px;
}
.hint { color: var(--faint); font-size: 0.82rem; }

.table-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
th, td {
  text-align: left;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
th {
  color: var(--faint);
  font-weight: 600;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  background: var(--bg-elev);
}
tr:last-child td { border-bottom: 0; }
.muted { color: var(--muted); }
.small { font-size: 0.82rem; }
.row-actions { text-align: right; white-space: nowrap; }
.warn { color: var(--warn); padding: 16px; margin: 0; }

.foot {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 18px;
  color: var(--faint);
  font-size: 0.78rem;
  font-family: var(--mono);
  padding-top: 8px;
  border-top: 1px solid var(--border);
}

.toast {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 50;
  max-width: min(360px, calc(100vw - 32px));
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--panel);
  box-shadow: var(--shadow);
  font-size: 0.9rem;
}
.toast.ok { border-color: rgba(34,197,94,0.4); }
.toast.err { border-color: rgba(239,68,68,0.45); color: #fecaca; }

@media (max-width: 720px) {
  .topbar { align-items: flex-start; flex-direction: column; }
  .intro { align-items: stretch; }
  .stat.host { flex: 1; }
}
