/* Data Lab — plain white, system font, large type readable at arm's length. */
:root {
  --bg: #ffffff;
  --ink: #111111;
  --muted: #5c5c5c;
  --line: #d4d4d4;
  --soft: #f4f4f4;
  --accent: #00d4aa;
  --accent-ink: #005c4f;
  --ok: #0a7a3d;
  --ok-bg: #e8f6ee;
  --warn: #8a5a00;
  --warn-bg: #fff4dc;
  --bad: #b3261e;
  --bad-bg: #fdecea;
  --info: #1f4e99;
  --info-bg: #eaf1fb;
  --radius: 6px;
  --gap: 16px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --text: 20px;
  --small: 16px;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { font-size: var(--text); }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font); line-height: 1.45; }
a { color: var(--accent-ink); }
h1 { font-size: 1.6rem; margin: 0.6em 0 0.4em; }
h2 { font-size: 1.3rem; margin: 1.2em 0 0.4em; }
h3 { font-size: 1.1rem; margin: 1em 0 0.3em; }
p { margin: 0.4em 0 0.8em; }
code, .mono { font-family: var(--mono); font-size: 0.9em; }
.muted { color: var(--muted); }
.small { font-size: var(--small); }
.skip { position: absolute; left: -999px; }
.skip:focus { left: 8px; top: 8px; background: var(--bg); padding: 6px; z-index: 10; }

header.top { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 24px; padding: 10px 24px; border-bottom: 1px solid var(--line); }
.brand { font-weight: 700; font-size: 1.15rem; color: var(--ink); text-decoration: none; }
nav { display: flex; flex-wrap: wrap; gap: 4px 18px; }
nav a { text-decoration: none; padding: 4px 0; border-bottom: 3px solid transparent; color: var(--ink); }
nav a.active { border-bottom-color: var(--accent); font-weight: 600; }
.who { margin-left: auto; font-size: var(--small); color: var(--muted); display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
main { max-width: 1100px; margin: 0 auto; padding: 8px 24px 80px; }
main:focus { outline: none; }

.banner { padding: 8px 24px; font-weight: 700; font-size: var(--small); text-align: center; }
.banner.sim { background: #ffe14d; color: #3a2f00; letter-spacing: 0.08em; }
.banner.mock { background: #e0d4ff; color: #2b145e; }
.banner.api { background: var(--info-bg); color: var(--info); }

button, .btn { font: inherit; font-size: 1rem; padding: 10px 18px; border-radius: var(--radius); border: 1px solid var(--ink); background: var(--bg); color: var(--ink); cursor: pointer; text-decoration: none; display: inline-block; line-height: 1.2; }
button:hover:not(:disabled), .btn:hover { background: var(--soft); }
button:disabled { opacity: 0.45; cursor: not-allowed; }
button.primary, .btn.primary { background: var(--accent-ink); border-color: var(--accent-ink); color: #fff; }
button.primary:hover:not(:disabled) { background: #004238; }
button.danger, .btn.danger { border-color: var(--bad); color: var(--bad); }
button.big, .btn.big { font-size: 1.25rem; padding: 14px 28px; font-weight: 600; }
button.start { min-width: 9em; }
button.link { border: none; background: none; padding: 0; color: var(--accent-ink); text-decoration: underline; cursor: pointer; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 12px 0; }

input[type=text], input[type=email], input[type=number], input[type=date], select, textarea {
  font: inherit; font-size: 1rem; padding: 8px 10px; border: 1px solid #8a8a8a; border-radius: var(--radius); background: var(--bg); color: var(--ink); max-width: 100%;
}
input[type=number] { width: 9em; }
input[type=text], input[type=email], select { min-width: 14em; }
input[type=checkbox], input[type=radio] { width: 1.15em; height: 1.15em; vertical-align: -0.15em; accent-color: var(--accent-ink); }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

.card { border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 20px; margin: 12px 0; background: var(--bg); }
.card.active { border: 3px solid var(--accent-ink); }
.card.done { background: #fafafa; }
.card.invalid { border-left: 6px solid var(--bad); }
.card h3:first-child, .card h2:first-child { margin-top: 0; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 12px; }
.row { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; }
.spacer { flex: 1; }

.notice { padding: 12px 16px; border-radius: var(--radius); margin: 12px 0; border: 1px solid; }
.notice.ok { background: var(--ok-bg); border-color: var(--ok); }
.notice.warn { background: var(--warn-bg); border-color: var(--warn); }
.notice.bad { background: var(--bad-bg); border-color: var(--bad); }
.notice.info { background: var(--info-bg); border-color: var(--info); }
.notice strong { display: block; margin-bottom: 2px; }

.badge { display: inline-block; padding: 1px 9px; border-radius: 999px; font-size: var(--small); font-weight: 600; border: 1px solid; white-space: nowrap; }
.badge.ok { color: var(--ok); background: var(--ok-bg); }
.badge.warn { color: var(--warn); background: var(--warn-bg); }
.badge.bad { color: var(--bad); background: var(--bad-bg); }
.badge.info { color: var(--info); background: var(--info-bg); }
.badge.muted { color: var(--muted); background: var(--soft); }

table { border-collapse: collapse; width: 100%; margin: 8px 0 16px; font-size: var(--small); }
th, td { text-align: left; padding: 7px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-weight: 600; background: var(--soft); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tr.clickable { cursor: pointer; }
tr.clickable:hover { background: var(--soft); }
.table-wrap { overflow-x: auto; }

.form { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px 24px; }
.field { display: flex; flex-direction: column; gap: 4px; }
.field-label { font-weight: 600; }
.field .unit { font-weight: 400; color: var(--muted); }
.qty { display: inline-flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.field .req { color: var(--bad); }
.field .help { font-size: var(--small); color: var(--muted); }
.field-error { color: var(--bad); font-size: var(--small); min-height: 0; }
.field.has-error input, .field.has-error select { border-color: var(--bad); border-width: 2px; }
.choices { display: flex; flex-wrap: wrap; gap: 6px 16px; }
.choices.inline { gap: 16px; }
.check { display: inline-flex; gap: 6px; align-items: center; font-weight: 400; cursor: pointer; }
.scale { display: flex; flex-wrap: wrap; gap: 4px; }
.scale-opt { display: inline-flex; flex-direction: column; align-items: center; min-width: 2.2em; padding: 4px; border: 1px solid var(--line); border-radius: var(--radius); cursor: pointer; font-size: var(--small); }
.scale-opt:has(input:checked) { background: var(--accent-ink); color: #fff; border-color: var(--accent-ink); }
.scale-opt input { position: absolute; opacity: 0; pointer-events: none; }

.group { margin: 20px 0; }
.group > h3 { margin-bottom: 0; }
.group .why { color: var(--muted); font-size: var(--small); margin: 2px 0 10px; }

dl.values { display: grid; grid-template-columns: max-content 1fr; gap: 2px 16px; margin: 6px 0; font-size: var(--small); }
dl.values dt { color: var(--muted); }
dl.values dd { margin: 0; font-weight: 600; }
dl.preset dd { font-size: 1.15rem; }

ul.checklist { list-style: none; padding: 0; margin: 6px 0; }
ul.checklist li { padding: 6px 0; border-bottom: 1px solid var(--soft); }
ul.checklist label { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; }
ul.checklist input { margin-top: 0.25em; flex: none; }
ol.script { font-size: 1.15rem; padding-left: 1.4em; }
ol.script li { margin: 4px 0; }

details.section { border-top: 1px solid var(--line); padding: 8px 0; }
details.section > summary { cursor: pointer; font-weight: 600; }

.steps { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 16px; padding: 0; list-style: none; font-size: var(--small); }
.steps li { padding: 4px 12px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); }
.steps li.now { border-color: var(--accent-ink); color: var(--ink); font-weight: 600; background: #e6fbf6; }
.steps li.ok { border-color: var(--ok); color: var(--ok); }

.devices { display: grid; gap: 10px; }
.device { border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 16px; }
.device .name { font-weight: 700; }
.hz { font-variant-numeric: tabular-nums; font-size: var(--small); }
.hz .ok { color: var(--ok); font-weight: 700; }
.hz .bad { color: var(--bad); font-weight: 700; }
.zones { display: flex; gap: 4px; align-items: flex-end; height: 70px; margin: 8px 0 2px; }
.zone { width: 22px; background: var(--soft); border: 1px solid var(--line); position: relative; height: 100%; }
.zone > i { position: absolute; left: 0; right: 0; bottom: 0; background: var(--accent-ink); }
.zone.rose { border-color: var(--ok); border-width: 2px; }

.big-number { font-size: 2.4rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.progress { height: 14px; background: var(--soft); border-radius: 7px; overflow: hidden; border: 1px solid var(--line); }
.progress > i { display: block; height: 100%; background: var(--accent-ink); width: 0; transition: width 0.3s; }

.cue-overlay { position: fixed; inset: 0; background: var(--bg); z-index: 50; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; text-align: center; padding: 24px; }
[hidden] { display: none !important; }
.cue-big { font-size: min(26vw, 40vh); font-weight: 800; line-height: 1; word-break: break-word; }
.cue-sub { font-size: 2rem; color: var(--muted); }
.cue-timer { font-size: 2rem; font-variant-numeric: tabular-nums; }
.cue-stop { margin-top: 24px; font-size: 1.6rem; padding: 18px 48px; }
.cue-overlay.flash { background: #000; color: #fff; }
.cue-overlay.flash .cue-sub, .cue-overlay.flash .cue-timer { color: #fff; }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 12px 20px; border-radius: var(--radius); font-size: var(--small); opacity: 0; pointer-events: none; transition: opacity 0.2s; z-index: 60; max-width: 90vw; }
.toast.show { opacity: 1; }
.toast.error { background: var(--bad); }
.toast.ok { background: var(--ok); }

video.preview { width: 320px; max-width: 100%; border: 1px solid var(--line); border-radius: var(--radius); background: #000; }
.matrix td.cell { text-align: center; font-variant-numeric: tabular-nums; }
.matrix td.full { background: var(--ok-bg); }
.matrix td.short { background: var(--warn-bg); }
.matrix td.zero { background: var(--bad-bg); }

.sheet { max-width: 820px; }
.sheet h1 { font-size: 1.4rem; }
.sheet h2 { font-size: 1.1rem; border-bottom: 1px solid var(--line); padding-bottom: 2px; }
.sheet-list, .sheet-fields { list-style: none; padding: 0; margin: 4px 0 10px; }
.sheet-item { padding: 3px 0; }
.sheet-fields li { padding: 3px 0; break-inside: avoid; }
.sheet-field { font-weight: 600; font-size: var(--small); }
.sheet-blank { display: inline-block; min-width: 10em; border-bottom: 1px solid var(--ink); }
.sheet-line { border-bottom: 1px solid var(--ink); height: 1.8em; }
.sheet-group { break-inside: avoid-page; }
.print-only { display: none; }
@media print {
  :root { --text: 12pt; --small: 10pt; }
  header.top, #banners, .no-print, .actions, nav { display: none !important; }
  .print-only { display: block; }
  main { max-width: none; padding: 0; }
  .card { break-inside: avoid; }
}
@media (max-width: 640px) {
  :root { --text: 18px; }
  header.top, main { padding-left: 16px; padding-right: 16px; }
  .who { margin-left: 0; }
}
