/* Print-only correction for the original receipt tables. Screen styling is unchanged. */
@media print {
    @page management-receipt {
        size: A4 landscape !important;
        margin: 5mm;
    }

    html:has(#management-view[data-management-view$="-receipt"]),
    body:has(#management-view[data-management-view$="-receipt"]) {
        page: management-receipt;
        margin: 0 !important;
        padding: 0 !important;
        height: auto !important;
        overflow: visible !important;
    }
    body:has(#management-view[data-management-view$="-receipt"]) .header-navbar,
    body:has(#management-view[data-management-view$="-receipt"]) .main-menu,
    body:has(#management-view[data-management-view$="-receipt"]) > footer,
    body:has(#management-view[data-management-view$="-receipt"]) #overlayfull {
        display: none !important;
    }
    body:has(#management-view[data-management-view$="-receipt"]) .app-content,
    body:has(#management-view[data-management-view$="-receipt"]) .content-wrapper,
    #management-view[data-management-view$="-receipt"] {
        margin: 0 !important;
        padding: 0 !important;
        width: auto !important;
        max-width: none !important;
        height: auto !important;
        overflow: visible !important;
        float: none !important;
        /* The original .content animates every property for300ms. Entering
           print must apply the zero sidebar margin immediately; intermediate
           screen margins otherwise narrow/crop the warehouse receipt table. */
        transition: none !important;
    }
    #management-view[data-management-view$="-receipt"] form[data-form],
    #management-view[data-management-view$="-receipt"] button {
        display: none !important;
    }
    #management-view[data-management-view$="-receipt"] div[style*="overflow"] {
        overflow: visible !important;
        height: auto !important;
    }
    #management-view[data-management-view$="-receipt"] table#print {
        display: table !important;
        table-layout: auto !important;
        width: 100% !important;
        max-width: 100% !important;
        overflow: visible !important;
        clear: both;
    }
    #management-view[data-management-view$="-receipt"] table#print thead {
        display: table-header-group !important;
    }
    #management-view[data-management-view$="-receipt"] table#print tbody {
        display: table-row-group !important;
        float: none !important;
        overflow: visible !important;
        height: auto !important;
    }
    #management-view[data-management-view$="-receipt"] table#print th,
    #management-view[data-management-view$="-receipt"] table#print td {
        width: auto !important;
        min-width: 0 !important;
        white-space: normal !important;
        overflow-wrap: break-word;
    }
    #management-view[data-management-view$="-receipt"] table#print tr {
        break-inside: avoid;
        page-break-inside: avoid;
    }
    /* The source shift labels are rows inside tbody. Print-only table grouping
       repeats those same labels without changing the on-screen DOM/layout. */
    #management-view[data-management-view="shift-receipt"] table#print > tbody {
        display: contents !important;
    }
    #management-view[data-management-view="shift-receipt"] table#print > tbody > tr.cart__header-labels {
        display: table-header-group !important;
    }
}
