/* Litmus brand (brand book 2024): greys from #000005 to #a5a9ac on black or
   white, Montserrat for headings, Aptos for body. Status colours are not
   brand colours: they follow safety-sign convention (green safe, yellow
   warning, red stop, blue mandatory) and every status is also a word. */
:root {
  --ink: #000005;
  --slate: #1f313a;
  --slate-2: #434e54;
  --muted: #5c666b;
  --mid: #787f82;
  --line: #a5a9ac;
  --paper: #ffffff;
  --wash: #f2f3f3;
  --safe: #00875A;
  --warn: #F7C600;
  --stop: #C8102E;
  --must: #0057B8;
  --head: "Montserrat", "Helvetica Neue", Arial, sans-serif;
  --body: "Aptos", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--wash); color: var(--ink);
  font: 400 17px/1.45 var(--body); padding-bottom: 84px; }
a { color: var(--slate); }
:focus-visible { outline: 3px solid var(--must); outline-offset: 2px; }

.top { background: linear-gradient(135deg, var(--ink), var(--slate-2)); color: #fff;
  display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; }
.brand { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; }
.brand img { display: block; height: 24px; width: auto; }
.brand span { font: 300 15px/1 var(--head); letter-spacing: .22em; text-transform: uppercase;
  border-left: 1px solid var(--mid); padding-left: 10px; }
.who { font-size: 14px; white-space: nowrap; }
.top { gap: 12px; }
@media (max-width: 440px) {
  .brand img { height: 18px; }
  .brand span { font-size: 11px; letter-spacing: .14em; padding-left: 8px; }
  .who { font-size: 13px; }
}
.who a { color: #fff; margin-left: 8px; }

main { max-width: 1180px; margin: 0 auto; padding: 16px; outline: none; }
main.narrow { max-width: 680px; }
form, .search, .statusbar, .signbox { max-width: 680px; }
h1 { font: 300 clamp(26px, 1.2vw + 22px, 38px)/1.15 var(--head); letter-spacing: -.01em; margin: 6px 0 4px; }
h2 { font: 600 12px/1.2 var(--head); text-transform: uppercase; letter-spacing: .14em;
  color: var(--slate-2); margin: 26px 0 8px; }
.sub { color: var(--muted); margin: 0 0 14px; }
.empty { background: var(--paper); border: 1px dashed var(--line);
  border-radius: 10px; padding: 22px; text-align: center; }

/* Tag: one record with its status band. */
.tag { display: grid; grid-template-columns: 92px 1fr; background: var(--paper);
  border: 1px solid var(--line); border-radius: 10px; overflow: hidden;
  margin: 0 0 10px; text-decoration: none; color: inherit; min-height: 74px; }
.tag .band { display: flex; align-items: center; justify-content: center; text-align: center;
  padding: 8px 6px; font: 700 11px/1.2 var(--head); letter-spacing: .1em;
  text-transform: uppercase; color: #fff; background: var(--muted); }
.tag .body { padding: 10px 12px; min-width: 0; }
.tag .name { font: 600 17px/1.25 var(--head); }
.tag .meta { color: var(--muted); font-size: 15px; }
.s-ok .band { background: var(--safe); }
.s-due .band { background: var(--warn); color: var(--ink); }
.s-overdue .band, .s-fail .band { background: var(--stop); }
.s-never .band { background: var(--slate); }
.s-fail { border-color: var(--stop); border-width: 2px; }

.count { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 10px 0 16px; }
@media (max-width: 480px) { .count { grid-template-columns: 1fr 1fr; } }
.count div { background: var(--paper); border: 1px solid var(--line);
  border-radius: 10px; padding: 8px 10px; }
.count b { display: block; font: 300 30px/1 var(--head); }
.count span { font-size: 13px; color: var(--muted); }

/* Check screen */
.statusbar { border-radius: 10px; padding: 12px 14px; color: #fff; margin: 12px 0;
  font: 700 14px/1.2 var(--head); letter-spacing: .1em; text-transform: uppercase; }
.statusbar small { display: block; font: 400 15px/1.3 var(--body);
  letter-spacing: 0; text-transform: none; margin-top: 4px; }
.statusbar.s-ok { background: var(--safe); }
.statusbar.s-due { background: var(--warn); color: var(--ink); }
.statusbar.s-overdue, .statusbar.s-fail { background: var(--stop); }
.statusbar.s-never { background: var(--slate); }
.statusbar.s-listed { background: var(--muted); }
.what { background: var(--paper); border-left: 4px solid var(--slate);
  border-radius: 6px; padding: 10px 12px; white-space: pre-line; }
.decide { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 14px 0; }
.big { border: 0; border-radius: 12px; min-height: 108px; color: #fff; cursor: pointer;
  font: 700 28px/1 var(--head); letter-spacing: .08em; text-transform: uppercase; }
.big.pass { background: var(--safe); }
.big.fail { background: var(--stop); }
a.big.open { display: flex; align-items: center; justify-content: center; text-decoration: none;
  background: linear-gradient(135deg, var(--ink), var(--slate-2)); font-size: 20px; margin: 14px 0 6px; }
.big:active { transform: translateY(2px); }
.big[disabled] { opacity: .5; }

label { display: block; font: 600 14px/1.3 var(--head); margin: 14px 0 4px; }
label small { font: 400 14px var(--body); color: var(--muted); }
input, textarea, select { width: 100%; font: 400 17px var(--body); color: inherit; padding: 12px;
  border: 1px solid var(--mid); border-radius: 8px; background: #fff; }
textarea { min-height: 96px; }
.btn { display: inline-block; border: 0; border-radius: 8px; padding: 13px 18px;
  background: var(--slate); color: #fff; font: 600 15px var(--head); cursor: pointer;
  text-decoration: none; margin: 14px 8px 0 0; }
.btn.stop { background: var(--stop); }
.btn.quiet { background: transparent; color: var(--ink); border: 1px solid var(--mid); }
.error { background: #FDECEF; border-left: 4px solid var(--stop); padding: 10px 12px;
  border-radius: 6px; margin: 12px 0; }
.saved { background: #E6F5EF; border-left: 4px solid var(--safe); padding: 12px;
  border-radius: 6px; margin: 12px 0; font-weight: 600; }

.log { list-style: none; padding: 0; margin: 0; }
.log li { background: var(--paper); border: 1px solid var(--line); border-radius: 8px;
  padding: 9px 12px; margin-bottom: 6px; font-size: 15px; }
.log .o-pass { color: var(--safe); font-weight: 700; }
.log .o-fail { color: var(--stop); font-weight: 700; }

/* COSHH sheet */
.aid { background: var(--safe); color: #fff; border-radius: 10px; padding: 14px; }
.aid h2 { margin: 0 0 6px; color: #fff; }
.aid p { margin: 0; white-space: pre-line; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; padding: 0; margin: 0; list-style: none; }
.chips li { border-radius: 999px; padding: 7px 14px; font: 600 14px var(--head); }
.chips.ppe li { background: var(--must); color: #fff; }
.chips.haz li { background: var(--warn); color: var(--ink); border-radius: 4px; }
.block { background: var(--paper); border: 1px solid var(--line); border-radius: 8px;
  padding: 10px 12px; white-space: pre-line; }
.checks-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 12px; }
.checks-grid label { font: 400 16px var(--body); margin: 0; display: flex; gap: 8px; align-items: center; }
.checks-grid input { width: 22px; height: 22px; flex: none; }

.tabs { position: fixed; left: 0; right: 0; bottom: 0; display: flex; background: var(--paper);
  border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
.tabs a { flex: 1; text-align: center; padding: 16px 2px 14px; text-decoration: none;
  color: var(--muted); font: 600 11px/1 var(--head); letter-spacing: .1em;
  text-transform: uppercase; border-top: 3px solid transparent; }
.tabs a.on { color: var(--ink); border-top-color: var(--ink); }

/* Sign-off */
.signbox { background: var(--paper); border: 1px solid var(--line); border-radius: 10px;
  padding: 4px 14px 12px; margin: 16px 0; }
.signbox.due { border: 3px solid var(--warn); }
.signbox h2 { margin-top: 12px; }
.tick { display: flex; gap: 10px; align-items: flex-start; font: 400 17px var(--body); }
.tick input { width: 26px; height: 26px; flex: none; margin-top: 1px; }
.temp { font: 700 24px/1.3 ui-monospace, Menlo, monospace; letter-spacing: .04em;
  word-break: break-all; text-align: center; padding: 18px; }

/* Search */
.search { position: relative; margin: 10px 0 14px; }
.search input { padding-left: 14px; }
.nomatch { color: var(--muted); padding: 8px 0; }

/* Dashboard */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin: 14px 0 6px; }
@media (max-width: 560px) { .stats { grid-template-columns: 1fr 1fr; } }
.stat { display: block; background: var(--paper); border: 1px solid var(--line); border-top: 4px solid var(--mid);
  border-radius: 10px; padding: 12px 14px; text-decoration: none; color: inherit; }
.stat b { display: block; font: 300 clamp(34px, 2vw + 26px, 52px)/1 var(--head); }
.stat span { font: 600 11px/1.3 var(--head); letter-spacing: .1em; text-transform: uppercase; color: var(--slate-2); }
.stat.k-overdue { border-top-color: var(--stop); }
.stat.k-week { border-top-color: var(--warn); }
.stat.k-later { border-top-color: var(--safe); }
.cols { display: grid; gap: 0 28px; }
@media (min-width: 900px) { .cols { grid-template-columns: 1fr 1fr; align-items: start; } }
.row { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: center;
  background: var(--paper); border: 1px solid var(--line); border-left: 5px solid var(--mid);
  border-radius: 8px; padding: 10px 12px; margin-bottom: 6px; text-decoration: none; color: inherit; }
.row .rname { display: block; font: 600 16px/1.25 var(--head); }
.row .rmeta { display: block; color: var(--muted); font-size: 14px; }
.row .rwhen { text-align: right; font-size: 14px; color: var(--muted); white-space: nowrap; }
.row .rwhen b { display: block; color: var(--ink); font: 600 13px var(--head); }
.row.r-fail, .row.r-overdue { border-left-color: var(--stop); }
.row.r-fail .rwhen b, .row.r-overdue .rwhen b { color: var(--stop); }
.row.r-never, .row.r-nodate { border-left-color: var(--slate); }
.row.r-week { border-left-color: var(--warn); }
.row.r-sign { border-left-color: var(--warn); }
.row.r-ok { border-left-color: var(--safe); }
.row.r-none { border-left-color: var(--line); }
.grid .row { margin: 0; }
.row.stack { grid-template-columns: 1fr; gap: 6px; align-items: start; }
.row.stack .rwhen { text-align: left; white-space: normal; }
.row.stack .rwhen b { display: inline; margin-right: 8px; }
.bar { height: 8px; background: var(--wash); border-radius: 4px; overflow: hidden; margin-top: 6px; }
.bar i { display: block; height: 100%; background: var(--safe); }
.allclear { background: var(--paper); border: 1px solid var(--line); border-left: 5px solid var(--safe);
  border-radius: 8px; padding: 12px; }

/* Printable QR labels */
.labels { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.label { display: block; text-decoration: none; color: inherit; background: #fff; border: 2px solid var(--ink); border-radius: 8px; padding: 8px;
  text-align: center; break-inside: avoid; }
.label img { width: 100%; height: auto; image-rendering: pixelated; }
.label b { display: block; font: 600 13px/1.2 var(--head); }
.label span { font-size: 11px; color: var(--muted); }
@media print {
  .top, .tabs, .noprint { display: none !important; }
  body { background: #fff; padding: 0; }
  main { max-width: none; }
}
@media (prefers-reduced-motion: reduce) { .big:active { transform: none; } }

/* Layout that adapts to the screen. Lists flow into as many columns as fit:
   one on a phone, two on a tablet, three on a desktop. */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 330px), 1fr));
  gap: 10px; margin-bottom: 10px; }
.grid .tag { margin: 0; }
.split { display: grid; gap: 0 36px; }
.split > div { min-width: 0; }

@media (hover: hover) {
  .tag:hover, .stat:hover { border-color: var(--slate); box-shadow: 0 2px 10px rgba(0, 0, 5, .10); }
  .row:hover { box-shadow: 0 2px 10px rgba(0, 0, 5, .10); }
  .btn:hover { background: var(--ink); }
  .btn.quiet:hover { background: var(--wash); }
  .btn.stop:hover { background: #9d0c24; }
  .tabs a:hover { color: var(--ink); }
}

/* Desktop: navigation moves from the bottom of the screen to a bar under the
   header, and detail screens use two columns. */
@media (min-width: 900px) {
  body { display: flex; flex-direction: column; min-height: 100vh; padding-bottom: 0; }
  .top { order: 1; padding: 14px 28px; }
  .brand img { height: 28px; }
  .tabs { order: 2; position: sticky; top: 0; z-index: 5; border-top: 0;
    border-bottom: 1px solid var(--line); padding: 0 16px; }
  .tabs a { flex: none; padding: 17px 16px 13px; border-top: 0;
    border-bottom: 3px solid transparent; font-size: 12px; }
  .tabs a.on { border-top-color: transparent; border-bottom-color: var(--ink); }
  main { order: 3; width: 100%; padding: 26px 28px 56px; }
  .split { grid-template-columns: minmax(0, 1.1fr) minmax(0, .9fr); align-items: start; }
  .split > div > h2:first-child { margin-top: 12px; }
  .stats { gap: 14px; }
}
@media print { .tabs { display: none !important; } body { display: block; } }

/* Back button, report form */
.back { display: inline-block; border: 0; background: none; padding: 6px 10px 6px 0; margin: 0 0 4px;
  font: 600 14px var(--head); color: var(--slate); cursor: pointer; }
.back:hover { color: var(--ink); text-decoration: underline; }
.choices { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.choices label { margin: 0; font: 600 15px var(--head); }
.choices input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.choices span { display: block; text-align: center; padding: 14px 8px; border: 1px solid var(--mid);
  border-radius: 8px; background: var(--paper); cursor: pointer; }
.choices input:checked + span { background: var(--slate); color: #fff; border-color: var(--slate); }
.choices input:focus-visible + span { outline: 3px solid var(--must); outline-offset: 2px; }
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.btn.small { padding: 7px 12px; margin: 0; font-size: 13px; }
.block b { font-family: var(--head); font-weight: 600; font-size: 14px; }
@media print { .back { display: none; } }

/* Single A6 label: 105 by 148 mm. */
.a6 { width: 105mm; height: 148mm; background: #fff; border: 1px solid var(--line); margin: 16px auto;
  display: flex; flex-direction: column; align-items: center; text-align: center; overflow: hidden;
  page: a6; break-inside: avoid; }
.a6top { width: 100%; background: linear-gradient(135deg, var(--ink), var(--slate-2)); color: #fff;
  display: flex; align-items: center; justify-content: center; gap: 3mm; padding: 5mm 0;
  -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.a6top img { height: 7mm; width: auto; }
.a6top span { font: 300 10pt/1 var(--head); letter-spacing: .22em; text-transform: uppercase;
  border-left: 1px solid var(--mid); padding-left: 3mm; }
.a6qr { width: 72mm; height: 72mm; margin-top: 6mm; image-rendering: pixelated; }
.a6name { font: 600 17pt/1.15 var(--head); padding: 3mm 7mm 0; overflow-wrap: anywhere; }
.a6ref { font: 600 13pt/1 ui-monospace, Menlo, monospace; letter-spacing: .06em; margin-top: 3mm; }
.a6note { font: 400 9.5pt/1.3 var(--body); color: var(--muted); margin-top: auto; padding: 0 6mm 6mm; }
@page a6 { size: 105mm 148mm; margin: 0; }
@media print {
  .a6 { border: 0; margin: 0; }
  main.narrow:has(.a6) { max-width: none; padding: 0; }
}

.changes { white-space: pre-line !important; font-size: 13px; color: var(--slate-2); overflow-wrap: anywhere; }

.qr { width: 220px; height: 220px; image-rendering: pixelated; background: #fff; padding: 8px;
  border: 1px solid var(--line); border-radius: 8px; }
.key { font: 600 15px ui-monospace, Menlo, monospace; letter-spacing: .04em; white-space: nowrap; }

/* Checklist run: three large tap targets for each question. The chosen
   answer is filled and ticked, so it does not rely on colour alone. */
.q { background: var(--paper); border: 1px solid var(--line); border-radius: 10px; padding: 12px;
  margin: 0 0 10px; max-width: 680px; }
.q.missing, input.missing { border: 2px solid var(--stop); }
.qtext { margin: 0 0 10px; font: 600 16px/1.35 var(--head); }
.yn { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.yn label { margin: 0; }
.yn input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.yn span { display: flex; align-items: center; justify-content: center; text-align: center; min-height: 58px;
  padding: 6px 4px; border: 1px solid var(--mid); border-radius: 8px; background: var(--paper);
  font: 600 15px/1.15 var(--head); cursor: pointer; }
.yn input:checked + span { color: #fff; background: var(--slate); border-color: var(--slate); }
.yn input:checked + span::before { content: "\2713\00a0"; }
.yn input:checked + .yn-yes { background: var(--safe); border-color: var(--safe); }
.yn input:checked + .yn-no { background: var(--stop); border-color: var(--stop); }
.yn input:focus-visible + span { outline: 3px solid var(--must); outline-offset: 2px; }
