/* ===================================
   Intranet - Estilos
   Os tons da marca vêm da cor principal definida em Painel > Aparência
   (Theme::cssVariables); os valores abaixo são o padrão.
   =================================== */

:root {
    --brand: #005eb8;
    --brand-dark: #004b93;
    --brand-darker: #003a72;
    --brand-light: #e6eff8;
    --brand-lighter: #f5f9fc;
    --brand-border: #b3cfea;
    --brand-focus: #80afdc;
    --brand-rgb: 0, 94, 184;
    --brand-dark-rgb: 0, 75, 147;

    --page-bg: #f4f6f9;
    --surface: #ffffff;
    --border: #e4e8ee;
    --border-strong: #d3d9e2;
    --text: #1f2937;
    --text-muted: #6b7280;
    --text-soft: #8a94a3;

    --sidebar-width: 264px;
    --radius: 12px;
    --radius-sm: 8px;
    --shadow-xs: 0 1px 2px rgba(16, 24, 40, 0.05);
    --shadow-sm: 0 1px 3px rgba(16, 24, 40, 0.07), 0 1px 2px rgba(16, 24, 40, 0.04);
    --shadow-md: 0 8px 20px rgba(16, 24, 40, 0.08);
    --ease: cubic-bezier(0.2, 0.7, 0.2, 1);

    /* Bootstrap com a cor da marca */
    --bs-primary: var(--brand);
    --bs-primary-rgb: var(--brand-rgb);
    --bs-primary-text-emphasis: var(--brand-darker);
    --bs-primary-bg-subtle: var(--brand-light);
    --bs-primary-border-subtle: var(--brand-border);
    --bs-link-color: var(--brand);
    --bs-link-color-rgb: var(--brand-rgb);
    --bs-link-hover-color: var(--brand-dark);
    --bs-link-hover-color-rgb: var(--brand-dark-rgb);
    --bs-body-color: #1f2937;
    --bs-body-font-size: 0.9375rem;
    --bs-border-color: #e4e8ee;
    --bs-focus-ring-color: rgba(var(--brand-rgb), 0.25);
}

body {
    background: var(--page-bg);
    color: var(--text);
    -webkit-font-smoothing: antialiased;
}

a {
    transition: color 0.15s ease;
}

.min-w-0 {
    min-width: 0;
}

.text-soft {
    color: var(--text-soft) !important;
}

.skip-link {
    position: absolute;
    left: 12px;
    top: -60px;
    z-index: 2000;
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    background: var(--brand);
    color: #ffffff;
    text-decoration: none;
    transition: top 0.15s ease;
}

.skip-link:focus {
    top: 12px;
    color: #ffffff;
}

/* ===================================
   Animações
   =================================== */
@keyframes fade-up {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: none; }
}

@keyframes fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes pop-in {
    from { opacity: 0; transform: scale(0.96); }
    to { opacity: 1; transform: none; }
}

@keyframes drop-in {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: none; }
}

.page-content > * {
    animation: fade-up 0.4s var(--ease) backwards;
}

.page-content > *:nth-child(2) { animation-delay: 0.04s; }
.page-content > *:nth-child(3) { animation-delay: 0.08s; }
.page-content > *:nth-child(n+4) { animation-delay: 0.12s; }

.dropdown-menu.show {
    animation: drop-in 0.15s var(--ease);
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-delay: 0s !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* ===================================
   Componentes do Bootstrap
   =================================== */
.btn {
    --bs-btn-font-weight: 500;
    border-radius: var(--radius-sm);
}

.btn-primary {
    --bs-btn-bg: var(--brand);
    --bs-btn-border-color: var(--brand);
    --bs-btn-hover-bg: var(--brand-dark);
    --bs-btn-hover-border-color: var(--brand-dark);
    --bs-btn-active-bg: var(--brand-darker);
    --bs-btn-active-border-color: var(--brand-darker);
    --bs-btn-disabled-bg: var(--brand);
    --bs-btn-disabled-border-color: var(--brand);
    --bs-btn-focus-shadow-rgb: var(--brand-rgb);
}

.btn-outline-primary {
    --bs-btn-color: var(--brand);
    --bs-btn-border-color: var(--brand);
    --bs-btn-hover-bg: var(--brand);
    --bs-btn-hover-border-color: var(--brand);
    --bs-btn-active-bg: var(--brand-dark);
    --bs-btn-active-border-color: var(--brand-dark);
    --bs-btn-disabled-color: var(--brand);
    --bs-btn-disabled-border-color: var(--brand);
    --bs-btn-focus-shadow-rgb: var(--brand-rgb);
}

.btn-light {
    --bs-btn-color: var(--text);
    --bs-btn-bg: #f1f4f8;
    --bs-btn-border-color: var(--border);
    --bs-btn-hover-color: var(--text);
    --bs-btn-hover-bg: #e7ecf2;
    --bs-btn-hover-border-color: var(--border-strong);
    --bs-btn-active-bg: #dfe5ed;
    --bs-btn-active-border-color: var(--border-strong);
}

.btn-group > .btn,
.btn-group > .btn-group > .btn {
    border-radius: var(--radius-sm) !important;
}

.form-label {
    font-size: 0.875rem;
    font-weight: 500;
    color: #374151;
    margin-bottom: 0.375rem;
}

.form-control,
.form-select {
    border-color: var(--border-strong);
    border-radius: var(--radius-sm);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.form-control:focus,
.form-select:focus,
.form-check-input:focus {
    border-color: var(--brand-focus);
    box-shadow: 0 0 0 0.2rem rgba(var(--brand-rgb), 0.12);
}

.form-check-input {
    border-color: #a9b4c2;
}

.form-check-input:checked {
    background-color: var(--brand);
    border-color: var(--brand);
}

.input-group-text {
    background: #f8fafc;
    border-color: var(--border-strong);
    color: var(--text-muted);
}

.input-group .btn-outline-secondary {
    --bs-btn-color: var(--text-muted);
    --bs-btn-bg: #f8fafc;
    --bs-btn-border-color: var(--border-strong);
    --bs-btn-hover-color: var(--brand);
    --bs-btn-hover-bg: #eef2f7;
    --bs-btn-hover-border-color: var(--border-strong);
    --bs-btn-active-color: var(--brand);
    --bs-btn-active-bg: #e7ecf2;
    --bs-btn-active-border-color: var(--border-strong);
}

.form-text {
    color: var(--text-muted);
    font-size: 0.8rem;
}

.pagination {
    --bs-pagination-color: var(--brand);
    --bs-pagination-hover-color: var(--brand-dark);
    --bs-pagination-focus-color: var(--brand-dark);
    --bs-pagination-focus-box-shadow: 0 0 0 0.2rem rgba(var(--brand-rgb), 0.12);
    --bs-pagination-active-bg: var(--brand);
    --bs-pagination-active-border-color: var(--brand);
    --bs-pagination-border-color: var(--border);
}

.dropdown-menu {
    --bs-dropdown-link-active-bg: var(--brand);
    --bs-dropdown-border-color: var(--border);
    --bs-dropdown-font-size: 0.9rem;
    padding: 6px;
    border-radius: 10px;
    box-shadow: var(--shadow-md);
}

.dropdown-item {
    border-radius: 6px;
    padding: 8px 12px;
}

.alert {
    border-radius: 10px;
    font-size: 0.9rem;
}

.modal-content {
    border: 0;
    border-radius: 14px;
    box-shadow: 0 24px 60px rgba(16, 24, 40, 0.2);
}

.progress {
    --bs-progress-bar-bg: var(--brand);
}

.badge-soft {
    background: var(--brand-light);
    color: var(--brand-dark);
    font-weight: 500;
}

/* ===================================
   Layout: menu lateral
   =================================== */
.app-wrapper {
    min-height: 100vh;
}

.sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 1040;
    width: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    background: linear-gradient(180deg, var(--brand) 0%, var(--brand-dark) 100%);
    color: #ffffff;
    transition: transform 0.25s var(--ease), box-shadow 0.25s ease;
}

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 22px 22px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.sidebar-brand {
    color: #ffffff;
    text-decoration: none;
}

.sidebar-brand:hover {
    color: #ffffff;
}

/* Sem logo enviada: espaço reservado "Sua logo" (cor do texto ao redor, funciona em fundo claro e escuro) */
.brand-placeholder {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    border: 1.5px dashed currentColor;
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.12em;
    line-height: 1.2;
    text-transform: uppercase;
    white-space: nowrap;
}

.brand-placeholder i {
    font-size: 1.15rem;
    letter-spacing: 0;
}

.sidebar .brand-logo {
    max-width: 170px;
    max-height: 44px;
}

.sidebar .brand-logo:not(.is-dark-version),
.portal-footer-brand .brand-logo:not(.is-dark-version) {
    filter: brightness(0) invert(1);
}

.sidebar-close-btn {
    width: 34px;
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: var(--radius-sm);
    background: transparent;
    color: #ffffff;
}

.sidebar-close-btn:hover {
    background: rgba(255, 255, 255, 0.15);
}

.sidebar-cta {
    padding: 18px 18px 6px;
}

.btn-sidebar-cta {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 14px;
    border: 0;
    background: #ffffff;
    color: var(--brand);
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(0, 30, 60, 0.18);
    transition: background-color 0.15s ease, color 0.15s ease;
}

.btn-sidebar-cta:hover,
.btn-sidebar-cta:focus-visible,
.btn-sidebar-cta.active {
    background: var(--brand-light);
    color: var(--brand-dark);
}

.sidebar-menu {
    flex: 1;
    overflow-y: auto;
    padding: 10px 0 24px;
}

.sidebar-section {
    padding: 18px 24px 6px;
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.55);
}

.sidebar-menu .nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 2px 12px;
    padding: 9px 12px;
    border-radius: var(--radius-sm);
    color: rgba(255, 255, 255, 0.82);
    font-size: 0.9rem;
    transition: background-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.sidebar-menu .nav-link i {
    width: 20px;
    font-size: 1.05rem;
    text-align: center;
}

.sidebar-menu .nav-link:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #ffffff;
}

.sidebar-menu .nav-link.active {
    background: rgba(255, 255, 255, 0.16);
    color: #ffffff;
    font-weight: 500;
    box-shadow: inset 3px 0 0 #ffffff;
}

.nav-badge {
    margin-left: auto;
    min-width: 22px;
    padding: 2px 7px;
    border-radius: 999px;
    background: #ffffff;
    color: var(--brand);
    font-size: 0.72rem;
    font-weight: 700;
    text-align: center;
}

.sidebar-menu::-webkit-scrollbar {
    width: 5px;
}

.sidebar-menu::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 3px;
}

.sidebar-backdrop {
    display: none;
}

/* ===================================
   Layout: área principal e barra superior
   =================================== */
.main-content {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.top-navbar {
    position: sticky;
    top: 0;
    z-index: 1020;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    min-height: 68px;
    padding: 12px 32px;
    background: rgba(255, 255, 255, 0.94);
    border-bottom: 1px solid var(--border);
    backdrop-filter: saturate(180%) blur(8px);
}

.top-navbar-title {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.page-title {
    margin: 0;
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.page-subtitle {
    margin: 2px 0 0;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.top-navbar-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.btn-icon {
    position: relative;
    width: 40px;
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: #4b5563;
    font-size: 1.2rem;
    text-decoration: none;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.btn-icon:hover,
.btn-icon[aria-expanded="true"] {
    background: #eef2f7;
    color: var(--brand);
}

.btn-icon-sm {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    font-size: 1rem;
}

.notification-count {
    position: absolute;
    top: 4px;
    right: 2px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 999px;
    background: #d92d20;
    color: #ffffff;
    font-size: 0.65rem;
    font-weight: 700;
    line-height: 18px;
    text-align: center;
    box-shadow: 0 0 0 2px #ffffff;
}

.notification-menu {
    width: 340px;
    max-width: calc(100vw - 24px);
    padding: 0;
    overflow: hidden;
}

.notification-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    font-size: 0.875rem;
    font-weight: 600;
}

.notification-item {
    display: block;
    padding: 10px 16px;
    border-bottom: 1px solid var(--border);
    color: var(--text);
    text-decoration: none;
    transition: background-color 0.15s ease;
}

.notification-item:hover {
    background: var(--brand-lighter);
    color: var(--text);
}

.notification-subject {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.notification-meta {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.notification-empty {
    padding: 24px 16px;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.85rem;
}

.notification-empty i {
    display: block;
    margin-bottom: 6px;
    font-size: 1.5rem;
    color: var(--brand-border);
}

.notification-footer {
    display: block;
    padding: 10px 16px;
    background: #f8fafc;
    font-size: 0.82rem;
    font-weight: 500;
    text-align: center;
    text-decoration: none;
}

.user-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 4px 10px 4px 4px;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: var(--text);
    transition: background-color 0.15s ease;
}

.user-toggle:hover,
.user-toggle[aria-expanded="true"] {
    background: #eef2f7;
}

.user-toggle .bi-chevron-down {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.user-meta {
    flex-direction: column;
    align-items: flex-start;
    line-height: 1.25;
    text-align: left;
}

.user-meta strong {
    font-size: 0.875rem;
    font-weight: 600;
}

.user-meta small {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.avatar {
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    border-radius: 50%;
    background: var(--brand);
    color: #ffffff;
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.avatar-sm {
    width: 32px;
    height: 32px;
    font-size: 0.72rem;
}

.avatar-lg {
    width: 64px;
    height: 64px;
    font-size: 1.25rem;
}

.avatar-soft {
    background: var(--brand-light);
    color: var(--brand);
}

.page-content {
    flex: 1;
    padding: 28px 32px 32px;
}

.app-footer {
    padding: 8px 32px 24px;
    font-size: 0.78rem;
    color: var(--text-soft);
}

/* ===================================
   Cards e blocos
   =================================== */
.dashboard-card {
    margin-bottom: 24px;
    padding: 24px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-xs);
}

.dashboard-card.card-flush {
    padding: 0;
    overflow: hidden;
}

.card-header-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
}

.card-flush > .card-header-bar {
    margin: 0;
    padding: 18px 24px;
    border-bottom: 1px solid var(--border);
}

.card-title {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
}

.card-title i {
    color: var(--brand);
}

.card-link {
    font-size: 0.85rem;
    font-weight: 500;
    text-decoration: none;
}

.section-title {
    margin: 0 0 4px;
    font-size: 0.95rem;
    font-weight: 600;
}

.section-text {
    margin: 0 0 16px;
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* Boas-vindas */
.welcome-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 20px;
}

.welcome-title {
    margin: 0 0 4px;
    font-size: 1.35rem;
    font-weight: 600;
}

.welcome-text {
    margin: 0;
    color: var(--text-muted);
}

/* Indicadores */
.stat-card {
    height: 100%;
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-xs);
    color: inherit;
    text-decoration: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

a.stat-card:hover {
    border-color: var(--brand-border);
    box-shadow: var(--shadow-md);
    color: inherit;
}

.stat-icon {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    border-radius: 12px;
    font-size: 1.35rem;
}

.stat-icon.blue { background: var(--brand-light); color: var(--brand); }
.stat-icon.orange { background: #fff4e5; color: #c2620a; }
.stat-icon.green { background: #e8f5ee; color: #1f7a4d; }
.stat-icon.gray { background: #eef1f5; color: #4b5563; }

.stat-number {
    font-size: 1.6rem;
    font-weight: 700;
    line-height: 1.1;
}

.stat-label {
    font-size: 0.82rem;
    color: var(--text-muted);
}

/* Estado vazio */
.empty-state {
    padding: 56px 24px;
    text-align: center;
    color: var(--text-muted);
}

.empty-state i {
    display: block;
    margin-bottom: 12px;
    font-size: 2.4rem;
    color: #b8c4d4;
}

.empty-state h3 {
    margin-bottom: 4px;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text);
}

.empty-state p {
    margin: 0;
    font-size: 0.875rem;
}

.empty-state-sm {
    padding: 32px 16px;
}

.empty-state-sm i {
    font-size: 1.8rem;
}

/* Barra de filtros acima das listas */
.list-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    padding: 14px 24px;
    border-bottom: 1px solid var(--border);
}

.filter-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.filter-tab {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 12px;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-size: 0.875rem;
    font-weight: 500;
    text-decoration: none;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.filter-tab:hover {
    background: #f1f4f8;
    color: var(--text);
}

.filter-tab.active {
    background: var(--brand-light);
    color: var(--brand);
}

.filter-tab .count {
    padding: 1px 7px;
    border-radius: 999px;
    background: #e4e8ee;
    color: #4b5563;
    font-size: 0.72rem;
    font-weight: 600;
}

.filter-tab.active .count {
    background: var(--brand);
    color: #ffffff;
}

.search-form {
    display: flex;
    gap: 8px;
}

.search-form .form-control {
    min-width: 240px;
}

.search-form .btn {
    flex-shrink: 0;
    white-space: nowrap;
}

.pagination-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    padding: 14px 24px;
    border-top: 1px solid var(--border);
}

/* ===================================
   Lista de envios (caixa de entrada e enviados)
   =================================== */
.message-list {
    margin: 0;
    padding: 0;
    list-style: none;
}

.message-item {
    position: relative;
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 16px 24px;
    border-top: 1px solid var(--border);
    transition: background-color 0.15s ease;
}

.message-item:first-child {
    border-top: 0;
}

.message-item:hover {
    background: #f8fafd;
}

.message-item.is-unread {
    background: var(--brand-lighter);
}

.message-item.is-unread::before {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    width: 3px;
    background: var(--brand);
}

.message-main {
    flex: 1;
    min-width: 0;
}

.message-top {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
}

.message-sender {
    font-size: 0.85rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.message-sender strong {
    color: var(--text);
    font-weight: 500;
}

.message-date {
    flex-shrink: 0;
    font-size: 0.78rem;
    color: var(--text-soft);
    white-space: nowrap;
}

.message-subject {
    display: block;
    margin-top: 2px;
    color: var(--text);
    font-weight: 500;
    text-decoration: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.message-subject:hover {
    color: var(--brand);
}

/* O link do assunto cobre o item inteiro */
.message-subject::after {
    content: "";
    position: absolute;
    inset: 0;
}

.is-unread .message-subject {
    font-weight: 700;
}

.message-excerpt {
    margin-top: 2px;
    font-size: 0.85rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.message-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}

.message-tags:empty {
    display: none;
}

.message-icon {
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    border-radius: 50%;
    background: #eef2f7;
    color: var(--brand);
}

.message-progress-group {
    width: 180px;
    flex-shrink: 0;
}

.message-progress {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.message-progress + .message-progress {
    margin-top: 8px;
}

.tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 6px;
    background: #eef1f5;
    color: #4b5563;
    font-size: 0.72rem;
    font-weight: 500;
    white-space: nowrap;
}

.tag-urgente { background: #fdecec; color: #b42318; }
.tag-importante { background: #fff4e5; color: #b54708; }
.tag-ack-pending { background: #fff4e5; color: #b54708; }
.tag-ack-done { background: #e8f5ee; color: #1f7a4d; }

.progress-thin {
    height: 6px;
    margin-top: 4px;
    border-radius: 999px;
    background: #eef1f5;
}

.progress-thin .progress-bar {
    border-radius: 999px;
    background: var(--brand);
    transition: width 0.6s var(--ease);
}

.progress-thin .progress-bar.bg-ack {
    background: #1f7a4d;
}

/* ===================================
   Leitura de um envio
   =================================== */
.message-view-header {
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border);
}

.message-view-subject {
    margin: 0 0 14px;
    font-size: 1.35rem;
    font-weight: 600;
    line-height: 1.3;
    word-wrap: break-word;
}

.message-meta {
    display: flex;
    align-items: center;
    gap: 12px;
}

.message-meta-name {
    font-weight: 600;
}

.message-meta-detail {
    font-size: 0.82rem;
    color: var(--text-muted);
}

.recipients-line {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    margin-top: 14px;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 10px;
    border-radius: 999px;
    background: #eef2f7;
    color: #374151;
    font-size: 0.8rem;
}

.chip i {
    color: var(--text-muted);
}

.message-body {
    font-size: 0.95rem;
    line-height: 1.7;
    word-wrap: break-word;
}

.message-body-empty {
    color: var(--text-soft);
    font-style: italic;
}

.reply-reference {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 16px;
    padding: 10px 14px;
    border-left: 3px solid var(--border-strong);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    background: #f8fafc;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.ack-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px 16px;
    margin-bottom: 20px;
    padding: 14px 16px;
    border: 1px solid #f5d9a8;
    border-radius: 10px;
    background: #fffaf0;
    font-size: 0.9rem;
}

.ack-banner.is-done {
    border-color: #bfe3cf;
    background: #f1faf5;
}

.ack-banner i {
    font-size: 1.2rem;
}

.ack-banner-text {
    flex: 1 1 280px;
    min-width: 0;
}

.attachments-section {
    margin-top: 28px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
}

.attachment-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 12px;
}

.attachment-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--surface);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.attachment-card:hover {
    border-color: var(--brand-border);
    box-shadow: var(--shadow-sm);
}

.attachment-info {
    flex: 1;
    min-width: 0;
}

.attachment-name {
    font-size: 0.875rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.attachment-size {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.attachment-actions {
    display: flex;
    gap: 2px;
}

.file-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    border-radius: var(--radius-sm);
    font-size: 1.3rem;
}

.file-pdf { background: #fdecec; color: #c4320a; }
.file-word { background: #e8f0fc; color: #1d4ed8; }
.file-excel { background: #e8f5ee; color: #1f7a4d; }
.file-ppt { background: #fff1e8; color: #c2410c; }
.file-image { background: #f1ecfb; color: #6d28d9; }
.file-media { background: #fcebf3; color: #be185d; }
.file-archive,
.file-text,
.file-generic { background: #eef1f5; color: #4b5563; }

/* Acompanhamento (remetente) */
.tracking-summary {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}

.tracking-stat {
    flex: 1 1 0;
    min-width: 0;
    padding: 12px 8px;
    border-radius: 10px;
    background: #f6f8fb;
    text-align: center;
}

.tracking-stat strong {
    display: block;
    font-size: 1.15rem;
    line-height: 1.2;
}

.tracking-stat span {
    display: block;
    font-size: 0.72rem;
    line-height: 1.3;
    color: var(--text-muted);
}

.recipient-status-list {
    max-height: 460px;
    margin: 0;
    padding: 0;
    overflow-y: auto;
    list-style: none;
}

.recipient-status-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 0;
    border-top: 1px solid var(--border);
}

.recipient-status-name {
    font-size: 0.875rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.recipient-status-detail {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.status-icons {
    display: flex;
    gap: 8px;
    margin-left: auto;
    font-size: 1rem;
}

.status-on { color: #1f7a4d; }
.status-off { color: #c9d0da; }

.side-actions {
    display: grid;
    gap: 8px;
}

.side-actions form {
    margin: 0;
}

.side-actions .btn {
    width: 100%;
    text-align: left;
}

/* Visualização de arquivos */
.preview-frame {
    width: 100%;
    height: 75vh;
    border: 0;
    border-radius: var(--radius-sm);
    background: #f1f4f8;
}

.preview-media {
    display: block;
    max-width: 100%;
    max-height: 75vh;
    margin: 0 auto;
    border-radius: var(--radius-sm);
}

/* ===================================
   Novo envio
   =================================== */
.recipient-picker {
    position: relative;
}

.recipient-field {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    min-height: 44px;
    padding: 6px 8px;
    cursor: text;
}

.recipient-field:focus-within {
    border-color: var(--brand-focus);
    box-shadow: 0 0 0 0.2rem rgba(var(--brand-rgb), 0.12);
}

.recipient-chips {
    display: contents;
}

.recipient-field.is-invalid {
    border-color: var(--bs-form-invalid-border-color);
}

.recipient-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 4px 3px 10px;
    border-radius: 999px;
    background: var(--brand-light);
    color: var(--brand-dark);
    font-size: 0.82rem;
    font-weight: 500;
    animation: pop-in 0.18s var(--ease);
}

.recipient-chip.type-department {
    background: #eef1f5;
    color: #374151;
}

.recipient-chip.type-all {
    background: #fff4e5;
    color: #8a4b08;
}

.recipient-chip button {
    width: 20px;
    height: 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: inherit;
    font-size: 0.7rem;
    opacity: 0.7;
}

.recipient-chip button:hover {
    background: rgba(0, 0, 0, 0.07);
    opacity: 1;
}

.recipient-input {
    flex: 1;
    min-width: 180px;
    padding: 4px;
    border: 0;
    outline: 0;
    background: transparent;
}

.recipient-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    z-index: 1050;
    max-height: 320px;
    padding: 6px;
    overflow-y: auto;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: var(--shadow-md);
    animation: drop-in 0.15s var(--ease);
}

.recipient-options {
    margin: 0;
    padding: 0;
    list-style: none;
}

.recipient-group-label {
    padding: 8px 10px 4px;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-soft);
}

.recipient-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: var(--radius-sm);
    cursor: pointer;
}

.recipient-option.is-active {
    background: var(--brand-lighter);
}

.recipient-option-icon {
    width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    border-radius: 50%;
    background: #eef2f7;
    color: var(--brand);
    font-size: 0.72rem;
    font-weight: 600;
}

.recipient-option-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
}

.recipient-option-detail {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.recipient-empty {
    padding: 14px;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.85rem;
}

.recipient-summary {
    margin-top: 6px;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.dropzone {
    position: relative;
    border: 1.5px dashed var(--border-strong);
    border-radius: var(--radius);
    background: #fafbfd;
    transition: border-color 0.15s ease, background-color 0.15s ease;
}

.dropzone.is-dragover {
    border-color: var(--brand);
    background: var(--brand-light);
}

.dropzone.is-invalid {
    border-color: var(--bs-form-invalid-border-color);
}

.dropzone-input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
}

.dropzone-label {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    margin: 0;
    padding: 28px 16px;
    color: var(--text-muted);
    text-align: center;
    cursor: pointer;
}

.dropzone-label i {
    font-size: 1.9rem;
    color: var(--brand);
}

.dropzone-label strong {
    color: var(--text);
    font-weight: 600;
}

.dropzone-label small {
    font-size: 0.78rem;
}

.dropzone-input:focus-visible + .dropzone-label {
    border-radius: var(--radius);
    outline: 2px solid var(--brand);
    outline-offset: 2px;
}

.attachment-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin: 12px 0 0;
    padding: 0;
    list-style: none;
}

.attachment-list:empty {
    display: none;
}

.attachment-list li {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--surface);
    animation: fade-up 0.2s var(--ease);
}

.attachment-list li.has-error {
    border-color: #f3c5c0;
    background: #fef6f5;
}

.attachment-error {
    font-size: 0.75rem;
    color: #b42318;
}

.priority-options .btn {
    --bs-btn-color: var(--text-muted);
    --bs-btn-border-color: var(--border-strong);
    --bs-btn-hover-color: var(--text);
    --bs-btn-hover-bg: #f1f4f8;
    --bs-btn-hover-border-color: var(--border-strong);
    --bs-btn-active-color: var(--brand-dark);
    --bs-btn-active-bg: var(--brand-light);
    --bs-btn-active-border-color: var(--brand);
    font-size: 0.875rem;
}

.compose-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
}

.upload-progress {
    flex: 1;
    min-width: 200px;
    max-width: 360px;
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* ===================================
   Tabelas (administração)
   =================================== */
.table {
    --bs-table-hover-bg: #f8fafd;
    margin-bottom: 0;
}

.table > thead th {
    padding: 12px 16px;
    background: #f8fafc;
    border-bottom: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    white-space: nowrap;
}

.table > tbody td {
    padding: 12px 16px;
    border-color: var(--border);
    font-size: 0.9rem;
    vertical-align: middle;
}

.table > :not(caption) > * > *:first-child {
    padding-left: 24px;
}

.table > :not(caption) > * > *:last-child {
    padding-right: 24px;
}

.table tbody tr:last-child td {
    border-bottom: 0;
}

.cell-title {
    font-weight: 500;
}

.cell-detail {
    font-size: 0.78rem;
    color: var(--text-muted);
}

.status-dot {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.82rem;
    font-weight: 500;
}

.status-dot::before {
    content: "";
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: currentColor;
}

.status-dot.is-active { color: #1f7a4d; }
.status-dot.is-inactive { color: #9aa3af; }
.status-dot.is-scheduled { color: #b45309; }

.row-actions {
    display: inline-flex;
    gap: 2px;
}

.row-actions form {
    margin: 0;
}

.filter-card .form-label {
    font-size: 0.78rem;
    color: var(--text-muted);
}

/* Perfis: matriz de permissões */
.permission-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 12px;
}

.permission-module {
    padding: 14px 16px;
    border: 1px solid var(--border);
    border-radius: 10px;
    transition: border-color 0.15s ease, background-color 0.15s ease;
}

.permission-module.has-selection {
    border-color: var(--brand-border);
    background: var(--brand-lighter);
}

.permission-module.is-disabled {
    opacity: 0.55;
}

.permission-module-title {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
    font-weight: 600;
    font-size: 0.9rem;
}

.permission-module-title i {
    color: var(--brand);
}

.permission-actions {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.permission-all {
    padding: 14px 16px;
    border: 1px solid #f5d9a8;
    border-radius: 10px;
    background: #fffaf0;
}

/* Meu perfil */
.profile-header {
    display: flex;
    align-items: center;
    gap: 16px;
}

.profile-name {
    margin: 0;
    font-size: 1.2rem;
    font-weight: 600;
}

.info-list {
    margin: 0;
}

.info-list dt {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-muted);
}

.info-list dd {
    margin-bottom: 12px;
    font-size: 0.9rem;
}

.activity-list {
    margin: 0;
    padding: 0;
    list-style: none;
}

.activity-list li {
    display: flex;
    gap: 12px;
    padding: 10px 0;
    border-top: 1px solid var(--border);
    font-size: 0.85rem;
}

.activity-list li:first-child {
    border-top: 0;
}

.activity-list i {
    color: var(--text-muted);
}

/* ===================================
   Login, troca de senha e erros
   =================================== */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px 16px;
    background: linear-gradient(135deg, var(--brand) 0%, var(--brand-dark) 100%);
}

.login-container {
    width: 100%;
    max-width: 420px;
    animation: fade-up 0.45s var(--ease) backwards;
}

.login-container.is-wide {
    max-width: 480px;
}

.login-card {
    overflow: hidden;
    background: var(--surface);
    border-radius: 16px;
    box-shadow: 0 24px 60px rgba(0, 25, 60, 0.28);
}

.login-header {
    padding: 32px 32px 24px;
    background: var(--brand-light);
    border-bottom: 1px solid var(--brand-border);
    text-align: center;
}

.login-header .brand-placeholder {
    padding: 12px 22px;
    color: var(--brand);
    font-size: 0.9rem;
}

.login-header .brand-logo {
    max-width: 240px;
    max-height: 64px;
}

.login-header p {
    margin: 12px 0 0;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.login-body {
    padding: 28px 32px 8px;
}

.login-footer {
    padding: 12px 32px 24px;
    font-size: 0.82rem;
    color: var(--text-muted);
    text-align: center;
}

.login-copyright {
    margin-top: 20px;
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.8);
    text-align: center;
}

.btn-login {
    width: 100%;
    padding: 11px 16px;
    font-weight: 600;
}

.password-rules {
    margin: 0 0 20px;
    padding: 12px 14px 12px 32px;
    border-radius: var(--radius-sm);
    background: #f6f8fb;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.error-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px 16px;
}

.error-card {
    width: 100%;
    max-width: 460px;
    padding: 40px 32px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    box-shadow: var(--shadow-md);
    text-align: center;
    animation: fade-up 0.4s var(--ease) backwards;
}

.error-icon {
    width: 64px;
    height: 64px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
    border-radius: 50%;
    background: var(--brand-light);
    color: var(--brand);
    font-size: 1.7rem;
}

.error-code {
    display: block;
    margin-bottom: 4px;
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-soft);
}

.error-card h1 {
    margin-bottom: 8px;
    font-size: 1.35rem;
    font-weight: 600;
}

.error-card p {
    margin-bottom: 24px;
    color: var(--text-muted);
}

/* ===================================
   Site dos colaboradores (portal)
   =================================== */
body.portal {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.portal-main {
    flex: 1;
}

.portal-topbar {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
}

.portal-topbar-inner {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 24px;
    min-height: 72px;
}

.portal-brand {
    color: var(--brand);
    text-decoration: none;
}

.portal-brand:hover {
    color: var(--brand-dark);
}


.portal-brand .brand-logo {
    max-height: 44px;
    max-width: 200px;
}

.portal-search {
    position: relative;
    width: 100%;
    max-width: 480px;
    justify-self: center;
}

.portal-search > .bi-search {
    position: absolute;
    top: 50%;
    left: 14px;
    transform: translateY(-50%);
    color: var(--text-soft);
    pointer-events: none;
}

.portal-search .form-control {
    padding-left: 40px;
    border-color: transparent;
    border-radius: 999px;
    background: #f1f4f8;
}

.portal-search .form-control:focus {
    background: var(--surface);
    border-color: var(--brand-focus);
}

.portal-user {
    display: flex;
    align-items: center;
    gap: 8px;
    justify-self: end;
}

.portal-nav {
    position: sticky;
    top: 0;
    z-index: 1020;
    padding: 0;
    background: linear-gradient(90deg, var(--brand) 0%, var(--brand-dark) 100%);
    box-shadow: 0 2px 10px rgba(0, 40, 90, 0.12);
}

.portal-nav .navbar-nav .nav-link {
    position: relative;
    padding: 14px 18px;
    color: rgba(255, 255, 255, 0.85);
    font-weight: 500;
    transition: color 0.15s ease, background-color 0.15s ease;
}

.portal-nav .navbar-nav .nav-link:hover,
.portal-nav .navbar-nav .nav-link:focus-visible,
.portal-nav .navbar-nav .show > .nav-link {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.08);
}

.portal-nav .navbar-nav .nav-link.active {
    color: #ffffff;
}

.portal-nav .navbar-nav .nav-link.active::after {
    content: "";
    position: absolute;
    left: 18px;
    right: 18px;
    bottom: 0;
    height: 3px;
    border-radius: 3px 3px 0 0;
    background: #ffffff;
}

.portal-nav .navbar-toggler {
    align-items: center;
    gap: 8px;
    margin: 8px 0;
    padding: 6px 12px;
    border-color: rgba(255, 255, 255, 0.35);
    color: #ffffff;
    font-size: 0.95rem;
}

.portal-nav .navbar-toggler:focus {
    box-shadow: 0 0 0 0.2rem rgba(255, 255, 255, 0.25);
}

.nav-count {
    display: inline-block;
    min-width: 20px;
    margin-left: 6px;
    padding: 1px 6px;
    border-radius: 999px;
    background: #ffffff;
    color: var(--brand);
    font-size: 0.7rem;
    font-weight: 700;
    text-align: center;
}

.mega-menu {
    padding: 20px 0;
}

.mega-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 20px 32px;
}

.mega-title {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
    color: var(--text);
    font-weight: 600;
    text-decoration: none;
}

.mega-title i {
    color: var(--brand);
}

.mega-title:hover {
    color: var(--brand);
}

.mega-links,
.mega-links ul {
    margin: 0;
    padding: 0;
    list-style: none;
}

.mega-links a {
    display: block;
    padding: 4px 0;
    color: var(--text-muted);
    font-size: 0.875rem;
    text-decoration: none;
}

.mega-links a:hover {
    color: var(--brand);
}

.mega-links ul {
    margin: 2px 0 6px 2px;
    padding-left: 12px;
    border-left: 1px solid var(--border);
}

.mega-links ul a {
    font-size: 0.82rem;
}

.mega-empty {
    margin: 0;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.portal-search-mobile {
    max-width: none;
    margin: 4px 0 12px;
}

.portal-page-header {
    padding: 24px 0;
    background: var(--brand-light);
    border-bottom: 1px solid var(--brand-border);
}

.portal-page-header .breadcrumb {
    margin-bottom: 8px;
    font-size: 0.82rem;
}

.portal-page-header .breadcrumb a {
    text-decoration: none;
}

.portal-page-heading {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px 24px;
}

.portal-page-title {
    margin: 0;
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--brand-darker);
    word-wrap: break-word;
}

.portal-page-subtitle {
    margin: 4px 0 0;
    color: var(--text-muted);
}

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

/* Abas encostadas no conteúdo (ex.: Recebidos / Enviados) */
.portal-tabs {
    display: flex;
    gap: 4px;
    margin: 16px 0 -24px;
}

.portal-tab {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 18px;
    border-radius: 10px 10px 0 0;
    color: var(--brand-dark);
    font-weight: 500;
    text-decoration: none;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.portal-tab:hover {
    background: rgba(255, 255, 255, 0.55);
    color: var(--brand-darker);
}

.portal-tab.active {
    background: var(--page-bg);
    color: var(--text);
}

.portal-tab .count {
    padding: 1px 7px;
    border-radius: 999px;
    background: var(--brand);
    color: #ffffff;
    font-size: 0.72rem;
    font-weight: 600;
}

.portal-flash {
    padding-top: 20px;
}

.portal-flash .alert:last-child {
    margin-bottom: 0;
}

.portal-content {
    padding-top: 28px;
    padding-bottom: 40px;
}

.portal-content > * {
    animation: fade-up 0.4s var(--ease) backwards;
}

.portal-heading {
    margin: 0 0 14px;
    font-size: 1.05rem;
    font-weight: 600;
}

/* Início */
.portal-hero {
    position: relative;
    overflow: hidden;
    padding: 44px 0 52px;
    background: linear-gradient(135deg, var(--brand) 0%, var(--brand-dark) 100%);
    color: #ffffff;
}

.portal-hero::after {
    content: "";
    position: absolute;
    top: -120px;
    right: -80px;
    width: 420px;
    height: 420px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.1) 0%, rgba(255, 255, 255, 0) 70%);
    pointer-events: none;
}

.portal-hero .container {
    position: relative;
    z-index: 1;
    animation: fade-up 0.45s var(--ease) backwards;
}

.portal-hero-greeting {
    margin-bottom: 4px;
    opacity: 0.85;
}

.portal-hero-title {
    margin-bottom: 20px;
    font-size: 2rem;
    font-weight: 700;
}

.portal-hero-search {
    position: relative;
    display: flex;
    gap: 6px;
    max-width: 660px;
    padding: 6px;
    background: var(--surface);
    border-radius: 12px;
    box-shadow: 0 12px 30px rgba(0, 30, 70, 0.25);
}

.portal-hero-search > .bi-search {
    position: absolute;
    top: 50%;
    left: 20px;
    transform: translateY(-50%);
    color: var(--text-soft);
}

.portal-hero-search input {
    flex: 1;
    min-width: 0;
    padding: 10px 12px 10px 42px;
    border: 0;
    outline: 0;
    background: transparent;
    color: var(--text);
    font-size: 1rem;
}

.portal-hero-search .btn {
    padding-left: 22px;
    padding-right: 22px;
}

.section-tiles {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 14px;
}

.section-tile {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px 18px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-xs);
    color: var(--text);
    text-decoration: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.section-tile:hover {
    border-color: var(--brand-border);
    box-shadow: var(--shadow-md);
    color: var(--text);
}

.section-tile-icon {
    width: 44px;
    height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    border-radius: 12px;
    background: var(--brand-light);
    color: var(--brand);
    font-size: 1.25rem;
}

.section-tile-name {
    display: block;
    font-weight: 600;
    line-height: 1.3;
}

.section-tile-meta {
    display: block;
    margin-top: 2px;
    font-size: 0.78rem;
    color: var(--text-muted);
}

.section-tile-arrow {
    margin-left: auto;
    color: var(--text-soft);
    transition: color 0.15s ease;
}

.section-tile:hover .section-tile-arrow {
    color: var(--brand);
}

.card-footer-actions {
    padding: 14px 24px 18px;
    border-top: 1px solid var(--border);
}

/* Lista de documentos */
.document-list {
    margin: 0;
    padding: 0;
    list-style: none;
}

.document-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 24px;
    border-top: 1px solid var(--border);
    transition: background-color 0.15s ease;
}

.document-list:first-child > .document-item:first-child,
.card-header-bar + .document-list > .document-item:first-child,
.list-toolbar + .document-list > .document-item:first-child {
    border-top: 0;
}

.document-item:hover {
    background: #f8fafd;
}

.document-info {
    flex: 1;
    min-width: 0;
}

.document-title-line {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.document-title {
    overflow: hidden;
    color: var(--text);
    font-weight: 600;
    text-decoration: none;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.document-title:hover {
    color: var(--brand);
}

.document-path {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 2px;
    overflow: hidden;
    color: var(--brand);
    font-size: 0.78rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.document-meta {
    margin-top: 2px;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.document-description {
    margin-top: 4px;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.document-actions {
    display: flex;
    gap: 2px;
    flex-shrink: 0;
}

.document-group-title {
    margin: 0;
    padding: 10px 24px;
    background: #f8fafc;
    border-top: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.document-group-title + .document-list > .document-item:first-child {
    border-top: 1px solid var(--border);
}

.list-toolbar + .document-group-title {
    border-top: 0;
}

/* Busca: seções, subseções e links encontrados */
.search-group-count {
    margin-left: 6px;
    padding: 1px 7px;
    border-radius: 999px;
    background: var(--border);
    color: var(--text-muted);
    font-size: 0.7rem;
    letter-spacing: 0;
}

.search-places {
    margin: 0;
    padding: 0;
    list-style: none;
}

.search-place {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 24px;
    border-top: 1px solid var(--border);
    color: var(--text);
    text-decoration: none;
    transition: background-color 0.15s ease;
}

.search-place:hover {
    background: #f8fafd;
    color: var(--text);
}

.search-place-icon {
    width: 40px;
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    border-radius: var(--radius-sm);
    background: var(--brand-light);
    color: var(--brand);
    font-size: 1.2rem;
}

.search-place-info {
    flex: 1;
    min-width: 0;
}

.search-place-path,
.search-place-name,
.search-place-meta,
.search-place-description {
    display: block;
}

.search-place-path {
    overflow: hidden;
    color: var(--text-muted);
    font-size: 0.78rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.search-place-name {
    font-weight: 600;
}

.search-place:hover .search-place-name {
    color: var(--brand);
}

.search-place-meta {
    margin-top: 2px;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.search-place-description {
    margin-top: 4px;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.search-place-arrow {
    color: var(--text-soft);
    transition: color 0.15s ease, transform 0.15s ease;
}

.search-place:hover .search-place-arrow {
    color: var(--brand);
    transform: translateX(2px);
}

.search-places mark,
.document-list mark {
    padding: 0 1px;
    border-radius: 3px;
    background: rgba(var(--brand-rgb), 0.14);
    color: inherit;
}

.tag-new {
    background: var(--brand-light);
    color: var(--brand-dark);
}

/* Navegação lateral dentro de uma seção */
.section-nav {
    position: sticky;
    top: 72px;
    padding: 14px;
}

.section-nav ul {
    margin: 0;
    padding: 0;
    list-style: none;
}

.section-nav ul ul {
    margin-left: 12px;
    padding-left: 8px;
    border-left: 1px solid var(--border);
}

.section-nav a {
    display: block;
    padding: 7px 10px;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-size: 0.875rem;
    text-decoration: none;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.section-nav a:hover {
    background: #f1f4f8;
    color: var(--text);
}

.section-nav a.active {
    background: var(--brand-light);
    color: var(--brand-dark);
    font-weight: 600;
}

.section-nav-top {
    display: flex !important;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
    color: var(--text) !important;
    font-weight: 600;
}

.section-nav-top i {
    color: var(--brand);
}

.section-nav-top.active {
    color: var(--brand-dark) !important;
}

.portal-footer {
    margin-top: 24px;
    background: var(--brand-darker);
    color: rgba(255, 255, 255, 0.82);
    font-size: 0.875rem;
}

.portal-footer-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 20px;
    padding-top: 28px;
    padding-bottom: 24px;
}

.portal-footer-org {
    margin-bottom: 4px;
    color: #ffffff;
    font-weight: 600;
}

.portal-footer-text {
    line-height: 1.6;
}

.portal-footer-brand {
    color: #ffffff;
}

.portal-footer-brand .brand-logo {
    max-height: 36px;
}

.portal-footer-bottom {
    padding-top: 12px;
    padding-bottom: 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 0.75rem;
    opacity: 0.7;
}

@media (min-width: 992px) {
    .portal-nav .dropdown-mega {
        position: static;
    }

    .portal-nav .mega-menu {
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        margin-top: 0;
        border: 0;
        border-top: 1px solid var(--border);
        border-radius: 0 0 14px 14px;
    }
}

@media (max-width: 991.98px) {
    .portal-nav .navbar-toggler {
        display: inline-flex;
    }

    .portal-nav .navbar-collapse {
        padding-bottom: 8px;
    }

    .portal-nav .navbar-nav .nav-link.active::after {
        display: none;
    }

    .portal-nav .mega-menu {
        margin-bottom: 8px;
    }

    .portal-nav .mega-grid {
        grid-template-columns: 1fr;
    }

    .section-nav {
        position: static;
    }
}

@media (max-width: 767.98px) {
    .portal-topbar-inner {
        grid-template-columns: auto 1fr;
    }

    .portal-hero {
        padding: 32px 0 36px;
    }

    .portal-hero-title {
        font-size: 1.5rem;
    }

    .portal-hero-search .btn {
        padding-left: 14px;
        padding-right: 14px;
    }

    .portal-page-title {
        font-size: 1.3rem;
    }

    .document-item,
    .search-place,
    .document-group-title {
        padding-left: 16px;
        padding-right: 16px;
    }
}

/* ===================================
   Painel: seções e documentos do site
   =================================== */
.section-tree-wrap {
    padding: 8px 0;
}

.section-tree {
    margin: 0;
    padding: 0;
    list-style: none;
}

.section-tree-nested {
    margin-left: 46px;
    border-left: 1px dashed var(--border-strong);
}

.section-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 24px 10px 16px;
    transition: background-color 0.15s ease;
}

.section-tree-nested .section-row {
    padding-left: 18px;
}

.section-row:hover {
    background: #f8fafd;
}

.section-row.is-inactive .section-row-name,
.section-row.is-inactive .section-row-icon {
    opacity: 0.55;
}

.section-row-icon {
    width: 34px;
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    border-radius: 10px;
    background: var(--brand-light);
    color: var(--brand);
}

.section-row-main {
    flex: 1;
    min-width: 0;
}

.section-row-name {
    font-weight: 600;
}

.section-row-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 14px;
    font-size: 0.78rem;
    color: var(--text-muted);
}

.section-row-meta i {
    margin-right: 4px;
}

.row-actions .btn-icon:disabled {
    opacity: 0.3;
    pointer-events: none;
}

.icon-picker {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.icon-option {
    width: 42px;
    height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-size: 1.15rem;
    cursor: pointer;
    transition: border-color 0.15s ease, background-color 0.15s ease, color 0.15s ease;
}

.icon-option:hover {
    border-color: var(--brand-focus);
    color: var(--brand);
}

.btn-check:checked + .icon-option {
    border-color: var(--brand);
    background: var(--brand-light);
    color: var(--brand);
}

.btn-check:focus-visible + .icon-option {
    outline: 2px solid var(--brand);
    outline-offset: 2px;
}

.department-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 6px 16px;
    padding: 14px 16px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: #fafbfd;
}

.section-picker ul {
    margin: 0;
    padding: 0;
    list-style: none;
}

.section-picker ul ul {
    margin-left: 10px;
    padding-left: 8px;
    border-left: 1px solid var(--border);
}

.section-picker a {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
    padding: 6px 10px;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-size: 0.875rem;
    text-decoration: none;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.section-picker a:hover {
    background: #f1f4f8;
    color: var(--text);
}

.section-picker a.active {
    background: var(--brand-light);
    color: var(--brand-dark);
    font-weight: 600;
}

.section-picker a.is-inactive {
    opacity: 0.55;
}

.picker-count {
    flex-shrink: 0;
    padding: 0 7px;
    border-radius: 999px;
    background: #eef1f5;
    color: var(--text-muted);
    font-size: 0.7rem;
    font-weight: 600;
}

/* Área de arquivos onde o próprio campo cobre a área (arrastar e soltar nativo) */
.dropzone-cover {
    position: absolute;
    inset: 0;
    z-index: 1;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

.dropzone-cover:focus-visible + .dropzone-label {
    border-radius: var(--radius);
    outline: 2px solid var(--brand);
    outline-offset: 2px;
}

.attachment-list li > .bi {
    color: var(--text-muted);
    font-size: 1.2rem;
}

/* ===================================
   Menu do site: submenus de seção e "Mais"
   =================================== */
.nav-section-menu,
.nav-more-menu {
    min-width: 260px;
    max-height: 70vh;
    overflow-y: auto;
}

.nav-section-overview {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
}

.nav-section-overview i {
    color: var(--brand);
}

.nav-section-parent {
    font-weight: 600;
}

.nav-section-sub {
    padding-left: 26px;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.nav-section-group {
    break-inside: avoid;
}

.nav-more-title {
    margin-top: 4px;
    font-weight: 600;
}

.nav-more-menu .nav-section-group .dropdown-item:not(.nav-section-sub) {
    padding-left: 22px;
    font-weight: 400;
}

.nav-more-menu .nav-section-sub {
    padding-left: 36px;
}

.nav-more-menu .nav-count {
    background: var(--brand);
    color: #ffffff;
}

.nav-external {
    margin-left: 4px;
    font-size: 0.7rem;
    opacity: 0.75;
}

.mega-all {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 16px;
    font-size: 0.875rem;
    font-weight: 500;
    text-decoration: none;
}

@media (min-width: 992px) {
    .nav-section-menu.is-wide {
        min-width: 520px;
    }

    .nav-section-menu.is-wide .nav-section-groups {
        columns: 2;
        column-gap: 8px;
    }
}

/* Mapa de seções (página Documentos) */
.sections-map {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

.sections-map-card {
    margin-bottom: 0;
}

.sections-map-title {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
    color: var(--text);
    text-decoration: none;
}

.sections-map-title:hover .section-tile-name {
    color: var(--brand);
}

/* ===================================
   Painel: menu do site e aparência
   =================================== */
.nav-preview {
    display: flex;
    flex-wrap: wrap;
    gap: 2px;
    padding: 6px 10px;
    border-radius: 10px;
    background: linear-gradient(90deg, var(--brand) 0%, var(--brand-dark) 100%);
}

.nav-preview-item {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 8px 12px;
    border-radius: 6px;
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.875rem;
    font-weight: 500;
}

.nav-preview-item:first-child {
    background: rgba(255, 255, 255, 0.14);
    color: #ffffff;
}

.nav-preview-item i {
    font-size: 0.7rem;
}

.nav-items-list {
    margin: 0;
    padding: 6px 0;
    list-style: none;
}

/* Ordem por arrastar e soltar */
[data-sortable] > .section-row {
    position: relative;
    background: var(--surface);
    cursor: grab;
}

[data-sortable] > .section-row:hover {
    background: #f8fafd;
}

[data-sortable].is-sorting > .section-row:not(.is-dragging):hover {
    background: var(--surface);
}

[data-sortable] > .section-row.is-dragging {
    z-index: 2;
    border-radius: var(--radius-sm);
    background: var(--surface);
    box-shadow: var(--shadow-md), 0 0 0 1px var(--brand-border);
}

[data-sortable] > .section-row.is-dropped {
    animation: sort-dropped 0.9s ease;
}

@keyframes sort-dropped {
    from { background: var(--brand-light); }
    to { background: var(--surface); }
}

body.is-sorting,
body.is-sorting * {
    cursor: grabbing !important;
    user-select: none;
}

.sort-handle {
    width: 26px;
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin: 0 -6px 0 -8px;
    padding: 0;
    border: 0;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-soft);
    font-size: 1.05rem;
    cursor: grab;
    touch-action: none;
    transition: color 0.15s ease, background-color 0.15s ease;
}

.section-row:hover .sort-handle,
.sort-handle:focus-visible {
    color: var(--brand);
}

.sort-handle:hover {
    background: var(--brand-light);
}

.sort-handle:focus-visible {
    outline: 2px solid var(--brand-focus);
    outline-offset: 1px;
}

.sort-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    color: var(--text-muted);
    text-align: right;
}

.sort-status.is-saved {
    color: #1f7a4d;
}

.sort-status.is-error {
    color: #b42318;
}

.nav-type-options {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
    gap: 10px;
}

.nav-type-option {
    display: flex;
    flex-direction: column;
    gap: 4px;
    height: 100%;
    padding: 14px;
    border: 1px solid var(--border-strong);
    border-radius: 10px;
    cursor: pointer;
    transition: border-color 0.15s ease, background-color 0.15s ease;
}

.nav-type-option i {
    color: var(--brand);
    font-size: 1.2rem;
}

.nav-type-title {
    font-weight: 600;
}

.nav-type-help {
    font-size: 0.78rem;
    color: var(--text-muted);
}

.nav-type-option:hover {
    border-color: var(--brand-focus);
}

.btn-check:checked + .nav-type-option {
    border-color: var(--brand);
    background: var(--brand-lighter);
    box-shadow: inset 0 0 0 1px var(--brand);
}

.btn-check:focus-visible + .nav-type-option {
    outline: 2px solid var(--brand);
    outline-offset: 2px;
}

.btn-check:disabled + .nav-type-option {
    cursor: not-allowed;
    background: var(--page-bg);
    border-color: var(--border);
}

.btn-check:disabled + .nav-type-option > :not(.nav-type-used) {
    opacity: 0.6;
}

.nav-type-used {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-top: auto;
    padding-top: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    color: #1f7a4d;
}

.nav-type-used i {
    font-size: 0.9rem;
    color: inherit;
}

.brand-image-row {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    padding: 16px 0;
    border-top: 1px solid var(--border);
}

.brand-image-row:first-of-type {
    padding-top: 0;
    border-top: 0;
}

.brand-image-preview {
    width: 180px;
    height: 72px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: #ffffff;
    color: var(--brand);
    overflow: hidden;
}

.brand-image-preview img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}


.brand-image-preview.is-dark {
    border-color: transparent;
    background: linear-gradient(135deg, var(--brand) 0%, var(--brand-dark) 100%);
    color: #ffffff;
}

/* Sem logo própria para fundo escuro, a principal aparece em branco (como no site) */
.brand-image-preview.is-dark img.is-fallback {
    filter: brightness(0) invert(1);
}

.brand-image-preview.is-icon {
    width: 72px;
}

.brand-image-preview.is-icon img {
    width: 48px;
    height: 48px;
}

.form-control-color {
    width: 52px;
    height: 38px;
    padding: 4px;
}

.theme-preview {
    margin-top: 16px;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--page-bg);
    font-size: 0.78rem;
}

.theme-preview-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 14px;
    background: #ffffff;
    color: var(--brand);
}

.theme-preview-search {
    width: 40%;
    height: 14px;
    border-radius: 999px;
    background: #f1f4f8;
}

.theme-preview-nav {
    display: flex;
    gap: 14px;
    padding: 8px 14px;
    background: linear-gradient(90deg, var(--brand) 0%, var(--brand-dark) 100%);
    color: rgba(255, 255, 255, 0.85);
}

.theme-preview-nav .is-active {
    color: #ffffff;
    font-weight: 600;
    box-shadow: inset 0 -2px 0 #ffffff;
}

.theme-preview-body {
    padding: 14px;
}

.theme-preview-hero {
    margin-bottom: 12px;
    padding: 14px;
    border-radius: 8px;
    background: linear-gradient(135deg, var(--brand) 0%, var(--brand-dark) 100%);
    color: #ffffff;
    font-size: 0.9rem;
    font-weight: 700;
}

.theme-preview-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.theme-preview-button {
    padding: 5px 12px;
    border-radius: 6px;
    background: var(--brand);
    color: #ffffff;
    font-weight: 500;
}

.theme-preview-link {
    color: var(--brand);
    font-weight: 500;
    text-decoration: underline;
}

.theme-preview-tag {
    padding: 2px 8px;
    border-radius: 6px;
    background: var(--brand-light);
    color: var(--brand-dark);
    font-weight: 500;
}

.theme-preview-swatches {
    display: flex;
    gap: 6px;
}

.swatch {
    flex: 1;
    height: 22px;
    border: 1px solid rgba(0, 0, 0, 0.06);
    border-radius: 6px;
}

.swatch[data-swatch="brand-darker"] { background: var(--brand-darker); }
.swatch[data-swatch="brand-dark"] { background: var(--brand-dark); }
.swatch[data-swatch="brand"] { background: var(--brand); }
.swatch[data-swatch="brand-border"] { background: var(--brand-border); }
.swatch[data-swatch="brand-light"] { background: var(--brand-light); }

.contrast-warning {
    color: #b54708;
}

.contrast-error {
    color: #b42318;
}

/* ===================================
   Responsivo
   =================================== */
@media (max-width: 991.98px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.show {
        transform: none;
        box-shadow: 0 0 40px rgba(0, 0, 0, 0.25);
    }

    .sidebar-backdrop {
        display: block;
        position: fixed;
        inset: 0;
        z-index: 1035;
        background: rgba(15, 23, 42, 0.4);
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.25s ease, visibility 0.25s ease;
    }

    .sidebar.show + .sidebar-backdrop {
        opacity: 1;
        visibility: visible;
    }

    body.sidebar-open {
        overflow: hidden;
    }

    .main-content {
        margin-left: 0;
    }

    .top-navbar {
        padding: 10px 16px;
    }

    .page-content {
        padding: 20px 16px;
    }

    .app-footer {
        padding: 4px 16px 20px;
    }
}

@media (max-width: 767.98px) {
    .message-item {
        flex-wrap: wrap;
    }

    .message-progress-group {
        width: 100%;
        padding-left: 50px;
    }

    .search-form,
    .search-form .form-control {
        width: 100%;
        min-width: 0;
    }
}

@media (max-width: 575.98px) {
    .page-title {
        font-size: 1.05rem;
    }

    .btn-label {
        display: none;
    }

    .message-item,
    .list-toolbar,
    .pagination-bar {
        padding-left: 16px;
        padding-right: 16px;
    }

    .dashboard-card {
        padding: 18px;
    }

    .card-flush > .card-header-bar {
        padding: 16px;
    }

    .table > :not(caption) > * > *:first-child {
        padding-left: 16px;
    }

    .table > :not(caption) > * > *:last-child {
        padding-right: 16px;
    }

    .login-header,
    .login-body,
    .login-footer {
        padding-left: 22px;
        padding-right: 22px;
    }

}


/* ===================================
   Notícias, vídeos e banners - painel
   =================================== */
.text-truncate-2 {
    display: -webkit-box;
    overflow: hidden;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    max-width: 520px;
}

.media-thumb {
    width: 64px;
    height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    overflow: hidden;
    border-radius: var(--radius-sm);
    background: var(--brand-light);
    color: var(--brand);
    font-size: 1.15rem;
}

.media-thumb.is-video {
    height: 36px;
    background: linear-gradient(135deg, var(--brand-dark) 0%, var(--brand-darker) 100%);
    color: #ffffff;
}

.media-thumb img,
.banner-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.banner-thumb {
    width: 136px;
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    overflow: hidden;
    border-radius: 6px;
    background: var(--brand-light);
    color: var(--brand);
}

.banner-list .section-row-meta .status-dot {
    font-size: 0.78rem;
}

.image-field {
    display: flex;
    align-items: flex-start;
    gap: 16px;
}

.image-field-preview {
    position: relative;
    width: 200px;
    aspect-ratio: 16 / 9;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--page-bg);
}

.image-field-preview.is-banner {
    width: 240px;
    aspect-ratio: 4 / 1;
}

.image-field-preview img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.image-field-preview img[hidden] {
    display: none;
}

.image-field-empty {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--text-soft);
    font-size: 0.8rem;
}

.image-field-body {
    flex: 1;
    min-width: 0;
}

.media-form-footer {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.media-form-footer .upload-progress {
    max-width: none;
}

.current-file {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    background: var(--page-bg);
    font-size: 0.85rem;
}

.current-file i {
    color: var(--brand);
}

.source-options {
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
}

.news-body-input {
    min-height: 280px;
    line-height: 1.6;
}

/* ===================================
   Notícias e vídeos - site
   =================================== */
.portal-heading-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}

.portal-heading-row .portal-heading {
    margin-bottom: 0;
}

.content-search {
    max-width: 560px;
    margin-bottom: 20px;
}

.news-grid,
.video-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 16px;
}

.news-card,
.video-card {
    height: 100%;
    overflow: hidden;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-xs);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.news-card:hover,
.video-card:hover {
    border-color: var(--brand-border);
    box-shadow: var(--shadow-md);
}

.news-card-link,
.video-card-link {
    display: flex;
    flex-direction: column;
    height: 100%;
    color: var(--text);
    text-decoration: none;
}

.news-card-link:hover,
.video-card-link:hover {
    color: var(--text);
}

.news-card-image {
    position: relative;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    background: var(--brand-light);
}

.news-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s var(--ease);
}

.news-card:hover .news-card-image img,
.video-card:hover .video-card-thumb img {
    transform: scale(1.02);
}

.news-card-placeholder {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--brand-light) 0%, var(--brand-lighter) 100%);
    color: var(--brand-border);
    font-size: 2.2rem;
}

.news-card-body,
.video-card-body {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 14px 16px 16px;
}

.news-card-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px 10px;
    color: var(--text-muted);
    font-size: 0.78rem;
}

.news-card-restricted i {
    margin-right: 3px;
}

.news-card-title,
.video-card-title {
    display: -webkit-box;
    margin: 0;
    overflow: hidden;
    font-size: 0.98rem;
    font-weight: 600;
    line-height: 1.35;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.news-card:hover .news-card-title,
.video-card:hover .video-card-title {
    color: var(--brand);
}

.news-card-summary {
    display: -webkit-box;
    margin: 0;
    overflow: hidden;
    color: var(--text-muted);
    font-size: 0.85rem;
    line-height: 1.5;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
}

.news-card.is-large {
    margin-bottom: 16px;
}

@media (min-width: 768px) {
    .news-card.is-large .news-card-link {
        flex-direction: row;
    }

    .news-card.is-large .news-card-image {
        flex: 0 0 55%;
        aspect-ratio: auto;
        min-height: 280px;
    }

    .news-card.is-large .news-card-body {
        justify-content: center;
        padding: 28px;
    }

    .news-card.is-large .news-card-title {
        font-size: 1.35rem;
        -webkit-line-clamp: 3;
    }

    .news-card.is-large .news-card-summary {
        font-size: 0.95rem;
        -webkit-line-clamp: 5;
    }
}

.news-article {
    padding: 0;
    overflow: hidden;
}

.news-article-image {
    margin: 0;
    background: var(--page-bg);
}

.news-article-image img {
    display: block;
    width: 100%;
    max-height: 480px;
    object-fit: cover;
}

.news-article-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 18px;
    padding: 22px 32px 0;
    color: var(--text-muted);
    font-size: 0.82rem;
}

.news-article-meta i {
    margin-right: 6px;
}

.news-article-lead {
    margin: 14px 32px 0;
    color: var(--text);
    font-size: 1.08rem;
    font-weight: 500;
    line-height: 1.55;
}

.news-article > .news-article-body {
    padding: 18px 32px 32px;
}

.news-article-body {
    font-size: 0.98rem;
    line-height: 1.75;
}

.news-article-body p,
.news-article-body ul {
    margin: 0 0 1em;
}

.news-article-body > :last-child {
    margin-bottom: 0;
}

.news-article-body ul {
    padding-left: 1.3em;
}

.news-article-body li + li {
    margin-top: 4px;
}

.news-article-body a {
    overflow-wrap: anywhere;
}

.news-mini-list,
.video-mini-list {
    margin: 0;
    padding: 6px 0;
    list-style: none;
}

.news-mini-list a,
.video-mini-list a {
    display: flex;
    gap: 12px;
    padding: 10px 24px;
    color: var(--text);
    text-decoration: none;
    transition: background-color 0.15s ease;
}

.news-mini-list a {
    flex-direction: column;
    gap: 2px;
}

.news-mini-list a:hover,
.video-mini-list a:hover {
    background: #f8fafd;
    color: var(--brand);
}

.news-mini-title,
.video-mini-title {
    display: block;
    font-size: 0.9rem;
    font-weight: 600;
    line-height: 1.35;
}

.news-mini-date,
.video-mini-date {
    display: block;
    color: var(--text-muted);
    font-size: 0.78rem;
}

.video-card-thumb,
.video-mini-thumb {
    position: relative;
    overflow: hidden;
    background: linear-gradient(135deg, var(--brand-dark) 0%, var(--brand-darker) 100%);
}

.video-card-thumb {
    aspect-ratio: 16 / 9;
}

.video-card-thumb img,
.video-mini-thumb img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s var(--ease);
}

.video-card-play {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.92);
    box-shadow: 0 4px 14px rgba(15, 23, 42, 0.25);
    color: var(--brand);
    font-size: 1.6rem;
    transform: translate(-50%, -50%);
    transition: transform 0.2s var(--ease);
}

.video-card:hover .video-card-play {
    transform: translate(-50%, -50%) scale(1.06);
}

.video-card-play i {
    margin-left: 3px;
}

.video-card-source {
    position: absolute;
    right: 8px;
    bottom: 8px;
    padding: 2px 8px;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.7);
    color: #ffffff;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.video-card-meta {
    color: var(--text-muted);
    font-size: 0.78rem;
}

.video-player {
    position: relative;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    border-radius: var(--radius);
    background: #0b1220;
    box-shadow: var(--shadow-sm);
}

.video-player iframe,
.video-player video {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: 0;
}

.video-player-missing {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.9rem;
}

.video-mini-list a {
    align-items: center;
}

.video-mini-thumb {
    width: 96px;
    aspect-ratio: 16 / 9;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    border-radius: var(--radius-sm);
    color: #ffffff;
    font-size: 1.2rem;
}

.video-mini-thumb i {
    position: relative;
    text-shadow: 0 1px 6px rgba(0, 0, 0, 0.45);
}

.search-place-icon.has-image {
    overflow: hidden;
    background: var(--page-bg);
}

.search-place-icon.has-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.search-more {
    display: block;
    padding: 10px 24px 14px;
    border-top: 1px solid var(--border);
    font-size: 0.85rem;
    font-weight: 500;
    text-decoration: none;
}

/* Banners da página inicial */
.home-banners {
    margin-bottom: 28px;
}

.home-banners .carousel {
    overflow: hidden;
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    background: var(--brand-light);
}

.banner-slide {
    display: block;
}

.banner-picture img {
    display: block;
    width: 100%;
    aspect-ratio: 4 / 1;
    object-fit: cover;
}

@media (max-width: 767.98px) {
    .banner-picture.has-mobile img {
        aspect-ratio: 16 / 9;
    }
}

.home-banners .carousel-indicators {
    margin-bottom: 10px;
}

.home-banners .carousel-indicators [data-bs-target] {
    width: 22px;
    height: 4px;
    margin: 0 3px;
    border: 0;
    border-radius: 999px;
    background-color: #ffffff;
    opacity: 0.55;
    transition: opacity 0.2s ease, width 0.2s ease;
}

.home-banners .carousel-indicators .active {
    width: 34px;
    opacity: 1;
}

.home-banners .carousel-control-prev,
.home-banners .carousel-control-next {
    width: 64px;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.home-banners .carousel:hover .carousel-control-prev,
.home-banners .carousel:hover .carousel-control-next,
.home-banners .carousel-control-prev:focus-visible,
.home-banners .carousel-control-next:focus-visible {
    opacity: 1;
}

.banner-control {
    width: 38px;
    height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.9);
    box-shadow: 0 2px 10px rgba(15, 23, 42, 0.2);
    color: var(--brand-dark);
    font-size: 1.05rem;
}

@media (max-width: 767.98px) {
    .image-field {
        flex-direction: column;
    }

    .image-field-preview,
    .image-field-preview.is-banner {
        width: 100%;
    }

    .news-article-meta {
        padding: 18px 18px 0;
    }

    .news-article-lead {
        margin: 12px 18px 0;
    }

    .news-article > .news-article-body {
        padding: 16px 18px 22px;
    }

    .home-banners .carousel-control-prev,
    .home-banners .carousel-control-next {
        display: none;
    }

    .news-mini-list a,
    .video-mini-list a,
    .search-more {
        padding-left: 16px;
        padding-right: 16px;
    }
}
