:root {
  --bg: #fbfaf7; --fg: #1d1d1b; --muted: #6b6a66; --line: #e4e1da; --accent: #8a5a00;
  --ok: #2f6b3a; --bad: #a23a2a; --alert-bg: #fbe9e5;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #111827; --fg: #e8e6e1; --muted: #9a988f; --line: #283244; --accent: #e9d5a0;
          --ok: #8fd19e; --bad: #f2a493; --alert-bg: #3a1f1c; }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--fg);
       font: 16px/1.5 ui-serif, Georgia, "Iowan Old Style", serif; }
a { color: var(--accent); }
header, main, footer { max-width: 60rem; margin: 0 auto; padding: 0 16px; }
header { padding-top: max(12px, env(safe-area-inset-top)); border-bottom: 1px solid var(--line); }
nav { display: flex; gap: 1.2rem; align-items: baseline; flex-wrap: wrap; font-family: ui-sans-serif, system-ui, sans-serif; }
nav .brand { font-weight: 700; color: var(--fg); text-decoration: none; margin-right: auto; }
.count { color: var(--bad); }
form.inline { display: inline; }
button { font: inherit; font-family: ui-sans-serif, system-ui, sans-serif; padding: .35rem .8rem; border: 1px solid var(--line);
         background: transparent; color: var(--fg); border-radius: 4px; cursor: pointer; }
button.link { border: 0; padding: 0; color: var(--accent); text-decoration: underline; }
.strip { display: flex; flex-wrap: wrap; gap: .2rem 1.4rem; margin: .6rem 0; font: 13px/1.4 ui-sans-serif, system-ui, sans-serif; }
.strip div { display: flex; gap: .35rem; }
.strip dt { color: var(--muted); }
.strip dd { margin: 0; }
.strip .ok dd { color: var(--ok); } .strip .bad dd { color: var(--bad); }
h1, h2 { font-weight: 600; line-height: 1.25; }
h2 { font-size: 1.1rem; margin-top: 2rem; border-bottom: 1px solid var(--line); padding-bottom: .2rem; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font: 12px ui-sans-serif, system-ui, sans-serif; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
td, th { padding: .45rem .5rem .45rem 0; vertical-align: top; border-bottom: 1px solid var(--line); }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.new { font: 11px ui-sans-serif, system-ui, sans-serif; color: var(--accent); text-transform: uppercase; }
tr.changed td:first-child { box-shadow: inset 3px 0 0 var(--accent); padding-left: .5rem; }
ul.items { padding-left: 1.1rem; }
.alert { background: var(--alert-bg); padding: .6rem 1rem; margin: 1rem 0; border-left: 3px solid var(--bad); }
.item { border-bottom: 1px solid var(--line); padding: .6rem 0; }
.item h3 { margin: 0; font-size: 1.05rem; }
.item.question h3::before, .item.approval h3::before { content: "● "; color: var(--bad); }
.item .text { white-space: pre-wrap; }
.option { display: inline-block; margin-right: .8rem; font-family: ui-sans-serif, system-ui, sans-serif; }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: .2rem 1rem; }
.facts dt { color: var(--muted); } .facts dd { margin: 0; }
footer { margin-top: 3rem; padding-bottom: max(24px, env(safe-area-inset-bottom)); font-size: .8rem; }
.audit td { font-size: .85rem; }
body.login main { max-width: 22rem; padding-top: 18vh; }
body.login label { display: block; margin: .8rem 0; font-family: ui-sans-serif, system-ui, sans-serif; }
body.login input:not([type=checkbox]) { display: block; width: 100%; font: inherit; padding: .5rem; margin-top: .2rem;
  background: transparent; color: var(--fg); border: 1px solid var(--line); border-radius: 4px; }
body.login .check { font-size: .9rem; color: var(--muted); }
.error { color: var(--bad); }
@media (max-width: 40rem) { .catalog th:nth-child(2), .catalog td:nth-child(2) { display: none; } }
.choices { display: flex; flex-wrap: wrap; gap: .5rem; margin: .5rem 0; }
.choices form { display: inline; }
form.answer, form.stack { display: flex; flex-direction: column; gap: .5rem; margin: .5rem 0; max-width: 36rem; }
form.answer button, form.stack button { align-self: flex-start; }
.inline-form { margin: 1rem 0; }
input:not([type=hidden]):not([type=checkbox]), textarea { font: inherit; padding: .5rem; background: transparent; color: var(--fg);
  border: 1px solid var(--line); border-radius: 4px; width: 100%; }
.sent { font-family: ui-sans-serif, system-ui, sans-serif; color: var(--ok); }

/* P2.7 instrument pages */
.md { white-space: pre-wrap; overflow-wrap: anywhere; }
pre.small { white-space: pre-wrap; overflow-wrap: anywhere; font-size: .8em; }
.attention.warn { color: #b45309; } .attention.bad { color: #b91c1c; }
table td { vertical-align: top; }
#mic.on { background: #b91c1c; color: #fff; }
#dump { font-size: 1.05em; }
