:root {
  --bg: #f5f7f8; --card: #ffffff; --text: #14201f; --muted: #5d6b69; --line: #dfe5e4;
  --brand: #0f766e; --brand-text: #ffffff; --ok: #15803d; --ok-bg: #dcfce7;
  --warn: #b45309; --warn-bg: #fef3c7; --bad: #b91c1c; --bad-bg: #fee2e2; --idle-bg: #e7ecec;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e1514; --card: #172120; --text: #e6eeed; --muted: #9bb0ad; --line: #2a3a38;
    --brand: #2dd4bf; --brand-text: #04211e; --ok: #4ade80; --ok-bg: #12301c;
    --warn: #fbbf24; --warn-bg: #3a2b0a; --bad: #f87171; --bad-bg: #3b1515; --idle-bg: #223130;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  padding: env(safe-area-inset-top, 0) env(safe-area-inset-right, 0) env(safe-area-inset-bottom, 0) env(safe-area-inset-left, 0);
}
.wrap { max-width: 760px; margin: 0 auto; padding: 14px 14px 40px; }
header.top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 10px 0 14px; }
header.top h1 { font-size: 18px; margin: 0 auto 0 0; }
nav { display: flex; gap: 6px; flex-wrap: wrap; }
nav button, nav a { all: unset; cursor: pointer; padding: 8px 12px; border-radius: 10px; font-size: 15px; color: var(--muted); }
nav .on { background: var(--card); color: var(--text); font-weight: 600; box-shadow: 0 0 0 1px var(--line); }
h2 { font-size: 15px; margin: 22px 0 8px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 14px; margin: 0 0 10px; }
a.card { display: block; color: inherit; text-decoration: none; }
a.card:active { opacity: .85; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.grow { flex: 1 1 auto; min-width: 0; }
.title { font-weight: 650; overflow-wrap: anywhere; }
.muted { color: var(--muted); font-size: 14px; overflow-wrap: anywhere; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 12px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 10px 12px; }
.stat b { display: block; font-size: 24px; line-height: 1.1; }
.stat span { color: var(--muted); font-size: 13px; }
.badge { display: inline-block; font-size: 12.5px; font-weight: 600; padding: 3px 9px; border-radius: 99px; background: var(--idle-bg); color: var(--muted); white-space: nowrap; }
.badge.ok { background: var(--ok-bg); color: var(--ok); }
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.bad { background: var(--bad-bg); color: var(--bad); }
button.btn, .btn {
  font: inherit; font-weight: 600; min-height: 44px; padding: 0 16px; border-radius: 12px; cursor: pointer;
  border: 1px solid var(--line); background: var(--card); color: var(--text);
}
button.primary { background: var(--brand); color: var(--brand-text); border-color: transparent; }
button.danger { color: var(--bad); }
button.danger.solid { background: var(--bad); color: #fff; border-color: transparent; }
button.small { min-height: 36px; padding: 0 12px; font-size: 14px; }
button:disabled { opacity: .55; cursor: default; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; margin: 12px 0 4px; }
.ev { display: flex; gap: 10px; padding: 9px 0; border-top: 1px solid var(--line); font-size: 14.5px; }
.ev:first-child { border-top: 0; }
.ev time { color: var(--muted); font-size: 13px; white-space: nowrap; margin-left: auto; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--muted); margin-top: 7px; flex: none; }
.dot.ok { background: var(--ok); } .dot.warn { background: var(--warn); } .dot.bad { background: var(--bad); }
.empty { text-align: center; color: var(--muted); padding: 26px 10px; }
.err { color: var(--bad); min-height: 1.3em; margin: 6px 0 0; font-size: 14.5px; }
.login { max-width: 380px; margin: 14vh auto 0; }
.login h1 { margin: 0 0 4px; font-size: 22px; }
dialog { border: 1px solid var(--line); border-radius: 16px; background: var(--card); color: var(--text); padding: 18px; width: min(440px, calc(100vw - 24px)); }
dialog::backdrop { background: rgba(0, 0, 0, .55); }
dialog h3 { margin: 0 0 6px; font-size: 18px; }
dialog p { margin: 0 0 10px; }
label { display: block; margin: 12px 0 0; }
label span { display: block; font-size: 14px; font-weight: 600; margin-bottom: 4px; }
label small { display: block; color: var(--muted); font-size: 13px; margin-top: 3px; }
input { font: inherit; width: 100%; min-height: 44px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg); color: var(--text); }
input:focus-visible, button:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.dlg-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px; }
.code { font: 700 32px/1.2 ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .08em; text-align: center; padding: 16px 8px; margin: 10px 0; border-radius: 12px; background: var(--bg); border: 1px dashed var(--brand); user-select: all; }
.center { text-align: center; }
