:root {
  --bg: #f6f5f1; --surface: #ffffff; --ink: #1d2320; --muted: #5d6662; --line: #dcdcd4;
  --accent: #1f6f5c; --accent-ink: #ffffff; --danger: #b3261e; --danger-ink: #ffffff; --warn: #8a5a00; --ok: #1e6b35;
  --radius: 14px; --gap: 16px;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111513; --surface: #1b211e; --ink: #e8ece9; --muted: #a2aca7; --line: #2e3833;
    --accent: #5fc2a6; --accent-ink: #0b1a15; --danger: #ff8a80; --danger-ink: #2b0705; --warn: #e3b55a; --ok: #7bd393;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink);
  font: 17px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; }
body { padding-bottom: calc(72px + env(safe-area-inset-bottom)); }
.top { display: flex; align-items: baseline; justify-content: space-between; padding: calc(12px + env(safe-area-inset-top)) 16px 8px; }
.top h1 { font-size: 22px; margin: 0; }
.who { color: var(--muted); font-size: 15px; }
main { padding: 0 16px; max-width: 640px; margin: 0 auto; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin: 0 0 var(--gap); }
.card h2 { margin: 0 0 8px; font-size: 19px; }
.card h3 { margin: 16px 0 6px; font-size: 16px; }
.stack { display: grid; gap: 10px; }
.row { display: flex; gap: 10px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.small, .muted { color: var(--muted); font-size: 14px; }
label { font-weight: 600; font-size: 15px; }
input, textarea, select { font: inherit; color: inherit; background: var(--bg); border: 1px solid var(--line); border-radius: 10px;
  padding: 12px; width: 100%; }
input#code { font-size: 22px; letter-spacing: 3px; text-transform: uppercase; text-align: center; }
button, .button { font: inherit; font-weight: 600; border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  border-radius: 12px; padding: 12px 16px; min-height: 48px; cursor: pointer; text-decoration: none; display: inline-flex;
  align-items: center; justify-content: center; gap: 8px; }
button:disabled { opacity: .5; cursor: not-allowed; }
.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.danger { background: var(--danger); color: var(--danger-ink); border-color: var(--danger); }
.big { width: 100%; font-size: 19px; min-height: 56px; }
.pill { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 14px; font-weight: 600; border: 1px solid var(--line); }
.pill.open, .pill.outage, .pill.armed_away, .pill.armed_night { color: var(--warn); border-color: var(--warn); }
.pill.closed, .pill.ok, .pill.on, .pill.locked, .pill.disarmed { color: var(--ok); border-color: var(--ok); }
.pill.unknown, .pill.not-installed, .pill.moving { color: var(--muted); }
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.list li:first-child { border-top: 0; }
.secret { font: 600 22px/1.3 ui-monospace, Menlo, monospace; letter-spacing: 1px; word-break: break-all; }
.banner { margin: 0 16px 12px; padding: 10px 14px; border-radius: 12px; background: var(--surface); border: 1px solid var(--warn); color: var(--warn); }
.tabs { position: fixed; left: 0; right: 0; bottom: 0; display: flex; background: var(--surface); border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom); }
.tabs button { flex: 1; border: 0; border-radius: 0; min-height: 60px; background: transparent; font-size: 13px; flex-direction: column; gap: 2px; }
.tabs button[aria-current="page"] { color: var(--accent); }
.tabs .ico { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tabs .ico circle { fill: currentColor; stroke: none; }
.tabs .ico circle[r="3.5"] { fill: none; stroke: currentColor; }
.secret.code { text-align: center; white-space: nowrap; font-size: 28px; margin: 4px 0 12px; }
.card ol { margin: 0; padding-left: 22px; }
.list li .small { white-space: nowrap; }
.qr svg { width: 100%; max-width: 260px; height: auto; background: #fff; border-radius: 8px; display: block; margin: 8px auto; }
.toast { position: fixed; left: 16px; right: 16px; bottom: calc(76px + env(safe-area-inset-bottom)); max-width: 608px; margin: 0 auto;
  background: var(--ink); color: var(--bg); padding: 12px 16px; border-radius: 12px; }
body.invite main { padding-top: 40px; }
dialog { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); color: var(--ink); max-width: 420px; width: calc(100% - 32px); }
dialog::backdrop { background: rgb(0 0 0 / .4); }

.card.install { border-color: var(--accent); }
.card.install h2 { color: var(--accent); }
