* {
    box-sizing: border-box;
}

:root {
    font-family: Arial, Helvetica, sans-serif;
    color: #111;
}

body {
    margin: 0;
    background: #dfe4ea;
}

.toolbar {
    position: sticky;
    top: 0;
    z-index: 1000;

    min-height: 66px;

    display: flex;
    align-items: center;
    justify-content: space-between;

    gap: 12px;

    padding: 10px 18px;

    background: #111827;
    color: white;

    box-shadow: 0 2px 10px rgba(0,0,0,.25);
}

.toolbar-title {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.toolbar-title strong {
    font-size: 21px;
}

.toolbar-title span {
    font-size: 12px;
    color: #d1d5db;
}

.toolbar-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.btn {
    border: 0;
    border-radius: 7px;

    padding: 10px 14px;

    font-weight: 700;
    cursor: pointer;
}

.btn.blue {
    background: #2563eb;
    color: white;
}

.btn.green {
    background: #15803d;
    color: white;
}

.btn.yellow {
    background: #f59e0b;
    color: #111;
}

.btn.dark {
    background: #374151;
    color: white;
}

.btn.mini {
    padding: 6px 10px;
    font-size: 12px;
}

.page {
    width: 210mm;
    min-height: 297mm;

    margin: 18px auto;
    padding: 10mm 9mm 12mm;

    background: white;

    box-shadow: 0 0 16px rgba(0,0,0,.18);
}

.cabecalho {
    display: grid;

    grid-template-columns: 24mm 1fr 24mm;

    align-items: center;

    margin-bottom: 6px;
}

.instituicao {
    text-align: center;

    font-size: 14px;
    font-weight: 800;

    line-height: 1.28;
}

.brasao {
    width: 21mm;
    height: 21mm;

    border: 2px solid #333;

    border-radius: 50%;

    display: flex;
    align-items: center;
    justify-content: center;

    font-weight: 900;
    font-size: 20px;

    justify-self: center;
}

.brasao-direita {
    border-radius: 4px 4px 10px 10px;
}

.titulo-rop {
    border: 2px solid #111;

    background: #dedede;

    min-height: 35px;

    display: grid;

    grid-template-columns: 1fr auto;

    align-items: center;

    padding: 4px 7px;

    font-size: 13px;

    text-align: center;
}

.titulo-rop span {
    min-width: 42mm;
    text-align: right;
}

.bloco {
    border: 1.6px solid #111;
    border-top: 0;

    padding: 5px 6px;
}

.bloco h2 {
    margin: 0 0 5px;

    font-size: 12px;
    font-weight: 800;
}

.topo-form {
    border-top: 0;
}

.grid {
    display: grid;
    gap: 5px 8px;
}

.linha-topo {
    grid-template-columns: 1.35fr .65fr .65fr 1.2fr;
}

label {
    display: block;
    font-size: 11px;
    font-weight: 600;
}

input,
select,
textarea {
    width: 100%;

    border: 0;
    border-bottom: 1px solid #111;

    background: transparent;

    font-family: Arial, Helvetica, sans-serif;
    font-size: 11px;

    padding: 3px 2px;

    outline: none;
}

textarea {
    border: 1px solid #888;
    margin-top: 3px;
    resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
    background: #fff8cf;
}

.policial {
    border-top: 1px solid #bbb;
    padding-top: 4px;
    margin-top: 4px;
}

.policial:first-child {
    border-top: 0;
    margin-top: 0;
}

.subtitulo {
    font-size: 10px;
    font-weight: 700;
    margin-bottom: 3px;
}

.policial-grid {
    grid-template-columns: 2.2fr 1fr 1.2fr;
}

.checks {
    display: grid;
}

.enquadramentos {
    grid-template-columns: repeat(5, 1fr);
    gap: 5px 8px;

    margin-bottom: 6px;
}

.checks label {
    display: flex;
    align-items: flex-start;
    gap: 4px;

    font-weight: 500;
}

.checks input[type="checkbox"] {
    width: auto;
    margin: 1px 0 0;
}

.outros-grid {
    grid-template-columns: 2fr 1fr;
}

.violencia {
    display: grid;
    grid-template-columns: 1fr 70px;
    align-items: center;
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.envolvido {
    border-top: 1px solid #111;
    padding-top: 5px;
    margin-top: 5px;
}

.envolvido:first-child {
    margin-top: 0;
}

.envolvido-head {
    display: flex;
    justify-content: space-between;
    align-items: center;

    margin-bottom: 4px;
}

.envolvido-numero {
    font-size: 11px;
}

.remover-envolvido {
    border: 0;
    background: #b91c1c;
    color: #fff;

    border-radius: 4px;
    padding: 4px 7px;

    font-size: 10px;

    cursor: pointer;
}

.envolvido-linha1 {
    grid-template-columns: 2fr .7fr .9fr;
}

.envolvido-filiacao {
    grid-template-columns: 1.4fr 1.4fr .7fr;
}

.envolvido-endereco {
    grid-template-columns: 2fr 1fr;
}

.envolvido-documentos {
    grid-template-columns: 1.1fr 1.2fr 1.2fr;
}

.local-topo {
    grid-template-columns: 1fr .7fr;

    max-width: 85mm;

    margin-left: auto;
    margin-bottom: 3px;
}

.local-referencia {
    grid-template-columns: 1.8fr .85fr .8fr .25fr;
}

.placas-row {
    grid-template-columns: 2fr .25fr;

    width: 52%;
}

.pericia-grid {
    grid-template-columns: .7fr 2fr;
}

.testemunha-grid {
    grid-template-columns: .7fr 2fr;
    align-items: end;
}

.nota {
    font-size: 10px;
    padding-bottom: 4px;
}

.linha-check {
    font-size: 11px;
    font-weight: 600;
    margin: 4px 0;
}

.providencias {
    grid-template-columns: auto auto 1fr auto auto 1fr;
    align-items: center;
    gap: 6px;
}

.inline-input {
    min-width: 80px;
}

.pericias-autoridade {
    grid-template-columns: 1fr 1fr;
}

.autoridade-grid {
    grid-template-columns: 2fr .7fr 1fr;
}

.termino {
    margin-top: 28px;

    display: flex;
    justify-content: center;
    align-items: center;

    gap: 8px;

    font-size: 12px;
}

.termino input {
    width: 32mm;
    text-align: center;
}

.toast {
    position: fixed;

    right: 20px;
    bottom: 20px;

    background: #111827;
    color: white;

    border-radius: 8px;

    padding: 12px 16px;

    opacity: 0;
    transform: translateY(10px);

    transition: .2s;

    pointer-events: none;

    z-index: 2000;
}

.toast.show {
    opacity: 1;
    transform: translateY(0);
}

.toast.error {
    background: #991b1b;
}

.toast.success {
    background: #166534;
}

@media (max-width: 900px) {

    body {
        background: white;
    }

    .toolbar {
        position: relative;
        align-items: flex-start;
        flex-direction: column;
    }

    .page {
        width: 100%;
        min-height: 0;

        margin: 0;
        padding: 12px;

        box-shadow: none;
    }

    .cabecalho {
        grid-template-columns: 45px 1fr 45px;
    }

    .brasao {
        width: 38px;
        height: 38px;

        font-size: 12px;
    }

    .instituicao {
        font-size: 10px;
    }

    .linha-topo,
    .policial-grid,
    .envolvido-linha1,
    .envolvido-filiacao,
    .envolvido-endereco,
    .envolvido-documentos,
    .local-referencia,
    .pericia-grid,
    .testemunha-grid,
    .autoridade-grid {
        grid-template-columns: 1fr;
    }

    .enquadramentos {
        grid-template-columns: 1fr 1fr;
    }

    .providencias {
        grid-template-columns: 1fr;
    }

    .local-topo {
        margin-left: 0;
        width: 100%;
        max-width: none;
    }

    .placas-row {
        width: 100%;
    }
}

@media print {

    @page {
        size: A4 portrait;
        margin: 7mm;
    }

    body {
        background: white;
    }

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

    .page {
        width: auto;
        min-height: auto;

        margin: 0;
        padding: 0;

        box-shadow: none;
    }

    input,
    select,
    textarea {
        font-size: 10px;
    }

    textarea {
        resize: none;
    }

    .envolvido {
        break-inside: avoid;
    }

    .bloco {
        break-inside: auto;
    }
}


/* =============================================================================
   ROP - CORREÇÃO MOBILE DEFINITIVA
   - largura sempre limitada à tela
   - zero movimento horizontal
   - zero crescimento de campo no foco
   - zero zoom automático
   - teclado pode deslocar apenas verticalmente
   ============================================================================= */

html {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

body {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
    position: relative;
}

* {
    box-sizing: border-box;
    min-width: 0;
}

input,
select,
textarea,
button {
    max-width: 100%;
    box-sizing: border-box;
}

textarea {
    resize: vertical !important;
}


/* impede qualquer elemento de forçar largura maior que a viewport */
.page,
.bloco,
.grid,
.toolbar,
.toolbar-actions,
.cabecalho,
.titulo-rop,
.policial,
.envolvido,
.section-header,
.termino,
label {
    max-width: 100%;
}


/* =============================================================================
   CELULAR / TABLET
   ============================================================================= */

@media screen and (max-width: 900px) {

    html,
    body {
        width: 100%;
        max-width: 100vw;
        min-width: 0;

        margin: 0;
        padding: 0;

        overflow-x: hidden !important;

        overscroll-behavior-x: none;
    }


    body {
        position: relative;
    }


    .page {
        width: 100% !important;
        max-width: 100vw !important;
        min-width: 0 !important;

        min-height: 0;

        margin: 0 !important;

        padding:
            10px
            max(10px, env(safe-area-inset-right))
            16px
            max(10px, env(safe-area-inset-left));

        overflow-x: hidden !important;

        box-shadow: none;
    }


    .toolbar {
        width: 100% !important;
        max-width: 100vw !important;
        min-width: 0 !important;

        overflow-x: hidden !important;

        padding:
            10px
            max(10px, env(safe-area-inset-right))
            10px
            max(10px, env(safe-area-inset-left));
    }


    .toolbar-title,
    .toolbar-actions {
        width: 100%;
        max-width: 100%;
        min-width: 0;
    }


    .toolbar-actions {
        display: grid;
        grid-template-columns: 1fr 1fr;

        gap: 7px;
    }


    .toolbar-actions .btn {
        width: 100%;
        min-width: 0;
    }


    /*
       REGRA MAIS IMPORTANTE:
       16px impede navegador mobile de aplicar zoom automático
       quando o usuário toca num input.
    */

    input,
    select,
    textarea {
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;

        font-size: 16px !important;

        transform: none !important;

        margin-left: 0 !important;
        margin-right: 0 !important;

        box-sizing: border-box !important;

        -webkit-appearance: none;

        touch-action: manipulation;
    }


    input:focus,
    select:focus,
    textarea:focus {
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;

        transform: none !important;

        margin-left: 0 !important;
        margin-right: 0 !important;
    }


    textarea {
        resize: vertical !important;
    }


    /*
       Todos os grids mobile viram uma coluna.
       Nenhuma célula pode preservar largura de desktop.
    */

    .grid,
    .linha-topo,
    .policial-grid,
    .envolvido-linha1,
    .envolvido-filiacao,
    .envolvido-endereco,
    .envolvido-documentos,
    .local-topo,
    .local-referencia,
    .placas-row,
    .pericia-grid,
    .testemunha-grid,
    .pericias-autoridade,
    .autoridade-grid,
    .outros-grid {
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;

        grid-template-columns: minmax(0, 1fr) !important;
    }


    .grid > *,
    .linha-topo > *,
    .policial-grid > *,
    .envolvido-linha1 > *,
    .envolvido-filiacao > *,
    .envolvido-endereco > *,
    .envolvido-documentos > *,
    .local-topo > *,
    .local-referencia > *,
    .placas-row > *,
    .pericia-grid > *,
    .testemunha-grid > *,
    .pericias-autoridade > *,
    .autoridade-grid > *,
    .outros-grid > * {
        width: 100%;
        max-width: 100%;
        min-width: 0;
    }


    .enquadramentos {
        width: 100%;
        max-width: 100%;

        grid-template-columns:
            minmax(0, 1fr)
            minmax(0, 1fr) !important;

        gap: 8px;
    }


    .enquadramentos label {
        width: 100%;
        min-width: 0;

        overflow-wrap: anywhere;
    }


    .checks input[type="checkbox"] {
        width: 18px !important;
        min-width: 18px !important;
        max-width: 18px !important;

        height: 18px;

        flex: 0 0 18px;

        -webkit-appearance: checkbox;
        appearance: auto;
    }


    .providencias {
        display: grid;

        grid-template-columns:
            minmax(0, 1fr) !important;

        width: 100%;
        max-width: 100%;
    }


    .local-topo,
    .placas-row {
        width: 100% !important;
        max-width: 100% !important;

        margin-left: 0 !important;
        margin-right: 0 !important;
    }


    .section-header {
        width: 100%;
        max-width: 100%;

        gap: 7px;

        flex-wrap: wrap;
    }


    .section-header h2 {
        flex: 1 1 auto;
        min-width: 0;
    }


    .cabecalho {
        width: 100%;
        max-width: 100%;

        grid-template-columns:
            40px
            minmax(0, 1fr)
            40px !important;
    }


    .instituicao {
        min-width: 0;

        overflow-wrap: anywhere;
    }


    .titulo-rop {
        width: 100%;
        max-width: 100%;

        grid-template-columns:
            minmax(0, 1fr) !important;

        gap: 3px;
    }


    .titulo-rop span {
        width: 100%;
        min-width: 0;

        text-align: center;
    }


    .termino {
        width: 100%;

        flex-wrap: wrap;

        text-align: center;
    }


    .termino input {
        width: 100% !important;
        max-width: 180px !important;
    }


    /*
       evita que strings grandes, CPF, placa, nomes ou textos
       forcem o documento para fora da tela
    */

    label,
    .nota,
    .subtitulo,
    .instituicao,
    .titulo-rop,
    .envolvido,
    .policial,
    .bloco {
        overflow-wrap: anywhere;
        word-break: normal;
    }
}


/* =============================================================================
   TELAS MUITO ESTREITAS
   ============================================================================= */

@media screen and (max-width: 430px) {

    .page {
        padding-left: 8px;
        padding-right: 8px;
    }

    .enquadramentos {
        grid-template-columns:
            minmax(0, 1fr) !important;
    }

    .toolbar-actions {
        grid-template-columns:
            minmax(0, 1fr)
            minmax(0, 1fr);
    }
}


/* =============================================================================
   FOCO - NÃO ALTERAR GEOMETRIA
   ============================================================================= */

input:focus,
select:focus,
textarea:focus {
    outline: none;

    box-shadow:
        inset 0 0 0 1px #2563eb;

    transform: none !important;
}


/* nenhuma rolagem horizontal */
body,
.page {
    overscroll-behavior-x: none;
}



/* =============================================================================
   ROP - IMPRESSÃO/PDF ULTRACOMPACTA
   OBJETIVO:
   - tentar manter em 1 folha A4
   - usar no máximo 2 folhas quando o conteúdo realmente exigir
   - preservar legibilidade
   - NÃO altera a interface normal/celular
   ============================================================================= */

@media print {

    @page {
        size: A4 portrait;
        margin: 3.5mm 4mm 3.5mm 4mm;
    }

    html,
    body {
        width: 100% !important;
        margin: 0 !important;
        padding: 0 !important;

        background: #fff !important;

        font-family: Arial, Helvetica, sans-serif !important;

        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

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

    .page {
        width: 100% !important;
        max-width: none !important;
        min-height: 0 !important;

        margin: 0 !important;
        padding: 0 !important;

        box-shadow: none !important;
        border: 0 !important;
    }


    /* -------------------------------------------------------------------------
       CABEÇALHO
       ------------------------------------------------------------------------- */

    .cabecalho {
        display: grid !important;

        grid-template-columns:
            15mm
            minmax(0, 1fr)
            15mm !important;

        align-items: center !important;

        margin: 0 0 1mm 0 !important;
        padding: 0 !important;

        min-height: 13mm !important;
    }

    .brasao {
        width: 12mm !important;
        height: 12mm !important;

        min-width: 12mm !important;
        min-height: 12mm !important;

        font-size: 8px !important;
        border-width: 1px !important;
    }

    .instituicao {
        font-size: 7px !important;
        line-height: 1.05 !important;

        margin: 0 !important;
        padding: 0 !important;

        font-weight: 800 !important;
    }


    /* -------------------------------------------------------------------------
       TÍTULO
       ------------------------------------------------------------------------- */

    .titulo-rop {
        min-height: 5.5mm !important;

        padding: .4mm 1mm !important;
        margin: 0 !important;

        border-width: 1px !important;

        font-size: 7.5px !important;
        line-height: 1 !important;

        grid-template-columns:
            minmax(0, 1fr)
            auto !important;
    }

    .titulo-rop span {
        min-width: 32mm !important;
        font-size: 7px !important;
    }


    /* -------------------------------------------------------------------------
       BLOCOS
       ------------------------------------------------------------------------- */

    .bloco {
        padding: .7mm 1mm !important;

        margin: 0 !important;

        border-width: .7px !important;

        page-break-inside: auto !important;
        break-inside: auto !important;
    }

    .bloco h2 {
        margin: 0 0 .5mm 0 !important;

        font-size: 7px !important;
        line-height: 1 !important;

        padding: 0 !important;
    }

    .subtitulo {
        font-size: 6.3px !important;
        line-height: 1 !important;

        margin: 0 0 .3mm 0 !important;
    }


    /* -------------------------------------------------------------------------
       TEXTOS / LABELS
       ------------------------------------------------------------------------- */

    label,
    .nota,
    .linha-check {
        font-size: 6.2px !important;
        line-height: 1.05 !important;
    }

    .nota {
        padding-bottom: 0 !important;
    }

    .linha-check {
        margin: .4mm 0 !important;
    }


    /* -------------------------------------------------------------------------
       CAMPOS
       ------------------------------------------------------------------------- */

    input,
    select,
    textarea {
        font-size: 6.2px !important;
        line-height: 1 !important;

        padding: 0 .5mm !important;
        margin: 0 !important;

        min-height: 3.2mm !important;
        height: 3.2mm !important;

        border-bottom-width: .5px !important;

        background: transparent !important;

        color: #000 !important;

        box-shadow: none !important;
        transform: none !important;
    }

    select {
        appearance: none !important;
        -webkit-appearance: none !important;
    }

    textarea {
        min-height: 6mm !important;
        height: auto !important;

        padding: .4mm .7mm !important;

        border-width: .5px !important;

        resize: none !important;

        overflow: hidden !important;

        white-space: pre-wrap !important;
    }

    textarea[name="despachoFundamentado"] {
        min-height: 10mm !important;
        max-height: 22mm !important;
    }

    textarea[name="objetosRecolhidos"] {
        min-height: 5mm !important;
        max-height: 12mm !important;
    }


    /* -------------------------------------------------------------------------
       GRIDS
       ------------------------------------------------------------------------- */

    .grid {
        gap: .5mm 1mm !important;
    }

    .linha-topo {
        grid-template-columns:
            1.4fr
            .55fr
            .55fr
            1fr !important;
    }

    .policial-grid {
        grid-template-columns:
            2.2fr
            .8fr
            .85fr !important;
    }

    .envolvido-linha1 {
        grid-template-columns:
            2fr
            .65fr
            .75fr !important;
    }

    .envolvido-filiacao {
        grid-template-columns:
            1.3fr
            1.3fr
            .55fr !important;
    }

    .envolvido-endereco {
        grid-template-columns:
            2fr
            .9fr !important;
    }

    .envolvido-documentos {
        grid-template-columns:
            1fr
            .9fr
            .9fr !important;
    }

    .local-topo {
        max-width: 60mm !important;

        grid-template-columns:
            1fr
            .7fr !important;

        gap: .5mm 1mm !important;

        margin-bottom: .3mm !important;
    }

    .local-referencia {
        grid-template-columns:
            1.8fr
            .7fr
            .7fr
            .25fr !important;
    }

    .placas-row {
        width: 50% !important;

        grid-template-columns:
            2fr
            .25fr !important;
    }

    .pericia-grid {
        grid-template-columns:
            .7fr
            2fr !important;
    }

    .testemunha-grid {
        grid-template-columns:
            .7fr
            2fr !important;
    }

    .pericias-autoridade {
        grid-template-columns:
            1fr
            1fr !important;
    }

    .autoridade-grid {
        grid-template-columns:
            2fr
            .65fr
            .8fr !important;
    }


    /* -------------------------------------------------------------------------
       POLICIAIS
       ------------------------------------------------------------------------- */

    .policial {
        padding-top: .3mm !important;
        margin-top: .3mm !important;

        border-top-width: .5px !important;
    }


    /* -------------------------------------------------------------------------
       ENQUADRAMENTOS
       ------------------------------------------------------------------------- */

    .enquadramentos {
        grid-template-columns:
            repeat(5, minmax(0, 1fr)) !important;

        gap: .25mm .8mm !important;

        margin-bottom: .5mm !important;
    }

    .checks label {
        gap: .5mm !important;
        font-size: 5.8px !important;
        line-height: 1 !important;
    }

    .checks input[type="checkbox"] {
        width: 2.4mm !important;
        height: 2.4mm !important;

        min-width: 2.4mm !important;
        max-width: 2.4mm !important;

        margin: 0 !important;

        appearance: auto !important;
        -webkit-appearance: checkbox !important;
    }

    .outros-grid {
        grid-template-columns:
            2fr
            .8fr !important;

        gap: .5mm 1mm !important;
    }

    .violencia {
        grid-template-columns:
            1fr
            17mm !important;
    }


    /* -------------------------------------------------------------------------
       ENVOLVIDOS
       ------------------------------------------------------------------------- */

    .envolvidos-section {
        page-break-inside: auto !important;
        break-inside: auto !important;
    }

    .envolvido {
        margin-top: .6mm !important;
        padding-top: .6mm !important;

        border-top-width: .6px !important;

        page-break-inside: avoid !important;
        break-inside: avoid !important;
    }

    .envolvido-head {
        margin-bottom: .3mm !important;
    }

    .envolvido-numero {
        font-size: 6.2px !important;
        line-height: 1 !important;
    }


    /* -------------------------------------------------------------------------
       PROVIDÊNCIAS
       ------------------------------------------------------------------------- */

    .providencias {
        grid-template-columns:
            auto
            auto
            1fr
            auto
            auto
            1fr !important;

        gap: .3mm .7mm !important;
    }

    .inline-input {
        min-width: 0 !important;
    }


    /* -------------------------------------------------------------------------
       TERMINO
       ------------------------------------------------------------------------- */

    .termino {
        margin-top: 2mm !important;

        gap: 1mm !important;

        font-size: 6.5px !important;
    }

    .termino input {
        width: 23mm !important;
        height: 3.2mm !important;
    }


    /* -------------------------------------------------------------------------
       CONTROLE DE QUEBRA
       ------------------------------------------------------------------------- */

    .cabecalho,
    .titulo-rop,
    .topo-form {
        break-inside: avoid !important;
        page-break-inside: avoid !important;
    }

    .policial,
    .envolvido,
    .autoridade-grid,
    .termino {
        break-inside: avoid !important;
        page-break-inside: avoid !important;
    }


    /* -------------------------------------------------------------------------
       COMPACTAÇÃO FINAL
       ------------------------------------------------------------------------- */

    section {
        margin-top: 0 !important;
        margin-bottom: 0 !important;
    }

    p,
    div {
        orphans: 2;
        widows: 2;
    }

}


/* =============================================================================
   IMPRESSÃO EXTRA COMPACTA PARA ROP LONGO
   Ativada adicionando class="print-ultra" ao body.
   Pode ser acionada automaticamente futuramente pelo JS.
   ============================================================================= */

@media print {

    body.print-ultra .instituicao {
        font-size: 6.2px !important;
    }

    body.print-ultra .bloco h2 {
        font-size: 6.2px !important;
    }

    body.print-ultra label,
    body.print-ultra .nota,
    body.print-ultra .linha-check {
        font-size: 5.5px !important;
    }

    body.print-ultra input,
    body.print-ultra select,
    body.print-ultra textarea {
        font-size: 5.5px !important;
        min-height: 2.8mm !important;
        height: 2.8mm !important;
    }

    body.print-ultra textarea {
        height: auto !important;
    }

    body.print-ultra .bloco {
        padding: .45mm .7mm !important;
    }

    body.print-ultra .grid {
        gap: .25mm .7mm !important;
    }

    body.print-ultra .envolvido {
        margin-top: .35mm !important;
        padding-top: .35mm !important;
    }

    body.print-ultra .checks label {
        font-size: 5.1px !important;
    }

}



/* =============================================================================
   ROP - CABEÇALHO INSTITUCIONAL V2
   Mais afastado do topo e mais destacado.
   ============================================================================= */


/* -----------------------------------------------------------------------------
   TELA NORMAL
   ----------------------------------------------------------------------------- */

.page {
    padding-top: 15mm;
}

.cabecalho {
    margin-top: 2mm;
    margin-bottom: 3mm;

    min-height: 25mm;
}

.instituicao {
    font-size: 15px;
    line-height: 1.32;

    font-weight: 800;

    letter-spacing: .1px;
}

.instituicao div:first-child {
    font-size: 16px;
    font-weight: 900;
}

.instituicao div:nth-child(2) {
    font-size: 15.5px;
    font-weight: 900;
}


/* -----------------------------------------------------------------------------
   CELULAR
   Mantém respiro superior sem criar rolagem lateral.
   ----------------------------------------------------------------------------- */

@media screen and (max-width: 900px) {

    .page {
        padding-top: 18px;
    }

    .cabecalho {
        margin-top: 6px;
        margin-bottom: 10px;

        min-height: 58px;
    }

    .instituicao {
        font-size: 11px;
        line-height: 1.25;
    }

    .instituicao div:first-child {
        font-size: 12px;
    }

    .instituicao div:nth-child(2) {
        font-size: 11.5px;
    }
}


/* -----------------------------------------------------------------------------
   PDF / IMPRESSÃO
   A margem física superior fica um pouco maior.
   O cabeçalho continua compacto para ajudar a manter o ROP em 1 folha.
   ----------------------------------------------------------------------------- */

@media print {

    @page {
        size: A4 portrait;

        /*
           Antes estava excessivamente perto da borda.
           Agora há respiro real no topo.
        */
        margin:
            7mm
            4mm
            3.5mm
            4mm;
    }

    .page {
        padding-top: 0 !important;
    }

    .cabecalho {
        min-height: 16mm !important;

        margin-top: 0 !important;
        margin-bottom: 1.5mm !important;

        padding-top: .8mm !important;
        padding-bottom: .8mm !important;
    }

    .instituicao {
        font-size: 7.8px !important;

        line-height: 1.12 !important;

        font-weight: 800 !important;

        letter-spacing: .05px !important;
    }

    .instituicao div:first-child {
        font-size: 8.6px !important;
        font-weight: 900 !important;
    }

    .instituicao div:nth-child(2) {
        font-size: 8.2px !important;
        font-weight: 900 !important;
    }

    .brasao {
        width: 13mm !important;
        height: 13mm !important;

        min-width: 13mm !important;
        min-height: 13mm !important;
    }

}



/* ROP_BRASOES_OFICIAIS_V2_INICIO */

/* =============================================================================
   BRASÕES OFICIAIS
   ============================================================================= */

.brasao {
    border: 0 !important;
    border-radius: 0 !important;

    background: transparent !important;

    display: flex !important;

    align-items: center !important;
    justify-content: center !important;

    overflow: visible !important;
}


.brasao-img {
    display: block;

    max-width: 100% !important;
    max-height: 100% !important;

    width: auto !important;
    height: auto !important;

    object-fit: contain;

    border: 0 !important;

    background: transparent !important;
}


.cabecalho {
    grid-template-columns:
        29mm
        minmax(0, 1fr)
        29mm !important;
}


.brasao-esquerda {
    width: 27mm !important;
    height: 29mm !important;
}


.brasao-direita {
    width: 27mm !important;
    height: 29mm !important;
}


.brasao-piaui-img {
    width: 24mm !important;
}


.brasao-pcpi-img {
    width: 23mm !important;
}


/* CELULAR */

@media screen and (max-width: 900px) {

    .cabecalho {
        grid-template-columns:
            56px
            minmax(0, 1fr)
            56px !important;
    }


    .brasao-esquerda,
    .brasao-direita {
        width: 52px !important;
        height: 58px !important;
    }


    .brasao-piaui-img {
        width: 48px !important;
    }


    .brasao-pcpi-img {
        width: 47px !important;
    }

}


/* PDF */

@media print {

    .cabecalho {
        grid-template-columns:
            20mm
            minmax(0, 1fr)
            20mm !important;

        min-height: 18mm !important;
    }


    .brasao-esquerda,
    .brasao-direita {
        width: 19mm !important;
        height: 19mm !important;
    }


    .brasao-piaui-img {
        width: 17mm !important;
    }


    .brasao-pcpi-img {
        width: 16.5mm !important;
    }


    .brasao-img {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

}

/* ROP_BRASOES_OFICIAIS_V2_FIM */



/* =============================================================================
   ROP - AJUSTE FINO DO BRASÃO PCPI
   Reduz tamanho e cria folga inferior.
   ============================================================================= */

.brasao-direita {
    display: flex !important;

    align-items: center !important;
    justify-content: center !important;

    overflow: visible !important;

    padding-top: 1mm !important;
    padding-bottom: 2mm !important;
}

.brasao-pcpi-img {
    width: 19.5mm !important;

    max-width: 19.5mm !important;

    height: auto !important;

    max-height: 24mm !important;

    object-fit: contain !important;

    transform: translateY(-0.5mm);
}


/* CELULAR */

@media screen and (max-width: 900px) {

    .brasao-direita {
        height: 58px !important;

        padding-top: 2px !important;
        padding-bottom: 5px !important;
    }

    .brasao-pcpi-img {
        width: 41px !important;
        max-width: 41px !important;

        max-height: 50px !important;

        transform: translateY(-1px);
    }

}


/* PDF / IMPRESSÃO */

@media print {

    .brasao-direita {
        width: 19mm !important;
        height: 19mm !important;

        padding-top: .5mm !important;
        padding-bottom: 1.5mm !important;
    }

    .brasao-pcpi-img {
        width: 14.8mm !important;

        max-width: 14.8mm !important;

        max-height: 16.5mm !important;

        transform: translateY(-0.4mm);
    }

}



/* ROP_GPS_OCORRENCIA_CSS_V1_INICIO */

/* =============================================================================
   GPS DO LOCAL DA OCORRÊNCIA
   ============================================================================= */

.endereco-gps-bloco {
    width: 100%;
    max-width: 100%;
    min-width: 0;
}


.endereco-gps-label {
    width: 100%;
    max-width: 100%;
    min-width: 0;
}


.endereco-gps-linha {
    display: grid;

    grid-template-columns:
        minmax(0, 1fr)
        27px;

    align-items: end;

    gap: 4px;

    width: 100%;
    max-width: 100%;
    min-width: 0;
}


.endereco-gps-linha input {
    width: 100%;
    max-width: 100%;
    min-width: 0;
}


.gps-mini {
    width: 27px;
    min-width: 27px;
    max-width: 27px;

    height: 27px;
    min-height: 27px;
    max-height: 27px;

    padding: 0;

    border: 1px solid #777;
    border-radius: 5px;

    background: #f4f4f4;
    color: #111;

    font-size: 18px;
    line-height: 25px;

    font-weight: 700;

    text-align: center;

    cursor: pointer;

    touch-action: manipulation;
}


.gps-mini:active {
    transform: scale(.94);
}


.gps-mini[disabled] {
    opacity: .55;
    cursor: wait;
}


.gps-status {
    min-height: 13px;

    margin-top: 2px;

    font-size: 10px;
    line-height: 1.2;

    color: #555;

    overflow-wrap: anywhere;
}


.gps-status.gps-ok {
    color: #166534;
}


.gps-status.gps-erro {
    color: #991b1b;
}


/* CELULAR */

@media screen and (max-width: 900px) {

    .endereco-gps-linha {
        grid-template-columns:
            minmax(0, 1fr)
            32px;

        gap: 5px;
    }


    .gps-mini {
        width: 32px;
        min-width: 32px;
        max-width: 32px;

        height: 32px;
        min-height: 32px;
        max-height: 32px;

        font-size: 21px;
        line-height: 30px;
    }


    .gps-status {
        font-size: 11px;
    }

}


/* PDF */

@media print {

    .endereco-gps-linha {
        display: block;
    }


    .endereco-gps-linha input {
        width: 100%;
    }


    .gps-status {
        display: none;
    }

}

/* ROP_GPS_OCORRENCIA_CSS_V1_FIM */

