/* Phone corrections for the original design; desktop and printed documents are unaffected. */
@media screen and (max-width: 767px) {
  body.nav-panel-open {
    touch-action: auto;
  }

  .mobile-nav-panel__scroll {
    flex: 1 1 0;
    min-height: 0;
    touch-action: pan-y;
  }

  .mobile-nav-panel .nav-section--accordion.is-expanded .nav-section__submenu {
    max-height: none;
  }

  .sanad-card fieldset,
  .sanad-card .form-group,
  .sanad-detail-header > *,
  .kashf-stats-block > * {
    min-width: 0;
    overflow-wrap: anywhere;
  }

  .sanad-card .form-group input,
  .sanad-card .form-group select,
  .sanad-card .form-group textarea,
  .choice-custom-control .custom-inline-input,
  .payment-method-select,
  .scan-stage-select {
    font-size: 16px;
    min-height: 44px;
    max-width: 100%;
  }

  .sanad-card input[type="checkbox"],
  .sanad-card input[type="radio"] {
    min-height: 0;
  }

  .line-row.design-extra-only-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .line-row.design-extra-only-row > label {
    grid-column: 1 / -1;
  }

  .sanad-lines .form-hint {
    color: #616161;
  }

  .sanad-totals {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }

  /* These tables already become cards on phones: remove their desktop minimum width. */
  .responsive-table > table,
  .kashf-responsive-table > table,
  .responsive-table > table > tbody,
  .kashf-responsive-table > table > tbody {
    display: block;
    width: 100%;
    min-width: 0;
  }

  .responsive-table tbody td,
  .kashf-responsive-table tbody td {
    grid-template-columns: minmax(0, 35%) minmax(0, 1fr);
    min-width: 0;
    overflow-wrap: anywhere;
  }

  .responsive-table tbody td > *,
  .kashf-responsive-table tbody td > * {
    min-width: 0;
    max-width: 100%;
  }

  .responsive-table td[data-label="إجراءات"],
  .kashf-responsive-table td[data-label="إجراءات"] {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.5rem;
  }

  .responsive-table td[data-label="إجراءات"]::before,
  .kashf-responsive-table td[data-label="إجراءات"]::before {
    grid-column: 1 / -1;
  }

  .responsive-table td[data-label="إجراءات"] > .btn-table-action,
  .kashf-responsive-table td[data-label="إجراءات"] > .btn-table-action {
    width: 100%;
    margin: 0;
  }

  .btn-table-action,
  .btn-remove-row {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .payment-method-form {
    display: flex;
    flex-wrap: wrap;
    width: 100%;
  }

  .payment-method-form > * {
    width: 100%;
    min-width: 0;
  }

  .scan-stage-select {
    width: 100%;
    min-width: 0;
  }

  .page-header {
    flex-wrap: wrap;
    gap: 0.75rem;
  }

  .sanad-status-stage,
  .sanad-title,
  .piece-barcode-serial {
    white-space: normal;
    overflow-wrap: anywhere;
  }
}
