/* ===================================
   Intranet Funpresp - Estilos
   Paleta herdada do Painel Sebrae Prev.
   =================================== */

:root {
    --brand: #005eb8;
    --brand-dark: #004a93;
    --brand-darker: #003a75;
    --brand-light: #e6f0f9;
    --brand-rgb: 0, 94, 184;

    --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: #005eb8;
    --bs-primary-rgb: 0, 94, 184;
    --bs-primary-text-emphasis: #00264a;
    --bs-primary-bg-subtle: #e6f0f9;
    --bs-primary-border-subtle: #a6c8ea;
    --bs-link-color: #005eb8;
    --bs-link-color-rgb: 0, 94, 184;
    --bs-link-hover-color: #004a93;
    --bs-link-hover-color-rgb: 0, 74, 147;
    --bs-body-color: #1f2937;
    --bs-body-font-size: 0.9375rem;
    --bs-border-color: #e4e8ee;
    --bs-focus-ring-color: rgba(0, 94, 184, 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: 0, 94, 184;
}

.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: 0, 94, 184;
}

.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: #7fb0e0;
    box-shadow: 0 0 0 0.2rem rgba(0, 94, 184, 0.12);
}

.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(0, 94, 184, 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;
}

.brand-wordmark {
    display: flex;
    flex-direction: column;
    line-height: 1.1;
}

.brand-name {
    font-size: 1.3rem;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.brand-product {
    margin-top: 4px;
    font-size: 0.66rem;
    font-weight: 600;
    letter-spacing: 0.24em;
    text-transform: uppercase;
    opacity: 0.75;
}

.sidebar .brand-logo {
    max-width: 170px;
    max-height: 44px;
    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: #f6f9fc;
    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: #9ec5ea;
}

.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: #c9d8ea;
    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;
}

.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: #f6faff;
}

.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;
}

.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: #c9d8ea;
    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 {
    font-size: 0.72rem;
    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: #7fb0e0;
    box-shadow: 0 0 0 0.2rem rgba(0, 94, 184, 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: #eef5fc;
}

.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; }

.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: #a6c8ea;
    background: #f8fbfe;
}

.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 #d6e5f5;
    text-align: center;
}

.login-header .brand-wordmark {
    align-items: center;
    color: var(--brand);
}

.login-header .brand-name {
    font-size: 1.75rem;
}

.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);
}

/* ===================================
   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;
    }

}
