﻿@media print {
    body * {
        visibility: hidden !important;
        /* Oculta todo el cuerpo */
    }

    .printable-area, .printable-area * {
        visibility: visible !important; /* Muestra solo el div a imprimir */
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    .printable-area {
        position: absolute !important;
        left: 0 !important;
        top: 0 !important;
        width: 100% !important;
        font-size: 10px !important; /* Reduce el tamaño de fuente */
        overflow: visible !important; /* Permite que se vea todo */
        box-shadow: none !important; /* Elimina sombras */
    }

    .d-print-none {
        display: none !important;
    }

    /* Forzar repetición de header/footer en tablas */
    thead {
        display: table-header-group !important;
    }

    tfoot {
        display: table-footer-group !important;
    }

    /* Evitar cortes raros en filas */
    tr, td, th {
        page-break-inside: avoid;
        padding: 2px 4px !important; /* Reduce padding */
    }

    /* Elimina cabecera/pie que agrega el navegador */
    @page {
        margin: 10mm !important;

        @bottom-center {
            content: "Página " counter(page) " de " counter(pages);
        }
    }
}

/* En pantalla no se muestra */
@media screen {
    .only-print {
        display: none !important;
    }
}
