/* Reuse the certification typography, with a bounded A4 sheet and balance table. */
@page leave-credits-page { size: A4 portrait; margin: 0; }

.print-document.leave-credits-print-document {
    box-sizing: border-box;
    width: 210mm;
    min-height: 297mm;
    padding: 15mm 18mm 12mm;
    page: leave-credits-page;
}

.leave-credits-certification { width: 100%; min-width: 0; }
.leave-credits-certification .coe-employee-line { overflow-wrap: anywhere; }
.leave-credits-certification .leave-credits-balance-table {
    width: 100%;
    table-layout: fixed;
    border-collapse: collapse;
    margin: 8mm 0;
    break-inside: avoid;
    font-size: 12pt;
}
.leave-credits-balance-table th,
.leave-credits-balance-table td {
    border: 1px solid #000;
    padding: 3mm 2mm;
    text-align: center;
    font-variant-numeric: tabular-nums;
    overflow-wrap: anywhere;
}
.leave-credits-balance-table th {
    font-weight: 700;
    line-height: 1.15;
    padding: 1.5mm 2mm;
}
/* Keep report balance headers monochrome instead of inheriting menu-table colors.
   Form 6 is shared by the Filed Leave and CTO print reports. */
.cto-form6-sheet .cto-form6-credit table thead th,
.leave-credits-certification .leave-credits-balance-table th {
    color: #000;
    background: #fff;
}
.leave-credits-certification .coe-signature { break-inside: avoid; }

/* Center every balance cell, including Earned/Spent/Balance row labels.
   Preserve the existing symmetric padding, text alignment and font sizes. */
.cto-form6-sheet .cto-form6-credit table :is(th, td),
.leave-credits-certification .leave-credits-balance-table :is(th, td) {
    vertical-align: middle;
}

/* Compact only the Form 6 balance headers; retain the existing value rows. */
.cto-form6-sheet .cto-form6-credit table thead th {
    font-size: 7pt;
    font-weight: 600;
    line-height: 1.1;
    padding: .35mm 1mm;
    vertical-align: middle;
}

@media print {
    /* The screen's 100vh minimum creates a trailing blank page in Firefox
       after the named A4 Form 6 sheet. Only reset its outer print container. */
    .print-only-layout:has(.cto-form6-sheet) {
        min-height: 0 !important;
    }

    html:has(.leave-credits-print-document),
    body:has(.leave-credits-print-document),
    .print-only-layout:has(.leave-credits-print-document),
    .print-page:has(.leave-credits-print-document) {
        page: leave-credits-page !important;
        width: 210mm !important;
        min-width: 0 !important;
        min-height: 0 !important;
        margin: 0 !important;
        padding: 0 !important;
        display: block !important;
    }
    .print-document.leave-credits-print-document {
        width: 210mm !important;
        min-width: 0 !important;
        min-height: 0 !important;
        padding: 15mm 18mm 12mm !important;
        margin: 0 !important;
        box-shadow: none;
    }
}
