/* Selan v52 - phone layout for staff declaration review and confirmation. */
@media (max-width: 767px) {
  .staff-declarations-view,
  .staff-declarations-view .declarations-table-container,
  .staff-declarations-view .declarations-table,
  .staff-declarations-view .declaration-detail-row,
  .staff-declarations-view .declaration-detail-row > td,
  .staff-declarations-view [data-declaration-detail],
  .staff-declarations-view .declaration-detail-panel {
    box-sizing: border-box !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
  }

  .staff-declarations-view .declarations-table-container,
  .staff-declarations-view .declaration-detail-row > td,
  .staff-declarations-view [data-declaration-detail] {
    overflow-x: clip !important;
  }

  .staff-declarations-view .declaration-detail-panel {
    margin-left: 0 !important;
    margin-right: 0 !important;
  }

  .staff-declarations-view [data-declaration-detail] :is(div, section, article, form, dl, ul, li, label, p) {
    min-width: 0 !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
  }

  .staff-declarations-view [data-declaration-detail] :is(p, span, strong, label, dt, dd) {
    overflow-wrap: anywhere !important;
    word-break: normal !important;
    white-space: normal !important;
  }

  .staff-declarations-view .declaration-detail-banner {
    padding: 12px !important;
  }

  .staff-declarations-view [data-declaration-detail] textarea,
  .staff-declarations-view [data-declaration-detail] canvas {
    display: block !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
  }

  /* The 720px packing table caused the whole declaration to slide sideways. */
  .staff-declarations-view .packing-review-table-wrap {
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    overflow: visible !important;
    border: 0 !important;
  }

  .staff-declarations-view .packing-review-table,
  .staff-declarations-view .packing-review-table tbody {
    display: block !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
  }

  .staff-declarations-view .packing-review-table thead {
    display: none !important;
  }

  .staff-declarations-view .packing-review-table tbody > tr {
    display: block !important;
    width: 100% !important;
    min-width: 0 !important;
    margin: 0 0 12px !important;
    overflow: hidden !important;
    border: 1px solid #dbe4f0 !important;
    border-radius: 12px !important;
    background: #fff !important;
    box-shadow: 0 4px 14px rgba(15, 23, 42, .06) !important;
  }

  .staff-declarations-view .packing-review-table tbody > tr > td {
    display: grid !important;
    grid-template-columns: minmax(82px, 30%) minmax(0, 1fr) !important;
    align-items: start !important;
    gap: 10px !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    padding: 10px !important;
    border-bottom: 1px solid #edf2f7 !important;
    text-align: left !important;
    white-space: normal !important;
    overflow-wrap: anywhere !important;
  }

  .staff-declarations-view .packing-review-table tbody > tr > td:last-child {
    border-bottom: 0 !important;
  }

  .staff-declarations-view .packing-review-table tbody > tr > td::before {
    content: attr(data-label);
    color: #64748b;
    font-size: 9px;
    font-weight: 900;
    letter-spacing: .05em;
    text-transform: uppercase;
  }

  .staff-declarations-view .packing-review-table tbody > tr > td[colspan] {
    display: block !important;
    text-align: center !important;
  }

  .staff-declarations-view .packing-review-table tbody > tr > td[colspan]::before {
    content: none !important;
  }

  .staff-declarations-view .packing-review-table td button {
    width: 100% !important;
    max-width: 150px !important;
  }

  /* Keep every confirmation tick and its full label inside the phone width. */
  .staff-declarations-view [data-declaration-detail] label:has(> input[type="checkbox"]),
  .staff-declarations-view [data-declaration-detail] label:has(> input[type="radio"]) {
    display: grid !important;
    grid-template-columns: 22px minmax(0, 1fr) !important;
    align-items: start !important;
    gap: 10px !important;
    width: 100% !important;
  }

  .staff-declarations-view [data-declaration-detail] input[type="checkbox"],
  .staff-declarations-view [data-declaration-detail] input[type="radio"] {
    display: inline-block !important;
    width: 20px !important;
    min-width: 20px !important;
    max-width: 20px !important;
    height: 20px !important;
    min-height: 20px !important;
    max-height: 20px !important;
    margin: 1px 0 0 !important;
  }

  /* Let status and logistics messages wrap instead of disappearing off-screen. */
  .staff-declarations-view .declaration-summary-row > td > *,
  .staff-declarations-view .declaration-summary-row > td :is(div, span, strong) {
    min-width: 0 !important;
    max-width: 100% !important;
    overflow: visible !important;
    text-overflow: clip !important;
    white-space: normal !important;
    overflow-wrap: anywhere !important;
  }
}

@media (max-width: 390px) {
  .staff-declarations-view .declaration-summary-row > td,
  .staff-declarations-view .packing-review-table tbody > tr > td {
    grid-template-columns: minmax(76px, 28%) minmax(0, 1fr) !important;
    gap: 8px !important;
  }

  .staff-declarations-view .declaration-detail-banner,
  .staff-declarations-view .declaration-detail-panel > div {
    padding-left: 10px !important;
    padding-right: 10px !important;
  }
}
