/* Manufacturing-factory order workbench: mobile-only layout corrections.
   The wrapper remains layout-transparent on desktop; mobile data-rail logic
   promotes it to the horizontal order-data scroller when required. */
.factory-order-data-scroll {
  display: contents;
}

@media (max-width: 760px) {
  /* This workbench has exactly three peer destinations, so keep all three
     visible and distribute the full mobile row between them. */
  .factory-body #factory-workbench > .factory-tabs {
    display: grid !important;
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    overflow: visible !important;
    touch-action: pan-y !important;
  }

  .factory-body #factory-workbench > .factory-tabs > button {
    flex: 1 1 0 !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: none !important;
    padding-inline: 5px !important;
    white-space: nowrap !important;
  }

  /* The page already identifies the active destination in the tab row.
     Remove the repeated card title while preserving any order alert text. */
  .factory-body [data-factory-panel="orders"] .factory-orders-card-heading {
    margin-bottom: 0;
  }

  .factory-body [data-factory-panel="orders"] .factory-orders-card-heading > h3 {
    display: none;
  }

  /* Only the table/list wrapper may scroll horizontally. Period headings and
     batch actions remain anchored in the visible card. */
  .factory-body .factory-order-period.is-current {
    display: grid !important;
    overflow: visible !important;
  }

  .factory-body .factory-order-data-scroll.mobile-data-scroll {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
  }

  /* Arrange the current-order actions as one express row, then a balanced
     three-button row and two-button row in the existing system palette. */
  .factory-body .factory-order-batch-toolbar {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 6px;
    width: 100%;
    padding: 8px;
    border: 1px solid #d6e4f4;
    border-radius: 8px;
    background: #f5f9ff;
  }

  .factory-body .factory-order-batch-toolbar > span,
  .factory-body .factory-order-batch-toolbar .factory-domestic-express-control {
    grid-column: 1 / -1;
    width: 100%;
    margin: 0;
  }

  .factory-body .factory-order-batch-toolbar .factory-domestic-express-control {
    grid-template-columns: 72px minmax(0, 1fr);
  }

  .factory-body .factory-order-batch-toolbar > button {
    width: 100%;
    min-width: 0;
    min-height: 34px;
    padding: 5px 6px;
  }

  .factory-body .factory-order-batch-toolbar .factory-order-select-all,
  .factory-body .factory-order-batch-toolbar .factory-order-cancel-selection,
  .factory-body .factory-order-batch-toolbar .factory-order-download-button {
    grid-column: span 2;
  }

  .factory-body .factory-order-batch-toolbar .factory-order-ship-button,
  .factory-body .factory-order-batch-toolbar .factory-order-batch-print-button {
    grid-column: span 3;
  }

  .factory-body .factory-order-batch-toolbar .factory-order-ship-button {
    color: #fff;
    border-color: transparent;
    background: linear-gradient(135deg, var(--teal), var(--blue));
    box-shadow: 0 5px 14px rgba(36, 110, 210, .18);
  }
}
