/* Global print rules.
 *
 * Loaded last so it wins over the layout's own screen styles. Its only job is to
 * strip app chrome — sidebar, top bar, floating buttons, toasts — from anything
 * the user prints. What actually gets printed is decided by the page: a page with
 * a printable artefact marks its own on-screen-only controls with `.pay-noprint`
 * (or its own equivalent) in its isolated stylesheet.
 *
 * This is deliberately not a per-page hidden-iframe print like the 80mm receipt
 * flow: a payslip is a full-page A4 document, so printing the page itself is both
 * correct and simpler.
 */

/* Every full-page document the app prints (payslips, report cards, anything saved with
   "Save as PDF") is an A4 sheet. Without this the browser uses the printer's default,
   which is US Letter on many machines — a different shape, so the page either leaves a
   band empty or pushes the last lines onto a second sheet.

   This file is linked to the main document only. Receipts and label sheets print from
   their own iframe documents with their own @page (80mm roll, label stock), so they are
   not affected. */
@page {
    size: A4 portrait;
    margin: 12mm;
}

@media print {
    /* App chrome. These selectors are intentionally broad — a shell class that is
       renamed will simply stop being hidden, never break the page. */
    .sidebar,
    .nav-menu,
    .top-row,
    .mk-appshell-nav,
    .mk-appshell-topbar,
    nav.navbar,
    .stack-toaster,
    .blazor-error-boundary,
    #blazor-error-ui,
    .no-print {
        display: none !important;
    }

    /* The content column carries margins and a max-width for screen reading that
       waste most of the sheet in print. */
    main,
    .main,
    .content,
    .page {
        margin: 0 !important;
        padding: 0 !important;
        max-width: none !important;
        width: 100% !important;
        display: block !important;
    }

    body {
        background: #FFFFFF !important;
        /* Printed output is always the light palette: a dark-mode page prints as a
           solid black rectangle and empties the cartridge. */
        color: #000000 !important;
    }

    /* Backgrounds are off by default in most browsers; opt in so tint fills and
       status colours survive onto paper. */
    * {
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    a[href]::after { content: none !important; }
}
