:root {
  --desk: #15171b;
  --desk-deep: #101216;
  --desk-raised: #1c1f24;
  --desk-hover: #22262d;
  --line: #363b44;
  --line-soft: #2a2f37;
  --text: #f5f6f8;
  --muted: #b6bdc8;
  --muted-strong: #c8ced7;
  --plate: #252a35;
  --plate-raised: #2d3340;
  --plate-line: #4b5361;
  --paper: #e9e7df;
  --paper-ink: #1b1c20;
  --paper-muted: #595d64;
  --cobalt: #6079de;
  --cobalt-strong: #7188e7;
  --cobalt-deep: #4055b4;
  --cobalt-wash: #273151;
  --role-nf: #8b68bb;
  --role-tk: #e04a73;
  --role-photo: #4f9bc2;
  --success: #72c6a6;
  --success-bg: #183c32;
  --warning: #e2b85b;
  --warning-bg: #493817;
  --error: #ee8995;
  --error-bg: #4b252b;
  --font: "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --radius-tight: 3px;
  --radius-control: 4px;
  --radius-surface: 6px;
  --shadow-plate: 0 12px 34px rgb(0 0 0 / 28%);
  --shadow-paper: 0 18px 38px rgb(0 0 0 / 38%);
  font-family: var(--font);
  color: var(--text);
  background: var(--desk);
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  min-height: 100%;
  background: var(--desk);
  scrollbar-color: var(--plate-line) var(--desk-deep);
  scrollbar-width: thin;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  background:
    linear-gradient(90deg, rgb(255 255 255 / 1.6%) 1px, transparent 1px) 0 0 / 64px 64px,
    var(--desk);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  text-rendering: optimizeLegibility;
}

button,
input {
  font: inherit;
}

button,
a,
label {
  -webkit-tap-highlight-color: transparent;
}

button {
  color: inherit;
}

a {
  color: inherit;
}

img {
  display: block;
  max-width: 100%;
}

[hidden] {
  display: none !important;
}

::selection {
  color: #fff;
  background: var(--cobalt-deep);
}

:focus-visible {
  outline: 3px solid var(--cobalt-strong);
  outline-offset: 3px;
}

.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.skip-link {
  position: fixed;
  z-index: 100;
  top: 12px;
  left: 12px;
  padding: 10px 14px;
  color: #fff;
  background: var(--cobalt-deep);
  border-radius: var(--radius-control);
  transform: translateY(-160%);
}

.skip-link:focus {
  transform: translateY(0);
}

.login-shell {
  position: relative;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 42px 20px 70px;
  overflow: hidden;
}

.login-shell::before,
.login-shell::after {
  content: "";
  position: absolute;
  pointer-events: none;
}

.login-shell::before {
  width: min(68vw, 960px);
  aspect-ratio: 210 / 148;
  border: 1px solid rgb(233 231 223 / 12%);
  background: rgb(233 231 223 / 2%);
  transform: rotate(-8deg) translate(8%, -5%);
}

.login-shell::after {
  width: min(46vw, 680px);
  aspect-ratio: 210 / 297;
  border: 1px dashed rgb(96 121 222 / 25%);
  transform: rotate(12deg) translate(-36%, 8%);
}

.brand-mark i {
  position: absolute;
  display: block;
  border-color: var(--cobalt);
  border-style: solid;
}

.brand strong {
  color: var(--text);
  font-weight: 750;
}

.pin-pad {
  position: relative;
  z-index: 2;
  width: min(100%, 328px);
  display: grid;
  gap: 24px;
}

.pin-display {
  min-height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
}

.pin-display i {
  width: 12px;
  height: 12px;
  display: block;
  background: transparent;
  border: 1px solid #77808f;
  border-radius: 50%;
  transition: background-color 120ms ease, border-color 120ms ease, transform 120ms ease;
}

.pin-display i.is-filled {
  background: var(--cobalt-strong);
  border-color: var(--cobalt-strong);
  transform: scale(1.08);
}

.pin-keyboard {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.pin-key {
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  padding: 0;
  color: var(--text);
  background: #20242b;
  border: 1px solid #464e5a;
  border-radius: var(--radius-surface);
  font-size: 25px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
  transition: background-color 120ms ease, border-color 120ms ease;
}

.pin-key:hover:not(:disabled),
.pin-key:focus-visible {
  background: var(--plate-raised);
  border-color: var(--cobalt-strong);
}

.pin-key:active:not(:disabled) {
  background: var(--cobalt-deep);
}

.pin-key.is-pressed {
  background: var(--cobalt-deep);
  border-color: var(--cobalt-strong);
  box-shadow: inset 0 0 0 1px rgb(255 255 255 / 14%);
}

.pin-key:disabled {
  cursor: wait;
  opacity: .5;
}

.pin-erase svg {
  width: 30px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.7;
}

.pin-pad.is-error {
  animation: pin-error 220ms ease;
}

.pin-pad.is-error .pin-key {
  border-color: var(--error);
}

.pin-pad.is-error .pin-display i {
  background: var(--error);
  border-color: var(--error);
}

.pin-pad.is-loading .pin-key {
  border-color: var(--cobalt-strong);
  animation: pin-loading 620ms ease-in-out infinite alternate;
}

.pin-pad.is-loading .pin-display i {
  background: var(--cobalt-strong);
  border-color: var(--cobalt-strong);
  animation: pin-loading 620ms ease-in-out infinite alternate;
}

.button {
  min-height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 18px;
  border: 1px solid transparent;
  border-radius: var(--radius-control);
  font-weight: 750;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 160ms ease, border-color 160ms ease, color 160ms ease, opacity 160ms ease;
}

.button-primary {
  color: #fff;
  background: var(--cobalt-deep);
  border-color: var(--cobalt);
}

.button-primary:hover:not(:disabled) {
  background: #4b61c4;
}

.button-primary:active:not(:disabled) {
  background: var(--cobalt-deep);
}

.button-secondary {
  color: var(--text);
  background: #292e36;
  border-color: var(--line);
}

.button-secondary:hover:not(:disabled) {
  background: #323842;
  border-color: var(--plate-line);
}

.button:disabled {
  color: #858c97;
  background: #272b31;
  border-color: #343943;
  cursor: not-allowed;
}

.button.is-loading {
  position: relative;
  overflow: hidden;
  cursor: wait;
}

.button.is-loading::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(100deg, transparent 25%, rgb(255 255 255 / 18%) 50%, transparent 75%);
  transform: translateX(-100%);
  animation: scan 1.1s ease-in-out infinite;
}

.compact-button {
  min-height: 42px;
  font-size: 13px;
}

.text-button {
  min-height: 40px;
  padding: 0 4px;
  color: var(--muted-strong);
  background: transparent;
  border: 0;
  text-decoration: underline;
  text-decoration-color: transparent;
  text-underline-offset: 4px;
  cursor: pointer;
}

.text-button:hover {
  color: var(--text);
  text-decoration-color: currentColor;
}

.topbar {
  position: sticky;
  z-index: 20;
  top: 0;
  min-height: 68px;
  display: grid;
  grid-template-columns: minmax(210px, 1fr) auto minmax(210px, 1fr);
  align-items: center;
  gap: 24px;
  padding: 0 5vw;
  background: rgb(21 23 27 / 94%);
  border-bottom: 1px solid var(--line-soft);
  backdrop-filter: blur(12px);
}

.brand {
  width: max-content;
  display: inline-flex;
  align-items: center;
  gap: 11px;
  text-decoration: none;
}

.brand-mark {
  position: relative;
  width: 30px;
  height: 24px;
  border: 1px solid var(--plate-line);
}

.brand-mark i:first-child {
  top: 4px;
  left: 4px;
  width: 9px;
  height: 7px;
  border-width: 1px 0 0 1px;
}

.brand-mark i:last-child {
  right: 4px;
  bottom: 4px;
  width: 9px;
  height: 7px;
  border-width: 0 1px 1px 0;
}

.workstation-nav {
  grid-column: 2;
  height: 68px;
  display: flex;
  align-items: stretch;
  gap: 2px;
}

.workstation-nav a {
  position: relative;
  min-width: 142px;
  display: grid;
  place-items: center;
  padding: 0 16px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
}

.workstation-nav a:hover {
  color: var(--text);
  background: rgb(255 255 255 / 2.5%);
}

.workstation-nav a.is-active {
  color: var(--text);
}

.workstation-nav a.is-active::after {
  content: "";
  position: absolute;
  right: 16px;
  bottom: -1px;
  left: 16px;
  height: 3px;
  background: var(--cobalt);
}

.session-tools {
  grid-column: 3;
  grid-row: 1;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 16px;
}

.session-state {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
}

.session-state i {
  width: 7px;
  height: 7px;
  background: var(--success);
  border-radius: 50%;
  box-shadow: 0 0 0 3px rgb(114 198 166 / 12%);
}

main {
  width: 90vw;
  margin: 0 auto;
  padding: 18px 0 28px;
}

.view-heading,
.section-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
}

.view-heading {
  margin-bottom: 12px;
}

.view-heading h1 {
  margin: 0;
  font-size: 30px;
  line-height: 1.1;
  letter-spacing: -0.035em;
}

.view-heading p,
.section-heading p,
.console-heading p,
.stage-heading p,
.sequence-heading p,
.batch-heading p {
  margin: 6px 0 0;
  color: var(--muted);
}

.create-workbench {
  display: grid;
  grid-template-columns: minmax(360px, 420px) minmax(560px, 1fr);
  min-height: 540px;
  border: 1px solid var(--line);
  background: var(--desk-raised);
  box-shadow: 0 18px 46px rgb(0 0 0 / 22%);
}

.source-console {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 18px;
  background: var(--plate);
  border-right: 1px solid var(--line);
}

.console-heading,
.stage-heading,
.rail-heading,
.sequence-heading,
.batch-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.console-heading {
  margin-bottom: 4px;
}

.console-heading h2,
.stage-heading h2,
.rail-heading h2,
.sequence-heading h2,
.batch-heading h2,
.section-heading h2 {
  margin: 0;
  font-size: 18px;
  line-height: 1.2;
  letter-spacing: -0.025em;
}

.source-group {
  min-width: 0;
  margin: 0;
  padding: 12px;
  background: #202630;
  border: 1px solid #3d4655;
  border-radius: var(--radius-surface);
}

.source-group:focus-within {
  border-color: var(--cobalt);
}

.source-group.has-error {
  border-color: var(--error);
}

.source-group legend {
  padding: 0 6px 0 0;
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
}

.role-code {
  display: inline-grid;
  place-items: center;
  min-width: 46px;
  height: 24px;
  margin-right: 7px;
  padding: 0 7px;
  color: #050609;
  border-radius: var(--radius-tight);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.role-nf { background: var(--role-nf); }
.role-tk { background: var(--role-tk); }
.role-photo { background: var(--role-photo); }

.dropzone {
  position: relative;
  min-height: 64px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  color: var(--muted-strong);
  background: var(--plate-raised);
  border: 1px dashed #596373;
  border-radius: var(--radius-control);
  cursor: pointer;
  transition: border-color 160ms ease, background-color 160ms ease;
}

.dropzone:hover,
.dropzone.is-dragover {
  color: var(--text);
  background: #343c4b;
  border-color: var(--cobalt-strong);
}

.dropzone:focus-within {
  color: var(--text);
  background: #343c4b;
  border-color: var(--cobalt-strong);
  box-shadow: 0 0 0 3px rgb(96 121 222 / 28%);
}

.dropzone strong,
.dropzone small {
  display: block;
}

.dropzone strong {
  color: var(--text);
  font-size: 13px;
}

.dropzone small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
}

.drop-symbol {
  position: relative;
  flex: 0 0 34px;
  width: 34px;
  height: 38px;
  border: 1px solid #758093;
  border-radius: 2px;
}

.drop-symbol::before,
.drop-symbol::after,
.drop-symbol i::before,
.drop-symbol i::after {
  content: "";
  position: absolute;
  display: block;
  background: var(--cobalt-strong);
}

.drop-symbol::before {
  top: 18px;
  left: 9px;
  width: 14px;
  height: 2px;
}

.drop-symbol::after {
  top: 12px;
  left: 15px;
  width: 2px;
  height: 14px;
}

.drop-symbol i::before {
  top: -1px;
  right: -1px;
  width: 9px;
  height: 9px;
  background: var(--plate-raised);
  border-bottom: 1px solid #758093;
  border-left: 1px solid #758093;
}

.photo-dropzone img {
  width: 78px;
  height: 54px;
  margin-left: auto;
  object-fit: cover;
  border: 2px solid var(--paper);
  border-radius: 2px;
}

.file-stack {
  display: grid;
  gap: 5px;
  margin: 7px 0 0;
  padding: 0;
  list-style: none;
}

.file-row {
  min-width: 0;
  min-height: 40px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 9px;
  padding: 5px 6px 5px 10px;
  background: #303643;
  border: 1px solid transparent;
  border-radius: var(--radius-tight);
}

.file-row strong {
  min-width: 0;
  overflow: hidden;
  font-size: 12px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-row small {
  color: var(--muted);
  font-size: 10px;
  font-variant-numeric: tabular-nums;
}

.file-row button {
  min-width: 62px;
  min-height: 30px;
  padding: 0 7px;
  color: var(--muted-strong);
  background: transparent;
  border: 1px solid #4a5260;
  border-radius: var(--radius-tight);
  font-size: 10px;
  cursor: pointer;
}

.file-row button:hover {
  color: #fff;
  background: var(--error-bg);
  border-color: var(--error);
}

.field-message {
  min-height: 0;
  margin: 6px 0 0;
  color: var(--error);
  font-size: 11px;
}

.field-message:empty {
  display: none;
}

.form-summary {
  padding: 10px 12px;
  color: #ffe9ec;
  background: var(--error-bg);
  border: 1px solid #92505a;
  border-radius: var(--radius-control);
  font-size: 12px;
}

.action-error {
  margin: 9px 0 0;
  padding: 9px 10px;
  color: #ffe8eb;
  background: var(--error-bg);
  border: 1px solid #bd5663;
  border-radius: var(--radius-control);
  font-size: 11px;
}

.build-button {
  width: 100%;
  margin-top: auto;
}

.proof-stage {
  min-width: 0;
  display: flex;
  flex-direction: column;
  padding: 16px;
  overflow: hidden;
}

.paper-scale {
  position: absolute;
  z-index: 2;
  top: 10px;
  right: 12px;
  padding: 3px 5px;
  color: var(--muted);
  background: #111419;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.proof-field {
  position: relative;
  flex: 1;
  min-height: 420px;
  display: grid;
  place-items: center;
  padding: clamp(20px, 3vw, 40px);
  overflow: hidden;
  background: #111419;
  border: 1px solid #2d333c;
}

.registration-grid {
  position: absolute;
  inset: 0;
  opacity: 0.46;
  background:
    linear-gradient(90deg, transparent calc(50% - .5px), #323843 50%, transparent calc(50% + .5px)),
    linear-gradient(0deg, transparent calc(50% - .5px), #323843 50%, transparent calc(50% + .5px));
}

.registration-grid::before,
.registration-grid::after {
  content: "";
  position: absolute;
  background: #4c5460;
}

.registration-grid::before {
  top: 50%;
  left: 10px;
  width: 22px;
  height: 1px;
}

.registration-grid::after {
  top: 10px;
  left: 50%;
  width: 1px;
  height: 22px;
}

.paper-preview {
  position: relative;
  z-index: 1;
  width: min(82%, 600px);
  aspect-ratio: 210 / 148;
  display: grid;
  place-items: center;
  padding: 6px;
  color: var(--paper-ink);
  background: var(--paper);
  box-shadow: var(--shadow-paper);
  transition: transform 220ms cubic-bezier(.2, .8, .2, 1), box-shadow 220ms ease;
}

.paper-preview.has-result:hover {
  transform: translateY(-3px);
  box-shadow: 0 24px 50px rgb(0 0 0 / 44%);
}

.paper-preview img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.paper-placeholder {
  display: grid;
  justify-items: center;
  gap: 8px;
  color: var(--paper-muted);
  text-align: center;
}

.paper-placeholder > span {
  width: 62px;
  height: 1px;
  background: #9da0a4;
}

.paper-placeholder strong {
  color: #5a5d63;
  font-size: 15px;
}

.paper-placeholder small {
  font-size: 11px;
}

.registration-corner {
  position: absolute;
  z-index: 2;
  width: 18px;
  height: 18px;
  pointer-events: none;
}

.corner-a {
  top: -9px;
  left: -9px;
  border-top: 1px solid #8f9399;
  border-left: 1px solid #8f9399;
}

.corner-b {
  right: -9px;
  bottom: -9px;
  border-right: 1px solid #8f9399;
  border-bottom: 1px solid #8f9399;
}

.proof-result {
  min-height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--line-soft);
}

.proof-result:empty {
  display: none;
}

.proof-result > p {
  margin: 0;
  color: var(--muted);
}

.proof-result-info strong,
.proof-result-info span {
  display: block;
}

.proof-result-info span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
}

.download-set {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.format-link {
  min-width: 48px;
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 10px;
  color: var(--text);
  background: #292e36;
  border: 1px solid var(--line);
  border-radius: var(--radius-tight);
  font-size: 11px;
  font-weight: 800;
  text-decoration: none;
}

.format-link:hover {
  background: var(--cobalt-wash);
  border-color: var(--cobalt);
}

.recent-section,
.delivery-section {
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.recent-strip {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.recent-card {
  min-width: 0;
  display: grid;
  grid-template-columns: clamp(200px, 44%, 320px) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
  padding: 14px;
  background: var(--desk-raised);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-control);
}

.recent-card img {
  grid-row: 1 / span 2;
  width: 100%;
  aspect-ratio: 210 / 148;
  object-fit: contain;
  background: var(--paper);
  border: 3px solid var(--paper);
  box-shadow: 0 6px 14px rgb(0 0 0 / 28%);
}

.recent-card strong,
.recent-card small {
  display: block;
}

.recent-card strong {
  overflow: hidden;
  font-size: 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.recent-card small {
  margin-top: 5px;
  color: var(--muted);
  font-size: 10px;
}

.recent-card .download-set {
  align-self: end;
  justify-content: flex-start;
  gap: 4px;
}

.empty-inline {
  grid-column: 1 / -1;
  padding: 24px;
  color: var(--muted);
  background: var(--desk-raised);
  border: 1px dashed var(--line);
  text-align: center;
}

.assembly-workbench {
  display: grid;
  grid-template-columns: minmax(290px, 330px) minmax(420px, 1fr) minmax(300px, 350px);
  min-height: 600px;
  border: 1px solid var(--line);
  background: var(--desk-raised);
  box-shadow: 0 18px 46px rgb(0 0 0 / 22%);
}

.import-rail,
.batch-rail,
.sequence-board {
  min-width: 0;
  padding: 16px;
}

.import-rail {
  background: var(--plate);
  border-right: 1px solid var(--line);
}

.rail-heading {
  align-items: center;
}

.rail-heading > span {
  color: var(--muted);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.import-dropzone {
  min-height: 80px;
  margin-top: 12px;
}

.import-progress {
  margin-top: 10px;
}

.import-progress > span {
  height: 4px;
  display: block;
  overflow: hidden;
  background: #171a20;
  border-radius: 2px;
}

.import-progress i {
  width: 100%;
  height: 100%;
  display: block;
  background: var(--cobalt);
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform 180ms ease;
}

.import-progress p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 10px;
}

.library-tools {
  margin-top: 10px;
}

.library-tools label {
  display: block;
  margin-bottom: 5px;
  color: var(--muted-strong);
  font-size: 11px;
  font-weight: 700;
}

.library-tools input {
  width: 100%;
  height: 38px;
  padding: 0 11px;
  color: var(--text);
  background: #191d23;
  border: 1px solid var(--plate-line);
  border-radius: var(--radius-control);
  caret-color: var(--cobalt);
}

.library-tools input::placeholder {
  color: #929aa6;
}

.a5-library {
  max-height: 535px;
  display: grid;
  gap: 8px;
  margin-top: 12px;
  padding-right: 3px;
  overflow-y: auto;
}

.library-card {
  position: relative;
  width: 100%;
  min-width: 0;
  display: grid;
  grid-template-columns: 80px minmax(0, 1fr);
  gap: 8px;
  padding: 6px;
  color: var(--text);
  background: #20252d;
  border: 1px solid #3a414c;
  border-radius: var(--radius-control);
  text-align: left;
  cursor: pointer;
}

.library-entry {
  min-width: 0;
}

.library-downloads {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 4px 6px 0;
}

.format-link.is-small {
  min-width: 38px;
  min-height: 28px;
  padding: 0 7px;
  font-size: 9px;
}

.library-card:hover {
  background: #272d36;
  border-color: #596271;
}

.library-card.is-selected {
  background: var(--cobalt-wash);
  border-color: var(--cobalt);
}

.library-card img {
  width: 80px;
  aspect-ratio: 210 / 148;
  object-fit: cover;
  background: var(--paper);
  border: 3px solid var(--paper);
}

.library-card-copy {
  min-width: 0;
  align-self: center;
}

.library-card-copy strong,
.library-card-copy small {
  display: block;
}

.library-card-copy strong {
  overflow: hidden;
  font-size: 12px;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.library-card-copy small {
  margin-top: 5px;
  color: var(--muted);
  font-size: 9px;
  text-transform: uppercase;
}

.selection-index {
  position: absolute;
  top: 4px;
  left: 4px;
  min-width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  color: #fff;
  background: var(--cobalt-deep);
  border: 2px solid var(--paper);
  border-radius: 50%;
  font-size: 10px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.library-empty {
  padding: 26px 14px;
  color: var(--muted);
  border: 1px dashed var(--plate-line);
  text-align: center;
}

.library-empty strong {
  display: block;
  margin-bottom: 5px;
  color: var(--text);
}

.sequence-board {
  display: flex;
  flex-direction: column;
  background: #191c21;
}

.sequence-heading {
  align-items: center;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line-soft);
}

.sequence-heading > p {
  margin: 0;
}

.sequence-list {
  display: grid;
  gap: 4px;
  padding: 12px 0;
}

.sequence-row {
  position: relative;
  min-width: 0;
  min-height: 66px;
  display: grid;
  grid-template-columns: 18px 34px 72px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 8px 9px;
  background: #22262c;
  border: 1px solid #353b44;
}

.drag-handle {
  width: 18px;
  height: 24px;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 3px;
  cursor: grab;
}

.drag-handle i {
  width: 15px;
  height: 2px;
  display: block;
  background: var(--muted-strong);
}

.sequence-row:hover .drag-handle i,
.sequence-row:focus-visible .drag-handle i {
  background: var(--text);
}

.sequence-row.is-dragging .drag-handle {
  cursor: grabbing;
}

.sequence-row.is-dragging {
  opacity: .48;
  border-color: var(--cobalt);
}

.sequence-row:nth-child(odd) {
  border-radius: var(--radius-control) var(--radius-control) 0 0;
}

.sequence-row:nth-child(even) {
  margin-bottom: 12px;
  border-top: 0;
  border-radius: 0 0 var(--radius-control) var(--radius-control);
}

.sequence-row:nth-child(odd)::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: -1px;
  left: 0;
  border-bottom: 1px dashed #5a606a;
}

.sequence-number {
  font-size: 16px;
  font-weight: 800;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.sequence-row img {
  width: 72px;
  aspect-ratio: 210 / 148;
  object-fit: cover;
  background: var(--paper);
  border: 2px solid var(--paper);
}

.sequence-copy {
  min-width: 0;
}

.sequence-copy strong,
.sequence-copy small {
  display: block;
}

.sequence-copy strong {
  overflow: hidden;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sequence-copy small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 9px;
}

.sequence-actions {
  display: flex;
  gap: 4px;
}

.mini-action {
  min-height: 34px;
  padding: 0 8px;
  color: var(--muted-strong);
  background: #292e35;
  border: 1px solid #414852;
  border-radius: var(--radius-tight);
  font-size: 9px;
  cursor: pointer;
}

.mini-action:hover:not(:disabled) {
  color: #fff;
  background: var(--cobalt-wash);
  border-color: var(--cobalt);
}

.mini-action:disabled {
  opacity: .38;
  cursor: not-allowed;
}

.remove-action {
  min-width: 34px;
  padding: 0;
}

.remove-action svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.7;
}

.remove-action:hover:not(:disabled) {
  color: var(--error);
  background: var(--error-bg);
  border-color: var(--error);
}

.sequence-empty {
  flex: 1;
  display: grid;
  place-content: center;
  justify-items: center;
  max-width: 350px;
  margin: 0 auto;
  color: var(--muted);
  text-align: center;
}

.sequence-empty strong {
  margin-top: 16px;
  color: var(--text);
  font-size: 15px;
}

.sequence-empty p {
  margin: 6px 0 0;
}

.empty-pair {
  position: relative;
  width: 118px;
  height: 74px;
}

.empty-pair span {
  position: absolute;
  width: 86px;
  aspect-ratio: 210 / 148;
  background: #2c3037;
  border: 1px dashed #555c67;
}

.empty-pair span:first-child {
  top: 0;
  left: 0;
  transform: rotate(-7deg);
}

.empty-pair span:last-child {
  right: 0;
  bottom: 0;
  transform: rotate(7deg);
}

.batch-rail {
  display: flex;
  flex-direction: column;
  background: #20242b;
  border-left: 1px solid var(--line);
}

.batch-state {
  padding: 5px 7px;
  color: var(--warning);
  background: var(--warning-bg);
  border: 1px solid #765a21;
  border-radius: var(--radius-tight);
  font-size: 9px;
  font-weight: 800;
  text-transform: uppercase;
}

.batch-state.is-ready {
  color: var(--success);
  background: var(--success-bg);
  border-color: #2b6c59;
}

.pair-preview-list {
  flex: 1;
  max-height: 464px;
  display: grid;
  align-content: start;
  gap: 12px;
  margin: 18px 0;
  padding-right: 3px;
  overflow-y: auto;
}

.batch-placeholder {
  min-height: 250px;
  display: grid;
  place-content: center;
  justify-items: center;
  color: var(--muted);
  border: 1px dashed var(--line);
  text-align: center;
}

.a4-mini,
.pair-sheet {
  position: relative;
  width: 112px;
  aspect-ratio: 210 / 297;
  display: grid;
  grid-template-rows: 1fr 1fr;
  padding: 4px;
  background: var(--paper);
  box-shadow: 0 8px 22px rgb(0 0 0 / 32%);
}

.a4-mini::after,
.pair-sheet::after {
  content: "";
  position: absolute;
  top: 50%;
  right: 0;
  left: 0;
  border-top: 1px dashed #92959a;
}

.a4-mini i {
  display: block;
  margin: 5px;
  background: #d7d5cf;
  border: 1px dashed #a9a8a3;
}

.batch-placeholder p {
  max-width: 22ch;
  margin: 14px 0 0;
}

.pair-card {
  display: grid;
  grid-template-columns: 94px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: #191c21;
  border: 1px solid var(--line-soft);
}

.pair-sheet {
  width: 94px;
}

.pair-sheet img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  overflow: hidden;
}

.pair-copy {
  min-width: 0;
}

.pair-copy > span,
.pair-copy strong,
.pair-copy small {
  display: block;
}

.pair-copy > span {
  color: var(--muted);
  font-size: 9px;
  font-weight: 800;
  text-transform: uppercase;
}

.pair-copy strong {
  margin-top: 6px;
  overflow: hidden;
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pair-copy small {
  margin-top: 3px;
  overflow: hidden;
  color: var(--muted);
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.batch-warning {
  margin-bottom: 10px;
  padding: 9px 10px;
  color: var(--warning);
  background: var(--warning-bg);
  border: 1px solid #725821;
  border-radius: var(--radius-control);
  font-size: 10px;
}

.batch-rail .button {
  width: 100%;
}

.batch-footnote {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 9px;
  line-height: 1.45;
}

.delivery-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.delivery-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 18px;
}

.delivery-card {
  min-width: 0;
  padding: 14px;
  background: var(--desk-raised);
  border: 1px solid var(--line);
}

.delivery-card > span,
.delivery-card > strong {
  display: block;
}

.delivery-card > span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
}

.delivery-card > strong {
  margin: 6px 0 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.delivery-card .download-set {
  justify-content: flex-start;
}

.toast-region {
  position: fixed;
  z-index: 80;
  right: 24px;
  bottom: 24px;
  width: min(calc(100% - 32px), 390px);
  display: grid;
  gap: 8px;
  pointer-events: none;
}

.toast {
  min-height: 66px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: start;
  padding: 13px 14px;
  color: #e7fff6;
  background: var(--success-bg);
  border: 1px solid #419b7c;
  border-radius: var(--radius-surface);
  box-shadow: 0 14px 34px rgb(0 0 0 / 42%);
  pointer-events: auto;
  animation: toast-in 180ms cubic-bezier(.2, .8, .2, 1);
}

.toast.is-warning {
  color: #fff2c9;
  background: var(--warning-bg);
  border-color: #bd8e32;
}

.toast.is-error {
  color: #ffe8eb;
  background: var(--error-bg);
  border-color: #bd5663;
}

.toast strong,
.toast span {
  display: block;
}

.toast span {
  margin-top: 3px;
  font-size: 12px;
}

.toast button {
  min-width: 58px;
  min-height: 38px;
  padding: 0 7px;
  color: inherit;
  background: transparent;
  border: 1px solid currentColor;
  border-radius: var(--radius-tight);
  cursor: pointer;
}

@keyframes scan {
  to { transform: translateX(100%); }
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(10px); }
}

@keyframes pin-error {
  25% { transform: translateX(-7px); }
  75% { transform: translateX(7px); }
}

@keyframes pin-loading {
  to { opacity: .36; }
}

@media (min-width: 1241px) {
  body.is-assemble-route main {
    padding-top: 14px;
    padding-bottom: 14px;
  }

  body.is-assemble-route .view-heading {
    margin-bottom: 10px;
  }

  body.is-assemble-route .assembly-workbench {
    height: calc(100dvh - 140px);
    min-height: 560px;
  }

  body.is-assemble-route .import-rail {
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }

  body.is-assemble-route .a5-library,
  body.is-assemble-route .sequence-list,
  body.is-assemble-route .pair-preview-list {
    min-height: 0;
    max-height: none;
    overflow-y: auto;
  }

  body.is-assemble-route .a5-library,
  body.is-assemble-route .pair-preview-list {
    flex: 1;
  }

  body.is-assemble-route .a5-library,
  body.is-assemble-route .sequence-list {
    align-content: start;
  }

  body.is-assemble-route .sequence-list {
    flex: 1;
  }

  body.is-assemble-route .sequence-board,
  body.is-assemble-route .batch-rail {
    overflow: hidden;
  }
}

@media (max-width: 1240px) {
  .assembly-workbench {
    grid-template-columns: 310px minmax(420px, 1fr);
  }

  .batch-rail {
    grid-column: 1 / -1;
    min-height: 360px;
    display: grid;
    grid-template-columns: minmax(180px, 240px) minmax(0, 1fr) minmax(250px, 310px);
    grid-template-rows: auto 1fr;
    gap: 16px;
    border-top: 1px solid var(--line);
    border-left: 0;
  }

  .batch-heading {
    grid-column: 1;
    grid-row: 1 / -1;
    display: block;
  }

  .batch-heading .batch-state {
    display: inline-block;
    margin-top: 12px;
  }

  .pair-preview-list {
    grid-column: 2;
    grid-row: 1 / -1;
    max-height: 280px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin: 0;
  }

  .batch-warning,
  .batch-error,
  .batch-rail > .button,
  .batch-footnote {
    grid-column: 3;
  }

  .batch-warning {
    align-self: end;
    margin: 0;
  }
}

@media (max-width: 980px) {
  .topbar {
    grid-template-columns: 1fr auto;
  }

  .workstation-nav {
    grid-column: 1 / -1;
    grid-row: 2;
    height: 46px;
    justify-content: center;
    border-top: 1px solid var(--line-soft);
  }

  .session-tools {
    grid-column: 2;
    grid-row: 1;
  }

  .workstation-nav a {
    min-width: 160px;
  }

  .create-workbench {
    grid-template-columns: 360px minmax(420px, 1fr);
  }

  .proof-field {
    min-height: 360px;
    padding: 28px;
  }

  .delivery-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 820px) {
  main {
    padding-top: 18px;
  }

  .session-state {
    display: none;
  }

  .create-workbench,
  .assembly-workbench {
    grid-template-columns: 1fr;
  }

  .source-console,
  .import-rail {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .proof-stage {
    min-height: 460px;
  }

  .assembly-workbench .sequence-board {
    min-height: 530px;
  }

  .a5-library {
    max-height: 380px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .batch-rail {
    grid-column: auto;
    display: flex;
    min-height: 500px;
    border-top: 0;
    border-left: 0;
  }

  .batch-heading {
    display: flex;
  }

  .batch-heading .batch-state {
    margin-top: 0;
  }

  .pair-preview-list {
    max-height: 380px;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin: 18px 0;
  }

  .recent-strip {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 580px) {
  body {
    background: var(--desk);
  }

  .topbar {
    min-height: 60px;
    padding: 0 12px;
    gap: 10px;
  }

  .brand {
    font-size: 13px;
  }

  .brand-mark {
    width: 26px;
    height: 21px;
  }

  .session-tools {
    gap: 6px;
  }

  .workstation-nav a {
    min-width: 0;
    flex: 1;
    padding: 0 8px;
    font-size: 12px;
  }

  main {
    width: calc(100% - 20px);
    padding: 18px 0 32px;
  }

  .view-heading,
  .section-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .view-heading h1 {
    font-size: 26px;
  }

  .source-console,
  .proof-stage,
  .import-rail,
  .sequence-board,
  .batch-rail {
    padding: 14px;
  }

  .source-group {
    padding: 12px;
  }

  .proof-stage {
    min-height: 410px;
  }

  .proof-field {
    min-height: 280px;
    padding: 22px;
  }

  .proof-result {
    align-items: flex-start;
    flex-direction: column;
  }

  .download-set {
    justify-content: flex-start;
  }

  .recent-section,
  .delivery-section {
    margin-top: 20px;
  }

  .recent-card {
    grid-template-columns: 140px minmax(0, 1fr);
    gap: 12px;
    padding: 12px;
  }

  .a5-library,
  .pair-preview-list,
  .delivery-grid {
    grid-template-columns: 1fr;
  }

  .sequence-row {
    grid-template-columns: 18px 28px 58px minmax(0, 1fr) auto;
    gap: 8px;
  }

  .assembly-workbench .sequence-board,
  .batch-rail {
    min-height: 0;
  }

  .pair-preview-list {
    flex: none;
    max-height: none;
  }

  .sequence-row img {
    width: 58px;
  }

  .sequence-actions {
    justify-content: flex-end;
  }

  .mini-action {
    min-height: 44px;
    padding-inline: 10px;
  }

  .remove-action {
    min-width: 44px;
    padding: 0;
  }

  .delivery-actions {
    justify-content: flex-start;
  }

  .toast-region {
    right: 10px;
    bottom: 10px;
    width: calc(100% - 20px);
  }

  .login-shell {
    padding: 28px;
  }

  .pin-pad {
    width: min(100%, 286px);
    gap: 22px;
  }

  .pin-keyboard {
    gap: 10px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}
