/* Despacho compact correction: better distribution, lower map, less redundancy. */
#orders .order-layout {
  grid-template-columns: minmax(0, 1.36fr) minmax(430px, 0.82fr);
  gap: 16px;
}

#orders .order-layout > .panel:first-child {
  display: grid;
  grid-template-columns: minmax(300px, 0.92fr) minmax(260px, 0.58fr);
  grid-auto-rows: min-content;
  gap: 8px 12px;
  align-items: start;
}

#orders .order-layout > .panel:first-child .panel-heading,
#orders .order-layout > .panel:first-child .dispatch-details,
#orders .order-layout > .panel:first-child .order-actions,
#orders .order-layout > .panel:first-child #orderScanStatus {
  grid-column: 1 / -1;
}

#orders #orderDropZone {
  grid-column: 1;
  width: 100%;
  min-width: 0;
  min-height: 62px;
  padding: 10px 16px;
}

#orders #orderDropZone > span {
  gap: 2px;
  padding-left: 30px;
}

#orders #orderDropZone strong,
#orders #orderDropZone span span {
  font-size: 11px;
}

#orders #orderImportStatus {
  grid-column: 1;
  min-height: 22px;
  margin: 0;
  font-size: 11px;
}

#orders .active-orders-list {
  position: static;
  grid-column: 2;
  grid-row: 2 / 4;
  width: 100%;
  max-height: 96px;
  grid-template-columns: 1fr;
  align-self: stretch;
}

#orders[data-dispatch-mode="multi"] .active-orders-list {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  max-height: 98px;
}

#orders .active-order-card {
  min-height: 54px;
  padding: 7px 8px;
  grid-template-columns: minmax(0, 1fr) 38px 50px;
}

#orders .active-order-card strong {
  font-size: 10.5px;
}

#orders .active-order-card span {
  font-size: 9.5px;
}

#orders .active-order-card .mini-window-button {
  width: auto;
  min-width: 38px;
  height: 22px;
  min-height: 22px;
  font-size: 9.5px;
}

#orders .dispatch-details {
  gap: 8px;
  margin: 2px 0 0;
}

#orders .dispatch-details input {
  height: 26px;
  min-height: 26px;
  font-size: 11px;
}

#orders .order-actions {
  grid-template-columns: 1.1fr repeat(3, 0.64fr);
  gap: 6px;
  margin-top: 2px;
}

#orders .order-actions button {
  height: 27px;
  min-height: 27px;
  padding: 0 8px;
  font-size: 10px;
}

#orders #orderPhoneBtn::before {
  width: 12px;
  height: 12px;
  margin-right: 5px;
}

#orders #orderScanStatus {
  min-height: 24px;
  margin: 2px 0 0;
  padding: 0 8px;
  font-size: 11px;
}

#orders .order-layout > .panel:nth-child(2) {
  padding: 12px;
}

#orders .dispatch-map {
  padding: 7px;
}

#orders .warehouse-grid {
  grid-template-columns: 52px repeat(4, minmax(48px, 1fr)) 54px 34px 34px;
  grid-auto-rows: 17px;
  gap: 3px;
}

#orders .map-row-label {
  font-size: 10.5px;
}

#orders .map-row-label span {
  font-size: 8.5px;
}

#orders .shelf-zone {
  font-size: 10px;
  border-width: 1px;
}

#orders .shelf-zone span {
  font-size: 7.5px;
}

#orders .aisle-label {
  font-size: 9.5px;
}

#orders .map-room,
#orders .main-aisle {
  min-height: 34px;
  font-size: 11px;
}

#orders #orderMapLegend {
  min-height: 28px;
  margin-top: 8px;
  padding: 0 10px;
  font-size: 10.5px;
}

#orders .order-metrics {
  gap: 8px;
  margin-top: 8px;
}

#orders .order-metric {
  min-height: 50px;
  padding: 9px 34px 8px 10px;
}

#orders .order-metric::after {
  right: 10px;
  width: 16px;
  height: 16px;
}

#orders .order-metric span {
  margin-bottom: 4px;
  font-size: 10px;
}

#orders .order-metric strong {
  font-size: 20px;
}

#orders[data-dispatch-mode="single"] .order-tables {
  grid-template-columns: minmax(0, 1fr);
}

#orders[data-dispatch-mode="single"] .order-tables > .panel:nth-child(2) {
  display: none;
}

#orders[data-dispatch-mode="single"] .order-table-wrap {
  max-height: 250px;
}

#orders[data-dispatch-mode="multi"] .order-tables {
  grid-template-columns: minmax(0, 0.9fr) minmax(520px, 1.1fr);
}

#orders[data-dispatch-mode="multi"] .packing-boards {
  grid-template-columns: repeat(5, minmax(190px, 1fr));
}

#orders[data-dispatch-mode="multi"] .packing-board {
  padding: 10px;
}

#orders[data-dispatch-mode="multi"] .packing-board-lines {
  max-height: 160px;
}

@media (max-width: 1400px) {
  #orders .order-layout {
    grid-template-columns: minmax(0, 1.28fr) minmax(390px, 0.82fr);
  }

  #orders .order-layout > .panel:first-child {
    grid-template-columns: minmax(260px, 0.9fr) minmax(230px, 0.58fr);
  }

  #orders .warehouse-grid {
    grid-template-columns: 48px repeat(4, minmax(42px, 1fr)) 50px 31px 31px;
    grid-auto-rows: 16px;
  }
}
