:root {
  --bg: #f4f5f7;
  --surface: #ffffff;
  --surface-2: #f8f9fb;
  --border: #e3e6eb;
  --text: #1c2230;
  --muted: #677085;
  --accent: #2563eb;
  --accent-ink: #ffffff;
  --accent-soft: #e8efff;
  --ok: #15803d;
  --ok-soft: #e7f6ec;
  --bad: #c2410c;
  --bad-soft: #fdeee6;
  --warn: #a16207;
  --warn-soft: #fdf6e3;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f131a;
    --surface: #171c25;
    --surface-2: #1d2330;
    --border: #2a3242;
    --text: #e6e9ef;
    --muted: #9aa3b5;
    --accent: #5b8cff;
    --accent-ink: #0b1020;
    --accent-soft: #1d2a4a;
    --ok: #4ade80;
    --ok-soft: #12301f;
    --bad: #fb8a5a;
    --bad-soft: #3a1d12;
    --warn: #facc15;
    --warn-soft: #33290d;
    --shadow: none;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font: 15px/1.5 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code, .mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .88em; }
h1 { font-size: 1.45rem; margin: 0 0 .25rem; letter-spacing: -.01em; }
h2 { font-size: 1.08rem; margin: 0 0 .75rem; }
h3 { font-size: .95rem; margin: 0 0 .4rem; }
p { margin: 0 0 .75rem; }
.muted { color: var(--muted); }
.small { font-size: .86rem; }

/* ---------- layout ---------- */
.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 10;
}
.topbar-inner {
  max-width: 1080px; margin: 0 auto; padding: 0 16px;
  display: flex; align-items: center; gap: 16px; min-height: 56px; flex-wrap: wrap;
}
.brand { font-weight: 700; color: var(--text); display: flex; align-items: center; gap: 8px; }
.brand:hover { text-decoration: none; }
.brand-mark {
  width: 26px; height: 26px; border-radius: 7px; background: var(--accent); color: var(--accent-ink);
  display: grid; place-items: center; font-size: 14px;
}
.nav { display: flex; gap: 2px; flex: 1; overflow-x: auto; scrollbar-width: none; }
.nav a {
  color: var(--muted); padding: 6px 10px; border-radius: 7px; white-space: nowrap; font-weight: 500;
}
.nav a:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.nav a.active { color: var(--accent); background: var(--accent-soft); }
.logout { margin-left: auto; }
@media (max-width: 640px) {
  .nav { order: 3; flex-basis: 100%; padding-bottom: 8px; }
}

.container { max-width: 1080px; margin: 0 auto; padding: 24px 16px 64px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head p { margin: 0; }
.stack > * + * { margin-top: 16px; }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }

/* ---------- cards ---------- */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px; box-shadow: var(--shadow);
}
.card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; margin-bottom: 10px; }
.card-head h2, .card-head h3 { margin: 0; }
.stat { font-size: 1.6rem; font-weight: 700; line-height: 1.2; }

/* ---------- buttons & forms ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 14px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); font: inherit; font-weight: 600; font-size: .9rem;
  cursor: pointer; white-space: nowrap; line-height: 1.3;
}
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: var(--accent); filter: brightness(1.08); }
.btn-danger { color: var(--bad); }
.btn-sm { padding: 5px 10px; font-size: .83rem; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
form.inline { display: inline; }

label { display: block; font-weight: 600; font-size: .9rem; margin-bottom: 5px; }
.field { margin-bottom: 16px; }
.hint { color: var(--muted); font-size: .84rem; margin-top: 4px; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=url], input[type=time], select, textarea {
  width: 100%; padding: 9px 11px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); font: inherit;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
.check { display: flex; gap: 8px; align-items: flex-start; font-weight: 500; }
.check input { margin-top: 4px; }
.error { color: var(--bad); font-size: .85rem; margin-top: 4px; }
.form-card { max-width: 640px; }

/* ---------- badges, alerts ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 999px;
  font-size: .78rem; font-weight: 600; background: var(--surface-2); color: var(--muted); white-space: nowrap;
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-success { background: var(--ok-soft); color: var(--ok); }
.badge-failed { background: var(--bad-soft); color: var(--bad); }
.badge-running, .badge-queued { background: var(--accent-soft); color: var(--accent); }
.badge-off { background: var(--surface-2); color: var(--muted); }

.alert { padding: 12px 14px; border-radius: 9px; margin-bottom: 18px; border: 1px solid transparent; }
.alert-success { background: var(--ok-soft); color: var(--ok); }
.alert-error { background: var(--bad-soft); color: var(--bad); }
.alert-warn { background: var(--warn-soft); color: var(--warn); }
.alert ul { margin: 0; padding-left: 18px; }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; margin: 0 -18px -18px; }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th, td { text-align: left; padding: 10px 18px; border-top: 1px solid var(--border); vertical-align: middle; }
th { font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; background: var(--surface-2); }
td.actions { text-align: right; white-space: nowrap; }
.empty { text-align: center; padding: 28px 12px; color: var(--muted); }

/* ---------- checklist ---------- */
.steps { list-style: none; margin: 0; padding: 0; }
.steps li { display: flex; gap: 12px; padding: 10px 0; border-top: 1px solid var(--border); align-items: flex-start; }
.steps li:first-child { border-top: 0; }
.step-dot {
  flex: none; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center;
  font-size: .8rem; font-weight: 700; background: var(--surface-2); color: var(--muted); border: 1px solid var(--border);
}
.steps li.done .step-dot { background: var(--ok); border-color: var(--ok); color: var(--surface); }
.steps li.done .step-title { color: var(--muted); text-decoration: line-through; }
.step-title { font-weight: 600; }

/* ---------- code / copy ---------- */
.copybox { display: flex; gap: 8px; align-items: stretch; }
.copybox code {
  flex: 1; display: block; padding: 9px 11px; background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 8px; overflow-x: auto; white-space: nowrap;
}
.copybox.wrap code { white-space: pre-wrap; word-break: break-all; }
pre.log {
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: 12px;
  overflow-x: auto; font-size: .84rem; margin: 0; white-space: pre-wrap;
}

/* ---------- site cards ---------- */
.site-card .meta { font-size: .86rem; color: var(--muted); }
.site-card .meta div { display: flex; justify-content: space-between; gap: 8px; padding: 3px 0; }
.site-card .meta strong { color: var(--text); font-weight: 600; }

/* ---------- auth pages ---------- */
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.auth-card { width: 100%; max-width: 420px; }

/* pagination */
.pager { display: flex; justify-content: space-between; align-items: center; margin-top: 14px; gap: 8px; }
