/**
 * Deko — keep PRODUCTOS SELECCIONADOS amounts inside the white box.
 * /pedido summary, /confirmacion-pedido, Mis pedidos (#order-products).
 */

#order-items {
  max-width: 100%;
  box-sizing: border-box;
}

#order-items .order-confirmation-table {
  max-width: 100%;
  box-sizing: border-box;
  overflow-x: hidden;
  padding-right: 1.25rem; /* match / reinforce theme padding so amounts clear the border */
}

/* Header: product | unit | qty | total */
#order-items > .row:first-child {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 7.75rem 3.25rem 9rem;
  column-gap: 0.5rem;
  align-items: end;
  margin: 0 0 0.5rem;
  padding-right: 1.25rem;
  box-sizing: border-box;
}

#order-items > .row:first-child > .card-title {
  width: auto !important;
  max-width: none !important;
  float: none !important;
  margin: 0;
  padding: 0;
  text-align: right;
  white-space: nowrap;
}

#order-items > .row:first-child > .card-title:first-child {
  text-align: left;
  white-space: normal;
}

/* Body line: image | name | unit | qty | total */
#order-items .order-line.row {
  display: grid;
  grid-template-columns: 4.5rem minmax(0, 1fr) 7.75rem 3.25rem 9rem;
  column-gap: 0.5rem;
  align-items: start;
  margin: 1rem 0 0;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

#order-items .order-line > .col-sm-2,
#order-items .order-line > .col-xs-3 {
  grid-column: 1;
  width: auto !important;
  max-width: none !important;
  float: none !important;
  padding: 0;
}

#order-items .order-line .image img {
  width: 100%;
  max-width: 4.25rem;
  height: auto;
}

#order-items .order-line > .details {
  grid-column: 2;
  width: auto !important;
  max-width: none !important;
  float: none !important;
  min-width: 0;
  padding: 0;
}

#order-items .order-line > .details span,
#order-items .order-line > .details a {
  overflow-wrap: anywhere;
  word-break: break-word;
  white-space: normal;
}

#order-items .order-line > .qty {
  grid-column: 3 / -1;
  display: grid;
  grid-template-columns: 7.75rem 3.25rem 9rem;
  column-gap: 0.5rem;
  width: auto !important;
  max-width: none !important;
  float: none !important;
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

#order-items .order-line > .qty > .row {
  display: contents;
}

#order-items .order-line > .qty > .row > [class*="col-"] {
  width: auto !important;
  max-width: none !important;
  float: none !important;
  padding: 0;
  text-align: right !important;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

#order-items .order-confirmation-table > table {
  width: 100%;
  max-width: 100%;
  table-layout: fixed;
  box-sizing: border-box;
}

#order-items .order-confirmation-table > table td {
  padding: 0.35rem 0;
  vertical-align: top;
}

#order-items .order-confirmation-table > table td:first-child {
  padding-right: 0.75rem;
  overflow-wrap: anywhere;
}

#order-items .order-confirmation-table > table td:last-child {
  width: 9rem;
  text-align: right;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  padding-right: 0;
}

@media (max-width: 767px) {
  #order-items > .row:first-child {
    display: block;
    padding-right: 0;
  }

  #order-items > .row:first-child > ._desktop-title {
    display: none !important;
  }

  #order-items .order-confirmation-table {
    padding-right: 1rem;
  }

  #order-items .order-line.row {
    grid-template-columns: 4rem minmax(0, 1fr);
    column-gap: 0.65rem;
  }

  #order-items .order-line > .qty {
    grid-column: 2;
    grid-row: 2;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    margin-top: 0.35rem;
  }

  #order-items .order-line > .qty > .row {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    margin: 0;
    width: 100%;
  }

  #order-items .order-line > .qty > .row > [class*="col-"] {
    width: 100% !important;
    text-align: left !important;
    white-space: nowrap;
  }

  #order-items .order-confirmation-table > table td:last-child {
    width: auto;
  }
}

/* Mis pedidos */
#order-products {
  width: 100%;
  max-width: 100%;
  table-layout: fixed;
}

#order-products td:nth-child(1),
#order-products th:nth-child(1) {
  overflow-wrap: anywhere;
  word-break: break-word;
}

#order-products th:nth-child(2),
#order-products td:nth-child(2) {
  width: 4.5rem;
  text-align: center;
  white-space: nowrap;
}

#order-products th:nth-child(3),
#order-products td:nth-child(3),
#order-products th:nth-child(4),
#order-products td:nth-child(4) {
  width: 9.5rem;
  text-align: right !important;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

#order-products tfoot td:last-child {
  text-align: right;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

@media (max-width: 767px) {
  #order-products,
  #order-products thead,
  #order-products tbody,
  #order-products tfoot,
  #order-products tr,
  #order-products th,
  #order-products td {
    display: block;
    width: 100% !important;
  }

  #order-products thead {
    display: none;
  }

  #order-products tbody tr {
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid #e5e5e5;
  }

  #order-products tbody td {
    text-align: left !important;
    padding: 0.15rem 0 !important;
  }

  #order-products tbody td:nth-child(2),
  #order-products tbody td:nth-child(3),
  #order-products tbody td:nth-child(4) {
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
  }

  #order-products tfoot td,
  #order-products tfoot td:last-child {
    text-align: left !important;
  }
}
