/* Documentos fiscais impressos. Regras isoladas das superfícies da aplicação. */
body.nfg-standalone-print-body,
body.nfg-portal-notas-document-body {
    overflow: auto;
    height: 100vh;
    padding-bottom: 40px;
}
/* DANFSe nacional
   ========================================================================== */
.nfg-danfse-page,
.nfg-danfse-page * {
    box-sizing: border-box;
}

.nfg-danfse-page {
    width: 860px;
    max-width: 100%;
    margin: 0 auto;
    color: #000;
    background: #fff;
    border: 1px solid #222;
    font-family: Arial, Helvetica, sans-serif;
    font-size: 9px;
    line-height: 1.14;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
}

.nfg-danfse-page table {
    width: 100%;
    table-layout: fixed;
    border-collapse: collapse;
    border-top: 1px solid #444;
}

.nfg-danfse-page > table:first-child {
    border-top: 0;
}

.nfg-danfse-page td {
    height: 26px;
    padding: 2px 5px;
    vertical-align: top;
}

.nfg-danfse-page .nfg-danfse-head td {
    height: 44px;
    padding: 0 7px;
    vertical-align: middle;
    background: #fff;
}

.nfg-danfse-logo {
    display: block;
    width: 155px;
    max-width: 100%;
    max-height: 42px;
    object-fit: contain;
}

.nfg-danfse-title {
    text-align: center;
    font-size: 12px;
    font-weight: 700;
    line-height: 1.05;
}

.nfg-danfse-title span,
.nfg-danfse-title strong {
    display: block;
}

.nfg-danfse-sem-validade {
    display: block;
    color: #f00;
    font-size: 13px;
}

.nfg-danfse-municipio {
    font-size: 8px;
    line-height: 1.1;
}

.nfg-danfse-municipio strong {
    display: block;
    font-size: 9px;
    font-weight: 400;
    white-space: normal;
    overflow-wrap: anywhere;
}

.nfg-danfse-municipio span {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.nfg-danfse-label {
    display: block;
    margin-bottom: 1px;
    font-size: 8px;
    font-weight: 700;
    line-height: 1.08;
}

.nfg-danfse-value {
    display: block;
    max-width: 100%;
    min-height: 12px;
    overflow: hidden;
    font-size: 9px;
    font-weight: 400;
    line-height: 1.14;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.nfg-danfse-value-big {
    font-size: 11px;
}

.nfg-danfse-section {
    background: #e5e5e5;
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
}

.nfg-danfse-highlight {
    background: #e5e5e5;
}

.nfg-danfse-qr-cell {
    padding: 5px 3px 3px !important;
    text-align: center;
}

.nfg-danfse-qr img {
    display: block;
    width: 74px;
    height: 74px;
    margin: 0 auto 2px;
    object-fit: contain;
}

.nfg-danfse-qr-note {
    font-size: 8px;
    line-height: 1.12;
    text-align: left;
}

.nfg-danfse-description {
    height: 70px !important;
}

.nfg-danfse-description .nfg-danfse-value,
.nfg-danfse-info .nfg-danfse-value {
    display: -webkit-box;
    overflow: hidden;
    text-align: justify;
    text-align-last: left;
    text-overflow: ellipsis;
    white-space: pre-wrap;
    -webkit-box-orient: vertical;
}

.nfg-danfse-info {
    min-height: 270px;
}

.nfg-danfse-receipt {
    width: calc(100% - 8px) !important;
    margin: 4px auto;
    border: 1px solid #000;
}

.nfg-danfse-receipt td {
    height: 24px;
    border: 1px solid #000;
}

.nfg-danfse-row {
    break-inside: avoid;
    page-break-inside: avoid;
}

/* Nota emitida no sistema próprio
   ========================================================================== */
.nota-sistema-proprio,
.nota-sistema-proprio * {
    box-sizing: border-box;
}

.nota-sistema-proprio {
    width: 706px;
    margin-inline: auto;
    color: #000;
    background: #fff;
    font-family: Arial, Helvetica, sans-serif;
}

.nota-sistema-proprio p {
    margin: 0;
}

.nota-sistema-proprio table {
    border-collapse: collapse;
}

.nota-sistema-proprio-documento {
    width: 706px;
    height: 852px;
    margin-bottom: 20px;
    table-layout: fixed;
    border: 1px solid #000;
}

.nota-sistema-proprio-documento > tbody > tr > td {
    padding: 1px 2px;
    vertical-align: middle;
    border: 1px solid #000;
}

.nota-sistema-proprio-cabecalho { height: 95px !important; }
.nota-sistema-proprio-logo { width: 125px; text-align: center; }
.nota-sistema-proprio-logo img { width: 120px; height: 112px; object-fit: contain; }
.nota-sistema-proprio-cidade { width: 379px; text-align: center; font-size: xx-small; }
.nota-sistema-proprio-nome-cidade { font-size: 13px !important; font-weight: 200 !important; height: 26px; }
.nota-sistema-proprio-secretaria { font-size: medium !important; font-weight: 200 !important; height: 29px; }
.nota-sistema-proprio-titulo { font-size: medium; font-weight: 400; }
.nota-sistema-proprio-informacoes-nota { width: 202px; font-size: xx-small; }
.nota-sistema-proprio-informacoes-nota td { height: 28px; }
.nota-sistema-proprio-informacoes-nota-tabela { width: 100%; height: 112px; }
.nota-sistema-proprio-prestador { height: 123px; }
.nota-sistema-proprio-prestador-detalhes { font-size: xx-small; line-height: 13px; }
.nota-sistema-proprio-banda { height: 16px; color: #000; background: #80ff80; font-size: small; margin: 3px 4px; font-weight: 700; text-align: center; }
.nota-sistema-proprio-banda-outros-dados { height: 20px; color: #000; background: #80ff80; font-size: small; margin: 1px 0 2px; font-weight: 700; text-align: center; }
.nota-sistema-proprio-tomador { height: 125px; font-size: xx-small; }
.nota-sistema-proprio-servico { height: 220px; vertical-align: top !important; font-size: x-small; text-align: justify; overflow-wrap: anywhere; }
.nota-sistema-proprio-discriminacao { white-space: pre-wrap; margin-left: 5px;}
.nota-sistema-proprio-observacao { height: 58px; vertical-align: top !important; font-size: xx-small; }
.nota-sistema-proprio-local { height: 20px; font-size: xx-small; }
.nota-sistema-proprio-retencoes { height: 36px; font: xx-small "Times New Roman", serif; }
.nota-sistema-proprio-retencoes table,
.nota-sistema-proprio-valores table { width: 100%; table-layout: fixed; }
.nota-sistema-proprio-valores { height: 50px; font: xx-small "Times New Roman", serif; }
.nota-sistema-proprio-valores th { height: 16px; font: bold x-small Arial, sans-serif; text-align: left; }
.nota-sistema-proprio-codigo-cnae,
.nota-sistema-proprio-codigo-servico,
.nota-sistema-proprio-nbs { font-size: 10px; }
.nota-sistema-proprio-outros-dados { height: 174px; vertical-align: top !important; padding: 0 !important; font-size: 8pt; }
.nota-sistema-proprio-outros-dados-layout { display: grid; grid-template-columns: 112px minmax(0, 1fr); min-height: 174px; }
.nota-sistema-proprio-outros-dados-area-qrcode { display: flex; align-items: center; justify-content: center; border-right: 1px solid #000; }
.nota-sistema-proprio-outros-dados-area-qrcode img { width: 90px; height: 90px; object-fit: contain; }
.nota-sistema-proprio-outros-dados-conteudo { display: flex; flex-direction: column; padding: 0 2px; line-height: 1.3; overflow-wrap: anywhere; }
.nota-sistema-proprio-outros-dados-texto { flex: 1; }
.nota-sistema-proprio-outros-dados-validacao { padding: 2px 0; }
.nota-sistema-proprio-outras-informacoes { height: 18px; background: #80ff80; font-size: small; font-weight: 700; text-align: center; }
.nota-sistema-proprio-assinatura { overflow-wrap: anywhere; }
.nota-sistema-proprio-retencoes-titulo { display: block; font-weight: semibold; font-size: 13px; font-family:  Arial, sans-serif; }
.nota-sistema-proprio-preenchimento { width: 100%; height: 100%; }
.nota-sistema-proprio-observacao-titulo { font-size: 12px; }
.nota-sistema-proprio-valores-titulo { font: bold 13px Arial; margin-bottom: 8px; }
.nota-sistema-proprio-outras-informacoes-logo { width: 125px; border-right: 1px solid #000; text-align: center; }

/* Boleto emitido no sistema próprio
   ========================================================================== */
.nfg-own-boleto,
.nfg-own-boleto * {
    box-sizing: border-box;
}

.nfg-own-boleto {
    width: 900px;
    color: #000;
    background: #fff;
    font-family: Arial, Helvetica, sans-serif;
    font-size: small;
}

.nfg-own-boleto table { border-collapse: collapse; }
.nfg-own-boleto-via { width: 100%; table-layout: fixed; }
.nfg-own-boleto-via td { padding: 2px 5px; border: 1px solid #000; }
.nfg-own-boleto-contribuinte { height: 291px; }
.nfg-own-boleto-banco { height: 266px; }
.nfg-own-boleto-logo { width: 159px; height: 121px; text-align: center; }
.nfg-own-boleto-banco .nfg-own-boleto-logo { width: 134px; }
.nfg-own-boleto-logo img { width: 74px; height: 75px; object-fit: contain; }
.nfg-own-boleto-prefeitura { height: 121px; text-align: center; }
.nfg-own-boleto-prefeitura strong { font-size: medium; }
.nfg-own-boleto-summary { width: 255px; height: 121px; font-size: medium; }
.nfg-own-boleto-person { height: 88px; line-height: 22px; }
.nfg-own-boleto-label { width: 14%; font-weight: 700; }
.nfg-own-boleto-value-label { width: 17%; font-weight: 700; text-align: right; }
.nfg-own-boleto-value { width: 12%; font-weight: 700; }
.nfg-own-boleto-row { height: 32px; }
.nfg-own-boleto-instructions { height: 96px; vertical-align: top; }
.nfg-own-boleto-linked { margin: 10px 0; color: #00e; }
.nfg-own-boleto-identification { width: 100%; }
.nfg-own-boleto-via-label { text-align: right; font-size: x-small; }
.nfg-own-boleto-auth { font-size: small; }
.nfg-own-boleto-line { width: 775px; max-width: 100%; margin: 4px auto; font-size: small; font-weight: 700; text-align: center; letter-spacing: .2px; }
.nfg-own-boleto-auth-contributor { text-align: center; }
.nfg-own-boleto-cut { margin: 5px 0; text-align: center; }
.nfg-own-boleto-bank-footer { display: grid; grid-template-columns: minmax(0, 1fr) 115px; }
.nfg-own-boleto-bank-content { text-align: center; }
.nfg-own-boleto-pix { min-height: 120px; }
.nfg-own-boleto-barcode { display: flex; align-items: stretch; width: 749px; max-width: 100%; height: 50px; margin: 16px auto 4px; overflow: hidden; }
.nfg-own-boleto-barcode span { display: block; flex: 0 0 auto; height: 50px; }
.nfg-own-boleto-barcode .nfg-bar-black { background: #000; }
.nfg-own-boleto-barcode .nfg-bar-white { background: #fff; }

.nfg-print-actions,
.nota-sistema-proprio-botao-imprimir {
    width: 100%;
    min-height: 40px;
    padding-top: 4px;
    text-align: center;
}

.nfg-print-actions-boleto { width: 900px; }

.nfg-print-actions button,
.nota-sistema-proprio-botao-imprimir button {
    min-height: 26px;
    padding: 2px 9px 3px;
    color: #fff;
    background: #007bff;
    border: 1px solid #0069d9;
    border-radius: .25rem;
    font: 14px/1.5 Arial, sans-serif;
    cursor: pointer;
}

@media print {
    @page { size: A4 portrait; margin: 5mm; }

    html,
    body {
        margin: 0 !important;
        padding: 0 !important;
        background: #fff !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    body * { visibility: hidden !important; }

    .nota-sistema-proprio {
        margin: 0 auto;
    }

    #danfse-print-area,
    #danfse-print-area *,
    .nota-sistema-proprio,
    .nota-sistema-proprio *,
    .nfg-own-boleto,
    .nfg-own-boleto * {
        visibility: visible !important;
    }

    .nfg-print-actions,
    .nota-sistema-proprio-botao-imprimir,
    .nfg-danfse-actionbar,
    .nfg-notas-print-toolbar,
    .nfg-portal-notas-document-toolbar,
    .modal-header,
    .modal-backdrop,
    .nfg-sidebar,
    .nfg-topbar,
    .nfg-mobile-nav {
        display: none !important;
    }

    #danfse-print-area.nfg-danfse-page {
        position: static;
        width: 200mm;
        max-width: 200mm;
        height: auto;
        min-height: 0;
        margin: 0 auto;
        overflow: visible;
    }

    .nfg-danfse-page table,
    .nfg-danfse-page tr,
    .nfg-danfse-page td {
        height: auto;
        max-height: none;
    }

    .nfg-danfse-page tr,
    .nfg-danfse-row {
        break-inside: avoid;
        page-break-inside: avoid;
    }

    .nfg-danfse-description,
    .nfg-danfse-info {
        height: auto !important;
        min-height: 0;
    }

    .nfg-danfse-description .nfg-danfse-value,
    .nfg-danfse-info .nfg-danfse-value {
        display: block;
        overflow: visible;
        white-space: pre-wrap;
        overflow-wrap: anywhere;
    }

    .nfg-detalhe-danfse-print-only,
    .modal,
    .modal-dialog,
    .modal-content,
    .modal-body {
        position: static !important;
        display: block !important;
        width: auto !important;
        height: auto !important;
        max-width: none !important;
        max-height: none !important;
        margin: 0 !important;
        padding: 0 !important;
        overflow: visible !important;
        border: 0 !important;
        box-shadow: none !important;
        background: transparent !important;
    }

    .nfg-own-note,
    .nfg-own-boleto {
        position: absolute;
        inset: 0 auto auto 0;
    }
}

/* Casca da impressão DANFSe do backoffice (Notas/Imprimir). */
.nfg-notas-print-shell #danfse-print-area {
    width: 100%;
    max-width: 200mm;
    min-height: 0;
}

@media print {
    .nfg-notas-print-body {
        padding: 0;
        background: transparent;
    }

    .nfg-notas-print-toolbar {
        display: none;
    }

    .nfg-notas-print-shell {
        width: 100%;
        margin: 0;
    }

    .nfg-notas-print-shell #danfse-print-area {
        width: 200mm;
        max-width: none;
        min-height: 0;
        height: auto;
        margin: 0;
        box-shadow: none;
    }
}
