/* V38.49 professional packing-slip UI and print-preview repair */
#modal .v3847-check{display:inline-grid!important;place-items:center!important;width:16px!important;height:16px!important;min-width:16px!important;min-height:16px!important;margin:0!important;position:relative;cursor:pointer;color:inherit}
#modal .v3847-check>input{position:absolute!important;opacity:0!important;width:16px!important;height:16px!important;min-height:0!important;margin:0!important;padding:0!important;pointer-events:none}
#modal .v3847-check>span{display:block;width:16px;height:16px;border:1.5px solid #7890a8;border-radius:4px;background:#fff;box-shadow:inset 0 0 0 1px #fff;transition:.12s}
#modal .v3847-check>input:checked+span{border-color:#2468a2;background:#2468a2}
#modal .v3847-check>input:checked+span:after{content:"";display:block;width:8px;height:4px;border-left:2px solid #fff;border-bottom:2px solid #fff;transform:rotate(-45deg);margin:3px 0 0 3px}
#modal .v3847-check>input:focus-visible+span{outline:3px solid rgba(36,104,162,.22);outline-offset:2px}
#modal .v3847-check>input:disabled+span{background:#edf1f5;border-color:#c6d0da;cursor:not-allowed}
.v3847-manager-head{display:flex;align-items:flex-start;justify-content:space-between;gap:16px;padding:14px;border:1px solid #d6e1ec;border-radius:11px;background:linear-gradient(135deg,#f8fbff,#fff)}
.v3847-manager-head>div{display:grid;gap:4px}.v3847-manager-head b{font-size:16px;color:#183c60}.v3847-manager-head span{font-size:12px;color:#64748b;line-height:1.45}
.v3847-summary{display:grid;grid-template-columns:repeat(4,minmax(120px,1fr));gap:10px;margin:12px 0}.v3847-summary>div{border:1px solid #dbe4ed;border-radius:10px;padding:12px;background:#fff}.v3847-summary b{display:block;font-size:22px;color:#1d527e}.v3847-summary span{font-size:11px;color:#6a7b8d}
.v3847-complete{border:1px solid #a9d4b9;border-left:4px solid #278457;background:#f1fbf5;color:#235c3d;border-radius:8px;padding:10px 12px;margin-bottom:12px;font-size:12px;font-weight:700}
.v3847-history-wrap{overflow:auto;border:1px solid #dbe3ec;border-radius:10px;max-height:440px}.v3847-history{min-width:890px}.v3847-history th{position:sticky;top:0;z-index:2;background:#edf3f8}.v3847-history td{vertical-align:top}.v3847-history .v3847-voided{opacity:.58;background:#f6f7f9}.v3847-row-actions{display:flex;gap:6px;flex-wrap:wrap}.v3847-row-actions button{padding:6px 9px;font-size:12px;white-space:nowrap}.v3847-danger-outline,button.danger-outline.v3847-danger-outline{background:#fff!important;color:#9f241f!important;border:1px solid #d69a96!important;min-width:52px!important;font-weight:700!important;opacity:1!important;visibility:visible!important}.v3847-danger-outline:hover,button.danger-outline.v3847-danger-outline:hover{background:#fff1f0!important;color:#7f1713!important;border-color:#b74a43!important}.v3847-empty{text-align:center;color:#6b7b8d;padding:28px}
.v3847-status{display:inline-flex;align-items:center;padding:3px 8px;border-radius:999px;background:#e8eef5;color:#3f5268;font-size:11px;font-weight:800;white-space:nowrap}.v3847-status-sent{background:#e5f6ec;color:#17643e}.v3847-status-partially-sent{background:#fff3d9;color:#865b00}.v3847-status-send-failed{background:#feeaea;color:#a82828}.v3847-status-voided{background:#eceff3;color:#64707e}.v3847-manager-footer{justify-content:flex-end;margin-top:12px}
.v3847-form-notice{margin-bottom:12px}.v3847-top-grid{grid-template-columns:repeat(4,minmax(145px,1fr))}.v3847-line-tools{display:flex;align-items:center;justify-content:space-between;gap:12px;margin:12px 0 7px}.v3847-line-tools>div:first-child{display:grid;gap:2px}.v3847-line-tools b{font-size:14px}.v3847-line-tools span{font-size:11px;color:#64748b}.v3847-line-tools>div:last-child{display:flex;gap:6px}.v3847-line-tools button{padding:6px 9px;font-size:12px}
.v3847-lines-wrap{overflow:auto;border:1px solid #d7e1eb;border-radius:10px;max-height:330px;scrollbar-gutter:stable}.v3847-lines{min-width:1050px}.v3847-lines th{position:sticky;top:0;z-index:2;background:#eaf1f7;color:#29445e;font-size:11px;white-space:nowrap}.v3847-lines td{padding:8px;font-size:12px}.v3847-lines .v3847-check-col,.v3847-lines .v3847-check-cell{width:42px;text-align:center}.v3847-lines .v3847-check-cell .v3847-check{margin:auto!important}.v3847-lines .v3847-qty{width:88px!important;min-width:88px!important;min-height:32px!important;height:32px!important;padding:5px 7px!important;text-align:right}.v3847-lines .v3847-no-remaining{background:#f6f7f9;color:#7a8591}.v3847-sticky-actions{position:sticky;bottom:-20px;z-index:6;background:#fff;border-top:1px solid #dbe3ec;margin:14px -20px -20px;padding:11px 20px;justify-content:flex-end;box-shadow:0 -7px 18px rgba(19,42,64,.08)}
.v3847-recipient-tools{display:flex;align-items:center;gap:7px;flex-wrap:wrap;margin:12px 0 8px}.v3847-recipient-tools button{padding:6px 9px;font-size:12px}.v3847-recipient-tools span{margin-left:auto;font-size:12px;font-weight:800;color:#2e5e88}.v3847-recipient-list{display:grid;gap:6px;max-height:330px;overflow:auto;padding:2px;border:1px solid #dce5ee;border-radius:10px;background:#f8fafc}.v3847-recipient{display:grid!important;grid-template-columns:20px minmax(0,1fr) auto;align-items:center;gap:9px;margin:0!important;padding:9px 10px;border:1px solid transparent;border-radius:8px;background:#fff;color:#1d2e40!important;cursor:pointer}.v3847-recipient:hover{border-color:#9bb5cc;background:#f7fbff}.v3847-recipient:has(input:checked){border-color:#4c83b3;background:#eef6fd;box-shadow:inset 3px 0 0 #2f6fa6}.v3847-recipient-copy{display:grid;gap:1px;min-width:0}.v3847-recipient-copy b{font-size:13px;color:#1c3349!important}.v3847-recipient-copy small{font-size:12px;color:#5b6e80!important;overflow-wrap:anywhere}.v3847-recipient-tags{display:flex;gap:4px;flex-wrap:wrap;justify-content:flex-end}.v3847-recipient-tags em{font-style:normal;font-size:10px;font-weight:800;color:#245c88;background:#e1eef9;border-radius:999px;padding:3px 6px;white-space:nowrap}.v3847-extra-email{margin-top:11px}.v3847-extra-email small{display:block;margin-top:4px;color:#6a7b8d;font-size:11px}
@media(min-width:1100px){#modal .modalbox:has(.v3847-lines){width:min(1220px,97vw)}}
@media(max-width:900px){.v3847-top-grid{grid-template-columns:repeat(2,minmax(140px,1fr))}.v3847-summary{grid-template-columns:repeat(2,minmax(110px,1fr))}.v3847-manager-head{flex-direction:column}.v3847-manager-head button{width:100%}}
@media(max-width:600px){.v3847-top-grid{grid-template-columns:1fr}.v3847-summary{grid-template-columns:1fr 1fr}.v3847-recipient{grid-template-columns:20px minmax(0,1fr)}.v3847-recipient-tags{grid-column:2;justify-content:flex-start}.v3847-line-tools{align-items:flex-start;flex-direction:column}.v3847-sticky-actions{justify-content:stretch}.v3847-sticky-actions button{flex:1 1 100%}}


/* V38.49: packing-slip preview must always begin at the left edge and fit the screen. */
#printPage{min-width:0!important;max-width:100%!important;overflow-x:hidden!important}
#printPage .invoice-paper{display:block!important;width:min(900px,100%)!important;max-width:900px!important;margin:0 auto!important;box-sizing:border-box!important;overflow:hidden!important}
#printPage .invoice-head{min-width:0!important}
#printPage .packing-meta{display:grid!important;grid-template-columns:minmax(0,1fr) minmax(150px,.42fr)!important;gap:22px!important;min-width:0!important}
#printPage .packing-list-table{display:table!important;width:100%!important;max-width:100%!important;min-width:0!important;table-layout:fixed!important;overflow:visible!important}
#printPage .packing-list-table thead{display:table-header-group!important}
#printPage .packing-list-table tbody{display:table-row-group!important}
#printPage .packing-list-table tr{display:table-row!important}
#printPage .packing-list-table th,#printPage .packing-list-table td{display:table-cell!important;position:static!important;overflow-wrap:anywhere!important}
#printPage .packing-list-table th:nth-child(1),#printPage .packing-list-table td:nth-child(1){width:18%!important}
#printPage .packing-list-table th:nth-child(2),#printPage .packing-list-table td:nth-child(2){width:67%!important}
#printPage .packing-list-table th:nth-child(3),#printPage .packing-list-table td:nth-child(3){width:15%!important;text-align:center!important}
@media(max-width:700px){
 #printPage .invoice-paper{width:100%!important;max-width:100%!important;padding:18px!important;margin:0!important}
 #printPage .invoice-head{display:grid!important;grid-template-columns:1fr!important;gap:14px!important}
 #printPage .invoice-head .right,#printPage .packing-meta .right{text-align:left!important}
 #printPage .invoice-title{font-size:25px!important}
 #printPage .packing-meta{grid-template-columns:1fr!important;gap:14px!important;margin:18px 0!important}
 #printPage .packing-signatures{grid-template-columns:1fr!important;gap:28px!important}
 #printPage .packing-list-table th,#printPage .packing-list-table td{padding:6px 5px!important;font-size:11px!important}
}
@media print{
 #printPage .invoice-paper{width:100%!important;max-width:none!important;padding:0!important;margin:0!important;overflow:visible!important}
 #printPage .invoice-head{display:flex!important;flex-direction:row!important}
 #printPage .invoice-head .right,#printPage .packing-meta .right{text-align:right!important}
 #printPage .packing-meta{grid-template-columns:minmax(0,1fr) minmax(150px,.42fr)!important}
 #printPage .packing-signatures{grid-template-columns:1fr 1fr!important}
}
.v3847-row-actions .v3849-item-label-button{background:#eef6fd!important;color:#245f8e!important;border-color:#9fc0db!important;font-weight:750}.v3847-row-actions .v3849-package-print-button{background:#fff8e8!important;color:#76530b!important;border-color:#d9bc72!important;font-weight:750}


/* V38.51 quantity integrity and email label attachments */
.v3851-allocation-warning{display:flex;align-items:center;justify-content:space-between;gap:14px;border:1px solid #e3a39e;border-left:5px solid #b8322a;background:#fff4f3;color:#70241f;border-radius:10px;padding:12px 14px;margin-bottom:12px}.v3851-allocation-warning>div{display:grid;gap:3px}.v3851-allocation-warning b{font-size:14px}.v3851-allocation-warning span{font-size:12px;line-height:1.45}.v3851-allocation-warning button{white-space:nowrap}
.v3851-email-attachments{display:grid;gap:8px;border:1px solid #cfddea;border-radius:11px;background:#f8fbfe;padding:12px;margin-top:12px}.v3851-email-attachments>b{color:#244b6c;font-size:14px}.v3851-attachment-row{display:grid!important;grid-template-columns:20px minmax(0,1fr);align-items:start;gap:9px;margin:0!important;border:1px solid #d7e2ec;border-radius:9px;background:#fff;padding:10px 11px;color:#203649!important;cursor:pointer}.v3851-attachment-row:has(input:checked){border-color:#6c9bc2;background:#eef7ff}.v3851-attachment-row.is-required{cursor:default;background:#f3f6f9}.v3851-attachment-row input{width:17px!important;height:17px!important;min-height:0!important;margin:2px 0 0!important}.v3851-attachment-row span{display:grid;gap:2px}.v3851-attachment-row strong{font-size:13px}.v3851-attachment-row small{font-size:11px;color:#617487}.v3851-email-label-format{margin:2px 0 0 29px!important}.v3851-email-label-format select{max-width:520px}.v3851-email-label-format.hidden{display:none!important}
@media(max-width:650px){.v3851-allocation-warning{align-items:stretch;flex-direction:column}.v3851-allocation-warning button{width:100%}.v3851-email-label-format{margin-left:0!important}}

/* V44.70 width rule: packing-slip manager and create/edit window fit the screen without horizontal scrolling. */
#modal .modalbox:has(.v3847-lines),#modal .modalbox:has(.v3847-history){width:min(1180px,96vw)!important;max-width:1180px!important;overflow-x:hidden!important}.v3847-lines-wrap,.v3847-history-wrap{overflow-x:hidden!important;overflow-y:auto!important}.v3847-lines,.v3847-history{min-width:0!important;width:100%!important;max-width:100%!important;table-layout:fixed!important}.v3847-lines th,.v3847-lines td,.v3847-history th,.v3847-history td{white-space:normal!important;overflow-wrap:anywhere!important;word-break:break-word!important;min-width:0!important}.v3847-lines .v3847-qty{width:100%!important;min-width:0!important;max-width:78px!important}.v3847-row-actions{display:grid!important;grid-template-columns:repeat(2,minmax(0,1fr))!important}.v3847-row-actions button{white-space:normal!important;min-width:0!important;width:100%}.v3847-top-grid{grid-template-columns:repeat(4,minmax(0,1fr))!important}.v3847-line-tools{flex-wrap:wrap}.v3847-line-tools>div:last-child{flex-wrap:wrap}
@media(max-width:950px){.v3847-top-grid{grid-template-columns:repeat(2,minmax(0,1fr))!important}.v3847-lines,.v3847-history{font-size:11px}.v3847-lines th,.v3847-lines td,.v3847-history th,.v3847-history td{padding:6px 5px!important}}
@media(max-width:650px){.v3847-top-grid{grid-template-columns:1fr!important}.v3847-row-actions{grid-template-columns:1fr!important}}

/* V51.40 packing-slip email failure visibility */
.v5140-send-failure{display:flex;align-items:center;gap:6px;margin-top:6px;max-width:250px;font-size:12px;line-height:1.25;color:#8b1e1e}
.v5140-send-failure span{min-width:0;overflow-wrap:anywhere}
.v5140-send-failure button{height:auto;min-height:0;padding:2px 6px;font-size:11px;white-space:nowrap}
.v5140-email-error-card{border:1px solid #e2b8b8;background:#fff7f7;border-radius:8px;padding:12px;display:grid;gap:7px}
.v5140-email-error-card details{margin-top:4px}
.v5140-email-error-card pre{white-space:pre-wrap;overflow-wrap:anywhere;max-height:180px;overflow:auto;background:#fff;border:1px solid #ead4d4;border-radius:6px;padding:8px;font-size:12px}
