/* Shared professional pullsheet table layout — 2026-07-22 */
.pullsheet-table-scroll {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: 6px;
}

.professional-pull-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  background: var(--surface, #fff);
}

.professional-pull-table th,
.professional-pull-table td {
  box-sizing: border-box;
  vertical-align: middle;
  overflow-wrap: anywhere;
}

.professional-pull-table thead th {
  height: 42px;
  padding: 7px 6px;
  text-align: center;
  vertical-align: middle;
  white-space: normal;
}

.professional-pull-table tbody tr:not(.department-row):not(.section-row) {
  min-height: 44px;
}

.professional-pull-table tbody td {
  padding: 6px;
}

.professional-pull-table input,
.professional-pull-table select,
.professional-pull-table textarea {
  max-width: 100%;
  box-sizing: border-box;
}

/* New pullsheet inventory selector */
.pull-table.professional-pull-table {
  min-width: 1120px;
}
.pull-table.professional-pull-table col.new-col-select { width: 64px; }
.pull-table.professional-pull-table col.new-col-qty { width: 72px; }
.pull-table.professional-pull-table col.new-col-item { width: 23%; }
.pull-table.professional-pull-table col.new-col-notes { width: 25%; }
.pull-table.professional-pull-table col.new-col-stock { width: 66px; }
.pull-table.professional-pull-table col.new-col-status { width: 104px; }
.pull-table.professional-pull-table col.new-col-return { width: 88px; }
.pull-table.professional-pull-table col.new-col-color { width: 112px; }

.pull-table.professional-pull-table th:nth-child(1),
.pull-table.professional-pull-table th:nth-child(2),
.pull-table.professional-pull-table th:nth-child(5),
.pull-table.professional-pull-table th:nth-child(6),
.pull-table.professional-pull-table th:nth-child(7),
.pull-table.professional-pull-table th:nth-child(8),
.pull-table.professional-pull-table th:nth-child(9),
.pull-table.professional-pull-table td:nth-child(1),
.pull-table.professional-pull-table td:nth-child(2),
.pull-table.professional-pull-table td:nth-child(5),
.pull-table.professional-pull-table td:nth-child(6),
.pull-table.professional-pull-table td:nth-child(7),
.pull-table.professional-pull-table td:nth-child(8),
.pull-table.professional-pull-table td:nth-child(9) {
  text-align: center;
}

.pull-table.professional-pull-table .qty-input {
  width: 58px;
  min-width: 0;
  text-align: center;
}
.pull-table.professional-pull-table .notes-input {
  width: 100%;
  min-height: 38px;
  resize: vertical;
}
.pull-table.professional-pull-table .inv-cell,
.pull-table.professional-pull-table .loaded-cell,
.theatrix-table.professional-pull-table .inv-cell,
.theatrix-table.professional-pull-table .loaded-cell {
  white-space: nowrap;
  text-align: center;
}
.pull-table.professional-pull-table .initials-input,
.theatrix-table.professional-pull-table .initials-input {
  width: 48px;
  min-width: 42px;
  margin-left: 4px;
  text-align: center;
}
.pull-table.professional-pull-table select {
  width: 100%;
  min-width: 0;
}

/* Existing event and master pullsheets */
.existing-pullsheet-scroll {
  overflow-x: auto;
  padding-bottom: 8px;
  border: 1px solid var(--border, #d0d5dd);
  border-radius: 10px;
  background: var(--surface, #fff);
}

/* Event/Pullsheet viewing layout: use comfortable fixed columns instead of
   percentage widths that squeeze the controls on the right side. */
.theatrix-table.professional-pull-table {
  min-width: 1300px;
  border-collapse: separate;
  border-spacing: 0;
}
.theatrix-table.professional-pull-table col.qty-col { width: 78px; }
.theatrix-table.professional-pull-table col.item-col { width: 300px; }
.theatrix-table.professional-pull-table col.notes-col { width: 360px; }
.theatrix-table.professional-pull-table col.inv-col { width: 140px; }
.theatrix-table.professional-pull-table col.loaded-col { width: 140px; }
.theatrix-table.professional-pull-table col.return-col { width: 120px; }
.theatrix-table.professional-pull-table col.color-col { width: 110px; }
.theatrix-table.professional-pull-table col.delete-col { width: 72px; }
.theatrix-table.professional-pull-table .qty-cell,
.theatrix-table.professional-pull-table .check-cell,
.theatrix-table.professional-pull-table .return-cell,
.theatrix-table.professional-pull-table .color-cell {
  text-align: center;
}
.theatrix-table.professional-pull-table .cell-input,
.theatrix-table.professional-pull-table .cell-textarea,
.theatrix-table.professional-pull-table select {
  width: 100%;
  min-width: 0;
}

.theatrix-table.professional-pull-table thead th {
  padding: 12px 10px;
  letter-spacing: .035em;
  white-space: nowrap;
}
.theatrix-table.professional-pull-table tbody td {
  padding: 10px;
}
.theatrix-table.professional-pull-table .gear-row td {
  border-bottom: 1px solid var(--border, #d9dee7);
}
.theatrix-table.professional-pull-table .gear-row:hover td {
  background: color-mix(in srgb, var(--surface, #fff) 93%, #6b7280 7%);
}
.theatrix-table.professional-pull-table .inv-cell,
.theatrix-table.professional-pull-table .loaded-cell {
  padding-left: 12px;
  padding-right: 12px;
}
.theatrix-table.professional-pull-table .inv-cell input[type="checkbox"],
.theatrix-table.professional-pull-table .loaded-cell input[type="checkbox"] {
  width: 18px;
  height: 18px;
  vertical-align: middle;
}
.theatrix-table.professional-pull-table .initials-input {
  width: 62px;
  min-width: 62px;
  height: 34px;
  margin-left: 8px;
  padding: 5px 7px;
}
.theatrix-table.professional-pull-table .return-cell select,
.theatrix-table.professional-pull-table .color-cell select {
  min-height: 36px;
  padding: 5px 8px;
}
.theatrix-table.professional-pull-table .delete-cell {
  text-align: center;
  padding-left: 14px;
  padding-right: 14px;
}
.theatrix-table.professional-pull-table .delete-cell input[type="checkbox"] {
  width: 18px;
  height: 18px;
}

/* Keep trucking manifests aligned with the same visual rhythm. */
.trucking-assignment-table th,
.trucking-assignment-table td {
  height: 42px;
  vertical-align: middle;
}

@media (max-width: 760px) {
  .pullsheet-table-scroll {
    border: 1px solid var(--border, #d0d5dd);
  }
  .pull-table.professional-pull-table { min-width: 980px; }
  .theatrix-table.professional-pull-table { min-width: 1180px; }
  .professional-pull-table th,
  .professional-pull-table td { padding: 5px 4px; }
}

@media print {
  .pullsheet-table-scroll,
  .existing-pullsheet-scroll {
    overflow: visible !important;
    border: 0 !important;
  }
  .theatrix-table.professional-pull-table {
    min-width: 0 !important;
    width: 100% !important;
    table-layout: fixed !important;
  }
  .theatrix-table.professional-pull-table col.qty-col { width: 7% !important; }
  .theatrix-table.professional-pull-table col.item-col { width: 32% !important; }
  .theatrix-table.professional-pull-table col.notes-col { width: 31% !important; }
  .theatrix-table.professional-pull-table col.inv-col { width: 11% !important; }
  .theatrix-table.professional-pull-table col.loaded-col { width: 10% !important; }
  .theatrix-table.professional-pull-table col.return-col { width: 9% !important; }
  .professional-pull-table th,
  .professional-pull-table td {
    height: auto;
    overflow-wrap: anywhere;
  }
}


/* Live pullsheet synchronization */
.live-pullsheet-status { display:inline-flex; align-items:center; gap:.4rem; margin-left:.75rem; padding:.3rem .6rem; border:1px solid var(--border-color, #cbd5e1); border-radius:999px; font-size:.82rem; vertical-align:middle; white-space:nowrap; }
.live-dot { width:.55rem; height:.55rem; border-radius:50%; background:#64748b; }
.live-pullsheet-status[data-state="connected"] .live-dot { background:#16a34a; }
.live-pullsheet-status[data-state="updated"] .live-dot { background:#2563eb; }
.live-pullsheet-status[data-state="reconnecting"] .live-dot { background:#d97706; animation: livePulse 1s infinite alternate; }
.live-row-updated > .qty-cell { animation: liveQtyFlash 2.4s ease-out; }
@keyframes livePulse { from { opacity:.35; } to { opacity:1; } }
@keyframes liveQtyFlash { 0% { outline:3px solid rgba(178,138,0,.85); background-color:#ffeb00; } 100% { outline-color:transparent; background-color:#ffeb00; } }
@media (max-width:700px) { .live-pullsheet-status { margin:.5rem 0 0; } }

/* Theme-safe pullsheet controls and semantic status contrast — 2026-08-01 */
:root {
  --changed-bg: #ffeb00;
  --changed-surface: #fffbd1;
  --changed-text: #171300;
  --changed-border: #7d6100;
  --control-bg: var(--input-bg, #ffffff);
  --control-text: var(--text, #111827);
  --control-border: var(--input-border, #98a2b3);
}

/* Form controls must use the foreground that belongs to their own surface. */
.professional-pull-table input:not([type="checkbox"]):not([type="radio"]),
.professional-pull-table textarea,
.professional-pull-table select {
  background-color: var(--control-bg) !important;
  color: var(--control-text) !important;
  border-color: var(--control-border) !important;
  -webkit-text-fill-color: var(--control-text) !important;
  caret-color: var(--control-text);
}
.professional-pull-table option {
  background: var(--control-bg);
  color: var(--control-text);
}

/* Recently changed quantities always remain legible, regardless of theme. */
.professional-pull-table tbody tr.gear-row.recently-changed-row > td.qty-cell,
.professional-pull-table tbody tr.gear-row.live-row-updated > td.qty-cell {
  background: var(--changed-bg) !important;
  color: var(--changed-text) !important;
  -webkit-text-fill-color: var(--changed-text) !important;
  box-shadow: inset 4px 0 0 var(--changed-border),
              inset 0 2px 0 color-mix(in srgb, var(--changed-border) 82%, #fff 18%),
              inset 0 -2px 0 color-mix(in srgb, var(--changed-border) 82%, #fff 18%);
}
.professional-pull-table tbody tr.gear-row.recently-changed-row > td.qty-cell input,
.professional-pull-table tbody tr.gear-row.live-row-updated > td.qty-cell input,
.professional-pull-table tbody tr.gear-row.recently-changed-row > td.qty-cell .qty-input,
.professional-pull-table tbody tr.gear-row.live-row-updated > td.qty-cell .qty-input {
  background: var(--changed-surface) !important;
  color: var(--changed-text) !important;
  -webkit-text-fill-color: var(--changed-text) !important;
  caret-color: var(--changed-text) !important;
  border-color: var(--changed-border) !important;
  font-weight: 900;
  opacity: 1;
}
.professional-pull-table tbody tr.gear-row.recently-changed-row > td.qty-cell input::selection,
.professional-pull-table tbody tr.gear-row.live-row-updated > td.qty-cell input::selection {
  background: #172033;
  color: #ffffff;
}

/* Keep browser number controls visible on the light warning surface. */
.professional-pull-table tbody tr.gear-row.recently-changed-row > td.qty-cell input[type="number"],
.professional-pull-table tbody tr.gear-row.live-row-updated > td.qty-cell input[type="number"] {
  color-scheme: light;
}

/* Semantic row colors use fixed high-contrast foregrounds. */
.professional-pull-table tr.row-color-yellow > td { color:#171300 !important; }
.professional-pull-table tr.row-color-green > td { color:#062b16 !important; }
.professional-pull-table tr.row-color-pink > td { color:#3d1020 !important; }
.professional-pull-table tr.row-color-turquoise > td { color:#062d31 !important; }
.professional-pull-table tr.row-color-red > td { color:#ffffff !important; }
.professional-pull-table tr.row-color-orange > td { color:#2b1600 !important; }
.professional-pull-table tr.row-color-tan > td { color:#111111 !important; }
.professional-pull-table tr.row-color-purple > td { color:#ffffff !important; }
.professional-pull-table tr.row-color-yellow > td input,
.professional-pull-table tr.row-color-green > td input,
.professional-pull-table tr.row-color-pink > td input,
.professional-pull-table tr.row-color-turquoise > td input,
.professional-pull-table tr.row-color-orange > td input,
.professional-pull-table tr.row-color-yellow > td textarea,
.professional-pull-table tr.row-color-green > td textarea,
.professional-pull-table tr.row-color-pink > td textarea,
.professional-pull-table tr.row-color-turquoise > td textarea,
.professional-pull-table tr.row-color-orange > td textarea {
  color:#111827 !important;
  -webkit-text-fill-color:#111827 !important;
}

/* Buttons and compact initials controls no longer inherit an unreadable color. */
.professional-pull-table button,
.professional-pull-table .btn {
  color: #ffffff !important;
  -webkit-text-fill-color: #ffffff !important;
}
.professional-pull-table .initials-input,
.professional-pull-table .qty-input,
.professional-pull-table .notes-input {
  opacity: 1;
}

@keyframes liveQtyFlash {
  0% {
    outline: 3px solid rgba(125,97,0,.95);
    outline-offset: -2px;
    background-color: var(--changed-bg);
  }
  100% {
    outline-color: transparent;
    background-color: var(--changed-bg);
  }
}

@media print {
  .professional-pull-table tbody tr.gear-row.recently-changed-row > td.qty-cell,
  .professional-pull-table tbody tr.gear-row.live-row-updated > td.qty-cell {
    background: inherit !important;
    color: inherit !important;
    -webkit-text-fill-color: inherit !important;
    box-shadow: none !important;
  }
}

.theatrix-table.professional-pull-table col.qc-col { width: 72px; }
.theatrix-table.professional-pull-table .qc-cell { text-align: center; }

/* Crossload accountability: only the CROSSLOAD cell turns orange when checked. */
.theatrix-table.professional-pull-table col.crossload-col { width: 96px; }
.professional-pull-table .crossload-cell { text-align: center; transition: background-color .15s ease; }
.professional-pull-table .crossload-cell.crossload-checked { background: transparent; color: inherit; }
.professional-pull-table .crossload-cell.crossload-checked input { accent-color: #211000; }
.professional-pull-table .qc-cell .qc-initials-input { width: 48px; min-width: 42px; margin-left: 4px; text-align: center; text-transform: uppercase; }
@media print {
  .professional-pull-table .crossload-cell.crossload-checked { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* 2026-08-11: Fit the existing Pullsheet on screen without horizontal scrolling. */
.existing-pullsheet-scroll {
  overflow-x: hidden;
}
.theatrix-table.professional-pull-table {
  min-width: 0;
  width: 100%;
  table-layout: fixed;
}
.theatrix-table.professional-pull-table col.qty-col { width: 5%; }
.theatrix-table.professional-pull-table col.item-col { width: 20%; }
.theatrix-table.professional-pull-table col.notes-col { width: 20%; }
.theatrix-table.professional-pull-table col.inv-col { width: 11%; }
.theatrix-table.professional-pull-table col.crossload-col { width: 8%; }
.theatrix-table.professional-pull-table col.loaded-col { width: 11%; }
.theatrix-table.professional-pull-table col.return-col { width: 8%; }
.theatrix-table.professional-pull-table col.qc-col { width: 11%; }
.theatrix-table.professional-pull-table col.color-col { width: 4%; }
.theatrix-table.professional-pull-table col.delete-col { width: 2%; }
.theatrix-table.professional-pull-table thead th,
.theatrix-table.professional-pull-table tbody td {
  padding-left: 4px;
  padding-right: 4px;
}
.theatrix-table.professional-pull-table thead th {
  white-space: normal;
  overflow-wrap: anywhere;
  font-size: clamp(.68rem, .78vw, .86rem);
  letter-spacing: 0;
}
.theatrix-table.professional-pull-table .inv-cell,
.theatrix-table.professional-pull-table .loaded-cell,
.theatrix-table.professional-pull-table .qc-cell {
  padding-left: 3px;
  padding-right: 3px;
  white-space: nowrap;
}
.theatrix-table.professional-pull-table .initials-input,
.professional-pull-table .qc-cell .qc-initials-input {
  width: 44px;
  min-width: 0;
  height: 30px;
  margin-left: 2px;
  padding: 3px 4px;
}
.theatrix-table.professional-pull-table .return-cell select,
.theatrix-table.professional-pull-table .color-cell select {
  min-height: 32px;
  padding: 3px 2px;
  font-size: .78rem;
}
.theatrix-table.professional-pull-table .delete-cell {
  padding-left: 2px;
  padding-right: 2px;
}
@media (max-width: 760px) {
  .theatrix-table.professional-pull-table { min-width: 0; }
  .theatrix-table.professional-pull-table thead th,
  .theatrix-table.professional-pull-table tbody td { padding-left: 2px; padding-right: 2px; }
  .theatrix-table.professional-pull-table .initials-input,
  .professional-pull-table .qc-cell .qc-initials-input { width: 36px; font-size: .72rem; }
}


/* 2026-08-11 v2: hard-fit existing Pullsheet to viewport; no horizontal scroll. */
.existing-pullsheet-scroll {
  width: 100% !important;
  max-width: 100% !important;
  overflow-x: clip !important;
  box-sizing: border-box;
}
.theatrix-table.professional-pull-table {
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0 !important;
  table-layout: fixed !important;
}
.theatrix-table.professional-pull-table col.qty-col { width: 4.5% !important; }
.theatrix-table.professional-pull-table col.item-col { width: 21% !important; }
.theatrix-table.professional-pull-table col.notes-col { width: 20% !important; }
.theatrix-table.professional-pull-table col.inv-col { width: 10.5% !important; }
.theatrix-table.professional-pull-table col.crossload-col { width: 8% !important; }
.theatrix-table.professional-pull-table col.loaded-col { width: 10.5% !important; }
.theatrix-table.professional-pull-table col.return-col { width: 8% !important; }
.theatrix-table.professional-pull-table col.qc-col { width: 10.5% !important; }
.theatrix-table.professional-pull-table col.color-col { width: 4.5% !important; }
.theatrix-table.professional-pull-table col.delete-col { width: 2.5% !important; }
.theatrix-table.professional-pull-table th,
.theatrix-table.professional-pull-table td {
  min-width: 0 !important;
  max-width: none !important;
  padding-left: 3px !important;
  padding-right: 3px !important;
  overflow-wrap: anywhere;
}
.theatrix-table.professional-pull-table thead th {
  white-space: normal !important;
  line-height: 1.05;
  font-size: clamp(.62rem,.72vw,.8rem) !important;
}
.theatrix-table.professional-pull-table .inv-cell,
.theatrix-table.professional-pull-table .loaded-cell,
.theatrix-table.professional-pull-table .qc-cell {
  white-space: nowrap !important;
}
.theatrix-table.professional-pull-table .initials-input,
.theatrix-table.professional-pull-table .qc-cell .qc-initials-input {
  width: 38px !important;
  min-width: 0 !important;
  max-width: 38px !important;
  height: 28px !important;
  margin-left: 1px !important;
  padding: 2px !important;
  font-size: .72rem !important;
}
.theatrix-table.professional-pull-table input[type=checkbox] {
  width: 16px !important;
  height: 16px !important;
  min-width: 16px !important;
}
.theatrix-table.professional-pull-table .return-cell select,
.theatrix-table.professional-pull-table .color-cell select {
  width: 100% !important;
  min-width: 0 !important;
  padding-left: 1px !important;
  padding-right: 1px !important;
  font-size: .72rem !important;
}

/* 2026-08-11 v3: Pullsheet uses the full available browser width.
   The previous screen layout was still constrained by:
   - theatrix-print.css .pullsheet-page { max-width:1200px }
   - style.css main { max-width:1600px }
   Remove both caps only when an actual pullsheet is being displayed. */
@media screen {
  body:has(.pullsheet-page) main {
    width: 100% !important;
    max-width: none !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
  }

  .pullsheet-page {
    width: 100% !important;
    max-width: none !important;
    min-width: 0 !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
  }

  .pullsheet-page .print-header,
  .pullsheet-page .existing-pullsheet-scroll,
  .pullsheet-page .theatrix-table.professional-pull-table {
    width: 100% !important;
    max-width: none !important;
  }
}

/* CROSSLOAD tape-color picker */
.professional-pull-table .crossload-cell.crossload-checked { color:#111 !important; }
.professional-pull-table .crossload-cell.crossload-color-green, .crossload-color-swatch.crossload-color-green { background:#22c55e !important; }
.professional-pull-table .crossload-cell.crossload-color-yellow, .crossload-color-swatch.crossload-color-yellow { background:#facc15 !important; }
.professional-pull-table .crossload-cell.crossload-color-red, .crossload-color-swatch.crossload-color-red { background:#ef4444 !important; color:#fff !important; }
.professional-pull-table .crossload-cell.crossload-color-pink, .crossload-color-swatch.crossload-color-pink { background:#f9a8d4 !important; }
.professional-pull-table .crossload-cell.crossload-color-turquoise, .crossload-color-swatch.crossload-color-turquoise { background:#2dd4bf !important; }
.professional-pull-table .crossload-cell.crossload-color-orange, .crossload-color-swatch.crossload-color-orange { background:#ff9800 !important; }
.professional-pull-table .crossload-cell.crossload-color-tan, .crossload-color-swatch.crossload-color-tan { background:#D2B48C !important; color:#111 !important; }
.professional-pull-table .crossload-cell.crossload-color-purple, .crossload-color-swatch.crossload-color-purple { background:#a855f7 !important; color:#fff !important; }
.crossload-color-modal[hidden]{display:none!important}.crossload-color-modal{position:fixed;inset:0;z-index:10000;background:rgba(0,0,0,.55);display:flex;align-items:center;justify-content:center;padding:24px}.crossload-color-modal-card{width:min(560px,96vw);background:#fff;color:#111;border-radius:12px;padding:22px;box-shadow:0 20px 60px rgba(0,0,0,.35)}.crossload-color-modal-card h2{margin:0 0 8px}.crossload-color-modal-card p{margin:0 0 18px}.crossload-color-options{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}.crossload-color-choice{display:flex;align-items:center;gap:10px;background:#f6f7f9;color:#111;border:1px solid #cfd5dc;padding:11px 12px;border-radius:8px;text-align:left}.crossload-color-choice:hover{background:#eceff3}.crossload-color-swatch{display:inline-block;width:28px;height:28px;border:1px solid rgba(0,0,0,.3);border-radius:5px;flex:0 0 28px}.crossload-color-modal-actions{display:flex;justify-content:flex-end;margin-top:18px}@media(max-width:600px){.crossload-color-options{grid-template-columns:1fr}}
@media print{.professional-pull-table .crossload-cell.crossload-checked{-webkit-print-color-adjust:exact;print-color-adjust:exact}}

/* =========================================================
   PRINT/PDF PARITY FIX - 2026-08-11
   Keep browser Print on the exact same 8-column proportions as
   the server-generated PDF.  Previous rules consumed 100% before
   CROSSLOAD and QC were counted, which squeezed/cut off QTY values.
========================================================= */
@media print {
  @page {
    size: letter portrait;
    margin: 0.25in;
  }

  .pullsheet-page {
    width: 100% !important;
    max-width: none !important;
  }

  .pullsheet-table-scroll,
  .existing-pullsheet-scroll {
    width: 100% !important;
    max-width: none !important;
    overflow: visible !important;
    border: 0 !important;
  }

  .theatrix-table.professional-pull-table {
    width: 100% !important;
    min-width: 0 !important;
    max-width: none !important;
    table-layout: fixed !important;
    border-collapse: collapse !important;
    font-size: 10px !important;
    line-height: 1.05 !important;
  }

  /* Same proportions as renderPullsheetPdfHtml() in routes/events.js. */
  .theatrix-table.professional-pull-table col.qty-col       { width: 5% !important; }
  .theatrix-table.professional-pull-table col.item-col      { width: 24% !important; }
  .theatrix-table.professional-pull-table col.notes-col     { width: 25% !important; }
  .theatrix-table.professional-pull-table col.inv-col       { width: 11% !important; }
  .theatrix-table.professional-pull-table col.crossload-col { width: 9% !important; }
  .theatrix-table.professional-pull-table col.loaded-col    { width: 11% !important; }
  .theatrix-table.professional-pull-table col.return-col    { width: 7% !important; }
  .theatrix-table.professional-pull-table col.qc-col        { width: 8% !important; }

  .theatrix-table.professional-pull-table th,
  .theatrix-table.professional-pull-table td {
    height: auto !important;
    padding: 2px 4px !important;
    box-sizing: border-box !important;
    overflow: visible !important;
    text-overflow: clip !important;
    word-break: normal !important;
    overflow-wrap: anywhere !important;
  }

  /* Quantity must print as plain text-width content, never as a clipped
     browser number control/spinner. */
  .theatrix-table.professional-pull-table .qty-cell {
    min-width: 0 !important;
    padding-left: 2px !important;
    padding-right: 2px !important;
    text-align: center !important;
    overflow: visible !important;
  }

  .theatrix-table.professional-pull-table .qty-cell .qty-input,
  .theatrix-table.professional-pull-table .qty-cell input[type="number"] {
    display: block !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    background: transparent !important;
    color: #000 !important;
    text-align: center !important;
    font: inherit !important;
    font-weight: 700 !important;
    line-height: 1.05 !important;
    appearance: textfield !important;
    -webkit-appearance: textfield !important;
    overflow: visible !important;
  }

  .theatrix-table.professional-pull-table .qty-cell input[type="number"]::-webkit-inner-spin-button,
  .theatrix-table.professional-pull-table .qty-cell input[type="number"]::-webkit-outer-spin-button {
    -webkit-appearance: none !important;
    margin: 0 !important;
  }

  .theatrix-table.professional-pull-table .crossload-cell,
  .theatrix-table.professional-pull-table .qc-cell,
  .theatrix-table.professional-pull-table .inv-cell,
  .theatrix-table.professional-pull-table .loaded-cell,
  .theatrix-table.professional-pull-table .return-cell {
    white-space: normal !important;
    text-align: center !important;
  }

  .theatrix-table.professional-pull-table thead th,
  .theatrix-table.professional-pull-table .department-row td,
  .theatrix-table.professional-pull-table .section-row td,
  .theatrix-table.professional-pull-table .gear-row td {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }
}


@media print {
  /* WHGSP PRINT: quantity number only */
  .qty-cell,
  .quantity-cell,
  td.qty,
  td.quantity,
  input.qty,
  input.quantity,
  input[type="number"] {
    background: transparent !important;
    background-color: transparent !important;
    background-image: none !important;
    box-shadow: none !important;
  }
}

/* PRINT FIX 2026-08-11: do not print transient yellow quantity-change highlighting. */
@media print {
  .professional-pull-table tbody tr.gear-row.recently-changed-row > td.qty-cell,
  .professional-pull-table tbody tr.gear-row.live-row-updated > td.qty-cell {
    background: transparent !important;
    background-color: transparent !important;
    background-image: none !important;
    box-shadow: none !important;
    outline: none !important;
    animation: none !important;
  }

  .professional-pull-table tbody tr.gear-row.recently-changed-row > td.qty-cell input,
  .professional-pull-table tbody tr.gear-row.live-row-updated > td.qty-cell input,
  .professional-pull-table tbody tr.gear-row.recently-changed-row > td.qty-cell .qty-input,
  .professional-pull-table tbody tr.gear-row.live-row-updated > td.qty-cell .qty-input {
    background: transparent !important;
    background-color: transparent !important;
    background-image: none !important;
    box-shadow: none !important;
    outline: none !important;
    animation: none !important;
    border: 0 !important;
  }

  .professional-pull-table .qty-cell,
  .professional-pull-table .qty-cell .qty-input {
    -webkit-print-color-adjust: economy !important;
    print-color-adjust: economy !important;
  }
}

/* Return destination highlighting - applies only to the RETURN cell. */
.professional-pull-table .return-cell.return-location-maui,
.professional-pull-table .return-cell.return-location-maui select {
  background: #f9a8d4 !important;
  background-color: #f9a8d4 !important;
  color: #3d1020 !important;
  -webkit-text-fill-color: #3d1020 !important;
}
.professional-pull-table .return-cell.return-location-oahu,
.professional-pull-table .return-cell.return-location-oahu select {
  background: #facc15 !important;
  background-color: #facc15 !important;
  color: #171300 !important;
  -webkit-text-fill-color: #171300 !important;
}
@media print {
  .professional-pull-table .return-cell.return-location-maui { background:#f9a8d4 !important; background-color:#f9a8d4 !important; -webkit-print-color-adjust:exact; print-color-adjust:exact; }
  .professional-pull-table .return-cell.return-location-oahu { background:#facc15 !important; background-color:#facc15 !important; -webkit-print-color-adjust:exact; print-color-adjust:exact; }
}

/* Simplified / Advanced pullsheet view (2026-08-12) */
.pullsheet-view-toggle{display:inline-flex;align-items:center;gap:6px;padding:4px;border:1px solid #aaa;border-radius:8px;background:var(--surface,#fff)}
.pullsheet-view-toggle button{margin:0}
.pullsheet-view-toggle button.is-active{font-weight:800;box-shadow:inset 0 0 0 2px currentColor}
.pullsheet-page.view-simplified .crossload-col,
.pullsheet-page.view-simplified .qc-col,
.pullsheet-page.view-simplified .color-col{display:none!important}
.pullsheet-page.view-simplified .department-row td,
.pullsheet-page.view-simplified .section-row td{ }
.new-pullsheet-page.view-simplified .new-col-stock,
.new-pullsheet-page.view-simplified .new-col-color,
.new-pullsheet-page.view-simplified th.new-stock-cell,
.new-pullsheet-page.view-simplified td.new-stock-cell,
.new-pullsheet-page.view-simplified th.new-color-cell,
.new-pullsheet-page.view-simplified td.new-color-cell{display:none!important}
@media print{
  .pullsheet-page.view-advanced .delete-col{display:none!important}
}
.new-pullsheet-page .new-delete-cell{display:none}
.new-pullsheet-page.view-simplified .new-select-cell{display:none!important}
.new-pullsheet-page.view-simplified .new-delete-cell{display:table-cell!important}
.new-pullsheet-page .new-col-delete{display:none}
.new-pullsheet-page.view-simplified .new-col-select,
.new-pullsheet-page.view-simplified .new-col-stock,
.new-pullsheet-page.view-simplified .new-col-color{display:none!important}
.new-pullsheet-page.view-simplified .new-col-delete{display:table-column!important}

/* Simplified view fix: existing pullsheet body cells use *-cell classes, not *-col classes. */
.pullsheet-page.view-simplified .professional-pull-table > thead > tr > th:nth-child(5),
.pullsheet-page.view-simplified .professional-pull-table > thead > tr > th:nth-child(8),
.pullsheet-page.view-simplified .professional-pull-table > thead > tr > th:nth-child(9),
.pullsheet-page.view-simplified .professional-pull-table > tbody > tr > td:nth-child(5),
.pullsheet-page.view-simplified .professional-pull-table > tbody > tr > td:nth-child(8),
.pullsheet-page.view-simplified .professional-pull-table > tbody > tr > td:nth-child(9) {
  display: none !important;
}
.pullsheet-page.view-simplified .professional-pull-table > thead > tr > th:nth-child(10),
.pullsheet-page.view-simplified .professional-pull-table > tbody > tr > td:nth-child(10) {
  display: table-cell !important;
}
.pullsheet-page.view-advanced .professional-pull-table > thead > tr > th:nth-child(10),
.pullsheet-page.view-advanced .professional-pull-table > tbody > tr > td:nth-child(10) {
  display: table-cell;
}
@media print {
  .pullsheet-page.view-advanced .professional-pull-table > thead > tr > th:nth-child(10),
  .pullsheet-page.view-advanced .professional-pull-table > tbody > tr > td:nth-child(10) {
    display: none !important;
  }
}

/* PRINT/PDF UI FIX 2026-08-12: DELETE is editing-only and must never print. */
@media print {
  .pullsheet-page .delete-col,
  .pullsheet-page .delete-cell,
  .new-pullsheet-page .new-delete-cell,
  .new-pullsheet-page .new-col-delete {
    display: none !important;
    visibility: hidden !important;
    width: 0 !important;
    min-width: 0 !important;
    max-width: 0 !important;
    padding: 0 !important;
    border: 0 !important;
  }
}

/* =========================================================
   FINAL PULLSHEET PRINT BOUNDARY FIX - 2026-08-12
   MUST remain at EOF because pullsheet-layout.css is loaded
   after theatrix-print.css. Prevents right-edge clipping.
========================================================= */
@media print {
  @page { size: letter portrait; margin: 0.38in; }

  html, body {
    width: auto !important;
    min-width: 0 !important;
    max-width: none !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: visible !important;
  }

  body .pullsheet-page {
    box-sizing: border-box !important;
    width: 7.66in !important;
    max-width: 7.66in !important;
    min-width: 0 !important;
    margin: 0 auto !important;
    padding: 0 !important;
    overflow: hidden !important;
  }

  body .pullsheet-page .pullsheet-table-scroll,
  body .pullsheet-page .existing-pullsheet-scroll {
    box-sizing: border-box !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    overflow: hidden !important;
  }

  body .pullsheet-page .theatrix-table.professional-pull-table {
    box-sizing: border-box !important;
    width: calc(100% - 2px) !important;
    max-width: calc(100% - 2px) !important;
    min-width: 0 !important;
    margin: 0 1px !important;
    border-collapse: collapse !important;
    table-layout: fixed !important;
    font-size: 9.5px !important;
    line-height: 1.08 !important;
  }

  /* Editing-only columns consume absolutely no print width. */
  body .pullsheet-page .professional-pull-table col.color-col,
  body .pullsheet-page .professional-pull-table col.delete-col,
  body .pullsheet-page .professional-pull-table th.color-col,
  body .pullsheet-page .professional-pull-table td.color-col,
  body .pullsheet-page .professional-pull-table th.delete-col,
  body .pullsheet-page .professional-pull-table td.delete-col,
  body .pullsheet-page .professional-pull-table .color-cell,
  body .pullsheet-page .professional-pull-table .delete-cell,
  body .pullsheet-page .professional-pull-table > thead > tr > th:nth-child(9),
  body .pullsheet-page .professional-pull-table > thead > tr > th:nth-child(10),
  body .pullsheet-page .professional-pull-table > tbody > tr:not(.department-row) > td:nth-child(9),
  body .pullsheet-page .professional-pull-table > tbody > tr:not(.department-row) > td:nth-child(10) {
    display: none !important;
    visibility: collapse !important;
    width: 0 !important;
    min-width: 0 !important;
    max-width: 0 !important;
    padding: 0 !important;
    border: 0 !important;
  }

  /* Advanced: all eight printable columns sum to exactly 100%. */
  body .pullsheet-page.view-advanced .professional-pull-table col.qty-col       { width: 5.5% !important; }
  body .pullsheet-page.view-advanced .professional-pull-table col.item-col      { width: 23.5% !important; }
  body .pullsheet-page.view-advanced .professional-pull-table col.notes-col     { width: 24.5% !important; }
  body .pullsheet-page.view-advanced .professional-pull-table col.inv-col       { width: 11.5% !important; }
  body .pullsheet-page.view-advanced .professional-pull-table col.crossload-col { width: 9.5% !important; }
  body .pullsheet-page.view-advanced .professional-pull-table col.loaded-col    { width: 11.0% !important; }
  body .pullsheet-page.view-advanced .professional-pull-table col.return-col    { width: 7.5% !important; }
  body .pullsheet-page.view-advanced .professional-pull-table col.qc-col        { width: 7.0% !important; }

  /* Simplified: QTY, ITEM, NOTES, PULLED, LOADED, RETURNED. */
  body .pullsheet-page.view-simplified .professional-pull-table col.qty-col       { width: 7% !important; }
  body .pullsheet-page.view-simplified .professional-pull-table col.item-col      { width: 31% !important; }
  body .pullsheet-page.view-simplified .professional-pull-table col.notes-col     { width: 30% !important; }
  body .pullsheet-page.view-simplified .professional-pull-table col.inv-col       { width: 12% !important; }
  body .pullsheet-page.view-simplified .professional-pull-table col.crossload-col { display:none !important; width:0 !important; }
  body .pullsheet-page.view-simplified .professional-pull-table col.loaded-col    { width: 11% !important; }
  body .pullsheet-page.view-simplified .professional-pull-table col.return-col    { width: 9% !important; }
  body .pullsheet-page.view-simplified .professional-pull-table col.qc-col        { display:none !important; width:0 !important; }

  body .pullsheet-page .professional-pull-table th,
  body .pullsheet-page .professional-pull-table td {
    box-sizing: border-box !important;
    min-width: 0 !important;
    max-width: none !important;
    padding: 2px 3px !important;
    overflow: hidden !important;
    text-overflow: clip !important;
    overflow-wrap: anywhere !important;
  }

  body .pullsheet-page .professional-pull-table thead th {
    text-align: center !important;
    vertical-align: middle !important;
    white-space: normal !important;
  }

  body .pullsheet-page .professional-pull-table .department-row td,
  body .pullsheet-page .professional-pull-table .section-row td {
    box-sizing: border-box !important;
    max-width: 100% !important;
    overflow: hidden !important;
  }

  body .pullsheet-page .print-header {
    box-sizing: border-box !important;
    width: calc(100% - 2px) !important;
    max-width: calc(100% - 2px) !important;
    margin-left: 1px !important;
    margin-right: 1px !important;
    grid-template-columns: minmax(0,1fr) 2.35in 1.68in !important;
    column-gap: 0.09in !important;
  }

  body .pullsheet-page .header-right,
  body .pullsheet-page .header-right > div,
  body .pullsheet-page .header-right .print-date-text {
    box-sizing: border-box !important;
    min-width: 0 !important;
    max-width: 100% !important;
  }

  body .pullsheet-page .header-right > div {
    grid-template-columns: 0.48in minmax(0,1fr) !important;
  }

  body .pullsheet-page .header-right .print-date-text {
    text-align: right !important;
    white-space: nowrap !important;
  }
}

/* 2026-08-13 iOS QTY + regular-user simplified view */
@media screen{.professional-pull-table .qty-col,.professional-pull-table .qty-cell{min-width:74px!important;width:74px!important}.professional-pull-table input[type=number].qty-input{box-sizing:border-box!important;width:64px!important;min-width:64px!important;max-width:64px!important;padding-left:7px!important;padding-right:7px!important;text-align:center!important}}
.regular-user-pullsheet.view-simplified .professional-pull-table>thead>tr>th:nth-child(2),.regular-user-pullsheet.view-simplified .professional-pull-table>thead>tr>th:nth-child(8),.regular-user-pullsheet.view-simplified .professional-pull-table>thead>tr>th:nth-child(9),.regular-user-pullsheet.view-simplified .professional-pull-table>thead>tr>th:nth-child(10),.regular-user-pullsheet.view-simplified .professional-pull-table>tbody>tr:not(.department-row)>td:nth-child(2),.regular-user-pullsheet.view-simplified .professional-pull-table>tbody>tr:not(.department-row)>td:nth-child(8),.regular-user-pullsheet.view-simplified .professional-pull-table>tbody>tr:not(.department-row)>td:nth-child(9),.regular-user-pullsheet.view-simplified .professional-pull-table>tbody>tr:not(.department-row)>td:nth-child(10){display:none!important}
.regular-user-pullsheet.view-simplified .professional-pull-table>thead>tr>th:nth-child(5),.regular-user-pullsheet.view-simplified .professional-pull-table>tbody>tr:not(.department-row)>td:nth-child(5){display:table-cell!important}
.regular-user-pullsheet.view-simplified .professional-pull-table col.item-col,.regular-user-pullsheet.view-simplified .professional-pull-table col.qc-col,.regular-user-pullsheet.view-simplified .professional-pull-table col.color-col,.regular-user-pullsheet.view-simplified .professional-pull-table col.delete-col{display:none!important;width:0!important}
@media screen{.regular-user-pullsheet.view-simplified .professional-pull-table col.qty-col{width:10%!important}.regular-user-pullsheet.view-simplified .professional-pull-table col.notes-col{width:35%!important}.regular-user-pullsheet.view-simplified .professional-pull-table col.inv-col{width:14%!important}.regular-user-pullsheet.view-simplified .professional-pull-table col.crossload-col{display:table-column!important;width:14%!important}.regular-user-pullsheet.view-simplified .professional-pull-table col.loaded-col{width:14%!important}.regular-user-pullsheet.view-simplified .professional-pull-table col.return-col{width:13%!important}}

/* WHGSP 2026-08-13: iOS quantity visibility hardening.
   Keep the quantity cell wide enough for 2-3+ digit values in portrait and landscape. */
@media screen {
  body .pullsheet-page .professional-pull-table col.qty-col,
  body .pullsheet-page.view-simplified .professional-pull-table col.qty-col,
  body .pullsheet-page.view-advanced .professional-pull-table col.qty-col,
  body .regular-user-pullsheet.view-simplified .professional-pull-table col.qty-col {
    width: 92px !important;
    min-width: 92px !important;
  }

  body .pullsheet-page .professional-pull-table th.qty-col,
  body .pullsheet-page .professional-pull-table td.qty-cell {
    width: 92px !important;
    min-width: 92px !important;
    max-width: 92px !important;
    padding-left: 5px !important;
    padding-right: 5px !important;
    overflow: visible !important;
  }

  body .pullsheet-page .professional-pull-table td.qty-cell input.qty-input,
  body .pullsheet-page .professional-pull-table td.qty-cell input[type="number"],
  body .pullsheet-page .professional-pull-table input[type="number"].qty-input {
    display: block !important;
    box-sizing: border-box !important;
    width: 80px !important;
    min-width: 80px !important;
    max-width: 80px !important;
    height: 38px !important;
    margin: 0 auto !important;
    padding: 6px 8px !important;
    font-size: 16px !important;
    line-height: 24px !important;
    text-align: center !important;
    text-indent: 0 !important;
    overflow: visible !important;
    -webkit-text-size-adjust: 100%;
  }

  /* Allow the table to grow rather than squeeze the fixed QTY column on narrow iOS screens. */
  body .pullsheet-page .table-scroll,
  body .pullsheet-page .pullsheet-table-wrap,
  body .pullsheet-page .table-responsive {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
  }
}

/* Extra room on phone-sized screens where Safari was clipping the value. */
@media screen and (max-width: 600px) {
  body .pullsheet-page .professional-pull-table col.qty-col,
  body .pullsheet-page.view-simplified .professional-pull-table col.qty-col,
  body .pullsheet-page.view-advanced .professional-pull-table col.qty-col,
  body .regular-user-pullsheet.view-simplified .professional-pull-table col.qty-col,
  body .pullsheet-page .professional-pull-table th.qty-col,
  body .pullsheet-page .professional-pull-table td.qty-cell {
    width: 100px !important;
    min-width: 100px !important;
    max-width: 100px !important;
  }

  body .pullsheet-page .professional-pull-table td.qty-cell input.qty-input,
  body .pullsheet-page .professional-pull-table td.qty-cell input[type="number"],
  body .pullsheet-page .professional-pull-table input[type="number"].qty-input {
    width: 88px !important;
    min-width: 88px !important;
    max-width: 88px !important;
  }
}


/* WHGSP 2026-08-13: iPhone/iPad portrait Simplified pullsheet layout.
   Override the generic mobile 1180px table minimum so the six-column
   regular-user Simplified view fills the viewport instead of being crushed/off-screen. */
@media screen and (max-width: 700px) and (orientation: portrait) {
  body {
    padding-left: 6px !important;
    padding-right: 6px !important;
  }

  body .pullsheet-page {
    width: calc(100vw - 12px) !important;
    max-width: none !important;
    min-width: 0 !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
  }

  body .pullsheet-page .pullsheet-table-scroll,
  body .pullsheet-page .existing-pullsheet-scroll {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    overflow-x: hidden !important;
    box-sizing: border-box !important;
  }

  body .regular-user-pullsheet.view-simplified .theatrix-table.professional-pull-table {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    table-layout: fixed !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
  }

  body .regular-user-pullsheet.view-simplified .professional-pull-table col.qty-col {
    width: 82px !important;
    min-width: 82px !important;
    max-width: 82px !important;
  }

  body .regular-user-pullsheet.view-simplified .professional-pull-table th.qty-col,
  body .regular-user-pullsheet.view-simplified .professional-pull-table td.qty-cell {
    width: 82px !important;
    min-width: 82px !important;
    max-width: 82px !important;
    padding-left: 4px !important;
    padding-right: 4px !important;
    overflow: visible !important;
  }

  body .regular-user-pullsheet.view-simplified .professional-pull-table td.qty-cell input.qty-input,
  body .regular-user-pullsheet.view-simplified .professional-pull-table td.qty-cell input[type="number"],
  body .regular-user-pullsheet.view-simplified .professional-pull-table input[type="number"].qty-input {
    width: 72px !important;
    min-width: 72px !important;
    max-width: 72px !important;
    box-sizing: border-box !important;
    padding: 7px 4px !important;
    font-size: 16px !important;
    line-height: 1.2 !important;
    text-align: center !important;
    overflow: visible !important;
  }

  body .regular-user-pullsheet.view-simplified .professional-pull-table col.notes-col {
    width: auto !important;
    min-width: 0 !important;
  }

  body .regular-user-pullsheet.view-simplified .professional-pull-table col.inv-col,
  body .regular-user-pullsheet.view-simplified .professional-pull-table col.crossload-col,
  body .regular-user-pullsheet.view-simplified .professional-pull-table col.loaded-col,
  body .regular-user-pullsheet.view-simplified .professional-pull-table col.return-col {
    width: 12.5% !important;
    min-width: 0 !important;
  }

  body .regular-user-pullsheet.view-simplified .professional-pull-table th,
  body .regular-user-pullsheet.view-simplified .professional-pull-table td {
    min-width: 0 !important;
    max-width: none !important;
    padding-left: 3px !important;
    padding-right: 3px !important;
  }

  body .regular-user-pullsheet.view-simplified .professional-pull-table thead th {
    white-space: normal !important;
    overflow-wrap: anywhere !important;
    font-size: 10.5px !important;
    letter-spacing: 0 !important;
    line-height: 1.1 !important;
  }
}


/* WHGSP 2026-08-13 iOS portrait v2:
   The page itself was inheriting a narrow desktop/container width.
   Expand the event page and all of its major wrappers to the viewport. */
@media screen and (max-width: 700px) and (orientation: portrait) {
  html,
  body {
    width: 100% !important;
    min-width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    overflow-x: hidden !important;
  }

  body > main,
  body > .container,
  body > .page-container,
  main,
  main.container,
  .container,
  .page-container,
  .content,
  .main-content,
  .event-detail,
  .event-detail-container,
  .pullsheet-page,
  form.pullsheet-page {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    box-sizing: border-box !important;
  }

  form.pullsheet-page {
    padding-left: 8px !important;
    padding-right: 8px !important;
  }

  .pullsheet-page .pullsheet-table-scroll,
  .pullsheet-page .existing-pullsheet-scroll {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
  }

  .regular-user-pullsheet.view-simplified .theatrix-table.professional-pull-table {
    width: 100% !important;
    min-width: 560px !important;
    max-width: none !important;
    table-layout: fixed !important;
  }

  /* Keep QTY permanently readable. */
  .regular-user-pullsheet.view-simplified .professional-pull-table col.qty-col,
  .regular-user-pullsheet.view-simplified .professional-pull-table th.qty-col,
  .regular-user-pullsheet.view-simplified .professional-pull-table td.qty-cell {
    width: 88px !important;
    min-width: 88px !important;
    max-width: 88px !important;
  }

  .regular-user-pullsheet.view-simplified .professional-pull-table td.qty-cell input.qty-input,
  .regular-user-pullsheet.view-simplified .professional-pull-table td.qty-cell input[type="number"] {
    width: 76px !important;
    min-width: 76px !important;
    max-width: 76px !important;
    font-size: 16px !important;
    padding-left: 5px !important;
    padding-right: 5px !important;
    box-sizing: border-box !important;
  }
}

/* WHGSP 2026-08-13 iOS portrait v3
   Do NOT compress the pullsheet to the phone width. Keep readable column
   widths and let the user pan horizontally across the whole pullsheet. */
@media screen and (max-width: 700px) and (orientation: portrait) {
  /* The scroll viewport itself occupies the available phone screen. */
  body .pullsheet-page .pullsheet-table-scroll.existing-pullsheet-scroll,
  body .pullsheet-page .pullsheet-table-scroll,
  body .pullsheet-page .existing-pullsheet-scroll {
    display: block !important;
    width: calc(100vw - 16px) !important;
    max-width: calc(100vw - 16px) !important;
    min-width: 0 !important;
    overflow-x: auto !important;
    overflow-y: visible !important;
    -webkit-overflow-scrolling: touch !important;
    overscroll-behavior-x: contain !important;
    touch-action: pan-x pan-y !important;
    box-sizing: border-box !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    padding-bottom: 8px !important;
  }

  /* Regular-user Simplified mode is intentionally wider than portrait.
     This preserves every field instead of squeezing/cropping it. */
  body .regular-user-pullsheet.view-simplified .theatrix-table.professional-pull-table {
    table-layout: fixed !important;
    width: 830px !important;
    min-width: 830px !important;
    max-width: 830px !important;
    margin: 0 !important;
  }

  body .regular-user-pullsheet.view-simplified .professional-pull-table col.qty-col {
    display: table-column !important;
    width: 90px !important;
    min-width: 90px !important;
    max-width: 90px !important;
  }
  body .regular-user-pullsheet.view-simplified .professional-pull-table col.notes-col {
    display: table-column !important;
    width: 260px !important;
  }
  body .regular-user-pullsheet.view-simplified .professional-pull-table col.inv-col {
    display: table-column !important;
    width: 115px !important;
  }
  body .regular-user-pullsheet.view-simplified .professional-pull-table col.crossload-col {
    display: table-column !important;
    width: 125px !important;
  }
  body .regular-user-pullsheet.view-simplified .professional-pull-table col.loaded-col {
    display: table-column !important;
    width: 115px !important;
  }
  body .regular-user-pullsheet.view-simplified .professional-pull-table col.return-col {
    display: table-column !important;
    width: 125px !important;
  }

  body .regular-user-pullsheet.view-simplified .professional-pull-table th.qty-col,
  body .regular-user-pullsheet.view-simplified .professional-pull-table td.qty-cell {
    width: 90px !important;
    min-width: 90px !important;
    max-width: 90px !important;
    overflow: visible !important;
    padding-left: 6px !important;
    padding-right: 6px !important;
  }

  body .regular-user-pullsheet.view-simplified .professional-pull-table td.qty-cell input.qty-input,
  body .regular-user-pullsheet.view-simplified .professional-pull-table td.qty-cell input[type="number"] {
    display: block !important;
    width: 76px !important;
    min-width: 76px !important;
    max-width: 76px !important;
    box-sizing: border-box !important;
    font-size: 16px !important;
    line-height: 1.25 !important;
    padding: 7px 5px !important;
    text-align: center !important;
    opacity: 1 !important;
    visibility: visible !important;
  }

  /* Advanced view keeps the complete wider pullsheet and scrolls too. */
  body .pullsheet-page.view-advanced .theatrix-table.professional-pull-table {
    width: 1180px !important;
    min-width: 1180px !important;
    max-width: none !important;
    table-layout: fixed !important;
  }

  /* Never hide overflow at an ancestor of the table on portrait. */
  body .pullsheet-page,
  body form.pullsheet-page {
    overflow: visible !important;
  }
}


/* =========================================================
   WHGSP iPHONE / MOBILE PULLSHEET FINAL OVERRIDE - 2026-08-13 v4
   Keep the application page at the device viewport width.
   Only the pullsheet TABLE is wider and horizontally scrollable.
   ========================================================= */
@media screen and (max-width: 700px) {
  html {
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    overflow-x: hidden !important;
    -webkit-text-size-adjust: 100% !important;
    text-size-adjust: 100% !important;
  }

  body:has(.pullsheet-page) {
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    overflow-x: hidden !important;
    margin: 0 !important;
    padding-left: max(8px, env(safe-area-inset-left)) !important;
    padding-right: max(8px, env(safe-area-inset-right)) !important;
    box-sizing: border-box !important;
  }

  body:has(.pullsheet-page) main {
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: visible !important;
    box-sizing: border-box !important;
  }

  body:has(.pullsheet-page) .nav,
  body:has(.pullsheet-page) .event-control-summary,
  body:has(.pullsheet-page) .attachment-manager,
  body:has(.pullsheet-page) .card,
  body:has(.pullsheet-page) form.pullsheet-page {
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
  }

  form.pullsheet-page {
    margin: 0 !important;
    padding: 0 !important;
    overflow: visible !important;
  }

  /* Toolbar stays phone-sized. It must never widen the document. */
  form.pullsheet-page .export-toolbar,
  form.pullsheet-page .sheet-top,
  form.pullsheet-page .sheet-bottom {
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    display: flex !important;
    flex-wrap: wrap !important;
    align-items: center !important;
    gap: 8px !important;
  }

  form.pullsheet-page .export-toolbar > *,
  form.pullsheet-page .sheet-top > *,
  form.pullsheet-page .sheet-bottom > * {
    max-width: 100% !important;
  }

  /* The desktop 3-column print header has 260/320/260px minimums.
     Stack it on phones so it cannot force an ~840px-wide PAGE. */
  form.pullsheet-page .print-header {
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 10px !important;
    margin: 8px 0 12px !important;
    overflow: hidden !important;
  }

  form.pullsheet-page .print-header .header-left,
  form.pullsheet-page .print-header .brand,
  form.pullsheet-page .print-header .header-right {
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    justify-self: stretch !important;
    box-sizing: border-box !important;
  }

  form.pullsheet-page .print-header .header-left {
    order: 1;
    text-align: left !important;
  }

  form.pullsheet-page .print-header .brand {
    order: 2;
    text-align: center !important;
  }

  form.pullsheet-page .print-header .brand-main {
    font-size: clamp(34px, 12vw, 48px) !important;
    white-space: nowrap !important;
  }

  form.pullsheet-page .print-header .brand-sub {
    font-size: 13px !important;
    letter-spacing: 5px !important;
  }

  form.pullsheet-page .print-header .header-right {
    order: 3;
    text-align: left !important;
  }

  form.pullsheet-page .print-header .header-right > div {
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    display: grid !important;
    grid-template-columns: 52px minmax(0, 1fr) !important;
    column-gap: 8px !important;
    align-items: center !important;
    justify-content: stretch !important;
    margin-bottom: 5px !important;
  }

  form.pullsheet-page .print-header .header-right > div > b {
    text-align: right !important;
  }

  form.pullsheet-page .print-header .header-right .date-print-input {
    width: 100% !important;
    min-width: 0 !important;
    max-width: none !important;
    box-sizing: border-box !important;
  }

  /* THIS is the only horizontal-scroll viewport. */
  form.pullsheet-page .pullsheet-table-scroll,
  form.pullsheet-page .existing-pullsheet-scroll,
  form.pullsheet-page .pullsheet-table-scroll.existing-pullsheet-scroll {
    display: block !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    overflow-x: auto !important;
    overflow-y: visible !important;
    -webkit-overflow-scrolling: touch !important;
    overscroll-behavior-x: contain !important;
    touch-action: pan-x pan-y !important;
    box-sizing: border-box !important;
    margin: 0 !important;
    padding: 0 0 10px !important;
    border-radius: 8px !important;
  }

  /* Simplified: readable full-sized six columns; swipe left/right. */
  form.pullsheet-page.regular-user-pullsheet.view-simplified
  .theatrix-table.professional-pull-table {
    width: 900px !important;
    min-width: 900px !important;
    max-width: none !important;
    table-layout: fixed !important;
    margin: 0 !important;
  }

  form.pullsheet-page.regular-user-pullsheet.view-simplified
  .professional-pull-table col.qty-col {
    display: table-column !important;
    width: 96px !important;
  }

  form.pullsheet-page.regular-user-pullsheet.view-simplified
  .professional-pull-table col.notes-col {
    display: table-column !important;
    width: 300px !important;
  }

  form.pullsheet-page.regular-user-pullsheet.view-simplified
  .professional-pull-table col.inv-col {
    display: table-column !important;
    width: 120px !important;
  }

  form.pullsheet-page.regular-user-pullsheet.view-simplified
  .professional-pull-table col.crossload-col {
    display: table-column !important;
    width: 135px !important;
  }

  form.pullsheet-page.regular-user-pullsheet.view-simplified
  .professional-pull-table col.loaded-col {
    display: table-column !important;
    width: 120px !important;
  }

  form.pullsheet-page.regular-user-pullsheet.view-simplified
  .professional-pull-table col.return-col {
    display: table-column !important;
    width: 129px !important;
  }

  form.pullsheet-page.regular-user-pullsheet.view-simplified
  .professional-pull-table th,
  form.pullsheet-page.regular-user-pullsheet.view-simplified
  .professional-pull-table td {
    padding: 7px 6px !important;
    overflow: visible !important;
  }

  form.pullsheet-page.regular-user-pullsheet.view-simplified
  .professional-pull-table th.qty-col,
  form.pullsheet-page.regular-user-pullsheet.view-simplified
  .professional-pull-table td.qty-cell {
    width: 96px !important;
    min-width: 96px !important;
    max-width: 96px !important;
  }

  form.pullsheet-page.regular-user-pullsheet.view-simplified
  .professional-pull-table td.qty-cell input.qty-input,
  form.pullsheet-page.regular-user-pullsheet.view-simplified
  .professional-pull-table td.qty-cell input[type="number"] {
    display: block !important;
    width: 80px !important;
    min-width: 80px !important;
    max-width: 80px !important;
    height: 38px !important;
    margin: 0 auto !important;
    padding: 6px !important;
    box-sizing: border-box !important;
    font-size: 16px !important;
    line-height: 1.2 !important;
    text-align: center !important;
    visibility: visible !important;
    opacity: 1 !important;
  }

  /* Advanced stays full-sized too and scrolls inside the same viewport. */
  form.pullsheet-page.view-advanced
  .theatrix-table.professional-pull-table {
    width: 1380px !important;
    min-width: 1380px !important;
    max-width: none !important;
    table-layout: fixed !important;
  }
}

/* =========================================================
   WHGSP iPhone form-value visibility fix — 2026-08-13 v5
   iOS Safari can render native controls using dark appearance even when
   their value text is inherited differently. Keep pullsheet data controls
   explicitly high-contrast on phones while leaving the rest of the app theme intact.
   ========================================================= */
@media screen and (max-width: 700px) {
  form.pullsheet-page .professional-pull-table input:not([type="checkbox"]):not([type="radio"]),
  form.pullsheet-page .professional-pull-table textarea,
  form.pullsheet-page .professional-pull-table select {
    color-scheme: light !important;
    appearance: auto;
    -webkit-appearance: none;
    background-color: #ffffff !important;
    background-image: none !important;
    color: #111827 !important;
    -webkit-text-fill-color: #111827 !important;
    caret-color: #111827 !important;
    border-color: #8b95a5 !important;
    opacity: 1 !important;
  }

  form.pullsheet-page .professional-pull-table input::placeholder,
  form.pullsheet-page .professional-pull-table textarea::placeholder {
    color: #667085 !important;
    -webkit-text-fill-color: #667085 !important;
    opacity: 1 !important;
  }

  form.pullsheet-page .professional-pull-table select option {
    background: #ffffff !important;
    color: #111827 !important;
    -webkit-text-fill-color: #111827 !important;
  }

  form.pullsheet-page .professional-pull-table input:disabled,
  form.pullsheet-page .professional-pull-table textarea:disabled,
  form.pullsheet-page .professional-pull-table select:disabled {
    background-color: #eef1f4 !important;
    color: #273142 !important;
    -webkit-text-fill-color: #273142 !important;
    opacity: 1 !important;
  }

  /* Keep recently-changed QTY warning visually distinct and readable. */
  form.pullsheet-page .professional-pull-table tbody tr.gear-row.recently-changed-row > td.qty-cell input,
  form.pullsheet-page .professional-pull-table tbody tr.gear-row.live-row-updated > td.qty-cell input {
    background-color: #fffbd1 !important;
    color: #171300 !important;
    -webkit-text-fill-color: #171300 !important;
    border-color: #7d6100 !important;
  }

  /* Native select arrows can disappear after -webkit-appearance:none.
     Use a small CSS arrow that remains visible on the white control. */
  form.pullsheet-page .professional-pull-table select {
    padding-right: 26px !important;
    background-image:
      linear-gradient(45deg, transparent 50%, #374151 50%),
      linear-gradient(135deg, #374151 50%, transparent 50%) !important;
    background-position:
      calc(100% - 14px) 50%,
      calc(100% - 9px) 50% !important;
    background-size: 5px 5px, 5px 5px !important;
    background-repeat: no-repeat !important;
  }
}


/* WHGSP 2026-08-13 v6: regular-user Simplified includes ITEM.
   Visible columns: QTY, ITEM, NOTES, PULLED, CROSSLOAD, LOADED, RETURNED. */
.regular-user-pullsheet.view-simplified .professional-pull-table col.item-col {
  display: table-column !important;
}
.regular-user-pullsheet.view-simplified .professional-pull-table > thead > tr > th:nth-child(2),
.regular-user-pullsheet.view-simplified .professional-pull-table > tbody > tr:not(.department-row) > td:nth-child(2) {
  display: table-cell !important;
}

/* Seven readable columns on phones; table remains horizontally swipeable. */
@media screen and (max-width: 700px) {
  form.pullsheet-page.regular-user-pullsheet.view-simplified
  .theatrix-table.professional-pull-table {
    width: 1160px !important;
    min-width: 1160px !important;
    max-width: none !important;
    table-layout: fixed !important;
  }

  form.pullsheet-page.regular-user-pullsheet.view-simplified
  .professional-pull-table col.qty-col { width: 96px !important; }

  form.pullsheet-page.regular-user-pullsheet.view-simplified
  .professional-pull-table col.item-col {
    display: table-column !important;
    width: 260px !important;
  }

  form.pullsheet-page.regular-user-pullsheet.view-simplified
  .professional-pull-table col.notes-col { width: 300px !important; }

  form.pullsheet-page.regular-user-pullsheet.view-simplified
  .professional-pull-table col.inv-col { width: 120px !important; }

  form.pullsheet-page.regular-user-pullsheet.view-simplified
  .professional-pull-table col.crossload-col { width: 135px !important; }

  form.pullsheet-page.regular-user-pullsheet.view-simplified
  .professional-pull-table col.loaded-col { width: 120px !important; }

  form.pullsheet-page.regular-user-pullsheet.view-simplified
  .professional-pull-table col.return-col { width: 129px !important; }
}


/* WHGSP 2026-08-13 v7: DELETE is admin-only.
   Regular users never see the DELETE column in Simplified or Advanced view. */
.regular-user-pullsheet .professional-pull-table col.delete-col {
  display: none !important;
  width: 0 !important;
}
.regular-user-pullsheet .professional-pull-table > thead > tr > th:nth-child(10),
.regular-user-pullsheet .professional-pull-table > tbody > tr:not(.department-row) > td:nth-child(10) {
  display: none !important;
}

/* Advanced mobile table no longer reserves space for DELETE for regular users. */
@media screen and (max-width: 700px) {
  form.pullsheet-page.regular-user-pullsheet.view-advanced
  .theatrix-table.professional-pull-table {
    width: 1260px !important;
    min-width: 1260px !important;
  }
}

/* Pullsheet 5-minute autosave status */
.pullsheet-autosave-status {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 10px;
  border: 1px solid var(--border, #cbd5e1);
  border-radius: 7px;
  font-size: 0.88rem;
  font-weight: 600;
  white-space: nowrap;
  background: var(--card-bg, #fff);
}
.pullsheet-autosave-status[data-state="pending"] { opacity: .78; }
.pullsheet-autosave-status[data-state="saving"] { font-style: italic; }
.pullsheet-autosave-status[data-state="error"] { border-color: #b91c1c; }
