:root {
  --bg: #f6f7f9;
  --panel: #ffffff;
  --ink: #16191d;
  --muted: #667085;
  --line: #e3e6ea;
  --accent: #2f6feb;
  --online: #12854a;
  --online-bg: #e6f5ec;
  --degraded: #a35a00;
  --degraded-bg: #fdf0dc;
  --offline: #667085;
  --offline-bg: #eceef1;
  --error: #b3261e;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14171a; --panel: #1c2025; --ink: #e8eaed; --muted: #9aa3ad;
    --line: #2c3138; --accent: #6ea3ff;
    --online: #5cd398; --online-bg: #12301f;
    --degraded: #ffbf5e; --degraded-bg: #3a2a10;
    --offline: #9aa3ad; --offline-bg: #23272d;
    --error: #ff8a80;
  }
}
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
code, pre, .mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }

header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 20px; background: var(--panel); border-bottom: 1px solid var(--line);
}
header h1 { font-size: 17px; margin: 0; letter-spacing: -0.01em; }
.header-right { display: flex; gap: 12px; align-items: center; }
main { max-width: 980px; margin: 0 auto; padding: 24px 20px 60px; }
section { margin-bottom: 36px; }
.section-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
h2 { font-size: 14px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin: 0; }
h3 { margin: 0 0 4px; font-size: 16px; }
.muted { color: var(--muted); }
.hint { color: var(--muted); font-size: 13px; margin: 4px 0 12px; }
.error { color: var(--error); font-size: 13px; margin: 8px 0 0; }

button {
  font: inherit; font-size: 14px; padding: 7px 14px; border-radius: 7px;
  border: 1px solid transparent; background: var(--accent); color: #fff; cursor: pointer;
}
button:hover { filter: brightness(1.07); }
button.ghost { background: transparent; color: var(--muted); border-color: var(--line); }
button.danger { background: transparent; color: var(--error); border-color: var(--line); }
button.tiny { padding: 3px 9px; font-size: 12px; }

input, textarea {
  font: inherit; width: 100%; padding: 8px 10px; border-radius: 7px;
  border: 1px solid var(--line); background: var(--bg); color: var(--ink);
}
textarea { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; }
label { display: block; font-size: 13px; font-weight: 600; margin: 12px 0 5px; }

.card {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 11px; padding: 16px 18px; margin-bottom: 12px;
}
.card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.hostname { font-size: 15px; font-weight: 600; }
.hostname a { color: inherit; text-decoration: none; }
.hostname a:hover { text-decoration: underline; }

.badge {
  display: inline-flex; align-items: center; gap: 6px; font-size: 12px;
  font-weight: 700; padding: 3px 10px; border-radius: 999px; text-transform: uppercase;
  letter-spacing: 0.04em;
}
.badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.badge.online   { color: var(--online);   background: var(--online-bg); }
.badge.degraded { color: var(--degraded); background: var(--degraded-bg); }
.badge.offline  { color: var(--offline);  background: var(--offline-bg); }

.badge-cert { font-size: 11px; padding: 2px 8px; border-radius: 999px; background: var(--offline-bg); color: var(--muted); }
.badge-cert.ready { color: var(--online); background: var(--online-bg); }
.badge-cert.provisioning { color: var(--degraded); background: var(--degraded-bg); }
.badge-cert.error { color: var(--error); background: var(--degraded-bg); }

.meta { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 13px; color: var(--muted); margin-top: 10px; }
.cmd {
  display: flex; gap: 8px; align-items: center; margin-top: 12px;
  background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px;
}
.cmd code { font-size: 12px; overflow-x: auto; white-space: nowrap; flex: 1; }
.keys { margin-top: 12px; border-top: 1px solid var(--line); padding-top: 10px; }
.key-row { display: flex; align-items: center; gap: 10px; font-size: 12.5px; padding: 4px 0; }
.key-row .fp { font-family: ui-monospace, monospace; color: var(--muted); overflow: hidden; text-overflow: ellipsis; }
.key-row .cmt { font-weight: 600; }
.spacer { flex: 1; }

.token { background: var(--bg); border: 1px solid var(--line); border-radius: 8px;
         padding: 12px; font-size: 13px; word-break: break-all; white-space: pre-wrap; }

dialog { border: 1px solid var(--line); border-radius: 12px; background: var(--panel);
         color: var(--ink); max-width: 520px; width: calc(100% - 32px); padding: 20px; }
dialog::backdrop { background: rgba(0,0,0,0.45); }
menu { display: flex; justify-content: flex-end; gap: 8px; padding: 0; margin: 18px 0 0; }

.login-page { display: grid; place-items: center; min-height: 100vh; }
.login-card { max-width: 340px; width: calc(100% - 32px); }
.login-card h1 { margin: 0 0 2px; }
.login-card button { width: 100%; margin-top: 18px; }
.empty { color: var(--muted); font-size: 14px; padding: 18px; text-align: center;
         border: 1px dashed var(--line); border-radius: 11px; }

/* utilities -- these exist because the CSP is style-src 'self', which blocks
   inline style="" attributes. Anything positional must be a class. */
.flush { margin: 0; }
.tight { margin: 8px 0 0; }
.mt8   { margin-top: 8px; }
.right { text-align: right; }
