/* Force black-on-white output for all browser printing. Screen styles are unchanged. */

@media print {
    /* Do not preserve theme / semantic background colors */
    *, *::before, *::after {
        -webkit-print-color-adjust: economy !important;
        print-color-adjust: economy !important;
        color: #000 !important;
        border-color: #000 !important;
        box-shadow: none !important;
        text-shadow: none !important;
    }

    /* Barcode stripes need exact black/white rendering */
    .bc-stripe, .bc-stripe * {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    html, body {
        background: #fff !important;
        color: #000 !important;
    }

    html[data-bs-theme="dark"],
    html[data-bs-theme="light"],
    html[data-doc-theme="dark"],
    body[data-bs-theme="dark"],
    body[data-bs-theme="light"] {
        background: #fff !important;
        color: #000 !important;
    }

    /* Hide app chrome */
    header, nav, .navbar, .navbar-expand-lg,
    .no-print, .action-bar, .pp-breadcrumb, .toolbar,
    .toast-container, .modal, .modal-backdrop {
        display: none !important;
    }

    /* Test environment banner (inline red bar in layout) */
    body > div[style*="background:#dc3545"],
    body > div[style*="background: #dc3545"] {
        display: none !important;
    }

    /* Document sheets */
    .doc-sheet, .qc-form, .sb-form, .label-wrapper,
    .doc-preview-wrap, #divDoc, #pageContent {
        background: #fff !important;
        color: #000 !important;
        box-shadow: none !important;
    }

    /* Branding / headers */
    .doc-branding-title-row {
        border-bottom-color: #000 !important;
    }

    .doc-branding-title-wrap .doc-title,
    .doc-code, .total-value {
        color: #000 !important;
    }

    .doc-branding-title-wrap .doc-sub,
    .doc-rev, .doc-branding-gap-label,
    .kv-label, .total-label, .doc-footer,
    .field-label, .form-note, .doc-branding-phc,
    .doc-branding-puc {
        color: #000 !important;
    }

    .doc-branding-logo-placeholder {
        border-color: #000 !important;
        color: #000 !important;
    }

    /* Tables and bands */
    .lines-table thead th {
        background: #fff !important;
        color: #000 !important;
        border: 1px solid #000 !important;
        font-weight: bold !important;
    }

    .lines-table tbody td,
    .lines-table tbody tr:nth-child(even) td {
        background: #fff !important;
        color: #000 !important;
        border: 1px solid #000 !important;
    }

    .totals-band, .notes-box {
        background: #fff !important;
        border: 1px solid #000 !important;
        color: #000 !important;
    }

    .status-pill,
    .status-open, .status-pending, .status-draft,
    .status-confirmed, .status-complete, .status-released,
    .status-partial, .status-superseded,
    .status-cancelled, .status-fail {
        color: #000 !important;
        border-color: #000 !important;
        background: transparent !important;
    }

    .fulfil-bar {
        background: #fff !important;
        border: 1px solid #000 !important;
    }

    .fulfil-fill, .progress-bar {
        background: #000 !important;
        color: #fff !important;
    }

    /* Packing instruction line-status dots */
    .line-status, .ls-open, .ls-partial, .ls-assigned,
    .ls-complete, .ls-cancelled {
        background: #000 !important;
    }

    /* QC inspection form */
    .hdr-table, .field-table, .ar-row, .dtable, .office-table {
        border-color: #000 !important;
    }

    .hdr-table td, .field-table td, .ar-row td,
    .dtable td, .dtable th, .office-table td {
        border-color: #000 !important;
        background: #fff !important;
        color: #000 !important;
    }

    .ar-label, .office-label, .drow-group, .drow-total, .drow-total-r {
        background: #fff !important;
        color: #000 !important;
    }

    .ar-value-pass, .ar-value-hold, .ar-value-fail,
    .pct-cell, .field-value, .prefilled {
        color: #000 !important;
    }

    .dtable th, .office-banner {
        background: #fff !important;
        color: #000 !important;
        border: 1px solid #000 !important;
        font-weight: bold !important;
    }

    .office-banner {
        border: 1px solid #000 !important;
    }

    /* Export label tables */
    table.label-table td, .product-table td {
        border-color: #000 !important;
        background: #fff !important;
        color: #000 !important;
    }

    .editable:focus {
        background: transparent !important;
        border-bottom: none !important;
    }

    /* Bootstrap / theme leftovers on layout pages */
    .card, .card-header, .card-body, .card-footer,
    .table, .table-striped > tbody > tr:nth-of-type(odd) > *,
    .table > :not(caption) > * > * {
        background: #fff !important;
        color: #000 !important;
        border-color: #000 !important;
    }

    a, a:visited {
        color: #000 !important;
        text-decoration: none !important;
    }

    img.doc-branding-logo {
        -webkit-print-color-adjust: economy !important;
        print-color-adjust: economy !important;
    }

    .doc-branding-attribution {
        color: #000 !important;
    }
}
