:root {
  --bg: #f6f5f2;
  --panel: #ffffff;
  --ink: #1f2328;
  --muted: #5d636b;
  --line: #e2e0da;
  --accent: #0f5c63;
  --accent-ink: #ffffff;
  --accent-soft: #e3f0f0;
  --met: #1e7a46;
  --met-soft: #e5f4ea;
  --notmet: #b4462b;
  --notmet-soft: #fbebe5;
  --pending: #8a6a00;
  --pending-soft: #fdf4d8;
  --na: #6b7178;
  --na-soft: #eef0f2;
  --radius: 10px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { font-family: var(--font); background: var(--bg); color: var(--ink); font-size: 15px; line-height: 1.5; }
a { color: var(--accent); }
code { background: #efede8; padding: 1px 5px; border-radius: 4px; font-size: 0.9em; }

header.top {
  display: flex; align-items: center; gap: 24px; padding: 12px 24px;
  background: var(--panel); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10;
}
.brand { font-weight: 700; font-size: 17px; color: var(--ink); text-decoration: none; letter-spacing: -0.01em; }
nav { display: flex; gap: 18px; flex-wrap: wrap; flex: 1; }
nav a { color: var(--muted); text-decoration: none; font-weight: 500; }
nav a:hover { color: var(--ink); }
nav a.primary-link { color: var(--accent); }
.who { display: flex; gap: 12px; align-items: center; color: var(--muted); }
.who form { margin: 0; }

main { max-width: 1180px; margin: 24px auto; padding: 0 20px 60px; }
footer { text-align: center; color: var(--muted); font-size: 12px; padding: 20px; }

h1 { font-size: 24px; margin: 0 0 6px; letter-spacing: -0.01em; }
h2 { font-size: 18px; margin: 28px 0 10px; }
h3 { font-size: 15px; margin: 18px 0 8px; }
p.lead { color: var(--muted); margin: 0 0 18px; max-width: 760px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

.banner { padding: 10px 24px; font-size: 14px; }
.banner.demo { background: var(--pending-soft); color: #5c4700; }
.banner.info { background: var(--accent-soft); color: var(--accent); }
.banner.error { background: var(--notmet-soft); color: var(--notmet); }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; margin-bottom: 16px; }
.card h2:first-child, .card h3:first-child { margin-top: 0; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 860px) { .grid2 { grid-template-columns: 1fr; } header.top { flex-wrap: wrap; } }

label { display: block; font-weight: 600; margin: 12px 0 4px; font-size: 14px; }
label.inline { display: inline-flex; gap: 6px; align-items: center; font-weight: 500; margin: 0; }
input[type=text], input[type=password], input[type=date], input[type=number], select, textarea {
  width: 100%; padding: 8px 10px; border: 1px solid #cfccc4; border-radius: 7px; font: inherit; background: #fff; color: var(--ink);
}
textarea { min-height: 90px; resize: vertical; }
textarea.comments { min-height: 170px; }
textarea.transcript { min-height: 360px; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px; }
.hint { color: var(--muted); font-size: 13px; margin-top: 4px; }

button, .button {
  display: inline-block; padding: 8px 16px; border-radius: 7px; border: 1px solid var(--accent);
  background: var(--accent); color: var(--accent-ink); font: inherit; font-weight: 600; cursor: pointer; text-decoration: none;
}
button.secondary, .button.secondary { background: #fff; color: var(--accent); }
button.danger { background: #fff; color: var(--notmet); border-color: var(--notmet); }
button.link { background: none; border: none; color: var(--accent); padding: 0; font-weight: 500; }
button.small, .button.small { padding: 4px 10px; font-size: 13px; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-top: 14px; }

table { width: 100%; border-collapse: collapse; background: var(--panel); }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); font-weight: 600; }
tr.section-row td { background: #faf9f6; font-weight: 600; color: var(--muted); font-size: 13px; }
td.num { white-space: nowrap; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); }

.pill { display: inline-block; padding: 1px 8px; border-radius: 99px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.pill.met { background: var(--met-soft); color: var(--met); }
.pill.notmet { background: var(--notmet-soft); color: var(--notmet); }
.pill.pending { background: var(--pending-soft); color: var(--pending); }
.pill.na { background: var(--na-soft); color: var(--na); }
.pill.final { background: var(--accent-soft); color: var(--accent); }
.pill.draft, .pill.running, .pill.baseline, .pill.error { background: var(--na-soft); color: var(--na); }
.pill.error { background: var(--notmet-soft); color: var(--notmet); }

.score { font-size: 28px; font-weight: 700; letter-spacing: -0.02em; }
.score small { font-size: 14px; color: var(--muted); font-weight: 500; }
.headline { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; flex-wrap: wrap; }

.evidence { font-size: 13px; color: var(--muted); max-width: 360px; }
.measure-name { font-weight: 600; }
.measure-cell select { min-width: 175px; }
td.obs-cell input { min-width: 210px; }
.code-cell select { min-width: 220px; }

.comment-item { border-top: 1px solid var(--line); padding-top: 12px; margin-top: 12px; }
.comment-item:first-of-type { border-top: none; padding-top: 0; margin-top: 0; }
.comment-item .item-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.comment-item textarea { margin-top: 6px; }
.problems { color: var(--notmet); font-size: 13px; margin: 6px 0 0; padding-left: 18px; }
.edited-tag { font-size: 12px; color: var(--accent); }

pre.output { white-space: pre-wrap; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; font-family: var(--font); font-size: 14px; line-height: 1.55; }
details summary { cursor: pointer; font-weight: 600; }
.notes li { margin-bottom: 6px; }
.verdict { white-space: nowrap; font-weight: 600; font-size: 13px; }
.verdict.Consistent { color: var(--met); }
.verdict.Inconsistent { color: var(--notmet); }
.verdict.Partly { color: var(--pending); }

.library h1 { font-size: 22px; }
.library h2 { border-top: 1px solid var(--line); padding-top: 18px; }
.library table { font-size: 13px; }
.library pre { background: #fff; padding: 12px; border: 1px solid var(--line); border-radius: 8px; overflow-x: auto; }

.spinner { width: 28px; height: 28px; border: 3px solid var(--accent-soft); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.9s linear infinite; display: inline-block; vertical-align: middle; margin-right: 10px; }
@keyframes spin { to { transform: rotate(360deg); } }

.stat-row { display: flex; gap: 14px; flex-wrap: wrap; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 16px; min-width: 150px; }
.stat b { display: block; font-size: 20px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { font-size: 12px; padding: 2px 8px; border-radius: 99px; background: var(--na-soft); color: var(--na); text-decoration: none; }
.chip.has { background: var(--met-soft); color: var(--met); }
.chip.sel { outline: 2px solid var(--accent); }

.qr { width: 220px; margin: 12px 0; background: #fff; padding: 8px; border-radius: 8px; }
.qr svg { width: 100%; height: auto; display: block; }
