/* Laboratory and quality (/lab). Uses the app.css tokens (--ok, --warn, --bad, --info and their
   -bg partners switch for light and dark), so no colours of its own need a dark variant. */

.lab-crumbs { font-size: 14px; color: var(--muted); display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.lab-crumbs a { text-decoration: none; font-weight: 600; }
.lab-h1-code { font-family: var(--mono); letter-spacing: .01em; }
.page-head h1 .lab-h1-code + .pill { vertical-align: middle; font-size: 13px; }
.lab-sub { margin: 18px 0 8px; font-size: 15px; }
.lab-kpis { margin-bottom: 16px; }

/* Tone edge on cards and tiles: colour plus words, never colour alone */
.lab-tone-ok { --lab-edge: var(--ok); }
.lab-tone-warn { --lab-edge: var(--warn); }
.lab-tone-bad { --lab-edge: var(--bad); }
.lab-tone-info { --lab-edge: var(--info); }
.lab-tone-muted { --lab-edge: var(--line-strong); }

/* Queue board */
.lab-queue { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; }
.lab-card { display: flex; flex-direction: column; gap: 8px; padding: 14px; border-radius: var(--radius); background: var(--sunk); box-shadow: inset 4px 0 0 var(--lab-edge, var(--line-strong)); min-width: 0; }
.lab-card-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.lab-card-kind { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; color: var(--muted); }
.lab-card-kind .icon { width: 16px; height: 16px; }
.lab-card-code { font-family: var(--mono); font-size: 22px; font-weight: 700; letter-spacing: .02em; color: var(--ink); text-decoration: none; margin: 0; }
a.lab-card-code:hover { text-decoration: underline; }
.lab-card p { margin: 0; }
.lab-card-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.lab-card-next { color: var(--muted); }
.lab-identity { display: inline-flex; align-items: center; gap: 6px; color: var(--info); font-weight: 600; }
.lab-identity .icon { width: 14px; height: 14px; }
.lab-truck-found { box-shadow: inset 4px 0 0 var(--lab-edge, var(--line-strong)); display: flex; flex-direction: column; gap: 8px; }

.lab-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.lab-list li { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.lab-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--line-strong); flex: none; }
.lab-dot-ok { background: var(--ok); }
.lab-dot-warn { background: var(--warn); }
.lab-dot-bad { background: var(--bad); }

.lab-ins-list { display: flex; flex-direction: column; gap: 10px; }
.lab-ins { display: flex; flex-direction: column; gap: 2px; padding: 8px 10px; border-radius: 12px; text-decoration: none; color: inherit; box-shadow: inset 3px 0 0 var(--lab-edge, var(--line-strong)); background: var(--sunk); }
.lab-ins:hover { background: var(--sunk-2, var(--sunk)); }
.lab-ins-name { font-size: 14px; font-weight: 600; }
.lab-ins-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.lab-ins-tile { display: flex; flex-direction: column; gap: 4px; padding: 12px; border-radius: var(--radius); text-decoration: none; color: inherit; background: var(--sunk); box-shadow: inset 4px 0 0 var(--lab-edge, var(--line-strong)); }
.lab-ins-tile.is-on { box-shadow: inset 4px 0 0 var(--lab-edge, var(--line-strong)), inset 0 0 0 2px var(--line-strong); }
.lab-plate { display: grid; grid-template-columns: 112px minmax(0, 1fr); gap: 12px; align-items: center; margin-bottom: 8px; }
.lab-plate-qr .lab-qr, .lab-label-qr .lab-qr { width: 112px; height: 112px; display: block; }

/* Result band: zones under the value, limit ticks, a mark at the value */
.lab-bands { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px 18px; }
.lab-band { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.lab-band-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.lab-band-label { font-size: 14px; font-weight: 600; }
.lab-band-value strong { font-size: 22px; font-variant-numeric: tabular-nums; }
.lab-band-value small { font-size: 13px; color: var(--muted); margin-left: 2px; }
.lab-band-svg { display: block; overflow: visible; }
.lab-band-track { fill: var(--sunk-2, rgba(128, 128, 128, .15)); }
.lab-band-track.has-limit { fill: var(--ok-bg); }
.lab-zone-warn { fill: var(--warn-bg); }
.lab-zone-bad { fill: var(--bad-bg); }
.lab-band-fill { fill: var(--info); }
.lab-state-ok .lab-band-fill { fill: var(--ok); }
.lab-state-warn .lab-band-fill { fill: var(--warn); }
.lab-state-bad .lab-band-fill { fill: var(--bad); }
.lab-band-limit { stroke: var(--muted); stroke-width: 1.5; stroke-dasharray: 2 2; }
.lab-band-mark { stroke: var(--ink); stroke-width: 2.5; }
.lab-band-foot { margin: 0; font-size: 12px; color: var(--muted); }
.lab-state-warn .lab-band-value strong { color: var(--warn); }
.lab-state-bad .lab-band-value strong { color: var(--bad); }
.lab-band.is-empty .lab-band-value strong { color: var(--muted); }

/* Sample page */
.lab-layout { display: grid; grid-template-columns: minmax(0, 2fr) minmax(260px, 1fr); gap: 16px; align-items: start; }
.lab-code-box .barcode { max-width: 100%; height: auto; }
.lab-hidden { display: flex; gap: 8px; align-items: flex-start; color: var(--muted); }
.lab-hidden .icon { width: 18px; height: 18px; flex: none; }
.lab-new-label { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.lab-new-label p { margin: 0; flex: 1 1 220px; }
.lab-new-label-code .barcode { max-width: 260px; height: auto; background: #FFFFFF; padding: 4px; border-radius: 6px; }
.lab-truck-go p { display: flex; align-items: center; gap: 8px; margin: 0 0 8px; font-weight: 600; }
form[data-lab-decide] fieldset { border: 0; padding: 0; margin: 0 0 12px; min-width: 0; }
.lab-decisions { display: flex; flex-wrap: wrap; gap: 8px; }
.lab-decision { display: inline-flex; align-items: center; gap: 8px; padding: 10px 14px; border-radius: 12px; background: var(--sunk); cursor: pointer; font-weight: 600; box-shadow: inset 0 0 0 1.5px var(--line); }
.lab-decision:has(input:checked) { box-shadow: inset 0 0 0 2px var(--ink); }
.lab-decision-ok { color: var(--ok); }
.lab-decision-warn { color: var(--warn); }
.lab-decision-bad { color: var(--bad); }
.lab-decision-info { color: var(--info); }
.lab-timeline { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.lab-timeline li { display: flex; flex-direction: column; gap: 2px; padding: 8px 12px; border-radius: 12px; background: var(--sunk); box-shadow: inset 3px 0 0 var(--lab-edge, var(--line-strong)); }

/* New sample */
.lab-kinds { border: 0; padding: 0; margin: 0 0 12px; }
.lab-kind-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 8px; }
.lab-kind-choice { display: block; cursor: pointer; }
.lab-kind-choice input { position: absolute; opacity: 0; pointer-events: none; }
.lab-kind-choice span { display: flex; align-items: center; gap: 8px; padding: 12px; border-radius: 12px; background: var(--sunk); font-weight: 600; box-shadow: inset 0 0 0 1.5px var(--line); }
.lab-kind-choice span .icon { width: 20px; height: 20px; }
.lab-kind-choice input:checked + span { box-shadow: inset 0 0 0 2px var(--accent); color: var(--accent-ink); background: var(--ok-bg); }
.lab-kind-choice input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Result entry: big numbers for a tablet on the lab bench */
.lab-entry-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.lab-big-input { font-size: 26px !important; font-variant-numeric: tabular-nums; padding: 10px 12px !important; min-height: 56px; }
.lab-live:empty { display: none; }
.lab-live { font-weight: 600; }
.lab-live.is-ok { color: var(--ok); }
.lab-live.is-warn { color: var(--warn); }
.lab-live.is-bad { color: var(--bad); }
.lab-hint-bad { color: var(--bad); }

/* Holds */
.lab-holds { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; }
.lab-hold { box-shadow: inset 4px 0 0 var(--lab-edge, var(--line-strong)); }
.lab-places { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0; }

/* Sample-bag labels */
.lab-labels { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 12px; }
.lab-label { display: grid; grid-template-columns: 112px minmax(0, 1fr); gap: 6px 12px; padding: 12px; border: 1.5px dashed var(--line-strong); border-radius: 12px; background: #FFFFFF; color: #111111; break-inside: avoid; page-break-inside: avoid; }
.lab-label-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.lab-label-mill { font-size: 12px; font-weight: 600; color: #444444; }
.lab-label-code { font-family: var(--mono); font-size: 24px; letter-spacing: .02em; }
.lab-label-line { font-size: 14px; line-height: 1.3; }
.lab-label-bar { width: 100%; max-width: 240px; height: auto; margin-top: 4px; }

@media (max-width: 900px) {
  .lab-layout { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .lab-queue, .lab-labels, .lab-holds { grid-template-columns: 1fr; }
  .lab-bands { grid-template-columns: 1fr; }
  .lab-kind-grid { grid-template-columns: 1fr 1fr; }
  .lab-entry-grid { grid-template-columns: 1fr 1fr; }
  .lab-big-input { font-size: 22px !important; }
  .lab-plate { grid-template-columns: 84px minmax(0, 1fr); }
  .lab-plate-qr .lab-qr { width: 84px; height: 84px; }
}
@media print {
  .lab-labels { grid-template-columns: 1fr 1fr; gap: 6mm; }
  .lab-label { border-color: #000000; }
  .lab-card, .lab-ins-tile, .lab-timeline li { background: #FFFFFF; }
  .lab-card-actions, .lab-decisions, form[action="/lab/decide"], form[action="/lab/truck/release"] { display: none; }
}
