:root {
  --bg: #f4f5f7;
  --surface: #ffffff;
  --surface-2: #eef0f3;
  --text: #171a1f;
  --muted: #5d6673;
  --border: #d9dde3;
  --accent: #2f6fed;
  --accent-text: #ffffff;
  --ok: #17803d;
  --ok-bg: #e3f5e9;
  --bad: #c42b1c;
  --bad-bg: #fde8e6;
  --warn: #8a5a00;
  --warn-bg: #fff2d6;
  --radius: 10px;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14161a;
    --surface: #1d2026;
    --surface-2: #272b33;
    --text: #e9ecf1;
    --muted: #9aa3b0;
    --border: #343a45;
    --accent: #6c9cff;
    --accent-text: #0d1220;
    --ok: #5fd08a;
    --ok-bg: #173323;
    --bad: #ff8a7d;
    --bad-bg: #3a1c19;
    --warn: #f2c261;
    --warn-bg: #3a2e12;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
.shell { max-width: 820px; margin: 0 auto; padding: 16px 16px 80px; }
h1 { font-size: 1.35rem; margin: 0; }
h2 { font-size: 1.05rem; margin: 0 0 4px; overflow-wrap: anywhere; }
p { margin: 0 0 8px; }
.muted { color: var(--muted); }
.center { text-align: center; }
.small { font-size: 0.875rem; }
.pre { white-space: pre-wrap; overflow-wrap: anywhere; }

.topbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.topbar .who { margin-left: auto; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 12px;
}
.card.narrow { max-width: 440px; margin: 12vh auto 0; }

.progress-row { display: flex; align-items: center; gap: 12px; }
progress { flex: 1; height: 12px; accent-color: var(--ok); }

.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin: 14px 0 10px; }
.tab {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  border-radius: 999px;
  padding: 7px 14px;
  font: inherit;
  cursor: pointer;
}
.tab[aria-selected="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.filters { display: flex; gap: 8px; align-items: center; margin-bottom: 12px; flex-wrap: wrap; }

.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.chip {
  font-size: 0.78rem;
  padding: 2px 9px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
  white-space: nowrap;
}
.chip.ok { background: var(--ok-bg); color: var(--ok); }
.chip.bad { background: var(--bad-bg); color: var(--bad); }
.chip.warn { background: var(--warn-bg); color: var(--warn); }

.label { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); margin: 10px 0 2px; }
.notice { background: var(--warn-bg); color: var(--warn); border-radius: 8px; padding: 8px 10px; margin: 10px 0; }
.card.notice { border-color: transparent; padding: 12px 16px; margin: 0 0 12px; }
.topbar .who .link { white-space: nowrap; }
.problem { background: var(--bad-bg); border-radius: 8px; padding: 8px 10px; margin-top: 8px; }
.problem .name { font-weight: 600; color: var(--bad); }

.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 12px; }
.actions .count { margin-left: auto; }

button, .button {
  font: inherit;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  padding: 9px 16px;
  min-height: 42px;
  cursor: pointer;
}
button:disabled { opacity: 0.55; cursor: default; }
button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
button.works { border-color: var(--ok); color: var(--ok); }
button.works.on { background: var(--ok); color: var(--surface); }
button.broken { border-color: var(--bad); color: var(--bad); }
button.broken.on { background: var(--bad); color: var(--surface); }
button.link { border: 0; background: none; padding: 0; min-height: 0; color: var(--accent); text-decoration: underline; }
button:focus-visible, .tab:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible, a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
a { color: var(--accent); }

form { display: grid; gap: 10px; margin-top: 12px; }
label { display: grid; gap: 4px; font-size: 0.9rem; color: var(--muted); }
input[type="text"], textarea, select {
  font: inherit;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 9px 10px;
  width: 100%;
}
textarea { min-height: 96px; resize: vertical; }
input[type="file"] { font: inherit; color: var(--muted); max-width: 100%; }
.form-actions { display: flex; gap: 8px; flex-wrap: wrap; }

dialog {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  padding: 18px;
  width: min(560px, calc(100vw - 32px));
}
dialog::backdrop { background: rgba(0, 0, 0, 0.5); }

.toast {
  position: fixed;
  left: 50%;
  bottom: 20px;
  transform: translateX(-50%);
  background: var(--text);
  color: var(--bg);
  padding: 10px 16px;
  border-radius: 8px;
  max-width: calc(100vw - 32px);
  z-index: 10;
}
.toast.error { background: var(--bad); color: #fff; }
.empty { text-align: center; padding: 28px 12px; color: var(--muted); }

@media (max-width: 520px) {
  .actions button { flex: 1; }
  .actions .count { flex-basis: 100%; margin-left: 0; }
  .topbar .who { margin-left: 0; width: 100%; justify-content: space-between; }
}
