/* Task Helper — the SAFETY screens: SWMS library, editor, settings (job-intake.md §41; SF-2, lane TASK HELPER SAFETY).
 * Copyright Rapid Surveys Pty Ltd. App tokens only (--bg --card --ink --muted --line --accent --accent-ink --ok --err). Namespaced .sf-.
 * Phone first; nothing scrolls the page sideways (wide bits scroll inside their own box). */
.sf-screen.overlay { display: block; background: var(--bg); overflow-y: auto; overflow-x: hidden; -webkit-overflow-scrolling: touch; }
html.sf-open, html.sf-open body { overflow: hidden; }
.sf-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; }
.sf-titles { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.sf-titles h2 { margin: 0; font-size: 18px; line-height: 1.25; color: #fff; text-transform: none; letter-spacing: 0; overflow-wrap: anywhere; outline: none; }
.sf-co { font-size: 12px; color: #9aa6b5; overflow-wrap: anywhere; }
.sf-back, .sf-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; }
.sf-back { max-width: 40%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sf-x { font-size: 20px; }
.sf-wrap { max-width: 960px; margin: 0 auto; padding: 12px 16px 96px; }
.sf-msg { margin: 0 0 10px; }
.sf-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 12px; }
.sf-actions:empty { display: none; }
.sf-primary, .sf-ghost { width: auto; margin: 0; min-height: 44px; padding: 0 16px; border-radius: 10px; font-weight: 600; font-size: 15px; }
.sf-primary { border: 1px solid var(--accent); background: var(--accent); color: var(--accent-ink); }
.sf-ghost { border: 1px solid var(--line); background: var(--card); color: var(--ink); }
.sf-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-size: 13px; font-weight: 600; }
.sf-danger { color: var(--err) !important; }
.sf-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.sf-card { display: flex; flex-direction: column; gap: 2px; width: 100%; margin: 0; padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); color: var(--ink); text-align: left; min-height: 44px; }
.sf-card-name { font-weight: 600; overflow-wrap: anywhere; }
.sf-card-sub { font-size: 13px; color: var(--muted); }
.sf-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; }
.sf-pill-ok { border-color: var(--ok); color: var(--ok); }
.sf-pill-warn { border-color: #b45309; color: #b45309; }
.sf-pill-bad { border-color: var(--err); color: var(--err); }
.sf-badge { display: inline-block; margin: 4px 0; padding: 2px 10px; border: 1px solid #9E8C5B; border-radius: 999px; font-size: 12px; }
.sf-sec { margin: 0 0 14px; padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); }
.sf-sec h3 { margin: 0 0 8px; font-size: 16px; }
.sf-sec.sf-gap { border-color: #b45309; }
.sf-f { display: flex; flex-direction: column; gap: 4px; margin: 0 0 10px; font-size: 14px; }
.sf-f > span { color: var(--muted); font-size: 13px; }
.sf-f textarea { min-height: 88px; }
.sf-f input, .sf-f textarea, .sf-f select, .sf-row input, .sf-row select { width: 100%; max-width: 100%; margin: 0; font-size: 16px; }
.sf-check { display: flex; align-items: flex-start; gap: 8px; margin: 0 0 8px; min-height: 36px; font-size: 14px; cursor: pointer; }
.sf-check input { width: 20px; height: 20px; margin: 2px 0 0; flex: none; }
.sf-reg { color: var(--muted); font-size: 12px; }
.sf-step { margin: 0 0 12px; padding: 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); }
.sf-haz { margin: 8px 0 0; padding: 8px 8px 8px 10px; border-left: 3px solid #9E8C5B; background: var(--card); border-radius: 6px; }
.sf-ctl { display: grid; grid-template-columns: 1fr; gap: 6px; margin: 6px 0; padding: 6px; border: 1px dashed var(--line); border-radius: 8px; }
@media (min-width: 768px) { .sf-ctl { grid-template-columns: 2fr 1fr 2fr auto; align-items: start; } }
.sf-rate { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 6px 0; }
.sf-rate select { width: auto; min-width: 0; flex: 1 1 140px; margin: 0; font-size: 15px; }
.sf-lvl { display: inline-block; padding: 1px 8px; border-radius: 4px; font-weight: 700; font-size: 13px; }
.sf-rowbtns { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0 0; }
.sf-gaps, .sf-warns { margin: 0 0 12px; padding: 10px 12px 10px 28px; border-radius: 10px; font-size: 14px; }
.sf-gaps { border: 1px solid #b45309; }
.sf-warns { border: 1px solid var(--line); }
.sf-gaps li, .sf-warns li { margin: 2px 0; }
.sf-cmt { margin: 0 0 8px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; font-size: 14px; }
.sf-cmt-meta { color: var(--muted); font-size: 12px; }
.sf-grid { overflow-x: auto; margin: 0 0 10px; }
.sf-grid table { border-collapse: collapse; font-size: 13px; }
.sf-grid th, .sf-grid td { border: 1px solid var(--line); padding: 4px; text-align: center; }
.sf-grid select { width: auto; margin: 0; font-size: 13px; }
.sf-none { color: var(--muted); font-style: italic; }
.sf-hint { color: var(--muted); font-size: 13px; margin: 0 0 8px; }
.sf-note { margin: 0 0 12px; padding: 8px 12px; border-left: 3px solid #9E8C5B; background: var(--card); font-size: 14px; }
/* SF-5: the Take 5's bottom SHEET (outside signer, "I don't agree") — phone first, never a browser prompt */
.t5-sheetov { position: fixed; inset: 0; z-index: 990; display: flex; align-items: flex-end; justify-content: center; background: rgba(0, 0, 0, .5); }
.t5-sheet { width: 100%; max-width: 560px; max-height: 92vh; overflow-y: auto; margin: 0; padding: 16px 16px max(16px, env(safe-area-inset-bottom)); border-radius: 14px 14px 0 0; background: var(--bg); color: var(--ink); box-shadow: 0 -8px 24px rgba(0, 0, 0, .3); }
.t5-sheet h2 { margin: 0 0 8px; font-size: 18px; text-transform: none; letter-spacing: 0; }
.t5-err, .sf-f > .t5-err { color: var(--err); font-size: 13px; }
.t5-err:empty { display: none; }
.sf-filt { flex: 1 1 140px; margin: 0; }
.sf-filt input, .sf-filt select { width: 100%; min-height: 44px; }
/* Gary's live test (2026-10-10): the starter badge is an inline TAG, not a full-width bar; a card says it opens (a chevron) */
.sf-card .sf-badge, .sf-badge { align-self: flex-start; width: fit-content; max-width: 100%; }
.sf-card { position: relative; padding-right: 76px; cursor: pointer; }
.sf-card::after { content: 'Open ›'; position: absolute; right: 12px; top: 50%; transform: translateY(-50%); font-size: 14px; font-weight: 700; line-height: 1; color: var(--accent); }
.sf-card:hover, .sf-card:focus-visible { border-color: var(--accent); }
/* R-1 (BRIEF-1140): the READER screen — a toolbar top + bottom around the sandboxed version */
.sr-ov { position: fixed; inset: 0; z-index: 980; display: flex; flex-direction: column; gap: 8px; padding: max(8px, env(safe-area-inset-top)) 12px max(8px, env(safe-area-inset-bottom)); background: var(--bg); }
.sr-head { display: flex; align-items: center; gap: 8px; }
.sr-head h2 { flex: 1; min-width: 0; margin: 0; font-size: 17px; text-transform: none; letter-spacing: 0; overflow-wrap: anywhere; }
.sr-head button { width: auto; margin: 0; min-height: 44px; padding: 0 14px; border-radius: 10px; font-weight: 600; }
.sr-bar { display: flex; flex-wrap: wrap; gap: 8px; }
.sr-bar > * { flex: 1 1 auto; justify-content: center; }
.sr-bar a.sf-ghost { display: inline-flex; align-items: center; text-decoration: none; }
.sr-frame { flex: 1; width: 100%; min-height: 0; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.sr-msg { margin: 0; }
/* Gary's live test (2026-10-10): a Take 5 problem is shown ON its item + listed at the top */
.t5-bad { outline: 2px solid var(--err); outline-offset: 2px; border-radius: 8px; }
.t5-err.t5-item { display: block; margin: 4px 0 0; }
.t5-summary { margin: 0 0 12px; padding: 10px 12px; border: 2px solid var(--err); border-radius: 10px; background: var(--card); font-size: 14px; }
.t5-summary ul { margin: 6px 0 0; padding-left: 18px; }
.t5-goto { width: auto; margin: 2px 0; min-height: 32px; padding: 0 6px; border: 0; background: none; color: var(--err); font-size: 14px; text-align: left; text-decoration: underline; }
.t5-need { margin: 4px 0 6px; color: var(--err); font-size: 13px; font-weight: 600; }
.t5-req { color: var(--err); }
.sf-regrow { display: block; text-align: left; }
.sf-regrow ul { margin: 4px 0 0; padding-left: 18px; }
/* BRIEF-1181: the risk rating at once + the matrix viewer — the app's own form styles, 44 px controls */
.rk { margin: 4px 0 10px; }
.rk-label, .rk-head { display: block; margin: 8px 0 4px; font-size: 13px; font-weight: 600; color: var(--muted); }
.rk-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.rk-f { display: flex; flex-direction: column; gap: 2px; font-size: 13px; color: var(--muted); min-width: 0; }
.rk-f select, .rk-kind select { width: 100%; min-height: 44px; margin: 0; font-size: 16px; }
.rk-result { margin: 6px 0 2px; font-size: 14px; }
.rk-out .sf-lvl { font-size: 14px; padding: 2px 10px; }
.rk-stop { display: block; margin-top: 4px; color: var(--err); font-weight: 600; font-size: 14px; }
.rk-view { width: auto; margin: 2px 0 0; min-height: 36px; padding: 0 4px; border: 0; background: none; color: var(--accent); font-size: 14px; font-weight: 600; text-decoration: underline; }
.rk-kind { margin-top: 6px; }
.mx-wrap { overflow-x: auto; margin: 0 0 10px; }
.mx { width: 100%; table-layout: fixed; border-collapse: separate; border-spacing: 2px; font-size: 11px; }
.mx th { padding: 2px 1px; font-weight: 600; color: var(--muted); text-align: center; overflow-wrap: break-word; -webkit-hyphens: auto; hyphens: auto; font-size: 10.5px; line-height: 1.15; }
.mx th[scope=row] { text-align: right; padding-right: 4px; }
.mx thead th:first-child, .mx th[scope=row] { width: 21%; }
.mx thead th { vertical-align: bottom; }
.mx-cell { width: 100%; min-width: 0; min-height: 44px; margin: 0; padding: 2px 1px; border: 2px solid transparent; border-radius: 6px; font-size: 10.5px; font-weight: 700; overflow-wrap: normal; word-break: keep-all; letter-spacing: -.2px; }
.mx-cell.mx-stop { border-color: rgba(0, 0, 0, .55); }
.mx-cell.mx-on { outline: 3px solid var(--accent); outline-offset: 2px; }
@media (max-width: 400px) { .mx-cell { font-size: 9px; letter-spacing: -.3px; padding: 2px 0; } .mx th { font-size: 9px; letter-spacing: -.3px; } .mx thead th:first-child, .mx th[scope=row] { width: 16%; } }
/* BRIEF-1231: "SWMS not signed" on a Take 5 (Gary W1 = 2) — a warning band, words not colour alone */
.t5-unsigned { border-left-color: #b45309; }
.t5-unsigned b { display: block; margin-bottom: 2px; }
.t5-unsigned div { overflow-wrap: anywhere; }
/* BRIEF-1231 B: what this phone still has to send for the task (OFFLINE's outbox) */
.t5-unsent { border-left-color: #6b7280; border-left-style: dashed; }
.t5-unsent b { display: block; overflow-wrap: anywhere; }
/* BRIEF-1237's copy sheet moved to public/shared/copy-sheet/copy-sheet.css (BRIEF-1239 Q8) */
/* BRIEF-1244: the Diary's Take 5 section, compact for a phone — one row per Take 5 (tap = Read), a QR button, 44 px targets */
.t5-done { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; margin: 0 0 10px; }
.t5-link { width: auto; min-height: 44px; margin: 0; padding: 0 6px; border: 0; background: none; color: var(--accent); font: inherit; font-weight: 600; text-decoration: underline; }
.t5-info { width: 44px; min-width: 44px; height: 44px; margin: 0; padding: 0; border: 0; border-radius: 22px; background: none; color: var(--muted); display: inline-flex; align-items: center; justify-content: center; }
.t5-dr[hidden] { display: none; }
.t5-item { margin: 0 0 8px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); }
.t5-item-active { border-color: var(--accent); }
.t5-row { display: flex; align-items: stretch; }
.t5-open { flex: 1 1 auto; min-width: 0; min-height: 44px; display: flex; flex-wrap: wrap; align-items: center; gap: 2px 8px; margin: 0; padding: 6px 10px; border: 0; border-radius: 10px 0 0 10px; background: none; color: var(--ink); font: inherit; font-size: 14px; text-align: left; }
.t5-res { padding: 0 7px; border: 1px solid; border-radius: 9px; font-size: 11px; font-weight: 700; }
.t5-res-ok { border-color: var(--ok); color: var(--ok); }
.t5-res-bad { border-color: var(--err); color: var(--err); }
.t5-when { font-weight: 600; font-variant-numeric: tabular-nums; }
.t5-what { min-width: 0; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.t5-who { color: var(--muted); }
.t5-tag { padding: 0 6px; border: 1px solid var(--line); border-radius: 9px; font-size: 11px; font-weight: 600; color: var(--muted); }
.t5-tag-bad { border-color: var(--err); color: var(--err); }
.t5-qrbtn { flex: 0 0 44px; width: 44px; min-height: 44px; margin: 0; padding: 0; border: 0; border-left: 1px solid var(--line); border-radius: 0 10px 10px 0; background: none; color: var(--ink); display: inline-flex; align-items: center; justify-content: center; }
.t5-crew, .t5-copies { padding: 0 10px 8px; }
.t5-crew .sf-chip, .t5-copies .sf-chip { min-height: 44px; }
.t5-earlier { margin: 4px 0 0; }
.t5-earlier > summary { min-height: 44px; display: flex; align-items: center; padding: 0 4px; color: var(--muted); font-weight: 600; cursor: pointer; }
.t5-earlier > summary::-webkit-details-marker { display: none; }
.t5-earlier > summary::after { content: '▸'; margin-left: 6px; }
.t5-earlier[open] > summary::after { content: '▾'; }
/* BRIEF-1253: the SWMS page — header, folded principal contractor, version rows with their date, a calm review line; selects match the inputs */
.sf-f select { min-height: 44px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 9px; background: #fbfcfd; color: var(--ink); }
.sf-swhead { padding-bottom: 4px; }
.sf-swtitle { margin: 0 0 4px; font-size: 20px; text-transform: none; letter-spacing: 0; color: var(--ink); overflow-wrap: anywhere; }
.sf-swstate { margin: 0 0 4px; }
.sf-pcfold { margin: 4px 0 12px; }
.sf-pcfold > summary { min-height: 44px; display: flex; align-items: center; color: var(--accent); font-weight: 600; cursor: pointer; }
.sf-ver { display: flex; align-items: center; gap: 8px; text-align: left; min-height: 44px; }
.sf-ver-main { flex: 1 1 auto; min-width: 0; }
.sf-ver-line { display: block; font-size: 13px; color: var(--muted); overflow-wrap: anywhere; }
.sf-ver-open { flex: 0 0 auto; color: var(--accent); font-weight: 600; font-size: 14px; }
.sf-ok-line { margin: 0 0 10px; color: var(--ok); font-weight: 600; }
/* BRIEF-1256 SDS-1: Safety Data Sheets (public/safety/sds.js) */
.sds-amber { display: block; margin: 4px 0 0; padding: 4px 8px; border-left: 3px solid #b45309; background: rgba(180, 83, 9, .10); color: #b45309; font-size: 13px; font-weight: 600; }
p.sds-amber { margin: 0 0 10px; }
.sds-filter { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 4px 16px; margin: 0 0 8px; }
.sds-filter .sf-f { flex: 1 1 220px; margin-bottom: 8px; }
a.sds-open, .sf-actions a.sf-ghost { display: inline-flex; align-items: center; text-decoration: none; }
.sds-versions .sf-cmt div { overflow-wrap: anywhere; }
/* BRIEF-1257 fix: Read and sign inside the task's SDS sheet */
.sds-signbox { margin: 14px 0 0; padding: 12px 0 0; border-top: 1px solid var(--line); }
.sds-signbox h3 { margin: 0 0 6px; font-size: 16px; }
/* BRIEF-1257: an SDS read + signed inside the Take 5 */
.sds-steps { margin: 8px 0 12px; padding-left: 22px; }
.sds-steps li { margin: 2px 0; }
.t5-chem .sf-check { margin-bottom: 4px; }
.t5-sdsadd-list { max-height: 50vh; overflow-y: auto; margin: 8px 0; }
.t5-sdsadd-list .sf-card { width: 100%; text-align: left; margin: 0 0 6px; }
/* BRIEF-1284: qualifications & licences (public/safety/quals.js) */
.ql-files { display: flex; flex-wrap: wrap; gap: 10px; margin: 6px 0 10px; }
/* BRIEF-1286b: the main image in the details (‹ › / swipe / ← →), a small list of the files under it; the full-size viewer carries the buttons */
.ql-item { display: grid; gap: 16px; }
@media (min-width: 760px) { .ql-item { grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); align-items: start; } }
.ql-main { display: flex; align-items: center; gap: 6px; }
.ql-mainimg { flex: 1; min-width: 0; height: 240px; margin: 0; padding: 0; border: 1px solid var(--line); border-radius: 10px; background: var(--card); cursor: zoom-in; overflow: hidden; }
@media (min-width: 760px) { .ql-mainimg { height: 300px; } }
.ql-mainimg img { display: block; width: 100%; height: 100%; object-fit: contain; }
.ql-mainimg:focus-visible, .ql-line:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.ql-step { width: 44px; min-width: 44px; height: 44px; min-height: 44px; padding: 0; border: 1px solid var(--line); border-radius: 22px; background: var(--card); color: var(--ink); font-size: 24px; line-height: 1; }
.ql-count { margin: 6px 0 0; text-align: center; font-size: 13px; color: var(--muted); }
.ql-list { list-style: none; margin: 10px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.ql-line { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 44px; margin: 0; padding: 4px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--card); color: var(--ink); text-align: left; font-weight: 500; font-size: 14px; text-decoration: none; cursor: pointer; }
.ql-line img { width: 48px; height: 34px; object-fit: contain; border-radius: 4px; background: var(--bg); flex: none; }
.ql-line.ql-on { border-color: var(--accent); box-shadow: inset 3px 0 0 var(--accent); font-weight: 700; }
.ql-pdficon { display: inline-flex; align-items: center; justify-content: center; width: 48px; height: 34px; flex: none; border-radius: 4px; background: var(--bg); color: var(--muted); font-size: 12px; font-weight: 700; }
.ql-addline { border-style: dashed; color: var(--accent); }
.ql-viewov { position: fixed; inset: 0; z-index: 995; display: flex; align-items: center; justify-content: center; background: #0b0d10; }
.ql-view { display: flex; flex-direction: column; width: min(100%, 960px); max-height: 100%; height: 100%; color: #fff; outline: none; }
.ql-view-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: max(8px, env(safe-area-inset-top)) 12px 8px; font-weight: 600; }
.ql-x { width: 44px; height: 44px; min-height: 44px; padding: 0; border: 0; border-radius: 22px; background: rgba(255, 255, 255, .15); color: #fff; font-size: 20px; }
.ql-view-body { flex: 1; min-height: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; padding: 0 12px; }
.ql-view-body img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 6px; background: #222; }
.ql-view-pdf { font-size: 18px; margin: 0; }
.ql-view-msg { margin: 6px 12px 0; }
.ql-view-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 10px; padding: 12px 12px max(12px, env(safe-area-inset-bottom)); background: rgba(0, 0, 0, .55); }
.ql-view-bar .sf-chip { min-height: 44px; padding: 0 16px; font-size: 15px; }
.ql-view-ask span { width: 100%; text-align: center; }
.sf-primary.gt-off { border-color: var(--line); background: var(--card); }   /* BRIEF-1289 G3: a greyed main button reads as greyed (muted text on the card, not on the accent) */
.sf-primary.gt-off, .sf-ghost.gt-off, .sf-chip.gt-off { display: inline-flex; align-items: center; justify-content: center; }
/* BRIEF-1307: a Take 5 NOT on a task (the + menu) — the same bottom sheet, taller, with its own header + result */
.t5-qov .t5-qsheet { max-height: 96vh; }
.t5-qhead { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 0 0 8px; }
.t5-qhead h2 { margin: 0; }
.t5-qx { min-width: 44px; min-height: 44px; }
.t5-qrecent .sf-chip { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.t5-qdone { margin: 8px 0 12px; padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); }
.t5-qres { margin: 0 0 6px; font-size: 17px; font-weight: 700; }
.t5-qstop .t5-qres { color: var(--err); }
.t5-qok .t5-qres { color: var(--ok); }
