/*
 * Shared theme for the web edition, deliberately reusing the exact colors
 * from the Java desktop app (see MainMenu.java / ForkliftChecklist.java
 * constants) so the two apps read as the same product. Mobile-first: base
 * rules target a phone-width viewport, and the min-width media query below
 * widens things up for desktop - one responsive codebase, not two separate
 * apps, which is what "desktop view and mobile view" means in a browser
 * (see WEB_PROJECT_NOTES.md).
 */

:root {
  --bg-top: #050a14;
  --bg-bottom: #142840;
  --panel-bg: rgba(0, 0, 0, 0.35);
  --row-bg: rgba(0, 0, 0, 0.35);
  --item-bar: #2e6da4;
  --item-bar-hover: #4fc3f7;
  --item-text: #ffffff;
  --title-color: #ffffff;
  --label-color: #b0c4de;
  --muted-text: #7c93ac;
  --accent: #4fc3f7;
  --confirm-green: #2e7d32;
  --warning-red: #c62828;
  --border-color: #969696;
  --checked-row: #c8e6c9;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  font-family: -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: linear-gradient(180deg, var(--bg-top), var(--bg-bottom));
  color: var(--item-text);
}

a {
  color: inherit;
}

/*
 * Two-column grid (back-link | title) rather than an absolutely positioned
 * back-link over a full-width centered title: at narrow (mobile) widths a
 * truly centered h1 sits close enough to the left edge to overlap the
 * back-link, since "MAIN MENU" and the page title both want the same space.
 * `auto` on the back-link column sizes it to its own text (so it can never
 * overflow into the title's column) and the title centers itself with
 * text-align within the remaining space - not perfectly centered on the
 * full width, but the point is no overlap, and in practice it reads fine
 * since "MAIN MENU" is short.
 */
.top-bar {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  padding: 14px 16px 10px;
  gap: 10px;
}

.top-bar .back-link {
  color: var(--label-color);
  font-weight: 700;
  font-size: 0.85rem;
  text-decoration: none;
  cursor: pointer;
  padding: 6px 4px;
  white-space: nowrap;
}

.top-bar .back-link:hover {
  color: #fff;
}

.top-bar h1 {
  min-width: 0;
  font-size: 1.15rem;
  margin: 0;
  text-align: center;
}

@media (max-width: 480px) {
  .top-bar h1 {
    font-size: 0.95rem;
  }
}

/* ---- Main menu ---- */

.menu-wrap {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  padding: 24px 16px;
  justify-content: flex-end;
}

.menu-box {
  background: var(--panel-bg);
  border-radius: 10px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.menu-item {
  display: block;
  background: var(--item-bar);
  color: var(--item-text);
  font-weight: 700;
  font-size: 1rem;
  text-decoration: none;
  padding: 14px 18px;
  border-radius: 4px;
  letter-spacing: 0.02em;
}

.menu-item:hover, .menu-item:focus-visible {
  background: var(--item-bar-hover);
}

.menu-item.disabled {
  background: rgba(255, 255, 255, 0.08);
  color: var(--muted-text);
  cursor: default;
  pointer-events: none;
}

.menu-title {
  text-align: right;
  margin-top: 20px;
}

.menu-title h2 {
  margin: 0;
  font-size: 1.8rem;
}

.menu-title p {
  margin: 2px 0 0;
  color: var(--accent);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
}

/* ---- Generic screen shell ---- */

.screen {
  max-width: 640px;
  margin: 0 auto;
  padding: 20px 16px 60px;
}

.center-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: 40px;
  gap: 14px;
}

input[type="text"], input[type="password"], textarea {
  width: 100%;
  max-width: 280px;
  background: #0e1e30;
  color: #fff;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  padding: 10px 12px;
  font-size: 1rem;
  font-family: "SFMono-Regular", Consolas, monospace;
  text-align: center;
}

textarea {
  max-width: 100%;
  font-family: inherit;
  text-align: left;
  min-height: 70px;
  resize: vertical;
}

button {
  font-size: 0.95rem;
  font-weight: 700;
  padding: 10px 18px;
  border-radius: 4px;
  border: 1px solid var(--border-color);
  background: #fff;
  color: #222;
  cursor: pointer;
}

button:disabled {
  opacity: 0.45;
  cursor: default;
}

button.primary {
  color: var(--confirm-green);
}

button.warning {
  color: var(--warning-red);
}

.status-line {
  min-height: 1.2em;
  font-size: 0.9rem;
  color: var(--muted-text);
  text-align: center;
}

.status-line.error {
  color: var(--warning-red);
}

.status-line.success {
  color: var(--confirm-green);
}

.checklist-rows {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 16px 0;
}

.checklist-row {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #fff;
  color: #222;
  border-radius: 4px;
  padding: 10px 14px;
  cursor: pointer;
  font-size: 0.92rem;
  user-select: none;
}

.checklist-row.checked {
  background: var(--checked-row);
}

.checklist-row .mark {
  font-family: monospace;
  font-weight: 700;
  width: 2.4em;
}

.notes-block {
  margin: 10px 0 4px;
}

.notes-block label {
  display: block;
  color: var(--label-color);
  font-size: 0.85rem;
  margin-bottom: 4px;
}

.action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: space-between;
  align-items: center;
  margin-top: 14px;
}

.action-row .buttons {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.back-to-scan-link {
  color: var(--label-color);
  font-weight: 700;
  font-size: 0.85rem;
  cursor: pointer;
  text-decoration: none;
}

.back-to-scan-link:hover {
  color: #fff;
}

/* ---- Login log rows ---- */

.log-rows {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.log-empty {
  color: var(--muted-text);
  text-align: center;
  margin-top: 40px;
}

.log-row {
  background: var(--row-bg);
  border-radius: 8px;
  padding: 10px 14px;
}

.log-row-header {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  align-items: baseline;
}

.log-row .timestamp {
  color: var(--muted-text);
  font-family: monospace;
  font-size: 0.8rem;
}

.log-row .badge {
  color: var(--accent);
  font-weight: 700;
  font-size: 0.85rem;
}

.log-row .description {
  color: #fff;
  font-size: 0.9rem;
}

.log-row .description.bad {
  color: var(--warning-red);
  font-weight: 700;
}

.log-row .notes {
  color: var(--muted-text);
  font-size: 0.85rem;
  margin-top: 6px;
}

/* ---- Login page ---- */

.login-wrap {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  padding: 24px;
}

.login-card {
  width: 100%;
  max-width: 320px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--panel-bg);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 28px 24px;
}

.login-card h1 {
  margin: 0;
  text-align: center;
  font-size: 1.3rem;
}

.login-subtitle {
  margin: 0 0 10px;
  text-align: center;
  color: var(--label-color);
  font-size: 0.9rem;
}

.login-card label {
  font-size: 0.85rem;
  color: var(--label-color);
}

.login-card input {
  max-width: none;
  text-align: left;
}

.login-card button {
  margin-top: 6px;
}

/* ---- Record screen ---- */

.record-instructions {
  text-align: center;
  color: var(--label-color);
  font-size: 0.9rem;
  max-width: 520px;
  margin: 0 auto 20px;
}

.record-card {
  background: rgba(0, 0, 0, 0.35);
  border-radius: 10px;
  padding: 22px 16px 26px;
  max-width: 560px;
  margin: 0 auto;
}

.mode-buttons {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 12px;
}

.mode-button {
  font-size: 0.78rem;
  font-weight: 700;
  padding: 8px 14px;
  border-radius: 6px;
  border: 1px solid var(--border-color);
  background: var(--item-bar);
  color: #fff;
  cursor: pointer;
}

.mode-button:hover {
  background: #3a82b8;
}

.mode-button.active {
  background: var(--accent);
  color: #0a1a2a;
}

.mode-button.danger {
  background: #6e2e2c;
}

.mode-button.danger:hover {
  background: var(--warning-red);
}

.scan-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: center;
  gap: 18px;
  margin-top: 10px;
}

.field-group {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.field-group label {
  color: var(--label-color);
  font-weight: 700;
  font-size: 0.78rem;
  letter-spacing: 0.03em;
}

.scan-field {
  width: 190px;
  max-width: 100%;
  background: #0e1e30;
  color: #fff;
  border: 1px solid var(--item-bar);
  border-radius: 4px;
  padding: 10px 12px;
  font-size: 1rem;
  font-family: "SFMono-Regular", Consolas, monospace;
  text-align: center;
}

.scan-field.error {
  border: 2px solid var(--warning-red);
}

.transfer-arrow {
  color: var(--accent);
  font-weight: 700;
  font-size: 1.4rem;
  align-self: center;
  margin-top: 28px;
}

.chain-button {
  align-self: center;
  margin-top: 22px;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: none;
  background: var(--item-bar);
  color: #fff;
  font-size: 1.3rem;
  font-weight: 700;
  cursor: pointer;
  flex-shrink: 0;
}

.chain-button:hover:not(:disabled) {
  background: var(--accent);
}

.chain-button:disabled {
  background: #2e4054;
  color: #5c7084;
  cursor: default;
}

.record-status {
  margin-top: 18px;
}

/* ---- Card Log ---- */

.card-log-row {
  background: rgba(0, 0, 0, 0.35);
  border-radius: 8px;
  padding: 10px 14px;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px 16px;
}

.card-log-row .timestamp {
  color: var(--muted-text);
  font-family: monospace;
  font-size: 0.78rem;
}

.card-log-row .badge {
  font-weight: 700;
  font-size: 0.75rem;
  min-width: 66px;
}

.card-log-row .description {
  color: #fff;
  font-size: 0.9rem;
}

.badge-pallet { color: #66bb6a; }
.badge-ghost { color: #b0b0b0; }
.badge-empty { color: #90a4ae; }
.badge-transfer { color: var(--accent); }

/* ---- Rack Run Visual ---- */
/*
 * Colors copied 1:1 from RackRunVisual.java / RackSlot.java's constants
 * (HEADER_TEXT #D0D8E0, PALLET_PRESENT_COLOR #81C784, card LABEL_COLOR
 * #222222 - the rest already match this file's shared --label-color /
 * --item-bar / --accent / --border-color tokens).
 *
 * Sizing mirrors CARD_WIDTH/CARD_HEIGHT (45x70) and SYMBOL_SIZE (26) from
 * RackSlot.java. Per-column spacing (2px within a position's A/B(/C)
 * group, 7px between groups) is applied as an inline margin-left per
 * cell computed by rack-run-visual.js's marginLeftsFor() - the JS
 * equivalent of RackRunVisual.leftGapFor().
 *
 * Unlike the Java app (JScrollPane with horizontal scrolling disabled -
 * it assumes a wide kiosk/desktop window), a rack section's row is wider
 * than most phones AND many desktop windows (35 columns at 45px + margins,
 * ~1780px), and a physical rack's address layout can't reflow to fit a
 * narrower width without losing its meaning (see WEB_PROJECT_NOTES.md).
 * Rather than force horizontal scrolling to see a full row, .rack-grid is
 * rendered at its natural size and then scaled down as a whole (see
 * #rackGridScale below and applyGridScale() in rack-run-visual.js) so an
 * entire row always fits the visible frame's width, on desktop and
 * mobile alike - the same "fit to width" a slide/PDF viewer does. Only
 * the vertical dimension still scrolls, same as before.
 */

/*
 * JS measures #rackGrid's real (natural, unscaled) size and sets both
 * this wrapper's width/height and #rackGrid's `transform: scale(...)` to
 * match - the wrapper exists so .rack-scroll's own scrollable area is
 * based on the *scaled* footprint (what a transform actually paints)
 * rather than #rackGrid's unscaled layout box, which browsers don't
 * shrink just because a transform is drawing it smaller.
 */
.rack-grid-scale {
  /* Must clip, not just size, its child: #rackGrid's own layout box is
     still its full natural (unscaled) width/height - only its paint is
     smaller, via transform - so without clipping here, that unscaled box
     leaks into .rack-scroll's scrollable-overflow calculation and brings
     back a horizontal scrollbar despite the visual fit. */
  overflow: hidden;
}

#rackGrid {
  transform-origin: top left;
}

/*
 * The fix for "doesn't scale to window": .rack-scroll previously had
 * overflow:auto but no height limit of its own, so it just grew to fit
 * ~8,000px of grid content and the whole *page* scrolled as one long
 * document - the header/toggle/view-switcher scrolled away with
 * everything else instead of staying put, on both desktop and mobile.
 * .rack-page pins the page to exactly the viewport height and gives
 * .rack-scroll (via flex: 1 + min-height: 0, the standard fix for a flex
 * child that needs to scroll instead of growing) all the space that's
 * left after the header stack - so the grid scrolls in its own box while
 * MAIN MENU / the view switcher / the display toggle stay visible.
 */
.rack-page {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
}

.view-switcher {
  display: flex;
  justify-content: center;
  gap: 10px;
  padding: 6px 16px 0;
  flex-wrap: wrap;
}

.view-switcher a {
  color: var(--label-color);
  font-size: 0.78rem;
  font-weight: 700;
  text-decoration: none;
  padding: 4px 2px;
  border-bottom: 2px solid transparent;
}

.view-switcher a.active {
  color: #fff;
  border-bottom-color: var(--accent);
}

.view-switcher a:hover {
  color: #fff;
}

.rack-toolbar {
  display: flex;
  justify-content: center;
  padding: 4px 16px 12px;
}

.display-toggle {
  display: flex;
  border: 1px solid var(--item-bar);
  border-radius: 6px;
  overflow: hidden;
}

.toggle-segment {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  padding: 8px 14px;
  border: none;
  border-radius: 0;
  background: var(--item-bar);
  color: #fff;
}

.toggle-segment.active {
  background: var(--accent);
  color: #0a1a2a;
}

.rack-scroll {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 0 16px 40px;
}

.rack-loading {
  color: var(--label-color);
  text-align: center;
  padding: 40px 0;
}

.rack-grid {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
}

.rack-section {
  padding: 0 0 26px;
}

.rack-section-title {
  color: var(--title-color);
  font-weight: 700;
  font-size: 0.92rem;
  margin-bottom: 6px;
}

.rack-row {
  display: flex;
  align-items: stretch;
  margin: 1px 0;
}

.rack-row-label {
  flex: 0 0 26px;
  width: 26px;
  margin-right: 6px;
  color: var(--label-color);
  font-weight: 700;
  font-size: 0.7rem;
  display: flex;
  align-items: center;
  justify-content: flex-end;
}

.rack-header-cell {
  flex: 0 0 45px;
  width: 45px;
  color: #d0d8e0;
  font-size: 0.6rem;
  text-align: center;
}

.rack-filler {
  flex: 0 0 45px;
  width: 45px;
}

.rack-cell {
  flex: 0 0 45px;
  width: 45px;
  height: 70px;
  background: #fff;
  border: 1px solid var(--border-color);
  cursor: pointer;
  position: relative;
  perspective: 300px;
}

.rack-cell.occupied {
  background: #81c784;
}

/*
 * RackSlot.java's refreshBackground() shades a Ghost or Empty card the same
 * single "needs attention" yellow (NEEDS_ATTENTION_COLOR, 0xFFE066) - this
 * background-shading itself was never ported to the web app at all until
 * now. Jacob asked for two distinct colors here instead of Java's shared
 * one - Ghost orange, Empty pink - so a glance at the grid tells the two
 * apart without opening a card's detail. A deliberate difference from the
 * Java app, not a bug to reconcile back to it.
 */
.rack-cell.ghost-card {
  background: #ffb74d;
}

.rack-cell.empty-card {
  background: #f48fb1;
}

/*
 * Port of RackSlot.java's flip animation (flipToFaceDown()/flipToFaceUp(),
 * FLIP_DURATION_MS = 260, paintFlippingCard()'s horizontal squeeze): a
 * click flips the card face-down to its back-of-card logo before the
 * detail modal opens, and flips it back face-up once the modal closes
 * (see rack-run-visual.js's flipDown()/flipUp()). Java hand-paints a
 * scaled snapshot every frame to fake this in Swing; a real
 * `transform: rotateY()` 3D flip does the same thing natively, so
 * .card-inner is what actually rotates and .card-face-front/-back are
 * its two sides, each hidden when facing away from the viewer.
 */
.card-inner {
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  transition: transform 260ms linear;
}

.rack-cell.flipped .card-inner {
  transform: rotateY(180deg);
}

.card-face-front,
.card-face-back {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

.card-face-back {
  transform: rotateY(180deg);
  background: var(--item-bar) center/55% no-repeat url(/icons/card_back_logo.png);
}

.rack-cell .face {
  display: none;
  width: 100%;
  height: 100%;
  align-items: center;
  justify-content: center;
}

.rack-grid[data-mode="SYMBOL"] .face-symbol { display: flex; }
.rack-grid[data-mode="RACK_SLOT"] .face-rackslot { display: flex; }
.rack-grid[data-mode="PALLET_ID"] .face-palletid { display: flex; }

.face-symbol {
  background-size: 26px 26px;
  background-repeat: no-repeat;
  background-position: center;
}

.face-symbol.type-GENESIS { background-image: url(/icons/genesis_helix.png); }
.face-symbol.type-EMPTY { background-image: url(/icons/vacant_door.png); }
.face-symbol.type-GHOST { background-image: url(/icons/ghost_logo.png); }
.face-symbol.type-PALLET_ID { background-image: url(/icons/pallet_box.png); }

.face-rackslot {
  flex-direction: column;
  color: #222;
  font-weight: 700;
  font-size: 0.62rem;
  line-height: 1.15;
  text-align: center;
}

.face-palletid {
  color: #222;
  font-weight: 700;
  font-size: 0.6rem;
  text-align: center;
  padding: 0 2px;
  word-break: break-word;
}

/* ---- Card / pallet-contents detail modals ---- */

.modal-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 10;
}

.modal-backdrop.open {
  display: flex;
}

.detail-card {
  background: #fff;
  border: 2px solid var(--border-color);
  border-radius: 4px;
  width: 100%;
  max-width: 340px;
  padding: 12px 16px 20px;
}

.detail-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 0 10px;
  border-bottom: 1px solid #eee;
  margin-bottom: 8px;
}

.detail-card-title {
  font-weight: 700;
  font-size: 0.95rem;
  color: #333;
}

.detail-card-icon {
  width: 32px;
  height: 32px;
  object-fit: contain;
}

.detail-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 6px 0;
  font-size: 0.85rem;
  color: #111;
}

.detail-row span:first-child {
  font-weight: 700;
  color: #333;
}

.detail-parts-header {
  font-weight: 700;
  color: #333;
  font-size: 0.85rem;
  margin: 6px 0 2px;
}

.pallet-id-link {
  color: #1a54c4;
  text-decoration: underline;
  cursor: pointer;
}

/* Rows shown only for an "own" (Record-screen-sourced) vs. a Parcel
   Hub-sourced card - see rack-run-visual.js's openOwnCardDetail() /
   openParcelhubCardDetail(). */
.detail-row.row-own,
.detail-row.row-parcelhub {
  display: none;
}

.detail-card.mode-own .row-own {
  display: flex;
}

.detail-card.mode-parcelhub .row-parcelhub {
  display: flex;
}

/* ---- Parcel Hub sync bar (parcelhub/combined Rack Run Visual pages) ---- */

.parcelhub-syncbar {
  max-width: 640px;
  margin: 0 auto 6px;
  padding: 8px 16px 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px 14px;
  text-align: center;
}

.parcelhub-syncbar span {
  color: var(--label-color);
  font-size: 0.8rem;
}

.parcelhub-syncbar button {
  font-size: 0.75rem;
  padding: 6px 12px;
}

/* ---- Session badge (logged-in-as / log out, shown in the top bar) ---- */

.session-badge {
  grid-column: 3;
  justify-self: end;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  color: var(--muted-text);
  white-space: nowrap;
}

.session-badge button {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 4px 10px;
  color: var(--label-color);
  background: transparent;
  border-color: var(--muted-text);
}

/* ---- Desktop widening ---- */

@media (min-width: 720px) {
  .menu-wrap {
    padding: 60px;
  }

  .menu-box {
    max-width: 380px;
  }

  .screen {
    padding-top: 30px;
  }

  input[type="text"] {
    max-width: 320px;
  }
}

/* ---- Pre-Receive wizard views + shared lane picker (Pre-Receive screen and Inbound Visual's truck-icon modal both use .lane-row*) ---- */

.wizard-subtitle {
  color: var(--label-color);
  font-size: 0.85rem;
  margin: 0;
}

.wizard-hint {
  color: var(--muted-text);
  font-size: 0.8rem;
  text-align: center;
  margin: 0 0 10px;
}

.lane-rows {
  display: flex;
  flex-direction: column;
  gap: 3px;
  max-height: 260px;
  overflow-y: auto;
  margin-bottom: 6px;
}

.lane-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #fff;
  color: #222;
  border-radius: 4px;
  padding: 8px 12px;
  font-size: 0.88rem;
  cursor: pointer;
  user-select: none;
}

.lane-row.selected {
  background: #bbdefb;
}

.lane-row-remove {
  color: var(--warning-red);
  font-weight: 700;
}

/* ---- Inbound Visual ---- */

.inbound-page {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
}

.inbound-body {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.inbound-scroll {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 16px;
}

.inbound-loading {
  color: var(--label-color);
  text-align: center;
  padding: 40px 0;
}

/* Same "measure the natural size, scale the whole thing down to fit" trick
   as Rack Run Visual's #rackGridScale/#rackGrid (see the comment there) -
   deliberately duplicated per-screen, not shared. */
.inbound-grid-scale {
  overflow: hidden;
}

#inboundGrid {
  transform-origin: top left;
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
}

.inbound-row {
  display: flex;
  align-items: center;
  margin: 1px 0;
}

.inbound-row-label {
  flex: 0 0 64px;
  width: 64px;
  padding-right: 8px;
  color: var(--label-color);
  font-weight: 700;
  font-size: 0.75rem;
  text-align: right;
}

.inbound-header-cell {
  flex: 0 0 45px;
  width: 45px;
  margin-left: 3px;
  color: #d0d8e0;
  font-size: 0.6rem;
  text-align: center;
}

.inbound-row-header .inbound-row-label {
  height: 16px;
}

.inbound-truck-header {
  flex: 0 0 48px;
  width: 48px;
  margin-left: 10px;
}

.inbound-cell {
  flex: 0 0 45px;
  width: 45px;
  height: 70px;
  margin-left: 3px;
  background: #fff;
  border: 1px solid var(--border-color);
  position: relative;
}

/* The "yellow traffic cone" Unload card (Jacob's request) - a plain white
   card becomes this, clickable, once a completed prereceive lands on it
   (see inbound-visual.js's placeUnloadCards()). Drawn with CSS shapes
   instead of an image, same reasoning as TruckIcon.java's hand-drawn
   Graphics2D shapes: there's no cone artwork among this app's existing
   icons. */
.inbound-cell.filled {
  cursor: pointer;
}

.inbound-cell.filled::before {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 11px solid transparent;
  border-right: 11px solid transparent;
  border-bottom: 22px solid #ffc107;
}

.inbound-cell.filled::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 14px;
  transform: translateX(-50%);
  width: 26px;
  height: 5px;
  background: #8a6d00;
  border-radius: 2px;
}

.truck-icon {
  flex: 0 0 48px;
  width: 48px;
  height: 70px;
  margin-left: 10px;
  padding: 0;
  border: none;
  background: none;
  color: var(--label-color);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.truck-icon:hover {
  color: #fff;
}

.truck-icon-svg {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
}

.truck-icon-svg circle {
  fill: currentColor;
  stroke: none;
}

/* ---- Pre-receive sessions panel ---- */

.sessions-panel {
  border-top: 1px solid #0a1828;
  padding: 16px;
  display: flex;
  flex-direction: column;
  min-height: 0;
  /* Bounded on mobile (where .inbound-body stacks in a column and this
     panel isn't otherwise height-constrained) so a long session list
     scrolls within itself instead of pushing the page past 100dvh and
     making the whole document scroll - the exact "header scrolls away"
     bug the Rack Run Visual fix (see .rack-page) exists to avoid. The
     min-width:720px rule below replaces this with a full flex stretch. */
  max-height: 260px;
}

.sessions-title {
  color: var(--title-color);
  font-weight: 700;
  font-size: 0.85rem;
}

.sessions-count {
  color: var(--accent);
  font-weight: 700;
  font-size: 0.78rem;
  margin-top: 4px;
}

.sessions-rows {
  margin-top: 10px;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.sessions-empty {
  color: var(--muted-text);
  text-align: center;
  font-size: 0.82rem;
  padding-top: 20px;
}

.session-row {
  background: var(--row-bg);
  border-radius: 8px;
  padding: 8px 10px;
}

.session-truck {
  color: var(--accent);
  font-weight: 700;
  font-size: 0.78rem;
}

.session-lanes {
  color: #fff;
  font-weight: 700;
  font-size: 0.85rem;
  margin: 3px 0;
}

.session-detail {
  color: var(--muted-text);
  font-size: 0.75rem;
}

@media (min-width: 720px) {
  .inbound-body {
    flex-direction: row;
  }

  .sessions-panel {
    border-top: none;
    border-left: 1px solid #0a1828;
    flex: 0 0 230px;
    width: 230px;
    max-height: none;
  }
}

/* ---- Pre-Receive modal (PreReceiveModal.java, opened from a truck icon) ---- */

.detail-card.modal-card {
  max-width: 380px;
}

.pr-modal-view {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
  padding: 8px 4px;
}

.pr-modal-title {
  margin: 0;
  text-align: center;
  color: #222;
  font-size: 1.05rem;
}

.pr-remaining-label {
  margin: 0;
  text-align: center;
  color: #444;
  font-size: 0.85rem;
}

.pr-edit-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 0.82rem;
  color: #555;
}

.pr-edit-row input {
  width: 70px;
  max-width: 70px;
}

.pr-wide-button {
  width: 100%;
}
