:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --text: #1c2128;
  --muted: #5d6673;
  --border: #d9dee5;
  --accent: #1f6feb;
  --accent-text: #ffffff;
  --ok: #1a7f37;
  --ok-bg: #dafbe1;
  --bad: #cf222e;
  --bad-bg: #ffebe9;
  --wait: #9a6700;
  --wait-bg: #fff8c5;
  --info: #0969da;
  --info-bg: #ddf4ff;
  --mutedbadge-bg: #eaeef2;
  --radius: 10px;
  --mono: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1216;
    --surface: #171b21;
    --text: #e6edf3;
    --muted: #8d96a0;
    --border: #2d333b;
    --accent: #4493f8;
    --accent-text: #0f1216;
    --ok: #3fb950;
    --ok-bg: #12261a;
    --bad: #f85149;
    --bad-bg: #2d1416;
    --wait: #d29922;
    --wait-bg: #2b2111;
    --info: #58a6ff;
    --info-bg: #10233a;
    --mutedbadge-bg: #262c34;
  }
}

* { box-sizing: border-box; }
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(--accent); }
code, .mono, pre { font-family: var(--mono); font-size: 0.9em; }
pre { background: var(--bg); border: 1px solid var(--border); border-radius: 6px; padding: 8px 10px; overflow-x: auto; }
h1 { font-size: 1.4rem; margin: 0; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
h2 { font-size: 1.05rem; margin: 0 0 12px; }
[hidden] { display: none !important; }

.top {
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px;
  padding: 10px 16px; background: var(--surface); border-bottom: 1px solid var(--border);
}
.brand { font-weight: 700; color: var(--text); text-decoration: none; display: flex; align-items: center; gap: 8px; }
.brand .dot { width: 12px; height: 12px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent); }
nav { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
nav a { text-decoration: none; color: var(--text); }
nav a.primary-link { color: var(--accent); font-weight: 600; }
.linklike { background: none; border: 0; color: var(--muted); cursor: pointer; font: inherit; padding: 0; }

main { max-width: 980px; margin: 0 auto; padding: 20px 16px 40px; }
.foot { text-align: center; color: var(--muted); font-size: 12px; padding: 0 0 24px; }

.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 12px; }
.card.narrow { max-width: 420px; margin: 40px auto; }
.card.empty { text-align: center; padding: 32px; }
.watch.is-off { opacity: 0.7; }
.watch-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.watch-title { font-weight: 600; color: var(--text); text-decoration: none; overflow-wrap: anywhere; }
a.watch-title:hover { text-decoration: underline; }
.actions { margin-left: auto; display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.desc { margin: 6px 0; overflow-wrap: anywhere; }
.meta { margin: 6px 0 0; color: var(--muted); font-size: 13px; }
.muted { color: var(--muted); }
.warn-text { color: var(--wait); }
.err-text { color: var(--bad); }

.badge { display: inline-block; font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 999px; white-space: nowrap; }
.badge-ok { color: var(--ok); background: var(--ok-bg); }
.badge-bad { color: var(--bad); background: var(--bad-bg); }
.badge-err { color: var(--bad); background: var(--bad-bg); }
.badge-wait { color: var(--wait); background: var(--wait-bg); }
.badge-done { color: var(--info); background: var(--info-bg); }
.badge-muted { color: var(--muted); background: var(--mutedbadge-bg); }

.chips { list-style: none; padding: 0; margin: 8px 0 0; display: flex; flex-wrap: wrap; gap: 6px; }
.chip { font-size: 13px; padding: 2px 10px 2px 8px; border-radius: 999px; border: 1px solid var(--border); display: inline-flex; align-items: center; gap: 6px; overflow-wrap: anywhere; }
.chip::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--muted); flex: none; }
.chip-ok::before { background: var(--ok); }
.chip-bad::before, .chip-err::before { background: var(--bad); }
.chip-wait::before { background: var(--wait); }
.chip-err { border-style: dashed; }
.chip.dot-only { border: 0; padding: 0; }

.btn {
  display: inline-block; font: inherit; font-size: 14px; padding: 6px 12px; border-radius: 8px; cursor: pointer;
  border: 1px solid var(--border); background: var(--surface); color: var(--text); text-decoration: none; line-height: 1.4;
}
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); font-weight: 600; }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--bad); }
.btn.small { font-size: 13px; padding: 3px 10px; }
.btn:disabled { opacity: 0.6; cursor: wait; }
form.inline { display: inline; margin: 0; }

.stack { display: flex; flex-direction: column; gap: 14px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
label { display: flex; flex-direction: column; gap: 4px; font-weight: 600; font-size: 14px; }
label small, fieldset small { font-weight: 400; color: var(--muted); }
label.check { flex-direction: row; align-items: center; gap: 8px; font-weight: 400; }
label.check.disabled { color: var(--muted); }
input, select {
  font: inherit; font-weight: 400; padding: 7px 10px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--bg); color: var(--text); width: 100%;
}
input[type=radio], input[type=checkbox] { width: auto; }
input:focus, select:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: var(--accent); }
fieldset { border: 1px solid var(--border); border-radius: 8px; padding: 8px 12px 10px; margin: 0; display: flex; flex-direction: column; gap: 6px; }
legend { font-weight: 600; font-size: 14px; padding: 0 4px; }

.flash { padding: 8px 12px; border-radius: 8px; margin: 0 0 12px; }
.flash ul { margin: 0; padding-left: 18px; }
.flash-ok { color: var(--ok); background: var(--ok-bg); }
.flash-info { color: var(--info); background: var(--info-bg); }
.flash-warn { color: var(--wait); background: var(--wait-bg); }
.flash-err { color: var(--bad); background: var(--bad-bg); }

.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; color: var(--muted); font-weight: 600; border-bottom: 1px solid var(--border); padding: 6px 8px; }
.table td { border-bottom: 1px solid var(--border); padding: 6px 8px; vertical-align: top; }
.wrap { overflow-wrap: anywhere; word-break: break-all; }
#preview { margin-top: 4px; }

.facts { display: grid; grid-template-columns: max-content 1fr; gap: 4px 16px; margin: 8px 0 0; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; overflow-wrap: anywhere; }

.events { list-style: none; padding: 0; margin: 0; font-size: 14px; }
.event { padding: 5px 0; border-bottom: 1px solid var(--border); overflow-wrap: anywhere; }
.event time { color: var(--muted); font-family: var(--mono); font-size: 12px; margin-right: 8px; }
.event-alert { font-weight: 600; }
.event-error, .event-notify_error { color: var(--bad); }

.small { font-size: 13px; }
.tabs { display: flex; gap: 4px; flex-wrap: wrap; border-bottom: 1px solid var(--border); margin-bottom: 14px; }
.tab { padding: 7px 12px; text-decoration: none; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tab:hover { color: var(--text); }
.tab.active { color: var(--text); border-bottom-color: var(--accent); font-weight: 600; }
.toolbar { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.toolbar .grow { flex: 1 1 220px; }
.toolbar label.check { padding-bottom: 8px; }
.inline-title { margin: 0; }
.records { background: var(--bg); border: 1px solid var(--border); border-radius: 6px; padding: 6px 10px; margin: 10px 0; font-size: 13px; }
.findings { list-style: none; padding: 0; margin: 8px 0 0; }
.finding { display: flex; gap: 8px; padding: 3px 0; }
.finding .icon { flex: none; width: 18px; height: 18px; border-radius: 50%; font-size: 11px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; margin-top: 2px; }
.finding-ok .icon { color: var(--ok); background: var(--ok-bg); }
.finding-info .icon { color: var(--info); background: var(--info-bg); }
.finding-warn .icon { color: var(--wait); background: var(--wait-bg); }
.finding-err .icon { color: var(--bad); background: var(--bad-bg); }
details { margin-top: 10px; }
summary { cursor: pointer; color: var(--accent); font-size: 14px; }
.tree { list-style: none; margin: 6px 0 0; padding-left: 16px; border-left: 1px solid var(--border); }
.tree li { padding: 3px 0; }
.pill { display: inline-block; background: var(--bg); border: 1px solid var(--border); border-radius: 6px; padding: 1px 6px; margin: 2px 0; }

@media (max-width: 640px) {
  .grid-2 { grid-template-columns: 1fr; }
  .actions { margin-left: 0; width: 100%; }
  .table th:nth-child(2), .table td:nth-child(2) { display: none; }
  .facts { grid-template-columns: 1fr; }
  .facts dd { margin-bottom: 6px; }
}
