:root {
  color-scheme: light;
  --bg: #f6f6f4;
  --surface: #ffffff;
  --fg: #1d1d1b;
  --muted: #6a6a65;
  --line: #e2e2dd;
  --accent: #2b59c3;
  --accent-fg: #ffffff;
  --ok: #1f7a4a;
  --bad: #b3261e;
  --radius: 10px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #161615;
    --surface: #1f1f1e;
    --fg: #ececea;
    --muted: #a2a29d;
    --line: #333331;
    --accent: #7ea2f0;
    --accent-fg: #10131a;
    --ok: #5cc28c;
    --bad: #f08a80;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #161615;
  --surface: #1f1f1e;
  --fg: #ececea;
  --muted: #a2a29d;
  --line: #333331;
  --accent: #7ea2f0;
  --accent-fg: #10131a;
  --ok: #5cc28c;
  --bad: #f08a80;
}

* { box-sizing: border-box; }
/* Rules below set display on forms, rows and the like; hidden must still win. */
[hidden] { display: none !important; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif;
}
.bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}
.brand { font-weight: 700; color: var(--fg); text-decoration: none; margin-right: auto; }
.who { color: var(--muted); font-size: 14px; overflow-wrap: anywhere; }
main { max-width: 44rem; margin: 0 auto; padding: 24px 16px 48px; }
h1 { font-size: 1.5rem; margin: 0 0 8px; }
h2 { font-size: 1.15rem; margin: 0; }
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
}
.muted { color: var(--muted); }
.small { font-size: 14px; }
.error { color: var(--bad); min-height: 1.5em; margin: 8px 0 0; }
.ok { color: var(--ok); margin: 8px 0 0; }
.ok:empty, .error:empty { display: none; }

form { display: grid; gap: 10px; margin-top: 12px; }
label { font-weight: 600; font-size: 14px; display: grid; gap: 6px; }
input, select, textarea {
  font: inherit;
  font-weight: 400; /* not the label's */
  color: var(--fg);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  width: 100%;
}
textarea { resize: vertical; }
fieldset { border: 1px solid var(--line); border-radius: 8px; padding: 12px; margin: 0; display: grid; gap: 8px; }
legend { font-weight: 600; font-size: 14px; padding: 0 4px; }
.choice { display: flex; align-items: center; gap: 8px; font-weight: 400; font-size: 15px; }
.choice input { width: auto; }
.row { display: flex; align-items: center; gap: 8px; }
.suffix { white-space: nowrap; font-size: 14px; }
button, .button {
  font: inherit;
  font-weight: 600;
  border: 0;
  border-radius: 8px;
  padding: 10px 16px;
  background: var(--accent);
  color: var(--accent-fg);
  cursor: pointer;
  text-decoration: none;
  justify-self: start;
}
button:disabled { opacity: .6; cursor: default; }
button.link { background: none; color: var(--accent); padding: 4px 0; font-weight: 500; }
code { font-size: 14px; background: var(--bg); padding: 1px 5px; border-radius: 4px; }

.heading-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.app-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.url { color: var(--accent); font-size: 14px; overflow-wrap: anywhere; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--muted); flex: none; }
.app.online .dot { background: var(--ok); }
.app.offline .dot { background: var(--bad); }
.state { margin: 6px 0 12px; color: var(--muted); }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr)); gap: 12px; margin: 0 0 12px; }
.facts dt { font-size: 13px; color: var(--muted); }
.facts dd { margin: 0; font-weight: 600; }
.outages summary { cursor: pointer; color: var(--muted); font-size: 14px; }
.outages ul { margin: 8px 0 0; padding-left: 20px; font-size: 14px; }
.settings { border-top: 1px solid var(--line); padding-top: 12px; }
.saved { font-size: 14px; }

.connect { border: 1px solid var(--line); border-radius: 8px; padding: 12px 16px; margin: 0 0 12px; }
.connect h3 { margin: 0 0 6px; font-size: 1rem; }
.connect ol { margin: 0; padding-left: 20px; display: grid; gap: 10px; }
.cmd { display: flex; align-items: center; gap: 8px; margin-top: 4px; }
.cmd pre { flex: 1; min-width: 0; margin: 0; padding: 8px 10px; background: var(--bg); border: 1px solid var(--line); border-radius: 6px; overflow-x: auto; }
.cmd code { background: none; padding: 0; font-size: 13px; white-space: pre; }
.app.not-connected .dot { background: var(--muted); }
