:root {
    /* Cores Globais - Modo Claro (Contraste Aprimorado e SÃ³brio) */
    --sidebar-bg: #0d1527; 
    --sidebar-hover: rgba(59, 130, 246, 0.16); 
    --sidebar-text: #a1aebf; 
    --blue-500: #3b82f6; 
    --blue-600: #2563eb;
    --text-main: #0f172a; 
    --bg-color: #eaeff5;
    --text-muted: #64748b; 
    --border-color: #cbd5e1; 
    --card-bg: #ffffff;
    --green-500: #10b981; 
    --purple-500: #8b5cf6; 
    --purple-600: #7c3aed;
    --orange-500: #f97316; 
    --red-500: #ef4444;
    --red-600: #dc2626;
    --input-bg: #ffffff;
    --table-header-bg: #e2e8f0;
    --hover-bg: #f1f5f9;
}

[data-theme="dark"] {
    /* Cores Globais - Modo Escuro */
    --sidebar-bg: #090e1a; 
    --sidebar-hover: rgba(59, 130, 246, 0.18); 
    --sidebar-text: #a1aebf; 
    --blue-500: #3b82f6; 
    --blue-600: #2563eb;
    --text-main: #f3f4f6; 
    --bg-color: #0f172a;
    --text-muted: #94a3b8; 
    --border-color: #3b485f; 
    --card-bg: #1e293b;
    --green-500: #10b981; 
    --purple-500: #8b5cf6; 
    --purple-600: #7c3aed;
    --orange-500: #f97316; 
    --red-500: #ef4444;
    --red-600: #dc2626;
    --input-bg: #1e293b;
    --hover-bg: #334155;
    --table-header-bg: #334155;
}

/* Estilos Globais PadrÃ£o para Sidebar (Evita quebras em novas pÃ¡ginas e traz visual moderno) */
.sidebar { width: 260px; background-color: var(--sidebar-bg); display: flex; flex-direction: column; flex-shrink: 0; border-right: 1px solid rgba(255, 255, 255, 0.08); box-shadow: 4px 0 24px -2px rgba(0, 0, 0, 0.15); }
.brand { padding: 20px 24px; color: white; font-weight: 700; font-size: 20px; border-bottom: 1px solid rgba(255,255,255,0.06); display: flex; align-items: center; justify-content: center; }
.brand i { color: var(--blue-500); font-size: 24px; }
.user-switcher { border-bottom: 1px solid rgba(255,255,255,0.06); }
.switcher-trigger { padding: 20px; display: flex; align-items: center; gap: 12px; color: white; }
.switcher-trigger img { width: 38px; height: 38px; border-radius: 10px; object-fit: cover; border: 1px solid rgba(255,255,255,0.15); }
.btn-trocar-acesso { display: block; margin: 0 20px 20px 20px; text-align: center; background: rgba(255,255,255,0.06); color: var(--sidebar-text); padding: 9px; border-radius: 8px; font-size: 12px; font-weight: 600; transition: 0.2s; border: 1px solid rgba(255,255,255,0.1); text-decoration: none; }
.btn-trocar-acesso:hover { background: rgba(59, 130, 246, 0.2); color: white; border-color: rgba(59, 130, 246, 0.4); }
.nav-menu { padding: 20px 16px; flex-grow: 1; overflow-y: auto; }
.nav-group { margin-bottom: 24px; }
.nav-group-title { font-size: 11px; font-weight: 700; color: #64748b; text-transform: uppercase; letter-spacing: 1.2px; margin-bottom: 10px; padding-left: 12px; }
.nav-item { display: flex; align-items: center; gap: 12px; padding: 11px 14px; color: var(--sidebar-text); border-radius: 8px; margin-bottom: 4px; font-size: 14px; font-weight: 500; transition: all 0.2s ease; text-decoration: none; }
.nav-item:hover { background: var(--sidebar-hover); color: white; transform: translateX(2px); }
.nav-item.active { background: linear-gradient(135deg, var(--blue-500) 0%, var(--blue-600) 100%); color: white; box-shadow: 0 4px 12px rgba(59, 130, 246, 0.35); font-weight: 600; }
.nav-item i { width: 20px; text-align: center; font-size: 16px; }

/* ========================================================================= */
/* Barras de Rolagem Personalizadas (Sleek Scrollbars)                      */
/* ========================================================================= */
/* PadrÃ£o global para toda a aplicaÃ§Ã£o */
* {
    scrollbar-width: thin;
    scrollbar-color: var(--border-color) transparent;
}

::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 8px;
    border: 2px solid transparent;
    background-clip: padding-box;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
    border: 2px solid transparent;
    background-clip: padding-box;
}

/* Barra de Rolagem da Sidebar (.nav-menu) - Ultra Elegante, Fina e Discreta */
.nav-menu {
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.16) transparent;
}
.nav-menu::-webkit-scrollbar {
    width: 5px;
}
.nav-menu::-webkit-scrollbar-track {
    background: transparent;
}
.nav-menu::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.16);
    border-radius: 10px;
}
.nav-menu::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.35);
}

/* Regra Global Responsiva para Hover em Itens de Lista/Tabela (Modo Claro e Escuro) */
.list-item:hover,
tr:hover {
    background-color: var(--hover-bg) !important;
}

/* ========================================================================= */
/* Estilos Globais de AutenticaÃ§Ã£o (Login e Cadastro)                        */
/* ========================================================================= */
.auth-body { 
    font-family: 'Inter', sans-serif; 
    background-color: var(--bg-color); 
    display: flex; 
    justify-content: center; 
    align-items: center; 
    min-height: 100vh; 
    margin: 0; 
    color: var(--text-main);
}

.auth-container { 
    background: var(--card-bg); 
    padding: 60px 40px; 
    border-radius: 12px; 
    border: 1px solid var(--border-color);
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.2), 0 8px 10px -6px rgba(0, 0, 0, 0.1); 
    width: 100%; 
    max-width: 650px; 
    min-height: 75vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    box-sizing: border-box;
}

.auth-container h2 { 
    margin-top: 0; 
    margin-bottom: 8px;
    color: var(--text-main); 
    text-align: center; 
    font-weight: 700;
    font-size: 24px;
}

.auth-container .subtitle {
    text-align: center;
    color: var(--text-muted);
    font-size: 14px;
    margin-bottom: 24px;
}

.auth-container .campo { 
    margin-bottom: 20px; 
    position: relative;
}

.auth-container .campo label { 
    display: block; 
    margin-bottom: 6px; 
    color: var(--text-main); 
    font-size: 13px; 
    font-weight: 600;
}

.auth-container .campo input { 
    width: 100%; 
    padding: 12px 14px; 
    border: 1px solid var(--border-color); 
    border-radius: 8px; 
    box-sizing: border-box; 
    font-size: 14px; 
    font-family: 'Inter', sans-serif;
    transition: all 0.2s ease;
    color: var(--text-main);
    background-color: var(--input-bg);
}

.auth-container .campo input:focus {
    outline: none;
    border-color: var(--blue-500);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Corrige o fundo branco do autopreenchimento do navegador (Chrome/Edge) no modo escuro */
.auth-container .campo input:-webkit-autofill,
.auth-container .campo input:-webkit-autofill:hover, 
.auth-container .campo input:-webkit-autofill:focus, 
.auth-container .campo input:-webkit-autofill:active {
    -webkit-box-shadow: 0 0 0 30px var(--input-bg) inset !important;
    -webkit-text-fill-color: var(--text-main) !important;
    transition: background-color 5000s ease-in-out 0s;
}

.auth-container .btn-enviar { 
    width: 100%; 
    padding: 10px; 
    background-color: var(--blue-500); 
    border: none; 
    color: white; 
    font-size: 15px; 
    border-radius: 8px; 
    cursor: pointer; 
    font-weight: 600; 
    transition: background-color 0.2s ease;
}

.auth-container .btn-enviar:hover { 
    background-color: var(--blue-600); 
}

.auth-container .btn-google { 
    width: 100%; 
    padding: 10px; 
    background-color: var(--card-bg); 
    border: 1px solid var(--border-color); 
    color: var(--text-main); 
    font-size: 14px; 
    border-radius: 8px; 
    cursor: pointer; 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    font-weight: 500; 
    transition: background-color 0.2s ease;
}

.auth-container .btn-google:hover {
    background-color: var(--hover-bg);
}

.auth-container .btn-google svg {
    margin-right: 10px;
    width: 18px;
    height: 18px;
}

.auth-container .divider { 
    text-align: center; 
    margin: 20px 0; 
    color: var(--text-muted); 
    font-size: 12px; 
    position: relative; 
    display: flex;
    align-items: center;
}

.auth-container .divider::before, .auth-container .divider::after { 
    content: ""; 
    flex: 1; 
    height: 1px; 
    background-color: var(--border-color); 
}

.auth-container .divider::before { margin-right: 10px; }
.auth-container .divider::after { margin-left: 10px; }

.auth-container .links { text-align: center; margin-top: 20px; font-size: 13px; color: var(--text-muted); line-height: 1.6; }
.auth-container .links a { color: var(--blue-500); text-decoration: none; font-weight: 600; transition: 0.2s; }
.auth-container .links a:hover { text-decoration: underline; color: var(--blue-600); }

/* Componentes Ãšteis em Auth */
.password-wrapper { position: relative; display: flex; align-items: center; }
.password-wrapper input { padding-right: 40px; }
.toggle-password { position: absolute; right: 12px; background: none; border: none; cursor: pointer; color: var(--text-muted); display: flex; align-items: center; justify-content: center; padding: 0; }
.toggle-password:hover { color: var(--blue-500); }

.alerta { padding: 12px 16px; margin-bottom: 24px; border-radius: 8px; font-size: 14px; line-height: 1.5; }
.alerta.erro { background-color: var(--error-bg); color: var(--error-text); border: 1px solid #fecaca; }
.alerta.sucesso { background-color: var(--success-bg); color: var(--success-text); border: 1px solid rgba(34, 197, 94, 0.3); }

/* ========================================================================= */
/* Ajustes Globais para o Editor de Texto (Quill)                            */
/* ========================================================================= */
.ql-toolbar.ql-snow { border-top-left-radius: 8px; border-top-right-radius: 8px; border-color: var(--border-color) !important; background: var(--hover-bg); }
.ql-container.ql-snow { border-bottom-left-radius: 8px; border-bottom-right-radius: 8px; border-color: var(--border-color) !important; font-size: 14px; font-family: inherit; }

/* Ajuste do Quill no Modo Escuro */
[data-theme="dark"] .ql-snow .ql-stroke { stroke: #cbd5e1 !important; }
[data-theme="dark"] .ql-snow .ql-fill, [data-theme="dark"] .ql-snow .ql-stroke.ql-fill { fill: #cbd5e1 !important; }
[data-theme="dark"] .ql-snow .ql-picker { color: #cbd5e1 !important; }
[data-theme="dark"] .ql-snow.ql-toolbar button:hover .ql-stroke, [data-theme="dark"] .ql-snow .ql-toolbar button:hover .ql-stroke { stroke: #38bdf8 !important; }
[data-theme="dark"] .ql-snow.ql-toolbar button:hover .ql-fill, [data-theme="dark"] .ql-snow .ql-toolbar button:hover .ql-fill { fill: #38bdf8 !important; }
[data-theme="dark"] .ql-snow .ql-picker-options { background-color: var(--card-bg) !important; border-color: var(--border-color) !important; color: var(--text-main) !important; }
[data-theme="dark"] .ql-editor.ql-blank::before { color: var(--text-muted) !important; font-style: italic; }
[data-theme="dark"] .ql-snow .ql-picker.ql-expanded .ql-picker-label .ql-stroke { stroke: #38bdf8 !important; }
[data-theme="dark"] .ql-snow .ql-picker.ql-expanded .ql-picker-label .ql-fill { fill: #38bdf8 !important; }
[data-theme="dark"] .ql-editor { color: var(--text-main) !important; }

/* Hejmo Global Modal Styles */
.hejmo-modal-overlay { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(15, 23, 42, 0.6); z-index: 9999; align-items: center; justify-content: center; opacity: 0; transition: opacity 0.2s ease-in-out; }
.hejmo-modal-overlay.active { display: flex; opacity: 1; }
.hejmo-modal-content-sm { background: var(--card-bg); border: 1px solid var(--border-color); border-radius: 12px; width: 400px; max-width: 90%; box-shadow: 0 20px 25px -5px rgba(0,0,0,0.1); transform: scale(0.95); transition: transform 0.2s ease-in-out; }
.hejmo-modal-overlay.active .hejmo-modal-content-sm { transform: scale(1); }
.hejmo-modal-header { padding: 16px 24px; border-bottom: 1px solid var(--border-color); display: flex; justify-content: space-between; align-items: center; }
.hejmo-modal-header h3 { margin: 0; font-size: 16px; font-weight: 700; color: var(--text-main); display: flex; align-items: center; }
.hejmo-modal-close { background: none; border: none; color: var(--text-muted); cursor: pointer; font-size: 18px; padding: 4px; border-radius: 4px; transition: 0.2s; }
.hejmo-modal-close:hover { background: var(--hover-bg); color: var(--text-main); }

/* =========================================
   ADAPTAÇÕES MOBILE (MORADORES & COMUM)
   ========================================= */
@media (max-width: 768px) {
    .mobile-friendly a.btn, .mobile-friendly button.btn, .mobile-friendly .btn-action {
        min-height: 44px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        margin-bottom: 8px;
    }
    
    .mobile-cards-table, .mobile-cards-table thead, .mobile-cards-table tbody, .mobile-cards-table th, .mobile-cards-table td, .mobile-cards-table tr { 
        display: block; 
    }
    
    .mobile-cards-table thead tr { 
        position: absolute;
        top: -9999px;
        left: -9999px;
    }
    
    .mobile-cards-table tr { 
        border: 1px solid var(--border-color); 
        border-radius: 8px; 
        margin-bottom: 16px; 
        background: var(--card-bg); 
        overflow: hidden; 
        padding: 8px 12px; 
        box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    }
    
    .mobile-cards-table td { 
        border: none;
        border-bottom: 1px solid var(--border-color); 
        position: relative;
        padding-left: 45% !important; 
        text-align: right !important;
        min-height: 44px;
        display: flex;
        align-items: center;
        justify-content: flex-end;
    }
    
    .mobile-cards-table td:last-child {
        border-bottom: 0;
        justify-content: center;
        padding-left: 0 !important;
        padding-top: 12px;
        padding-bottom: 4px;
    }
    
    .mobile-cards-table td:last-child::before {
        display: none;
    }

    .mobile-cards-table td::before { 
        content: attr(data-label); 
        position: absolute;
        left: 0;
        width: 40%; 
        padding-right: 10px; 
        white-space: nowrap;
        text-align: left;
        font-weight: 600;
        font-size: 13px;
        color: var(--text-muted);
    }
}

