/* ==========================================================================
   Página sysadmin — estilos da seção de logs do sistema
   ========================================================================== */

.logs-sistema {
    margin-top: 2rem;
}

.logs-sistema .tabela {
    margin-top: 1rem;
}

/* Linhas da tabela de logs (clique abre os detalhes) */
.logs-sistema tbody tr.log-linha {
    transition: background-color 0.15s ease;
}

.logs-sistema tbody tr.log-linha:hover {
    background-color: color-mix(in srgb, var(--color-link, #a31f38) 8%, transparent);
}

.logs-sistema td.log-sucesso {
    color: var(--color-differentiate, #147b79);
    font-weight: 600;
}

.logs-sistema td.log-erro {
    color: #b91c1c;
    font-weight: 600;
}

/* Paginação dos logs */
.logs-paginacao {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-top: 1rem;
    flex-wrap: wrap;
}

.logs-paginacao span {
    font-size: 0.85rem;
    opacity: 0.8;
}

/* Caixa de diálogo de detalhes do log */
dialog.log-detalhe-dialog[open] {
    max-width: none;
    width: min(96vw, 64rem);
    max-height: 90vh;
    display: flex;
    flex-direction: column;
}

dialog.log-detalhe-dialog .log-detalhe-corpo {
    overflow-y: auto;
    flex: 1 1 auto;
    min-height: 0;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem 1.25rem;
    align-content: start;
    padding-right: 0.25rem;
}

dialog.log-detalhe-dialog .log-detalhe-carregando,
dialog.log-detalhe-dialog .log-detalhe-erro {
    grid-column: 1 / -1;
    opacity: 0.8;
}

dialog.log-detalhe-dialog .log-detalhe-erro {
    color: #b91c1c;
    opacity: 1;
}

/* Campo simples (rótulo/valor) */
dialog.log-detalhe-dialog .log-campo {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    border: 1px solid color-mix(in srgb, var(--text-color, #111) 12%, transparent);
    border-radius: 0.4rem;
    padding: 0.5rem 0.65rem;
}

dialog.log-detalhe-dialog .log-campo-rotulo {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    opacity: 0.6;
}

dialog.log-detalhe-dialog .log-campo-valor {
    font-size: 0.88rem;
    word-break: break-word;
}

/* Blocos JSON (param, body, options, result) */
dialog.log-detalhe-dialog .log-bloco {
    grid-column: 1 / -1;
    border: 1px solid color-mix(in srgb, var(--text-color, #111) 15%, transparent);
    border-radius: 0.4rem;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

dialog.log-detalhe-dialog .log-bloco-cabecalho {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.4rem 0.65rem;
    background-color: color-mix(in srgb, var(--color-link, #a31f38) 8%, transparent);
}

dialog.log-detalhe-dialog .log-bloco-cabecalho strong {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

dialog.log-detalhe-dialog .log-bloco-cabecalho button {
    padding: 0.15rem 0.7rem;
    font-size: 0.75rem;
    min-height: 0;
}

dialog.log-detalhe-dialog .log-bloco pre {
    margin: 0;
    padding: 0.65rem;
    background-color: #111;
    color: #eee;
    font-size: 0.78rem;
    line-height: 1.45;
    white-space: pre-wrap;
    word-break: break-word;
    overflow-x: auto;
    max-height: 24rem;
    overflow-y: auto;
    border-radius: 0;
}

@media (max-width: 640px) {
    dialog.log-detalhe-dialog .log-detalhe-corpo {
        grid-template-columns: 1fr;
    }
}

/* ==========================================================================
   Página sysadmin — estilos da seção de migrations
   ========================================================================== */

.migrations {
    margin-top: 2rem;
}

.migrations .migrations-resumo {
    margin: 0.75rem 0 0;
    font-size: 0.85rem;
    opacity: 0.8;
}

.migrations .tabela {
    margin-top: 1rem;
}

/* o nome do arquivo é longo: reduz a fonte e evita quebra de linha */
.migrations .tabela td:first-child code {
    font-size: 0.8rem;
    white-space: nowrap;
}

.migrations .tabela th:nth-child(2),
.migrations .tabela td:nth-child(2),
.migrations .tabela th:last-child,
.migrations .tabela td:last-child {
    white-space: nowrap;
}

.migrations .tabela td.migration-status-aplicada {
    color: var(--color-differentiate, #147b79);
    font-weight: 600;
}

.migrations .tabela td.migration-status-pendente {
    color: #b91c1c;
    font-weight: 600;
}
