/* Trusted Trade Gateway · live stage. World: cold-store pallet label on a concrete floor. */

@font-face { font-family: 'TTG Archivo SC'; src: url('assets/fonts/archivo-sc-500.woff') format('woff'); font-weight: 500; font-display: swap; }
@font-face { font-family: 'TTG Archivo SC'; src: url('assets/fonts/archivo-sc-700.woff') format('woff'); font-weight: 700; font-display: swap; }
@font-face { font-family: 'TTG Archivo SC'; src: url('assets/fonts/archivo-sc-900.woff') format('woff'); font-weight: 900; font-display: swap; }
@font-face { font-family: 'TTG Archivo'; src: url('assets/fonts/archivo-400.woff') format('woff'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'TTG Archivo'; src: url('assets/fonts/archivo-600.woff') format('woff'); font-weight: 600; font-display: swap; }

:root {
  --floor: #D9DBD7;
  --floor-2: #CDD0CB;
  --stock: #FFFFFF;
  --ink: #141414;
  --ink-2: #464945;
  --ink-3: #676A65;
  --blank: #E6E7E4;
  --rule-soft: #B4B7B2;
  --tape: #F5C400;
  --shell: #1E5AA8;
  --shell-ink-2: #DCE6F4;
  --hold: #D42A1F;
  --hold-tint: #FCEDEC;
  --act: #0E7C3A;
  --act-press: #0A6630;
  --hair: 1px;
  --shell-h: 56px;
  --roll-h: 192px;
  --f-label: 'TTG Archivo SC', 'Arial Narrow', sans-serif;
  --f-text: 'TTG Archivo', system-ui, sans-serif;
  --f-mono: 'IBM Plex Mono', ui-monospace, 'SF Mono', Menlo, monospace;
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);
  --ease-drawer: cubic-bezier(0.32, 0.72, 0, 1);
  --lift: 0 1px 1px rgba(20, 20, 20, 0.12), 0 8px 18px -10px rgba(20, 20, 20, 0.5);
  --lift-high: 0 2px 2px rgba(20, 20, 20, 0.14), 0 20px 34px -14px rgba(20, 20, 20, 0.6);
  --hatch: repeating-linear-gradient(-45deg, var(--ink) 0 5px, var(--tape) 5px 10px);
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--floor);
  color: var(--ink);
  font: 400 14px/1.4 var(--f-text);
  font-variant-numeric: tabular-nums;
  caret-color: var(--ink);
  -webkit-font-smoothing: antialiased;
  height: 100dvh;
  overflow: hidden;
}
::selection { background: var(--tape); color: var(--ink); }
h1, h2, h3, p, ol, ul, dl, dd { margin: 0; }
ol, ul { padding: 0; list-style: none; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
code, .mono { font-family: var(--f-mono); font-size: 0.92em; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
* { scrollbar-width: thin; scrollbar-color: var(--rule-soft) transparent; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: var(--rule-soft); border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-track { background: transparent; }

/* ------------------------------------------------------------------ shell bar */
.shell {
  height: var(--shell-h);
  background: var(--shell);
  color: #fff;
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr);
  align-items: center;
  gap: 24px;
  padding: 0 16px 0 14px;
  position: relative;
  z-index: 10;
}
.shell :focus-visible { outline-color: #fff; }
.shell-id { display: flex; align-items: center; gap: 10px; min-width: 0; }
.mark { width: 30px; height: 30px; flex: none; }
.shell-name { display: flex; flex-direction: column; line-height: 1.1; min-width: 0; }
.shell-name strong { font: 900 19px/1 var(--f-label); letter-spacing: 0.005em; text-transform: uppercase; white-space: nowrap; }
.shell-name span { font: 500 12px/1.3 var(--f-label); color: var(--shell-ink-2); letter-spacing: 0.02em; white-space: nowrap; }

.shell-status { display: flex; align-items: center; gap: 8px; font: 700 13px/1 var(--f-label); text-transform: uppercase; letter-spacing: 0.05em; white-space: nowrap; padding: 6px 2px; }
.shell-status .dot { width: 9px; height: 9px; border-radius: 50%; background: transparent; box-shadow: inset 0 0 0 1.5px #fff; flex: none; }
.shell-status[data-kind='live'] .dot { background: var(--tape); box-shadow: 0 0 0 0 rgba(245, 196, 0, 0.55); animation: live 2.4s var(--ease-out) infinite; }
.shell-status[data-kind='reconnecting'] .dot, .shell-status[data-kind='closed'] .dot { background: var(--hold); box-shadow: none; }
.shell-status[data-kind^='playback'] { background: var(--stock); color: var(--ink); padding: 6px 6px 6px 10px; gap: 10px; }
.shell-status[data-kind^='playback'] .dot { border-radius: 0; width: 8px; height: 8px; background: var(--ink); box-shadow: none; }
@keyframes live { 70% { box-shadow: 0 0 0 7px rgba(245, 196, 0, 0); } 100% { box-shadow: 0 0 0 0 rgba(245, 196, 0, 0); } }

.btn-ghost {
  display: inline-flex; align-items: center; gap: 5px;
  height: 26px; padding: 0 8px;
  background: transparent; border: var(--hair) solid currentColor;
  font: 700 11.5px/1 var(--f-label); letter-spacing: 0.06em; text-transform: uppercase;
  transition: background-color 150ms ease, transform 120ms var(--ease-out);
}
.btn-ghost svg { width: 13px; height: 13px; }
.btn-ghost:active { transform: scale(0.97); }

.shell-run { display: flex; align-items: center; justify-content: flex-end; gap: 6px; min-width: 0; }
.shell-run select, .shell-run input {
  height: 34px; border: 0; border-radius: 0; background: var(--stock); color: var(--ink);
  padding: 0 10px; font: 400 14px/1 var(--f-text);
}
.shell-run select {
  font: 700 12.5px/1 var(--f-label); text-transform: uppercase; letter-spacing: 0.04em;
  padding-right: 26px; appearance: none; cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--ink) 50%), linear-gradient(135deg, var(--ink) 50%, transparent 50%);
  background-position: calc(100% - 14px) 15px, calc(100% - 9px) 15px;
  background-size: 5px 5px; background-repeat: no-repeat;
}
.shell-run input { width: min(430px, 100%); min-width: 0; flex: 0 1 430px; }
.shell-run input::placeholder { color: var(--ink-3); }
.shell-run :focus-visible { outline: 2px solid var(--tape); outline-offset: 1px; }
.btn-run {
  height: 34px; padding: 0 18px; border: 0; background: var(--ink); color: #fff;
  font: 900 14px/1 var(--f-label); letter-spacing: 0.08em; text-transform: uppercase;
  transition: transform 120ms var(--ease-out), background-color 150ms ease;
  position: relative;
}
.btn-run:active { transform: scale(0.97); }
.btn-run[data-busy] { color: transparent; }
.btn-run[data-busy]::after { content: 'Sending'; position: absolute; inset: 0; display: grid; place-items: center; color: #fff; }
@media (hover: hover) and (pointer: fine) {
  .btn-run:hover { background: #2B2B2B; }
  .btn-ghost:hover { background: rgba(20, 20, 20, 0.06); }
}

/* ------------------------------------------------------------------ notice */
.notice {
  position: fixed; top: calc(var(--shell-h) + 12px); left: 50%; transform: translateX(-50%);
  width: min(660px, calc(100vw - 32px)); z-index: 30;
  background: var(--stock); color: var(--ink); box-shadow: var(--lift-high);
  display: flex; gap: 12px; align-items: flex-start; padding: 14px 10px 12px 14px;
  font: 400 13.5px/1.45 var(--f-text);
  animation: notice-in 240ms var(--ease-out);
}
.notice::before { content: ''; position: absolute; left: 0; right: 0; top: 0; height: 4px; background: var(--hatch); }
.notice p { flex: 1; text-wrap: pretty; }
@keyframes notice-in { from { opacity: 0; transform: translate(-50%, -8px); } }
.btn-icon { width: 28px; height: 28px; flex: none; display: grid; place-items: center; border: 0; background: transparent; color: inherit; transition: transform 120ms var(--ease-out); }
.btn-icon svg { width: 14px; height: 14px; }
.btn-icon:active { transform: scale(0.94); }

/* ------------------------------------------------------------------ stage layout */
.stage {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr) var(--roll-h);
  height: calc(100dvh - var(--shell-h));
}
.floor { grid-row: 1; grid-column: 1; position: relative; overflow: hidden; background: var(--floor); touch-action: none; }
.floor-under, .floor-over { position: absolute; inset: 0; display: block; pointer-events: none; }
.floor-over { z-index: 3; }
.labels { position: absolute; inset: 0; z-index: 2; pointer-events: none; }
.floor.is-dragging, .floor.is-dragging .lbl { cursor: grabbing; }

/* ------------------------------------------------------------------ thermal labels */
.lbl {
  position: absolute; left: 0; top: 0;
  background: var(--stock); color: var(--ink);
  box-shadow: var(--lift);
  pointer-events: auto; cursor: grab; user-select: none; -webkit-user-select: none;
  transition: box-shadow 220ms var(--ease-out);
  will-change: transform;
}
.lbl:focus-visible { outline: 2px solid var(--shell); outline-offset: 3px; }
.lbl--hub { width: 206px; }
.lbl--quote { width: 210px; }
.lbl--order { width: 206px; }
.lbl--order[data-size='0'] { width: 190px; }
.lbl--order[data-size='1'] { width: 198px; }
.lbl--order[data-size='2'] { width: 206px; }
.lbl--order[data-size='3'] { width: 220px; }
.lbl--order[data-size='4'] { width: 240px; }
.lbl.is-here { box-shadow: var(--lift-high); }

/* head: checkpoint number first (every checkpoint), name, then the named standard in the second slot */
.lbl-head {
  position: relative;
  display: flex; align-items: baseline; gap: 7px;
  background: var(--ink); color: #fff; padding: 5px 8px 5px 5px;
}
.lbl-no {
  flex: none; padding: 2px 3px 1px; font: 600 12px/1 var(--f-mono); color: #fff;
  box-shadow: inset 0 0 0 var(--hair) rgba(255, 255, 255, 0.55);
  transition: background-color 200ms ease, color 200ms ease, box-shadow 200ms ease;
}
.lbl-name { flex: 1 1 auto; min-width: 0; font: 700 12.5px/1.1 var(--f-label); text-transform: uppercase; letter-spacing: 0.035em; text-wrap: balance; }
.lbl-std { flex: none; margin-left: auto; font: 400 11px/1 var(--f-mono); color: rgba(255, 255, 255, 0.82); white-space: nowrap; }
.lbl.is-here .lbl-no { background: var(--tape); color: var(--ink); box-shadow: none; }
.lbl.is-here .lbl-head::after { content: ''; position: absolute; left: 0; right: 0; bottom: -5px; height: 5px; background: var(--hatch); }

.lbl-print { position: relative; }
.lp-main { padding: 9px 9px 7px; }
.lp-big { font: 700 18px/1.12 var(--f-label); letter-spacing: -0.005em; overflow-wrap: anywhere; }
.lp-big .mono { font: 600 14.5px/1.2 var(--f-mono); letter-spacing: 0; }
.lp-big .code { font: 900 21px/1 var(--f-label); letter-spacing: 0.02em; margin-right: 2px; }
.lp-sub {
  margin-top: 3px; font: 400 12.5px/1.32 var(--f-text); color: var(--ink-2);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  overflow-wrap: anywhere;
}
.lp-sub .mono { font-size: 12px; color: var(--ink); }
.lp-row { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); }
.fd { padding: 4px 8px 6px 9px; min-width: 0; }
/* GS1 fields: captions and values wrap at word boundaries, never truncate */
.fd-cap { display: block; font: 500 11px/1.2 var(--f-label); text-transform: uppercase; letter-spacing: 0.05em; color: var(--ink-3); }
.fd-v { display: block; margin-top: 1px; font: 400 12.5px/1.3 var(--f-mono); letter-spacing: -0.015em; overflow-wrap: break-word; }
.fd-v i { font-style: normal; color: var(--ink-3); }

/* order title with its printed release box (HOLD tag hangs here, the Peppol stamp lands here) */
.lp-main--release { display: grid; grid-template-columns: minmax(0, 1fr) 76px; padding: 0; }
.lp-title { padding: 8px 6px 8px 9px; min-width: 0; }
.lp-main--release .lp-big { line-height: 1; }
.lp-main--release .lp-big .code { font-size: 25px; margin-right: 6px; vertical-align: -1px; }
.lp-main--release .lp-big .sim { margin-left: 0; vertical-align: 3px; }
.lp-main--release .lp-big .state { display: block; margin-top: 4px; font: 700 16px/1.1 var(--f-label); }
.lp-main--release .lp-sub { margin-top: 4px; display: block; overflow: visible; }
.lp-release { position: relative; padding: 4px 6px; min-height: 76px; }
.lp-release > .fd-cap { position: absolute; left: 7px; bottom: 5px; font-size: 11px; color: var(--ink-3); }
.lp-release:has(.hold, .stamp) > .fd-cap { visibility: hidden; }
.ph { display: inline-block; vertical-align: middle; width: 72%; height: 0.62em; background: var(--blank); }
.ph--big { width: 64%; height: 15px; }
.ph--sub { width: 86%; height: 8px; }

.sim {
  display: inline-block; vertical-align: 1px; margin-left: 4px;
  font: 700 11px/1 var(--f-label); text-transform: uppercase; letter-spacing: 0.05em;
  padding: 2px 4px 2px; color: var(--ink); box-shadow: inset 0 0 0 var(--hair) var(--ink);
}

.lbl-scan { position: absolute; left: 0; right: 0; top: 0; height: 2px; background: var(--ink); opacity: 0; pointer-events: none; }
.lbl-scan::before { content: ''; position: absolute; left: 0; right: 0; bottom: 2px; height: 18px; background: linear-gradient(to bottom, rgba(20, 20, 20, 0), rgba(20, 20, 20, 0.09)); }
.lbl-fx { position: absolute; inset: 0; pointer-events: none; }

/* refusal band printed under the head */
.lbl-alert { background: var(--hold); color: #fff; padding: 5px 9px 6px; transform-origin: 50% 0; transition: background-color 300ms ease, color 300ms ease; }
.lbl-alert b { display: block; font: 900 13.5px/1.1 var(--f-label); text-transform: uppercase; letter-spacing: 0.06em; }
.lbl-alert small { display: block; margin-top: 2px; font: 500 12px/1.25 var(--f-text); }
.lbl-alert.is-spent { background: var(--hold-tint); color: #9E1E16; }

/* HOLD tag: hangs from the head's lower edge into the release box while a human must sign; torn off on approval */
.hold { position: absolute; top: -6px; left: 4px; right: 4px; transform: rotate(-4deg); transform-origin: 50% 0; filter: drop-shadow(0 4px 5px rgba(20, 20, 20, 0.3)); }
.hold-stub {
  display: block; height: 12px; background: var(--hold); position: relative;
  clip-path: polygon(16% 0, 84% 0, 100% 70%, 100% 100%, 0 100%, 0 70%);
}
.hold-stub::before { content: ''; position: absolute; left: 50%; top: 3px; width: 6px; height: 6px; margin-left: -3px; border-radius: 50%; background: var(--ink); }
.hold-body {
  display: block; background: var(--hold); color: #fff; text-align: center;
  padding: 3px 2px 5px; border-top: 1px dashed rgba(255, 255, 255, 0.75);
}
.hold-body b { display: block; font: 900 19px/1 var(--f-label); letter-spacing: 0.06em; }
.hold-body small { display: block; margin-top: 2px; font: 700 11px/1.05 var(--f-label); text-transform: uppercase; letter-spacing: 0.02em; text-wrap: balance; }

/* ink stamps: Peppol AP/CA (blue ink), RE and refusals (red ink), landing in the release box */
.stamp {
  position: absolute; inset: 0; margin: auto; width: fit-content; height: fit-content;
  padding: 3px 5px 4px; text-align: center;
  color: var(--shell); box-shadow: inset 0 0 0 3px currentColor;
  transform: rotate(-7deg); mix-blend-mode: multiply; opacity: 0.94;
  transition: opacity 300ms ease;
}
.stamp b { display: block; font: 900 27px/1 var(--f-label); letter-spacing: 0.04em; }
.stamp small { display: block; font: 700 11px/1.05 var(--f-label); text-transform: uppercase; letter-spacing: 0.02em; }
.stamp--red { color: var(--hold); }
.stamp.is-spent { opacity: 0.22; }

/* satellites */
.lbl--opt { width: 88px; }
.lbl--opt[data-size='0'] { width: 72px; }
.lbl--opt[data-size='1'] { width: 80px; }
.lbl--opt[data-size='2'] { width: 88px; }
.lbl--opt[data-size='3'] { width: 98px; }
.lbl--opt[data-size='4'] { width: 112px; }
.opt-top { display: flex; align-items: center; gap: 5px; padding: 3px 5px 3px 3px; }
.opt-rank { display: inline-grid; place-items: center; min-width: 16px; height: 16px; background: var(--ink); color: #fff; font: 600 11.5px/1 var(--f-mono); }
.opt-pid { font: 400 12px/1 var(--f-mono); color: var(--ink-2); }
.opt-total { padding: 3px 6px 5px; font: 700 14px/1.1 var(--f-label); white-space: nowrap; }
.lbl--opt.is-chosen .opt-top { background: var(--ink); }
.lbl--opt.is-chosen .opt-rank { background: var(--tape); color: var(--ink); }
.lbl--opt.is-chosen .opt-pid { color: #fff; }

.lbl--reason { width: 140px; }
.rs-band { background: var(--hold); color: #fff; padding: 3px 7px; font: 700 11px/1.1 var(--f-label); text-transform: uppercase; letter-spacing: 0.07em; }
.rs-code { padding: 5px 7px 3px; font: 700 14px/1.15 var(--f-label); }
.rs-n { padding: 3px 7px 5px; font: 400 12px/1.2 var(--f-mono); color: var(--ink-2); }
.rs-n b { font: 600 13px/1 var(--f-mono); color: var(--ink); }

/* mandate rules: one printed cell per rule, docked on the policy label */
.rules { display: block; margin-top: 4px; }
.rstrip { position: relative; display: grid; grid-template-columns: repeat(var(--n), minmax(0, 1fr)); gap: 2px; }
.rc { display: block; height: 12px; background: var(--stock); box-shadow: inset 0 0 0 var(--hair) var(--ink); transition: background-color 120ms ease; }
.rc[data-result='blank'] { background: var(--blank); box-shadow: none; }
.rc[data-result='info'] { background: #C9CCC7; }
.rc[data-result='approval'] { background: var(--tape); box-shadow: inset 0 0 0 var(--hair) var(--ink); }
.rc[data-result='reject'] { background: var(--hold); box-shadow: none; }
.rl {
  position: absolute; top: 100%; height: 7px; width: 1px;
  left: calc((100% - (var(--n) - 1) * 2px) / var(--n) * (var(--i) + 0.5) + var(--i) * 2px);
  background: var(--ink); transform-origin: 50% 0;
}
.rdec { display: grid; gap: 3px; margin-top: 7px; }
.rdec-g { display: block; box-shadow: inset 0 0 0 var(--hair) var(--ink); }
.rdec-g b { display: block; padding: 3px 6px 2px; font: 700 11px/1.15 var(--f-label); text-transform: uppercase; letter-spacing: 0.06em; background: var(--tape); }
.rdec-g[data-result='reject'] b { background: var(--hold); color: #fff; }
.rdec-g code { display: block; padding: 3px 6px 4px; font: 600 12.5px/1.2 var(--f-mono); letter-spacing: -0.015em; overflow-wrap: anywhere; }
.rnone { display: block; margin-top: 5px; font: 400 12.5px/1.3 var(--f-text); color: var(--ink-2); }
.rules.is-blank .rl, .rules.is-blank .rdec, .rules.is-blank .rnone { visibility: hidden; }

.lbl--filed .lbl-head { background: var(--ink-2); }
/* filed orders use the same value ramp as the live order label, so sizes compare */
.lbl--filed { width: 206px; }
.lbl--filed[data-size='0'] { width: 190px; }
.lbl--filed[data-size='1'] { width: 198px; }
.lbl--filed[data-size='2'] { width: 206px; }
.lbl--filed[data-size='3'] { width: 220px; }
.lbl--filed[data-size='4'] { width: 240px; }
.lbl--filed .lp-big { font-size: 16px; }

/* floor key: one stencilled strip along the bottom edge of the floor; labels never settle on it */
.floor-key {
  position: absolute; left: 16px; bottom: 10px; z-index: 1;
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px 20px;
  font: 500 11.5px/1.3 var(--f-label); color: var(--ink-2);
  letter-spacing: 0.02em; pointer-events: none; max-width: calc(100% - 32px);
}
.key-tape { display: flex; align-items: center; gap: 8px; }
.key-tape i { width: 30px; height: 9px; background: var(--hatch); flex: none; }
.key-tape svg { width: 30px; height: 9px; flex: none; }
.key-ramp { display: flex; align-items: center; gap: 9px; }
.key-ramp ol { display: flex; align-items: center; gap: 8px; }
.key-ramp li { display: flex; align-items: center; gap: 4px; font: 400 11.5px/1.3 var(--f-mono); }
.key-ramp li i { display: block; background: var(--stock); box-shadow: inset 0 0 0 var(--hair) var(--ink); height: 7px; }
.key-ramp li:nth-child(1) i { width: 10px; }
.key-ramp li:nth-child(2) i { width: 13px; }
.key-ramp li:nth-child(3) i { width: 16px; }
.key-ramp li:nth-child(4) i { width: 20px; }
.key-ramp li:nth-child(5) i { width: 24px; }
.key-hint { color: var(--ink-2); }
.tip {
  position: absolute; left: 0; top: 0; z-index: 8; max-width: 320px;
  background: var(--ink); color: #fff; padding: 6px 9px 7px;
  font: 400 12px/1.35 var(--f-text); pointer-events: none; text-wrap: pretty;
}

/* inspector */
.inspector {
  position: absolute; left: 16px; top: 16px; z-index: 7;
  width: min(380px, calc(100% - 32px)); max-height: calc(100% - 32px);
  display: flex; flex-direction: column;
  background: var(--stock); box-shadow: var(--lift-high);
  animation: ins-in 220ms var(--ease-out);
}
@keyframes ins-in { from { opacity: 0; transform: translateY(6px); } }
.inspector header { display: flex; align-items: center; justify-content: space-between; background: var(--ink); color: #fff; padding: 4px 4px 4px 12px; }
.inspector h2 { font: 700 13px/1.1 var(--f-label); text-transform: uppercase; letter-spacing: 0.06em; }
.inspector :focus-visible { outline-color: var(--tape); }
.ins-body { overflow: auto; padding: 12px 14px 16px; font: 400 13px/1.45 var(--f-text); display: grid; gap: 10px; }
.ins-body h3 { font: 700 11px/1.2 var(--f-label); text-transform: uppercase; letter-spacing: 0.07em; color: var(--ink-3); margin-top: 6px; }
.ins-body p { text-wrap: pretty; }
.ins-kv { display: grid; gap: 0; }
.ins-kv div { display: grid; grid-template-columns: 120px minmax(0, 1fr); gap: 10px; padding: 5px 0; border-bottom: var(--hair) solid var(--blank); }
.ins-kv dt { font: 500 11px/1.4 var(--f-label); text-transform: uppercase; letter-spacing: 0.05em; color: var(--ink-3); }
.ins-kv dd { font: 400 12px/1.4 var(--f-mono); overflow-wrap: anywhere; }
.ins-list { display: grid; gap: 6px; }
.ins-list li { padding-bottom: 6px; border-bottom: var(--hair) dashed var(--rule-soft); font-size: 12.5px; }
.ins-list li.is-focus { background: var(--blank); margin: 0 -6px; padding: 4px 6px 6px; }
.ins-note { color: var(--ink-2); font-size: 12px; }
.ins-rules { display: grid; gap: 7px; }
.ins-rules li { display: grid; grid-template-columns: 74px minmax(0, 1fr); gap: 8px; align-items: start; }
.ins-rules code { font-size: 11px; }
.ins-rules p { font-size: 12.5px; }
.res {
  display: inline-block; padding: 3px 5px; text-align: center;
  font: 700 11px/1.1 var(--f-label); text-transform: uppercase; letter-spacing: 0.05em;
  background: var(--stock); box-shadow: inset 0 0 0 var(--hair) var(--ink);
}
[data-result='approval'] > .res { background: var(--tape); box-shadow: none; }
[data-result='reject'] > .res { background: var(--hold); color: #fff; box-shadow: none; }
[data-result='info'] > .res { background: #DADCD8; box-shadow: none; }

/* ------------------------------------------------------------------ approval card */
.approval {
  grid-row: 1; grid-column: 1; align-self: end; justify-self: end;
  width: min(372px, 28vw); max-height: calc(100% - 32px);
  margin: 0 16px 16px 0; z-index: 6;
  display: flex; flex-direction: column; justify-content: flex-end;
  pointer-events: none;
}
.ap-card {
  pointer-events: auto; max-height: 100%; overflow: hidden;
  display: flex; flex-direction: column;
  background: var(--stock); color: var(--ink);
  box-shadow: inset 0 0 0 var(--hair) var(--ink), 0 2px 3px rgba(20, 20, 20, 0.14), 0 30px 50px -22px rgba(20, 20, 20, 0.62);
  transition: transform 460ms var(--ease-drawer), opacity 200ms ease;
}
.approval[data-state='empty'] .ap-card { transform: translateY(calc(100% + 32px)); visibility: hidden; }
.approval[data-state='closing'] .ap-card { transform: translateY(calc(100% + 32px)); transition: transform 300ms var(--ease-in-out); }
.ap-empty { display: none; }

.ap-band { flex: none; display: flex; align-items: center; gap: 10px; background: var(--hold); color: #fff; padding: 9px 12px 9px 10px; }
.ap-hold { font: 900 13px/1 var(--f-label); letter-spacing: 0.1em; background: #fff; color: var(--hold); padding: 4px 6px 3px; }
.ap-band h2 { font: 700 15px/1.1 var(--f-label); text-transform: uppercase; letter-spacing: 0.04em; flex: 1; white-space: nowrap; }
.approval[data-state='done'] .ap-band { background: var(--ink); }
.approval[data-state='done'] .ap-hold { color: var(--ink); }

/* the body scrolls only if the window is too short; then its lower edge fades out on purpose */
.ap-body { flex: 1 1 auto; min-height: 0; overflow: auto; overscroll-behavior: contain; padding: 12px 15px 12px 16px; display: grid; align-content: start; gap: 0; }
.ap-body[data-clip] { -webkit-mask-image: linear-gradient(to bottom, #000 calc(100% - 40px), transparent); mask-image: linear-gradient(to bottom, #000 calc(100% - 40px), transparent); }
.ap-what { font: 700 16.5px/1.2 var(--f-label); text-wrap: pretty; }
.ap-who { margin-top: 4px; font: 400 12.5px/1.4 var(--f-text); color: var(--ink-2); }
.ap-who b { font-weight: 600; color: var(--ink); }
.ap-who i, .ap-refs i { font-style: normal; color: var(--ink-3); }
.ap-h { margin: 12px 0 6px; font: 700 11px/1.2 var(--f-label); text-transform: uppercase; letter-spacing: 0.07em; color: var(--ink-3); }
.ap-why { display: grid; gap: 8px; }
.ap-why li { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 4px 8px; align-items: center; }
.ap-why p { grid-column: 1 / -1; font: 600 14px/1.36 var(--f-text); text-wrap: pretty; }
.ap-why code { font-size: 12px; color: var(--ink-2); overflow-wrap: anywhere; }
.ap-refused {
  margin-top: 10px; display: flex; align-items: baseline; gap: 8px; min-width: 0;
  padding: 5px 8px 6px; background: var(--hold-tint); box-shadow: inset 0 0 0 var(--hair) var(--hold);
  font: 500 12.5px/1.3 var(--f-text); color: #9E1E16;
}
.ap-refused-tag { flex: none; font: 700 11px/1.2 var(--f-label); text-transform: uppercase; letter-spacing: 0.06em; color: #fff; background: var(--hold); padding: 2px 5px 1px; }
.ap-refused-tag .mono { font: 700 11px/1.2 var(--f-label); letter-spacing: 0.06em; }
.ap-refused-text { min-width: 0; }
.ap-grid { margin-top: 10px; display: grid; grid-template-columns: 1fr 1fr; box-shadow: inset 0 0 0 var(--hair) var(--ink); }
.ap-grid div { padding: 7px 10px 8px; box-shadow: inset calc(-1 * var(--hair)) calc(-1 * var(--hair)) 0 var(--ink); }
.ap-grid div:nth-child(2n) { box-shadow: inset 0 calc(-1 * var(--hair)) 0 var(--ink); }
.ap-grid div:nth-child(n + 3) { box-shadow: inset calc(-1 * var(--hair)) 0 0 var(--ink); }
.ap-grid div:nth-child(4) { box-shadow: none; }
.ap-grid dt { font: 500 11px/1.2 var(--f-label); text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-3); }
.ap-grid dd { margin-top: 3px; font: 700 15px/1.2 var(--f-label); }
.ap-grid .ap-num { font: 900 23px/1.05 var(--f-label); letter-spacing: 0.005em; }
.ap-refs { margin-top: 9px; font: 400 12px/1.45 var(--f-text); color: var(--ink-2); overflow-wrap: anywhere; }
.ap-refs .mono { font-size: 11.5px; color: var(--ink); white-space: nowrap; }

/* key and comment print as boxed field rows: caption cell, then the input */
.ap-form { margin-top: 10px; display: grid; gap: 6px; }
.ap-field { display: grid; grid-template-columns: 82px minmax(0, 1fr); align-items: stretch; box-shadow: inset 0 0 0 var(--hair) var(--ink); }
.ap-field label {
  display: flex; align-items: center; padding: 0 8px; box-shadow: inset calc(-1 * var(--hair)) 0 0 var(--ink);
  font: 700 11px/1.15 var(--f-label); text-transform: uppercase; letter-spacing: 0.05em; color: var(--ink-2);
}
.ap-field input {
  min-width: 0; height: 36px; border: 0; border-radius: 0; padding: 0 9px; background: transparent;
  font: 400 13.5px/1 var(--f-text);
}
.ap-field input::placeholder { color: var(--ink-3); }
.ap-field input:focus-visible { outline: 2px solid var(--shell); outline-offset: 0; }

/* the signing stub: a perforated, die-cut tear line above Approve and Reject */
.ap-foot {
  flex: none; position: relative; z-index: 1; display: grid; gap: 6px;
  margin: 0 var(--hair) var(--hair);
  padding: 11px 15px 11px; background: var(--stock);
  border-top: 1px dashed var(--ink);
}
.ap-foot::before, .ap-foot::after {
  content: ''; position: absolute; top: -6px; width: 11px; height: 11px; border-radius: 50%;
  background: var(--floor); box-shadow: inset 0 0 0 var(--hair) var(--ink);
}
.ap-foot::before { left: -7px; }
.ap-foot::after { right: -7px; }
.ap-actions { display: grid; grid-template-columns: 1.55fr 1fr; gap: 8px; }
.btn-approve, .btn-reject {
  position: relative; height: 48px; border: 0; border-radius: 0;
  font: 900 15px/1 var(--f-label); text-transform: uppercase; letter-spacing: 0.06em;
  transition: transform 120ms var(--ease-out), background-color 150ms ease, opacity 150ms ease;
}
.btn-approve { background: var(--act); color: #fff; box-shadow: 0 1px 0 rgba(20, 20, 20, 0.25), 0 6px 14px -8px rgba(14, 124, 58, 0.7); }
.btn-reject { background: var(--stock); color: var(--hold); box-shadow: inset 0 0 0 2px var(--hold); }
.btn-approve:active:not(:disabled), .btn-reject:active:not(:disabled) { transform: scale(0.97); }
.btn-approve:disabled, .btn-reject:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-approve[data-busy], .btn-reject[data-busy] { color: transparent; opacity: 1; }
.btn-approve[data-busy]::after { content: 'Signing'; position: absolute; inset: 0; display: grid; place-items: center; color: #fff; }
.btn-reject[data-busy]::after { content: 'Rejecting'; position: absolute; inset: 0; display: grid; place-items: center; color: var(--hold); }
.btn-approve:focus-visible, .btn-reject:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
@media (hover: hover) and (pointer: fine) {
  .btn-approve:hover:not(:disabled) { background: var(--act-press); }
  .btn-reject:hover:not(:disabled) { background: var(--hold-tint); color: #B3221A; }
}
.ap-error { padding: 8px 10px; background: var(--hold-tint); box-shadow: inset 0 0 0 var(--hair) var(--hold); color: #9E1E16; font: 600 12.5px/1.4 var(--f-text); overflow-wrap: anywhere; }
.ap-status { font: 600 13px/1.35 var(--f-text); }
.ap-status:empty { display: none; }
.ap-note { margin-top: -3px; font: 400 12px/1.4 var(--f-text); color: var(--ink-2); text-wrap: pretty; }

/* ------------------------------------------------------------------ audit roll */
.roll {
  grid-row: 2; grid-column: 1;
  display: grid; grid-template-columns: 276px minmax(0, 1fr);
  background: var(--floor-2); min-height: 0; position: relative; z-index: 4;
  box-shadow: inset 0 var(--hair) 0 rgba(20, 20, 20, 0.35);
}
.roll-head { padding: 14px 16px 12px; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.roll-head h2 { font: 900 15px/1 var(--f-label); text-transform: uppercase; letter-spacing: 0.05em; }
.roll-meta { font: 500 12px/1.3 var(--f-label); color: var(--ink-2); letter-spacing: 0.02em; }
.roll-hash { font: 400 11px/1.3 var(--f-mono); color: var(--ink-2); }
.btn-quiet {
  align-self: flex-start; margin-top: 6px; height: 32px; padding: 0 12px;
  background: var(--stock); border: 0; box-shadow: inset 0 0 0 var(--hair) var(--ink);
  font: 700 12px/1 var(--f-label); text-transform: uppercase; letter-spacing: 0.06em;
  transition: transform 120ms var(--ease-out), background-color 150ms ease;
}
.btn-quiet:active:not(:disabled) { transform: scale(0.97); }
.btn-quiet:disabled { opacity: 0.55; cursor: progress; }
@media (hover: hover) and (pointer: fine) { .btn-quiet:hover:not(:disabled) { background: var(--blank); } }
.roll-verify { font: 500 12px/1.35 var(--f-text); color: var(--ink); text-wrap: pretty; }
.roll-verify[data-tone='ok'] { font-weight: 600; }
.roll-verify[data-tone='ok']::before { content: ''; display: inline-block; width: 8px; height: 8px; margin-right: 6px; background: var(--ink); vertical-align: 1px; }
.roll-verify[data-tone='bad'] { color: #9E1E16; font-weight: 600; }
.roll-std { margin-top: auto; font: 500 11px/1.3 var(--f-label); letter-spacing: 0.04em; color: var(--ink-2); text-transform: uppercase; }

/* the print roll scrolls row by row: the top visible entry always starts whole */
.roll-paper {
  position: relative; margin: 12px 16px 0 0; background: var(--stock);
  overflow: auto; min-height: 0; overscroll-behavior: contain;
  scroll-snap-type: y mandatory; scroll-padding-top: 4px;
  box-shadow: 0 -1px 0 rgba(20, 20, 20, 0.12), 0 -8px 18px -12px rgba(20, 20, 20, 0.4);
}
.roll-empty { padding: 18px 16px; color: var(--ink-2); font: 400 13px/1.45 var(--f-text); max-width: 68ch; }
.roll-list { padding: 4px 0 8px; }
.roll-list > .row { scroll-snap-align: start; }
.row-toggle {
  width: 100%; display: grid; grid-template-columns: 40px 62px 196px minmax(0, 1fr) 84px; gap: 12px;
  align-items: start; text-align: left; padding: 7px 14px 8px; border: 0; background: transparent;
  border-bottom: var(--hair) dashed var(--rule-soft); cursor: pointer;
  transition: background-color 150ms ease;
}
.row-toggle:focus-visible { outline: 2px solid var(--ink); outline-offset: -2px; }
@media (hover: hover) and (pointer: fine) { .row-toggle:hover { background: #F3F4F2; } }
.r-seq, .r-time, .r-hash { font: 400 11.5px/1.5 var(--f-mono); color: var(--ink-2); white-space: nowrap; }
.r-hash { text-align: right; }
.r-actor { font: 400 12px/1.5 var(--f-text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.r-actor b { font: 700 11px/1 var(--f-label); text-transform: uppercase; letter-spacing: 0.05em; color: var(--ink-3); margin-right: 2px; }
.r-text {
  font: 400 13px/1.42 var(--f-text);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.r-text code { font-size: 12px; color: var(--ink-3); margin-right: 0.45em; }
.r-flag { display: inline-block; margin-right: 6px; padding: 2px 4px; background: var(--hold); color: #fff; font: 700 11px/1.1 var(--f-label); text-transform: uppercase; letter-spacing: 0.05em; vertical-align: 1px; }
.r-flag--local { background: var(--stock); color: var(--ink); box-shadow: inset 0 0 0 var(--hair) var(--ink); }
.row.is-open .r-text { -webkit-line-clamp: unset; display: block; }
.r-more { display: none; padding: 2px 14px 10px 128px; font: 400 10.5px/1.5 var(--f-mono); color: var(--ink-2); gap: 2px; overflow-wrap: anywhere; }
.row.is-open .r-more { display: grid; }
.row[data-local] .row-toggle { background: repeating-linear-gradient(-45deg, transparent 0 8px, rgba(20, 20, 20, 0.035) 8px 16px); }

.strip { display: none; }

/* ------------------------------------------------------------------ phone */
@media (max-width: 760px) {
  body { height: auto; overflow: auto; }
  .shell {
    height: auto; grid-template-columns: minmax(0, 1fr) auto; gap: 10px 12px;
    padding: 10px 16px 12px;
  }
  .shell-name strong { font-size: 17px; }
  .shell-status { grid-column: 1 / -1; justify-self: start; font-size: 11.5px; }
  .shell-status[data-kind^='playback'] { justify-self: stretch; padding: 5px 5px 5px 8px; gap: 7px; }
  .shell-status[data-kind^='playback'] #restartBtn { margin-left: auto; }
  .shell-run { grid-column: 1 / -1; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px; }
  .shell-run input { grid-column: 1 / -1; order: -1; width: 100%; height: 40px; font-size: 16px; }
  .shell-run select { height: 40px; }
  .btn-run { height: 40px; }
  .notice { top: 12px; }
  .stage { display: flex; flex-direction: column; height: auto; }
  .floor { display: none; }
  .approval { order: 1; width: auto; max-height: none; margin: 14px 16px 0; align-self: stretch; pointer-events: auto; }
  .ap-card { max-height: none; overflow: clip; display: block; transition: opacity 200ms ease; }
  .ap-body { overflow: visible; padding-bottom: 44px; }
  .approval[data-state='empty'] .ap-card, .approval[data-state='closing'] .ap-card { display: none; }
  .approval[data-state='empty'] .ap-empty, .approval[data-state='closing'] .ap-empty {
    display: block; padding: 14px 16px 16px; background: var(--stock); box-shadow: inset 0 0 0 var(--hair) var(--ink);
  }
  .ap-empty h2 { font: 900 15px/1.1 var(--f-label); text-transform: uppercase; letter-spacing: 0.04em; }
  .ap-empty p { margin-top: 6px; font: 400 13.5px/1.45 var(--f-text); color: var(--ink-2); text-wrap: pretty; }
  /* the signing stub stays at the bottom of the screen; content passing under it fades into the perforation, never slices */
  .ap-foot { position: sticky; bottom: 0; padding: 11px 15px 14px; }
  .ap-foot > .ap-actions { position: relative; }
  .ap-foot > .ap-actions::before {
    content: ''; position: absolute; left: -15px; right: -15px; bottom: calc(100% + 12px); height: 44px; pointer-events: none;
    background: linear-gradient(to bottom, rgba(255, 255, 255, 0), rgba(255, 255, 255, 0.86) 62%, #fff);
  }
  .ap-what { font-size: 18px; }
  .ap-why p { font-size: 15px; }
  .ap-actions { grid-template-columns: 1fr 1fr; }
  .btn-approve, .btn-reject { height: 52px; font-size: 16px; }
  .ap-field input { height: 44px; font-size: 16px; }
  .ap-field { grid-template-columns: 92px minmax(0, 1fr); }

  .roll { order: 2; display: block; margin-top: 18px; box-shadow: none; background: transparent; }
  .roll-head { padding: 0 16px 10px; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 12px; align-items: center; }
  .roll-head h2, .roll-meta, .roll-hash, .roll-verify, .roll-std { grid-column: 1; }
  .btn-quiet { grid-column: 2; grid-row: 1 / span 3; align-self: center; margin: 0; height: 40px; }
  .roll-verify { grid-column: 1 / -1; margin-top: 4px; }
  .roll-std { grid-column: 1 / -1; margin-top: 6px; }
  .roll-paper { margin: 0 16px; overflow: visible; }
  .row-toggle { grid-template-columns: auto auto minmax(0, 1fr) auto; gap: 3px 10px; padding: 10px 12px 11px; }
  .r-actor { grid-column: 3; }
  .r-text { grid-column: 1 / -1; grid-row: 2; -webkit-line-clamp: unset; display: block; font-size: 14px; }
  .r-more { padding: 0 12px 12px; }

  .strip { order: 3; display: block; padding: 22px 16px 28px; }
  .strip-title { font: 900 15px/1 var(--f-label); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 10px; }
  .strip-list { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; counter-reset: cp; }
  .strip-list li {
    position: relative; padding: 7px 9px 11px; background: transparent; min-width: 0;
    box-shadow: inset 0 0 0 var(--hair) var(--rule-soft);
  }
  .st-name { display: flex; gap: 6px; align-items: baseline; font: 700 11px/1.15 var(--f-label); text-transform: uppercase; letter-spacing: 0.05em; color: var(--ink-2); }
  .st-name b { font: 600 11px/1 var(--f-mono); color: var(--ink-3); }
  .st-val { display: block; margin-top: 3px; font: 400 12.5px/1.3 var(--f-text); overflow-wrap: anywhere; min-height: 1.3em; }
  .strip-list li[data-state='done'], .strip-list li[data-state='held'], .strip-list li[data-state='refused'] { background: var(--stock); box-shadow: var(--lift); }
  .strip-list li[data-state='done'] .st-name, .strip-list li[data-state='held'] .st-name, .strip-list li[data-state='refused'] .st-name { color: var(--ink); }
  .strip-list li[data-state='done']::after, .strip-list li[data-state='held']::after { content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 4px; background: var(--hatch); }
  .strip-list li[data-state='held']::before { content: 'Hold'; position: absolute; top: 6px; right: 6px; padding: 2px 4px; background: var(--hold); color: #fff; font: 900 11px/1 var(--f-label); text-transform: uppercase; letter-spacing: 0.06em; }
  .strip-list li[data-state='refused'] .st-val { color: #9E1E16; }
  .strip-list li[data-state='skipped'] { opacity: 0.55; }
  .strip-list li.is-here { box-shadow: inset 0 0 0 2px var(--ink), var(--lift); }
}

/* ------------------------------------------------------------------ preferences */
@media (prefers-reduced-motion: reduce) {
  .shell-status[data-kind='live'] .dot { animation: none; }
  .ap-card, .approval[data-state='closing'] .ap-card { transition: opacity 150ms ease; }
  .approval[data-state='empty'] .ap-card { transform: none; opacity: 0; }
  .notice, .inspector { animation: none; }
  .lbl { transition: none; }
}
@media (prefers-contrast: more) {
  :root { --ink-2: #2E302D; --ink-3: #3F423E; --rule-soft: #6E716C; }
}
