
/* Phase H.4 — Sales & Purchases Forms Mobile Refactor
   Safe mobile-first layer for long transactional forms. */

@media (max-width: 991.98px) {
  .mobile-foundation .content .card,
  .mobile-foundation .main .card {
    border-radius: 18px;
  }

  .mobile-foundation form .row > [class*="col-"] {
    margin-bottom: 0.75rem;
  }

  .mobile-foundation form .form-label,
  .mobile-foundation form label {
    display: block;
    margin-bottom: .45rem;
    font-weight: 600;
    line-height: 1.35;
  }

  .mobile-foundation form .form-control,
  .mobile-foundation form .form-select,
  .mobile-foundation form select,
  .mobile-foundation form input,
  .mobile-foundation form textarea {
    min-height: 48px;
    font-size: 16px;
    border-radius: 14px;
  }

  .mobile-foundation form textarea {
    min-height: 112px;
  }

  .mobile-foundation .page-actions,
  .mobile-foundation .action-row,
  .mobile-foundation .toolbar-actions,
  .mobile-foundation .form-actions,
  .mobile-foundation .btn-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: .625rem;
  }

  .mobile-foundation .page-actions .btn,
  .mobile-foundation .action-row .btn,
  .mobile-foundation .toolbar-actions .btn,
  .mobile-foundation .form-actions .btn,
  .mobile-foundation .btn-toolbar .btn {
    min-height: 44px;
  }

  .mobile-foundation .summary-card,
  .mobile-foundation .totals-card,
  .mobile-foundation .invoice-summary,
  .mobile-foundation .payment-summary {
    position: static !important;
    top: auto !important;
  }

  .mobile-foundation .table-responsive {
    border-radius: 16px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .mobile-foundation table thead th {
    white-space: nowrap;
    font-size: .94rem;
  }

  .mobile-foundation table tbody td {
    white-space: nowrap;
    vertical-align: middle;
  }

  .mobile-foundation .line-items-card,
  .mobile-foundation .invoice-lines,
  .mobile-foundation .purchase-lines,
  .mobile-foundation .sale-lines {
    overflow: hidden;
  }

  .mobile-foundation .line-items-card .btn,
  .mobile-foundation .invoice-lines .btn,
  .mobile-foundation .purchase-lines .btn,
  .mobile-foundation .sale-lines .btn {
    min-width: 40px;
    min-height: 40px;
  }

  .mobile-foundation .sticky-mobile-actions {
    position: sticky;
    bottom: 0;
    z-index: 20;
    background: #fff;
    padding: .875rem;
    margin: 1rem -0.5rem -0.5rem;
    border-top: 1px solid rgba(0,0,0,.08);
    box-shadow: 0 -6px 20px rgba(0,0,0,.06);
  }

  .mobile-foundation .sticky-mobile-actions .btn {
    min-height: 46px;
  }

  .mobile-foundation .transaction-form-header,
  .mobile-foundation .document-header-card {
    margin-bottom: 1rem;
  }

  .mobile-foundation .document-section-card {
    margin-bottom: 1rem;
  }

  .mobile-foundation .document-section-title {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: .75rem;
  }

  /* Safer number/qty controls on mobile */
  .mobile-foundation input[type="number"] {
    text-align: center;
  }

  /* Prevent cramped 3-column date/customer/warehouse rows */
  .mobile-foundation .transaction-header-grid,
  .mobile-foundation .sale-header-grid,
  .mobile-foundation .purchase-header-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: .75rem;
  }
}

@media (min-width: 768px) and (max-width: 1199.98px) {
  .mobile-foundation .transaction-header-grid,
  .mobile-foundation .sale-header-grid,
  .mobile-foundation .purchase-header-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 1200px) {
  .mobile-foundation .transaction-header-grid,
  .mobile-foundation .sale-header-grid,
  .mobile-foundation .purchase-header-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
