/* Vishal Diagnostics manufacturing demo.
   Paper and ink: lab-bench paper, white record sheets, ballpoint-blue for actions and signatures,
   amber-glass for warnings. The one bold element is the spectral swatch: each product carries the colour
   of the wavelength its assay is read at. */
:root {
  --paper: #EDF0EE;
  --sheet: #FFFFFF;
  --ink: #172033;
  --ink-2: #4A5468;
  --ink-3: #737C8C;
  --rule: #D3D9D6;
  --rule-2: #E5E9E7;
  --blue: #2440A8;
  --blue-deep: #1B3290;
  --blue-wash: #E9EDFB;
  --amber: #9A5B13;
  --amber-wash: #F8EEDD;
  --green: #1E7A4C;
  --green-wash: #E2F2E9;
  --red: #B42318;
  --red-wash: #FCE9E6;
  --violet: #5B3FA8;
  --violet-wash: #EEEAF8;
  --cold: #1F6FB2;
  --cold-wash: #E4EFFA;
  --font: 'Atkinson Hyperlegible Next', 'Atkinson Hyperlegible', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'Atkinson Hyperlegible Mono', ui-monospace, 'Cascadia Mono', Consolas, monospace;
  --side: 236px;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 400 14.5px/1.45 var(--font); font-variant-numeric: tabular-nums; }
a { color: var(--blue); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--blue-deep); }
h1, h2, h3 { margin: 0; line-height: 1.2; }
p { margin: 0 0 .6em; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; border-radius: 3px; }
.muted { color: var(--ink-3); }
.neg { color: var(--red); font-weight: 600; }
.pos { color: var(--green); }
.big { font-size: 18px; }
.code { font-family: var(--mono); font-size: .92em; letter-spacing: -.01em; white-space: nowrap; }
.note { color: var(--ink-2); font-size: 13px; margin-top: 10px; }
.wrap { white-space: normal; }
[hidden] { display: none !important; }

/* ---------- shell ---------- */
.app { display: grid; grid-template-columns: var(--side) 1fr; min-height: 100vh; }
.side { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; border-right: 1px solid var(--rule); background: #F5F7F6; padding: 18px 14px; overflow-y: auto; }
.brand { display: flex; gap: 10px; align-items: center; padding: 2px 8px 18px; color: var(--ink); text-decoration: none; }
.brand svg { width: 34px; height: 34px; color: var(--blue); flex: none; }
.brand b { display: block; font-size: 15px; letter-spacing: -.01em; }
.brand span { display: block; font-size: 12px; color: var(--ink-3); }
#nav { display: flex; flex-direction: column; gap: 1px; }
.nav-item { display: flex; justify-content: space-between; align-items: center; padding: 8px 10px 8px 12px; border-radius: 5px; color: var(--ink-2); text-decoration: none; font-size: 14.5px; border-left: 3px solid transparent; }
.nav-item:hover { background: #EAEEEC; color: var(--ink); }
.nav-item.is-active { background: var(--sheet); color: var(--blue); border-left-color: var(--blue); font-weight: 600; box-shadow: 0 0 0 1px var(--rule-2); }
.nav-count { font-size: 12px; min-width: 22px; text-align: center; padding: 1px 6px; border-radius: 10px; background: var(--amber-wash); color: var(--amber); font-weight: 600; }
.side-foot { margin-top: auto; padding: 16px 6px 4px; }
.side-foot .btn { width: 100%; justify-content: center; }
.side-foot p { font-size: 12px; color: var(--ink-3); margin: 10px 4px 0; }

.main-col { min-width: 0; display: flex; flex-direction: column; }
.top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px; padding: 10px 28px; background: rgba(237, 240, 238, .94); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); border-bottom: 1px solid var(--rule); }
.search-wrap { position: relative; flex: 1; max-width: 460px; }
#search { width: 100%; padding: 8px 12px 8px 34px; border: 1px solid var(--rule); border-radius: 6px; background: var(--sheet) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%23737C8C' stroke-width='2'%3E%3Ccircle cx='7' cy='7' r='5'/%3E%3Cpath d='m11 11 4 4'/%3E%3C/svg%3E") 11px center no-repeat; font: inherit; color: var(--ink); }
.top-spacer { flex: 1; }
.icon-btn { position: relative; display: inline-flex; align-items: center; justify-content: center; width: 38px; height: 38px; border: 1px solid var(--rule); border-radius: 6px; background: var(--sheet); color: var(--ink-2); cursor: pointer; font: inherit; font-size: 20px; line-height: 1; }
.icon-btn:hover { color: var(--ink); border-color: #BCC4C0; }
.icon-btn svg { width: 18px; height: 18px; }
.bell-count { position: absolute; top: -6px; right: -6px; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 10px; background: var(--ink-2); color: #fff; font-size: 11.5px; font-weight: 700; display: grid; place-items: center; }
#bell.has-critical .bell-count { background: var(--red); }
#role { padding: 8px 10px; border: 1px solid var(--rule); border-radius: 6px; background: var(--sheet); font: inherit; font-size: 13.5px; color: var(--ink); max-width: 280px; }
#menu-btn { display: none; }
.top-pop { position: absolute; z-index: 30; top: calc(100% + 6px); background: var(--sheet); border: 1px solid var(--rule); border-radius: 8px; box-shadow: 0 12px 32px rgba(23, 32, 51, .14); max-height: 70vh; overflow-y: auto; }
#search-pop { left: 0; right: 0; }
#bell-pop { right: 0; width: 420px; padding: 6px 0; }
#more-pop { right: 0; width: 240px; padding: 6px; }
.pop-wrap { position: relative; }
.pop-row { display: flex; align-items: center; gap: 10px; padding: 8px 12px; color: var(--ink); text-decoration: none; border-bottom: 1px solid var(--rule-2); }
.pop-row:hover, .pop-row.is-first { background: var(--blue-wash); }
.pop-main { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pop-kind { font-size: 12px; color: var(--ink-3); }
.pop-empty, .pop-head { padding: 10px 14px; margin: 0; color: var(--ink-2); font-size: 13px; }
.pop-head { font-weight: 600; color: var(--ink); }
.pop-more { display: block; padding: 10px 14px; font-size: 13px; }
#more-pop button { display: block; width: 100%; text-align: left; padding: 9px 10px; border: 0; background: none; font: inherit; color: var(--ink); border-radius: 5px; cursor: pointer; }
#more-pop button:hover { background: var(--paper); }
#more-pop button.danger { color: var(--red); }

/* ---------- page ---------- */
.page { width: 100%; max-width: 1340px; padding: 26px 28px 80px; }
.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; margin-bottom: 18px; }
.page-head h1 { font-size: 25px; font-weight: 700; letter-spacing: -.015em; }
.page-head .sub { margin: 6px 0 0; color: var(--ink-2); max-width: 78ch; }
.head-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: flex-end; }
.head-actions.one-line { flex: none; flex-wrap: nowrap; } /* the description beside it wraps instead */
.crumbs { margin: 0 0 6px; font-size: 13px; color: var(--ink-3); }
.crumbs a { color: var(--ink-2); }
.ph-title { display: flex; gap: 16px; align-items: flex-start; }
.batch-no { font-family: var(--mono); font-weight: 600; letter-spacing: -.02em; color: var(--blue-deep); margin-right: 6px; }
.batch-head h1 { font-size: 27px; }

.sheet { background: var(--sheet); border: 1px solid var(--rule); border-radius: 7px; padding: 18px 20px; margin-bottom: 16px; }
.sheet-head { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; margin-bottom: 12px; flex-wrap: wrap; }
.sheet-head h2 { font-size: 16.5px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.sheet-head .muted { font-size: 13px; }
.sheet-foot { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 14px 0 0; padding-top: 14px; border-top: 1px solid var(--rule-2); }
.sheet-foot.decision { justify-content: flex-end; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-2 > .sheet, .grid-2 > div > .sheet:last-child { margin-bottom: 16px; }
.grid-auto { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.mini h3 { font-size: 14px; margin-bottom: 6px; }

/* KPI strip: one ruled row, not a set of cards */
.kpis { display: grid; grid-template-columns: repeat(var(--kpis, 6), 1fr); background: var(--sheet); border: 1px solid var(--rule); border-radius: 7px; margin-bottom: 16px; }
.kpi { padding: 14px 16px; text-decoration: none; color: var(--ink); border-left: 1px solid var(--rule-2); }
.kpi:first-child { border-left: 0; }
.kpi:hover { background: #FAFBFB; }
.kpi b { display: block; font-size: 21px; font-weight: 700; letter-spacing: -.015em; white-space: nowrap; }
.kpi span { display: block; font-size: 12.5px; color: var(--ink-2); margin-top: 2px; }

/* ruled field grid, like the header block of a BMR */
.fields { display: grid; grid-template-columns: repeat(var(--cols), minmax(0, 1fr)); margin: 0; border-top: 1px solid var(--rule-2); }
.fields > div { padding: 9px 12px 10px 0; border-bottom: 1px solid var(--rule-2); min-width: 0; }
.fields dt { font-size: 12px; color: var(--ink-3); margin-bottom: 2px; }
.fields dd { margin: 0; font-size: 14.5px; overflow-wrap: anywhere; }
.sheet > .fields:first-child { border-top: 0; }

/* ---------- chips, badges, swatches ---------- */
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 1px 7px; border-radius: 3px; font-size: 12px; font-weight: 600; line-height: 1.6; white-space: nowrap; border: 1px solid transparent; vertical-align: middle; }
.chip-neutral { background: #EEF1F0; color: var(--ink-2); border-color: var(--rule-2); }
.chip-blue { background: var(--blue-wash); color: var(--blue-deep); }
.chip-amber { background: var(--amber-wash); color: var(--amber); }
.chip-green { background: var(--green-wash); color: var(--green); }
.chip-red { background: var(--red-wash); color: var(--red); }
.chip-ink { background: var(--ink); color: #fff; }
.storage { display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; white-space: nowrap; color: var(--ink-2); }
.storage::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--ink-3); }
.st-cold { color: var(--cold); } .st-cold::before { background: var(--cold); }
.st-frozen { color: var(--violet); } .st-frozen::before { background: var(--violet); box-shadow: 0 0 0 2px var(--violet-wash); }

/* the spectral swatch: a small cuvette filled with the colour of the assay wavelength */
.swatch { display: inline-block; width: 11px; height: 15px; border-radius: 2px 2px 3px 3px; background: linear-gradient(180deg, rgba(255, 255, 255, .55) 0 22%, transparent 22%), var(--sw); box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .12); vertical-align: -2px; flex: none; }
.swatch-uv { background: linear-gradient(180deg, rgba(255, 255, 255, .5) 0 22%, transparent 22%), repeating-linear-gradient(45deg, rgba(255, 255, 255, .22) 0 2px, transparent 2px 4px), var(--sw); }
.swatch-lg { width: 30px; height: 44px; border-radius: 3px 3px 6px 6px; margin-top: 3px; }
.spectral { display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; }
.cell-swatch { display: inline-flex; align-items: center; gap: 8px; }

.spectrum { position: relative; padding-top: 20px; }
.spectrum svg { display: block; width: 100%; height: 34px; border-radius: 4px; }
.spectrum-mark { position: absolute; top: 0; bottom: 16px; width: 2px; background: var(--ink); transform: translateX(-1px); }
.spectrum-mark b { position: absolute; top: -2px; left: 6px; font-size: 12.5px; white-space: nowrap; color: var(--ink); }
.spectrum-mark::after { content: ''; position: absolute; left: -4px; bottom: -3px; width: 10px; height: 10px; border-radius: 50%; background: var(--sheet); border: 2px solid var(--ink); }
.spectrum-scale { display: flex; justify-content: space-between; font-size: 11.5px; color: var(--ink-3); margin-top: 4px; }
.spectrum-sheet { padding-top: 12px; padding-bottom: 12px; }

/* ---------- buttons & forms ---------- */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px; border: 1px solid #C4CCC8; border-radius: 5px; background: var(--sheet); color: var(--ink); font: inherit; font-size: 14px; font-weight: 600; text-decoration: none; cursor: pointer; white-space: nowrap; line-height: 1.3; }
.btn:hover { border-color: #9EA8A3; color: var(--ink); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary { background: var(--blue); border-color: var(--blue); color: #fff; }
.btn-primary:hover { background: var(--blue-deep); border-color: var(--blue-deep); color: #fff; }
.btn-danger { color: var(--red); border-color: #E3B5AE; }
.btn-danger:hover { background: var(--red-wash); color: var(--red); border-color: var(--red); }
.btn-quiet { background: transparent; border-color: transparent; color: var(--blue); }
.btn-quiet:hover { background: var(--blue-wash); border-color: transparent; color: var(--blue-deep); }
.btn-sm { padding: 3px 10px; font-size: 13px; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }
.why { font-size: 12px; color: var(--ink-3); margin-left: 6px; }
.field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; font-size: 13px; color: var(--ink-2); }
.field > span { font-weight: 600; }
.field em { font-style: normal; color: var(--ink-3); font-weight: 400; }
.field.inline { flex-direction: row; align-items: center; gap: 8px; margin: 0; }
input, select, textarea { font: inherit; color: var(--ink); }
.field input, .field select, .field textarea { padding: 8px 10px; border: 1px solid #C4CCC8; border-radius: 5px; background: var(--sheet); font-size: 14.5px; }
.field input:disabled, .field select:disabled, .field textarea:disabled { background: #F4F6F5; color: var(--ink-2); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.span-2 { grid-column: 1 / -1; }
.field-note { font-size: 13px; color: var(--ink-2); margin: 0 0 12px; }
/* number boxes are typed into: no up/down arrows to click by mistake */
input[type=number] { -moz-appearance: textfield; appearance: textfield; }
input[type=number]::-webkit-inner-spin-button, input[type=number]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.in-num { width: 7.5em; padding: 4px 7px; border: 1px solid #C4CCC8; border-radius: 4px; text-align: right; font: inherit; font-size: 14px; background: #FDFDFD; }
.in-num:disabled { background: transparent; border-color: transparent; color: var(--ink); }
.in-num:focus { border-color: var(--blue); outline: none; box-shadow: 0 0 0 3px var(--blue-wash); }
.in-price { width: 6.5em; }
.switch { display: inline-flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--ink-2); cursor: pointer; }
.switch input { width: 16px; height: 16px; accent-color: var(--blue); }

/* ---------- tables ---------- */
.tbl-tools { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 10px; }
.tbl-search { flex: 1; min-width: 200px; max-width: 340px; padding: 7px 10px; border: 1px solid #C4CCC8; border-radius: 5px; }
.tbl-filter { padding: 6px 8px; border: 1px solid #C4CCC8; border-radius: 5px; background: var(--sheet); font-size: 13.5px; }
.tbl-count { margin-left: auto; font-size: 13px; color: var(--ink-3); }
.tbl-wrap { overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th { text-align: left; font-size: 12.5px; font-weight: 600; color: var(--ink-2); padding: 7px 10px; border-bottom: 1px solid var(--rule); white-space: nowrap; vertical-align: bottom; }
.tbl td { padding: 8px 10px; border-bottom: 1px solid var(--rule-2); vertical-align: middle; white-space: nowrap; }
.tbl td.wrap { white-space: normal; min-width: 260px; }
.tbl tfoot td { border-top: 1px solid var(--rule); border-bottom: 0; }
.tbl .num { text-align: right; }
.tbl-dense td { padding: 5px 8px; font-size: 13.5px; }
.tbl-dense th { padding: 5px 8px; }
.th-sort { border: 0; background: none; padding: 0; font: inherit; color: inherit; cursor: pointer; }
.th-sort:hover { color: var(--blue); }
.row-link { cursor: pointer; }
.row-link:hover td { background: #F6F8FD; }
.tbl tr.is-selected td { background: var(--blue-wash); }
.tbl-empty { text-align: center; color: var(--ink-3); padding: 28px !important; }
.tbl-pages { display: flex; gap: 12px; align-items: center; justify-content: flex-end; margin-top: 10px; font-size: 13px; color: var(--ink-2); }
.cell-top { vertical-align: top !important; padding-top: 10px !important; }
.muted-row td { color: var(--ink-3); }
.tbl small { color: var(--ink-3); font-size: 12px; margin-left: 4px; }
.matrix th small { display: block; font-weight: 400; color: var(--ink-3); margin: 0; white-space: normal; max-width: 140px; margin-left: auto; }
.matrix .fill-row td { background: #F7F9F8; color: var(--ink-2); }
.diff tr.add td { background: #F1F9F4; }
.diff tr.del td { background: #FDF3F1; color: var(--ink-2); }
.diff tr.chg td { background: #FDF8EE; }
.ledger td.desc { white-space: normal; min-width: 180px; }
.ledger tr.t-rec td { background: #F5FAF7; }
.ledger tr.t-adj td { background: #FDF8EE; }
.ledger tr.t-open td { color: var(--ink-2); }
.perm td:not(:first-child) { text-align: center; color: var(--blue); font-weight: 700; }
.perm th:not(:first-child) { text-align: center; white-space: normal; }

.comp-title { font-size: 14.5px; font-weight: 700; margin: 18px 0 8px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.comp-title:first-of-type { margin-top: 4px; }
.comp-tag { display: inline-grid; place-items: center; min-width: 28px; height: 22px; padding: 0 5px; border: 1.5px solid var(--ink); border-radius: 3px; font: 700 12.5px var(--mono); color: var(--ink); background: var(--sheet); }

/* ---------- tabs & stepper ---------- */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--rule); margin: 0 0 16px; overflow-x: auto; }
.tab { padding: 9px 14px; color: var(--ink-2); text-decoration: none; font-weight: 600; font-size: 14px; border-bottom: 2.5px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tab:hover { color: var(--ink); }
.tab.is-active { color: var(--blue); border-bottom-color: var(--blue); }
.stepper { list-style: none; display: grid; grid-template-columns: repeat(7, 1fr); margin: 0 0 16px; padding: 0; }
.stepper li { position: relative; padding-top: 20px; font-size: 13px; color: var(--ink-3); }
.stepper li::before { content: ''; position: absolute; top: 6px; left: 0; right: 0; height: 2px; background: var(--rule); }
.stepper li.done::before, .stepper li.current::before { background: var(--blue); }
.stepper li:first-child::before { left: 7px; }
.stepper .dot { position: absolute; top: 0; left: 0; width: 14px; height: 14px; border-radius: 50%; background: var(--paper); border: 2px solid var(--rule); }
.stepper li.done .dot { background: var(--blue); border-color: var(--blue); }
.stepper li.current .dot { background: var(--sheet); border: 4px solid var(--blue); }
.stepper li.failed .dot { background: var(--red); border-color: var(--red); }
.stepper li.failed { color: var(--red); }
.stepper .lbl { display: block; font-weight: 600; }
.stepper li.done .lbl, .stepper li.current .lbl { color: var(--ink); }
.stepper .when { display: block; font-size: 11.5px; }

/* ---------- dashboard ---------- */
.alert-list { display: flex; flex-direction: column; }
.alert-row { display: grid; grid-template-columns: 4px 1fr; gap: 12px; padding: 9px 4px 9px 0; border-bottom: 1px solid var(--rule-2); color: var(--ink); text-decoration: none; }
.alert-row:last-child { border-bottom: 0; }
.alert-row:hover b { color: var(--blue); }
.alert-row .lvl { border-radius: 2px; background: var(--ink-3); }
.alert-row.lvl-critical .lvl { background: var(--red); }
.alert-row.lvl-warn .lvl { background: #C68A2E; }
.alert-row.lvl-info .lvl { background: var(--blue); }
.alert-row b { display: block; font-size: 14px; font-weight: 600; }
.alert-row small { display: block; font-size: 13px; color: var(--ink-2); }
#bell-pop .alert-row { padding: 9px 14px; }
.pipeline { list-style: none; margin: 0; padding: 0; position: relative; }
.pipeline::before { content: ''; position: absolute; left: 6px; top: 10px; bottom: 10px; width: 2px; background: var(--rule); }
.pipe-stage { position: relative; display: grid; grid-template-columns: 14px 1fr auto; column-gap: 12px; align-items: center; padding: 7px 0; }
.pipe-dot { width: 14px; height: 14px; border-radius: 50%; background: var(--paper); border: 2px solid var(--rule); position: relative; z-index: 1; }
.pipe-stage.has .pipe-dot { border-color: var(--blue); background: var(--sheet); }
.pipe-label { font-weight: 600; font-size: 14px; color: var(--ink-3); }
.pipe-stage.has .pipe-label { color: var(--ink); }
.pipe-n { font-size: 13px; color: var(--ink-3); font-weight: 600; }
.pipe-tokens { grid-column: 2 / 4; display: flex; flex-wrap: wrap; gap: 6px; }
.pipe-tokens:empty { display: none; }
.token { display: inline-flex; align-items: center; gap: 7px; padding: 4px 9px; border: 1px solid var(--rule); border-radius: 5px; color: var(--ink); text-decoration: none; font-size: 13px; background: #FBFCFB; margin-top: 4px; }
.token:hover { border-color: var(--blue); }
.recent-title { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--rule-2); font-size: 13.5px; color: var(--ink-2); }
.token small { color: var(--ink-3); font-size: 12px; }
.chart { display: block; width: 100%; height: auto; }
.chart .grid { stroke: var(--rule-2); stroke-width: 1; }
.chart .axis { fill: var(--ink-3); font-size: 11px; font-family: var(--font); }
.legend { display: flex; gap: 16px; font-size: 12.5px; color: var(--ink-2); margin-top: 6px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 6px; vertical-align: -1px; }
.lj-mean { stroke: var(--green); stroke-width: 1.5; }
.lj-sd1 { stroke: var(--rule); stroke-dasharray: 3 4; }
.lj-sd2 { stroke: #D8A75A; stroke-dasharray: 5 4; }
.lj-sd3 { stroke: var(--red); stroke-dasharray: 6 4; opacity: .7; }
.lj-line { fill: none; stroke: var(--blue); stroke-width: 1.6; }
.lj-pt { fill: var(--sheet); stroke: var(--blue); stroke-width: 2; }
.lj-warn { fill: #F2D59B; stroke: var(--amber); stroke-width: 2; }
.lj-fail { fill: var(--red); stroke: var(--red); stroke-width: 2; }

/* ---------- callouts, empty, meter ---------- */
.callout { padding: 10px 14px; border-radius: 5px; border-left: 3px solid; margin: 0 0 12px; font-size: 14px; }
.callout-red { background: var(--red-wash); border-color: var(--red); }
.callout-green { background: var(--green-wash); border-color: var(--green); }
.callout-amber { background: var(--amber-wash); border-color: #C68A2E; }
.callout-neutral { background: #F2F4F3; border-color: var(--ink-3); color: var(--ink-2); }
.callout .btn { margin-left: 4px; }
.head-actions .callout { margin: 0; max-width: 520px; }
.short-list { margin: 8px 0 0; padding-left: 18px; }
.short-list li { margin: 4px 0; }
.empty { text-align: center; padding: 36px 20px; color: var(--ink-2); max-width: 620px; margin: 0 auto; }
.empty-title { font-size: 16px; font-weight: 700; color: var(--ink); margin-bottom: 6px; }
.empty .btn { margin-top: 8px; }
.meter { display: inline-block; width: 100%; max-width: 360px; height: 8px; border-radius: 4px; background: var(--rule-2); overflow: hidden; vertical-align: middle; }
.meter span { display: block; height: 100%; background: var(--blue); }
.meter-bad span { background: var(--red); }

/* ---------- products, batches, process ---------- */
.product-head .ph-title h1 { font-size: 27px; }
.steps-plain { margin: 0 0 6px; padding-left: 22px; }
.steps-plain li { padding: 3px 0; }
.steps-plain li.is-ph { font-weight: 600; }
.steps-plain li.is-enzyme { color: var(--violet); }
.nb-grid { display: grid; grid-template-columns: 340px 1fr; gap: 16px; align-items: start; }
.nb-form { position: sticky; top: 76px; }
.nb-grid > * { min-width: 0; }
.nb-preview { overflow-x: auto; }
.nb-preview td.mat { white-space: normal; min-width: 200px; }
.grid-2 > * { min-width: 0; }
.nb-meta { margin: 6px 0 4px; }
.nb-meta .fields { --cols: 2 !important; }
.nb-actions { margin-top: 14px; }
.nb-parts { border: 1px solid var(--rule); border-radius: 6px; padding: 8px 12px 2px; margin: 0 0 12px; }
.nb-parts legend { padding: 0 4px; font-size: 13px; font-weight: 600; color: var(--ink-2); }
.nb-part { display: flex; align-items: center; gap: 10px; padding: 6px 0; }
.nb-part + .nb-part { border-top: 1px dashed var(--rule); }
.nb-make { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0; font-size: 14px; cursor: pointer; }
.nb-make input { width: 17px; height: 17px; margin: 0; flex: none; }
.nb-make > span:last-child { overflow-wrap: anywhere; }
.nb-litres { display: flex; align-items: center; gap: 6px; flex: none; font-size: 13px; color: var(--ink-2); }
.nb-litres input { width: 84px; padding: 7px 8px; border: 1px solid #C4CCC8; border-radius: 5px; background: var(--sheet); font-size: 14.5px; text-align: right; }
.nb-litres input:disabled { background: #F4F6F5; color: var(--ink-3); }
.nb-part.is-off .nb-make > span { color: var(--ink-3); }
.nb-part.is-off .comp-tag { border-color: var(--ink-3); }
.nb-nos { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.nb-nos .field input { width: 100%; min-width: 0; box-sizing: border-box; }
.nb-nos .field input.code { font-family: var(--mono); }
.pre-grid { display: grid; grid-template-columns: 1.2fr 1fr; gap: 20px; align-items: start; }
.steps { list-style: none; margin: 0; padding: 0; }
.step { display: grid; grid-template-columns: 56px 1fr 150px; gap: 10px; align-items: start; padding: 9px 0; border-bottom: 1px solid var(--rule-2); }
.step:last-child { border-bottom: 0; }
.step-check { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.step-check input { width: 18px; height: 18px; accent-color: var(--blue); }
.step-n { font: 600 13px var(--mono); color: var(--ink-3); }
.step.is-done .step-body > span:first-child { color: var(--ink-2); }
.step.is-done .step-n { color: var(--blue); }
.step.is-qc { color: var(--ink-3); }
.step-body { display: flex; flex-direction: column; gap: 4px; }
.step-note { font-size: 13px; color: var(--violet); }
.ph-in { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.step-by { font-size: 12px; color: var(--ink-3); text-align: right; }
.sticky-actions { position: sticky; bottom: 12px; z-index: 5; display: flex; gap: 10px; align-items: center; justify-content: flex-end; padding: 10px 14px; background: var(--sheet); border: 1px solid var(--rule); border-radius: 7px; box-shadow: 0 6px 20px rgba(23, 32, 51, .1); }
.sticky-actions > span { margin-right: auto; color: var(--ink-2); font-size: 13.5px; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { display: flex; gap: 10px; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--rule-2); font-size: 13.5px; }
.doc-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 10px; }
.doc-list a { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; padding: 12px 14px; border: 1px solid var(--rule); border-radius: 6px; text-decoration: none; color: var(--ink); height: 100%; }
.doc-list a:hover { border-color: var(--blue); background: #FAFBFE; }
.doc-list a span { flex-basis: 100%; font-size: 13px; color: var(--ink-2); }
.doc-preview { background: #E7EBE9; padding: 20px; border-radius: 5px; overflow-x: auto; }

/* ---------- QC ---------- */
.readings .in-num { width: 7em; }
.spec { color: var(--ink-3); font-size: 11.5px; display: block; }
.results .val { font-size: 15px; }
.qc-grid { align-items: start; }
/* the left half of the QC page: names wrap and the pick lists share what is left, so nothing spills onto Readings */
.phys th, .phys td { white-space: normal; padding-left: 6px; padding-right: 6px; }
.phys .in-num { width: 5.5em; }
.phys th:nth-child(4) { width: 28%; }
.phys th:nth-child(5) { width: 25%; }
.phys select { width: 100%; min-width: 6em; padding: 4px 3px; border: 1px solid #C4CCC8; border-radius: 4px; background: var(--sheet); font: inherit; font-size: 13.5px; }
.qc-grid .form-grid { grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); }
.qc-grid .field select { width: 100%; min-width: 0; }
/* the CBC control check: the lot for each level, then the readings level by level */
.cbc-lots { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); gap: 0 14px; }
.cbc-lots .field select { width: 100%; min-width: 0; }
.cbc-lots .field b { font-weight: 500; color: var(--ink); font-size: 14px; }
.cbc-tbl th[scope=row] { font-weight: 600; color: var(--ink); white-space: nowrap; vertical-align: middle; }
.cbc-tbl thead th.cbc-lvl, .cbc-tbl td.cbc-lvl { border-left: 1px solid var(--rule); }
.cbc-tbl thead tr:first-child th.cbc-lvl { text-align: center; }
.cbc-tbl td.cbc-lvl { color: var(--ink-2); font-variant-numeric: tabular-nums; }
.cbc-tbl .in-num { width: 5.5em; }
.cbc-mark { display: inline-block; width: 1.2em; margin-left: 4px; text-align: center; font-weight: 700; }
.cbc-ok { color: var(--green, #1f7a4a); }
.cbc-bad { color: var(--red, #b42318); }

/* ---------- modal, toast, tour ---------- */
.modal-wrap { position: fixed; inset: 0; z-index: 100; background: rgba(23, 32, 51, .38); display: grid; place-items: start center; padding: 8vh 16px 16px; overflow-y: auto; }
.modal { width: 100%; max-width: 580px; background: var(--sheet); border-radius: 9px; box-shadow: 0 24px 60px rgba(23, 32, 51, .25); }
.modal-wide { max-width: 860px; }
.modal header { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--rule-2); }
.modal header h2 { font-size: 17px; }
.modal header .icon-btn { border: 0; width: 32px; height: 32px; }
.modal-body { padding: 18px 20px 6px; }
.modal footer { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--rule-2); }
.modal-error { color: var(--red); font-weight: 600; font-size: 13.5px; }
input.combo-input { padding-right: 30px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M2.5 4.5 6 8l3.5-3.5' fill='none' stroke='%234A5468' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; }
.combo-list { position: fixed; z-index: 5; overflow-y: auto; padding: 4px; background: var(--sheet); border: 1px solid var(--rule); border-radius: 7px; box-shadow: 0 14px 34px rgba(23, 32, 51, .2); }
.combo-opt { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; padding: 7px 10px; border-radius: 4px; font-size: 14px; color: var(--ink); cursor: pointer; }
.combo-opt.is-active { background: var(--blue-wash); color: var(--blue-deep); }
.combo-name { min-width: 0; overflow-wrap: anywhere; }
.combo-opt .code { flex: none; font-size: 12.5px; color: var(--ink-3); }
.combo-opt.is-active .code { color: var(--blue-deep); }
.combo-group { padding: 9px 10px 3px; font-size: 12.5px; font-weight: 700; color: var(--ink-3); }
.combo-note { padding: 8px 10px; font-size: 13px; color: var(--ink-3); }
.combo-create { margin-top: 4px; border-top: 1px solid var(--rule-2); border-radius: 0 0 4px 4px; color: var(--blue); font-weight: 600; }
/* Material and product lists: the code, then the name, in two columns under their headings, a line between them.
   Under a Code box and a Name box (UI.codePair) the line falls where the Name box starts (--code-w). */
.combo-list.coded .combo-opt:not(.combo-create), .combo-cols { display: grid; grid-template-columns: var(--code-w, 8.5rem) minmax(0, 1fr); gap: 0; align-items: stretch; }
.combo-list.coded .combo-opt:not(.combo-create) { padding: 0 10px; }
.combo-list.coded .combo-opt .code { padding: 7px 12px 7px 0; font-size: 13px; color: var(--ink-2); overflow-wrap: anywhere; }
.combo-list.coded .combo-opt .combo-name, .combo-cols > :last-child { padding-left: 12px; border-left: 1px solid var(--rule); }
.combo-list.coded .combo-opt .combo-name { padding-top: 7px; padding-bottom: 7px; }
.combo-cols { position: sticky; top: -4px; z-index: 1; margin: -4px -4px 2px; padding: 0 14px; background: var(--sheet); border-bottom: 1px solid var(--rule-2); font-size: 12.5px; font-weight: 700; color: var(--ink-3); }
.combo-cols > span { padding: 8px 0 6px; }
.pick2 { display: flex; gap: 8px; min-width: 0; }
.pick2 input { min-width: 0; }
.pick2 .pick-code { flex: 0 0 9.5rem; padding-right: 10px; background-image: none; }
.pick2 .pick-name { flex: 1 1 auto; width: 0; } /* takes the room left, never widens the form */
.field.inline .pick2 { width: 30em; max-width: 100%; }
.fe-lines .pick2 input, .bom-rows .pick2 input { padding: 5px 8px; border: 1px solid #C4CCC8; border-radius: 4px; background-color: var(--sheet); font: inherit; font-size: 14px; }
.fe-lines .pick2 .pick-name, .bom-rows .pick2 .pick-name { padding-right: 28px; background-position: right 8px center; }
.fe-lines .pick2 .pick-code, .bom-rows .pick2 .pick-code { flex-basis: 8.5rem; }
.fe-lines .pick2 { min-width: 360px; }
@media (max-width: 560px) { .pick2 .pick-code { flex-basis: 7.5rem; } }
.field-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.field-head > span { font-weight: 600; }
.link-btn { padding: 0; border: 0; background: none; color: var(--blue); font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; }
.link-btn:hover { text-decoration: underline; }
.link-btn:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; border-radius: 2px; }
/* Master list: a price is a button that opens the price form */
.link-btn.price-edit { font-size: inherit; font-weight: 400; color: var(--ink); text-decoration: underline dotted var(--ink-3); text-underline-offset: 3px; }
.link-btn.price-edit:hover { color: var(--blue); text-decoration: underline; }
.new-mat { margin-top: 2px; padding: 12px 12px 0; background: #F6F8F7; border: 1px solid var(--rule-2); border-radius: 6px; }
.new-mat .switch { align-self: center; margin-bottom: 12px; }
/* New inward: the delivery once, then one box per item */
.inw-head { grid-template-columns: repeat(auto-fit, minmax(min(100%, 180px), 1fr)); }
.inw-head > *, .inw-fields > *, .inw-item .new-mat > * { min-width: 0; } /* a long delivery name in the list must not widen the form */
.inw-head select { width: 100%; }
.inw-head [name=inwardNo] { font-variant-numeric: tabular-nums; }
.inw-head [aria-invalid="true"] { border-color: var(--red); }
.field-note.err-text { color: var(--red); }
.inw-item .field-head { flex-wrap: wrap; }
.inw-items { display: grid; gap: 10px; }
.inw-item { padding: 12px 12px 0; border: 1px solid var(--rule-2); border-radius: 6px; }
.inw-item .field-head .code { margin-left: 4px; font-weight: 400; color: var(--ink-3); }
.inw-acts { display: inline-flex; gap: 16px; }
.inw-fields { grid-template-columns: repeat(auto-fit, minmax(min(100%, 150px), 1fr)); }
.inw-add { margin: 12px 0 4px; }
.import-preview { max-height: 300px; overflow-y: auto; }
.modal-wide .import-preview { max-height: none; overflow: visible; }
.modal:has(.import-table) { max-width: 1120px; }
.import-scroll { max-height: 38vh; overflow: auto; }
.import-table .in-num { width: 5.5em; padding: 4px 5px; }
.import-table .in-unit { width: 4.8em; }
.import-table td { vertical-align: middle; }
.row-warn { background: var(--amber-wash); }

#update-note { position: fixed; z-index: 60; left: 50%; bottom: 20px; transform: translateX(-50%); display: flex; align-items: center; gap: 14px; padding: 10px 12px 10px 16px; background: var(--ink); color: #fff; border-radius: 7px; box-shadow: 0 6px 24px rgba(23, 32, 51, .25); font-size: 14px; max-width: calc(100vw - 32px); }

/* import from a file */
.import-start { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.import-start .field { flex: 1 1 280px; margin: 0; }
.import-map { border: 1px solid var(--rule); border-radius: 6px; padding: 8px 12px; margin: 0 0 12px; }
.import-map summary { cursor: pointer; font-size: 13.5px; color: var(--ink-2); }
.import-map[open] summary { margin-bottom: 10px; }
.map-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 12px; }
.map-grid .field select { width: 100%; }
.import-counts { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 4px 0 8px; }
.import-table td.wrap { min-width: 220px; }
/* Specification sheets: the file name under its code, and the rest allowed to wrap so the notes stay in view. */
.spec-table .in-code { width: 9.5em; }
.spec-table .spec-file { display: block; margin-top: 2px; font-size: 11.5px; overflow-wrap: anywhere; }
.spec-table td { white-space: normal; }
.spec-table td:nth-child(3) { min-width: 180px; }
.spec-table td:nth-child(5) .chip { white-space: normal; text-align: left; line-height: 1.3; }
.spec-table .in-name { width: 15em; padding: 4px 7px; border: 1px solid #C4CCC8; border-radius: 4px; font: inherit; font-size: 14px; }
.spec-new { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.spec-cas { display: inline-flex; align-items: center; gap: 4px; font-size: 12.5px; white-space: nowrap; margin-top: 3px; }
.spec-new select { padding: 3px 4px; font: inherit; font-size: 13px; }
.kind-list { grid-template-columns: 1fr; }
.kind-pick { display: flex; flex-wrap: wrap; gap: 4px 8px; width: 100%; padding: 12px 14px; border: 1px solid var(--rule); border-radius: 6px; background: none; font: inherit; color: var(--ink); text-align: left; cursor: pointer; }
.kind-pick:hover { border-color: var(--blue); background: #FAFBFE; }
.kind-pick:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
.kind-pick span { flex-basis: 100%; font-size: 13px; color: var(--ink-2); }
@media (max-width: 880px) { .map-grid { grid-template-columns: 1fr; } }
.in-code, .in-unit { padding: 4px 7px; border: 1px solid #C4CCC8; border-radius: 4px; font: inherit; font-size: 14px; background: #FDFDFD; }
.in-code { width: 11em; }
.in-unit { width: 5.5em; }
.in-code:disabled { background: transparent; border-color: transparent; color: var(--ink); }
.in-code:focus, .in-unit:focus { border-color: var(--blue); outline: none; box-shadow: 0 0 0 3px var(--blue-wash); }
#toasts { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 6px; font-size: 14px; box-shadow: 0 10px 28px rgba(23, 32, 51, .25); transition: opacity .3s, transform .3s; max-width: 560px; }
.toast-err { background: var(--red); }
.toast-act { pointer-events: auto; }
.toast-act a { color: #fff; font-weight: 600; text-decoration: underline; text-underline-offset: 2px; margin-left: 4px; white-space: nowrap; }
.toast.out { opacity: 0; transform: translateY(6px); }
#tour { position: fixed; right: 20px; bottom: 20px; z-index: 90; width: 370px; background: var(--sheet); border: 1px solid var(--rule); border-radius: 9px; box-shadow: 0 18px 44px rgba(23, 32, 51, .22); padding: 0 18px 14px; overflow: hidden; }
.tour-progress { height: 4px; margin: 0 -18px 12px; background: var(--rule-2); }
.tour-progress span { display: block; height: 100%; background: var(--blue); transition: width .3s; }
.tour-count { font-size: 12px; color: var(--ink-3); margin: 0 0 2px; }
#tour h3 { font-size: 16px; margin-bottom: 6px; }
#tour p { font-size: 13.5px; color: var(--ink-2); }
.tour-btns { display: flex; gap: 6px; align-items: center; }
.tour-btns span { flex: 1; }
.tour-hl { outline: 3px solid #E0A33A !important; outline-offset: 4px; border-radius: 6px; animation: hl 1.2s ease-out 1; }
@keyframes hl { 0% { outline-offset: 12px; outline-color: rgba(224, 163, 58, 0); } 100% { outline-offset: 4px; } }

/* ---------- documents (A4) ---------- */
.print-wrap { padding: 20px 28px 60px; }
.print-bar { display: flex; align-items: center; gap: 12px; max-width: 210mm; margin: 0 auto 14px; }
.print-bar span { flex: 1; font-size: 13px; color: var(--ink-3); }
/* Export: one button, its list of PDF, Excel and Word */
.dl-menu { position: relative; display: inline-flex; flex: none; }
.dl-caret { width: 12px; height: 12px; flex: none; }
.dl-pop { position: absolute; z-index: 30; top: calc(100% + 4px); right: 0; display: grid; min-width: 150px; padding: 4px; background: var(--sheet); border: 1px solid var(--rule); border-radius: 8px; box-shadow: 0 12px 32px rgba(23, 32, 51, .14); }
.dl-pop button { display: block; width: 100%; padding: 8px 12px; border: 0; border-radius: 5px; background: none; color: var(--ink); font: inherit; font-size: 14px; text-align: left; cursor: pointer; }
.dl-pop button:hover, .dl-pop button:focus-visible { background: var(--paper); outline: none; }
.dl-pop button:focus-visible { box-shadow: inset 0 0 0 2px var(--blue); }
/* a printout built off screen for a download button on another screen */
.dl-src { position: absolute; left: -100000px; top: 0; width: 210mm; }
/* a page laid out as it prints, off screen, for the PDF and Word downloads (js/views/downloads.js) */
.dl-stage { position: absolute; left: -100000px; top: 0; background: #fff; }
.dl-stage .doc-page { width: auto; min-height: 0; border: 0; box-shadow: none; padding: 0; margin: 0; }
.dl-stage .doc-page.inward-page { width: 100%; }
.doc { display: flex; flex-direction: column; align-items: center; } /* a record of many pages prints one under another */
.doc-page { width: 210mm; max-width: 100%; min-height: 270mm; background: #fff; padding: 14mm 14mm 16mm; border: 1px solid var(--rule); box-shadow: 0 6px 24px rgba(23, 32, 51, .08); font-size: 12.5px; color: #111827; }
.doc-preview .doc-page { margin: 0 auto; min-height: 0; }
.doc-head { display: flex; justify-content: space-between; align-items: flex-end; border-bottom: 2px solid #111827; padding-bottom: 8px; margin-bottom: 12px; gap: 20px; }
.doc-brand { display: flex; gap: 10px; align-items: center; }
.doc-logo { width: 34px; height: 34px; color: var(--blue); }
.doc-brand b { display: block; font-size: 16px; }
.doc-brand span { display: block; font-size: 11.5px; color: #4B5563; }
.doc-head h1 { font-size: 17px; text-align: right; }
.doc-grid { width: 100%; border-collapse: collapse; margin-bottom: 10px; }
.doc-grid th, .doc-grid td { border: 1px solid #9CA3AF; padding: 4px 7px; text-align: left; font-size: 11.5px; vertical-align: top; }
.doc-grid th { background: #F3F4F6; font-weight: 600; width: 13%; }
.doc-sec { font-size: 13.5px; margin: 14px 0 6px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.doc-sec > span:last-child:not(.comp-tag) { font-weight: 400; color: #4B5563; font-size: 12px; margin-left: auto; }
.doc-tbl { width: 100%; border-collapse: collapse; margin-bottom: 8px; }
.doc-tbl th, .doc-tbl td { border: 1px solid #9CA3AF; padding: 3px 6px; font-size: 11.5px; text-align: left; vertical-align: top; }
.doc-tbl th { background: #F3F4F6; font-weight: 600; }
.doc-tbl .num { text-align: right; }
.doc-grid td, .doc-tbl td { white-space: nowrap; }
.doc-tbl td:nth-child(3), .doc-steps td:nth-child(2) { white-space: normal; }
.doc-steps td:first-child { width: 40px; text-align: center; }
.doc-steps td:last-child { width: 150px; }
.doc-note { font-size: 11.5px; color: #374151; margin: 4px 0 8px; }
.doc-statement { font-size: 12px; margin: 8px 0; }
.doc-decision { font-size: 13px; font-weight: 600; margin-top: 10px; }
.doc-decision span { display: inline-block; padding: 2px 12px; border: 1px solid #9CA3AF; margin-left: 8px; color: #9CA3AF; }
.doc-decision span.is-on { border: 2px solid #111827; color: #111827; }
.doc-sign { display: flex; justify-content: space-between; gap: 40px; margin-top: 34px; }
.doc-sign div { flex: 1; max-width: 240px; text-align: center; }
.sig-line { display: block; border-bottom: 1px solid #111827; padding-bottom: 4px; min-height: 22px; font-family: 'Segoe Script', 'Brush Script MT', cursive; color: var(--blue); font-size: 15px; }
.doc-sign small { font-size: 11px; color: #4B5563; }
.label-sheet { display: grid; grid-template-columns: repeat(auto-fill, 62mm); gap: 4mm; }
.label-sheet.small { grid-template-columns: repeat(auto-fill, 58mm); }
.label { border: 1px dashed #9CA3AF; padding: 2.5mm 3mm; font-size: 10px; line-height: 1.3; min-height: 38mm; display: flex; flex-direction: column; }
.label-top { display: flex; justify-content: space-between; align-items: center; }
.label-top b { font-size: 12.5px; }
.ivd { display: inline-block; border: 1.5px solid currentColor; padding: 0 3px; font-weight: 700; font-size: 10px; letter-spacing: .04em; }
.label-comp { margin: 1mm 0; font-weight: 600; }
.label dl { display: grid; grid-template-columns: auto 1fr; gap: 0 6px; margin: 0; }
.label dt { font-weight: 700; border: 1px solid #111827; padding: 0 2px; font-size: 8.5px; align-self: center; }
.label dd { margin: 0; font-family: var(--mono); }
.label-foot { margin: auto 0 0; font-size: 8.5px; color: #374151; display: flex; justify-content: space-between; gap: 4px; padding-top: 1mm; }
.therm { font-weight: 700; color: #111827; }
.ifu { font-size: 11.5px; }
.ifu-head { display: flex; gap: 12px; align-items: flex-start; border: 2px solid #9CA3AF; padding: 10px 12px; margin-bottom: 12px; }
.ifu-head h1 { font-size: 20px; color: var(--blue-deep); }
.ifu-head p { margin: 4px 0 0; font-weight: 600; }
.ifu-head .ivd { margin-left: auto; font-size: 12px; }
.ifu-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.ifu h3 { font-size: 12px; margin: 10px 0 3px; }
.ifu p, .ifu ul, .ifu ol { margin: 0 0 4px; }
.ifu ul, .ifu ol { padding-left: 16px; }
.ifu-tbl { border-collapse: collapse; width: 100%; margin: 4px 0; }
.ifu-tbl th, .ifu-tbl td { border: 1px solid #9CA3AF; padding: 2px 5px; font-size: 11px; text-align: center; }
.ifu-params th { text-align: left; font-weight: 400; padding-right: 12px; }
.ifu-params td { font-weight: 600; }
.ifu-calc { font-weight: 600; }
.ifu-foot { margin-top: 18px; border-top: 1px solid #9CA3AF; padding-top: 6px; font-size: 10.5px; display: flex; gap: 8px; flex-wrap: wrap; }
.ifu-foot span { margin-left: auto; }
.roadmap ul { margin: 0; padding-left: 18px; columns: 2; column-gap: 32px; }
.roadmap li { margin-bottom: 6px; break-inside: avoid; }

/* ---------- incoming QC: stock on hold ---------- */
.held { color: var(--amber); font-weight: 600; }
a.held { text-decoration: underline; text-decoration-style: dotted; }
.tab-count { display: inline-block; min-width: 18px; margin-left: 4px; padding: 0 5px; border-radius: 9px; background: var(--amber-wash); color: var(--amber); font-size: 11.5px; text-align: center; }
.stepper-4 { grid-template-columns: repeat(4, 1fr); max-width: 760px; }
.rm-tests select { padding: 5px 8px; border: 1px solid #C4CCC8; border-radius: 4px; background: var(--sheet); font: inherit; font-size: 14px; min-width: 11em; }
.rm-tests select:disabled { border-color: transparent; background: transparent; color: var(--ink); -webkit-appearance: none; appearance: none; }
.rm-tests td { vertical-align: middle; }
.rm-tests .in-num { width: 11em; } /* as wide as the remarks box next to it: easy to click */
.spec { display: block; font-size: 12px; color: var(--ink-3); }
.ledger tr.t-qua td { background: #FDF8EF; }
.ledger tr.t-rej td { background: #FDF3F1; }
.ledger tr.t-rel td { background: #F3F9F5; }
.ledger .chip { font-size: 11px; padding: 0 6px; margin-left: 4px; }
/* the incoming test screen, laid out like the client's QC report (VD/QC/SOP/003 R-02, R-04) */
.qr-grid { display: grid; grid-template-columns: 1.15fr 1fr; gap: 6px 36px; }
.qr-row { display: grid; grid-template-columns: 11.5em 10px minmax(0, 1fr); align-items: center; min-height: 34px; }
.qr-row > span { font-weight: 600; color: var(--ink-2); font-size: 14px; }
.qr-row > b { color: var(--ink-3); font-weight: 400; }
.qr-row input { width: 100%; box-sizing: border-box; padding: 5px 8px; border: 1px solid #C4CCC8; border-radius: 4px; background: #FDFDFD; font-size: 14px; }
.qr-row input:focus, .qr-tests input:focus { border-color: var(--blue); outline: none; box-shadow: 0 0 0 3px var(--blue-wash); }
.qr-row input:disabled { background: transparent; border-color: transparent; padding-left: 0; color: var(--ink); }
.qr-more { margin: 10px 0 0; font-size: 13px; }
.qr-tests [data-rmo] { width: 100%; max-width: 18em; box-sizing: border-box; padding: 4px 7px; border: 1px solid #C4CCC8; border-radius: 4px; background: #FDFDFD; font-size: 14px; }
.qr-tests [data-rmo]:disabled { background: transparent; border-color: transparent; padding-left: 0; color: var(--ink); }
.qr-tests tr.qr-grp th { background: var(--paper); text-align: left; font-size: 12.5px; letter-spacing: .04em; padding: 5px 10px; }
@media (max-width: 900px) { .qr-grid { grid-template-columns: 1fr; } }
@media (max-width: 560px) { .qr-row { grid-template-columns: 1fr; } .qr-row > b { display: none; } }

/* the printed QC report, as on the client's master copies */
.qr-page { font-family: Calibri, Carlito, 'Segoe UI', Arial, sans-serif; color: #000; }
.qr-top { display: grid; grid-template-columns: 1fr 2.1fr 1.35fr; gap: 12px; font-weight: 700; font-size: 13.5px; line-height: 1.32; margin-bottom: 8px; }
.qr-rev u { display: block; }
.qr-ctl { width: 100%; border-collapse: collapse; margin: 0 0 20px; font-weight: 700; font-size: 13px; }
.qr-ctl th, .qr-ctl td { border: 1px solid #000; padding: 5px 7px; text-align: left; height: 22px; }
.qr-ctl td:first-child { width: 17%; font-weight: 400; }
.qr-ctl td:last-child, .qr-ctl th:last-child { width: 20%; }
.qr-ctl td { font-weight: 400; }
.qr-title { font-size: 14px; font-weight: 700; text-align: center; text-decoration: underline; margin: 0 0 16px; }
.qr-page-pm .qr-title { font-family: 'Times New Roman', Times, serif; font-weight: 400; font-size: 16px; }
.qr-fields { border-collapse: collapse; margin: 0 0 6px 4%; width: 92%; font-size: 13px; }
.qr-fields th { text-align: left; font-weight: 700; padding: 3px 6px 3px 0; white-space: nowrap; width: 22%; }
.qr-fields td { padding: 3px 6px; width: 34%; }
.qr-fields td:last-child { width: 22%; }
.qr-test { font-family: 'Times New Roman', Times, serif; font-size: 14px; margin: 4px 0 10px 4%; line-height: 1.3; }
.qr-tbl { width: 86%; margin: 0 0 26px 7%; border-collapse: collapse; font-size: 13px; }
.qr-tbl th, .qr-tbl td { border: 1px solid #000; padding: 3px 7px; text-align: left; height: 18px; }
.qr-tbl thead th { text-align: center; font-weight: 400; }
.qr-pm { width: 80%; margin: 14px 0 20px 9%; font-family: Arial, Helvetica, sans-serif; }
.qr-pm thead th { padding: 9px 7px; }
.qr-pm td, .qr-pm th { padding: 6px 7px; }
.qr-tbl tr.qr-grp th { text-align: center; font-weight: 700; }
.qr-concl { font-family: Arial, Helvetica, sans-serif; font-size: 13px; margin-left: 4%; }
.qr-concl p { margin: 0 0 14px; }
.qr-ticks { display: flex; justify-content: space-between; max-width: 80%; margin: 22px 0 18px 3%; }
.qr-ticks span { display: inline-flex; align-items: center; gap: 10px; }
.qr-box { display: inline-block; width: 38px; height: 18px; border: 1.5px solid #000; font-style: normal; text-align: center; line-height: 18px; font-weight: 700; }
.qr-sign { display: flex; justify-content: space-between; align-items: flex-end; max-width: 86%; margin-left: 3%; }
.qr-chem { display: flex; flex-direction: column; align-items: center; min-width: 9em; }
.qr-chem em { font-style: normal; min-height: 18px; }

/* ---------- product set-up and the formula editor ---------- */
.checklist { list-style: none; margin: 6px 0 0; padding: 0; }
.checklist li { display: flex; gap: 8px; align-items: baseline; padding: 2px 0; }
.checklist .tick { flex: none; width: 16px; height: 16px; border: 1.5px solid var(--amber); border-radius: 3px; display: inline-grid; place-items: center; font-size: 11px; font-weight: 700; transform: translateY(2px); }
.checklist li.is-done { color: var(--ink-2); }
.checklist li.is-done .tick { background: var(--green); border-color: var(--green); color: #fff; }
.fe-comp-head { display: flex; flex-wrap: wrap; gap: 0 14px; align-items: flex-end; margin-bottom: 4px; }
.fe-comp-head .field { margin-bottom: 10px; }
.fe-comp-head .fe-tag input { width: 4.5em; font-family: var(--mono); font-weight: 700; text-transform: uppercase; border: 1.5px solid var(--ink); text-align: center; }
.fe-comp-head .fe-name { flex: 1 1 220px; }
.fe-comp-head .fe-l input { width: 8em; }
.fe-del-comp { margin: 0 0 12px auto; }
.fe-lines select { width: 100%; min-width: 260px; padding: 5px 8px; border: 1px solid #C4CCC8; border-radius: 4px; background: var(--sheet); font: inherit; font-size: 14px; }
.fe-lines td { vertical-align: middle; }
.fe-lines .icon-btn, .tests-edit .icon-btn, .bom-rows .icon-btn { width: 30px; height: 30px; font-size: 18px; }
.fe-foot { justify-content: flex-end; border-top: 0; }
.tests-edit input, .tests-edit select, .bom-rows select { width: 100%; padding: 5px 7px; border: 1px solid #C4CCC8; border-radius: 4px; background: var(--sheet); font: inherit; font-size: 13.5px; }
.tests-edit input:disabled { background: #F4F6F5; }
.tests-edit .in-num { width: 5.5em; }
.tests-edit .in-unit { width: 5em; }
.tests-edit td { vertical-align: middle; }
.tests-edit { table-layout: fixed; min-width: 760px; }
.tests-edit th:nth-child(1) { width: 32%; }
.tests-edit th:nth-child(2) { width: 16%; }
.tests-edit th:nth-child(3) { width: 24%; }
.tests-edit th:nth-child(4), .tests-edit th:nth-child(5) { width: 9%; }
.tests-edit th:nth-child(6) { width: 7%; }
.tests-edit th:nth-child(7) { width: 42px; }
.tests-edit .in-num, .tests-edit .in-unit { width: 100%; }
.trio { border: 1px solid var(--rule-2); border-radius: 6px; padding: 8px 12px 0; margin: 0 0 12px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 12px; }
.trio legend { font-size: 13px; font-weight: 700; color: var(--ink); padding: 0 4px; }
.trio .field { margin-bottom: 10px; }
.trio .field input { width: 100%; min-width: 0; }
.trio[hidden], .field[hidden] { display: none; }
.matrix th .btn { margin-top: 4px; }
.switch.span-2 { margin: 2px 0 12px; align-items: flex-start; }
.switch.span-2 input { margin-top: 2px; flex: none; }

/* ---------- responsive ---------- */
@media (max-width: 1180px) {
  .grid-2 { grid-template-columns: 1fr; }
  .kpis-wrap { grid-template-columns: repeat(3, 1fr); }
  .kpis-wrap .kpi:nth-child(4) { border-left: 0; }
  .kpis-wrap .kpi:nth-child(n+4) { border-top: 1px solid var(--rule-2); }
  .nb-grid { grid-template-columns: 1fr; }
  .nb-form { position: static; }
  .fields { --cols: 4 !important; }
}
@media (max-width: 880px) {
  .app { grid-template-columns: 1fr; }
  .side { position: fixed; z-index: 50; left: 0; top: 0; width: 260px; transform: translateX(-100%); transition: transform .2s; box-shadow: 0 0 40px rgba(23, 32, 51, .2); }
  .side.open { transform: none; }
  #menu-btn { display: inline-flex; }
  .top { padding: 10px 16px; flex-wrap: wrap; }
  #role { max-width: 180px; }
  .page { padding: 18px 16px 70px; }
  .page-head { flex-direction: column; }
  .head-actions { justify-content: flex-start; }
  .head-actions.one-line { flex-wrap: wrap; }
  .fields { --cols: 2 !important; }
  .stepper { grid-template-columns: repeat(4, 1fr); row-gap: 12px; }
  .pre-grid, .form-grid, .ifu-cols { grid-template-columns: 1fr; }
  .step { grid-template-columns: 50px 1fr; }
  .step-by { grid-column: 2; text-align: left; }
  #tour { left: 12px; right: 12px; width: auto; }
  #bell-pop { width: 92vw; right: -60px; }
  .roadmap ul { columns: 1; }
}
@media (max-width: 560px) {
  .kpis { grid-template-columns: 1fr 1fr; }
  .kpi { border-left: 0 !important; border-top: 1px solid var(--rule-2); }
  .search-wrap { order: 5; flex-basis: 100%; max-width: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- print ---------- */
@media print {
  @page { size: A4; margin: 10mm; }
  body { background: #fff; }
  .side, .top, .print-bar, #tour, #toasts, .modal-wrap { display: none !important; }
  .app { display: block; }
  .print-wrap { padding: 0; }
  .doc-page { width: auto; min-height: 0; border: 0; box-shadow: none; padding: 0; }
  .page { padding: 0; }
  .sheet { break-inside: avoid; }
  a { color: inherit; text-decoration: none; }
  /* the material inward register is landscape, like the store's sheet */
  @page inward { size: A4 landscape; margin: 10mm; }
  .doc-page.inward-page { page: inward; width: 100%; }
}

/* ---------- material inward register (printout) ---------- */
.doc-page.inward-page { width: 297mm; }
.inw-title { margin: 0; text-align: center; font-size: 17px; font-weight: 700; letter-spacing: .02em; }
.inw-year { margin: 2px 0 10px; text-align: center; font-weight: 700; }
.inw-tbl th, .inw-tbl td { font-size: 10.5px; padding: 2px 4px; }
.inw-tbl thead th { text-align: center; vertical-align: middle; }
.inw-tbl thead { display: table-header-group; } /* repeats on every printed page */
.inw-tbl tr { break-inside: avoid; }
.inw-tbl .inw-sign { width: 12mm; }


/* Sign-in */
.signin { position: fixed; inset: 0; display: grid; place-items: center; background: var(--paper); padding: 16px; }
.signin-card { width: min(360px, 100%); background: var(--sheet); border: 1px solid var(--rule); border-radius: 8px; padding: 24px; }
.signin-card .brand { padding: 0 0 18px; }
.signin-card .btn { width: 100%; justify-content: center; }
.signin-card .modal-error { margin: 0 0 12px; }

/* Specification sheets (CS) and the delivery's sample details */
.form-grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.spec-desc { margin: 8px 0; font-size: 13.5px; color: var(--ink-2); line-height: 1.5; max-width: 90ch; }
.spec-limits { margin-top: 8px; }
.spec-limits .spec-total td { font-weight: 600; border-top: 1.5px solid var(--rule-2); }
.spec-details > summary { cursor: pointer; padding: 2px 0; list-style-position: inside; }
.spec-details[open] > summary { margin-bottom: 10px; }
@media (max-width: 900px) { .form-grid-4 { grid-template-columns: 1fr 1fr; } }
@media (max-width: 560px) { .form-grid-4 { grid-template-columns: 1fr; } }

/* The forms of the client's BMR filled in on screen */
.bmr-list td:first-child { width: 4.5em; }
.bmr-list td.num { white-space: nowrap; }
.bmr-form .in-text { width: 100%; padding: 6px 8px; border: 1px solid #C4CCC8; border-radius: 5px; font: inherit; font-size: 14px; }
.bmr-form .in-date { padding: 5px 6px; border: 1px solid #C4CCC8; border-radius: 5px; font: inherit; font-size: 13.5px; }
.bmr-form .field .in-num, .bmr-form .field .in-date { width: 100%; }
.bmr-form select { padding: 5px 6px; border: 1px solid #C4CCC8; border-radius: 5px; font: inherit; font-size: 13.5px; background: var(--sheet); max-width: 100%; }
.bmr-grid td, .bmr-checks td, .bmr-rows td { vertical-align: middle; }
.bmr-grid .in-num { width: 6.5em; }
.bmr-grid .in-text { min-width: 9em; }
.bmr-rows .in-num { width: 5.5em; }
.bmr-checks td:first-child { white-space: normal; min-width: 280px; }
.bmr-readings { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 6px; font-size: 13px; color: var(--ink-2); }
.bmr-readings .in-num { width: 5em; }
.bmr-sub { font-size: 14px; margin: 14px 0 6px; }
.bmr-outcome { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; margin-top: 12px; }
.bmr-outcome .field { margin: 0; min-width: 260px; }
.bmr-signs { display: flex; flex-wrap: wrap; gap: 12px 28px; margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--rule); }
.bmr-sign { display: flex; align-items: center; gap: 10px; font-size: 13.5px; }
.bmr-sign > span:first-child { color: var(--ink-2); }

/* The client's BMR printed like its master copies (BMR_Biochemistry.pdf / BMR_Hematology.pdf): plain bordered tables, Calibri */
.vd-page { font-family: Calibri, Carlito, 'Segoe UI', Arial, sans-serif; color: #000; font-size: 12.5px; display: flex; flex-direction: column; }
.vd-page + .vd-page { margin-top: 18px; }
.vd-head { margin-bottom: 14px; }
.vd-co { text-align: center; margin-bottom: 4px; }
.vd-co b { display: block; font-size: 22px; font-weight: 400; letter-spacing: .02em; line-height: 1.15; }
.vd-co span { display: block; font-size: 10.5px; }
.vd-co i { display: block; font-style: normal; font-family: 'Times New Roman', Times, serif; font-weight: 700; font-size: 14px; margin-top: 1px; }
.vd-ctl { display: grid; grid-template-columns: 1.3fr 1fr; gap: 0 22px; align-items: start; }
.vd-ctl .vd-tbl th { width: 34%; font-weight: 400; }
.vd-ctl .vd-tbl td { color: #374151; }
.vd-tbl { width: 100%; border-collapse: collapse; margin-bottom: 12px; }
.vd-tbl th, .vd-tbl td { border: 1px solid #000; padding: 3px 6px; text-align: left; vertical-align: top; font-size: 12px; line-height: 1.3; }
.vd-tbl th { font-weight: 700; background: none; }
.vd-tbl .vd-cols th { text-align: center; }
.vd-tbl th.vd-left { text-align: left; }
.vd-tbl th.vd-c { text-align: center; }
.vd-tbl td.num { text-align: right; }
.vd-tbl small { font-size: 10px; color: #374151; }
.vd-tbl td:empty::after { content: '\00a0'; }
.vd-tbl.vd-packs { table-layout: fixed; }
.vd-packs col.vd-lab { width: 34%; }
.vd-req td, .vd-req th, .vd-labels td, .vd-ipqc td { height: 21px; }
.vd-clear td, .vd-clear th { font-family: Arial, Helvetica, sans-serif; font-size: 11.5px; }
.vd-clear td:nth-child(n+2) { width: 14%; }
.vd-title { font-family: 'Times New Roman', Times, serif; font-size: 16px; text-align: center; text-decoration: underline; margin: 2px 0 12px; font-weight: 700; }
.vd-lines { border-collapse: collapse; margin: 0 0 10px 18px; font-family: 'Times New Roman', Times, serif; font-size: 13px; }
.vd-lines th { font-weight: 400; text-align: left; padding: 1px 6px 1px 0; white-space: nowrap; }
.vd-lines td { padding: 1px 28px 1px 0; min-width: 190px; }
.vd-cap { font-weight: 700; margin: 10px 0 4px; }
.vd-cap.vd-u { text-decoration: underline; font-weight: 400; }
.vd-cap.vd-box { border: 1px solid #000; text-align: center; padding: 2px; }
.vd-proc { margin: 0 0 10px 20px; padding: 0; }
.vd-proc li { margin: 1px 0; }
.vd-fl { margin: 6px 0; font-family: Arial, Helvetica, sans-serif; font-size: 12px; }
.vd-remark { margin: 10px 0; }
.vd-signs { display: flex; justify-content: space-between; gap: 30px; margin: 22px 0 6px; }
.vd-signs span { min-width: 40%; }
.vd-issued { margin-top: auto; padding-top: 16px; font-size: 11.5px; }
.vd-issued span { color: #4B5563; margin-left: 6px; }
.vd-issued .vd-blank { display: inline-block; min-width: 14em; margin: 0 16px 0 6px; border-bottom: 1px solid #111827; vertical-align: -2px; }
@media print {
  .vd-page { break-after: page; min-height: 0; }
  .vd-page:last-child { break-after: auto; }
  .vd-page + .vd-page { margin-top: 0; }
}

.vd-fl u { display: inline-block; min-width: 150px; text-decoration: none; border-bottom: 1px solid #000; }

.bmr-form [data-auto] { color: var(--ink-3); font-style: italic; }
.bmr-auto-note { margin-top: 0; }
