/* Estilos de domínio extraídos da camada legada. */

/* A trilha possui campos naturalmente longos (rotas, caminhos e mensagens).
   Mantemos uma largura mínima para evitar que o algoritmo da tabela reduza
   Origem e Mensagem a colunas estreitas e quebre o conteúdo por caractere. */
.admin-audit-log-viewport {
    scrollbar-width: thin;
}

.admin-audit-log-table {
    width: 100%;
    min-width: 141rem;
    table-layout: fixed;
}

.admin-audit-log-table .audit-log-col-date { width: 10rem; }
.admin-audit-log-table .audit-log-col-level { width: 7rem; }
.admin-audit-log-table .audit-log-col-action { width: 18rem; }
.admin-audit-log-table .audit-log-col-actor { width: 12rem; }
.admin-audit-log-table .audit-log-col-target { width: 11rem; }
.admin-audit-log-table .audit-log-col-status { width: 8rem; }
.admin-audit-log-table .audit-log-col-origin { width: 23rem; }
.admin-audit-log-table .audit-log-col-message { width: 29rem; }
.admin-audit-log-table .audit-log-col-details { width: 24rem; }

.admin-audit-log-table .audit-log-cell,
.admin-audit-log-table .audit-log-origin-text,
.admin-audit-log-table .audit-log-message-text,
.admin-audit-log-table .audit-log-details-text {
    overflow-wrap: break-word;
    word-break: normal;
    white-space: normal;
    vertical-align: top;
}

.admin-audit-log-table .audit-log-nowrap {
    display: block;
    min-width: 0;
    overflow: hidden;
    overflow-wrap: normal;
    text-overflow: ellipsis;
    white-space: nowrap;
    word-break: normal;
}

html[data-theme="light"] .admin-whatsapp-hero {
    border-color: rgba(16, 185, 129, 0.18) !important;
    background:
        radial-gradient(circle at top left, rgba(16, 185, 129, 0.2), transparent 34%),
        linear-gradient(135deg, rgba(12, 24, 39, 0.97), rgba(30, 41, 59, 0.94)) !important;
    box-shadow:
        0 24px 50px rgba(15, 23, 42, 0.16),
        0 10px 24px rgba(15, 23, 42, 0.12);
}

html[data-theme="light"] .admin-whatsapp-hero .text-white {
    color: #f8fbff !important;
}

html[data-theme="light"] .admin-whatsapp-hero h2 {
    color: #f8fbff !important;
}

html[data-theme="light"] .admin-whatsapp-hero .text-slate-300 {
    color: rgba(216, 228, 240, 0.9) !important;
}

html[data-theme="light"] .admin-whatsapp-hero .text-slate-400 {
    color: rgba(177, 193, 212, 0.82) !important;
}

html[data-theme="light"] .admin-whatsapp-hero .text-emerald-200\/80 {
    color: #8ce7c4 !important;
}

html[data-theme="light"] .admin-whatsapp-hero .rounded-2xl.bg-white\/\[0\.05\] {
    background: rgba(255, 255, 255, 0.06) !important;
    border-color: rgba(255, 255, 255, 0.08) !important;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

/* Painel administrativo: mesma navegação horizontal leve do Emissor. */
.portal-admin-main #page-content > .admin-shell {
    /* Em telas largas, use toda a área útil do main e mantenha apenas o
       espaçamento lateral definido pelo layout global. */
    width: 100%;
    max-width: none;
    margin-inline: 0;
}

.admin-shell .admin-section-toolbar {
    display: flex;
    min-width: 0;
    align-items: stretch;
    gap: 0.75rem;
}

.admin-shell .admin-section-nav {
    flex: 1 1 auto;
    min-width: 0;
    gap: 0.45rem;
    padding: 0.3rem;
    overflow-x: auto;
    border: 1px solid rgba(148, 163, 184, 0.14);
    border-radius: 1rem;
    background: rgba(10, 18, 32, 0.54);
    scrollbar-width: thin;
}

.admin-shell .admin-section-link {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    gap: 0.55rem;
    white-space: nowrap;
    border-color: transparent !important;
    border-radius: 0.7rem !important;
    background: transparent !important;
    color: #9caabd !important;
    transition: background 180ms ease, border-color 180ms ease, color 180ms ease, transform 180ms ease;
}

.admin-shell .admin-section-link i { font-size: 1rem; }

.admin-shell .admin-section-actions {
    display: flex;
    flex: 0 0 auto;
}

.admin-shell .admin-section-actions:empty { display: none; }

.admin-shell .admin-section-link:hover {
    border-color: rgba(148, 163, 184, 0.16) !important;
    background: rgba(255, 255, 255, 0.045) !important;
    color: #e5edf5 !important;
    transform: translateY(-1px);
}

.admin-shell .admin-section-link.is-active {
    border-color: rgba(20, 184, 166, 0.38) !important;
    background: #117f79 !important;
    color: #f3fffd !important;
    box-shadow: 0 0.35rem 1rem rgba(20, 184, 166, 0.12);
}

html[data-theme="light"] .admin-shell .admin-section-nav { border-color: rgba(105, 133, 164, 0.16); background: rgba(231, 238, 245, 0.72); }
html[data-theme="light"] .admin-shell .admin-section-link { color: #5b6b80 !important; }
html[data-theme="light"] .admin-shell .admin-section-link:hover { border-color: rgba(20, 184, 166, 0.2) !important; background: rgba(20, 184, 166, 0.08) !important; color: #126e6c !important; }
html[data-theme="light"] .admin-shell .admin-section-link.is-active { background: #117f79 !important; color: #ffffff !important; }

@media (max-width: 767px) {
    .admin-shell .admin-section-toolbar { flex-direction: column; gap: 0.65rem; }
    .admin-shell .admin-section-nav {
        width: 100%;
        margin-inline: 0;
        padding: 0.25rem;
        scroll-snap-type: x proximity;
    }
    .admin-shell .admin-section-link { min-height: 3rem; scroll-snap-align: start; }
    .admin-shell .admin-section-actions > * { width: 100%; justify-content: center; }
}

/* Superfícies e navegação específicas da Administração. */
/* Camada visual compartilhada das áreas internas. */
.portal-admin-main { padding-top: clamp(1.25rem, 4vh, 3rem); }

.admin-shell-card {
    position: relative;
    background: var(--portal-card) !important;
    box-shadow: var(--portal-shadow) !important;
}

.admin-shell-card::before { display: none; }

.admin-section-icon {
    background: rgba(22, 174, 160, 0.13) !important;
    color: #53ded0 !important;
}

.admin-shell-card h1,
.portal-module-hero h1,
.portal-responsive-main-card h2 {
    letter-spacing: -0.035em;
}

.admin-metric-card {
    border-color: rgba(111, 137, 167, 0.2) !important;
    background: rgba(5, 18, 32, 0.58) !important;
    box-shadow: inset 0 1px rgba(255, 255, 255, 0.03);
}

.admin-metric-card:hover {
    border-color: rgba(83, 222, 208, 0.28) !important;
}

.admin-section-link {
    border-color: rgba(111, 137, 167, 0.22) !important;
    background: rgba(5, 18, 32, 0.55) !important;
    color: #b7c6d7 !important;
}

.admin-section-link:hover {
    border-color: rgba(83, 222, 208, 0.35) !important;
    background: rgba(83, 222, 208, 0.08) !important;
    color: #f3fffd !important;
}

.admin-section-link.is-active {
    border-color: rgba(83, 222, 208, 0.5) !important;
    background: linear-gradient(135deg, #0f9f91, #0b7e7b) !important;
    color: #f4fffd !important;
    box-shadow: 0 0.65rem 1.5rem rgba(7, 126, 123, 0.18);
}

.portal-auth-card {
    border-color: rgba(111, 137, 167, 0.2);
    box-shadow: 0 1.25rem 3rem rgba(2, 8, 23, 0.16), inset 0 1px rgba(255, 255, 255, 0.025);
}

html[data-theme="light"] .admin-metric-card,
html[data-theme="light"] .admin-section-link {
    border-color: rgba(105, 133, 164, 0.2) !important;
    background: rgba(238, 244, 249, 0.8) !important;
    color: #405067 !important;
}

html[data-theme="light"] .admin-section-link:hover {
    background: rgba(15, 159, 145, 0.08) !important;
    color: #126e6c !important;
}

html[data-theme="light"] .admin-section-link.is-active {
    background: linear-gradient(135deg, #0f9f91, #0b7e7b) !important;
    color: #ffffff !important;
}

@media (max-width: 767px) {
    .portal-admin-main { padding-top: 0.25rem !important; }
    .admin-shell-card { padding: 1.15rem !important; border-radius: 1.35rem !important; }
    .admin-metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .admin-section-nav { gap: 0.55rem; }
    .admin-section-link { padding: 0.7rem 0.85rem !important; font-size: 0.8rem !important; }
}
