/* Task Helper — QUALITY: the report-type screen, the shared designer + the WHAT TO DO view (job-intake.md §42; QA-1, BRIEF-1117).
 * Copyright Rapid Surveys Pty Ltd. App tokens only (--bg --card --ink --muted --line --accent --accent-ink --ok --err --hover).
 * Namespaced .qa-. Phone first; the page never scrolls sideways. Also loaded by the developer page (platform/). */
.qa-screen.overlay { display: block; background: var(--bg); overflow-y: auto; overflow-x: hidden; -webkit-overflow-scrolling: touch; }
html.qa-open, html.qa-open body { overflow: hidden; }
.qa-bar { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; gap: 8px; min-height: 56px;
  padding: max(8px, env(safe-area-inset-top)) 12px 8px; background: var(--ink); color: #fff; }
.qa-titles { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.qa-titles h2 { margin: 0; font-size: 18px; line-height: 1.25; color: #fff; text-transform: none; letter-spacing: 0; overflow-wrap: anywhere; outline: none; }
.qa-co { font-size: 12px; color: #9aa6b5; overflow-wrap: anywhere; }
.qa-back, .qa-x { width: auto; flex: none; margin: 0; min-height: 44px; min-width: 44px; padding: 0 8px; border: 0; border-radius: 8px; background: transparent; color: #fff; font-size: 15px; font-weight: 600; }
.qa-back { max-width: 45%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qa-x { font-size: 20px; }
.qa-back:focus-visible, .qa-x:focus-visible { outline-color: #fff; }
.qa-wrap { max-width: 1100px; margin: 0 auto; padding: 12px 16px 96px; }
.qa-msg { margin: 0 0 10px; }
.qa-msg.err { color: var(--err); } .qa-msg.ok { color: var(--ok); }
.qa-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 12px; }
.qa-actions:empty { display: none; }
.qa-primary, .qa-ghost { width: auto; margin: 0; min-height: 44px; padding: 0 16px; border-radius: 10px; font: inherit; font-weight: 600; font-size: 15px; cursor: pointer; }
.qa-primary { border: 1px solid var(--accent); background: var(--accent); color: var(--accent-ink); }
.qa-ghost { border: 1px solid var(--line); background: var(--card); color: var(--ink); }
.qa-primary:disabled, .qa-ghost:disabled { opacity: .45; cursor: default; }
.qa-chip { width: auto; margin: 0; min-height: 36px; min-width: 36px; padding: 0 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--card); color: var(--ink); font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; }
.qa-chip:disabled { opacity: .4; cursor: default; }
.qa-danger { color: var(--err) !important; }
.qa-pill { display: inline-block; padding: 0 7px; border: 1px solid var(--line); border-radius: 9px; font-size: 11px; font-weight: 600; color: var(--muted); background: var(--bg); vertical-align: middle; }
.qa-pill.warn { color: #8a5a00; border-color: #e7c27a; background: #fff6e0; }
.qa-pill.on { color: var(--ok); border-color: var(--ok); background: var(--card); }
.qa-note { margin: 0 0 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); font-size: 14px; }
.qa-none { color: var(--muted); }
.qa-err { color: var(--err); }
.qa-hint { color: var(--muted); font-size: 13px; margin: 0 0 10px; }
.qa-check { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; font-size: 14px; color: var(--ink); cursor: pointer; }
.qa-check input { width: 20px; height: 20px; margin: 0; }
.qa-cards { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.qa-card { display: flex; flex-direction: column; align-items: flex-start; gap: 3px; width: 100%; margin: 0; padding: 12px 14px; text-align: left; cursor: pointer;
  background: var(--card); color: var(--ink); border: 1px solid var(--line); border-radius: 12px; font: inherit; min-height: 52px; }
.qa-card:hover { background: var(--hover); }
.qa-card b { font-size: 15px; overflow-wrap: anywhere; }
.qa-card span { font-size: 13px; color: var(--muted); overflow-wrap: anywhere; }
.qa-search { width: 100%; max-width: 420px; min-height: 44px; margin: 0 0 12px; padding: 0 12px; border: 1px solid var(--line); border-radius: 10px; font: inherit; background: var(--card); color: var(--ink); }

/* forms (designer + meta + licence) */
.qa-row { display: flex; flex-wrap: wrap; gap: 8px 12px; margin: 0 0 8px; align-items: flex-end; }
.qa-f { display: flex; flex-direction: column; gap: 3px; flex: 1 1 160px; min-width: 0; font-size: 12px; color: var(--muted); }
.qa-f.qa-wide { flex-basis: 100%; }
.qa-f.qa-num { flex: 0 1 150px; }
.qa-f input, .qa-f select, .qa-f textarea { width: 100%; min-height: 40px; padding: 6px 10px; border: 1px solid var(--line); border-radius: 8px; font: inherit; font-size: 15px; color: var(--ink); background: var(--card); box-sizing: border-box; }
.qa-f textarea { min-height: 64px; resize: vertical; }
.qa-f [aria-invalid="true"] { border-color: var(--err); }
.qa-box { margin: 0 0 14px; padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--card); }
.qa-box > h3 { margin: 0 0 8px; font-size: 15px; }
.qa-problems { margin: 0 0 12px; padding: 10px 12px 10px 28px; border: 1px solid #f3c2c2; border-radius: 10px; background: #fdecec; color: #8a1c1c; font-size: 14px; }
.qa-problems.ok { padding-left: 12px; list-style: none; border-color: #b9e2c8; background: #e8f6ee; color: #145c34; }

/* the designer */
.qa-dsec { margin: 0 0 14px; padding: 10px; border: 1px solid var(--line); border-radius: 12px; background: var(--bg); }
.qa-dsec-head { display: flex; gap: 8px; align-items: flex-end; margin: 0 0 8px; }
.qa-dsteps { list-style: none; margin: 0 0 8px; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.qa-dstep { border: 1px solid var(--line); border-radius: 10px; background: var(--card); }
.qa-dhead { display: flex; align-items: center; gap: 6px; padding: 4px 6px; }
.qa-toggle { flex: 1; min-width: 0; min-height: 44px; margin: 0; padding: 0 6px; border: 0; background: none; color: var(--ink); font: inherit; font-weight: 600; text-align: left; cursor: pointer; overflow-wrap: anywhere; }
.qa-dnum { display: inline-block; min-width: 24px; height: 24px; line-height: 24px; border-radius: 12px; background: var(--ink); color: #fff; font-size: 12px; text-align: center; margin-right: 4px; }
.qa-dtools { display: flex; gap: 4px; flex: none; }
.qa-rule-live { padding: 0 12px 8px 42px; font-size: 13px; color: var(--muted); overflow-wrap: anywhere; }
.qa-dbody { padding: 4px 12px 12px; border-top: 1px solid var(--line); }

/* WHAT TO DO (read-only) */
.qa-what { font-size: 15px; }
.qa-src { margin: 0 0 8px; font-size: 13px; color: var(--muted); }
.qa-brief { margin: 0 0 12px; padding: 10px 12px; border-left: 3px solid var(--accent); background: var(--card); border-radius: 0 10px 10px 0; }
.qa-wsec h4 { margin: 14px 0 6px; font-size: 14px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.qa-steps { margin: 0; padding: 0 0 0 26px; display: flex; flex-direction: column; gap: 10px; }
.qa-step { padding: 2px 0 2px 4px; }
.qa-step-name { font-weight: 700; overflow-wrap: anywhere; }
.qa-step-do { margin: 2px 0; overflow-wrap: anywhere; }
.qa-rule { margin: 2px 0; padding: 4px 8px; border-radius: 6px; background: var(--hover); font-size: 14px; overflow-wrap: anywhere; }
.qa-clause { font-size: 12px; color: var(--muted); }
.qa-figs { list-style: none; margin: 6px 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.qa-fig { margin: 0; max-width: 220px; }
.qa-fig img { display: block; max-width: 100%; height: auto; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.qa-fig figcaption { font-size: 12px; color: var(--muted); overflow-wrap: anywhere; }
.qa-doc { display: inline-flex; align-items: center; min-height: 36px; padding: 0 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--card); color: var(--ink); text-decoration: none; font-size: 13px; }
.qa-attr { margin: 16px 0 4px; padding: 8px 10px; border-top: 1px solid var(--line); font-size: 12px; color: var(--muted); overflow-wrap: anywhere; }
.qa-ref { margin: 4px 0 0; font-size: 12px; font-weight: 600; color: #8a5a00; }

/* pictures + files panel (editors) */
.qa-files { list-style: none; margin: 0 0 8px; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.qa-file { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: flex-start; padding: 8px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); }
.qa-file img { width: 96px; height: auto; border-radius: 6px; border: 1px solid var(--line); background: #fff; flex: none; }
.qa-file .qa-fmeta { flex: 1 1 220px; min-width: 0; }
.qa-split { display: grid; grid-template-columns: 1fr; gap: 16px; }
@media (min-width: 1000px) { .qa-split { grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); } .qa-split > .qa-preview { position: sticky; top: 64px; align-self: start; max-height: calc(100vh - 80px); overflow: auto; } }
.qa-preview { padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--card); }
.qa-preview > h3 { margin: 0 0 8px; font-size: 15px; }
.qa-versions { margin: 0; padding: 0 0 0 18px; font-size: 13px; color: var(--muted); }

/* QR-1 (BRIEF-1239): the chooser, the criteria table, a linked (shared) step */
.qa-pick { position: fixed; inset: 0; z-index: 2000; display: flex; align-items: flex-start; justify-content: center; padding: 56px 12px 12px; background: rgba(15, 20, 28, .45); }
.qa-pick-box { width: 100%; max-width: 560px; max-height: calc(100vh - 80px); overflow: auto; padding: 14px; border-radius: 14px; background: var(--card); color: var(--ink); box-shadow: 0 10px 40px rgba(0, 0, 0, .25); }
.qa-pick-box > h3 { margin: 0 0 10px; font-size: 16px; }
.qa-pick-list { list-style: none; margin: 0 0 10px; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.qa-ctable summary { cursor: pointer; min-height: 32px; }
.qa-tscroll { overflow-x: auto; margin-top: 8px; }
.qa-ctable table { border-collapse: collapse; width: 100%; min-width: 640px; font-size: 13px; }
.qa-ctable th, .qa-ctable td { padding: 6px 8px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; overflow-wrap: anywhere; }
.qa-ctable th { color: var(--muted); font-weight: 700; }
.qa-locked { border: 0; margin: 0; padding: 0; min-width: 0; opacity: .75; }
.qa-ctable th, .qa-ctable td { overflow-wrap: normal; word-break: normal; }
@media (max-width: 600px) {   /* a phone: each criterion a stacked card, the label above its value */
  .qa-ctable table, .qa-ctable tbody, .qa-ctable tr, .qa-ctable td { display: block; min-width: 0; width: auto; }
  .qa-ctable thead { display: none; }
  .qa-ctable tr { padding: 8px 0; border-bottom: 1px solid var(--line); }
  .qa-ctable td { padding: 2px 0; border: 0; overflow-wrap: anywhere; }
  .qa-ctable td:empty, .qa-ctable td[data-l=""]:empty { display: none; }
  .qa-ctable td[data-l]:not([data-l=""]):not([data-l="#"])::before { content: attr(data-l); display: block; font-size: 11px; color: var(--muted); }
  .qa-ctable td[data-l="#"] { font-weight: 700; }
}
/* BRIEF-1252: a step's method · who checks · notes */
.qa-meta { font-size: 13px; color: var(--ink); margin-top: 2px; }
.qa-notes { font-size: 13px; color: var(--muted); margin-top: 2px; overflow-wrap: anywhere; }
/* BRIEF-1285 / 1287 AS-3: calibration on an asset (public/quality/calibration.js, mounted in the asset page) */
.qcal-acts { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 2px; }
.qcal-acts .qa-chip { width: auto; display: inline-flex; align-items: center; cursor: pointer; }
.qcal-rule { margin: 0 0 12px; }
.qcal-rule > summary { cursor: pointer; font-weight: 600; padding: 4px 0; }
.qcal-pill { white-space: nowrap; }

/* EQ-2: equipment used on a record */
.qr-eqs { list-style: none; margin: 0 0 8px; padding: 0; display: grid; gap: 8px; }
.qr-eq { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 6px 10px; }
.qr-eq .qa-f { flex: 1 1 200px; min-width: 0; }
.qr-eqst { font-size: 13px; padding: 2px 8px; border-radius: 999px; align-self: center; }
.qr-eqst:empty { display: none; }
.qr-eqst.ok { color: var(--ok); border: 1px solid currentColor; }
.qr-eqst.bad { color: #fff; background: var(--err); font-weight: 700; }
.qr-eqst.unk { color: var(--muted); font-style: italic; }
.qr-eqro .qr-eqn { flex: 1 1 200px; min-width: 0; overflow-wrap: anywhere; }
.qa-eqmode .qa-radios { border: 0; margin: 0; padding: 0; display: grid; gap: 8px; }
.qa-radio { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; }
.qa-radio input[type="radio"] { width: auto; min-width: 0; height: auto; min-height: 0; margin: 4px 0 0; flex: 0 0 auto; }
.qa-radio span { display: grid; flex: 1 1 auto; min-width: 0; }
.qa-radio small { color: var(--muted); }
.qa-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.qr-eqc { flex: 1 0 100%; font-size: 13px; }
.qcal-sdet { padding: 4px 12px 8px; }
