:root {
  --bg: #f6f7f9;
  --panel: #ffffff;
  --ink: #16191d;
  --muted: #6b7280;
  --line: #e3e6ea;
  --accent: #2f6fed;
  --pass: #128a4d;
  --pass-bg: #e6f5ec;
  --fail: #c02626;
  --fail-bg: #fdecec;
  --partial: #9a6700;
  --partial-bg: #fdf3e0;
  --radius: 10px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14171b;
    --panel: #1c2027;
    --ink: #e8eaed;
    --muted: #9aa3ad;
    --line: #2c323a;
    --accent: #6ea0ff;
    --pass: #57d08c;
    --pass-bg: #17321f;
    --fail: #ff8a8a;
    --fail-bg: #3a1c1c;
    --partial: #e2b258;
    --partial-bg: #372a13;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
}

.topbar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 24px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand { font-weight: 650; color: var(--ink); text-decoration: none; }
.breadcrumbs { flex: 1; color: var(--muted); font-size: 14px; }
.breadcrumbs a { color: var(--accent); text-decoration: none; }
.breadcrumbs span::before { content: " / "; color: var(--line); }

.view { padding: 24px; max-width: 1400px; margin: 0 auto; }

h1 { font-size: 22px; margin: 0 0 4px; }
h2 { font-size: 17px; margin: 0 0 12px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

.cards { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  text-decoration: none;
  color: inherit;
  display: block;
}

.card:hover { border-color: var(--accent); }
.card h3 { margin: 0 0 6px; font-size: 16px; }

.stats { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }

.pill {
  font-size: 12px;
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--muted);
  white-space: nowrap;
}

.pill.pass { color: var(--pass); background: var(--pass-bg); border-color: transparent; }
.pill.fail { color: var(--fail); background: var(--fail-bg); border-color: transparent; }
.pill.partial { color: var(--partial); background: var(--partial-bg); border-color: transparent; }

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: end;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 16px;
}

.field { display: flex; flex-direction: column; gap: 4px; }
.field label { font-size: 12px; color: var(--muted); }

select, input[type="text"], input[type="password"], textarea {
  background: var(--bg);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 7px 10px;
  font: inherit;
  min-width: 180px;
}

button {
  border-radius: 8px;
  border: 1px solid var(--line);
  padding: 7px 13px;
  font: inherit;
  cursor: pointer;
  background: var(--panel);
  color: var(--ink);
}

button:hover { border-color: var(--accent); }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
button.ghost { background: transparent; }
button[disabled] { opacity: 0.5; cursor: not-allowed; }

table { width: 100%; border-collapse: collapse; background: var(--panel); border-radius: var(--radius); overflow: hidden; }
th, td { text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); background: var(--bg); }
tr:last-child td { border-bottom: none; }

.q { font-weight: 550; }
.answer { white-space: pre-wrap; color: var(--muted); font-size: 14px; max-height: 12em; overflow: auto; }
.answer.empty { font-style: italic; }
.verdict-buttons { display: flex; gap: 6px; }
.verdict-buttons button { padding: 4px 9px; font-size: 13px; }
.verdict-buttons button[aria-pressed="true"].v-pass { background: var(--pass-bg); color: var(--pass); border-color: var(--pass); }
.verdict-buttons button[aria-pressed="true"].v-fail { background: var(--fail-bg); color: var(--fail); border-color: var(--fail); }
.verdict-buttons button[aria-pressed="true"].v-partial { background: var(--partial-bg); color: var(--partial); border-color: var(--partial); }

.banner {
  background: var(--partial-bg);
  color: var(--partial);
  border-radius: var(--radius);
  padding: 12px 16px;
  margin-bottom: 16px;
  font-size: 14px;
}

.banner.error { background: var(--fail-bg); color: var(--fail); }

dialog {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  color: var(--ink);
  padding: 20px;
  min-width: 340px;
}

dialog::backdrop { background: rgba(0, 0, 0, .4); }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; }
dialog input { width: 100%; }

.row-actions { display: flex; gap: 8px; align-items: center; margin-bottom: 16px; flex-wrap: wrap; }
code { background: var(--bg); padding: 1px 5px; border-radius: 4px; font-size: 13px; }
