.floor-control-target {
  background: color-mix(in srgb, var(--accent) 14%, var(--surface-1));
  box-shadow: inset 5px 0 0 var(--accent);
  outline: 3px solid color-mix(in srgb, var(--accent) 55%, transparent);
  outline-offset: -3px;
}

.floor-control-target:focus {
  outline-color: var(--accent);
}

/* The station screens — Racking, Anodizing, Packing. Extends styles.css
   rather than restating it — the shell,
   cards, fields, buttons and banners all come from there. Only what the racking
   screens need that the Quality screens never did lives here. */

.card-note {
  color: var(--text-secondary);
  margin: -4px 0 16px;
  max-width: 68ch;
}

.field.wide { grid-column: 1 / -1; }

.row.actions { gap: 12px; margin: 18px 0 40px; }
.row.head-row { align-items: center; gap: 12px; margin-bottom: 4px; }
.inline-label { color: var(--text-secondary); font-weight: 600; }

/* The controls in a head row are filters over the table below, not fields being
   filled in. Inputs default to filling their container, and inside a flex row that
   means each one claims a line of its own — which turned every filter bar in the
   app into a stack. Sized to their content, they sit on the heading line where
   they read as controls rather than as a form. */
.row.head-row input,
.row.head-row select { width: auto; min-width: 132px; }
.row.head-row input[type="date"] { min-width: 150px; }

/* ---- order line rows ---------------------------------------------------- */
table.lines { width: 100%; border-collapse: collapse; }
table.lines th {
  text-align: left;
  font-size: 12px;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 8px 8px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
table.lines td { padding: 5px 6px; vertical-align: middle; }
table.lines input {
  width: 100%;
  height: 38px;
  box-sizing: border-box;
}
.line-drop {
  border: 0;
  background: none;
  color: var(--critical);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
}
.line-drop:hover { background: var(--critical-wash); }
.line-drop:focus-visible { box-shadow: var(--focus-ring); outline: none; }

/* An order number that is not plain digits still saves — it is flagged for the
   office rather than blocked, because the floor cannot wait on a correction. */
.line-flagged input.order-no {
  background: var(--warning-wash);
  border-color: var(--warning);
}

/* ---- board -------------------------------------------------------------- */
.board-list { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }

.board-card {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-left: 7px solid var(--axis);
  border-radius: var(--radius);
  padding: 14px 16px;
  box-shadow: var(--shadow);
  cursor: grab;
}
.board-card[draggable="true"]:active { cursor: grabbing; }
.board-card.dragging { opacity: .45; }
.board-card.drop-target { border-top: 3px solid var(--series-1); }
.board-card.is-priority { border-left-color: var(--critical); background: var(--critical-wash); }
.board-card.is-carried { border-left-color: var(--warning); }

.board-flybar {
  font-size: 26px;
  font-weight: 700;
  min-width: 58px;
  text-align: center;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}
.board-flybar small {
  display: block;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.board-main { flex: 1; min-width: 0; }
.board-title { font-weight: 600; }
.board-sub { color: var(--text-secondary); font-size: 13px; }
.board-tags { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }

.tag {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 2px;
  border: 1px solid currentColor;
  white-space: nowrap;
}
.tag.stage    { background: var(--surface-2); color: var(--text-secondary); border-color: var(--border); }
.tag.priority { background: var(--warning-wash); color: var(--warning-text, #8a5a00); border-color: var(--warning); }
.tag.priority.critical { background: var(--critical-wash); color: var(--critical); border-color: var(--critical); }
.tag.priority.urgent { background: var(--warning-wash); color: var(--warning-text, #8a5a00); border-color: var(--warning); }
.tag.carried  { background: var(--warning-wash); color: var(--warning-text, #8a5a00); border-color: var(--warning); }
.tag.rework   { background: var(--warning-wash); color: var(--warning-text, #8a5a00); border-color: var(--warning); }
.tag.flagged  { background: var(--critical-wash); color: var(--critical); border-color: var(--critical); }
.tag.reading  { background: var(--good-wash); color: var(--good-text, #0a6b2c); border-color: var(--good); }

.board-actions { display: flex; gap: 8px; flex: none; }

/* Details carried across from somewhere else and shown read-only: the load an
   anodize run belongs to, the load a rerun follows, the plan a load departs
   from. Shared by every station page rather than owned by one of them. */
.carried {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 10px 18px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin: 8px 0 18px;
}
.carried div { min-width: 0; }
.carried dt, .carried .k {
  display: block;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.carried .v {
  display: block;
  font-weight: 600;
  overflow-wrap: anywhere;
}


@media (max-width: 720px) {
  .board-card { flex-wrap: wrap; }
  .board-actions { width: 100%; justify-content: flex-end; }
  table.lines th:nth-child(4), table.lines td:nth-child(4) { display: none; }
}

/* ---- station switcher ---------------------------------------------------- */
/* Three stations, one workflow. An operator at the tank needs to see what
   racking entered, so getting between them cannot mean typing a URL. */
.app-switch { display: flex; gap: 2px; }

.app-switch a {
  display: inline-block;
  padding: 9px 13px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  text-decoration: none;
  border: 1px solid var(--border);
  background: var(--surface-1);
}
.app-switch a:first-child { border-radius: 3px 0 0 3px; }
.app-switch a:last-child { border-radius: 0 3px 3px 0; }
.app-switch a + a { margin-left: -1px; }
.app-switch a:hover { background: var(--surface-2); color: var(--text-primary); }
.app-switch a:focus-visible { box-shadow: var(--focus-ring); outline: none; position: relative; }

.app-switch a.current {
  background: var(--text-primary);
  border-color: var(--text-primary);
  color: #fff;
  position: relative;
}

@media (max-width: 720px) {
  .app-switch a { padding: 6px 9px; font-size: 12px; }
}

/* ---- guided station queues ---------------------------------------------- */
.workflow-queue { display: grid; gap: 12px; }
.workflow-card {
  border: 2px solid var(--border);
  border-left: 8px solid var(--section-accent, var(--axis));
  border-radius: var(--radius);
  background: var(--surface-1);
  padding: 18px 20px;
  box-shadow: var(--shadow);
}
.workflow-card.is-held {
  border-color: var(--critical);
  border-left-width: 8px;
  background: repeating-linear-gradient(-45deg, var(--critical-wash), var(--critical-wash) 12px, var(--surface-1) 12px, var(--surface-1) 24px);
}
.workflow-hold-reason {
  width: 100%; margin-top: 12px; padding: 10px 12px;
  border: 1px solid var(--critical); border-radius: 6px;
  background: var(--critical-wash); font-weight: 700;
}
.workflow-card-head { display: flex; align-items: center; gap: 14px; }
.workflow-flybar {
  min-width: 86px;
  padding: 10px 12px;
  background: var(--surface-strong);
  color: #fff;
  border-radius: 2px;
  font: 800 34px/1 var(--font-mono);
  text-align: center;
}
.workflow-flybar small { display: block; margin-bottom: 4px; font: 800 9px/1 var(--font); letter-spacing: .08em; text-transform: uppercase; color: #b8c4ca; }
.workflow-card-main { flex: 1; min-width: 0; }
.workflow-card-title { font-size: 18px; font-weight: 800; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.workflow-card-sub { color: var(--text-secondary); font-size: 13px; margin-top: 3px; }
.workflow-step {
  border: 1px solid var(--section-accent, var(--axis));
  border-radius: 2px;
  padding: 8px 10px;
  background: var(--section-wash, var(--surface-2));
  color: var(--section-accent, var(--text-secondary));
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .035em;
  text-transform: uppercase;
  white-space: nowrap;
}
.workflow-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: end; margin-top: 12px; }
.workflow-note { flex: 1 1 320px; min-height: 66px; }
.workflow-message { width: 100%; margin-top: 8px; }
.packing-counts { width: 100%; display: grid; grid-template-columns: repeat(5, minmax(90px, 1fr)); gap: 10px; }
.packing-counts label { font-size: 12px; font-weight: 700; color: var(--text-secondary); }
.packing-counts input, .packing-counts textarea { margin-top: 4px; }
.packing-counts .wide { grid-column: 1 / -1; }
.packing-calculated-totals > div {
  display: grid; gap: 4px; padding: 10px 12px; border: 1px solid var(--border);
  border-radius: 7px; background: var(--surface-2);
}
.packing-calculated-totals > div span {
  color: var(--text-muted); font-size: 10px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
}
.packing-calculated-totals > div b { font-size: 20px; font-variant-numeric: tabular-nums; }
.workflow-queue-card ~ #entry-form .finish-box { display: none !important; }

@media (max-width: 720px) {
  .workflow-card-head { align-items: flex-start; flex-wrap: wrap; }
  .workflow-step { width: 100%; }
  .packing-counts { grid-template-columns: repeat(2, minmax(100px, 1fr)); }
}

/* ---- Quality: closing a load -------------------------------------------- */
/* Only shown when the entry matches a racked load. Finishing releases the
   flybar and cannot be undone, so it reads as a decision, not another field. */
.finish-box {
  margin-top: 16px;
  padding: 12px 14px;
  border: 1px solid var(--warning);
  background: var(--warning-wash);
  border-radius: 8px;
}
.finish-check {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  cursor: pointer;
  font-size: 15px;
}
.finish-check input[type="checkbox"] {
  width: 20px;
  height: 20px;
  margin-top: 2px;
  flex: none;
  accent-color: var(--critical);
}
.finish-check b { display: block; }
.finish-note {
  display: block;
  color: var(--text-secondary);
  font-size: 13px;
  margin-top: 2px;
}
.finish-warning {
  margin: 8px 0 0 30px;
  font-size: 12.5px;
  color: var(--warning-text, #8a5a00);
}

/* ---- sign-in ------------------------------------------------------------- */
/* Reading is open, so the header states plainly that you are viewing rather
   than presenting an empty login wall. */
.signin-box { display: flex; align-items: center; gap: 10px; }

.signin-who { display: flex; flex-direction: column; line-height: 1.2; }
.signin-who b { font-size: 13px; }
.signin-role {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.signin-btn { padding: 6px 12px; font-size: 13px; }

.signin-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(16, 24, 40, .55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 100;
}
.signin-panel {
  background: var(--surface-1);
  border-radius: 12px;
  box-shadow: 0 12px 40px rgba(16, 24, 40, .25);
  padding: 22px;
  width: 100%;
  max-width: 340px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.signin-panel h2 { margin: 0; font-size: 19px; }
.signin-panel .field { display: flex; flex-direction: column; gap: 4px; }
.signin-panel label { font-size: 13px; font-weight: 600; color: var(--text-secondary); }
.signin-note { margin: 0; font-size: 13px; color: var(--text-secondary); }
.signin-error { color: var(--critical); font-size: 13px; min-height: 18px; }
.signin-actions { display: flex; justify-content: flex-end; gap: 8px; }

/* ---- dialogs -------------------------------------------------------------
   Shared by the tank entry form and the plan editor.

   The [hidden] rule below is not optional. `display: flex` is an author rule and
   beats the browser's own `[hidden] { display: none }`, so without it the dialog
   can never be closed: it sits over the screen from page load with nothing in
   it, and Cancel appears to do nothing because setting .hidden has no visual
   effect at all.
   -------------------------------------------------------------------------- */
.modal-backdrop[hidden] { display: none; }

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(16, 24, 40, 0.55);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 24px 16px;
  overflow-y: auto;
  z-index: 50;
}
.modal {
  background: var(--surface-1);
  border-radius: 12px;
  box-shadow: 0 12px 40px rgba(16, 24, 40, .25);
  width: 100%;
  max-width: 700px;
  padding: 20px 22px 18px;
}
.erp-line-status { font-size: 12px; line-height: 1.4; white-space: normal; overflow-wrap: anywhere; margin-top: 6px; }
.erp-review-list { display: grid; gap: 12px; margin: 12px 0; }
.erp-review-list > div { border-bottom: 1px solid var(--border); padding: 12px 0; }
.erp-review-list input { max-width: 100%; margin: 4px; }

.modal-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 4px;
}
.modal-head h2 { margin: 0; flex: 1; }
.modal-close {
  border: 0;
  background: none;
  font-size: 26px;
  line-height: 1;
  color: var(--text-muted);
  cursor: pointer;
  padding: 2px 8px;
  border-radius: 6px;
}
.modal-close:hover { background: var(--surface-2); color: var(--text-primary); }
.modal-close:focus-visible { box-shadow: var(--focus-ring); outline: none; }


/* --- FR-14: what the plan says, while the rack is still being built ------ */
.plan-note {
  margin-top: 6px; padding: 8px 11px; border-radius: 6px;
  font-size: 13.5px; line-height: 1.45;
  border: 1px solid transparent;
}
.plan-note.is-ok {
  background: var(--ok-bg, #e6f4ea); color: var(--ok-text, #1e4620);
  border-color: var(--ok-border, #b7dfc1);
}
.plan-note.is-off {
  background: var(--warn-bg, #fdecea); color: var(--warn-text, #7f1d1d);
  border-color: var(--warn-border, #f5c2bd); font-weight: 500;
}

.scheduled-orders-card .head-row { align-items: flex-start; }
.scheduled-orders-card .card-note { margin: 4px 0 0; }
.scheduled-order-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 10px;
}
.scheduled-order {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--border);
  border-left: 6px solid var(--axis);
  border-radius: var(--radius);
  background: var(--surface-1);
  box-shadow: 0 2px 0 rgba(23, 32, 39, .08);
}
.scheduled-order .queue-rank {
  align-self: flex-start; min-width: 24px; height: 24px; display: inline-grid;
  place-items: center; border-radius: 2px; background: var(--surface-strong); color: #fff; font-weight: 800;
}
.scheduled-order.is-first { border-left-color: var(--good); }
.scheduled-order-title {
  display: flex;
  align-items: center;
  gap: 8px;
}
.scheduled-order-detail {
  min-height: 34px;
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.4;
}
.scheduled-order .btn { align-self: flex-start; }
.scheduled-order .production-order-select { width: 18px; height: 18px; align-self: flex-start; }
.scheduled-order .planned-quantity { max-width: 140px; }
.packing-order-list { width: 100%; display: grid; gap: 8px; margin-bottom: 12px; }
.packing-order-counts { display: grid; grid-template-columns: minmax(130px, 1.5fr) repeat(5, minmax(72px, 1fr)); gap: 8px; align-items: end; padding: 10px; border: 1px solid var(--border); border-radius: 6px; }
.packing-order-counts strong { font-size: 13px; padding-bottom: 9px; }
.packing-order-counts label { font-size: 11px; color: var(--text-secondary); }
.packing-order-counts input { margin-top: 3px; }
.station-order-breakdown { display: grid; gap: 4px; margin-top: 10px; max-width: 720px; }
.station-order-row {
  display: grid; grid-template-columns: minmax(140px, 1.4fr) minmax(90px, .7fr) minmax(90px, .7fr);
  gap: 10px; padding: 7px 10px; border-radius: 6px; background: var(--surface-2);
  font-size: 12px;
}
.station-order-row span { color: var(--text-secondary); }
.quantity-line {
  display: grid; grid-template-columns: minmax(180px, 1.4fr) minmax(90px, .5fr) minmax(110px, .6fr);
  gap: 14px; align-items: end; padding: 12px 0; border-bottom: 1px solid var(--border);
}
.quantity-identity, .quantity-readonly { display: grid; gap: 3px; }
.quantity-identity span, .quantity-readonly span { color: var(--text-secondary); font-size: 12px; }
.quantity-readonly b { font-size: 18px; }
.quantity-input { margin: 0; }
.quantity-total {
  display: flex; align-items: center; justify-content: flex-end; gap: 18px;
  padding: 14px; margin-top: 10px; border-radius: var(--radius); background: var(--surface-strong); color: #fff;
}
.quantity-total span { color: #bdc8ce; font-weight: 700; }

.row.actions {
  position: sticky;
  bottom: 0;
  z-index: 10;
  justify-content: flex-end;
  padding: 14px;
  border: 1px solid var(--border);
  border-bottom: 0;
  background: color-mix(in srgb, var(--surface-1) 94%, transparent);
  box-shadow: 0 -8px 24px rgba(23, 32, 39, .1);
  backdrop-filter: blur(8px);
}
.row.actions .btn.primary { min-width: 180px; }
.quantity-total b { font-size: 24px; font-variant-numeric: tabular-nums; }
@media (max-width: 760px) {
  .packing-order-counts { grid-template-columns: 1fr 1fr; }
  .packing-order-counts strong { grid-column: 1 / -1; }
  .quantity-line, .station-order-row { grid-template-columns: 1fr 1fr; }
  .quantity-identity, .station-order-row strong { grid-column: 1 / -1; }
}

/* ---------------------------------------------------------------------------
   Racking board: flybars on the left (the selected one expands in place),
   eligible orders on the right.
   --------------------------------------------------------------------------- */
.rack-board {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) minmax(260px, 1fr);
  gap: 16px;
  align-items: start;
}
.rack-bars {
  max-height: calc(100vh - 220px);
  overflow-y: auto;
  border-top: 1px solid var(--border);
}
.rack-bar { border-bottom: 1px solid var(--border); }
.rack-bar-head {
  display: flex; align-items: center; gap: 12px; width: 100%;
  padding: 12px 10px; min-height: 52px;
  background: none; border: 0; text-align: left; font: inherit; color: var(--text-primary);
  cursor: pointer;
}
.rack-bar-head:hover:not(:disabled) { background: var(--surface-2); }
.rack-bar-head:disabled { cursor: not-allowed; color: var(--text-muted); }
.rack-bar-no {
  min-width: 44px; font-size: 1.35rem; font-weight: 700; font-variant-numeric: tabular-nums;
}
.rack-bar-sum { color: var(--text-secondary); }
.rack-bar.has-load .rack-bar-sum { color: var(--text-primary); font-weight: 600; }
.rack-bar.stage-racking .rack-bar-no { color: var(--warning-text, #8a5a00); }
.rack-bar.is-open { background: var(--surface-2); }
.rack-bar.is-open .rack-bar-head { font-weight: 600; }
.rack-bar-body { padding: 4px 12px 14px 12px; }
.rack-load-head { font-weight: 600; margin-bottom: 8px; }
.rack-picked { display: grid; gap: 8px; margin: 8px 0; }
.rack-picked-row {
  display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: flex-end;
  padding: 8px; border: 1px solid var(--border); border-radius: 6px; background: var(--surface-1);
}
.rack-picked-info { flex: 1 1 200px; min-width: 0; }
.rack-picked-info .tag { margin-right: 6px; }
.rack-qty { width: 130px; margin: 0; }
.rack-qty input { width: 100%; }
.rack-count.is-invalid { border-color: var(--critical); }
.rack-count-done { font-weight: 600; white-space: nowrap; }
.rack-exception {
  margin-top: 4px; padding: 4px 8px; border-radius: 4px;
  background: var(--warning-wash); color: var(--warning-text, #8a5a00); font-size: .9rem;
}
.rack-orders { max-height: calc(100vh - 160px); overflow-y: auto; }
.rack-group { margin: 16px 0 8px; font-size: 1rem; }
.rack-order {
  display: block; width: 100%; margin-bottom: 8px; padding: 10px 12px;
  text-align: left; font: inherit; color: var(--text-primary);
  background: var(--surface-1); border: 1px solid var(--border); border-radius: 6px; cursor: pointer;
}
.rack-order:hover:not(:disabled) { border-color: var(--text-secondary); }
.rack-order:disabled { cursor: default; opacity: .55; }
.rack-order.is-picked { opacity: .55; }
.rack-order-title { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.rack-order-customer {
  display: inline-flex; align-items: center; max-width: 100%;
  padding: 2px 7px; border: 1px solid var(--axis); border-radius: 4px;
  background: var(--surface-2); color: var(--text-primary);
  font-size: .78rem; font-weight: 700; line-height: 1.25;
}
.rack-order-qty { margin-left: auto; color: var(--text-secondary); font-variant-numeric: tabular-nums; }
.rack-order-desc { margin-top: 2px; font-size: .9rem; color: var(--text-secondary); }

@media (max-width: 640px) {
  .rack-board { grid-template-columns: 1fr; }
  .rack-bars, .rack-orders { max-height: none; }
  .rack-bar-body { padding-left: 12px; }
}

/* ---------------------------------------------------------------------------
   Quality / Packing: queue on the left, the selected load on the right.
   --------------------------------------------------------------------------- */
.packing-board {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) minmax(320px, 1.4fr);
  gap: 16px;
  align-items: start;
}
.packing-board .workflow-queue { max-height: calc(100vh - 240px); overflow-y: auto; }
button.workflow-card {
  display: block; width: 100%; text-align: left; font: inherit; color: inherit; cursor: pointer;
}
button.workflow-card:hover { border-color: var(--text-secondary); }
.workflow-card.is-selected { outline: 3px solid var(--section-accent, var(--axis)); outline-offset: 1px; }
.workflow-step.step-held { color: var(--critical); font-weight: 700; }
.workflow-step.step-ready { color: var(--good, inherit); font-weight: 700; }
.packing-panel #packing-load h2 .tag { margin-left: 8px; vertical-align: middle; }
.packing-panel .quality-form { margin-top: 16px; border-top: 1px solid var(--border); padding-top: 12px; }
.packing-panel .quality-form input[readonly] { background: var(--surface-2); }
/* From the queue, a load is closed by Complete Packing, not by the form. */
.quality-form.from-queue #finish-box { display: none !important; }
.packing-step-card { margin-top: 16px; border-top: 1px solid var(--border); padding-top: 12px; }
.packing-step-card .workflow-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.packing-step-card .workflow-note { width: 100%; min-height: 60px; }
.packing-step-card .packing-note { display: block; margin-top: 10px; }
.packing-step-card .packing-note textarea { display: block; width: 100%; }
@media (max-width: 640px) {
  .packing-board { grid-template-columns: 1fr; }
  .packing-board .workflow-queue { max-height: none; }
}

.rack-shift { max-width: 180px; margin: 8px 0 0; }

/* ---------------------------------------------------------------------------
   One layout for every station: the queue on the left, the selected load on
   the right, the same proportions and the same point where they stack. The
   main action (Start Racking, Start Anodizing, Save Entry, Complete) is the
   primary button at the foot of the right-hand panel, full size.
   --------------------------------------------------------------------------- */
.rack-board, .anodize-board, .packing-board {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) minmax(340px, 1.4fr);
  gap: 16px;
  align-items: start;
}
.rack-board .btn.primary, .anodize-board .btn.primary, .packing-board .btn.primary {
  min-height: 48px; padding-inline: 22px; font-size: 16px;
}
@media (max-width: 900px) {
  .rack-board, .anodize-board, .packing-board { grid-template-columns: 1fr; }
  .rack-bars, .rack-orders, .packing-board .workflow-queue { max-height: none; }
  .tank-panel { position: static; }
}

/* Queue cards: flybar, customer and wait first, order detail second. */
.tank-card .tank-title, .workflow-card .workflow-card-title { font-size: 18px; font-weight: 800; line-height: 1.25; }
.tank-card .tank-sub, .workflow-card .workflow-card-sub { font-size: 13px; color: var(--text-secondary); margin-top: 2px; }
.card-wait { font-size: 14px; font-weight: 700; color: var(--text-primary); margin-top: 2px; font-variant-numeric: tabular-nums; }

/* Racking list on the Racking board */
.rack-list-card { margin-bottom: 16px; }
.rack-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; counter-reset: rl; }
.rack-list-item { counter-increment: rl; display: flex; align-items: center; gap: 12px; padding: 10px 12px;
  border: 1px solid var(--border); border-left: 5px solid var(--border); border-radius: 8px; background: var(--surface-1); }
.rack-list-item::before { content: counter(rl); font: 800 20px/1 var(--font); color: var(--text-muted); min-width: 24px; }
.rack-list-item.is-next { border-left-color: var(--good); background: var(--good-wash); }
.rack-list-item.is-next::after { content: none; }
.rack-list-main { flex: 1; min-width: 0; }
.rack-list-bar { font-size: 20px; font-weight: 800; }
.rack-list-cust { font-weight: 700; }
.rack-list-orders { font-size: 13px; color: var(--text-secondary); overflow-wrap: anywhere; }
.rack-list-act { display: flex; gap: 8px; align-items: center; }
.rack-list-act select { width: auto; min-width: 110px; }
@media (max-width: 640px) { .rack-list-item { flex-wrap: wrap; } .rack-list-act { width: 100%; } }

/* Order picker filters: All / Critical / Urgent / Production */
.rack-filters { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 10px; }
.rack-filters .btn.is-on { background: var(--accent); border-color: var(--accent); color: #fff; }

/* Racking: priority orders on the right side */
.rack-priorities { display: grid; gap: 8px; }
.rack-priorities h3.prio-critical { color: var(--critical); }
.rack-priorities h3.prio-urgent { color: var(--warning-text, #8a5a00); }
.rack-prio-item { border: 1px solid var(--border); border-left: 5px solid var(--border); border-radius: 8px;
  padding: 8px 10px; background: var(--surface-1); }
.rack-priorities h3.prio-critical ~ .rack-prio-item { border-left-color: var(--critical); }
.rack-prio-item.is-waiting { background: var(--warning-wash); }
.rack-prio-where { font-weight: 700; margin-top: 2px; }
.rack-list-item.prio-critical:not(.is-next) { border-left-color: var(--critical); }
.rack-list-item.prio-urgent:not(.is-next) { border-left-color: var(--warning); }

/* Selected flybar section sits below the priority orders */
.rack-bar-heading { margin-top: 18px; padding-top: 12px; border-top: 2px solid var(--border); }

/* COO: Racking bars as queue-style cards, compact Available group, one Orders list */
.floor-bar { grid-template-columns: 1fr; }
.rack-bar.queue-card { border: 1px solid var(--border); border-left: 5px solid var(--series-1); border-radius: 8px; margin: 0 0 8px; background: var(--surface-1); }
.rack-bar.queue-card.is-priority { border-left-color: var(--critical); background: var(--critical-wash); }
.rack-bar.queue-card.prio-urgent { border-left-color: var(--warning); background: var(--warning-wash); }
.rack-bar.queue-card.is-stuck:not(.is-priority) { border-left-color: var(--critical); }
.rack-bar-sum { display: grid; gap: 2px; text-align: left; }
.rack-card-top { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.rack-card-sub { font-size: 13px; font-weight: 400; color: var(--text-secondary); }
.tag.stuck { background: var(--critical); color: #fff; }
.rack-available .rack-bar-head { padding-top: 6px; padding-bottom: 6px; }
.rack-counts { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 8px; }
.rack-count-tag { font-weight: 800; font-variant-numeric: tabular-nums; }
.rack-count-tag.critical { color: var(--critical); }
.rack-count-tag.urgent { color: var(--warning-text, #8a5a00); }
.rack-group.prio-critical { color: var(--critical); }
.rack-group.prio-urgent { color: var(--warning-text, #8a5a00); }

/* The racking header "Racked by" box is superseded by the Racking operators picker. */
.identity[hidden] { display: none; }
.rack-planned { font-size: 1.15em; }

/* Planned is the number the rack is built to, so it is the largest thing on the load panel. */
.rack-planned-banner { display: flex; align-items: flex-end; gap: 28px; margin: 10px 0 12px; padding: 12px 18px;
  border: 3px solid var(--accent, #156fa8); border-radius: 12px; background: var(--accent-soft, #e8f2fa); }
.rack-planned-banner .lbl { font-size: 12px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.rack-planned-banner .num { font-weight: 900; line-height: 1; }
.rack-planned-main .num { font-size: 56px; color: var(--accent, #156fa8); }
.rack-planned-side .num { font-size: 30px; }
.rack-order-planned { margin-left: auto; padding: 2px 8px; border-radius: 6px; font-weight: 800;
  color: #fff; background: var(--accent, #156fa8); }
.tag.priority.erp-priority { background: var(--urgent, #b45309); color: #fff; }

/* Orders whose finish differs from the rack: dimmed, still clickable for the explanation pop-up. */
.rack-order.is-finish-incompatible { opacity: .5; background: #eef0f2; }
.rack-order.is-finish-incompatible::after {
  content: attr(data-finish-note); display: block; margin-top: 4px;
  font-size: 12px; font-weight: 700; color: #8a4b00;
}
