/* styles.css — Qeckmate.
 *
 * Swiss / International Typographic Style, in black and white only.
 *
 * The rules that follow from that, and that everything here obeys:
 *
 *   - Two values: black and white. Everything between them is black at an
 *     opacity, never a hue. There is no accent colour.
 *   - A neutral grotesque, flush left, ragged right. Never justified,
 *     never centred.
 *   - Hierarchy comes from scale, weight and space. Nothing is emphasised
 *     with colour, because there is none to spend.
 *   - Hairline rules divide. Boxes, shadows and rounded corners do not.
 *   - Numbers are tabular and right-aligned, so a column can be read down.
 *
 * The hard part of monochrome in this app is that a verdict used to be red or
 * green. It is now inversion: a failing result is a solid black field with the
 * word knocked out in white, and a passing one is the same word on white
 * inside a hairline. At arm's length on a factory floor that reads faster than
 * the colour did, and it survives a photocopier, a fax and a black-and-white
 * print — which the colour version did not.
 *
 * Defect classes are ranked the same way: critical is solid, major is
 * outlined, minor is a rule. Weight descends with severity.
 *
 * Sizes assume a phone held in one hand while the other holds the product.
 * Anything tapped repeatedly — pass/fail, buttons, fields — is at least 44px.
 * Destructive affordances are deliberately 40px: still hittable, but not so
 * inviting that a fumble throws away evidence.
 */

:root {
  --black: #000;
  --white: #fff;

  --paper: var(--white);
  --ink: var(--black);

  /* Black at an opacity. Named for what they are for, not what they look
     like, so inverting for dark mode is a single block of overrides. */
  --ink-2: rgba(0, 0, 0, 0.66);
  --ink-3: rgba(0, 0, 0, 0.46);
  --ink-4: rgba(0, 0, 0, 0.28);
  --rule: rgba(0, 0, 0, 0.92);
  --rule-2: rgba(0, 0, 0, 0.22);
  --rule-3: rgba(0, 0, 0, 0.1);
  --wash: rgba(0, 0, 0, 0.045);

  --gap: 16px;
  --pad: 20px;
  --safe-b: env(safe-area-inset-bottom, 0px);

  /* Helvetica first — this is a Swiss grid and it wants the face it was drawn
     for. Everything after it is the nearest neutral grotesque per platform. */
  --sans: "Helvetica Neue", Helvetica, Inter, "Segoe UI", Roboto, Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;

  color-scheme: light dark;
}

/* Dark mode is a literal inversion. In a two-value palette there is nothing
   else it could honestly be. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: var(--black);
    --ink: var(--white);
    --ink-2: rgba(255, 255, 255, 0.68);
    --ink-3: rgba(255, 255, 255, 0.48);
    --ink-4: rgba(255, 255, 255, 0.3);
    --rule: rgba(255, 255, 255, 0.92);
    --rule-2: rgba(255, 255, 255, 0.24);
    --rule-3: rgba(255, 255, 255, 0.12);
    --wash: rgba(255, 255, 255, 0.06);
  }
}

:root[data-theme="dark"] {
  --paper: var(--black);
  --ink: var(--white);
  --ink-2: rgba(255, 255, 255, 0.68);
  --ink-3: rgba(255, 255, 255, 0.48);
  --ink-4: rgba(255, 255, 255, 0.3);
  --rule: rgba(255, 255, 255, 0.92);
  --rule-2: rgba(255, 255, 255, 0.24);
  --rule-3: rgba(255, 255, 255, 0.12);
  --wash: rgba(255, 255, 255, 0.06);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.4;
  letter-spacing: -0.006em;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  -webkit-font-smoothing: antialiased;
}

/* Numbers are compared down columns. Tabular figures keep the digits in the
   same place so the eye can do it without reading. */
.n, .job-tally, .statbar strong, .tallybox strong, .reading-in, .job-ref,
.table td, .table th, .kv dd, .defect-qty, .measure-band, .measure-stats,
code { font-variant-numeric: tabular-nums; font-feature-settings: "tnum" 1; }

h1 { font-size: 1.5rem; line-height: 1.08; margin: 0; letter-spacing: -0.028em; font-weight: 700; }

/* The micro-label. Uppercase, tracked out, sitting on a rule — the Swiss
   section marker, used everywhere a group of things needs naming. */
h2 {
  font-size: 0.625rem;
  margin: 0 0 14px;
  padding-bottom: 7px;
  border-bottom: 1px solid var(--rule);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--ink);
  font-weight: 700;
}
h3 { font-size: 0.9rem; margin: 18px 0 8px; font-weight: 700; letter-spacing: -0.012em; }
p { margin: 0 0 10px; }
a { color: inherit; text-decoration: none; }

.muted { color: var(--ink-3); font-size: 0.8125rem; }
.count { color: var(--ink-3); font-weight: 400; }

/* ---- boot -------------------------------------------------------- */

.boot {
  position: fixed;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: start;
  align-content: center;
  gap: 18px;
  padding: 40px;
  color: var(--ink);
  font-size: 0.6875rem;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  font-weight: 700;
}
.boot-mark { width: 52px; height: 52px; }
.boot pre { font-size: 0.7rem; max-width: 80vw; white-space: pre-wrap; letter-spacing: 0; text-transform: none; font-weight: 400; }

/* ---- chrome ------------------------------------------------------ */

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px var(--pad);
  padding-top: calc(12px + env(safe-area-inset-top, 0px));
  background: var(--paper);
  border-bottom: 1px solid var(--rule);
}

.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; letter-spacing: -0.02em; }
.brand-mark { width: 24px; height: 24px; }

/* The sync state is a word, not a dot. Its weight carries the urgency. */
.syncpill {
  font-size: 0.625rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-weight: 500;
  padding: 4px 0 4px 14px;
  border-left: 1px solid var(--rule-2);
  color: var(--ink-3);
  white-space: nowrap;
}
.syncpill[data-mode="ok"] { color: var(--ink-2); }
.syncpill[data-mode="pending"], .syncpill[data-mode="busy"] { color: var(--ink); font-weight: 700; }
.syncpill[data-mode="error"] {
  color: var(--paper); background: var(--ink); font-weight: 700;
  padding: 4px 8px; border-left: 0;
}

.view {
  max-width: 860px;
  margin: 0 auto;
  padding: var(--pad);
  padding-bottom: calc(100px + var(--safe-b));
}

.bottombar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  background: var(--paper);
  border-top: 1px solid var(--rule);
  padding-bottom: var(--safe-b);
}

.navbtn {
  display: grid;
  justify-items: center;
  gap: 4px;
  padding: 10px 4px 9px;
  font-size: 0.5625rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 500;
  color: var(--ink-3);
  min-height: 54px;
  border-left: 1px solid var(--rule-3);
}
.navbtn:first-child { border-left: 0; }
.navbtn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: square; stroke-linejoin: miter; }
.navbtn.is-on { color: var(--ink); font-weight: 700; }
.navbtn.is-on svg { stroke-width: 2; }

/* ---- buttons ----------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 18px;
  border: 1px solid var(--rule);
  border-radius: 0;
  background: var(--paper);
  color: var(--ink);
  font: inherit;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  cursor: pointer;
  white-space: nowrap;
}
.btn:disabled { opacity: 0.3; cursor: not-allowed; }
.btn--primary { background: var(--ink); color: var(--paper); }
.btn--ghost { border-color: var(--rule-2); font-weight: 500; }
.btn--danger { border-style: dashed; }
.btn--sm { min-height: 40px; padding: 0 12px; font-size: 0.6875rem; letter-spacing: 0.08em; }

.iconbtn {
  border: 0;
  background: transparent;
  color: var(--ink-3);
  font-size: 1.1rem;
  line-height: 1;
  width: 40px;
  height: 40px;
  border-radius: 0;
  cursor: pointer;
  flex: none;
}
.iconbtn:hover { background: var(--ink); color: var(--paper); }

.formrow { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 14px; }
.formrow .btn { flex: 1 1 auto; }

.back {
  display: grid;
  place-items: center;
  width: 36px; height: 36px;
  margin-left: -10px;
  font-size: 1.5rem;
  line-height: 1;
  color: var(--ink);
  flex: none;
}

/* ---- page heads -------------------------------------------------- */

.page-head {
  display: flex;
  align-items: baseline;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: var(--gap);
  padding-bottom: 12px;
  border-bottom: 2px solid var(--rule);
}
.page-head h1 { flex: 1 1 auto; }
.page-head .formrow { margin: 0; flex: 0 1 auto; }

/* ---- jobs list --------------------------------------------------- */

.toolbar { display: grid; gap: 12px; margin-bottom: var(--gap); }

.search {
  width: 100%;
  min-height: 44px;
  padding: 0 0 0 2px;
  border: 0;
  border-bottom: 1px solid var(--rule);
  border-radius: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  font-size: 1rem;
}
.search::placeholder { color: var(--ink-4); }
.search:focus { outline: 0; border-bottom-width: 2px; }

.chips { display: flex; gap: 0; overflow-x: auto; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  border: 1px solid var(--rule-2);
  border-left-width: 0;
  background: transparent;
  color: var(--ink-3);
  border-radius: 0;
  padding: 8px 13px;
  font: inherit;
  font-size: 0.625rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
}
.chip:first-child { border-left-width: 1px; }
.chip span { margin-left: 5px; font-variant-numeric: tabular-nums; }
.chip.is-on { background: var(--ink); color: var(--paper); border-color: var(--ink); font-weight: 700; }

/* A list of rules, not a stack of cards. */
.joblist { display: grid; border-top: 1px solid var(--rule); }

.job {
  display: block;
  padding: 14px 0;
  border-bottom: 1px solid var(--rule-3);
}
.job:active { background: var(--wash); }
/* Select mode. The checkbox is a square that fills solid when chosen — the
   same ink-or-nothing logic the verdicts use, rather than a tick glyph. */
.job--pick { display: flex; align-items: flex-start; gap: 14px; cursor: pointer; }
.job--pick .job-body { flex: 1 1 auto; min-width: 0; }
.job--pick.is-picked { background: var(--wash); }

.job-pick {
  appearance: none;
  -webkit-appearance: none;
  flex: none;
  width: 20px; height: 20px;
  margin: 3px 0 0;
  border: 1px solid var(--rule);
  border-radius: 0;
  background: transparent;
  cursor: pointer;
}
.job-pick:checked { background: var(--ink); box-shadow: inset 0 0 0 3px var(--paper); }
.job-pick:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }

.job-top { display: flex; align-items: baseline; gap: 10px; margin-bottom: 3px; }
.job-ref { font-family: var(--mono); font-size: 0.6875rem; color: var(--ink-3); letter-spacing: 0.04em; }
.job-title { font-weight: 700; letter-spacing: -0.018em; font-size: 1.0625rem; }
.job-sub { color: var(--ink-3); font-size: 0.8125rem; }
.job-foot {
  display: flex; gap: 14px; align-items: baseline; margin-top: 7px;
  font-size: 0.625rem; text-transform: uppercase; letter-spacing: 0.1em; color: var(--ink-3);
}
.job-tally { margin-left: auto; display: flex; gap: 8px; font-family: var(--mono); letter-spacing: 0; }

/* Severity by weight, since there is no colour to rank it with. */
.t-critical { color: var(--ink); font-weight: 700; }
.t-major { color: var(--ink-2); font-weight: 700; }
.t-minor { color: var(--ink-3); font-weight: 400; }
.t-pass { color: var(--ink-2); font-weight: 400; }

.tag {
  font-size: 0.5625rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-weight: 700;
  padding: 3px 6px;
  border: 1px solid var(--rule-2);
  color: var(--ink-3);
}
.tag--in_progress { border-color: var(--rule); color: var(--ink); }
.tag--complete { background: var(--ink); color: var(--paper); border-color: var(--ink); }

/* The verdict. Inversion carries it: failed is knocked out of solid black. */
.verdict {
  font-size: 0.5625rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  padding: 4px 8px;
  margin-left: auto;
  border: 1px solid var(--ink);
}
.verdict--pass { background: var(--paper); color: var(--ink); }
.verdict--fail { background: var(--ink); color: var(--paper); }
.verdict--hold { background: var(--paper); color: var(--ink); border-style: double; border-width: 3px; padding: 2px 6px; }
.verdict--pending { background: var(--paper); color: var(--ink-3); border-color: var(--rule-2); border-style: dashed; }

.empty { padding: 72px 0; color: var(--ink-3); display: grid; justify-items: start; gap: 18px; }
.empty-mark { width: 58px; height: 58px; color: var(--ink-4); }
.empty p { font-size: 1.125rem; color: var(--ink-2); margin: 0; }

/* ---- job head ---------------------------------------------------- */

.job-head { margin-bottom: var(--gap); }
.job-head-top { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.job-head-id { display: flex; align-items: baseline; gap: 12px; flex: 1 1 auto; min-width: 0; }
.job-head-verdict { flex: none; }
.job-head-verdict .verdict { margin: 0; }
.job-head h1 { font-size: 1.625rem; }
.job-head-sub {
  color: var(--ink-3); font-size: 0.625rem; margin: 5px 0 0;
  text-transform: uppercase; letter-spacing: 0.12em;
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.job-head-sub .sub-sep { color: var(--ink-4); }

/* The subtitle's two fields. They have to be invisible as controls until
   touched — the line is a statement about the job, not a form — so they carry
   the micro-label's own type and only take a rule on hover and focus.
   `font: inherit` would drop the tracking, so the type is restated. */
.sub-input {
  border: 0;
  border-bottom: 1px solid transparent;
  border-radius: 0;
  background: transparent;
  color: inherit;
  font-family: inherit;
  font-size: inherit;
  font-weight: inherit;
  text-transform: inherit;
  letter-spacing: inherit;
  padding: 0 2px;
  margin: 0;
  /* Taller than the 10px type it holds, so it is not a hairline to hit. This
     is a secondary header control rather than one tapped all day, so it sits
     below the 44px the checklist buttons use. */
  min-height: 32px;
  width: 22ch;
}
.sub-input::placeholder { color: var(--ink-4); text-transform: inherit; letter-spacing: inherit; }
.sub-input:hover:not(:focus) { border-bottom-color: var(--rule-3); }
.sub-input:focus { outline: 0; border-bottom-color: var(--ink); color: var(--ink); }

/* A select sizes to its own content; only the free-text field needs a guess. */
.sub-input--select { width: auto; cursor: pointer; }

/* Where it is supported, the text field sizes to what is typed, so the rule
   under it is the width of the words rather than an arbitrary box. */
@supports (field-sizing: content) {
  .sub-input { field-sizing: content; width: auto; min-width: 12ch; max-width: 44ch; }
}

/* The heading is an input, and has to look exactly like the h1 it replaced —
   no box, no chrome, nothing that says "form field" until you touch it. The
   rule on focus is the same one every other field in the app uses. */
.job-title-input {
  display: block;
  width: 100%;
  margin: 0;
  padding: 0 0 2px;
  border: 0;
  border-bottom: 1px solid transparent;
  border-radius: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 1.625rem;
  font-weight: 700;
  line-height: 1.08;
  letter-spacing: -0.028em;
}
.job-title-input::placeholder { color: var(--ink-4); }
.job-title-input:hover:not(:focus) { border-bottom-color: var(--rule-3); }
.job-title-input:focus { outline: 0; border-bottom-color: var(--ink); }

#savestate { font-size: 0.5625rem; color: var(--ink-3); text-transform: uppercase; letter-spacing: 0.14em; }
#savestate[data-state="saving"] { color: var(--ink); font-weight: 700; }

.locked-bar {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  margin-top: 12px; padding: 10px 12px;
  background: var(--ink);
  color: var(--paper);
  font-size: 0.75rem;
}
.locked-bar .btn { border-color: var(--paper); color: var(--paper); background: transparent; }

.tabs {
  display: flex;
  gap: 0;
  margin-top: 16px;
  overflow-x: auto;
  scrollbar-width: none;
  border-bottom: 1px solid var(--rule);
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  display: flex; align-items: center; gap: 6px;
  padding: 10px 14px 9px;
  font-size: 0.625rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 500;
  color: var(--ink-3);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  white-space: nowrap;
}
.tab:first-child { padding-left: 0; }
.tab.is-on { color: var(--ink); border-bottom-color: var(--ink); font-weight: 700; }
.tab-badge { font-size: 0.625rem; font-family: var(--mono); letter-spacing: 0; color: var(--ink-4); }
.tab.is-on .tab-badge { color: var(--ink-2); }

/* ---- cards and forms --------------------------------------------- */

/* Not cards — bands of content separated by space and a rule. */
.card {
  background: transparent;
  border: 0;
  border-radius: 0;
  padding: 0;
  margin-bottom: 34px;
}
.card--danger h2 { border-bottom-style: dashed; }
.card--warn h2 { border-bottom-width: 2px; }

.grid { display: grid; gap: 0 26px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }

.f { display: grid; gap: 0; margin-bottom: 14px; align-content: start; }
.f-label {
  font-size: 0.5625rem; color: var(--ink-3); font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.13em; margin-bottom: 4px;
}
.f-hint { font-size: 0.6875rem; color: var(--ink-3); margin-top: 5px; }

/* Ruled fields. A box around every input would fight the grid. */
.f-input {
  width: 100%;
  min-height: 44px;
  padding: 10px 2px;
  border: 0;
  border-bottom: 1px solid var(--rule-2);
  border-radius: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  font-size: 0.9375rem;
}
.f-input::placeholder { color: var(--ink-4); }
textarea.f-input { min-height: 0; resize: vertical; line-height: 1.45; }
.f-input:focus { outline: 0; border-bottom: 2px solid var(--ink); padding-bottom: 9px; }
.f-input:disabled { opacity: 0.45; }
.f-input--sm { min-height: 38px; padding: 6px 2px; font-size: 0.8125rem; }
.f-input--plain { border-bottom-color: transparent; font-weight: 700; }
.f-input--plain:focus { border-bottom-color: var(--ink); }
select.f-input { padding-left: 0; }

.checkrow { display: flex; align-items: center; gap: 12px; padding: 10px 0; font-size: 0.875rem; }
.checkrow input { width: 18px; height: 18px; accent-color: var(--black); border-radius: 0; }

.kv { margin: 0; display: grid; }
.kv > div {
  display: flex; justify-content: space-between; gap: 14px;
  font-size: 0.8125rem; border-bottom: 1px solid var(--rule-3); padding: 9px 0;
}
.kv dt { color: var(--ink-3); text-transform: uppercase; font-size: 0.625rem; letter-spacing: 0.1em; font-weight: 700; }
.kv dd { margin: 0; }

.notice {
  padding: 11px 0 11px 13px;
  border-left: 3px solid var(--ink);
  font-size: 0.8125rem;
  margin: 14px 0;
}
.notice--warn { background: var(--wash); }

.footnote { font-size: 0.6875rem; color: var(--ink-3); margin: 12px 0 0; line-height: 1.5; }
ul.footnote { padding-left: 16px; }

.blockers { margin: 0; padding-left: 0; list-style: none; font-size: 0.8125rem; }
.blockers li { padding: 8px 0 8px 18px; border-bottom: 1px solid var(--rule-3); position: relative; }
.blockers li::before { content: "—"; position: absolute; left: 0; }

/* ---- sampling ---------------------------------------------------- */

.statbar {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(84px, 1fr));
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  margin-bottom: 18px;
}
.statbar > div { padding: 12px 14px 12px 0; display: grid; gap: 4px; align-content: start; border-left: 1px solid var(--rule-3); padding-left: 14px; }
.statbar > div:first-child { border-left: 0; padding-left: 0; }
.statbar span { font-size: 0.5625rem; color: var(--ink-3); text-transform: uppercase; letter-spacing: 0.12em; font-weight: 700; }
.statbar strong { font-size: 1.375rem; font-weight: 700; letter-spacing: -0.03em; line-height: 1; }

/* The number the inspector acts on. Inverted, so it is the one thing the eye
   lands on when the phone comes out of a pocket. */
.statbar-hero { background: var(--ink); color: var(--paper); padding-left: 14px !important; }
.statbar-hero span { color: var(--paper); opacity: 0.7; }
.statbar-hero strong { font-size: 2rem; }

.table { width: 100%; border-collapse: collapse; font-size: 0.8125rem; }
.table th, .table td { padding: 11px 8px 11px 0; text-align: left; border-bottom: 1px solid var(--rule-3); }
.table thead th {
  font-size: 0.5625rem; text-transform: uppercase; letter-spacing: 0.12em;
  color: var(--ink-3); font-weight: 700; border-bottom: 1px solid var(--rule);
}
.table .n { text-align: right; }
.table tbody th { font-weight: 500; }
.n--found { font-weight: 700; font-size: 1rem; }

/* A rejecting row is struck with a heavy left rule and its count inverted. */
.row--reject { background: var(--wash); }
.row--reject th { box-shadow: inset 3px 0 0 var(--ink); padding-left: 10px; font-weight: 700; }
.row--reject .n--found { background: var(--ink); color: var(--paper); padding: 2px 6px; }
.state { text-align: right; white-space: nowrap; }
.headroom {
  display: block; font-size: 0.5625rem; color: var(--ink-3);
  margin-top: 4px; text-transform: uppercase; letter-spacing: 0.1em;
}

/* Severity: solid, outlined, rule. */
.dot { display: inline-block; width: 9px; height: 9px; margin-right: 9px; vertical-align: 0; }
.dot--critical { background: var(--ink); }
.dot--major { border: 1.5px solid var(--ink); }
.dot--minor { border-bottom: 1.5px solid var(--ink-3); height: 5px; }

.verdict-large {
  display: grid;
  gap: 6px;
  padding: 18px 20px;
  border: 1px solid var(--ink);
}
.verdict-large strong { font-size: 1.75rem; letter-spacing: 0.08em; font-weight: 700; line-height: 1; }
.verdict-large span { font-size: 0.8125rem; }
.verdict-large--pass { background: var(--paper); color: var(--ink); }
.verdict-large--pass span { color: var(--ink-2); }
.verdict-large--fail { background: var(--ink); color: var(--paper); }
.verdict-large--fail span { color: var(--paper); opacity: 0.75; }
.verdict-large--hold { border-width: 4px; border-style: double; }
.verdict-large--hold span { color: var(--ink-2); }
.verdict-large--pending { border-style: dashed; border-color: var(--rule-2); color: var(--ink-3); }

/* ---- checklist --------------------------------------------------- */

.progress {
  display: flex; align-items: center; gap: 14px;
  margin-bottom: 18px; padding-bottom: 10px;
  border-bottom: 1px solid var(--rule);
  font-size: 0.625rem; text-transform: uppercase; letter-spacing: 0.12em;
  color: var(--ink-3); font-weight: 700;
}
.progress-bar { flex: 1 1 auto; height: 3px; background: var(--rule-3); }
.progress-bar i { display: block; height: 100%; background: var(--ink); }

.items { display: grid; }
.item { padding: 13px 0; border-bottom: 1px solid var(--rule-3); }
.item:last-child { border-bottom: 0; }
.item-main { display: flex; gap: 14px; align-items: flex-start; }
.item-text { flex: 1 1 auto; font-size: 0.875rem; line-height: 1.4; }
.item-hint { display: block; font-size: 0.6875rem; color: var(--ink-3); margin-top: 3px; }

/* A failed line is the one thing on the page that must not be missed. */
.item--fail { box-shadow: inset 3px 0 0 var(--ink); padding-left: 13px; }
.item--fail .item-text { font-weight: 700; }
.item--na .item-text { color: var(--ink-3); }

.picks { display: flex; gap: 0; flex: none; }
.pick {
  min-width: 48px; min-height: 44px;
  border: 1px solid var(--rule-2);
  border-left-width: 0;
  border-radius: 0;
  background: transparent;
  color: var(--ink-3);
  font: inherit; font-size: 0.625rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.08em;
  cursor: pointer;
}
.pick:first-child { border-left-width: 1px; }
.pick.is-on { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.pick--na.is-on { background: var(--paper); color: var(--ink); border-color: var(--ink); border-style: dashed; }
.pick:disabled { opacity: 0.35; }

.item-extra { margin-top: 10px; display: grid; gap: 10px; padding-left: 0; }

/* ---- thumbnails -------------------------------------------------- */

.thumbs { display: flex; flex-wrap: wrap; gap: 6px; }
.thumb {
  position: relative;
  width: 64px; height: 64px;
  border-radius: 0;
  overflow: hidden;
  border: 1px solid var(--rule-2);
  background: var(--wash);
  flex: none;
}
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb-x {
  position: absolute; top: 0; right: 0;
  width: 26px; height: 26px;
  border: 0; border-radius: 0;
  background: var(--black);
  color: #fff; font-size: 0.8rem; line-height: 1;
  cursor: pointer;
}
.thumb--add {
  display: grid; place-items: center;
  border-style: dashed;
  color: var(--ink-3);
  font-size: 1.3rem;
  cursor: pointer;
}

/* ---- defects ----------------------------------------------------- */

.tallies { display: grid; grid-template-columns: repeat(3, 1fr); border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); margin-bottom: 20px; }
.tallybox { padding: 13px 14px 13px 0; display: grid; gap: 3px; border-left: 1px solid var(--rule-3); padding-left: 14px; }
.tallybox:first-child { border-left: 0; padding-left: 0; }
.tallybox strong { font-size: 1.875rem; line-height: 1; font-weight: 700; letter-spacing: -0.04em; }
.tallybox span { font-size: 0.5625rem; color: var(--ink-3); text-transform: uppercase; letter-spacing: 0.12em; font-weight: 700; }
.tallybox--critical strong { font-weight: 700; }
.tallybox--major strong { color: var(--ink-2); }
.tallybox--minor strong { color: var(--ink-3); font-weight: 400; }

.segmented { display: grid; grid-auto-flow: column; gap: 0; margin-bottom: 10px; }
.seg { position: relative; }
.seg input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.seg span {
  display: grid; place-items: center;
  min-height: 42px; padding: 0 8px;
  border: 1px solid var(--rule-2);
  border-left-width: 0;
  font-size: 0.6875rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--ink-3);
  cursor: pointer;
}
.seg:first-child span { border-left-width: 1px; }
.seg input:checked + span { background: var(--ink); color: var(--paper); border-color: var(--ink); }

/* Critical solid, major outlined, minor ruled — the same rank as the dots. */
.chip--critical, .chip--major, .chip--minor {
  font-size: 0.5625rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.12em;
  padding: 3px 7px; border-radius: 0; cursor: default; flex: none;
}
.chip--critical { background: var(--ink); color: var(--paper); border: 1px solid var(--ink); }
.chip--major { background: transparent; color: var(--ink); border: 1px solid var(--ink); }
.chip--minor { background: transparent; color: var(--ink-3); border: 1px solid var(--rule-2); }

.defect { padding: 14px 0; border-bottom: 1px solid var(--rule-3); }
.defect:last-child { border-bottom: 0; }
.defect-head { display: flex; align-items: center; gap: 10px; }
.defect-n { font-family: var(--mono); font-size: 0.625rem; color: var(--ink-4); }
.defect-title { flex: 1 1 auto; font-size: 0.875rem; font-weight: 500; min-width: 0; }
.defect-qty { font-family: var(--mono); font-weight: 700; font-size: 1rem; }
.defect-meta {
  display: flex; gap: 14px; font-size: 0.625rem; color: var(--ink-3); margin: 5px 0 0;
  text-transform: uppercase; letter-spacing: 0.08em;
}
.defect-meta code { font-family: var(--mono); letter-spacing: 0; }
.defect-desc { font-size: 0.8125rem; color: var(--ink-2); margin: 6px 0; }
.defect .thumbs { margin-top: 9px; }

/* ---- measurements ------------------------------------------------ */

.measure { padding: 16px 0; border-bottom: 1px solid var(--rule-3); }
.measure:last-of-type { border-bottom: 0; }
.measure--fail { box-shadow: inset 3px 0 0 var(--ink); padding-left: 13px; }
.measure-head { display: flex; align-items: center; gap: 8px; }
.measure-spec { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0 12px; margin: 10px 0; }
.measure-spec label { display: grid; gap: 2px; font-size: 0.5625rem; color: var(--ink-3); text-transform: uppercase; letter-spacing: 0.1em; font-weight: 700; }
.measure-band { font-size: 0.6875rem; color: var(--ink-2); margin: 0 0 10px; text-transform: uppercase; letter-spacing: 0.08em; }
.measure-stats { font-size: 0.6875rem; color: var(--ink-3); margin: 10px 0 0; }
.measure-stats b { color: var(--ink); }

.readings { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.reading { position: relative; display: inline-flex; }
.reading-in {
  width: 84px; min-height: 42px;
  padding: 6px 20px 6px 8px;
  border: 1px solid var(--rule-2);
  border-radius: 0;
  background: transparent;
  color: inherit; font: inherit; font-size: 0.875rem;
}
.reading-in:focus { outline: 0; border-color: var(--ink); }
.reading--in .reading-in { border-color: var(--rule-2); }
/* Out of tolerance is inverted, the same language as a rejecting row. */
.reading--over .reading-in, .reading--under .reading-in {
  border-color: var(--ink); background: var(--ink); color: var(--paper); font-weight: 700;
}
.reading--over .reading-x, .reading--under .reading-x { color: var(--paper); }
.reading-x {
  position: absolute; right: 1px; top: 50%; transform: translateY(-50%);
  width: 18px; height: 18px; border: 0; border-radius: 0;
  background: transparent; color: var(--ink-3); font-size: 0.75rem; line-height: 1; cursor: pointer;
}
.reading-add {
  min-height: 42px; padding: 0 14px;
  border: 1px dashed var(--rule-2); border-radius: 0;
  background: transparent; color: var(--ink-3);
  font: inherit; font-size: 0.625rem; text-transform: uppercase; letter-spacing: 0.1em; font-weight: 700;
  cursor: pointer;
}

/* ---- photos ------------------------------------------------------ */

.shots { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; margin-top: 16px; }
.shot { margin: 0; }
.shot img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; display: block; border: 1px solid var(--rule-2); }
.shot figcaption { display: flex; align-items: center; gap: 4px; margin-top: 4px; }
.shot figcaption .f-input { font-size: 0.75rem; min-height: 34px; padding: 4px 0; }

/* ---- signature --------------------------------------------------- */

.padwrap { display: grid; gap: 10px; justify-items: start; }
.pad {
  width: 100%;
  height: 150px;
  border: 1px solid var(--rule-2);
  border-bottom: 1px solid var(--ink);
  border-radius: 0;
  background: #fff;
  touch-action: none;
  cursor: crosshair;
}

/* ---- template editor --------------------------------------------- */

.tplitems { display: grid; gap: 0; margin-bottom: 12px; }
.tplitem { display: grid; grid-template-columns: 1fr 160px auto; gap: 10px; align-items: center; border-bottom: 1px solid var(--rule-3); }
@media (max-width: 560px) { .tplitem { grid-template-columns: 1fr auto; } .tplitem .f-input--sm { grid-column: 1 / -1; } }

/* ---- report preview ---------------------------------------------- */

.reportframe { background: #fff; border: 1px solid var(--rule); }

/* ---- ask ---------------------------------------------------------- */

/* Replaces the native confirm dialog, which webviews suppress. Squared off
   and ruled, like everything else — a rounded system dialog would have looked
   borrowed anyway. */
.ask { position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; padding: 20px; }
.ask-scrim { position: absolute; inset: 0; background: rgba(0, 0, 0, 0.55); }
:root[data-theme="dark"] .ask-scrim { background: rgba(0, 0, 0, 0.72); }

.ask-panel {
  position: relative;
  width: min(100%, 460px);
  max-height: 84vh;
  overflow-y: auto;
  background: var(--paper);
  border: 1px solid var(--ink);
  padding: 22px;
}
.ask-panel h2 {
  font-size: 1.125rem;
  text-transform: none;
  letter-spacing: -0.028em;
  color: var(--ink);
  border-bottom: 0;
  padding-bottom: 0;
  margin-bottom: 10px;
  font-weight: 700;
}
.ask-body { font-size: 0.875rem; color: var(--ink-2); margin-bottom: 14px; }

.ask-lines {
  list-style: none; margin: 0 0 16px; padding: 0;
  border-top: 1px solid var(--rule-3);
  max-height: 34vh; overflow-y: auto;
}
.ask-lines li {
  padding: 8px 0; border-bottom: 1px solid var(--rule-3);
  font-size: 0.75rem; font-family: var(--mono); color: var(--ink-2);
}

.ask-input { margin-bottom: 18px; }
.ask-actions { display: flex; gap: 10px; justify-content: flex-end; }
.ask-actions .btn { flex: 0 1 auto; }

/* The dialog owns the screen while it is up. */
body.is-asking { overflow: hidden; }

/* ---- toast ------------------------------------------------------- */

.toast {
  position: fixed;
  left: var(--pad);
  bottom: calc(76px + var(--safe-b));
  z-index: 60;
  max-width: min(92vw, 440px);
  padding: 13px 16px;
  border-radius: 0;
  background: var(--black);
  color: #fff;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 500;
  opacity: 0;
  pointer-events: none;
  transform: translateY(6px);
  transition: opacity 0.15s linear, transform 0.15s linear;
}
.toast.is-on { opacity: 1; transform: translateY(0); }
.toast[data-kind="error"] { border-left: 4px solid #fff; font-weight: 700; }

@media (prefers-reduced-motion: reduce) { .toast { transition: none; } }

/* ---- desktop ----------------------------------------------------- */

/* Past this width the bottom bar becomes a rail down the left — a desk, a
   mouse, and a 27-inch screen whose bottom edge is nowhere near the hand. */
@media (min-width: 900px) {
  .bottombar {
    top: 0; bottom: 0; right: auto;
    width: 96px;
    grid-template-columns: 1fr;
    grid-auto-rows: max-content;
    align-content: start;
    padding: 84px 0 0;
    border-top: 0;
    border-right: 1px solid var(--rule);
  }
  .navbtn { padding: 14px 4px; border-left: 0; border-bottom: 1px solid var(--rule-3); }
  .navbtn:first-child { border-top: 1px solid var(--rule-3); }
  .navbtn.is-on { background: var(--ink); color: var(--paper); }
  .topbar { padding-left: calc(96px + 28px); padding-right: 28px; }
  .view { padding-left: calc(96px + 28px); padding-right: 28px; padding-bottom: 56px; max-width: 1000px; }
  .toast { left: calc(96px + 28px); bottom: 28px; }
  .grid { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
  .tallies { max-width: 480px; }
}

@media (min-width: 1200px) {
  .view { max-width: 1100px; margin-left: 96px; }
}

/* A one-of-several question in the dialog — see `choices` in `ui.js`. */
.ask-choice { margin-bottom: 18px; }
