/* BLINDAGEM DO CONTAINER E PROPORÇÃO EXATA A4 */
        #danfe-preview-wrapper { width: 100%; overflow-x: auto; padding-bottom: 20px; background-color: #f1f5f9; }
        #danfe-container * { box-sizing: border-box !important; }
        
        .danfe-page {
            font-family: Arial, Helvetica, sans-serif;
            color: #000;
            width: 800px !important;
            min-height: 1120px !important;
            height: auto !important;
            min-width: 800px !important;
            max-width: 800px !important;
            display: flex;
            flex-direction: column;
            background: #fff;
            padding: 8px;
            margin: 0 auto 20px auto;
            position: relative;
            box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1);
        }

        /* ESTRUTURA FLEXBOX DA NOTA FISCAL (Blindada contra esmagamento) */
        .flex-row { display: flex; flex-wrap: nowrap; width: 100%; align-items: stretch; }
        
        .cell { 
            padding: 2px 4px 6px 4px; 
            display: block; 
            overflow: hidden; 
        }

        /* TABELAS DE INFORMACAO (HTML real): html2canvas respeita vertical-align:top de <td> de forma confiável */
        .dtbl { width: 100%; border-collapse: collapse; table-layout: fixed; }
        .dtbl td { vertical-align: top; padding: 2px 4px 6px 4px; overflow: hidden; word-wrap: break-word; }
        
        /* TIPOGRAFIA PADRÃO SEFAZ AJUSTADA */
        .lbl { font-size: 5.5px; text-transform: uppercase; color: #333; padding-bottom: 2px; margin: 0; display: block; line-height: 1; }
        .val { font-size: 8px; font-weight: bold; word-break: break-word; display: block; line-height: 1.2; letter-spacing: -0.1px; padding-top: 2px; }
        .val-sm { font-size: 7.5px; }
        
        .sec-title { 
            font-size: 6.5px; 
            font-weight: bold; 
            text-transform: uppercase; 
            padding: 1px 4px 8px 4px; 
            border-bottom: 1px solid #000; 
            background-color: #f8f8f8; 
            line-height: 1.2; 
            display: block;
            overflow: hidden;
        }
        .danfe-title { font-size: 14px; font-weight: 900; letter-spacing: 2px; text-align: center; }
        
        /* TABELA DE PRODUTOS BLINDADA CONTRA SOBREPOSIÇÃO */
        .prod-table { border-collapse: collapse; width: 100%; table-layout: fixed; }
        .prod-table th, .prod-table td { 
            border-right: 1px solid #000; 
            border-bottom: 1px solid #000; 
            padding: 4px 3px 6px 3px; 
            font-size: 6.5px; 
            vertical-align: top; 
            word-wrap: break-word; 
            line-height: 1.3; 
        }
        .prod-table th:last-child, .prod-table td:last-child { border-right: none; }
        .prod-table th { font-size: 5.5px; text-transform: uppercase; font-weight: bold; text-align: left; background-color: #f8f8f8; padding: 4px 3px; }
        
        .prod-desc { display: block; padding-bottom: 2px; }
        .num-col { font-size: 7px; font-weight: bold; }

        @media print {
            body { margin: 0; padding: 0; background: #fff; }
            #danfe-preview-wrapper { padding: 0; background: transparent; overflow: visible; }
            .danfe-page {
                width: 100% !important;
                max-width: 100% !important;
                min-width: 0 !important;
                min-height: auto !important;
                margin: 0 !important;
                padding: 0 !important;
                box-shadow: none !important;
                page-break-after: always;
            }
            @page {
                size: A4 portrait;
                margin: 5mm;
            }
        }