/* Definição de Cores e Variáveis (Modern Slate UI Tokens) */
:root {
    --bg-color: #f1f5f9;
    --side-color: #0f172a;
    --text-color: #0f172a;
    --card-bg: #ffffff;
    --border-color: #e2e8f0;
    --topbar-bg: rgba(255, 255, 255, 0.92);
    --accent-color: #3498db;
    --success-color: #2ecc71; /* Verde Sucesso do Botão */
    --nav-hover: #1e293b;
}

/* Classe para Modo Escuro */
body.dark-mode {
    --bg-color: #11161f;
    --side-color: #0b0f17;
    --text-color: #f1f5f9;
    --card-bg: #181f2c;
    --border-color: #2a3444;
    --topbar-bg: rgba(20, 27, 38, 0.92);
    --nav-hover: rgba(52, 152, 219, 0.14);
}

/* Reset e Estrutura Base */
* { margin: 0; padding: 0; box-sizing: border-box; }
body, input, select, textarea, button { font-family: 'Inter', 'Segoe UI', -apple-system, BlinkMacSystemFont, Roboto, sans-serif; }
body {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

/* Padronização Global de Barras de Rolagem (Verticais e Horizontais) */
*::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
*::-webkit-scrollbar-track {
    background: var(--bg-color);
    border-radius: 4px;
}
*::-webkit-scrollbar-thumb {
    background: var(--accent-color);
    border-radius: 4px;
}
*::-webkit-scrollbar-thumb:hover {
    filter: brightness(1.15);
}
*::-webkit-scrollbar-corner {
    background: var(--bg-color);
}

body { background-color: var(--bg-color); color: var(--text-color); transition: 0.3s; display: flex; }
.wrapper { display: flex; width: 100%; height: 100vh; height: 100dvh; }

/* Sidebar Retrátil Blindada */
.sidebar { 
    width: 250px; 
    background-color: var(--side-color); 
    color: white; 
    position: fixed; 
    top: 0;
    left: 0;
    height: 100%; 
    border-right: 1px solid rgba(255, 255, 255, 0.06);
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.14);
    transition: width 0.3s ease, transform 0.28s cubic-bezier(0.4, 0, 0.2, 1); 
    z-index: 250; 
    display: flex;
    flex-direction: column;
    overflow: hidden; /* Garante que o texto suma ao colapsar */
}

/* Classe de colapso */
.sidebar.collapsed { width: 70px; }

.sidebar-header { 
    display: flex; 
    align-items: center; 
    justify-content: space-between; 
    padding: 10px 18px; 
    height: 88px;
    transition: padding 0.3s ease;
    flex-shrink: 0;
}

.btn-sidebar-toggle {
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    outline: none;
    transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-logo-img {
    width: 68px;
    height: 68px;
    object-fit: contain;
    border-radius: 8px;
    transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1), filter 0.2s ease, width 0.2s ease, height 0.2s ease;
    filter: drop-shadow(0 2px 6px rgba(0,0,0,0.28));
}
.sidebar.collapsed .sidebar-logo-img {
    width: 54px;
    height: 54px;
}

.btn-sidebar-toggle:hover .sidebar-logo-img {
    transform: scale(1.1);
    filter: brightness(1.15) drop-shadow(0 4px 10px rgba(0,0,0,0.4));
}

.btn-sidebar-toggle:active .sidebar-logo-img {
    transform: scale(0.94);
}

.sidebar .nav-links { list-style: none; flex-grow: 1; display: flex; flex-direction: column; width: 100%; }

.nav-links li a { 
    display: flex; 
    align-items: center; 
    padding: 13px 22px; 
    color: #94a3b8; 
    text-decoration: none; 
    font-size: 0.91rem;
    font-weight: 500;
    border-left: 3px solid transparent;
    white-space: nowrap; /* Impede que o texto quebre linha antes de sumir */
    width: 100%;
    transition: background-color 0.18s ease, color 0.18s ease, border-color 0.18s ease;
}

.nav-links li a:hover { 
    background-color: var(--nav-hover); 
    color: #f8fafc; 
    border-left-color: rgba(52, 152, 219, 0.55); 
}

.nav-links li a.active { 
    background: linear-gradient(90deg, rgba(52, 152, 219, 0.22) 0%, rgba(52, 152, 219, 0.06) 100%);
    color: #ffffff; 
    font-weight: 600;
    border-left: 3px solid var(--accent-color); 
}

/* Ícones: Mantém fixo para não sumir no colapso */
.nav-links li a .material-icons { 
    margin-right: 14px; 
    min-width: 24px; 
    text-align: center;
    font-size: 21px;
    transition: transform 0.18s ease, color 0.18s ease;
}
.nav-links li a.active .material-icons {
    color: #60a5fa;
}
.nav-links li a:hover .material-icons {
    transform: translateX(2px);
}

/* Ajuste específico para quando estiver colapsado */
.sidebar.collapsed .sidebar-header {
    justify-content: center;
    padding: 0;
}
.sidebar.collapsed .sidebar-header h3 { display: none; }
.sidebar.collapsed .nav-links li a { padding: 13px 20px; } /* Mantém o ícone centralizado */
.sidebar.collapsed .nav-links li a span:not(.material-icons) { display: none; }

/* Ícone de Chat (Conversas estilo WhatsApp) na base da Sidebar */
.sidebar-chat-footer {
    margin-top: auto;
    padding: 10px 12px 14px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    flex-shrink: 0;
}
.sidebar-chat-btn {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-radius: 10px;
    border: 1px solid rgba(52, 152, 219, 0.28);
    background: rgba(52, 152, 219, 0.12);
    color: #e2e8f0;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: background-color 0.18s ease, border-color 0.18s ease, color 0.18s ease, transform 0.12s ease;
}
.sidebar-chat-btn:hover {
    background: rgba(52, 152, 219, 0.24);
    border-color: rgba(52, 152, 219, 0.55);
    color: #ffffff;
}
.sidebar-chat-btn:active { transform: translateY(1px); }
.sidebar-chat-icon-wrap {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;
    flex-shrink: 0;
    color: #60a5fa;
}
.sidebar-chat-badge {
    position: absolute;
    top: -6px;
    right: -8px;
    min-width: 17px;
    height: 17px;
    padding: 0 4px;
    border-radius: 999px;
    background: #22c55e;
    color: #ffffff;
    font-size: 0.65rem;
    font-weight: 800;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--side-color);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
}
.sidebar-chat-badge.pulse {
    animation: waBadgePulse 2s infinite;
}
@keyframes waBadgePulse {
    0%   { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.7); }
    70%  { box-shadow: 0 0 0 8px rgba(34, 197, 94, 0); }
    100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); }
}
.sidebar.collapsed .sidebar-chat-footer { padding: 10px 8px 14px; }
.sidebar.collapsed .sidebar-chat-btn { justify-content: center; padding: 10px 0; }
.sidebar.collapsed .sidebar-chat-label { display: none; }

/* Content */
.content { 
    margin-left: 250px; 
    width: calc(100% - 250px); 
    height: 100vh;
    height: 100dvh;
    overflow: hidden; 
    display: flex;
    flex-direction: column;
    flex-grow: 1; 
    min-width: 0;
    transition: margin-left 0.3s ease, width 0.3s ease; 
}

.btn-mobile-menu {
    display: none;
    width: 38px;
    height: 38px;
    padding: 3px;
    border-radius: 9px;
    border: 1px solid var(--border-color);
    background: transparent;
    color: var(--text-color);
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    transition: transform 0.18s ease, border-color 0.18s ease;
}
.btn-mobile-menu:hover { border-color: var(--accent-color); }
.btn-mobile-menu:active { transform: scale(0.94); }
.mobile-menu-logo {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 6px;
    display: block;
    filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.25));
}
.mobile-sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
    backdrop-filter: blur(2px);
    z-index: 240;
}
.mobile-sidebar-backdrop.active { display: block; }

.sidebar.collapsed ~ .content { 
    margin-left: 70px; 
    width: calc(100% - 70px); 
}

.topbar {
    background: var(--topbar-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    padding: 0 28px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
    height: 60px;
    min-height: 60px;
    flex-shrink: 0;
    z-index: 100;
    position: relative;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.topbar-breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.95rem;
}

.topbar-brand {
    color: var(--text-color);
    opacity: 0.55;
    font-weight: 500;
    letter-spacing: 0.2px;
}

.topbar-sep {
    color: var(--text-color);
    opacity: 0.35;
    font-size: 1.15rem;
    line-height: 1;
}

.topbar-title {
    color: var(--text-color);
    font-weight: 700;
    font-size: 1.05rem;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 14px;
}

.topbar-session-timer {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    height: 30px;
    padding: 0 10px;
    border-radius: 999px;
    border: 1px solid var(--border-color);
    background: rgba(52, 152, 219, 0.08);
    color: var(--text-color);
    font-size: 0.78rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.3px;
    user-select: none;
    transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}
.topbar-session-timer .material-icons {
    font-size: 15px;
    color: var(--accent-color);
    opacity: 0.9;
}
.topbar-session-timer.aviso {
    background: rgba(243, 156, 18, 0.14);
    border-color: rgba(243, 156, 18, 0.4);
    color: #d35400;
}
body.dark-mode .topbar-session-timer.aviso { color: #fbbf24; }
.topbar-session-timer.aviso .material-icons { color: #f39c12; }
.topbar-session-timer.critico {
    background: rgba(231, 76, 60, 0.14);
    border-color: rgba(231, 76, 60, 0.45);
    color: #c0392b;
}
body.dark-mode .topbar-session-timer.critico { color: #f87171; }
.topbar-session-timer.critico .material-icons { color: #e74c3c; }

.topbar-divider {
    width: 1px;
    height: 28px;
    background: var(--border-color);
    opacity: 0.8;
}

.topbar-user-badge {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 4px 8px;
    border-radius: 8px;
    user-select: none;
}

.user-avatar-initials {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-color), #2980b9);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.88rem;
    box-shadow: 0 2px 6px rgba(52, 152, 219, 0.3);
}

.user-text-meta {
    display: flex;
    flex-direction: column;
    line-height: 1.25;
}

.user-name-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-color);
}

.user-role-label {
    font-size: 0.72rem;
    color: var(--text-color);
    opacity: 0.65;
}

/* SINO DE NOTIFICAÇÕES */
.notif-bell-container {
    position: relative;
    display: inline-flex;
    align-items: center;
}

.btn-notif-bell {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 1px solid transparent;
    background: transparent;
    color: var(--text-color);
    opacity: 0.85;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    position: relative;
    transition: all 0.2s ease;
}

.btn-notif-bell:hover,
.btn-notif-bell.active {
    background: rgba(52, 152, 219, 0.12);
    color: var(--accent-color);
    opacity: 1;
    transform: scale(1.04);
}

.btn-notif-bell .material-icons {
    font-size: 24px;
}

.notif-badge-count {
    position: absolute;
    top: 2px;
    right: 2px;
    background: #e74c3c;
    color: #ffffff;
    font-size: 0.68rem;
    font-weight: 800;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 9px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 6px rgba(231, 76, 60, 0.45);
    border: 2px solid var(--topbar-bg);
    line-height: 1;
    pointer-events: none;
}

@keyframes notifPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.15); box-shadow: 0 0 10px rgba(231, 76, 60, 0.7); }
    100% { transform: scale(1); }
}

.notif-badge-count.pulse {
    animation: notifPulse 2.2s infinite ease-in-out;
}

/* DROPDOWN DO SINO */
.notif-dropdown-panel {
    position: absolute;
    top: calc(100% + 10px);
    right: -10px;
    width: 390px;
    max-width: calc(100vw - 24px);
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: 0 14px 40px rgba(0,0,0,0.22);
    z-index: 1050;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: notifDropIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes notifDropIn {
    from { opacity: 0; transform: translateY(-8px) scale(0.97); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.notif-dropdown-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
    background: rgba(0,0,0,0.02);
}

.notif-header-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--text-color);
}

.notif-header-title .material-icons {
    font-size: 19px;
    color: var(--accent-color);
}

.notif-pill-count {
    background: rgba(52, 152, 219, 0.15);
    color: var(--accent-color);
    font-size: 0.72rem;
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: 700;
}

.btn-mark-all-read {
    background: transparent;
    border: none;
    color: var(--text-color);
    opacity: 0.75;
    font-size: 0.78rem;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
    transition: all 0.15s;
    font-family: inherit;
}

.btn-mark-all-read:hover {
    opacity: 1;
    color: var(--accent-color);
    background: rgba(52, 152, 219, 0.1);
}

.btn-mark-all-read .material-icons {
    font-size: 15px;
}

.notif-dropdown-list {
    max-height: 380px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.notif-dropdown-list::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
.notif-dropdown-list::-webkit-scrollbar-track {
    background: var(--bg-color);
    border-radius: 3px;
}
.notif-dropdown-list::-webkit-scrollbar-thumb {
    background: var(--accent-color);
    border-radius: 3px;
}

.notif-item {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    gap: 12px;
    text-decoration: none;
    color: inherit;
    cursor: pointer;
    transition: background 0.18s ease;
    position: relative;
    align-items: flex-start;
}

.notif-item:hover {
    background: rgba(52, 152, 219, 0.07);
}

.notif-item.is-mencao {
    border-left: 3px solid #f39c12;
    background: rgba(243, 156, 18, 0.04);
}

.notif-item.is-mencao:hover {
    background: rgba(243, 156, 18, 0.08);
}

.notif-item-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #e0e6ed;
    color: #34495e;
    font-weight: 700;
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-top: 2px;
}

body.dark-mode .notif-item-avatar {
    background: #3a3f47;
    color: #ecf0f1;
}

.notif-item-body {
    flex: 1;
    min-width: 0;
}

.notif-item-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 3px;
    gap: 6px;
}

.notif-item-proposta {
    font-weight: 700;
    font-size: 0.84rem;
    color: var(--accent-color);
    white-space: nowrap;
}

.notif-item-mencao-badge {
    background: rgba(243, 156, 18, 0.18);
    color: #e67e22;
    font-size: 0.68rem;
    padding: 1px 6px;
    border-radius: 4px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 2px;
}

.notif-item-time {
    font-size: 0.72rem;
    color: var(--text-color);
    opacity: 0.55;
    white-space: nowrap;
    margin-left: auto;
}

.notif-item-cliente {
    font-size: 0.76rem;
    color: var(--text-color);
    opacity: 0.78;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.notif-item-msg {
    font-size: 0.82rem;
    color: var(--text-color);
    opacity: 0.9;
    line-height: 1.35;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    word-break: break-word;
}

.notif-item-author {
    font-weight: 600;
    color: var(--text-color);
}

.notif-dropdown-footer {
    padding: 10px 16px;
    border-top: 1px solid var(--border-color);
    background: rgba(0,0,0,0.02);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.75rem;
    color: var(--text-color);
    opacity: 0.75;
}

.notif-dropdown-footer a {
    color: var(--accent-color);
    text-decoration: none;
    font-weight: 600;
}

.notif-dropdown-footer a:hover {
    text-decoration: underline;
}

.notif-empty-state {
    padding: 36px 20px;
    text-align: center;
    color: var(--text-color);
    opacity: 0.7;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.notif-empty-state .material-icons {
    font-size: 38px;
    color: var(--accent-color);
    opacity: 0.6;
}

.notif-dropdown-loading {
    padding: 30px 20px;
    text-align: center;
    color: var(--text-color);
    opacity: 0.65;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 0.85rem;
}

.page-container { padding: 22px 28px; flex: 1; display: flex; flex-direction: column; overflow: hidden; min-height: 0; width: 100%; box-sizing: border-box; }

/* Cabeçalho Executivo Padronizado para Todas as Páginas */
.page-exec-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 14px;
    margin-bottom: 14px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
}
.page-exec-title { min-width: 0; flex: 1 1 340px; }
.page-exec-title h2 {
    margin: 0;
    font-size: clamp(1.12rem, 1.35vw, 1.38rem);
    font-weight: 800;
    letter-spacing: -0.3px;
    display: flex;
    align-items: center;
    gap: 9px;
    color: var(--text-color);
}
.page-exec-title h2 .material-icons { font-size: 26px; }
.page-exec-title p {
    margin: 4px 0 0;
    font-size: 0.85rem;
    opacity: 0.74;
    color: var(--text-color);
    line-height: 1.35;
}
.page-exec-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    flex-shrink: 0;
}
.page-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px 14px;
    margin-bottom: 14px;
    flex-shrink: 0;
}
.page-toolbar .filters-container {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-start;
    flex-grow: 0;
}
.filter-input {
    height: 36px;
    padding: 0 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--card-bg);
    color: var(--text-color);
    font-size: 0.84rem;
    width: 165px;
    outline: none;
    transition: 0.2s;
    box-sizing: border-box;
}
.filter-input-wide { width: 230px; }
.filter-select-ano { width: auto; min-width: 130px; cursor: pointer; }
.filter-input:focus { border-color: var(--accent-color); box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.16); }

.btn-toolbar {
    height: 36px;
    padding: 0 14px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-size: 0.83rem;
    font-weight: 700;
    white-space: nowrap;
    text-decoration: none;
    transition: filter 0.18s ease, transform 0.15s ease;
    box-sizing: border-box;
}
.btn-toolbar:hover { filter: brightness(1.08); }
.btn-toolbar-primary { background-color: var(--success-color); color: #fff !important; }
.btn-toolbar-search { background-color: var(--accent-color); color: #fff !important; }
.btn-toolbar-success { background-color: #27ae60; color: #fff !important; }
.btn-toolbar-danger { background-color: #c0392b; color: #fff !important; }
.btn-toolbar-clear { background: rgba(127, 140, 141, 0.16); color: var(--text-color) !important; border: 1px solid var(--border-color); }

.header-page { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; width: 100%; margin-bottom: 16px; gap: 12px; flex-shrink: 0; }
.filters-container { display: flex; gap: 8px; flex-grow: 1; justify-content: center; flex-wrap: wrap; align-items: center; }

.form-row { display: flex; gap: 10px; }

.btn-add { background-color: var(--success-color); color: white !important; border: none; height: 36px; padding: 0 15px; border-radius: 8px; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; font-weight: 700; font-size: 0.84rem; white-space: nowrap; transition: 0.2s; }
.btn-add:hover { filter: brightness(1.08); }

/* Tabela */
.card { background: var(--card-bg); padding: 20px; border-radius: 12px; border: 1px solid var(--border-color); box-shadow: 0 4px 16px rgba(15, 23, 42, 0.05); overflow: auto; flex: 1; min-height: 0; }
body.dark-mode .card,
body.dark-mode .table-responsive { box-shadow: 0 6px 24px rgba(0, 0, 0, 0.28); }
.card::-webkit-scrollbar { width: 8px; height: 8px; }
.card::-webkit-scrollbar-track { background: var(--bg-color); border-radius: 4px; }
.card::-webkit-scrollbar-thumb { background: var(--accent-color); border-radius: 4px; }
.card::-webkit-scrollbar-thumb:hover { filter: brightness(1.15); }
.card::-webkit-scrollbar-corner { background: var(--bg-color); }
.custom-table { width: 100%; border-collapse: separate; border-spacing: 0; table-layout: auto; }
.custom-table th, .custom-table td { padding: 10px 8px; border-bottom: 1px solid var(--border-color); text-align: center; font-size: 0.8rem; white-space: nowrap; }
.custom-table td { font-variant-numeric: tabular-nums; transition: background-color 0.14s ease; }
.custom-table tbody tr:hover td { background-color: rgba(52, 152, 219, 0.05); }
.custom-table td.text-left, .custom-table th.text-left { text-align: left; }
.custom-table th { background-color: var(--card-bg); font-size: 0.69rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; cursor: pointer; white-space: nowrap; position: sticky; top: 0; z-index: 2; box-shadow: 0 2px 2px -1px rgba(0,0,0,0.08); }

/* Tabela com header sticky - Todas as páginas */
.table-responsive { margin-top: 20px; background: var(--card-bg); border: 1px solid var(--border-color); border-radius: 12px; box-shadow: 0 4px 16px rgba(15, 23, 42, 0.05); overflow-x: auto; display: flex; flex-direction: column; flex: 1; min-height: 0; padding: 20px; }
.table-body-scroll { overflow-y: auto; flex: 1; min-height: 0; padding-right: 6px; }
.table-responsive .custom-table th { position: sticky; top: 0; z-index: 5; background-color: var(--card-bg); box-shadow: 0 2px 4px -1px rgba(0,0,0,0.14); }
.table-responsive .custom-table td { white-space: nowrap; }
.table-responsive::-webkit-scrollbar { width: 8px; height: 8px; }
.table-responsive::-webkit-scrollbar-track { background: var(--bg-color); border-radius: 4px; }
.table-responsive::-webkit-scrollbar-thumb { background: var(--accent-color); border-radius: 4px; }
.table-responsive::-webkit-scrollbar-thumb:hover { filter: brightness(1.15); }
.table-responsive::-webkit-scrollbar-corner { background: var(--bg-color); }
.table-body-scroll::-webkit-scrollbar { width: 8px; height: 8px; }
.table-body-scroll::-webkit-scrollbar-track { background: var(--bg-color); border-radius: 4px; }
.table-body-scroll::-webkit-scrollbar-thumb { background: var(--accent-color); border-radius: 4px; }
.table-body-scroll::-webkit-scrollbar-thumb:hover { filter: brightness(1.15); }
.table-body-scroll::-webkit-scrollbar-corner { background: var(--bg-color); }

/* Truncamento com hover tooltip na tabela de Materiais (evita scroll horizontal) */
#tabelaMateriais th,
#tabelaMateriais td {
    padding: 9px 7px;
}
.mat-desc-trunc {
    display: block;
    max-width: clamp(170px, 21vw, 310px);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.mat-forn-trunc {
    display: inline-block;
    max-width: 135px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    vertical-align: middle;
}
.mat-hover-tooltip {
    position: fixed;
    z-index: 9600;
    max-width: min(460px, calc(100vw - 24px));
    padding: 10px 13px;
    border-radius: 9px;
    background: #0f172a;
    color: #f8fafc;
    border: 1px solid rgba(56, 189, 248, 0.35);
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.38);
    font-size: 0.82rem;
    line-height: 1.45;
    white-space: normal;
    word-break: break-word;
    pointer-events: none;
    opacity: 0;
    transform: translateY(4px);
    transition: opacity 0.14s ease, transform 0.14s ease;
}
.mat-hover-tooltip.visible {
    opacity: 1;
    transform: translateY(0);
}

.btn-icon { background: none; border: 1px solid var(--border-color); border-radius: 6px; cursor: pointer; padding: 6px; transition: background-color 0.18s ease, color 0.18s ease, border-color 0.18s ease, transform 0.1s ease; color: var(--text-color); line-height: 0; }
.btn-icon:hover { background-color: rgba(52, 152, 219, 0.12); border-color: rgba(52, 152, 219, 0.4); color: var(--accent-color); }
.btn-icon.delete:hover { background-color: rgba(231, 76, 60, 0.12); border-color: rgba(231, 76, 60, 0.4); color: #e74c3c; }
.btn-icon:active { transform: translateY(1px); }

.badge { background-color: #3498db; color: white; padding: 4px 12px; border-radius: 20px; font-size: 11px; font-weight: bold; }

/* MODAIS (Padronização Global + Animação Moderna) */
@keyframes modalSlideIn {
    from { opacity: 0; transform: scale(0.97) translateY(8px); }
    to   { opacity: 1; transform: scale(1) translateY(0); }
}
.modal { display: none; position: fixed; z-index: 1000; left: 0; top: 0; width: 100%; height: 100%; background-color: rgba(15, 23, 42, 0.65); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); align-items: center; justify-content: center; padding: 12px; }
.modal-content { background-color: var(--card-bg); color: var(--text-color); padding: 25px; border: 1px solid var(--border-color); border-radius: 14px; width: 450px; max-width: 92vw; box-shadow: 0 20px 50px rgba(0, 0, 0, 0.38); position: relative; animation: modalSlideIn 0.18s cubic-bezier(0.16, 1, 0.3, 1); }
.modal-content h3 { margin-top: 0; letter-spacing: -0.2px; }
.modal-close { position: absolute; top: 10px; right: 14px; background: none; border: none; font-size: 22px; color: var(--text-color); cursor: pointer; opacity: 0.65; line-height: 1; padding: 2px 6px; border-radius: 6px; transition: background-color 0.15s ease, opacity 0.15s ease; }
.modal-close:hover { opacity: 1; background-color: rgba(128,128,128,0.2); }

/* CLASSE DE ALERTA (CENTRALIZADA) */
.modal-alert { text-align: center; width: 400px !important; max-width: 92vw !important; padding: 28px 26px !important; }
.modal-alert .material-icons { font-size: 56px !important; margin-bottom: 12px; }

.modal-alert p { margin-top: 8px; margin-bottom: 22px; opacity: 0.9; font-size: 0.94rem; line-height: 1.5; word-break: break-word; }
.modal-alert .modal-buttons { justify-content: center !important; margin-top: 0px; }

/* Modal de Tempo Ativo de Sessão */
.sessao-modal-card { width: 430px !important; }
.sessao-modal-card #sessaoModalIcone { font-size: 56px !important; margin-bottom: 10px !important; }
.sessao-modal-card .modal-buttons .material-icons { font-size: 18px !important; margin-bottom: 0 !important; }
.sessao-countdown-box {
    margin: 0 auto 22px;
    padding: 12px 16px;
    border-radius: 10px;
    background: rgba(243, 156, 18, 0.1);
    border: 1px solid rgba(243, 156, 18, 0.28);
}
.sessao-countdown-valor {
    font-size: 2rem;
    font-weight: 800;
    letter-spacing: 1px;
    color: #f39c12;
    font-variant-numeric: tabular-nums;
    margin-bottom: 10px;
}
.sessao-progress-track {
    width: 100%;
    height: 7px;
    border-radius: 999px;
    background: rgba(148, 163, 184, 0.22);
    overflow: hidden;
}
.sessao-progress-fill {
    height: 100%;
    border-radius: 999px;
    background: linear-gradient(90deg, #e67e22, #f39c12);
    transition: width 0.25s linear;
}
.sessao-countdown-box.critico {
    background: rgba(231, 76, 60, 0.12);
    border-color: rgba(231, 76, 60, 0.35);
}
.sessao-countdown-box.critico .sessao-countdown-valor { color: #e74c3c; }
.sessao-countdown-box.critico .sessao-progress-fill { background: linear-gradient(90deg, #c0392b, #e74c3c); }

.form-input { width: 100%; max-width: 100%; box-sizing: border-box; padding: 10px 12px; margin-top: 5px; margin-bottom: 15px; border: 1px solid var(--border-color); border-radius: 8px; background: var(--card-bg); color: var(--text-color); font-size: 0.9rem; outline: none; transition: border-color 0.18s ease, box-shadow 0.18s ease; }
.form-input:focus { border-color: var(--accent-color); box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.18); }
.form-input:disabled { opacity: 0.6; cursor: not-allowed; }
.modal-buttons { display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }
.btn { padding: 10px 20px; border: none; border-radius: 8px; cursor: pointer; font-weight: 700; transition: filter 0.15s ease, transform 0.1s ease, box-shadow 0.15s ease; }
.btn:hover { filter: brightness(1.06); }
.btn:active, .btn-toolbar:active, .btn-add:active { transform: translateY(1px); }
.modal .btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.btn-confirm { background-color: var(--accent-color); color: white; }
.btn-cancel { background-color: #64748b; color: white; }

/* --- Tela de Login Estilizada (Modern Glassmorphism) --- */
.login-body { 
    height: 100vh; 
    width: 100vw; 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    position: relative;
    overflow: hidden;
    background-color: #0b0f17; 
}

.login-background {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background-image: url('../img/login.webp'), url('../img/login.png'); 
    background-size: cover;
    background-position: center;
    filter: blur(3px) brightness(0.38);
    opacity: 0.92;
    z-index: 1;
}

.login-card { 
    position: relative;
    z-index: 10;
    background: rgba(15, 23, 42, 0.58); 
    backdrop-filter: blur(18px); 
    -webkit-backdrop-filter: blur(18px);
    border: 1px solid rgba(255, 255, 255, 0.18); 
    padding: 40px 32px; 
    border-radius: 22px; 
    width: 410px; 
    max-width: 92vw;
    text-align: center; 
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5); 
}

.login-card .avatar { width: 82px; height: 82px; margin: 0 auto 20px auto; border-radius: 50%; background: #eee; display: flex; align-items: center; justify-content: center; box-shadow: 0 6px 20px rgba(0,0,0,0.35); border: 2px solid rgba(255,255,255,0.28); }
.login-input-group { position: relative; margin-bottom: 18px; }
.login-input-group i { position: absolute; left: 15px; top: 12px; color: #64748b; pointer-events: none; }
.login-input { width: 100%; padding: 12px 14px 12px 45px; border-radius: 10px; border: 1px solid transparent; background: rgba(255, 255, 255, 0.94); color: #0f172a; font-size: 0.95rem; outline: none; transition: border-color 0.2s, box-shadow 0.2s, background 0.2s; }
.login-input:focus { background: #ffffff; border-color: #60a5fa; box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.35); }
.btn-login { width: 100%; padding: 13px; border: none; border-radius: 10px; background: linear-gradient(135deg, #3498db 0%, #2563eb 100%); color: white; font-weight: 700; font-size: 0.95rem; letter-spacing: 0.4px; cursor: pointer; box-shadow: 0 6px 18px rgba(37, 99, 235, 0.35); transition: filter 0.18s ease, transform 0.12s ease; }
.btn-login:hover { filter: brightness(1.08); }
.btn-login:active { transform: translateY(1px); }

/* Ajuste de Rolagem Interna para Modais com muitos dados */
.modal-content {
    max-height: 90vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

/* Garante que o cabeçalho da tabela de visualização fique fixo no topo ao rolar */
.modal-content .custom-table thead th {
    position: sticky;
    top: 0;
    background-color: var(--card-bg);
    z-index: 10;
    box-shadow: 0 2px 2px -1px rgba(0,0,0,0.4);
}
.modal-busca-mat-table {
    table-layout: fixed;
    width: 100%;
}
.modal-busca-mat-table th:first-child,
.modal-busca-mat-table td:first-child {
    white-space: normal;
    word-break: break-word;
    line-height: 1.35;
}

.modal-prop-row {
    cursor: pointer;
    transition: background-color 0.15s ease;
}
.modal-prop-row:hover {
    background-color: rgba(52, 152, 219, 0.12) !important;
}
body.dark-mode .modal-prop-row:hover {
    background-color: rgba(56, 189, 248, 0.14) !important;
}

/* ==================== MAPA SVG BI (ESTADOS & CIDADES) ==================== */
.mapa-controls {
    display: inline-flex;
    background: rgba(0,0,0,0.05);
    border: 1px solid var(--border-color);
    border-radius: 18px;
    padding: 3px;
    gap: 3px;
}
body.dark-mode .mapa-controls { background: rgba(255,255,255,0.05); }
.mapa-metric-btn {
    border: none;
    background: transparent;
    color: var(--text-color);
    opacity: 0.72;
    font-size: 0.76rem;
    font-weight: 600;
    padding: 5px 12px;
    border-radius: 15px;
    cursor: pointer;
    transition: all 0.2s;
}
.mapa-metric-btn.active {
    background: var(--accent-color);
    color: #fff;
    opacity: 1;
}
.mapa-bi-layout {
    display: grid;
    grid-template-columns: 1.35fr 1fr;
    gap: 20px;
    align-items: stretch;
}
.mapa-bi-canvas-wrap {
    position: relative;
    background: rgba(0,0,0,0.02);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 8px 10px 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 290px;
    overflow: hidden;
    user-select: none;
}
body.dark-mode .mapa-bi-canvas-wrap { background: rgba(15, 23, 42, 0.35); }
.mapa-bi-layout.mapa-bi-compact {
    grid-template-columns: 1.25fr 0.95fr;
    gap: 12px;
}
.mapa-bi-compact .mapa-svg-brasil {
    max-width: 100%;
    max-height: 280px;
}
.mapa-bi-compact .mapa-bi-sidebar {
    min-height: 290px;
    max-height: 325px;
    padding: 10px;
}
.mapa-zoom-controls {
    position: absolute;
    top: 8px;
    right: 8px;
    z-index: 10;
    display: flex;
    align-items: center;
    gap: 3px;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 3px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.12);
}
.mapa-zoom-btn {
    width: 24px;
    height: 24px;
    border: none;
    border-radius: 5px;
    background: rgba(0,0,0,0.05);
    color: var(--text-color);
    font-weight: 700;
    font-size: 0.9rem;
    line-height: 1;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.15s;
}
body.dark-mode .mapa-zoom-btn { background: rgba(255,255,255,0.08); }
.mapa-zoom-btn:hover { background: var(--accent-color); color: #fff; }
.mapa-zoom-label {
    font-size: 0.68rem;
    font-weight: 700;
    padding: 0 5px;
    opacity: 0.75;
    min-width: 36px;
    text-align: center;
}
.mapa-svg-brasil {
    width: 100%;
    max-width: 440px;
    height: auto;
    max-height: 350px;
    display: block;
    cursor: grab;
}
.mapa-svg-brasil:active { cursor: grabbing; }
.mapa-estado-path {
    cursor: pointer;
    transition: opacity 0.15s ease, filter 0.15s ease;
}
.mapa-estado-path:hover {
    filter: brightness(1.15);
    opacity: 0.92;
}
.mapa-cidade-dot {
    cursor: pointer;
    transition: transform 0.15s ease, filter 0.15s ease;
    transform-box: fill-box;
    transform-origin: center;
}
.mapa-cidade-dot:hover {
    transform: scale(1.35);
    filter: brightness(1.15);
}
.mapa-tooltip {
    position: absolute;
    z-index: 20;
    pointer-events: none;
    background: rgba(15, 23, 42, 0.95);
    color: #f8fafc;
    border: 1px solid rgba(148, 163, 184, 0.25);
    border-radius: 8px;
    padding: 9px 12px;
    min-width: 195px;
    font-size: 0.78rem;
    box-shadow: 0 8px 20px rgba(0,0,0,0.3);
}
.mapa-tip-title { font-weight: 700; font-size: 0.85rem; margin-bottom: 5px; color: #fff; }
.mapa-tip-row { display: flex; justify-content: space-between; gap: 10px; margin-bottom: 2px; }
.mapa-tip-sub { opacity: 0.7; font-size: 0.74rem; }
.mapa-tip-hint { margin-top: 5px; padding-top: 4px; border-top: 1px solid rgba(255,255,255,0.12); font-size: 0.7rem; color: #38bdf8; }
.mapa-legenda {
    position: absolute;
    bottom: 8px;
    left: 12px;
    right: 12px;
    display: flex;
    justify-content: center;
    gap: 14px;
    flex-wrap: wrap;
    font-size: 0.72rem;
    opacity: 0.85;
}
.mapa-leg-item { display: inline-flex; align-items: center; gap: 5px; }
.mapa-leg-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.mapa-bi-sidebar {
    display: flex;
    flex-direction: column;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 12px;
    min-height: 360px;
    max-height: 400px;
}
.mapa-rank-tabs {
    display: flex;
    gap: 6px;
    margin-bottom: 10px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 8px;
}
.mapa-rank-tab {
    flex: 1;
    border: none;
    background: rgba(0,0,0,0.04);
    color: var(--text-color);
    font-size: 0.78rem;
    font-weight: 700;
    padding: 6px 10px;
    border-radius: 6px;
    cursor: pointer;
    opacity: 0.72;
    transition: all 0.2s;
}
body.dark-mode .mapa-rank-tab { background: rgba(255,255,255,0.05); }
.mapa-rank-tab.active {
    background: var(--accent-color);
    color: #fff;
    opacity: 1;
}
.mapa-ranking-lista {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding-right: 5px;
}
.mapa-ranking-lista::-webkit-scrollbar { width: 8px; height: 8px; }
.mapa-ranking-lista::-webkit-scrollbar-track { background: var(--bg-color); border-radius: 4px; }
.mapa-ranking-lista::-webkit-scrollbar-thumb { background: var(--accent-color); border-radius: 4px; }
.mapa-ranking-lista::-webkit-scrollbar-thumb:hover { filter: brightness(1.15); }
.dash-table-scroll-box {
    overflow: auto !important;
    height: 350px;
    max-height: 350px;
    padding-top: 0 !important;
    padding-right: 10px !important;
}
.dash-table-scroll-box::-webkit-scrollbar { width: 8px; height: 8px; }
.dash-table-scroll-box::-webkit-scrollbar-track { background: var(--bg-color); border-radius: 4px; }
.dash-table-scroll-box::-webkit-scrollbar-thumb { background: var(--accent-color); border-radius: 4px; }
.dash-table-scroll-box::-webkit-scrollbar-thumb:hover { filter: brightness(1.15); }
.dash-table-scroll-box::-webkit-scrollbar-corner { background: var(--bg-color); }
.mapa-rank-item {
    padding: 8px 10px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    cursor: pointer;
    transition: background-color 0.15s, border-color 0.15s;
}
.mapa-rank-item:hover {
    background: rgba(52, 152, 219, 0.09);
    border-color: rgba(52, 152, 219, 0.4);
}
.mapa-rank-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 0.82rem; margin-bottom: 5px; }
.mapa-rank-name { font-weight: 600; display: flex; align-items: center; gap: 5px; }
.mapa-uf-pill {
    display: inline-block;
    background: rgba(37, 99, 235, 0.14);
    color: #2563eb;
    font-size: 0.68rem;
    font-weight: 800;
    padding: 1px 5px;
    border-radius: 4px;
}
body.dark-mode .mapa-uf-pill { background: rgba(56, 189, 248, 0.18); color: #38bdf8; }
.mapa-rank-metrics { font-size: 0.76rem; opacity: 0.88; white-space: nowrap; }
.mapa-rank-bar-bg { height: 5px; border-radius: 3px; background: rgba(0,0,0,0.08); overflow: hidden; margin-bottom: 4px; }
body.dark-mode .mapa-rank-bar-bg { background: rgba(255,255,255,0.08); }
.mapa-rank-bar-fill { height: 100%; border-radius: 3px; background: linear-gradient(90deg, #3b82f6, #10b981); }
.mapa-rank-bar-cid { background: linear-gradient(90deg, #f59e0b, #10b981); }
.mapa-rank-sub { font-size: 0.7rem; opacity: 0.68; }
@media (max-width: 1280px) {
    .mapa-bi-layout.mapa-bi-compact { grid-template-columns: 1fr; }
}
@media (max-width: 960px) {
    .mapa-bi-layout { grid-template-columns: 1fr; }
}
/* ========== DASHBOARD MODERNO ========== */
/* ========== DASHBOARD EXECUTIVO MODERNO ========== */
.dash-exec-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-color);
}
.dash-exec-title h2 {
    margin: 0;
    font-size: 1.35rem;
    font-weight: 800;
    letter-spacing: -0.3px;
    display: flex;
    align-items: center;
    gap: 10px;
}
.dash-exec-title p {
    margin: 4px 0 0;
    font-size: 0.85rem;
    opacity: 0.75;
}
.dash-exec-controls {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}
.periodo-selector {
    display: inline-flex;
    background: rgba(0,0,0,0.04);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 3px;
    gap: 2px;
}
body.dark-mode .periodo-selector {
    background: rgba(255,255,255,0.05);
}
.btn-periodo {
    border: none;
    background: transparent;
    color: var(--text-color);
    font-size: 0.76rem;
    font-weight: 600;
    padding: 5px 12px;
    border-radius: 16px;
    cursor: pointer;
    transition: all 0.2s ease;
    opacity: 0.75;
}
.btn-periodo:hover {
    opacity: 1;
    background: rgba(0,0,0,0.05);
}
body.dark-mode .btn-periodo:hover {
    background: rgba(255,255,255,0.08);
}
.btn-periodo.active {
    background: var(--accent-color) !important;
    color: #fff !important;
    opacity: 1;
    box-shadow: 0 2px 8px rgba(52, 152, 219, 0.35);
}
.periodo-select-ano {
    height: 34px;
    padding: 0 10px;
    border-radius: 18px;
    border: 1px solid var(--border-color);
    background: var(--card-bg);
    color: var(--text-color);
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    outline: none;
}
.periodo-range-group {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 3px 6px 3px 10px;
}
.periodo-date-input {
    border: none;
    background: transparent;
    color: var(--text-color);
    font-size: 0.76rem;
    font-weight: 600;
    outline: none;
    width: 118px;
}
.periodo-range-sep {
    font-size: 0.74rem;
    opacity: 0.65;
    font-weight: 600;
}
.btn-periodo-apply {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    border: none;
    background: var(--accent-color);
    color: #fff;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 5px 11px;
    border-radius: 15px;
    cursor: pointer;
    transition: opacity 0.2s ease;
}
.btn-periodo-apply:hover {
    opacity: 0.9;
}
.btn-periodo-clear {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border: none;
    border-radius: 50%;
    background: rgba(239, 68, 68, 0.14);
    color: #ef4444;
    cursor: pointer;
}
.btn-refresh {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid var(--border-color);
    background: var(--card-bg);
    color: var(--text-color);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
}
.btn-refresh:hover {
    background: rgba(52, 152, 219, 0.12);
    color: var(--accent-color);
    border-color: var(--accent-color);
}
.btn-refresh.spinning .material-icons {
    animation: spin 0.8s linear infinite;
}

.dash-header {
    display: flex;
    flex-direction: row;
    justify-content: center;
    align-items: center;
    margin-bottom: 20px;
    gap: 15px;
    flex-wrap: wrap;
    position: relative;
}
.dash-tabs {
    display: flex;
    gap: 4px;
    background: var(--card-bg);
    border-radius: 10px;
    padding: 4px;
    border: 1px solid var(--border-color);
    cursor: default;
}
.dash-tab {
    padding: 10px 26px;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-color);
    opacity: 0.55;
    text-decoration: none;
    transition: 0.2s;
    white-space: nowrap;
    cursor: pointer;
    user-select: none;
}
.dash-tab:hover {
    opacity: 0.85;
    background: rgba(52,152,219,0.08);
}
.dash-tab.active {
    opacity: 1;
    background: var(--accent-color);
    color: #fff;
}
body.dark-mode .dash-tab.active {
    color: #fff;
}

/* Tabs de filtro para páginas (Orçamentos, Serviços) */
.orc-tabs {
    display: flex;
    gap: 4px;
    background: var(--card-bg);
    border-radius: 10px;
    padding: 4px;
    border: 1px solid var(--border-color);
    cursor: default;
    justify-content: center;
}

/* CONTAINER DE NAVEGAÇÃO DE PROPOSTAS NA OPERAÇÃO COM SCROLL HORIZONTAL */
.operacao-tabs-container {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 6px 10px;
    margin-top: 8px;
    margin-bottom: 14px;
    flex-shrink: 0;
    overflow-x: auto;
    overflow-y: hidden;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
}

.operacao-tabs-container::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

.operacao-tabs-container::-webkit-scrollbar-track {
    background: var(--bg-color);
    border-radius: 4px;
}

.operacao-tabs-container::-webkit-scrollbar-thumb {
    background: var(--accent-color);
    border-radius: 4px;
}

.operacao-tabs-container::-webkit-scrollbar-thumb:hover {
    filter: brightness(1.15);
}

.operacao-tabs-container .orc-tab {
    flex-shrink: 0;
}
.orc-tab {
    padding: 8px 20px;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-color);
    opacity: 0.55;
    text-decoration: none;
    transition: 0.2s;
    white-space: nowrap;
    cursor: pointer;
    user-select: none;
}
.orc-tab:hover {
    opacity: 0.85;
    background: rgba(52,152,219,0.08);
}
.orc-tab.active {
    opacity: 1;
    background: var(--accent-color);
    color: #fff;
}
body.dark-mode .orc-tab.active {
    color: #fff;
}

.badge-tab {
    display: inline-block;
    background: rgba(255,255,255,0.25);
    border-radius: 10px;
    padding: 0 8px;
    font-size: 0.75rem;
    margin-left: 4px;
    line-height: 1.6;
}

/* Dropdown inline de status nas tabelas */
.status-dropdown {
    padding: 4px 8px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    background: var(--card-bg);
    color: var(--text-color);
    font-size: 0.8rem;
    cursor: pointer;
    outline: none;
    min-width: 110px;
}
.status-dropdown:focus {
    border-color: var(--accent-color);
}

/* Icone de observação com badge de não lida */
.obs-icon {
    position: relative;
    cursor: pointer;
    font-size: 20px;
    vertical-align: middle;
}
.obs-icon.obs-nao-lida::after {
    content: '';
    position: absolute;
    top: -2px;
    right: -4px;
    width: 10px;
    height: 10px;
    background: #e74c3c;
    border-radius: 50%;
    border: 2px solid var(--card-bg);
}

/* Badges de status */
.badge-status.aprovado { background: #2ecc71; color: #fff; padding: 3px 10px; border-radius: 12px; font-size: 0.75rem; font-weight: 600; }
.badge-status.negociando { background: #f39c12; color: #fff; padding: 3px 10px; border-radius: 12px; font-size: 0.75rem; font-weight: 600; }
.badge-status.declinado { background: #e74c3c; color: #fff; padding: 3px 10px; border-radius: 12px; font-size: 0.75rem; font-weight: 600; }
.badge-status.vencido { background: #95a5a6; color: #fff; padding: 3px 10px; border-radius: 12px; font-size: 0.75rem; font-weight: 600; }
.badge-status.auditado, .badge-status.revisado { background: rgba(39, 174, 96, 0.15); color: #27ae60; border: 1px solid rgba(39, 174, 96, 0.3); padding: 3px 10px; border-radius: 12px; font-size: 0.75rem; font-weight: 600; }

/* Seções de conteúdo das abas */
.dash-section { display: none; }
.dash-section.active { display: block; flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; padding: 8px 12px 6px 2px; }
.dash-section::-webkit-scrollbar { width: 8px; height: 8px; }
.dash-section::-webkit-scrollbar-track { background: var(--bg-color); border-radius: 4px; }
.dash-section::-webkit-scrollbar-thumb { background: var(--accent-color); border-radius: 4px; opacity: 0.7; }
.dash-section::-webkit-scrollbar-thumb:hover { filter: brightness(1.15); }
.dash-section::-webkit-scrollbar-corner { background: var(--bg-color); }

/* Tabela de materiais no dashboard */
.dash-table-sm {
    font-size: 0.78rem;
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}
.dash-table-sm th {
    text-align: left;
    padding: 12px 6px 8px;
    border-bottom: 2px solid var(--border-color);
    color: #64748b;
    font-weight: 600;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background-color: var(--card-bg);
    position: sticky;
    top: 0;
    z-index: 5;
    box-shadow: 0 2px 4px -1px rgba(0,0,0,0.12);
}
body.dark-mode .dash-table-sm th,
body.dark-mode .dash-table th {
    color: #94a3b8;
}
.dash-table-sm td {
    padding: 8px 6px;
    border-bottom: 1px solid var(--border-color);
    opacity: 0.85;
}

/* Colunas ordenáveis */
th[onclick] {
    cursor: pointer;
    user-select: none;
}
.custom-table th.sorted-asc::after,
.dash-table th.sorted-asc::after,
.dash-table-sm th.sorted-asc::after {
    content: " ▲";
    opacity: 0.7;
    font-size: 0.75em;
}
.custom-table th.sorted-desc::after,
.dash-table th.sorted-desc::after,
.dash-table-sm th.sorted-desc::after {
    content: " ▼";
    opacity: 0.7;
    font-size: 0.75em;
}

/* KPI clicável */
.stat-card[data-status] {
    cursor: pointer;
}
.stat-card.active {
    box-shadow: inset 0 0 0 2px var(--accent-color), 0 6px 16px rgba(52, 152, 219, 0.24);
    transform: translateY(-2px);
    z-index: 2;
}
body.dark-mode .stat-card.active {
    box-shadow: inset 0 0 0 2px var(--accent-color), 0 6px 18px rgba(0, 0, 0, 0.45);
}
.stats-grid.filter-active .stat-card:not(.active) {
    opacity: 0.38;
    filter: saturate(0.35);
    transition: opacity 0.25s ease, filter 0.25s ease;
}
.stats-grid.filter-active .stat-card.active {
    box-shadow: inset 0 0 0 2px var(--accent-color), 0 8px 22px rgba(0, 0, 0, 0.28);
    transform: translateY(-2px);
}
body.dark-mode .stats-grid.filter-active .stat-card.active {
    box-shadow: inset 0 0 0 2px var(--accent-color), 0 8px 24px rgba(0, 0, 0, 0.52);
}

/* Grid de Cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 14px;
    margin-bottom: 22px;
    width: 100%;
    box-sizing: border-box;
}

/* Card Individual Moderno (SaaS / Fintech) */
.stat-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    border-radius: 12px;
    background: var(--card-bg, #fff);
    border: 1px solid var(--border-color);
    box-shadow: 0 3px 12px rgba(0,0,0,0.03);
    cursor: default;
    transition: transform 0.22s ease, box-shadow 0.22s ease, border-color 0.22s ease;
    position: relative;
    overflow: hidden;
    min-width: 0;
    box-sizing: border-box;
}
.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 24px rgba(0,0,0,0.08);
    border-color: rgba(52, 152, 219, 0.4);
}

.stat-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 12px;
    flex-shrink: 0;
    transition: transform 0.2s ease;
}
.stat-card:hover .stat-icon {
    transform: scale(1.08);
}
.stat-icon .material-icons {
    font-size: 22px;
}

.stat-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
    flex: 1;
}
.stat-value {
    font-size: clamp(0.92rem, 1.05vw, 1.16rem);
    font-weight: 800;
    line-height: 1.25;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--text-color);
    letter-spacing: -0.3px;
    font-variant-numeric: tabular-nums;
}
.stat-label {
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    opacity: 0.7;
    margin-top: 2px;
    color: var(--text-color);
    display: flex;
    align-items: center;
    gap: 4px;
}

/* PALETA TEMÁTICA DE CÁPSULAS TRANSLÚCIDAS */
.stat-card[data-color="azul"] .stat-icon         { background: rgba(52, 152, 219, 0.12); color: #2980b9; }
.stat-card[data-color="azul"]                    { border-left: 4px solid #3498db; }

.stat-card[data-color="verde"] .stat-icon        { background: rgba(39, 174, 96, 0.12); color: #27ae60; }
.stat-card[data-color="verde"]                   { border-left: 4px solid #2ecc71; }

.stat-card[data-color="laranja"] .stat-icon      { background: rgba(243, 156, 18, 0.12); color: #d35400; }
.stat-card[data-color="laranja"]                 { border-left: 4px solid #f39c12; }

.stat-card[data-color="vermelho"] .stat-icon     { background: rgba(231, 76, 60, 0.12); color: #c0392b; }
.stat-card[data-color="vermelho"]                { border-left: 4px solid #e74c3c; }

.stat-card[data-color="roxo"] .stat-icon         { background: rgba(155, 89, 182, 0.12); color: #8e44ad; }
.stat-card[data-color="roxo"]                    { border-left: 4px solid #9b59b6; }

.stat-card[data-color="verde-agua"] .stat-icon   { background: rgba(26, 188, 156, 0.12); color: #16a085; }
.stat-card[data-color="verde-agua"]              { border-left: 4px solid #1abc9c; }

.stat-card[data-color="cinza"] .stat-icon        { background: rgba(108, 117, 125, 0.12); color: #6c757d; }
.stat-card[data-color="cinza"]                   { border-left: 4px solid #7f8c8d; }

.stat-card[data-color="azul-escuro"] .stat-icon  { background: rgba(44, 62, 80, 0.12); color: #2c3e50; }
.stat-card[data-color="azul-escuro"]             { border-left: 4px solid #34495e; }

.stat-card[data-color="laranja-escuro"] .stat-icon { background: rgba(211, 84, 0, 0.12); color: #d35400; }
.stat-card[data-color="laranja-escuro"]            { border-left: 4px solid #e67e22; }

/* HERO CARD DE DESTAQUE (LUCRO) */
.stat-card-hero {
    background: linear-gradient(135deg, #065f46 0%, #047857 50%, #059669 100%) !important;
    border: 1px solid rgba(16, 185, 129, 0.3) !important;
    box-shadow: 0 8px 24px rgba(5, 150, 105, 0.22) !important;
    color: #ffffff !important;
}
.stat-card-hero .stat-icon {
    background: rgba(255, 255, 255, 0.2) !important;
    color: #a7f3d0 !important;
}
.stat-card-hero .stat-value {
    color: #ffffff !important;
    font-size: clamp(0.94rem, 1.08vw, 1.2rem);
}
.stat-card-hero .stat-label {
    color: rgba(255, 255, 255, 0.88) !important;
}
.stat-badge-margem {
    background: rgba(255, 255, 255, 0.25);
    color: #ffffff;
    font-size: 0.72rem;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 12px;
    margin-left: 4px;
}

/* BADGES DE EXPIRAÇÃO INTELIGENTES */
.badge-expira-urgente {
    background: rgba(231, 76, 60, 0.15);
    color: #c0392b;
    border: 1px solid rgba(231, 76, 60, 0.3);
    padding: 2px 7px;
    border-radius: 5px;
    font-weight: 700;
    font-size: 0.74rem;
    display: inline-flex;
    align-items: center;
    gap: 3px;
}
.badge-expira-atencao {
    background: rgba(243, 156, 18, 0.15);
    color: #d35400;
    border: 1px solid rgba(243, 156, 18, 0.3);
    padding: 2px 7px;
    border-radius: 5px;
    font-weight: 700;
    font-size: 0.74rem;
    display: inline-flex;
    align-items: center;
    gap: 3px;
}
.badge-expira-ok {
    background: rgba(52, 152, 219, 0.12);
    color: #2980b9;
    border: 1px solid rgba(52, 152, 219, 0.25);
    padding: 2px 7px;
    border-radius: 5px;
    font-weight: 600;
    font-size: 0.74rem;
    display: inline-flex;
    align-items: center;
    gap: 3px;
}
body.dark-mode .badge-expira-urgente { color: #f87171; border-color: rgba(248, 113, 113, 0.35); }
body.dark-mode .badge-expira-atencao { color: #fbbf24; border-color: rgba(251, 191, 36, 0.35); }
body.dark-mode .badge-expira-ok { color: #60a5fa; border-color: rgba(96, 165, 250, 0.35); }

/* Linha inferior: Recentes + Indicadores */
.dash-bottom {
    display: grid;
    grid-template-columns: 1.5fr 1fr;
    gap: 20px;
}

.dash-card {
    background: var(--card-bg);
    border-radius: 12px;
    border: 1px solid var(--border-color);
    box-shadow: 0 4px 16px rgba(15, 23, 42, 0.05);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
body.dark-mode .dash-card {
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.28);
}
.dash-card-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
}
.dash-card-header .material-icons {
    font-size: 20px;
    opacity: 0.7;
}
.dash-card-header h3 {
    font-size: 0.95rem;
    font-weight: 600;
    margin: 0;
}
.dash-card-body {
    padding: 15px 20px;
    flex: 1;
    overflow: auto;
}
.dash-card-body::-webkit-scrollbar { width: 8px; height: 8px; }
.dash-card-body::-webkit-scrollbar-track { background: var(--bg-color); border-radius: 4px; }
.dash-card-body::-webkit-scrollbar-thumb { background: var(--accent-color); border-radius: 4px; opacity: 0.7; }
.dash-card-body::-webkit-scrollbar-thumb:hover { filter: brightness(1.15); }
.dash-card-body::-webkit-scrollbar-corner { background: var(--bg-color); }

/* Tabela do dashboard */
.dash-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.85rem;
}
.dash-table th {
    text-align: center;
    padding: 12px 6px 10px;
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #64748b;
    border-bottom: 1px solid var(--border-color);
    background-color: var(--card-bg);
    position: sticky;
    top: 0;
    z-index: 5;
    box-shadow: 0 2px 4px -1px rgba(0,0,0,0.12);
}
.dash-table td {
    padding: 10px 6px;
    border-bottom: 1px solid var(--border-color);
    text-align: center;
}
.dash-table td.text-left { text-align: left; }
.dash-table tbody tr:hover {
    background: rgba(52,152,219,0.04);
}
.dash-table .badge-status {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
}
.badge-status.aprovado  { background: rgba(46,204,113,0.15); color: #2ecc71; }
.badge-status.pendente  { background: rgba(241,196,15,0.15); color: #f39c12; }
.badge-status.cancelado { background: rgba(231,76,60,0.15);  color: #e74c3c; }
.badge-status.vencido   { background: rgba(149,165,166,0.15); color: #95a5a6; }

/* Indicadores */
.indicador {
    margin-bottom: 18px;
}
.indicador:last-child { margin-bottom: 0; }
.indicador-label {
    display: block;
    font-size: 0.78rem;
    opacity: 0.7;
    margin-bottom: 6px;
}
.indicador-valor {
    font-weight: 700;
    font-size: 1rem;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: rgba(0,0,0,0.08);
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 4px;
}
.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #2ecc71, #1abc9c);
    border-radius: 10px;
    transition: width 0.8s ease;
}
body.dark-mode .progress-bar { background: rgba(255,255,255,0.1); }

/* Footer do card de ações */
.dash-card-footer {
    display: flex;
    gap: 10px;
    padding: 15px 20px;
    border-top: 1px solid var(--border-color);
}

/* Charts row */
.charts-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 25px;
}
.charts-row-3 {
    grid-template-columns: 1fr 1fr 1fr;
}
.charts-row-4 {
    grid-template-columns: 1fr 1fr 1fr 1fr;
}
.charts-row-2-1 {
    grid-template-columns: 2fr 1fr;
}
@media (max-width: 1200px) and (min-width: 769px) {
    .sidebar { width: 70px; }
    .sidebar .sidebar-header { justify-content: center; padding: 0; }
    .sidebar .nav-links li a span:not(.material-icons) { display: none; }
    .sidebar .sidebar-header h3 { display: none; }
    .sidebar:not(.collapsed) { width: 250px; box-shadow: 4px 0 30px rgba(0,0,0,0.4); }
    .sidebar:not(.collapsed) .sidebar-header { justify-content: space-between; padding: 16px 20px; }
    .sidebar:not(.collapsed) .sidebar-header h3 { display: block; }
    .sidebar:not(.collapsed) .nav-links li a span:not(.material-icons) { display: inline; }
    .sidebar .sidebar-chat-footer { padding: 10px 8px 14px; }
    .sidebar .sidebar-chat-btn { justify-content: center; padding: 10px 0; }
    .sidebar .sidebar-chat-label { display: none; }
    .sidebar:not(.collapsed) .sidebar-chat-footer { padding: 10px 12px 14px; }
    .sidebar:not(.collapsed) .sidebar-chat-btn { justify-content: flex-start; padding: 10px 14px; }
    .sidebar:not(.collapsed) .sidebar-chat-label { display: inline; }
    .content { margin-left: 70px; width: calc(100% - 70px); }

    .page-container { padding: 18px 20px; }
    .charts-row-4 { grid-template-columns: 1fr 1fr; }
    .stats-grid { grid-template-columns: repeat(auto-fit, minmax(175px, 1fr)); gap: 10px; }
    .stat-card { padding: 12px 14px; }
    .stat-value { font-size: clamp(0.86rem, 1.25vw, 1.05rem); }
    .stat-label { font-size: 0.66rem; }
    .stat-icon { width: 34px; height: 34px; }
    .stat-icon .material-icons { font-size: 18px; }
    .chart-body { height: 225px; }
    .charts-row-4 .chart-body { height: 200px; }
    .filter-input { width: 140px; font-size: 0.8rem; }
    .filter-input-wide { width: 185px; }
    .dash-tab { padding: 8px 16px; font-size: 0.84rem; }
    .orc-tab { padding: 6px 12px; font-size: 0.78rem; }
}
.chart-card .dash-card-header {
    min-height: 48px;
}
.chart-body {
    padding: 10px 15px 15px;
    position: relative;
    height: 260px;
}
.charts-row-4 .chart-body {
    height: 220px;
}
.chart-body canvas {
    width: 100% !important;
    height: 100% !important;
    max-height: 240px;
}

/* Tabela de Expiração */
.expiring-vencido  { color: #e74c3c; font-weight: 700; }
.expiring-alerta   { color: #e67e22; font-weight: 600; }
.expiring-ok       { color: #27ae60; }
.badge-expiring {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.68rem;
    font-weight: 700;
}
.badge-expiring.vencido  { background: rgba(231,76,60,0.15); color: #e74c3c; }
.badge-expiring.alerta   { background: rgba(230,126,34,0.15); color: #e67e22; }
.badge-expiring.ok       { background: rgba(39,174,96,0.15);  color: #27ae60; }

/* Responsivo - Tablet (até 1024px) */
@media (max-width: 1024px) {
    .dash-bottom { grid-template-columns: 1fr; }
    .charts-row-4 { grid-template-columns: 1fr 1fr; }
    .form-row { flex-wrap: wrap; }
    .form-row > * { flex: 1 1 100%; }
    .dash-card-header h3 { font-size: 0.86rem; }
    .dash-table { font-size: 0.76rem; }
    .dash-table-sm { font-size: 0.74rem; }
    .custom-table th, .custom-table td { padding: 7px 6px; font-size: 0.74rem; }
}

/* Responsivo - Telas Ultrawide / 2.5K (2560x1080, 2560x1440) */
@media (min-width: 2000px) {
    .page-container { padding: 28px 44px; max-width: 2360px; margin: 0 auto; }
    .stats-grid { grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 16px; }
    #statsGridFinanceiro { grid-template-columns: repeat(5, minmax(0, 1fr)); }
    .chart-body { height: 290px; }
}

/* Responsivo - Notebook (1366x768) */
@media (max-width: 1440px) and (min-width: 1201px) {
    .page-container { padding: 18px 22px; }
    .stats-grid { grid-template-columns: repeat(auto-fit, minmax(175px, 1fr)); gap: 10px; margin-bottom: 18px; }
    .stat-card { padding: 12px 14px; gap: 10px; }
    .stat-icon { width: 38px; height: 38px; }
    .chart-body { height: 235px; }
    .filter-input { width: 145px; }
    .filter-input-wide { width: 195px; }
}

/* Responsivo - Tablet & 1024x768 */
@media (max-width: 1024px) {
    .charts-row,
    .charts-row-3,
    .charts-row-2-1 {
        grid-template-columns: 1fr;
    }
    .page-toolbar { gap: 8px; }
    .page-toolbar .orc-tabs { margin-left: 0; width: 100%; overflow-x: auto; justify-content: flex-start; }
}

/* Responsivo - Mobile (Android & iOS) */
@media (max-width: 768px) {
    .btn-mobile-menu { display: inline-flex; }
    .sidebar {
        width: 260px;
        transform: translateX(-100%);
        box-shadow: 8px 0 32px rgba(0,0,0,0.45);
    }
    .sidebar.mobile-open {
        transform: translateX(0);
    }
    .sidebar.mobile-open .sidebar-header { justify-content: space-between; padding: 16px 20px; }
    .sidebar.mobile-open .sidebar-header h3 { display: block; }
    .sidebar.mobile-open .nav-links li a { padding: 14px 22px; }
    .sidebar.mobile-open .nav-links li a span:not(.material-icons) { display: inline; }
    .content,
    .sidebar.collapsed ~ .content {
        margin-left: 0 !important;
        width: 100% !important;
    }
    .page-container { padding: 12px 14px; }
    .page-exec-header { gap: 10px; margin-bottom: 12px; padding-bottom: 12px; }
    .page-exec-title h2 { font-size: 1.08rem; }
    .page-exec-actions { width: 100%; }
    .page-exec-actions .btn-toolbar,
    .page-exec-actions .btn-add { flex: 1 1 auto; justify-content: center; }
    .page-toolbar .filters-container { width: 100%; }
    .page-toolbar .filter-input,
    .page-toolbar .filter-input-wide,
    .page-toolbar .filter-select-ano { flex: 1 1 140px; width: auto; font-size: 16px; }
    .topbar { padding: 0 12px; height: 54px; min-height: 54px; }
    .topbar-right { gap: 8px; }
    .topbar-session-timer { height: 26px; padding: 0 8px; font-size: 0.72rem; }
    .topbar-session-timer .material-icons { font-size: 14px; }
    .topbar-brand, .topbar-sep, .topbar-divider, .user-text-meta { display: none; }
    .topbar-title { font-size: 0.95rem; }
    .notif-dropdown-panel { width: 320px; right: -46px; }
    .dash-header { margin-bottom: 14px; flex-direction: column; gap: 10px; }
    .dash-tabs { width: 100%; overflow-x: auto; justify-content: flex-start; }
    .orc-tabs { width: 100%; overflow-x: auto; justify-content: flex-start; }
    .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
    .stat-card { padding: 10px; gap: 8px; }
    .stat-icon { width: 30px; height: 30px; }
    .stat-icon .material-icons { font-size: 16px; }
    .stat-value { font-size: 0.85rem; }
    .stat-label { font-size: 0.62rem; }
    .dash-card-header { padding: 12px 14px; }
    .dash-card-body { padding: 10px 12px; }
    .dash-table-scroll-box { height: 280px; max-height: 280px; }
    .chart-body { height: 210px; }
    .dash-table { font-size: 0.74rem; }
    .dash-table th, .dash-table td { padding: 6px 4px; }
    .dash-card-footer { padding: 12px 14px; flex-direction: column; gap: 8px; }
    .dash-card-footer .btn-add { width: 100%; justify-content: center; }
    .charts-row { gap: 12px; margin-bottom: 15px; }
    .dash-bottom { gap: 12px; }
    .form-row { flex-wrap: wrap; }
    .form-row > * { flex: 1 1 100%; }
    .card { padding: 14px; }
    .table-responsive { padding: 12px; -webkit-overflow-scrolling: touch; }
    .custom-table th, .custom-table td { padding: 7px 5px; font-size: 0.74rem; }
    .modal-content { padding: 16px; max-height: 92dvh; overflow-y: auto; }
    .login-card { padding: 28px 18px; }
    .login-card .avatar { width: 58px; height: 58px; }
    .login-input { padding: 10px 10px 10px 40px; font-size: 16px; }
    td[style*="display: flex"] { flex-wrap: wrap; justify-content: center; }
}

/* Responsivo - Mobile pequeno (<= 480px) */
@media (max-width: 480px) {
    .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
    .stat-card { padding: 8px 9px; gap: 6px; }
    .stat-icon { width: 26px; height: 26px; }
    .stat-icon .material-icons { font-size: 14px; }
    .stat-value { font-size: 0.78rem; }
    .stat-label { font-size: 0.56rem; }
    .page-container { padding: 10px; }
    .chart-body { height: 185px; }
    .card { padding: 10px; }
    .table-responsive { padding: 10px; }
    .custom-table th, .custom-table td { padding: 6px 4px; font-size: 0.68rem; }
    .modal-content { padding: 14px; }
    .modal-buttons { flex-direction: column; }
    .modal-buttons .btn { width: 100%; }
}

/* ===================================================
   MODAL DE OBSERVAÇÕES (REDESIGN MODERNO)
   =================================================== */
.modal-obs-backdrop {
    backdrop-filter: blur(4px);
    background-color: rgba(15, 23, 42, 0.65) !important;
    transition: all 0.25s ease;
}

.modal-obs-content {
    width: 600px !important;
    max-width: 94vw !important;
    padding: 0 !important;
    border-radius: 14px !important;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    max-height: 88vh;
    box-shadow: 0 20px 45px rgba(0, 0, 0, 0.35) !important;
    border: 1px solid var(--border-color);
    background-color: var(--card-bg);
    animation: obsModalPop 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes obsModalPop {
    from { opacity: 0; transform: scale(0.96) translateY(8px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

.obs-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 22px;
    border-bottom: 1px solid var(--border-color);
    background: var(--card-bg);
}

.obs-header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.obs-icon-badge {
    width: 42px;
    height: 42px;
    border-radius: 10px;
    background: rgba(52, 152, 219, 0.12);
    color: var(--accent-color);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: inset 0 0 0 1px rgba(52, 152, 219, 0.2);
}

.obs-icon-badge .material-icons {
    font-size: 22px;
}

.obs-modal-title {
    font-size: 1.15rem;
    font-weight: 700;
    margin: 0;
    color: var(--text-color);
    line-height: 1.2;
}

.obs-modal-subtitle {
    font-size: 0.8rem;
    color: var(--text-color);
    opacity: 0.65;
    margin: 3px 0 0;
}

.obs-close-btn {
    position: static !important;
    font-size: 26px !important;
    color: var(--text-color) !important;
    background: none;
    border: none;
    border-radius: 8px;
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0.6;
    transition: all 0.2s ease;
}

.obs-close-btn:hover {
    opacity: 1;
    background: rgba(128, 128, 128, 0.15);
}

.obs-timeline {
    flex: 1;
    overflow-y: auto;
    padding: 18px 22px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: rgba(0, 0, 0, 0.02);
    min-height: 200px;
    max-height: 380px;
}

body.dark-mode .obs-timeline {
    background: rgba(0, 0, 0, 0.18);
}

.obs-timeline::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
.obs-timeline::-webkit-scrollbar-track {
    background: var(--bg-color);
    border-radius: 4px;
}
.obs-timeline::-webkit-scrollbar-thumb {
    background: var(--accent-color);
    border-radius: 4px;
}
.obs-timeline::-webkit-scrollbar-thumb:hover {
    filter: brightness(1.15);
}

.obs-card {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    animation: obsItemFade 0.2s ease;
}

@keyframes obsItemFade {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

.obs-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #34495e;
    color: white;
    font-size: 0.8rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    text-transform: uppercase;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.15);
    user-select: none;
}

.obs-card.is-me .obs-avatar {
    background: linear-gradient(135deg, #3498db, #1d6fa5);
}

.obs-bubble {
    flex: 1;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 11px 14px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.03);
    position: relative;
    transition: border-color 0.2s;
}

.obs-card.is-me .obs-bubble {
    border-left: 3px solid var(--accent-color);
}

.obs-card:not(.is-me) .obs-bubble {
    border-left: 3px solid #2ecc71;
}

.obs-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 5px;
}

.obs-author {
    font-weight: 600;
    font-size: 0.82rem;
    color: var(--text-color);
    display: flex;
    align-items: center;
    gap: 6px;
}

.obs-badge-me {
    background: rgba(52, 152, 219, 0.15);
    color: var(--accent-color);
    font-size: 0.65rem;
    padding: 1px 6px;
    border-radius: 8px;
    font-weight: 700;
}

.obs-meta-right {
    display: flex;
    align-items: center;
    gap: 6px;
}

.obs-date {
    opacity: 0.55;
    font-size: 0.74rem;
}

.obs-status-pill {
    font-size: 0.65rem;
    padding: 1px 6px;
    border-radius: 8px;
    font-weight: 600;
}
.obs-status-pill.lida {
    background: rgba(46, 204, 113, 0.15);
    color: #2ecc71;
}
.obs-status-pill.nova {
    background: rgba(243, 156, 18, 0.15);
    color: #f39c12;
}
.obs-status-pill.enviada {
    background: rgba(148, 163, 184, 0.14);
    color: #94a3b8;
    display: inline-flex;
    align-items: center;
    gap: 3px;
}
.obs-status-pill.visualizada {
    background: rgba(56, 189, 248, 0.15);
    color: #38bdf8;
    display: inline-flex;
    align-items: center;
    gap: 3px;
}
.wa-check-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    vertical-align: middle;
    flex-shrink: 0;
}
.wa-read-count {
    font-size: 0.65rem;
    font-weight: 700;
    color: #38bdf8;
    margin-left: 2px;
    flex-shrink: 0;
}

.obs-mensagem {
    font-size: 0.88rem;
    line-height: 1.5;
    color: var(--text-color);
    word-break: break-word;
    white-space: pre-wrap;
}

.obs-actions {
    display: flex;
    gap: 2px;
    margin-left: 4px;
}

.obs-btn-action {
    background: none;
    border: none;
    cursor: pointer;
    opacity: 0.5;
    padding: 3px;
    border-radius: 4px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--text-color);
    transition: all 0.15s ease;
}

.obs-btn-action:hover {
    opacity: 1;
    background: rgba(128, 128, 128, 0.15);
}

.obs-btn-action.delete:hover {
    color: #e74c3c;
    background: rgba(231, 76, 60, 0.12);
}

.obs-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    text-align: center;
}

.obs-empty .material-icons {
    font-size: 46px;
    color: var(--accent-color);
    opacity: 0.4;
    margin-bottom: 8px;
}

.obs-empty-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-color);
    margin-bottom: 3px;
}

.obs-empty-sub {
    font-size: 0.78rem;
    color: var(--text-color);
    opacity: 0.6;
}

.obs-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 30px;
    opacity: 0.6;
    font-size: 0.88rem;
}

.obs-spin {
    animation: obsSpin 1s linear infinite;
}

@keyframes obsSpin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.obs-composer {
    padding: 14px 22px 16px;
    border-top: 1px solid var(--border-color);
    background: var(--card-bg);
}

.obs-textarea-wrapper {
    margin-bottom: 10px;
}

.obs-textarea {
    width: 100%;
    min-height: 60px;
    max-height: 140px;
    padding: 10px 14px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-color);
    color: var(--text-color);
    font-size: 0.88rem;
    resize: vertical;
    transition: border-color 0.2s, box-shadow 0.2s;
    font-family: inherit;
    line-height: 1.4;
}

.obs-textarea:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.15);
}

.obs-composer-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.obs-btn-emoji {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background: var(--bg-color);
    color: var(--text-color);
    opacity: 0.85;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color 0.16s ease, border-color 0.16s ease, color 0.16s ease;
}
.obs-btn-emoji:hover,
.obs-btn-emoji.active {
    opacity: 1;
    color: var(--accent-color);
    border-color: var(--accent-color);
    background: rgba(52, 152, 219, 0.12);
}

.obs-emoji-picker {
    position: absolute;
    left: 22px;
    bottom: calc(100% - 4px);
    width: 310px;
    max-width: calc(100vw - 48px);
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: 0 14px 36px rgba(0, 0, 0, 0.3);
    z-index: 60;
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    animation: modalSlideIn 0.14s ease-out;
}
.obs-emoji-search-wrap {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 0 10px;
    height: 32px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background: var(--bg-color);
    color: var(--text-color);
}
.obs-emoji-search-wrap svg { opacity: 0.6; flex-shrink: 0; }
.obs-emoji-search {
    border: none;
    background: transparent;
    color: var(--text-color);
    font-size: 0.82rem;
    width: 100%;
    outline: none;
}
.obs-emoji-tabs {
    display: flex;
    gap: 4px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 6px;
}
.obs-emoji-tab {
    flex: 1;
    height: 30px;
    border: none;
    border-radius: 7px;
    background: transparent;
    color: var(--text-color);
    opacity: 0.6;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.15s ease, color 0.15s ease, opacity 0.15s ease;
}
.obs-emoji-tab:hover { opacity: 0.95; background: rgba(52, 152, 219, 0.08); }
.obs-emoji-tab.active {
    opacity: 1;
    color: var(--accent-color);
    background: rgba(52, 152, 219, 0.14);
}
.obs-emoji-grid {
    display: grid;
    grid-template-columns: repeat(8, minmax(0, 1fr));
    gap: 3px;
    max-height: 185px;
    overflow-y: auto;
    padding-right: 3px;
}
.obs-emoji-btn {
    border: none;
    background: transparent;
    border-radius: 7px;
    height: 33px;
    font-size: 1.18rem;
    line-height: 1;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.1s ease, background-color 0.14s ease;
}
.obs-emoji-btn:hover {
    background: rgba(52, 152, 219, 0.14);
    transform: scale(1.12);
}
.obs-emoji-empty {
    grid-column: 1 / -1;
    text-align: center;
    padding: 18px 8px;
    font-size: 0.8rem;
    opacity: 0.65;
}

/* =========================================================================
   CENTRAL DE CONVERSAS ESTILO WHATSAPP (#modalChatCentral)
   ========================================================================= */
.wa-modal-content {
    width: 980px !important;
    max-width: 95vw !important;
    height: 82vh;
    max-height: 720px;
    padding: 0 !important;
    overflow: hidden !important;
}
.wa-layout {
    display: flex;
    width: 100%;
    height: 100%;
    min-height: 0;
}
.wa-sidebar-pane {
    width: 340px;
    flex-shrink: 0;
    border-right: 1px solid var(--border-color);
    background: var(--card-bg);
    display: flex;
    flex-direction: column;
    min-height: 0;
}
.wa-sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-color);
    background: rgba(52, 152, 219, 0.06);
}
.wa-sidebar-title {
    display: flex;
    align-items: center;
    gap: 10px;
}
.wa-brand-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: linear-gradient(135deg, #3498db, #2563eb);
    color: #ffffff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.wa-sidebar-title h3 { margin: 0; font-size: 1rem; font-weight: 700; }
.wa-sidebar-title small { display: block; font-size: 0.74rem; opacity: 0.68; }
.wa-close-mobile-only { display: none; position: static; }
.wa-search-bar {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.wa-search-input-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    height: 35px;
    padding: 0 11px;
    border-radius: 9px;
    border: 1px solid var(--border-color);
    background: var(--bg-color);
}
.wa-search-input-wrap svg { opacity: 0.55; flex-shrink: 0; }
.wa-search-input-wrap input {
    width: 100%;
    border: none;
    background: transparent;
    color: var(--text-color);
    font-size: 0.84rem;
    outline: none;
}
.wa-filter-pills {
    display: flex;
    gap: 6px;
}
.wa-filter-pill {
    border: 1px solid var(--border-color);
    background: transparent;
    color: var(--text-color);
    opacity: 0.75;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 0.74rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
}
.wa-filter-pill:hover { opacity: 1; background: rgba(52, 152, 219, 0.08); }
.wa-filter-pill.active {
    opacity: 1;
    background: var(--accent-color);
    border-color: var(--accent-color);
    color: #ffffff;
}
.wa-conv-list {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 6px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.wa-conv-item {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 10px 10px;
    border-radius: 10px;
    border: 1px solid transparent;
    background: transparent;
    color: var(--text-color);
    text-align: left;
    width: 100%;
    cursor: pointer;
    transition: background-color 0.15s ease, border-color 0.15s ease;
}
.wa-conv-item:hover {
    background: rgba(52, 152, 219, 0.08);
}
.wa-conv-item.active {
    background: rgba(52, 152, 219, 0.15);
    border-color: rgba(52, 152, 219, 0.35);
}
.wa-conv-item.has-unread {
    background: rgba(34, 197, 94, 0.08);
    border-left: 3px solid #22c55e;
}
.wa-conv-item.has-unread .wa-conv-preview {
    opacity: 0.95;
    font-weight: 600;
}

/* Toast flutuante de nova mensagem de conversa */
.wa-toast-stack {
    position: fixed;
    right: 20px;
    bottom: 20px;
    z-index: 8800;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: 340px;
    width: calc(100vw - 32px);
    pointer-events: none;
}
.wa-chat-toast {
    pointer-events: auto;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 14px;
    border-radius: 12px;
    background: var(--card-bg);
    color: var(--text-color);
    border: 1px solid var(--border-color);
    border-left: 4px solid #22c55e;
    box-shadow: 0 14px 32px rgba(0, 0, 0, 0.28);
    cursor: pointer;
    animation: modalSlideIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    transition: transform 0.15s ease, opacity 0.25s ease;
}
.wa-chat-toast:hover { transform: translateY(-2px); }
.wa-toast-icon {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: rgba(34, 197, 94, 0.15);
    color: #22c55e;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.wa-toast-body { flex: 1; min-width: 0; }
.wa-toast-title { font-size: 0.82rem; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wa-toast-msg { font-size: 0.78rem; opacity: 0.84; margin-top: 2px; display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; word-break: break-word; }
.wa-toast-close {
    background: none;
    border: none;
    color: var(--text-color);
    opacity: 0.5;
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    padding: 0 2px;
}
.wa-toast-close:hover { opacity: 1; }
.wa-conv-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #2563eb, #3498db);
    color: #ffffff;
    font-size: 0.72rem;
    font-weight: 800;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    letter-spacing: -0.2px;
}
.wa-conv-avatar.nova {
    background: rgba(52, 152, 219, 0.16);
    color: var(--accent-color);
    border: 1px dashed rgba(52, 152, 219, 0.5);
}
.wa-conv-body {
    flex: 1;
    min-width: 0;
}
.wa-conv-top {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 6px;
    margin-bottom: 3px;
}
.wa-conv-title {
    font-size: 0.85rem;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.wa-conv-time {
    font-size: 0.7rem;
    opacity: 0.6;
    flex-shrink: 0;
    font-variant-numeric: tabular-nums;
}
.wa-conv-time.unread { color: #22c55e; opacity: 1; font-weight: 700; }
.wa-conv-bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
}
.wa-conv-preview {
    font-size: 0.77rem;
    opacity: 0.74;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.wa-conv-unread-pill {
    min-width: 19px;
    height: 19px;
    padding: 0 5px;
    border-radius: 999px;
    background: #22c55e;
    color: #ffffff;
    font-size: 0.68rem;
    font-weight: 800;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.wa-thread-pane {
    flex: 1;
    min-width: 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
    background: var(--bg-color);
}
.wa-empty-thread {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 30px;
    gap: 10px;
}
.wa-empty-icon {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: rgba(52, 152, 219, 0.12);
    color: var(--accent-color);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.wa-empty-thread h4 { margin: 0; font-size: 1.08rem; }
.wa-empty-thread p { margin: 0; max-width: 360px; font-size: 0.85rem; opacity: 0.72; line-height: 1.45; }
.wa-active-thread {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
}
.wa-thread-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: var(--card-bg);
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
}
.wa-back-btn {
    display: none;
    border: 1px solid var(--border-color);
    background: transparent;
    color: var(--text-color);
    width: 32px;
    height: 32px;
    border-radius: 8px;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
}
.wa-thread-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: linear-gradient(135deg, #2563eb, #3498db);
    color: #ffffff;
    font-size: 0.72rem;
    font-weight: 800;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.wa-thread-meta { flex: 1; min-width: 0; }
.wa-thread-meta h4 { margin: 0; font-size: 0.94rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wa-thread-meta small { display: block; font-size: 0.75rem; opacity: 0.7; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wa-thread-status {
    padding: 3px 9px;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 700;
    background: rgba(52, 152, 219, 0.14);
    color: var(--accent-color);
    flex-shrink: 0;
}
.wa-close-btn { position: static; flex-shrink: 0; }
.wa-timeline {
    flex: 1;
    max-height: none !important;
    min-height: 0 !important;
}
.wa-composer { flex-shrink: 0; }

@media (max-width: 768px) {
    .wa-modal-content {
        width: 96vw !important;
        height: 88dvh !important;
        max-height: 88dvh !important;
    }
    .wa-sidebar-pane { width: 100%; }
    .wa-close-mobile-only { display: inline-flex; }
    .wa-thread-pane { display: none; width: 100%; }
    .wa-layout.chat-open .wa-sidebar-pane { display: none; }
    .wa-layout.chat-open .wa-thread-pane { display: flex; }
    .wa-back-btn { display: inline-flex; }
    .sidebar.mobile-open .sidebar-chat-label { display: inline; }
}

.obs-composer-hint {
    font-size: 0.74rem;
    opacity: 0.6;
    user-select: none;
}

.obs-composer-hint kbd {
    background: rgba(128, 128, 128, 0.15);
    padding: 2px 5px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-family: inherit;
    border: 1px solid var(--border-color);
}

.obs-btn-send {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    font-size: 0.88rem;
    font-weight: 600;
}

.obs-btn-send .material-icons {
    font-size: 16px;
}

.obs-btn-close {
    padding: 8px 14px;
    font-size: 0.88rem;
}

.obs-edit-textarea {
    margin: 6px 0 !important;
    min-height: 55px !important;
    border-radius: 6px !important;
    font-size: 0.86rem !important;
}

/* DEMANDA 5: Menções estilo WhatsApp */
.obs-mention {
    display: inline-block;
    background: rgba(41, 128, 185, 0.15);
    color: #2980b9;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 4px;
    border: 1px solid rgba(41, 128, 185, 0.3);
}

.obs-mention-dropdown {
    position: absolute;
    bottom: 100%;
    left: 0;
    width: 250px;
    max-height: 180px;
    overflow-y: auto;
    background: var(--card-bg, #ffffff);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.15);
    z-index: 2000;
    margin-bottom: 6px;
}

.obs-mention-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: background 0.15s ease;
}

.obs-mention-item:hover, .obs-mention-item.selected {
    background: rgba(41, 128, 185, 0.1);
    color: #2980b9;
}

/* TOGGLE SWITCH (SIM/NÃO) */
.switch-toggle {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 26px;
    margin: 0;
    cursor: pointer;
    vertical-align: middle;
}

.switch-toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.switch-toggle .slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: #bdc3c7;
    transition: .25s ease;
    border-radius: 26px;
}

.switch-toggle .slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 3px;
    background-color: #ffffff;
    transition: .25s ease;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0,0,0,0.25);
}

.switch-toggle input:checked + .slider {
    background-color: #27ae60;
}

.switch-toggle input:checked + .slider:before {
    transform: translateX(24px);
}

.toggle-status-badge {
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    min-width: 32px;
}

/* CARD DO MODAL DE ALERTA DE MENÇÕES */
.mencao-alerta-card {
    background: rgba(0,0,0,0.02);
    border: 1px solid var(--border-color);
    border-left: 4px solid #f39c12;
    border-radius: 8px;
    padding: 12px 14px;
    transition: transform 0.15s ease;
}

.mencao-alerta-card:hover {
    background: rgba(243, 156, 18, 0.04);
}

.mencao-alerta-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
    font-size: 0.8rem;
    opacity: 0.85;
}

.mencao-alerta-msg {
    font-size: 0.92rem;
    color: var(--text-color);
    line-height: 1.45;
    background: var(--card-bg, #fff);
    padding: 10px 12px;
    border-radius: 6px;
    border: 1px solid rgba(0,0,0,0.06);
    margin-top: 6px;
}

/* ROLAGEM VERTICAL DA ABA OPERAÇÃO */
.operacao-scroll-container {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
}

.operacao-scroll-container::-webkit-scrollbar {
    width: 8px;
}

.operacao-scroll-container::-webkit-scrollbar-track {
    background: var(--bg-color);
    border-radius: 4px;
}

.operacao-scroll-container::-webkit-scrollbar-thumb {
    background: var(--accent-color);
    border-radius: 4px;
    opacity: 0.8;
}

.operacao-scroll-container::-webkit-scrollbar-thumb:hover {
    filter: brightness(1.15);
}

/* =========================================================================
   HEADER: BOTÃO TEMA & DROPDOWN DO PERFIL DO USUÁRIO
   ========================================================================= */
.btn-topbar-action {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 1px solid transparent;
    background: transparent;
    color: var(--text-color);
    opacity: 0.85;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    position: relative;
    transition: all 0.2s ease;
}

.btn-topbar-action:hover {
    background: rgba(52, 152, 219, 0.12);
    color: var(--accent-color);
    opacity: 1;
    transform: scale(1.05);
}

.btn-topbar-action .material-icons {
    font-size: 22px;
}

.user-dropdown-container {
    position: relative;
    display: inline-flex;
    align-items: center;
}

.btn-user-profile {
    border: 1px solid transparent;
    background: transparent;
    cursor: pointer;
    text-align: left;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 4px 10px;
    border-radius: 10px;
}

.btn-user-profile:hover,
.btn-user-profile.dropdown-active {
    background: rgba(0, 0, 0, 0.05);
    border-color: var(--border-color);
}

body.dark-mode .btn-user-profile:hover,
body.dark-mode .btn-user-profile.dropdown-active {
    background: rgba(255, 255, 255, 0.06);
    border-color: var(--border-color);
}

.user-caret-icon {
    font-size: 18px;
    color: var(--text-color);
    opacity: 0.6;
    transition: transform 0.25s ease;
    margin-left: 2px;
}

.user-dropdown-menu {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    width: 250px;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.2);
    z-index: 1050;
    overflow: hidden;
    animation: fadeInDropdown 0.2s ease;
}

@keyframes fadeInDropdown {
    from { opacity: 0; transform: translateY(-6px); }
    to { opacity: 1; transform: translateY(0); }
}

.user-dropdown-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: rgba(52, 152, 219, 0.08);
}

.user-dropdown-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-color), #2980b9);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.05rem;
    box-shadow: 0 3px 8px rgba(52, 152, 219, 0.35);
}

.user-dropdown-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    overflow: hidden;
}

.user-dropdown-name {
    font-weight: 700;
    font-size: 0.92rem;
    color: var(--text-color);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.badge-role-pill {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    background: rgba(52, 152, 219, 0.15);
    color: var(--accent-color);
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.user-dropdown-divider {
    height: 1px;
    background: var(--border-color);
    opacity: 0.6;
}

.user-dropdown-list {
    list-style: none;
    margin: 6px 0;
    padding: 0;
}

.user-dropdown-list li a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    color: var(--text-color);
    text-decoration: none;
    font-size: 0.88rem;
    font-weight: 500;
    transition: all 0.15s ease;
}

.user-dropdown-list li a .material-icons {
    font-size: 20px;
    opacity: 0.75;
}

.user-dropdown-list li a:hover {
    background: rgba(52, 152, 219, 0.1);
    color: var(--accent-color);
}

.user-dropdown-list li a:hover .material-icons {
    opacity: 1;
}

.user-dropdown-footer {
    padding: 6px 0;
}

.btn-user-logout {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    color: #e74c3c !important;
    text-decoration: none;
    font-size: 0.88rem;
    font-weight: 600;
    transition: all 0.15s ease;
}

.btn-user-logout .material-icons {
    font-size: 20px;
    color: #e74c3c;
}

.btn-user-logout:hover {
    background: rgba(231, 76, 60, 0.1) !important;
}

/* =========================================================================
   PÁGINA: LOGS DE AUDITORIA & ATIVIDADES
   ========================================================================= */
.logs-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin-bottom: 16px;
    flex-shrink: 0;
}

.logs-stat-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 18px 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

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

.logs-stat-info {
    display: flex;
    flex-direction: column;
}

.logs-stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-color);
    line-height: 1.2;
}

.logs-stat-label {
    font-size: 0.8rem;
    color: var(--text-color);
    opacity: 0.7;
    margin-top: 2px;
}

/* Filtros de Auditoria */
.logs-filters-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 16px 20px;
    margin-bottom: 16px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    flex-shrink: 0;
}

.logs-filters-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr 1fr auto;
    gap: 12px;
    align-items: flex-end;
}

@media (max-width: 1200px) {
    .logs-filters-grid {
        grid-template-columns: 1fr 1fr 1fr;
    }
}

@media (max-width: 768px) {
    .logs-filters-grid {
        grid-template-columns: 1fr;
    }
}

.logs-filter-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.logs-filter-group label {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-color);
    opacity: 0.85;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.logs-filter-input,
.logs-filter-select {
    height: 38px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-color);
    color: var(--text-color);
    padding: 0 12px;
    font-size: 0.88rem;
    outline: none;
    transition: border-color 0.2s ease;
}

.logs-filter-input:focus,
.logs-filter-select:focus {
    border-color: var(--accent-color);
}

/* Tabela de Auditoria */
.logs-table-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 260px;
}

.logs-table-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
}

.logs-table-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-color);
    display: flex;
    align-items: center;
    gap: 8px;
}

.logs-table-container {
    flex: 1;
    min-height: 0;
    overflow-x: auto;
    overflow-y: auto;
    max-height: clamp(320px, 58vh, 680px);
    -webkit-overflow-scrolling: touch;
}
.logs-table-container::-webkit-scrollbar { width: 8px; height: 8px; }
.logs-table-container::-webkit-scrollbar-track { background: var(--bg-color); border-radius: 4px; }
.logs-table-container::-webkit-scrollbar-thumb { background: var(--accent-color); border-radius: 4px; }
.logs-table-container::-webkit-scrollbar-thumb:hover { filter: brightness(1.15); }
.logs-table-container::-webkit-scrollbar-corner { background: var(--bg-color); }

.logs-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.86rem;
}

.logs-table th {
    position: sticky;
    top: 0;
    z-index: 5;
    background: var(--card-bg);
    color: var(--text-color);
    text-align: left;
    padding: 12px 16px;
    font-weight: 700;
    font-size: 0.76rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border-color);
    box-shadow: 0 2px 4px -1px rgba(0, 0, 0, 0.12);
}

body.dark-mode .logs-table th {
    background: var(--card-bg);
}

.logs-table td {
    padding: 13px 16px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-color);
    vertical-align: middle;
}

.logs-table tr:hover td {
    background: rgba(52, 152, 219, 0.04);
}

/* Badges e Pílulas */
.badge-modulo {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-modulo .material-icons {
    font-size: 14px;
}

.badge-modulo-orcamentos    { background: rgba(52, 152, 219, 0.15); color: #2980b9; }
.badge-modulo-materiais     { background: rgba(243, 156, 18, 0.15); color: #d35400; }
.badge-modulo-operacao      { background: rgba(26, 188, 156, 0.15); color: #16a085; }
.badge-modulo-financeiro    { background: rgba(46, 204, 113, 0.15); color: #27ae60; }
.badge-modulo-revisao       { background: rgba(155, 89, 182, 0.15); color: #8e44ad; }
.badge-modulo-usuarios      { background: rgba(108, 92, 231, 0.15); color: #6c5ce7; }
.badge-modulo-autenticacao  { background: rgba(127, 140, 141, 0.15); color: #7f8c8d; }
.badge-modulo-observacoes   { background: rgba(230, 126, 34, 0.15); color: #d35400; }
.badge-modulo-sistema       { background: rgba(52, 73, 94, 0.15); color: #34495e; }

.badge-acao {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.badge-acao-criar     { background: rgba(46, 204, 113, 0.18); color: #27ae60; }
.badge-acao-editar    { background: rgba(52, 152, 219, 0.18); color: #2980b9; }
.badge-acao-excluir   { background: rgba(231, 76, 60, 0.18); color: #c0392b; }
.badge-acao-status    { background: rgba(243, 156, 18, 0.18); color: #d35400; }
.badge-acao-login     { background: rgba(39, 174, 96, 0.18); color: #27ae60; }
.badge-acao-logout    { background: rgba(149, 165, 166, 0.18); color: #7f8c8d; }
.badge-acao-revisao   { background: rgba(142, 68, 173, 0.18); color: #8e44ad; }
.badge-acao-custo     { background: rgba(230, 126, 34, 0.18); color: #d35400; }
.badge-acao-etapa     { background: rgba(26, 188, 156, 0.18); color: #16a085; }
.badge-acao-senha     { background: rgba(211, 84, 0, 0.18); color: #e67e22; }

/* Usuário na Tabela */
.log-user-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.log-user-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-color), #2980b9);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.75rem;
}

.log-user-meta {
    display: flex;
    flex-direction: column;
    line-height: 1.15;
}

.log-user-name {
    font-weight: 600;
    font-size: 0.84rem;
}

.log-user-level {
    font-size: 0.68rem;
    opacity: 0.65;
}

/* Paginação */
.logs-pagination-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 20px;
    border-top: 1px solid var(--border-color);
    flex-wrap: wrap;
    gap: 12px;
    flex-shrink: 0;
}

.logs-pagination-links {
    display: flex;
    gap: 6px;
    align-items: center;
}

.logs-page-btn {
    min-width: 34px;
    height: 34px;
    padding: 0 10px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    background: var(--bg-color);
    color: var(--text-color);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.15s ease;
}

.logs-page-btn:hover:not(.disabled) {
    background: rgba(52, 152, 219, 0.12);
    border-color: var(--accent-color);
    color: var(--accent-color);
}

.logs-page-btn.active {
    background: var(--accent-color);
    border-color: var(--accent-color);
    color: #fff;
}

.logs-page-btn.disabled {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
}

