/* Pedido reference layout refresh. Visual-only, keeps all existing controls and handlers. */
#orders.view.active {
  padding: 24px 28px 34px;
  background: linear-gradient(180deg, #f8fbff 0%, #f6f8fc 100%);
}

#orders .order-layout {
  grid-template-columns: minmax(0, 1.34fr) minmax(460px, 0.86fr);
  gap: 20px;
}

#orders .order-layout > .panel:first-child {
  grid-template-columns: minmax(280px, 0.8fr) minmax(360px, 1fr);
  gap: 14px 16px;
  padding: 22px;
  min-height: 430px;
}

#orders .order-layout > .panel:first-child .panel-heading {
  grid-column: 1 / -1;
  margin-bottom: 4px;
}

#orders .order-layout > .panel:first-child .panel-heading h2 {
  font-size: 18px;
}

#orders[data-dispatch-mode="single"] .order-layout > .panel:first-child .panel-heading h2::before {
  content: "Crear / Gestionar ";
}

#orders #orderDropZone {
  grid-column: 1;
  min-height: 174px;
  border-radius: 4px;
  border: 1.5px dashed #8db5ff;
  background: #fbfdff;
}

#orders #orderDropZone > span {
  padding-left: 0;
  text-align: center;
  color: #536487;
  font-size: 14px;
}

#orders #orderDropZone > span::before {
  position: static;
  display: block;
  width: 28px;
  height: 28px;
  margin: 0 auto 14px;
  background: #536487;
}

#orders #orderDropZone strong,
#orders #orderDropZone span span {
  display: block;
  max-width: 190px;
  margin: 0 auto;
  color: #536487;
  font-size: 14px;
  line-height: 1.35;
  font-weight: 900;
}

#orders .active-orders-list {
  grid-column: 2;
  grid-row: 2;
  align-self: stretch;
  max-height: none;
  padding: 42px 12px 12px;
  position: relative;
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  border: 1px solid #dbe4f2;
  border-radius: 8px;
  background: #ffffff;
  overflow: auto;
}

#orders .active-orders-list::before {
  content: "Pedidos activos";
  position: absolute;
  left: 14px;
  top: 13px;
  color: #071a44;
  font-size: 13px;
  font-weight: 900;
}

#orders .active-order-card {
  min-height: 66px;
  grid-template-columns: minmax(0, 1fr) 56px 66px;
  padding: 10px;
  border-radius: 6px;
}

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

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

#orders .active-order-card .mini-window-button {
  height: 30px;
  min-height: 30px;
  font-size: 11px;
}

#orders .dispatch-details {
  grid-column: 1 / -1;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-top: 4px;
}

#orders .dispatch-details label {
  font-size: 12px;
}

#orders .dispatch-details input {
  height: 38px;
  min-height: 38px;
  border-radius: 5px;
  font-size: 13px;
}

#orders .order-actions {
  grid-column: 1 / -1;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-top: 0;
}

#orders .order-actions::before {
  content: none;
  display: none;
}

#orders .order-actions button {
  height: 44px;
  min-height: 44px;
  border-radius: 6px;
  font-size: 13px;
}

#orders #prepareOrderBtn { grid-column: 1; grid-row: 1; }
#orders #saveOrderBtn { grid-column: 2; grid-row: 1; }
#orders #finishOrderBtn { grid-column: 3; grid-row: 1; }
#orders #clearOrderBtn { grid-column: 4; grid-row: 1; }
#orders #orderPhoneBtn { grid-column: 1; grid-row: 2; }
#orders #printPickListBtn { grid-column: 2; grid-row: 2; }
#orders #printMapBtn { grid-column: 3; grid-row: 2; }
#orders #printLabelBtn {
  grid-column: 4;
  grid-row: 2;
  display: inline-flex;
}

#orders .order-layout > .panel:nth-child(2) {
  padding: 20px;
  min-height: 430px;
}

#orders .order-layout > .panel:nth-child(2) .panel-heading h2 {
  font-size: 18px;
}

#orders .dispatch-map {
  padding: 10px;
  border-color: #1f2937;
  background: #eef2f5;
}

#orders .warehouse-grid {
  grid-template-columns: 54px repeat(4, minmax(52px, 1fr)) 58px 39px 39px;
  grid-auto-rows: 22px;
  gap: 4px;
}

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

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

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

#orders #orderMapLegend {
  display: none;
}

#orders #orderMapLegend::before {
  content: none;
  display: none;
}

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

#orders .order-metric {
  min-height: 96px;
  padding: 18px 52px 16px 18px;
  border-radius: 8px;
}

#orders .order-metric span {
  font-size: 13px;
}

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

#orders .order-tables {
  grid-template-columns: minmax(0, 1fr);
  margin-top: 18px;
}

#orders .order-tables > .panel:first-child {
  padding: 22px;
}

#orders .order-tables > .panel:first-child .panel-heading h2 {
  font-size: 18px;
}

#orders .order-table-wrap {
  max-height: none;
  border-radius: 8px;
}

#orders .order-table-wrap table {
  min-width: 100%;
}

#orders .order-table-wrap th,
#orders .order-table-wrap td {
  height: 38px;
  padding: 7px 14px;
  font-size: 13px;
}

#orders .order-table-wrap th {
  height: 36px;
  font-size: 12px;
}

#orders .pick-check-label {
  font-size: 12px;
}

#orders .pick-check-label input {
  width: 18px;
  height: 18px;
  min-height: 18px;
}

#orders .badge {
  min-width: 96px;
  min-height: 24px;
  font-size: 12px;
}

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

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

#orders[data-dispatch-mode="multi"] .order-tables > .panel:nth-child(2) {
  display: block;
  padding: 22px;
}

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

@media (max-width: 1400px) {
  #orders.view.active {
    padding: 20px 22px 28px;
  }

  #orders .order-layout {
    grid-template-columns: minmax(0, 1.28fr) minmax(420px, 0.82fr);
  }

  #orders .order-layout > .panel:first-child {
    grid-template-columns: minmax(240px, 0.78fr) minmax(300px, 1fr);
  }

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

  #orders .order-actions {
    gap: 10px;
  }
}

/* Pedido final reference styling: visual only, existing IDs/actions are preserved. */
body[data-active-view="orders"] #orders.view.active {
  padding: 22px 24px 32px;
  background: linear-gradient(180deg, #f8fbff 0%, #f6f8fc 100%);
}

#orders .order-layout {
  grid-template-columns: minmax(680px, 1.16fr) minmax(460px, 0.84fr);
  gap: 16px;
  align-items: stretch;
}

#orders .order-layout > .panel {
  border: 1px solid #dbe4f2;
  border-radius: 10px;
  box-shadow: 0 14px 30px rgba(7, 26, 68, 0.06);
}

#orders .order-layout > .panel:first-child {
  min-height: 386px;
  padding: 20px;
  grid-template-columns: minmax(260px, 0.72fr) minmax(360px, 1fr);
  gap: 12px 16px;
}

#orders .order-layout > .panel:first-child .panel-heading {
  margin: 0 0 4px;
}

#orders .order-layout > .panel:first-child .panel-heading h2,
#orders .order-layout > .panel:nth-child(2) .panel-heading h2,
#orders .order-tables > .panel:first-child .panel-heading h2 {
  font-size: 17px;
  font-weight: 900;
}

#orders #orderDropZone {
  min-height: 150px;
  padding: 20px;
  border: 1.5px dashed #7fb0ff;
  border-radius: 4px;
  background: #fbfdff;
  display: grid;
  place-items: center;
}

#orders #orderDropZone > span {
  max-width: 190px;
  display: grid;
  justify-items: center;
  gap: 8px;
  color: #536487;
  font-size: 13px;
  line-height: 1.35;
  text-align: center;
}

#orders #orderDropZone > span::before {
  width: 30px;
  height: 30px;
  margin: 0 0 4px;
  background: #536487;
}

#orders #orderDropZone strong {
  color: #071a44;
  font-size: 14px;
  font-weight: 900;
}

#orders #orderDropZone span span {
  color: #536487;
  font-size: 13px;
  font-weight: 800;
}

#orders .active-orders-list {
  min-height: 150px;
  max-height: 184px;
  padding: 38px 10px 10px;
  gap: 8px;
  border-radius: 6px;
  overflow: auto;
}

#orders .active-orders-list::before {
  left: 12px;
  top: 11px;
  font-size: 13px;
}

#orders .active-order-card {
  min-height: 56px;
  grid-template-columns: minmax(0, 1fr) 52px 62px;
  gap: 8px;
  padding: 9px 10px;
  border-radius: 5px;
}

#orders .active-order-card strong {
  font-size: 11.5px;
  line-height: 1.2;
}

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

#orders .active-order-card .mini-window-button {
  height: 30px;
  min-height: 30px;
  padding: 0 8px;
  font-size: 11px;
}

#orders .dispatch-details {
  gap: 14px;
  margin-top: 0;
}

#orders .dispatch-details label {
  gap: 5px;
  color: #536487;
  font-size: 11.5px;
  font-weight: 900;
}

#orders .dispatch-details input {
  height: 36px;
  min-height: 36px;
  border-radius: 5px;
  font-size: 13px;
  font-weight: 900;
}

#orders .order-actions {
  grid-template-columns: 96px repeat(4, minmax(128px, 1fr));
  gap: 10px 12px;
  align-items: stretch;
}

#orders .order-actions::before {
  content: "Herramientas";
  grid-column: 1;
  grid-row: 2;
  min-height: 40px;
  display: flex;
  align-items: center;
  padding-left: 10px;
  border-radius: 5px;
  background: #fbfdff;
  color: #536487;
  font-size: 11.5px;
  font-weight: 900;
}

#orders .order-actions button {
  height: 40px;
  min-height: 40px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 12.5px;
}

#orders #prepareOrderBtn { grid-column: 1 / 3; grid-row: 1; }
#orders #saveOrderBtn { grid-column: 3; grid-row: 1; }
#orders #finishOrderBtn { grid-column: 4; grid-row: 1; }
#orders #clearOrderBtn { grid-column: 5; grid-row: 1; }
#orders #orderPhoneBtn { grid-column: 2; grid-row: 2; }
#orders #printPickListBtn { grid-column: 3; grid-row: 2; }
#orders #printMapBtn { grid-column: 4; grid-row: 2; }
#orders #printLabelBtn { grid-column: 5; grid-row: 2; display: inline-flex; }

#orders .order-layout > .panel:nth-child(2) {
  min-height: 386px;
  padding: 18px;
  position: relative;
}

#orders .order-layout > .panel:nth-child(2)::after {
  content: "↗";
  position: absolute;
  right: 18px;
  top: 18px;
  color: #071a44;
  font-size: 18px;
  font-weight: 900;
}

#orders .order-layout > .panel:nth-child(2) .panel-heading {
  margin-bottom: 10px;
}

#orders .dispatch-map {
  padding: 8px;
  border: 2px solid #1f2937;
  border-radius: 0;
  background: #eef2f5;
}

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

#orders .shelf-zone {
  min-height: 0;
  border-radius: 2px;
  font-size: 11px;
}

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

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

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

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

#orders .map-room,
#orders .main-aisle {
  min-height: 36px;
  border-radius: 2px;
  font-size: 12px;
}

#orders #orderMapLegend {
  min-height: 38px;
  margin: 10px 0 0;
  padding: 0 18px;
  display: flex;
  align-items: center;
  justify-content: space-around;
  gap: 16px;
  border: 1px solid #dbe4f2;
  border-radius: 5px;
  background: #ffffff;
  color: transparent;
  font-size: 0;
}

#orders #orderMapLegend::before {
  content: "●  Disponible      ●  Reservado      ●  Ocupado      ●  Seleccionado";
  display: block;
  width: 100%;
  color: #071a44;
  word-spacing: 10px;
  font-size: 10.5px;
  font-weight: 900;
  text-align: center;
}

#orders .order-metrics {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 14px;
}

#orders .order-metric {
  min-height: 76px;
  padding: 13px 38px 12px 14px;
  border-radius: 6px;
}

#orders .order-metric span {
  font-size: 12px;
}

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

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

#orders .order-tables > .panel:first-child {
  padding: 18px 20px 16px;
}

#orders .order-tables > .panel:first-child .panel-heading {
  margin-bottom: 10px;
}

#orders .order-table-wrap {
  max-height: 248px;
  overflow: auto;
  border: 1px solid #dbe4f2;
  border-radius: 7px;
}

#orders .order-table-wrap table {
  min-width: 100%;
}

#orders .order-table-wrap th,
#orders .order-table-wrap td {
  height: 32px;
  padding: 6px 14px;
  font-size: 12px;
}

#orders .order-table-wrap th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f0f5fb;
  font-size: 11.5px;
}

#orders .pick-check-label input {
  width: 15px;
  height: 15px;
  min-height: 15px;
}

#orders .badge {
  min-width: 84px;
  min-height: 22px;
  font-size: 11px;
}

/* Final order layout hardening: remove page overflow and give quote/packing cards room. */
body[data-active-view="orders"],
body[data-active-view="orders"] .main {
  overflow-x: hidden;
}

body[data-active-view="orders"] #orders.view.active {
  max-width: 100%;
  overflow-x: hidden;
}

#orders .order-layout,
#orders .order-tables,
#orders .order-layout > .panel,
#orders .order-tables > .panel {
  min-width: 0;
  max-width: 100%;
}

#orders .order-layout {
  grid-template-columns: minmax(0, 1.38fr) minmax(380px, 0.82fr);
}

#orders .order-layout > .panel:first-child {
  grid-template-columns: minmax(260px, 0.9fr) minmax(300px, 0.78fr);
  grid-template-areas:
    "heading heading"
    "drop orders"
    "status orders"
    "details details"
    "actions actions"
    "scan scan";
}

#orders .order-layout > .panel:first-child .panel-heading {
  grid-area: heading;
  grid-column: auto;
}

#orders #orderDropZone {
  grid-area: drop;
  grid-column: auto;
  min-width: 0;
}

#orders #orderImportStatus {
  grid-area: status;
  grid-column: auto;
}

#orders .active-orders-list {
  grid-area: orders;
  grid-column: auto;
  grid-row: auto;
  width: 100%;
  min-width: 0;
  max-height: 154px;
  margin: 0;
}

#orders[data-dispatch-mode="multi"] .active-orders-list {
  grid-template-columns: 1fr;
  max-height: 136px;
}

#orders .active-order-card {
  min-width: 0;
  grid-template-columns: minmax(0, 1fr) auto auto;
}

#orders .active-order-card strong {
  overflow: visible;
  white-space: normal;
  text-overflow: clip;
}

#orders .active-order-card span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#orders .dispatch-details {
  grid-area: details;
  grid-column: auto;
  min-width: 0;
}

#orders .order-actions {
  grid-area: actions;
  grid-column: auto;
  min-width: 0;
  grid-template-columns: minmax(86px, 0.64fr) repeat(4, minmax(112px, 1fr));
}

#orders #orderScanStatus {
  grid-area: scan;
  grid-column: auto;
}

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

#orders[data-dispatch-mode="multi"] .order-tables > .panel:nth-child(2) {
  min-width: 0;
}

#orders[data-dispatch-mode="multi"] .packing-boards {
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  overflow-x: hidden;
  overflow-y: visible;
}

#orders[data-dispatch-mode="multi"] .packing-board,
#orders .packing-board-lines {
  min-width: 0;
  max-width: 100%;
}

#orders[data-dispatch-mode="multi"] .packing-board-table {
  width: 100%;
  min-width: 100%;
  table-layout: fixed;
}

#orders[data-dispatch-mode="multi"] .packing-board-table th,
#orders[data-dispatch-mode="multi"] .packing-board-table td {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#orders[data-dispatch-mode="multi"] .packing-board-table th:nth-child(1),
#orders[data-dispatch-mode="multi"] .packing-board-table td:nth-child(1) {
  width: 25%;
}

#orders[data-dispatch-mode="multi"] .packing-board-table th:nth-child(2),
#orders[data-dispatch-mode="multi"] .packing-board-table td:nth-child(2) {
  width: 28%;
}

#orders[data-dispatch-mode="multi"] .packing-board-table th:nth-child(3),
#orders[data-dispatch-mode="multi"] .packing-board-table td:nth-child(3) {
  width: 18%;
}

#orders[data-dispatch-mode="multi"] .packing-board-table th:nth-child(4),
#orders[data-dispatch-mode="multi"] .packing-board-table td:nth-child(4) {
  width: 14%;
}

#orders[data-dispatch-mode="multi"] .packing-board-table th:nth-child(5),
#orders[data-dispatch-mode="multi"] .packing-board-table td:nth-child(5) {
  width: 15%;
}

@media (max-width: 1400px) {
  #orders .order-layout,
  #orders[data-dispatch-mode="multi"] .order-tables {
    grid-template-columns: minmax(0, 1fr);
  }

  #orders .order-layout > .panel:first-child {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
      "heading"
      "drop"
      "orders"
      "status"
      "details"
      "actions"
      "scan";
  }

  #orders .active-orders-list,
  #orders[data-dispatch-mode="multi"] .active-orders-list {
    max-height: 180px;
  }

  #orders .order-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  #orders .order-actions::before {
    grid-column: 1 / -1;
    grid-row: auto;
  }

  #orders #prepareOrderBtn,
  #orders #saveOrderBtn,
  #orders #finishOrderBtn,
  #orders #clearOrderBtn,
  #orders #orderPhoneBtn,
  #orders #printPickListBtn,
  #orders #printMapBtn,
  #orders #printLabelBtn {
    grid-column: auto;
    grid-row: auto;
  }
}

/* Structured order composer: upload, quotes, details and actions are explicit sections. */
#orders .order-layout > .order-create-panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 0;
}

#orders .order-create-panel > .panel-heading,
#orders .order-create-panel > .order-entry-grid,
#orders .order-create-panel > .dispatch-details,
#orders .order-create-panel > .order-actions,
#orders .order-create-panel > #orderScanStatus {
  width: 100%;
}

#orders .order-entry-grid {
  display: grid;
  grid-template-columns: minmax(320px, 1fr) minmax(340px, 0.88fr);
  gap: 14px;
  align-items: stretch;
  min-width: 0;
}

#orders .order-entry-grid > *,
#orders .order-upload-stack > * {
  grid-area: auto;
  grid-column: auto;
  grid-row: auto;
}

#orders .order-upload-stack {
  min-width: 0;
  display: grid;
  grid-template-rows: minmax(142px, 1fr) auto;
  gap: 8px;
}

#orders .order-create-panel #orderDropZone {
  width: 100%;
  min-width: 0;
  min-height: 142px;
}

#orders .order-create-panel #orderImportStatus {
  min-height: 30px;
  margin: 0;
  padding: 7px 10px;
  display: flex;
  align-items: center;
  font-size: 11.5px;
  line-height: 1.25;
}

#orders .order-create-panel .active-orders-list {
  position: relative;
  width: 100%;
  min-width: 0;
  min-height: 180px;
  max-height: 180px;
  margin: 0;
  padding: 40px 12px 12px;
  align-self: stretch;
  grid-template-columns: 1fr;
}

#orders[data-dispatch-mode="multi"] .order-create-panel .active-orders-list {
  min-height: 180px;
  max-height: 180px;
}

#orders .order-create-panel .active-orders-list::before {
  left: 12px;
  top: 12px;
}

#orders .order-create-panel .active-order-card {
  min-height: 58px;
  padding: 9px 10px;
  gap: 5px 8px;
}

#orders .order-create-panel .dispatch-details {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin: 0;
}

#orders .order-create-panel .order-actions {
  display: grid;
  grid-template-columns: minmax(100px, 0.5fr) repeat(4, minmax(128px, 1fr));
  gap: 9px 12px;
  margin: 0;
}

#orders .order-create-panel .order-actions button {
  min-width: 0;
}

#orders .order-create-panel #orderScanStatus {
  min-height: 0;
  margin: 0;
}

@media (max-width: 1500px) {
  #orders .order-entry-grid {
    grid-template-columns: minmax(300px, 0.96fr) minmax(310px, 0.9fr);
  }

  #orders .order-create-panel .order-actions {
    grid-template-columns: minmax(96px, 0.5fr) repeat(4, minmax(112px, 1fr));
  }
}

@media (max-width: 1200px) {
  #orders .order-entry-grid,
  #orders .order-create-panel .dispatch-details,
  #orders .order-create-panel .order-actions {
    grid-template-columns: minmax(0, 1fr);
  }

  #orders .order-create-panel .order-actions::before,
  #orders .order-create-panel .order-actions button {
    grid-column: auto;
    grid-row: auto;
  }
}

/* Final order composer reset: wins over the earlier first-child grid rules. */
#orders.view .order-layout {
  align-items: start;
}

#orders.view .order-layout > .panel.order-create-panel:first-child {
  display: flex;
  flex-direction: column;
  grid-template-columns: none;
  grid-template-areas: none;
  grid-auto-rows: auto;
  gap: 12px;
  align-self: start;
  min-height: 0;
  height: auto;
  padding: 20px;
}

#orders.view .order-layout > .panel.order-create-panel:first-child > .panel-heading,
#orders.view .order-layout > .panel.order-create-panel:first-child > .order-entry-grid,
#orders.view .order-layout > .panel.order-create-panel:first-child > .dispatch-details,
#orders.view .order-layout > .panel.order-create-panel:first-child > .order-actions,
#orders.view .order-layout > .panel.order-create-panel:first-child > #orderScanStatus {
  width: 100%;
  grid-area: auto;
  grid-column: auto;
  grid-row: auto;
  margin: 0;
}

#orders.view .order-layout > .panel.order-create-panel:first-child .order-entry-grid,
#orders.view .order-layout > .panel.order-create-panel:first-child .order-upload-stack,
#orders.view .order-layout > .panel.order-create-panel:first-child #orderDropZone,
#orders.view .order-layout > .panel.order-create-panel:first-child #orderImportStatus,
#orders.view .order-layout > .panel.order-create-panel:first-child .active-orders-list {
  position: static;
  inset: auto;
  grid-area: auto;
  grid-column: auto;
  grid-row: auto;
  width: auto;
  max-width: 100%;
  box-sizing: border-box;
}

#orders.view .order-layout > .panel.order-create-panel:first-child .order-entry-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: stretch;
  min-width: 0;
}

#orders.view .order-layout > .panel.order-create-panel:first-child .active-orders-list {
  order: 1;
  position: relative;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 8px;
  min-height: 108px;
  max-height: 146px;
  padding: 38px 12px 12px;
  border: 1px solid #dbe4f2;
  border-radius: 8px;
  background: #ffffff;
  overflow: auto;
}

#orders.view .order-layout > .panel.order-create-panel:first-child .active-orders-list.empty-state {
  display: flex;
  align-items: center;
  justify-content: center;
  padding-top: 38px;
  color: #536487;
  font-size: 12px;
  font-weight: 800;
}

#orders.view .order-layout > .panel.order-create-panel:first-child .active-orders-list::before {
  left: 12px;
  top: 12px;
}

#orders.view .order-layout > .panel.order-create-panel:first-child .active-order-card {
  min-width: 0;
  min-height: 54px;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 5px 8px;
  padding: 9px 10px;
}

#orders.view .order-layout > .panel.order-create-panel:first-child .active-order-card strong {
  grid-column: 1 / -1;
  font-size: 11.5px;
}

#orders.view .order-layout > .panel.order-create-panel:first-child .active-order-card span {
  grid-column: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#orders.view .order-layout > .panel.order-create-panel:first-child .active-order-card .mini-window-button {
  min-width: 58px;
  height: 30px;
  min-height: 30px;
}

#orders.view .order-layout > .panel.order-create-panel:first-child .order-upload-stack {
  order: 2;
  display: grid;
  grid-template-columns: minmax(260px, 420px) minmax(0, 1fr);
  gap: 12px;
  align-items: stretch;
  min-width: 0;
}

#orders.view .order-layout > .panel.order-create-panel:first-child #orderDropZone {
  display: flex;
  min-width: 0;
  min-height: 118px;
  margin: 0;
  padding: 16px;
  align-items: center;
  justify-content: center;
}

#orders.view .order-layout > .panel.order-create-panel:first-child #orderDropZone > span {
  display: grid;
  gap: 4px;
  justify-items: center;
  padding-left: 0;
  text-align: center;
}

#orders.view .order-layout > .panel.order-create-panel:first-child #orderDropZone strong,
#orders.view .order-layout > .panel.order-create-panel:first-child #orderDropZone span span {
  max-width: 240px;
  margin: 0;
}

#orders.view .order-layout > .panel.order-create-panel:first-child #orderImportStatus {
  display: flex;
  min-height: 118px;
  margin: 0;
  padding: 14px 16px;
  align-items: center;
  justify-content: flex-start;
  border: 1px solid #dbe4f2;
  border-radius: 8px;
  background: #f8fbff;
  color: #304464;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.35;
}

#orders.view .order-layout > .panel.order-create-panel:first-child .dispatch-details {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

#orders.view .order-layout > .panel.order-create-panel:first-child .order-actions {
  display: grid;
  grid-template-columns: minmax(96px, 0.48fr) repeat(4, minmax(126px, 1fr));
  gap: 9px 12px;
}

#orders.view .order-layout > .panel.order-create-panel:first-child .order-actions::before {
  grid-column: 1;
  grid-row: 2;
  align-self: center;
}

#orders.view .order-layout > .panel.order-create-panel:first-child #prepareOrderBtn { grid-column: 1 / 3; grid-row: 1; }
#orders.view .order-layout > .panel.order-create-panel:first-child #saveOrderBtn { grid-column: 3; grid-row: 1; }
#orders.view .order-layout > .panel.order-create-panel:first-child #finishOrderBtn { grid-column: 4; grid-row: 1; }
#orders.view .order-layout > .panel.order-create-panel:first-child #clearOrderBtn { grid-column: 5; grid-row: 1; }
#orders.view .order-layout > .panel.order-create-panel:first-child #orderPhoneBtn { grid-column: 2; grid-row: 2; }
#orders.view .order-layout > .panel.order-create-panel:first-child #printPickListBtn { grid-column: 3; grid-row: 2; }
#orders.view .order-layout > .panel.order-create-panel:first-child #printMapBtn { grid-column: 4; grid-row: 2; }
#orders.view .order-layout > .panel.order-create-panel:first-child #printLabelBtn {
  grid-column: 5;
  grid-row: 2;
}

#orders.view .order-layout > .panel.order-create-panel:first-child .order-actions button {
  min-width: 0;
}

@media (max-width: 1500px) {
  #orders.view .order-layout > .panel.order-create-panel:first-child .order-upload-stack,
  #orders.view .order-layout > .panel.order-create-panel:first-child .dispatch-details,
  #orders.view .order-layout > .panel.order-create-panel:first-child .order-actions {
    grid-template-columns: minmax(0, 1fr);
  }

  #orders.view .order-layout > .panel.order-create-panel:first-child .order-actions::before,
  #orders.view .order-layout > .panel.order-create-panel:first-child .order-actions button {
    grid-column: auto;
    grid-row: auto;
  }
}

/* Full-width composer correction: use the available panel space instead of a narrow left lane. */
#orders.view .order-layout > .panel.order-create-panel:first-child > .order-entry-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  width: 100%;
  max-width: none;
  align-self: stretch;
  align-items: stretch;
}

#orders.view .order-layout > .panel.order-create-panel:first-child .active-orders-list,
#orders.view .order-layout > .panel.order-create-panel:first-child .order-upload-stack {
  width: 100%;
  max-width: none;
  align-self: stretch;
}

#orders.view .order-layout > .panel.order-create-panel:first-child .active-orders-list {
  grid-template-columns: repeat(auto-fit, minmax(236px, 1fr));
  min-height: 110px;
  max-height: 146px;
}

#orders.view .order-layout > .panel.order-create-panel:first-child .order-upload-stack {
  grid-template-columns: minmax(360px, 1.45fr) minmax(260px, 0.75fr);
}

#orders.view .order-layout > .panel.order-create-panel:first-child #orderDropZone,
#orders.view .order-layout > .panel.order-create-panel:first-child #orderImportStatus {
  width: 100%;
}

@media (max-width: 1280px) {
  #orders.view .order-layout > .panel.order-create-panel:first-child .order-upload-stack,
  #orders.view .order-layout > .panel.order-create-panel:first-child .dispatch-details,
  #orders.view .order-layout > .panel.order-create-panel:first-child .order-actions {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* Requested flow: upload/status first, opened quotes below; remove map status legend. */
#orders.view .order-layout > .panel.order-create-panel:first-child .order-upload-stack {
  order: 1;
}

#orders.view .order-layout > .panel.order-create-panel:first-child .active-orders-list {
  order: 2;
}

#orders.view #orderMapLegend {
  display: none;
}

#orders.view #orderMapLegend::before {
  content: none;
  display: none;
}

/* Compact upload/status row: these are entry controls, not content cards. */
#orders.view .order-layout > .panel.order-create-panel:first-child > .order-entry-grid {
  gap: 8px;
}

#orders.view .order-layout > .panel.order-create-panel:first-child .order-upload-stack {
  gap: 8px;
  grid-template-columns: minmax(320px, 1.5fr) minmax(190px, 0.6fr);
}

#orders.view .order-layout > .panel.order-create-panel:first-child #orderDropZone,
#orders.view .order-layout > .panel.order-create-panel:first-child #orderImportStatus {
  min-height: 72px;
  padding: 9px 12px;
}

#orders.view .order-layout > .panel.order-create-panel:first-child #orderDropZone > span {
  gap: 2px;
}

#orders.view .order-layout > .panel.order-create-panel:first-child #orderDropZone > span::before {
  width: 20px;
  height: 20px;
  margin: 0 auto 4px;
}

#orders.view .order-layout > .panel.order-create-panel:first-child #orderDropZone strong {
  font-size: 13px;
  line-height: 1.15;
}

#orders.view .order-layout > .panel.order-create-panel:first-child #orderDropZone span span {
  font-size: 12px;
  line-height: 1.2;
}

#orders.view .order-layout > .panel.order-create-panel:first-child #orderImportStatus {
  justify-content: center;
  text-align: center;
}

#orders.view .order-layout > .panel.order-create-panel:first-child .active-orders-list {
  min-height: 100px;
  max-height: 126px;
}

@media (max-width: 1280px) {
  #orders.view .order-layout > .panel.order-create-panel:first-child #orderDropZone,
  #orders.view .order-layout > .panel.order-create-panel:first-child #orderImportStatus {
    min-height: 64px;
  }
}

/* Dense dispatch controls: remove inherited tall rows and preserve quote numbers. */
#orders.view .order-layout > .panel.order-create-panel:first-child .order-upload-stack {
  grid-template-rows: none;
  grid-auto-rows: auto;
  gap: 6px;
}

#orders.view .order-layout > .panel.order-create-panel:first-child #orderDropZone,
#orders.view .order-layout > .panel.order-create-panel:first-child #orderImportStatus {
  min-height: 42px;
  padding: 6px 10px;
}

#orders.view .order-layout > .panel.order-create-panel:first-child #orderDropZone > span {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 8px;
  align-items: center;
  justify-content: center;
}

#orders.view .order-layout > .panel.order-create-panel:first-child #orderDropZone > span::before {
  flex: 0 0 15px;
  width: 15px;
  height: 15px;
  margin: 0;
}

#orders.view .order-layout > .panel.order-create-panel:first-child #orderDropZone strong,
#orders.view .order-layout > .panel.order-create-panel:first-child #orderDropZone span span {
  max-width: none;
  font-size: 11.5px;
  line-height: 1.1;
}

#orders.view .order-layout > .panel.order-create-panel:first-child #orderImportStatus {
  font-size: 11.5px;
}

#orders.view .order-layout > .panel.order-create-panel:first-child .active-orders-list {
  min-height: 86px;
  max-height: 110px;
}

#orders.view .order-layout > .panel.order-create-panel:first-child .active-order-card {
  min-height: 48px;
  grid-template-columns: minmax(0, 1fr) 58px 64px;
  gap: 3px 8px;
  padding: 7px 9px;
}

#orders.view .order-layout > .panel.order-create-panel:first-child .active-order-card .active-order-quote {
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
  font-size: 10.8px;
  line-height: 1.18;
}

/* Multi-order mode already exposes client/quote per window and in packing boards. */
#orders.view[data-dispatch-mode="multi"] .order-layout > .panel.order-create-panel:first-child .dispatch-details {
  display: none;
}

/* Interaction safety: keep the hidden file input from covering order actions/cards. */
#orders.view .order-layout > .panel.order-create-panel:first-child {
  position: relative;
}

#orders.view #orderFileInput {
  position: absolute;
  inset: auto;
  left: 0;
  top: 0;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

#orders.view .order-layout > .panel.order-create-panel:first-child #orderDropZone {
  cursor: pointer;
  z-index: 1;
}

#orders.view .order-layout > .panel.order-create-panel:first-child .active-orders-list,
#orders.view .order-layout > .panel.order-create-panel:first-child .order-actions,
#orders.view .order-tables {
  position: relative;
  z-index: 3;
}

#orders.view .order-layout > .panel.order-create-panel:first-child .active-order-card {
  cursor: pointer;
}

#orders.view .order-layout > .panel.order-create-panel:first-child .active-order-card button,
#orders.view .order-layout > .panel.order-create-panel:first-child .order-actions button {
  position: relative;
  z-index: 4;
  pointer-events: auto;
}

/* Quotation-to-order flow: explicit source selection plus internal active orders. */
#orders.view .order-layout > .panel.order-create-panel:first-child .order-upload-stack {
  grid-template-columns: minmax(170px, 0.52fr) minmax(260px, 1.2fr) minmax(190px, 0.72fr);
}

#orders.view .quotation-select-button {
  min-height: 42px;
  height: 42px;
  align-self: stretch;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 900;
}

#orders.view .order-layout > .panel.order-create-panel:first-child #orderDropZone,
#orders.view .order-layout > .panel.order-create-panel:first-child #orderImportStatus {
  min-height: 42px;
}

#readyOrders.view.active,
#deliveryOrders.view.active {
  padding: 22px 24px 32px;
  background: linear-gradient(180deg, #f8fbff 0%, #f6f8fc 100%);
}

#readyOrders .ready-orders-panel,
#deliveryOrders .ready-orders-panel {
  display: grid;
  gap: 14px;
  border: 1px solid #dbe4f2;
  border-radius: 10px;
  box-shadow: 0 14px 30px rgba(7, 26, 68, 0.06);
}

#readyOrders .ready-orders-heading,
#deliveryOrders .ready-orders-heading {
  align-items: center;
  gap: 16px;
}

#readyOrders .panel-subtitle,
#deliveryOrders .panel-subtitle {
  margin: 5px 0 0;
  color: #536487;
  font-size: 12px;
  font-weight: 700;
}

#readyOrders .ready-orders-actions {
  display: flex;
  justify-content: flex-end;
}

#readyOrders #readyQuotationStatus,
#deliveryOrders #deliveryOrdersStatus {
  margin: 0;
  min-height: 42px;
  padding: 12px 14px;
}

#readyOrders .ready-orders-table-wrap,
#deliveryOrders .ready-orders-table-wrap {
  max-height: 430px;
  border: 1px solid #dbe4f2;
  border-radius: 8px;
  overflow: auto;
}

#readyOrders .ready-orders-table-wrap table,
#deliveryOrders .ready-orders-table-wrap table {
  table-layout: fixed;
}

#readyOrders .ready-orders-table-wrap table {
  min-width: 1260px;
}

#deliveryOrders .ready-orders-table-wrap table {
  min-width: 980px;
}

#readyOrders .ready-orders-table-wrap th,
#readyOrders .ready-orders-table-wrap td,
#deliveryOrders .ready-orders-table-wrap th,
#deliveryOrders .ready-orders-table-wrap td {
  height: 36px;
  padding: 7px 12px;
  font-size: 12px;
  white-space: nowrap;
}

#readyOrders .ready-orders-table-wrap td {
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: middle;
}

#readyOrders .ready-orders-table-wrap th:nth-child(1),
#readyOrders .ready-orders-table-wrap td:nth-child(1) {
  width: 78px;
}

#readyOrders .ready-orders-table-wrap th:nth-child(2),
#readyOrders .ready-orders-table-wrap td:nth-child(2) {
  width: 148px;
}

#readyOrders .ready-orders-table-wrap th:nth-child(3),
#readyOrders .ready-orders-table-wrap td:nth-child(3) {
  width: 260px;
}

#readyOrders .ready-orders-table-wrap th:nth-child(4),
#readyOrders .ready-orders-table-wrap td:nth-child(4) {
  width: 270px;
}

#readyOrders .ready-orders-table-wrap th:nth-child(5),
#readyOrders .ready-orders-table-wrap td:nth-child(5),
#readyOrders .ready-orders-table-wrap th:nth-child(7),
#readyOrders .ready-orders-table-wrap td:nth-child(7) {
  width: 76px;
  text-align: center;
}

#readyOrders .ready-orders-table-wrap th:nth-child(6),
#readyOrders .ready-orders-table-wrap td:nth-child(6) {
  width: 112px;
}

#readyOrders .ready-orders-table-wrap th:nth-child(8),
#readyOrders .ready-orders-table-wrap td:nth-child(8) {
  width: 128px;
}

#readyOrders .ready-orders-table-wrap th:nth-child(9),
#readyOrders .ready-orders-table-wrap td:nth-child(9) {
  width: 170px;
  text-align: center;
}

#readyOrders .ready-orders-table-wrap th:nth-child(10),
#readyOrders .ready-orders-table-wrap td:nth-child(10) {
  width: 150px;
}

#readyOrders .quotation-row-annulled {
  background: #fff1f2;
  color: #7f1d1d;
}

#readyOrders .quotation-row-annulled td {
  border-bottom-color: #fecdd3;
}

#readyOrders .quotation-row-annulled .ready-cell-text {
  color: #7f1d1d;
}

#readyOrders .quotation-row-deleted {
  background: #f3f4f6;
  color: #374151;
}

#readyOrders .quotation-row-deleted td {
  border-bottom-color: #d1d5db;
}

#readyOrders .quotation-row-deleted .ready-cell-text {
  color: #374151;
}

#readyOrders .ready-action-buttons {
  display: flex;
  justify-content: center;
  gap: 6px;
}

#readyOrders .ready-action-buttons .danger-button {
  width: 76px;
  min-width: 76px;
  height: 30px;
  min-height: 30px;
  padding: 0 8px;
  font-size: 11px;
}

#readyOrders .ready-cell-text {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#readyOrders .ready-orders-table-wrap th,
#deliveryOrders .ready-orders-table-wrap th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f0f5fb;
}

#deliveryOrders .delivery-confirm-button {
  width: 148px;
  min-width: 148px;
  height: 30px;
  min-height: 30px;
  padding: 0 12px;
  border-radius: 7px;
  font-size: 11px;
  font-weight: 900;
}

#readyOrders .ready-priority-actions {
  display: flex;
  justify-content: center;
  gap: 6px;
}

#readyOrders .ready-priority-actions button {
  width: 62px;
  min-width: 62px;
  height: 28px;
  min-height: 28px;
  padding: 0;
  font-size: 11px;
}

#readyOrders .ready-priority-actions button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

#readyOrders .ready-view-button {
  width: 58px;
  min-width: 58px;
  height: 28px;
  min-height: 28px;
  padding: 0;
  border-radius: 7px;
  font-size: 11px;
  font-weight: 900;
}

#readyOrders .ready-annul-button {
  width: 72px;
  min-width: 72px;
  height: 28px;
  min-height: 28px;
  padding: 0;
  border-radius: 7px;
  font-size: 11px;
  font-weight: 900;
}

#readyOrders .ready-annul-button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

#quotationViewDialog {
  width: min(920px, calc(100vw - 40px));
  max-width: 920px;
  border-radius: 14px;
  background: transparent;
}

#quotationViewDialog::backdrop {
  background: rgba(10, 20, 42, 0.62);
  backdrop-filter: blur(2px);
}

#quotationViewDialog .quotation-view-card {
  display: grid;
  gap: 14px;
  padding: 22px 24px 20px;
  border: 1px solid #dbe4f2;
  border-radius: 14px;
  background: linear-gradient(180deg, #ffffff 0%, #fbfdff 100%);
  box-shadow: 0 24px 52px rgba(7, 26, 68, 0.2);
}

#quotationViewDialog .quotation-view-heading {
  margin: 0;
  align-items: flex-start;
}

#quotationViewDialog .quotation-view-heading h2 {
  margin: 0;
  color: #071a44;
  font-size: 20px;
  font-weight: 900;
}

#quotationViewDialog .dialog-subtitle {
  margin: 5px 0 0;
  color: #536487;
  font-size: 12px;
  font-weight: 700;
}

#quotationViewDialog .dialog-close-button {
  width: 38px;
  min-width: 38px;
  height: 38px;
  min-height: 38px;
  padding: 0;
  border-radius: 10px;
  font-size: 24px;
  line-height: 1;
}

#quotationViewDialog .quotation-view-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

#quotationViewDialog .quotation-view-field {
  min-width: 0;
  padding: 12px 14px;
  border: 1px solid #dbe4f2;
  border-radius: 10px;
  background: #f8fbff;
}

#quotationViewDialog .quotation-view-field span,
#quotationViewDialog .quotation-view-field strong {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#quotationViewDialog .quotation-view-field span {
  margin-bottom: 5px;
  color: #536487;
  font-size: 11px;
  font-weight: 800;
}

#quotationViewDialog .quotation-view-field strong {
  color: #071a44;
  font-size: 13px;
  font-weight: 900;
}

#quotationViewDialog .quotation-view-table-wrap {
  max-height: min(48vh, 420px);
  border: 1px solid #cfe0f7;
  border-radius: 10px;
  overflow: auto;
}

#quotationViewDialog .quotation-view-table-wrap table {
  min-width: 680px;
  table-layout: fixed;
}

#quotationViewDialog .quotation-view-table-wrap th,
#quotationViewDialog .quotation-view-table-wrap td {
  height: 40px;
  padding: 0 14px;
  font-size: 12px;
  white-space: nowrap;
}

#quotationViewDialog .quotation-view-table-wrap td {
  overflow: hidden;
  text-overflow: ellipsis;
}

#quotationViewDialog .quotation-view-actions {
  margin: 0;
  padding-top: 14px;
  border-top: 1px solid #dbe4f2;
  justify-content: flex-end;
}

#quotationViewDialog .quotation-view-actions button {
  min-width: 144px;
  height: 42px;
  min-height: 42px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 900;
}

#quotationSelectDialog {
  width: min(820px, calc(100vw - 40px));
  max-width: 820px;
  border-radius: 14px;
  background: transparent;
}

#quotationSelectDialog::backdrop {
  background: rgba(10, 20, 42, 0.62);
  backdrop-filter: blur(2px);
}

#quotationSelectDialog .quotation-select-card {
  display: grid;
  gap: 14px;
  padding: 22px 24px 20px;
  border: 1px solid #dbe4f2;
  border-radius: 14px;
  background: linear-gradient(180deg, #ffffff 0%, #fbfdff 100%);
  box-shadow: 0 24px 52px rgba(7, 26, 68, 0.2);
}

#quotationSelectDialog .quotation-select-heading {
  margin: 0;
  align-items: flex-start;
}

#quotationSelectDialog .quotation-select-heading h2 {
  margin: 0;
  color: #071a44;
  font-size: 20px;
  font-weight: 900;
}

#quotationSelectDialog .dialog-subtitle {
  margin: 5px 0 0;
  color: #536487;
  font-size: 12px;
  font-weight: 700;
}

#quotationSelectDialog .dialog-close-button {
  width: 38px;
  min-width: 38px;
  height: 38px;
  min-height: 38px;
  padding: 0;
  border-radius: 10px;
  font-size: 24px;
  line-height: 1;
}

#quotationSelectDialog .quotation-select-meta span {
  min-height: 26px;
  display: inline-flex;
  align-items: center;
  padding: 6px 12px;
  border-radius: 8px;
  background: #e8f0ff;
  color: #0057d9;
  font-size: 12px;
  font-weight: 900;
}

#quotationSelectDialog .quotation-select-table-wrap {
  max-height: min(46vh, 360px);
  border: 1px solid #cfe0f7;
  border-radius: 10px;
  overflow: auto;
}

#quotationSelectDialog .quotation-select-table-wrap table {
  min-width: 680px;
}

#quotationSelectDialog .quotation-select-table-wrap th,
#quotationSelectDialog .quotation-select-table-wrap td {
  height: 42px;
  padding: 0 16px;
  font-size: 13px;
}

#quotationSelectDialog .quotation-select-actions {
  margin: 0;
  padding-top: 14px;
  border-top: 1px solid #dbe4f2;
  justify-content: flex-end;
}

#quotationSelectDialog .quotation-select-actions button {
  min-width: 144px;
  height: 42px;
  min-height: 42px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 900;
}

@media (max-width: 1500px) {
  #orders.view .order-layout > .panel.order-create-panel:first-child .order-upload-stack {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  #quotationViewDialog {
    width: calc(100vw - 24px);
  }

  #quotationViewDialog .quotation-view-grid {
    grid-template-columns: 1fr;
  }

  #quotationSelectDialog {
    width: calc(100vw - 24px);
  }
}

/* Final Pedidos polish: the user now selects quotations from the source list,
   so the old file-import hint should not occupy visible space here. */
#orders.view .order-layout > .panel.order-create-panel:first-child .order-upload-stack {
  grid-template-columns: minmax(188px, 240px) minmax(180px, 1fr);
  gap: 8px;
  align-items: stretch;
}

#orders.view .order-layout > .panel.order-create-panel:first-child #orderDropZone {
  display: none;
}

#orders.view .quotation-select-button {
  width: min(240px, 100%);
  justify-self: start;
}

#orders.view .order-layout > .panel.order-create-panel:first-child #orderImportStatus {
  height: 42px;
  min-height: 42px;
  padding: 0 14px;
  justify-content: flex-start;
  text-align: left;
}

#orders.view .order-layout > .panel.order-create-panel:first-child .dispatch-details {
  grid-template-columns: minmax(240px, 1fr) minmax(150px, 220px);
  gap: 10px;
  align-items: end;
}

#orders.view .order-layout > .panel.order-create-panel:first-child .order-actions {
  grid-template-columns: repeat(4, minmax(126px, 152px));
  gap: 8px;
  justify-content: start;
}

#orders.view .order-layout > .panel.order-create-panel:first-child .order-actions::before {
  content: none;
  display: none;
}

#orders.view .order-layout > .panel.order-create-panel:first-child #prepareOrderBtn,
#orders.view .order-layout > .panel.order-create-panel:first-child #saveOrderBtn,
#orders.view .order-layout > .panel.order-create-panel:first-child #finishOrderBtn,
#orders.view .order-layout > .panel.order-create-panel:first-child #clearOrderBtn,
#orders.view .order-layout > .panel.order-create-panel:first-child #orderPhoneBtn,
#orders.view .order-layout > .panel.order-create-panel:first-child #printPickListBtn,
#orders.view .order-layout > .panel.order-create-panel:first-child #printMapBtn,
#orders.view .order-layout > .panel.order-create-panel:first-child #printLabelBtn {
  grid-column: auto;
  grid-row: auto;
}

#orders.view .order-layout > .panel.order-create-panel:first-child .order-actions button {
  height: 36px;
  min-height: 36px;
  padding: 0 12px;
  font-size: 12px;
}

@media (max-width: 1280px) {
  #orders.view .order-layout > .panel.order-create-panel:first-child .order-upload-stack,
  #orders.view .order-layout > .panel.order-create-panel:first-child .dispatch-details {
    grid-template-columns: minmax(0, 1fr);
  }

  #orders.view .quotation-select-button {
    width: 100%;
  }

  #orders.view .order-layout > .panel.order-create-panel:first-child #orderImportStatus {
    height: auto;
    min-height: 38px;
  }

  #orders.view .order-layout > .panel.order-create-panel:first-child .order-actions {
    grid-template-columns: repeat(2, minmax(126px, 1fr));
  }
}

/* Stable picking table: checking rows must not resize columns or move content. */
#orders.view .order-lines-table {
  width: 100%;
  min-width: 760px;
  table-layout: fixed;
}

#orders.view .order-lines-table .order-col-code {
  width: 15%;
}

#orders.view .order-lines-table .order-col-oem {
  width: 21%;
}

#orders.view .order-lines-table .order-col-location {
  width: 18%;
}

#orders.view .order-lines-table .order-col-quantity {
  width: 12%;
}

#orders.view .order-lines-table .order-col-check {
  width: 16%;
}

#orders.view .order-lines-table .order-col-status {
  width: 18%;
}

#orders.view .order-lines-table th,
#orders.view .order-lines-table td {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#orders.view .order-lines-table th:nth-child(4),
#orders.view .order-lines-table td:nth-child(4),
#orders.view .order-lines-table th:nth-child(5),
#orders.view .order-lines-table td:nth-child(5),
#orders.view .order-lines-table th:nth-child(6),
#orders.view .order-lines-table td:nth-child(6) {
  text-align: center;
}

#orders.view .order-lines-table .pick-check-label {
  width: 104px;
  min-width: 104px;
  justify-content: flex-start;
}

#orders.view .order-lines-table .pick-check-label span {
  display: inline-block;
  width: 72px;
  min-width: 72px;
  overflow: hidden;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#orders.view .order-lines-table .badge {
  width: 88px;
  min-width: 88px;
  max-width: 88px;
  box-sizing: border-box;
}
