/* Anexo Viewer (Anexo-viewer.js) */

.av-visualizador {
    position: fixed;
    inset: 0;
    z-index: 2050;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

    .av-visualizador :is(button, a, strong, span) {
        font-family: inherit;
    }

.av-fundo {
    position: absolute;
    inset: 0;
    background: rgba(16, 24, 40, .55);
    opacity: 0;
    transition: opacity .25s ease;
}

.av-caixa {
    position: relative;
    display: flex;
    flex-direction: column;
    width: min(1100px, 100%);
    height: min(88vh, 100%);
    overflow: hidden;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 24px 64px rgba(16, 24, 40, .28);
    opacity: 0;
    transform: translateY(14px) scale(.985);
    transition: opacity .3s ease, transform .45s cubic-bezier(.16, 1, .3, 1);
}

.av-visualizador.aberto .av-fundo {
    opacity: 1;
}

.av-visualizador.aberto .av-caixa {
    opacity: 1;
    transform: none;
}

.av-topo {
    display: flex;
    align-items: center;
    flex-shrink: 0;
    gap: 12px;
    padding: 10px 12px 10px 18px;
    border-bottom: 1px solid #eaecf0;
}

.av-icone {
    font-size: 24px;
    line-height: 1;
    color: #667085;
}

    .av-icone.mdi-file-pdf-box {
        color: #b42318;
    }

    .av-icone.mdi-file-word-outline {
        color: #185FA5;
    }

    .av-icone.mdi-file-excel-outline {
        color: #067647;
    }

.av-titulos {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 1px;
}

    .av-titulos strong {
        overflow: hidden;
        font-size: 14px;
        font-weight: 600;
        color: #101828;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .av-titulos span {
        overflow: hidden;
        font-size: 12px;
        color: #667085;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .av-titulos .av-detalhe {
        font-size: 11.5px;
        color: #98a2b3;
    }

.av-acoes {
    display: flex;
    align-items: center;
    flex-shrink: 0;
    gap: 2px;
}

/* Navegação (anexos ← → e, no modo por grupos, registros ↑ ↓) botões e posição agrupados */
.av-nav {
    display: inline-flex;
    align-items: center;
    gap: 0;
    margin-right: 4px;
    padding: 1px 2px;
    border: 1px solid #eaecf0;
    border-radius: 8px;
}

    .av-nav .av-btn {
        width: 28px;
        height: 28px;
    }

.av-pos {
    padding: 0 4px;
    text-align: center;
    font-size: 12px;
    color: #667085;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.av-extras {
    display: inline-flex;
    align-items: center;
    gap: 2px;
}

    .av-extras:empty {
        display: none;
    }

.av-btn.av-btn-reservado {
    visibility: hidden;
    pointer-events: none;
}

.av-div {
    width: 1px;
    height: 20px;
    margin: 0 6px;
    background: #e4e7ec;
}

/* Botões de ícone (equivalente ao rp-icon-btn, próprio do componente) */
.av-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: #667085;
    font-size: 18px;
    line-height: 1;
    text-decoration: none;
    cursor: pointer;
}

    .av-btn:hover {
        background: #f2f4f7;
        color: #1d2939;
    }

    .av-btn:focus-visible {
        outline: 2px solid #185FA5;
        outline-offset: 1px;
    }

    .av-btn[aria-disabled="true"],
    .av-btn:disabled {
        color: #c4cad3;
        background: transparent;
        pointer-events: none;
        cursor: default;
    }

/* Meio: conteúdo + painel lateral (modo por grupos) */
.av-meio {
    flex: 1;
    min-height: 0;
    display: flex;
}

.av-corpo {
    flex: 1;
    min-width: 0;
    min-height: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f5f7fa;
}

    .av-corpo iframe {
        width: 100%;
        height: 100%;
        border: 0;
        background: #fff;
    }

    .av-corpo img {
        max-width: 100%;
        max-height: 100%;
        padding: 20px;
        box-sizing: border-box;
        object-fit: contain;
    }

.av-sem {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 24px;
    text-align: center;
}

    .av-sem > i {
        margin-bottom: 8px;
        font-size: 76px;
        line-height: 1;
        color: #d0d5dd;
    }

    .av-sem strong {
        font-size: 14px;
        font-weight: 600;
        color: #344054;
    }

    .av-sem span {
        margin-bottom: 12px;
        font-size: 12.5px;
        color: #667085;
    }

    .av-sem a {
        display: inline-flex;
        align-items: center;
        gap: 6px;
        padding: 4px 8px;
        border-radius: 6px;
        color: #185FA5;
        font-size: 13px;
        font-weight: 600;
        text-decoration: none;
    }

        .av-sem a:hover {
            background: #eaf2fb;
        }

        .av-sem a:focus-visible {
            outline: 2px solid #185FA5;
            outline-offset: 2px;
        }

        .av-sem a i {
            font-size: 18px;
            line-height: 1;
        }

/* painel lateral  */
.av-visualizador.com-painel .av-caixa {
    width: min(1340px, 100%);
}

.av-painel {
    display: none;
    flex-direction: column;
    flex-shrink: 0;
    width: 290px;
    min-height: 0;
    border-left: 1px solid #eaecf0;
    background: #fff;
}

.av-visualizador.com-painel .av-painel {
    display: flex;
}

.av-visualizador.com-painel.painel-recolhido .av-painel {
    display: none;
}

.av-painel-toggle[aria-pressed="true"] {
    color: #185FA5;
    background: #eaf2fb;
}

.av-painel-cab {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    flex-shrink: 0;
    padding: 12px 16px 8px;
    border-bottom: 1px solid #f2f4f7;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .4px;
    text-transform: uppercase;
    color: #667085;
}

.av-painel-corpo {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 12px 16px;
    display: flex;
    flex-direction: column;
    gap: 11px;
    font-size: 12.5px;
    color: #1d2939;
}

.av-painel-rodape {
    flex-shrink: 0;
    display: flex;
    gap: 6px;
    padding: 10px 14px;
    border-top: 1px solid #f2f4f7;
}

.av-painel-acao {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    height: 30px;
    padding: 0 8px;
    border: 1px solid #d0d5dd;
    border-radius: 6px;
    background: #fff;
    color: #344054;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
}

    .av-painel-acao:hover {
        background: #f9fafb;
    }

    .av-painel-acao:focus-visible {
        outline: 2px solid #185FA5;
        outline-offset: 1px;
    }

    .av-painel-acao i {
        font-size: 15px;
        line-height: 1;
    }

.av-painel-cab-extra {
    text-transform: none;
    letter-spacing: normal;
}

.av-p-campo span {
    display: block;
    margin-bottom: 1px;
    font-size: 10.5px;
    color: #98a2b3;
}

.av-p-campo strong {
    display: block;
    font-weight: 500;
    color: #1d2939;
    font-variant-numeric: tabular-nums;
    overflow-wrap: anywhere;
}

.av-p-linha {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.av-p-valores {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 3px 8px;
    padding: 8px 10px;
    border-radius: 6px;
    background: #f8fafc;
    font-variant-numeric: tabular-nums;
}

    .av-p-valores span {
        color: #667085;
    }

    .av-p-valores b {
        font-weight: 500;
        text-align: right;
    }

    .av-p-valores .av-p-neg {
        color: #b42318;
    }

    .av-p-valores .av-p-total {
        padding-top: 4px;
        border-top: 1px solid #e4e7ec;
        font-weight: 600;
        color: #0d47a1;
    }

.av-p-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    width: fit-content;
    padding: 0 7px;
    border-radius: 10px;
    background: #EEEDFE;
    color: #534AB7;
    font-size: 10.5px;
    font-weight: 600;
    line-height: 18px;
}

    .av-p-chip.azul {
        background: #e6f1fb;
        color: #1976d2;
    }

.av-p-nota {
    padding: 8px 10px;
    border-left: 2px solid #e4e7ec;
    color: #475467;
    white-space: pre-line;
}

/* Telas pequenas o PDF fica com a largura toda */
@media (max-width: 900px) {
    .av-visualizador.com-painel .av-painel,
    .av-painel-toggle {
        display: none !important;
    }
}

/* Visualizador de PDF próprio (pdf-viewer.js) ocupa o corpo inteiro */
.av-pdf-host {
    align-self: stretch;
    flex: 1;
    min-width: 0;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

    .av-pdf-host > .pv-raiz {
        align-self: stretch;
    }

/* Carregando os anexos de um registro (modo por grupos) */
.av-carregando {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    color: #667085;
}

.av-spinner {
    width: 18px;
    height: 18px;
    border: 2px solid #d0d5dd;
    border-top-color: #185FA5;
    border-radius: 50%;
    animation: av-girar .8s linear infinite;
}

@keyframes av-girar {
    to {
        transform: rotate(360deg);
    }
}

@media (prefers-reduced-motion: reduce) {
    .av-spinner {
        animation-duration: 2s;
    }

    .av-fundo,
    .av-caixa {
        transition: none !important;
    }
}
