/* Layout: a wide single column of test cases under a sticky progress header; a sheet for recording a result. */
:root {
  --bg: #f5f6f4;
  --paper: #ffffff;
  --ink: #1b2124;
  --ink-soft: #46515a;
  --ink-faint: #67727b;
  --line: #d9dedf;
  --accent: #1f5c6e;
  --accent-wash: #e3eef1;
  --pass: #1d6b45; --pass-wash: #e2f2e9;
  --fail: #b3261e; --fail-wash: #fbe7e5;
  --blocked: #8a5a00; --blocked-wash: #fbf0d9;
  --neutral-wash: #eceff0;
  --shadow: 0 10px 40px rgba(20, 30, 35, .18);
  --font: "Public Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121618; --paper: #1b2124; --ink: #e8ecee; --ink-soft: #b9c2c8; --ink-faint: #8e999f; --line: #2f383d;
    --accent: #7cc0d3; --accent-wash: #1d3239;
    --pass: #6fcf9a; --pass-wash: #183427; --fail: #f2948c; --fail-wash: #3d1d1a; --blocked: #e7b65a; --blocked-wash: #3a2c12;
    --neutral-wash: #262e32; --shadow: 0 10px 40px rgba(0, 0, 0, .5); color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font); font-size: 15px; line-height: 1.5; }
[hidden] { display: none !important; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.wrap { max-width: 1120px; margin: 0 auto; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }

header.top { position: sticky; top: 0; z-index: 5; background: var(--paper); border-bottom: 1px solid var(--line); padding-top: env(safe-area-inset-top, 0px); }
header.top .wrap { padding-block: 14px 12px; display: grid; gap: 10px; }
.title-row { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
h1 { font-size: 20px; font-weight: 700; margin: 0; letter-spacing: -.01em; }
.who { display: flex; align-items: center; gap: 6px; color: var(--ink-soft); font-size: 14px; flex-wrap: wrap; }
.linkish { background: none; border: 0; padding: 4px 2px; color: var(--accent); font-weight: 600; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }

.bar { display: flex; height: 10px; border-radius: 99px; overflow: hidden; background: var(--neutral-wash); }
.bar span { display: block; height: 100%; transition: width .3s; }
.bar .p { background: var(--pass); } .bar .f { background: var(--fail); } .bar .b { background: var(--blocked); } .bar .o { background: var(--ink-faint); }
.counts { display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: 13px; color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.counts b { color: var(--ink); font-weight: 600; }

nav.tabs { display: flex; gap: 4px; max-width: 520px; }
nav.tabs button { flex: 1; border: 1px solid var(--line); background: var(--paper); border-radius: 8px; padding: 8px 6px; font-weight: 600; font-size: 14px; color: var(--ink-soft); cursor: pointer; min-height: 40px; }
nav.tabs button[aria-selected="true"] { background: var(--accent); border-color: var(--accent); color: var(--paper); }

main .wrap { padding-block: 18px 64px; display: grid; gap: 18px; }
.notice { background: var(--accent-wash); color: var(--ink); border-radius: 10px; padding: 10px 14px; font-size: 14px; }
.notice.warn { background: var(--blocked-wash); }

.filters { display: grid; gap: 10px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chips button { white-space: nowrap; border: 1px solid var(--line); background: var(--paper); border-radius: 99px; padding: 6px 12px; font-size: 13px; font-weight: 500; color: var(--ink-soft); cursor: pointer; min-height: 34px; }
.chips button[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.search-row { display: flex; gap: 8px; }
.search-row input, .search-row select { min-width: 0; border: 1px solid var(--line); background: var(--paper); border-radius: 8px; padding: 8px 10px; font-size: 16px; }
.search-row input { flex: 1; }
details.help { background: var(--paper); border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; font-size: 14px; }
details.help summary { font-weight: 600; cursor: pointer; }
details.help p, details.help ul { margin: 8px 0 0; color: var(--ink-soft); }
details.help ul { padding-left: 18px; display: grid; gap: 4px; }
code { font-family: var(--mono); font-size: 13px; background: var(--neutral-wash); padding: 1px 5px; border-radius: 4px; color: var(--ink); overflow-wrap: anywhere; }

section.group h2 { font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-faint); margin: 0 0 8px; }
.list { background: var(--paper); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 2px 12px; align-items: center; width: 100%; text-align: left; background: none; border: 0; border-top: 1px solid var(--line); padding: 12px 14px; cursor: pointer; min-height: 56px; }
.row:first-child { border-top: 0; }
.row:hover { background: var(--bg); }
.tc { font-family: var(--mono); font-size: 13px; color: var(--ink-faint); font-variant-numeric: tabular-nums; }
.row .name { font-weight: 500; }
.row .tester { display: none; }
.row .meta { grid-column: 2 / 4; font-size: 13px; color: var(--ink-faint); }
.row.recorded .name { color: var(--ink-soft); }
@media (min-width: 900px) {
  .row { grid-template-columns: 4.5rem minmax(0, 2fr) minmax(0, 1.2fr) minmax(0, 1.6fr) 7.5rem; gap: 16px; }
  .row .tester { display: block; font-size: 14px; color: var(--ink-soft); }
  .row .meta { grid-column: auto; grid-row: 1; grid-column-start: 4; }
  .row .pill { justify-self: end; }
}

.pill { display: inline-block; border-radius: 99px; padding: 2px 10px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.pill.pass { background: var(--pass-wash); color: var(--pass); }
.pill.fail { background: var(--fail-wash); color: var(--fail); }
.pill.blocked { background: var(--blocked-wash); color: var(--blocked); }
.pill.oos, .pill.none { background: var(--neutral-wash); color: var(--ink-soft); }
.pill.critical { background: var(--fail); color: var(--paper); }
.pill.high { background: var(--fail-wash); color: var(--fail); }
.pill.medium { background: var(--blocked-wash); color: var(--blocked); }
.pill.low { background: var(--neutral-wash); color: var(--ink-soft); }

.empty { padding: 28px 18px; text-align: center; color: var(--ink-soft); }
.cards { display: grid; gap: 18px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr)); align-items: start; }
.card { background: var(--paper); border: 1px solid var(--line); border-radius: 12px; padding: 16px; display: grid; gap: 12px; }
.card h3 { margin: 0; font-size: 16px; }
table.sum { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
table.sum td { padding: 8px 0; border-top: 1px solid var(--line); }
table.sum td:last-child { text-align: right; font-weight: 600; }
table.sum tr:first-child td { border-top: 0; }
.criteria { display: grid; gap: 10px; margin: 0; padding: 0; list-style: none; }
.criteria li { display: grid; grid-template-columns: 1fr auto; gap: 12px; align-items: start; font-size: 14px; }
.criteria small { display: block; color: var(--ink-faint); font-size: 13px; }

.btn { display: inline-flex; align-items: center; justify-content: center; border: 1px solid var(--line); background: var(--paper); border-radius: 10px; padding: 10px 16px; font-weight: 600; cursor: pointer; min-height: 44px; text-decoration: none; color: var(--ink); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--paper); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }

/* Sign-in */
.signin { max-width: 420px; margin: 12vh auto 0; background: var(--paper); border: 1px solid var(--line); border-radius: 14px; padding: 24px; display: grid; gap: 16px; }
.signin h1 { font-size: 22px; }
.signin p { margin: 0; color: var(--ink-soft); }

/* The recording sheet */
.scrim { position: fixed; inset: 0; background: rgba(10, 15, 18, .45); z-index: 20; display: flex; align-items: flex-end; justify-content: center; }
.sheet { background: var(--paper); width: 100%; max-width: 720px; max-height: 92vh; overflow-y: auto; border-radius: 16px 16px 0 0; box-shadow: var(--shadow);
  padding: 20px max(20px, env(safe-area-inset-right, 0px)) calc(20px + env(safe-area-inset-bottom, 0px)) max(20px, env(safe-area-inset-left, 0px)); display: grid; gap: 16px; }
@media (min-width: 760px) { .scrim { align-items: center; } .sheet { border-radius: 16px; max-height: 88vh; padding: 24px; } }
.sheet-head { display: flex; justify-content: space-between; gap: 12px; align-items: start; }
.sheet-head h2 { margin: 2px 0 0; font-size: 19px; line-height: 1.3; text-wrap: balance; }
.close { border: 0; background: var(--neutral-wash); border-radius: 99px; width: 36px; height: 36px; flex: none; cursor: pointer; font-size: 18px; line-height: 1; }
.label { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-faint); margin-bottom: 4px; }
.block p { margin: 0; }
.expect { background: var(--accent-wash); border-radius: 10px; padding: 10px 12px; }
.choices { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
@media (max-width: 420px) { .choices { grid-template-columns: repeat(2, 1fr); } }
.choices button { border: 1.5px solid var(--line); background: var(--paper); border-radius: 10px; padding: 10px 4px; font-weight: 600; cursor: pointer; min-height: 48px; }
.choices button[aria-pressed="true"][data-v="pass"] { background: var(--pass-wash); border-color: var(--pass); color: var(--pass); }
.choices button[aria-pressed="true"][data-v="fail"] { background: var(--fail-wash); border-color: var(--fail); color: var(--fail); }
.choices button[aria-pressed="true"][data-v="blocked"] { background: var(--blocked-wash); border-color: var(--blocked); color: var(--blocked); }
.choices button[aria-pressed="true"][data-v="oos"] { background: var(--neutral-wash); border-color: var(--ink-soft); }
.field { display: grid; gap: 4px; }
.field > span { font-size: 14px; font-weight: 600; }
.field > small { color: var(--ink-faint); font-size: 13px; }
.field input, .field textarea, .field select { width: 100%; border: 1px solid var(--line); background: var(--paper); border-radius: 8px; padding: 9px 10px; font-size: 16px; }
.field textarea { min-height: 76px; resize: vertical; }
.defect-box { border: 1px solid var(--line); border-radius: 12px; padding: 14px; display: grid; gap: 12px; background: var(--bg); }
.sev { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
@media (max-width: 480px) { .sev { grid-template-columns: repeat(2, 1fr); } }
.sev button { border: 1.5px solid var(--line); background: var(--paper); border-radius: 8px; padding: 8px 4px; cursor: pointer; text-align: center; min-height: 44px; font-size: 14px; }
.sev button small { display: block; font-size: 11px; color: var(--ink-faint); }
.sev button[aria-pressed="true"] { border-color: var(--ink); background: var(--neutral-wash); font-weight: 600; }
.history { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.history li { font-size: 14px; display: grid; gap: 2px; padding-top: 8px; border-top: 1px solid var(--line); }
.history li:first-child { border-top: 0; padding-top: 0; }
.h-top { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; color: var(--ink-faint); font-size: 13px; }
.shot { max-width: 100%; border-radius: 8px; border: 1px solid var(--line); }
.err { color: var(--fail); font-size: 14px; }
.err:empty { display: none; }
.toast { position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); background: var(--ink); color: var(--paper); padding: 10px 16px; border-radius: 10px; font-size: 14px; z-index: 30; box-shadow: var(--shadow); max-width: calc(100% - 32px); }
@media (prefers-reduced-motion: reduce) { .bar span { transition: none; } }
