:root {
  --bg: #f5f6f8; --panel: #ffffff; --text: #111827; --muted: #6b7280; --line: #e5e7eb; --soft: #f3f4f6;
  --brand: #ea580c; --brand-dark: #c2410c; --good: #16a34a; --warn: #d97706; --bad: #dc2626; --info: #2563eb;
  --good-bg: #dcfce7; --warn-bg: #fef3c7; --bad-bg: #fee2e2; --info-bg: #dbeafe;
  --radius: 10px; --shadow: 0 1px 2px rgba(0,0,0,.05), 0 2px 8px rgba(0,0,0,.04);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1115; --panel: #181b21; --text: #e5e7eb; --muted: #9ca3af; --line: #2a2f38; --soft: #20242c;
    --good-bg: #14321f; --warn-bg: #3a2c0d; --bad-bg: #3b1515; --info-bg: #172554;
    --shadow: none; color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--brand); }
code { font: 12.5px ui-monospace, SFMono-Regular, Consolas, monospace; background: var(--soft); padding: 1px 5px; border-radius: 4px; word-break: break-all; }
.boot { padding: 40px; color: var(--muted); }
h1 { font-size: 24px; margin: 0; }
h2 { font-size: 16px; margin: 0 0 12px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

/* shell */
.top { display: flex; align-items: center; gap: 18px; padding: 0 20px; height: 56px; background: var(--panel); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.logo { display: flex; align-items: center; gap: 9px; font-weight: 700; text-decoration: none; color: var(--text); }
.logo img { width: 26px; height: 26px; }
.nav { display: flex; gap: 2px; flex: 1; overflow-x: auto; }
.nav a { padding: 7px 12px; border-radius: 8px; color: var(--muted); text-decoration: none; white-space: nowrap; font-weight: 500; }
.nav a.on, .nav a:hover { background: var(--soft); color: var(--text); }
main { max-width: 1180px; margin: 0 auto; padding: 24px 20px 60px; }
.head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.head h1 { flex: 1; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); margin-bottom: 18px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.grid2 > .card { margin-bottom: 0; }
@media (max-width: 820px) { .grid2 { grid-template-columns: 1fr; } .top { gap: 10px; padding: 0 12px; } .logo span { display: none; } main { padding: 16px 12px 50px; } }

/* controls */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: 8px; border: 1px solid var(--line); background: var(--panel); color: var(--text); font: inherit; font-weight: 500; cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { background: var(--soft); }
.btn:disabled { opacity: .55; cursor: default; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-dark); }
.btn.danger { color: var(--bad); }
.btn.sm { padding: 5px 10px; font-size: 13px; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
label.field { display: block; margin-bottom: 14px; }
label.field > span { display: block; font-weight: 600; font-size: 13.5px; margin-bottom: 5px; }
label.field small { display: block; color: var(--muted); font-size: 12.5px; margin-top: 4px; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=url], textarea, select {
  width: 100%; padding: 9px 11px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); color: var(--text); font: inherit;
}
textarea { resize: vertical; }
input:focus, textarea:focus, select:focus, .btn:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }
.check { display: flex; gap: 8px; align-items: center; margin-bottom: 14px; }

/* badges and dots */
.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--soft); color: var(--muted); white-space: nowrap; }
.badge.good { background: var(--good-bg); color: var(--good); } .badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.bad { background: var(--bad-bg); color: var(--bad); } .badge.info { background: var(--info-bg); color: var(--info); }
.dot { width: 11px; height: 11px; border-radius: 50%; display: inline-block; background: var(--muted); flex: none; }
.dot.up { background: var(--good); box-shadow: 0 0 0 3px var(--good-bg); } .dot.down { background: var(--bad); box-shadow: 0 0 0 3px var(--bad-bg); }
.good { color: var(--good); } .warn { color: var(--warn); } .bad { color: var(--bad); }

/* sites */
.sites { display: grid; gap: 12px; }
.site { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); display: grid; grid-template-columns: minmax(200px, 1.4fr) repeat(5, minmax(90px, 1fr)) auto; gap: 14px; align-items: center; }
.site .name { display: flex; gap: 10px; align-items: center; min-width: 0; }
.site .name a { font-weight: 650; color: var(--text); text-decoration: none; }
.site .name a:hover { text-decoration: underline; }
.site .name .url { color: var(--muted); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stat { font-size: 13.5px; min-width: 0; }
.stat b { display: block; font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; }
@media (max-width: 1000px) { .site { grid-template-columns: 1fr 1fr 1fr; } .site .name { grid-column: 1 / -1; } .site .acts { grid-column: 1 / -1; } }
.empty { text-align: center; padding: 50px 20px; color: var(--muted); }

/* lists */
.list > div { display: flex; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); align-items: baseline; }
.list > div:first-child { border-top: 0; }
.list .when { color: var(--muted); font-size: 12.5px; white-space: nowrap; margin-left: auto; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; font-size: 14px; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.strip { display: flex; gap: 1px; height: 34px; align-items: flex-end; margin: 6px 0 4px; }
.strip i { flex: 1; min-width: 1px; background: var(--good); border-radius: 1px; opacity: .8; }
.strip i.part { background: var(--warn); } .strip i.none { background: var(--bad); } .strip i.gap { background: var(--line); height: 6px !important; }

/* job, toasts, modal */
.job { border-left: 4px solid var(--info); }
.job .item { display: flex; gap: 10px; font-size: 14px; padding: 4px 0; }
#toasts { position: fixed; bottom: 18px; right: 18px; display: grid; gap: 8px; z-index: 50; }
.toast { background: #111827; color: #fff; padding: 10px 14px; border-radius: 8px; box-shadow: 0 6px 20px rgba(0,0,0,.25); max-width: 380px; font-size: 14px; }
.toast.error { background: var(--bad); }
.modal-bg { position: fixed; inset: 0; background: rgba(0,0,0,.45); display: grid; place-items: center; z-index: 40; padding: 16px; }
.modal { background: var(--panel); border-radius: 12px; width: min(560px, 100%); max-height: 90vh; overflow: auto; padding: 22px; box-shadow: 0 20px 50px rgba(0,0,0,.3); }
.modal h2 { font-size: 18px; }
.modal .row { justify-content: flex-end; margin-top: 8px; }

/* auth */
.auth { max-width: 420px; margin: 8vh auto; padding: 0 16px; }
.auth .card { padding: 26px; }
.auth h1 { margin-bottom: 6px; display: flex; gap: 10px; align-items: center; }
.auth h1 img { width: 32px; }
.qr { background: #fff; padding: 10px; border-radius: 8px; width: 200px; margin: 10px 0; }
.codes { columns: 2; font: 14px ui-monospace, Consolas, monospace; background: var(--soft); padding: 12px; border-radius: 8px; }
.error-box { background: var(--bad-bg); color: var(--bad); padding: 9px 12px; border-radius: 8px; margin-bottom: 12px; font-size: 14px; }
pre.json { background: var(--soft); padding: 12px; border-radius: 8px; overflow: auto; font-size: 12.5px; max-height: 360px; }
