/* The same inputs and table data remain in use at every screen size. */
.purchase-order-editor .po-form-wrap { overflow-y: auto; min-height: 0; flex: 1; }
.purchase-order-editor .po-money-input input { display: block; width: 100%; min-width: 0; }
@media (max-width: 1000px) {
  .purchase-order-editor .main { min-width: 0; }
  .purchase-order-editor .topbar { height: auto; min-height: 62px; flex-wrap: wrap; gap: 10px; padding: 12px 16px; position: sticky; top: 0; z-index: 20; }
  .purchase-order-editor .topbar-title { flex: 1 1 100%; }
  .purchase-order-editor .topbar-actions { max-width: 100%; flex-wrap: wrap; overflow: visible; }
  .purchase-order-editor .po-form-wrap { padding: 16px 16px 32px; }
  .purchase-order-editor .po-header-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .purchase-order-editor .form-group { min-width: 0; }
  .purchase-order-editor input, .purchase-order-editor select, .purchase-order-editor textarea { max-width: 100%; box-sizing: border-box; }
  .purchase-order-editor .btn, .purchase-order-editor .po-status-btn, .purchase-order-editor .po-icon-btn,
  .purchase-order-editor .del-item-btn, .purchase-order-editor .add-item-btn, .supplier-overview .btn,
  .supplier-overview .sio-document, .supplier-overview .sio-views button { min-height: 44px; }
  .purchase-order-editor .po-icon-btn, .supplier-overview .sio-document { width: 44px; }
  .purchase-order-editor .del-item-btn { min-width: 44px; }
  .purchase-order-editor .po-status-bar { padding: 10px; gap: 6px; }
  .purchase-order-editor .po-status-btn { border-radius: 6px; }
  .purchase-order-editor .po-payment-actions { width: 100%; gap: 8px; }
  .purchase-order-editor .po-payment-actions .btn { flex: 1 1 auto; justify-content: center; white-space: normal; }
  .purchase-order-editor .po-payment-summary, .purchase-order-editor .psi-totals { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
  .purchase-order-editor .po-payment-summary strong, .purchase-order-editor .psi-totals strong { overflow-wrap: anywhere; }
  .purchase-order-editor .po-totals table { width: 100%; max-width: 360px; }
  .purchase-order-editor .modal-overlay { padding: 8px; box-sizing: border-box; }
  .purchase-order-editor .modal-overlay .modal { width: 100%; max-width: 760px !important; max-height: calc(100dvh - 16px); display: flex; flex-direction: column; min-height: 0; margin: auto; }
  .purchase-order-editor .modal-header, .purchase-order-editor .modal-footer { flex-shrink: 0; padding: 12px; gap: 8px; }
  .purchase-order-editor .modal-body { min-height: 0; overflow: auto; padding: 12px; }
  .purchase-order-editor .modal-footer { flex-wrap: wrap; }
  .purchase-order-editor .modal-footer .btn { flex: 1 1 auto; justify-content: center; white-space: normal; }
  .purchase-order-editor .modal-close { width: 44px; height: 44px; flex-shrink: 0; }
  .purchase-order-editor .focus-tabs { display: flex; flex-wrap: wrap; }
  .purchase-order-editor .focus-tab { flex: 1; min-height: 44px; white-space: normal; }
  .purchase-responsive, .po-items-table { display: block; width: 100%; min-width: 0 !important; }
  .purchase-responsive thead, .po-items-table thead { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .purchase-responsive tbody, .po-items-table tbody { display: block; width: 100%; }
  .purchase-responsive tbody tr, .po-items-table tbody tr { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 16px; padding: 16px 12px; border-bottom: 1px solid var(--border); background: var(--surface); }
  .purchase-responsive tbody td, .po-items-table tbody td { display: block; width: auto !important; min-width: 0 !important; max-width: none !important; border: 0; padding: 0; white-space: normal !important; overflow-wrap: anywhere; }
  .supplier-overview .purchase-responsive tbody td { padding: 0; border: 0; }
  .purchase-responsive td[data-label]::before, .po-items-table td[data-label]::before { content: attr(data-label); display: block; margin-bottom: 5px; color: var(--text-muted); font: 400 11px/1.4 var(--font-body); letter-spacing: 0; }
  .purchase-responsive td:first-child, .purchase-responsive td:last-child, .purchase-responsive td[colspan] { grid-column: 1 / -1; }
  .purchase-responsive td[colspan]::before { content: none; }
  .purchase-responsive td small { max-width: none; }
  .purchase-responsive td.payment-tools, .purchase-responsive td.psi-tools { display: flex; justify-content: flex-end; gap: 8px; }
  .purchase-responsive .po-icon-btn { margin: 0; }
  .po-items-table td:first-child { grid-column: 1; align-self: center; text-align: left !important; }
  .po-items-table td:nth-child(2), .po-items-table td:nth-child(10) { grid-column: 1 / -1; }
  .po-items-table td:last-child { grid-column: 2; grid-row: 1; justify-self: end; }
  .po-items-table input, .po-items-table select { min-height: 44px; min-width: 0; }
  .po-items-table .calc-field { min-height: 44px; display: flex; align-items: center; justify-content: flex-end; box-sizing: border-box; white-space: normal; overflow-wrap: anywhere; }
  .purchase-order-editor .psi-allocations td:last-child { width: auto; }
  .purchase-order-editor .psi-allocations .psi-money { max-width: 220px; margin-left: auto; }
  .purchase-order-editor .po-invoice-table td:first-child { grid-column: 1; }
  .purchase-order-editor .po-invoice-table td:nth-child(2) { grid-column: 1 / -1; grid-row: 1; }
  .purchase-order-editor .po-invoice-table input[type=checkbox], .po-select-all input { width: 22px; height: 22px; }
  .po-select-all { min-height: 44px; display: flex; gap: 10px; align-items: center; }
  .po-invoice-toggle { display: inline-flex; align-items: center; justify-content: center; min-width: 44px; min-height: 44px; }
  .supplier-overview .sio-scroll, .purchase-order-editor .psi-scroll { overflow: visible; }
  .supplier-overview .sio-table, .supplier-overview .sio-po-table { min-width: 0; }
  .supplier-overview .sio-table-footer { flex-wrap: wrap; }
  .supplier-overview .sio-views { overflow-x: auto; flex-wrap: nowrap; }
  .supplier-overview .sio-views button { flex-shrink: 0; }
}
@media (max-width: 600px) {
  .purchase-order-editor .po-header-grid, .purchase-order-editor .po-payment-grid, .purchase-order-editor .psi-grid { grid-template-columns: minmax(0, 1fr); }
  .purchase-order-editor input:not([type=checkbox]), .purchase-order-editor select, .purchase-order-editor textarea,
  .supplier-overview .focus-select, .supplier-overview input[type=search] { font-size: 16px; min-height: 44px; }
  .purchase-order-editor input[type=file] { width: 100%; }
}
