﻿/* ==========================================================================
   1. RESET E VARIÁVEIS GLOBAIS
   ========================================================================== */
html, body {
    margin: 0;
    padding: 0;
    height: 100%; /* Garante altura total */
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f4f7fa;
    justify-content: center; /* Centraliza Horizontalmente */
    align-items: center; /* Centraliza Verticalmente */
}

:root {
    --header-height: 60px;
    --nav-width-desktop: 450px;
    --nav-width-mobile: 300px;
    --footer-height: 30px;
    --color-primary: #19493d;
    --color-secondary: #c4d733;
    --color-primary-text: #ffffff;
    --color-border-light: #e0e0e0;
}

/* ==========================================================================
   2. ESTRUTURA DE LAYOUT (Header, Nav, Footer, Containers)
   ========================================================================== */

/* Cabeçalho Fixo */
.main-header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: var(--header-height);
    background-color: var(--color-primary);
    color: var(--color-primary-text);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    z-index: 1000;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    box-sizing: border-box;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.header-left {
    display: flex;
    align-items: center;
}

.header-logo {
    height: 45px;
    width: auto;
    margin-left: 15px;
    /*filter: brightness(0) invert(1);*/ /*filtro para deixar branco*/
}

/* Menu do Usuário (Direita) */
.user-menu {
    position: relative;
}

.user-menu-toggle {
    display: flex;
    align-items: center;
    background: none;
    border: none;
    color: var(--color-primary-text);
    cursor: pointer;
    padding: 5px 10px;
    border-radius: 6px;
    transition: background-color 0.2s ease;
}

    .user-menu-toggle:hover {
        background-color: rgba(255, 255, 255, 0.1);
    }

.user-name {
    margin-right: 10px;
    font-weight: 600;
    display: block;
}

.user-photo {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    border: 2px solid var(--color-secondary);
    margin-right: 5px;
}

.user-menu-toggle i {
    font-size: 0.8em;
    transition: transform 0.3s ease;
}

.user-menu-toggle.active i {
    transform: rotate(180deg);
}

.user-menu-dropdown {
    display: none;
    position: absolute;
    top: 110%;
    right: 0;
    background-color: #fff;
    color: #666;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
    min-width: 220px;
    z-index: 1001;
    overflow: hidden;
    font-weight: 500;
}

    .user-menu-dropdown.show {
        display: block;
    }

    .user-menu-dropdown a, .user-menu-dropdown .logout-button {
        display: flex;
        align-items: center;
        padding: 12px 15px;
        text-decoration: none;
        color: #666;
        font-weight: 500;
        font-size: 0.9em;
        transition: background-color 0.2s ease;
        background: none;
        border: none;
        width: 100%;
        text-align: left;
        cursor: pointer;
    }

        .user-menu-dropdown a i, .user-menu-dropdown .logout-button i {
            padding-right: 10px;
        }

        .user-menu-dropdown a:hover {
            background-color: #f5f5f5;
            color: var(--color-primary);
        }

.dropdown-divider {
    height: 1px;
    background-color: var(--color-border-light);
    margin: 5px 0;
}

.logout-button {
    color: #dc3545 !important;
}
/* Navegação Lateral (Menu Esquerdo) */
.main-navigation {
    position: fixed;
    left: 0;
    width: var(--nav-width-desktop);
    z-index: 1002;
    top: 0;
    height: 100vh;
    box-shadow: 2px 0 10px rgba(0,0,0,0.2);
    background-color: #fff;
    transition: transform 0.3s ease;
    transform: translateX(calc(-1 * var(--nav-width-desktop)));
    overflow-y: auto;
    padding-bottom: 20px;
}

    .main-navigation.show {
        transform: translateX(0);
    }
/* Seletor de Módulo e Header Info */
.module-selector {
    padding: 15px;
    padding-right: 50px;
    border-bottom: 1px solid var(--color-border-light);
    position: relative;
}

.module-display-single {
    font-size: 1.1em;
    font-weight: 600;
    color: var(--color-primary);
}

    .module-display-single i {
        margin-right: 10px;
        color: var(--color-secondary);
    }

#moduleSelect, #moduleSelectHeader {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--color-border-light);
    border-radius: 6px;
    font-size: 1em;
    font-weight: 600;
    background-color: #f9f9f9;
    color: var(--color-primary);
    cursor: pointer;
}

.current-module span {
    font-size: 1.1em;
    font-weight: 600;
    color: var(--color-primary-text);
}

.current-module i {
    color: var(--color-secondary);
    margin-right: 5px;
}
/* Lista de Menu (Accordion) */
.menu-list {
    list-style: none;
    padding: 0;
    margin: 10px 0 0 0;
}

    .menu-list li a {
        display: flex;
        align-items: center;
        justify-content: flex-start;
        padding: 12px 20px;
        text-decoration: none;
        color: #444;
        font-size: 0.95em;
        font-weight: 500;
        border-bottom: 1px solid #f0f0f0;
        transition: all 0.2s ease;
        position: relative;
    }

        .menu-list li a:hover {
            background-color: color-mix(in srgb, var(--color-secondary) 20%, transparent);
            color: var(--color-primary);
            padding-left: 25px;
        }

        .menu-list li a .menu-icon {
            width: 24px;
            margin-right: 10px;
            text-align: center;
            color: #888;
        }

        .menu-list li a .fa-chevron-right {
            margin-left: auto;
            font-size: 0.8em;
            transition: transform 0.3s ease;
        }
        /* Estados do Menu */
        .menu-list li a.menu-toggle.active {
            color: var(--color-primary);
            font-weight: bold;
        }

            .menu-list li a.menu-toggle.active .menu-icon,
            .menu-list li a.menu-toggle.active .fa-chevron-right {
                color: var(--color-secondary);
            }

            .menu-list li a.menu-toggle.active .fa-chevron-right {
                transform: rotate(90deg);
            }

        .menu-list li a.active-program {
            background-color: var(--color-secondary) !important;
            color: var(--color-primary) !important;
            font-weight: bold;
            border-left: 4px solid var(--color-primary);
        }

            .menu-list li a.active-program .menu-icon {
                color: var(--color-primary) !important;
            }
/* Submenus */
.submenu-list {
    list-style: none;
    padding: 0;
    margin: 0;
    background-color: #fafafa;
    display: none;
}

    .submenu-list li a {
        padding-left: 45px;
        font-size: 0.9em;
        color: #666;
    }

        .submenu-list li a:hover {
            padding-left: 50px;
        }

    .submenu-list .submenu-list li a {
        padding-left: 65px;
    }
/* Conteúdo Principal e Rodapé */
.main-content {
    padding: 20px;
    background-color: #f4f7fa;
    box-sizing: border-box;
    flex-grow: 1;
}

.main-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: var(--footer-height);
    background-color: #fff;
    border-top: 1px solid var(--color-border-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    font-size: 0.85em;
    color: #fff;
    z-index: 998;
    box-sizing: border-box;
    background: var(--color-primary);
}

@media (max-width: 768px) {
    .main-footer {
        position: fixed;
        bottom: 0;
        left: 0;
        width: 100%;
        height: var(--footer-height);
        background-color: #fff;
        border-top: 1px solid var(--color-border-light);
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 0 10px;
        font-size: 0.55em;
        color: #fff;
        z-index: 998;
        box-sizing: border-box;
        background: var(--color-primary);
    }
}


.footer-right strong {
    color: #fff;
}
/* Botões Mobile */
.mobile-menu-toggle {
    display: block;
    font-size: 1.2em;
    background: none;
    border: none;
    color: var(--color-primary-text);
    cursor: pointer;
}

.mobile-nav-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.4);
    z-index: 997;
}

    .mobile-nav-overlay.show {
        display: block;
    }

.mobile-menu-close {
    position: absolute;
    top: 10px;
    right: 15px;
    font-size: 1.5em;
    background: none;
    border: none;
    color: #999;
    cursor: pointer;
    z-index: 10;
}
/* Responsividade Layout */
@media (max-width: 992px) {
    .main-navigation {
        width: var(--nav-width-mobile);
        transform: translateX(calc(-1 * var(--nav-width-mobile)));
    }

    .user-name, .current-module {
        display: none;
    }


    .footer-right {
        width: 50%;
        text-align: right;
    }

    .user-menu {
        padding-right: 0;
    }
}
/* --- CONTAINER FULL HEIGHT (Para Grids) --- */
.full-height-container {
    margin-top: 60px;
    height: calc(100vh - 150px); /* AJUSTADO CONFORME SOLICITAÇÃO */
    width: 100%;
    display: flex;
    flex-direction: column;
    padding: 1px 1px 1px 1px;
    box-sizing: border-box;
    overflow: hidden;
}

.full-height-box {
    width: 100%;
    background: #fff;
    border-radius: 8px 8px 0 0;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.05);
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

.box-header-area {
    padding: 15px 20px 0 20px;
    flex-shrink: 0;
    background-color: #fff;
    z-index: 20;
}

.grid-wrapper {
    flex-grow: 1;
    overflow: hidden;
    padding: 0 20px 0 20px;
    display: flex;
    flex-direction: column;
}
/* --- CONTAINER DASHBOARD (Para Formulários Centralizados) --- */
.dashboard-container {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding-top: 5vh;
}

.dashboard-box {
    background: #fff;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 8px 30px rgba(25, 73, 61, 0.2);
    width: 90%;
    max-width: 800px;
    text-align: center;
    box-sizing: border-box;
}

@media (max-width: 767px) {
    .dashboard-container {
        width: 100%;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: flex-start;
        padding-top: 5vh;
    }

    .dashboard-box {
        background: #fff;
        padding: 30px;
        border-radius: 12px;
        box-shadow: 0 8px 30px rgba(25, 73, 61, 0.2);
        width: 90%;
        max-width: 800px;
        text-align: center;
        box-sizing: border-box;
    }
}



/* ==========================================================================
   3. FORMULÁRIOS E INPUTS (PADRÃO DEFINITIVO - LABEL FIXO)
   ========================================================================== */

.form-group {
    margin-bottom: 20px;
    position: relative;
}

.form-check-label {
    font-size: 0.8em;
}

@media (max-width: 768px) {
    .form-check-label {
        font-size: 0.6em;
    }
}


/* Input Field (Com espaço no topo para o Label) */
.input-field {
    width: 100%;
    padding: 22px 10px 6px 10px !important; /* Padding Top fixo para o label */
    border: 1px solid #ddd;
    border-radius: 6px;
    box-sizing: border-box;
    font-size: 0.9em;
    background-color: #fafafa;
    transition: border-color 0.3s ease;
    outline: none;
    text-indent: 0;
    height: 45px !important; /* Altura fixa */
}

    .input-field:focus {
        border-color: var(--color-primary);
        background-color: #fff;
    }

    .input-field:read-only, .input-field:disabled {
        background-color: #e9ecef;
        color: #555;
    }

select.input-field {
    padding-top: 22px;
}
/* Label (Sempre pequeno e no topo) */
.input-label {
    position: absolute;
    top: 6px !important;
    left: 10px;
    font-size: 0.6em !important;
    color: var(--color-primary);
    font-weight: 600;
    pointer-events: none;
    z-index: 4;
    transition: none;
}

.required {
    color: #dc3545;
    display: inline-block;
    margin-right: 2px;
}
/* Grupos com Lupa */
.lookup-trigger-group {
    display: flex;
    align-items: stretch;
    width: 100%;
}

    .lookup-trigger-group .input-field {
        border-top-right-radius: 0;
        border-bottom-right-radius: 0;
    }

.lookup-trigger-btn {
    padding: 0 15px;
    background-color: var(--color-primary);
    color: white;
    border: 1px solid var(--color-primary);
    border-radius: 0 6px 6px 0;
    cursor: pointer;
    font-size: 1.1em;
    display: flex;
    align-items: center;
    justify-content: center;
}
/* Grids de Formulário (Para alinhar campos lado a lado) */
.perfil-header-grid, .form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

    .perfil-header-grid .form-group, .form-grid .form-group {
        margin-bottom: 0;
    }

@media (max-width: 768px) {
    .perfil-header-grid, .form-grid {
        grid-template-columns: 1fr;
    }
}
/* ==========================================================================
   4. BOTÕES E MENSAGENS
   ========================================================================== */

.BotaoPadrao {
    width: 100%;
    padding: 12px;
    border-radius: 6px;
    font-size: 1.1em;
    font-weight: bold;
    transition: all 0.3s ease;
    margin-top: 15px;
    cursor: pointer;
    background-color: var(--color-secondary);
    color: var(--color-primary);
    border: 2px solid var(--color-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-decoration: none !important;
}

@media (max-width: 768px) {
    .BotaoPadrao {
        width: 100%;
        padding: 12px;
        border-radius: 6px;
        font-size: 0.8em;
        font-weight: bold;
        transition: all 0.3s ease;
        margin-top: 15px;
        cursor: pointer;
        background-color: var(--color-secondary);
        color: var(--color-primary);
        border: 2px solid var(--color-primary);
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 8px;
        text-decoration: none !important;
    }
}


.BotaoPadrao:hover:not(.is-disabled) {
    filter: brightness(0.9);
}
/* Variantes de Botão */
.BotaoPadrao.btn-secondary {
    background-color: #6c757d;
    border-color: #6c757d;
    color: white;
}

    .BotaoPadrao.btn-secondary:hover {
        background-color: #5a6268;
    }

.BotaoPadrao.btn-danger {
    background-color: #dc3545;
    border-color: #dc3545;
    color: white;
}

    .BotaoPadrao.btn-danger:hover {
        background-color: #c82333;
    }


/* Botões Pequenos (Grid/Header) */
.header-btn, .btn-icon-grid {
    background: #fff;
    border: 1px solid #ddd;
    color: #555;
    cursor: pointer;
    font-size: 0.9em;
    padding: 6px 12px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
    height: 36px;
}

    .header-btn:hover, .btn-icon-grid:hover {
        background-color: var(--color-primary);
        color: #fff;
        border-color: var(--color-primary);
    }


/* Botões Pequenos (Grid/Header) */
.header-btn-destaque, .btn-icon-grid {
    background-color: var(--color-primary);
    border: 1px solid var(--color-secondary);
    color: #fff;
    cursor: pointer;
    font-size: 0.9em;
    padding: 3px 10px 3px 10px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
    height: 36px;
}

    .header-btn-destaque:hover, .btn-icon-grid:hover {
        background-color: var(--color-primary);
        color: var(--color-secondary);
        border-color: var(--color-primary);
    }

/* Mensagens de Feedback */
.message-box {
    padding: 10px;
    margin-bottom: 15px;
    border-radius: 5px;
    text-align: center;
    font-weight: bold;
}

    .message-box.error {
        background-color: #f8d7da;
        color: #721c24;
        border: 1px solid #f5c6cb;
    }

    .message-box.success {
        background-color: #d1e7dd;
        color: #0f5132;
        border: 1px solid #badbcc;
    }

    .message-box.hidden {
        display: none;
    }
/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.4);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    transition: opacity 0.3s;
}

.loading-content {
    background: #fff;
    padding: 20px 30px;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    text-align: center;
    color: var(--color-primary);
    font-weight: bold;
}

.loading-overlay.hidden {
    display: none;
    opacity: 0;
}

.spinner {
    border: 4px solid rgba(0, 0, 0, 0.1);
    border-left-color: var(--color-secondary);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 0 auto 10px auto;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}
/* ==========================================================================
   5. GRID E TABELAS (PortalGrid)
   ========================================================================== */

/* O Grid interno que organiza os campos */
.filter-grid {
    /* TRUQUE DE CSS: */
    /* Aplica Grid !important APENAS se o elemento NÃO estiver oculto (display: none) */
    /* Isso permite que o jQuery esconda o elemento, mas quando visível, força o Grid */
    display: grid;
    /* Define colunas flexíveis padrão */
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    align-items: end;
    background-color: #f9f9f9;
    padding: 20px;
    border-radius: 6px;
    border: 1px solid #eee;
    width: 100%;
    box-sizing: border-box;
}

    /* Regra de reforço para garantir Grid quando visível (vence o display:block do jQuery) */
    .filter-grid:not([style*="display: none"]) {
        display: grid !important;
    }

/* Ajuste para o botão de ação ficar na largura correta */
.filter-actions {
    display: flex;
    gap: 10px;
    /* O botão ocupa uma coluna inteira se necessário, ou se ajusta */
    justify-self: start;
}

/* Ajuste específico para inputs dentro do grid de filtro */
.filter-grid .form-group {
    margin-bottom: 0; /* Remove margem inferior pois o gap do grid já resolve */
    width: 100%;
}

/* Garante altura consistente */
.filter-grid .input-field {
    height: 45px !important;
    padding: 22px 10px 6px 10px !important;
}

/* Força o label a aparecer */
.filter-grid .input-label {
    display: block !important;
    font-size: 0.7em !important;
    top: 6px !important;
    left: 10px !important;
    color: var(--color-primary);
}

/* Responsividade para celular */
@media (max-width: 768px) {
    .filter-grid {
        grid-template-columns: 1fr; /* Uma coluna no mobile */
        gap: 15px;
    }

    .filter-actions {
        width: 100%;
    }

        .filter-actions .BotaoPadrao {
            width: 100%;
        }
}

#filterContainer {
    margin-bottom: 20px;
}


.filter-actions .BotaoPadrao {
    height: 36px !important;
    min-width: auto !important;
    padding: 0 20px;
    margin-top: 0;
    width: auto;
}

.table-responsive {
    flex-grow: 1;
    overflow: auto;
    border: 1px solid #ddd;
    border-radius: 4px;
    background-color: #fff;
    margin-bottom: 0;
}

.excel-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85em;
    white-space: nowrap;
}

    .excel-table th {
        background-color: color-mix(in srgb, var(--color-primary) 20%, white);
        color: var(--color-primary);
        font-weight: bold;
        padding: 8px 10px;
        border: 1px solid #ccc;
        position: sticky;
        top: 0;
        z-index: 10;
        text-align: left;
        cursor: pointer;
    }

    .excel-table td {
        padding: 6px 10px;
        border: 1px solid #ddd;
        color: #555;
    }

    .excel-table tr:nth-child(even) {
        background-color: #fafafa;
    }

    .excel-table tr:hover {
        background-color: #eef5f9;
    }

.action-cell {
    text-align: center;
    /*background-color: #fff !important;*/
    position: sticky;
    left: 0;
    z-index: 5;
    border-right: 2px solid #ddd !important;
}

.excel-table th.action-cell {
    z-index: 20;
}

.action-cell a {
    color: var(--color-primary);
    font-size: 1.1em;
    cursor: pointer;
}
/* Paginação */
.grid-pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 20px;
    border-top: 1px solid #eee;
    font-size: 0.85em;
    background: #fff;
    flex-shrink: 0;
    height: 45px;
    box-sizing: border-box;
}

.pagination-controls button {
    padding: 3px 8px;
    border: 1px solid #ddd;
    background: #fff;
    cursor: pointer;
    border-radius: 4px;
}

    .pagination-controls button:disabled {
        opacity: 0.5;
        cursor: default;
    }
/* Badges */
.badge-ativo {
    background-color: #d1e7dd;
    color: #0f5132;
    padding: 2px 6px;
    border-radius: 4px;
}

.badge-inativo {
    background-color: #f8d7da;
    color: #721c24;
    padding: 2px 6px;
    border-radius: 4px;
}

.badge-warning {
    background-color: #fff3cd;
    color: #856404;
    padding: 2px 6px;
    border-radius: 4px;
    border: 1px solid #ffeeba;
}
/* --- TOPO: Título e Botões (Unificado) --- */
.form-section-title {
    margin-top: 0;
    padding-bottom: 8px;
    margin-bottom: 20px;
    color: var(--color-primary);
    border-bottom: 2px solid var(--color-secondary);
    /* Flexbox essencial para alinhar botões à direita */
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap; /* Permite quebra suave em telas médias */
}

    .form-section-title h3 {
        margin: 0;
        font-size: 1.3em;
        font-weight: bold;
    }

    .form-section-title h4 {
        margin: 0;
        font-size: 1.0em;
        font-weight: bold;
    }

@media (max-width: 768px) {
    .form-section-title h3 {
        margin: 0;
        font-size: 1.1em;
        font-weight: bold;
    }

    .form-section-title h4 {
        margin: 0;
        font-size: 0.9em;
        font-weight: bold;
    }
}


.top-actions {
    display: flex;
    gap: 10px;
}
/* Responsividade do Título (Celular) */
@media (max-width: 768px) {
    .form-section-title {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }

        .form-section-title h3 {
            width: 100%;
        }

    .top-actions {
        width: 100%;
        justify-content: flex-start;
        flex-wrap: wrap;
    }

        .top-actions .header-btn {
            flex-grow: 1;
            justify-content: center;
        }
}
/* ==========================================================================
   6. MÓDULOS ESPECÍFICOS E MODAIS
   ========================================================================== */
/* Login Container - CENTRALIZAÇÃO ABSOLUTA */
.login-container {
    /*background: #fff;*/
    background: var(--color-primary);
    padding: 40px 30px;
    border-radius: 12px;
    box-shadow: 0 8px 30px rgba(25, 73, 61, 0.2);
    width: 90%;
    max-width: 400px;
    text-align: center;
    /* Centralização Robusta (Sem afetar o body) */
    position: absolute; /* Solta o elemento do fluxo normal */
    top: 50%; /* Empurra o topo para o meio da tela */
    left: 50%; /* Empurra a esquerda para o meio da tela */
    transform: translate(-50%, -50%); /* Traz de volta metade do tamanho para centralizar exato */

    margin: 0; /* Remove margens automáticas antigas */
}

    .login-container .logo {
        max-width: 200px;
        margin-bottom: 25px; /* Mais espaço abaixo do logo */
        display: block;
        margin-left: auto;
        margin-right: auto;
    }

.forgot-password {
    text-align: right;
    margin-top: -10px; /* Ajuste fino para colar no input de cima */
    margin-bottom: 20px; /* Espaço antes do botão */
    font-size: 0.9em;
}

    .forgot-password a {
        color: #fff;
        text-decoration: none;
    }
/* Rodapé da Versão (Dentro do box de login) */
.login-container .footer {
    margin-top: 30px;
    padding-top: 15px;
    border-top: 1px solid #f0f0f0; /* Linha sutil separando */
    color: #fff;
    font-size: 0.85em;
}
/* Modal de Lupa */
.lookup-modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.6);
    padding-top: 60px;
}

.lookup-modal-content {
    background-color: #fefefe;
    margin: 3% auto;
    padding: 0;
    border-radius: 8px;
    width: 90%;
    max-width: 800px;
    height: 80vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
    animation: fadeIn 0.3s;
}

.lookup-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid var(--color-secondary);
    padding: 15px;
}

    .lookup-header h3 {
        margin: 0;
        color: var(--color-primary);
    }

.lookup-close-btn {
    background: none;
    border: none;
    font-size: 28px;
    color: #aaa;
    cursor: pointer;
}
/* --- BARRA DE PESQUISA NO MODAL (CORREÇÃO) --- */
.lookup-search-bar {
    margin-top: 15px;
    display: flex;
    align-items: stretch;
    width: 100%;
    margin-bottom: 15px;
}
    /* Input específico da pesquisa (sem padding de label) */
    .lookup-search-bar input {
        flex-grow: 1; /* Ocupa o espaço disponível */
        width: auto; /* Reseta largura fixa se houver */
        padding: 0 15px !important; /* Padding normal centralizado */
        height: 45px !important; /* Altura balanceada */
        font-size: 1em;
        border: 1px solid #ddd;
        border-radius: 6px 0 0 6px !important; /* Arredonda só a esquerda */
        border-right: none; /* Remove borda direita para colar no botão */
        outline: none;
        box-sizing: border-box;
        background-color: #fff;
    }

        .lookup-search-bar input:focus {
            border-color: var(--color-primary);
        }
    /* Botão da Lupa (Quadrado ao lado do input) */
    .lookup-search-bar button {
        padding: 0;
        width: 50px; /* Largura fixa para o botão */
        height: 45px !important; /* Mesma altura do input */
        background-color: var(--color-primary);
        color: white;
        border: 1px solid var(--color-primary);
        border-radius: 0 6px 6px 0 !important; /* Arredonda só a direita */
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 1.1em;
        box-sizing: border-box;
    }

        .lookup-search-bar button:hover {
            filter: brightness(1.1);
        }
/* Ajustes para Modais de Edição (Reutilizam formulários) */
.edit-modal-content .form-section-title {
    display: none;
}

.edit-modal-content .dashboard-box {
    padding-top: 10px;
    box-shadow: none;
    width: 100%;
}

.edit-modal-content #message.message-box {
    margin-bottom: 15px;
    width: 100%;
    box-sizing: border-box;
}
/* Tree View (Menu Admin) */
.menu-tree-wrapper {
    background-color: #f9f9f9;
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 20px;
    padding-bottom: 50px;
    min-height: 300px;
}

.menu-tree-ul {
    list-style: none;
    padding-left: 30px;
    min-height: 15px;
    margin: 0;
    border-left: 1px dashed rgba(0,0,0,0.05);
}

.menu-tree-content {
    display: flex;
    align-items: center;
    background: #fff;
    border: 1px solid #ccc;
    padding: 8px 12px;
    border-radius: 4px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.sortable-ghost {
    opacity: 0.4;
    background-color: #e0f7fa;
    border: 2px dashed var(--color-primary);
}
/* Modal de PDF / Assinatura */
.modal-assinatura-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    z-index: 2000;
    justify-content: center;
    align-items: center;
}

.modal-assinatura-content {
    background: white;
    width: 90%;
    max-width: 1200px;
    height: 90%;
    border-radius: 6px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.4);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.modal-body {
    flex-grow: 1;
    background: #f9f9f9;
    position: relative;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.modal-iframe {
    width: 100%;
    height: 100%;
    border: none;
}
/* Animações */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}
/* ==========================================================================
   7. MÓDULO AP - ANTECIPAÇÃO TERMO (Cards e Assinatura)
   ========================================================================== */
/* Grid de Cards (Lado a Lado) */
.grid-info {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

@media (max-width: 768px) {
    .grid-info {
        grid-template-columns: 1fr;
    }
}
/* Estilo do Card */
.card-termo {
    background: #fff;
    border-radius: 8px;
    padding: 20px;
    height: 100%;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
    border: 1px solid #f0f0f0;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}
/* Cabeçalho do Card */
.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid var(--color-secondary);
    padding-bottom: 12px;
    margin-bottom: 15px;
}

    .card-header h4 {
        margin: 0;
        color: var(--color-primary);
        font-size: 0.9em;
        font-weight: bold;
    }

@media (max-width: 768px) {
    .card-header h4 {
        margin: 0;
        color: var(--color-primary);
        font-size: 0.9em;
        font-weight: bold;
    }
}

/* Botão Editar (Pequeno no topo do card) */
.btn-edit {
    background-color: var(--color-primary);
    color: white;
    padding: 4px 12px;
    border-radius: 4px;
    text-decoration: none !important;
    font-size: 0.8em;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    transition: all 0.2s ease;
    font-weight: 500;
}

    .btn-edit:hover {
        filter: brightness(1.1);
        color: white;
        transform: translateY(-1px);
    }
/* Grupos de Informação */
.info-group {
    margin-bottom: 12px;
}

.info-label {
    font-weight: 600;
    color: #888;
    display: block;
    font-size: 0.8em;
    margin-bottom: 2px;
    text-transform: uppercase;
}

.info-value {
    color: #333;
    font-size: 1em;
    font-weight: 500;
    display: block;
    word-break: break-word;
}




/* Área de Termo Ativo */
.active-term-wrapper {
    padding: 20px 25px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.status-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    text-align: left;
}

.check-icon {
    font-size: 2.2em;
    color: #28a745;
    flex-shrink: 0;
}

.status-text {
    font-size: 1em;
    color: #555;
    line-height: 1.4;
    max-width: 650px;
}

@media (max-width: 768px) {
    .status-row {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 5px;
        text-align: left;
    }

    .check-icon {
        font-size: 1.2em;
        color: #28a745;
        flex-shrink: 0;
    }

    .status-text {
        font-size: 0.7em;
        color: #555;
        line-height: 1.0;
        max-width: 768px;
    }

    .info-label {
        font-weight: 600;
        color: #888;
        display: block;
        font-size: 0.6em;
        margin-bottom: 2px;
        text-transform: uppercase;
    }

    .info-value {
        color: #333;
        font-size: 0.8em;
        font-weight: 500;
        display: block;
        word-break: break-word;
    }
}


/* Botões de Ação (Visualizar/Log/Assinar) */
.action-buttons-container {
    display: flex;
    justify-content: center; /* Centraliza os botões */
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 15px;
}
/* Variações do Botão Padrão para esta tela */
.BotaoPadrao.btn-view {
    background-color: #fff;
    color: var(--color-primary);
    border: 1px solid var(--color-primary);
    width: auto; /* Permite tamanho variável */
    padding: 8px 16px;
}

    .BotaoPadrao.btn-view:hover {
        background-color: #f5f5f5;
    }

.BotaoPadrao.btn-action {
    width: auto;
    padding: 8px 25px;
    font-weight: bold;
}
/* ==========================================================================
   8. MÓDULO SS - ADMINISTRAÇÃO DE PERFIL (Árvore de Permissões)
   ========================================================================== */
/* Container da Árvore */
.permission-tree {
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 15px;
    max-height: 400px;
    overflow-y: auto;
    background: #fff;
    margin-bottom: 20px;
}
/* Bloco de Módulo (Caixa Externa) */
.tree-module {
    margin-bottom: 15px;
    border: 1px solid #eee;
    border-radius: 4px;
    overflow: hidden;
}
/* Cabeçalho do Módulo (Cinza) */
.tree-header {
    font-weight: bold;
    display: flex;
    align-items: center;
    gap: 10px;
    background: #e9ecef;
    padding: 10px 15px;
    color: #333;
    border-bottom: 1px solid #eee;
}
/* Conteúdo Interno do Módulo */
.tree-content {
    padding: 10px;
    background-color: #fff;
}
/* --- Listas Hierárquicas (UL/LI) --- */
.tree-ul {
    list-style-type: none;
    padding-left: 20px; /* Indentação para filhos */
    margin: 0;
}
    /* Linha guia vertical opcional para níveis profundos */
    .tree-ul .tree-ul {
        border-left: 1px solid #eee;
        margin-left: 5px;
        padding-left: 15px;
    }

    .tree-ul li {
        margin-bottom: 5px;
        position: relative;
    }
/* Linha de Item (Programa/Menu) */
.tree-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 0;
    transition: background-color 0.2s;
}

    .tree-row:hover {
        background-color: #f9f9f9;
        border-radius: 4px;
    }
    /* Checkbox e Label */
    .tree-row input[type="checkbox"] {
        margin: 0;
        cursor: pointer;
    }

    .tree-row label {
        cursor: pointer;
        font-size: 0.95em;
        color: #333;
        display: flex;
        align-items: center;
    }
    /* Ícones dentro da árvore */
    .tree-row i {
        margin-right: 8px;
        width: 16px;
        text-align: center;
    }
/* AS: Menu Admin (Drag & Drop) */
.filter-bar {
    background: #fafafa;
    border: 1px solid #eee;
    border-radius: 6px;
    padding: 15px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.tree-legend {
    margin-bottom: 10px;
    padding: 0 5px;
    display: flex;
    gap: 15px;
    font-size: 0.9em;
    color: #555;
}

.menu-tree-wrapper {
    background: #f9f9f9;
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 20px;
    padding-bottom: 50px;
    min-height: 300px;
}

.menu-tree-ul {
    list-style: none;
    padding-left: 30px;
    margin: 0;
    border-left: 1px dashed rgba(0,0,0,0.05);
    padding-top: 5px;
}

#menuTreeContainer > .menu-tree-ul {
    padding-left: 0;
    border-left: none;
}

.menu-tree-content {
    display: flex;
    align-items: center;
    background: #fff;
    border: 1px solid #ccc;
    padding: 8px 12px;
    border-radius: 4px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
    user-select: none;
}

    .menu-tree-content:hover {
        background-color: #f0f8ff;
        border-color: #b3d7ff;
    }

.drag-handle {
    cursor: grab;
    color: #999;
    padding: 5px 10px 5px 0;
    font-size: 1.2em;
}

.item-text {
    flex-grow: 1;
    font-size: 0.95em;
    font-weight: 500;
}

.sortable-ghost {
    opacity: 0.4;
    background-color: #e0f7fa;
    border: 2px dashed var(--color-primary);
}
/* ==========================================================================
   9. COMPONENTES DE ABAS (TABS) - Usado em Definição de Banco
   ========================================================================== */

.tabs-header {
    display: flex;
    border-bottom: 2px solid #eee;
    margin-bottom: 20px;
    gap: 5px;
}

.tab-link {
    padding: 10px 20px;
    cursor: pointer;
    background-color: #f9f9f9;
    border: 1px solid #eee;
    border-bottom: none;
    border-radius: 6px 6px 0 0;
    font-weight: 600;
    color: #666;
    transition: all 0.2s;
}

    .tab-link:hover {
        background-color: #eef5f9;
        color: var(--color-primary);
    }

    .tab-link.active {
        background-color: #fff;
        border-color: #eee;
        border-bottom: 2px solid #fff; /* Cobre a linha de baixo para conectar */
        margin-bottom: -2px; /* Posiciona sobre a linha */
        color: var(--color-primary);
        border-top: 3px solid var(--color-secondary);
    }

.tab-content {
    display: none;
    animation: fadeIn 0.3s;
}

    .tab-content.active {
        display: block;
    }
    /* Ajuste para Grids/Containers que estejam DENTRO de uma aba */
    /* Removemos paddings e sombras extras para encaixar perfeitamente */
    .tab-content .full-height-container {
        margin-top: 0 !important;
        height: auto !important;
        padding: 0 !important;
    }

    .tab-content .full-height-box {
        box-shadow: none !important;
        border-radius: 0 !important;
    }

    .tab-content .box-header-area {
        padding: 15px 0 15px 0 !important;
        margin-bottom: 10px;
    }

    .tab-content .grid-wrapper {
        padding: 0 !important;
    }

/* 1. Força a exibição do cabeçalho/botões dentro das abas 
      (Vence a regra global que esconde títulos em modais) */
.edit-modal-content .tab-content .form-section-title {
    display: flex !important;
}

/* 2. Restaura o espaçamento vertical que pode ter sido zerado */
.tab-content .box-header-area {
    padding: 15px 0 !important;
    margin-bottom: 10px;
    display: block !important;
}

/* Garante que os botões fiquem na mesma linha */
.tab-content .form-actions {
    display: flex !important;
    flex-direction: row !important; /* Força linha */
    justify-content: center; /* Centraliza o grupo de botões */
    align-items: center;
    gap: 15px; /* Espaço entre eles */
    margin-top: 30px;
    flex-wrap: nowrap; /* Impede quebra de linha */
}

    /* Garante que os botões não tentem ocupar 100% da largura individualmente */
    .tab-content .form-actions .BotaoPadrao {
        width: auto !important;
        min-width: 150px; /* Tamanho mínimo elegante */
        flex-grow: 0;
        margin-top: 0 !important; /* Remove margem superior que pode causar desalinhamento */
    }


/* ==========================================================================
   10. CORREÇÃO COMPLEXIDADE DE SENHA (SS)
   ========================================================================== */

.complexity-indicator {
    text-align: left !important; /* Força alinhar à esquerda, ignorando o centro do login */
    background-color: #f9f9f9;
    padding: 15px;
    border: 1px solid #ddd;
    border-radius: 6px;
    margin-bottom: 20px;
    margin-top: -10px; /* Aproxima do campo de senha */
    font-size: 0.85em;
    color: #555;
}

    .complexity-indicator p {
        font-weight: bold;
        margin: 0 0 8px 0;
        color: #31a426;
        font-size: 1em;
    }

    .complexity-indicator ul {
        list-style: none; /* Remove as bolinhas padrão */
        padding-left: 0;
        margin: 0;
    }

    .complexity-indicator li {
        margin-bottom: 4px;
        display: flex;
        align-items: center;
        gap: 6px;
    }
    /* Estados de Validação */
    .complexity-indicator .invalid {
        color: #dc3545;
    }

        .complexity-indicator .invalid::before {
            content: '✕'; /* Adiciona um X visual */
            font-weight: bold;
        }

    .complexity-indicator .valid {
        color: #31a426;
        font-weight: bold;
    }

        .complexity-indicator .valid::before {
            content: '✓'; /* Adiciona um Check visual */
            font-weight: bold;
        }

    .complexity-indicator.hidden {
        display: none;
    }


/* ==========================================================================
   11. ESTILO DOS MODAIS GLOBAIS (CONFIRM/ALERT)
   ========================================================================== */

#portalConfirmModal {
    position: fixed;
    z-index: 9999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
}

.portal-confirm-content {
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
    width: 90%;
    max-width: 450px;
    animation: modalFadeIn 0.3s;
    overflow: hidden; /* Para o header */
}

/* Header (Padrão Novo) */
.portal-confirm-title {
    margin: 0;
    padding: 15px 20px;
    background-color: #fff;
    border-bottom: 2px solid var(--color-secondary); /* Linha colorida */
    font-size: 1.2em;
    color: var(--color-primary);
    font-weight: bold;
    text-align: left; /* Alinhado à esquerda */
}

/* Corpo */
#portalConfirmMessage {
    padding: 20px;
    font-size: 1em;
    color: #333;
    line-height: 1.5;
}

/* Botões */
.portal-confirm-actions {
    padding: 15px 20px;
    background-color: #f9f9f9;
    border-top: 1px solid #eee;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

    .portal-confirm-actions button {
        padding: 8px 20px;
        border-radius: 4px;
        cursor: pointer;
        font-weight: bold;
        border: none;
        font-size: 0.9em;
    }

#portalConfirmBtnNo {
    background-color: #e0e0e0;
    color: #333;
}

#portalConfirmBtnYes {
    background-color: var(--color-primary);
    color: #fff;
}

/* ==========================================================================
   12. CORREÇÃO MODAL DE ASSINATURA E PDF (BOX)
   ========================================================================== */

/* Garante que o modal de assinatura tenha prioridade de estilo */
.modal-assinatura-content .modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background-color: #fff;
    border-bottom: 2px solid var(--color-secondary); /* Linha verde limão */
    min-height: 50px; /* Garante altura mínima */
}

/* Título do Modal */
.modal-assinatura-content .modal-title {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; /* Fonte padrão do sistema */
    font-size: 1.4em;
    font-weight: bold;
    color: var(--color-primary); /* Verde escuro */
    margin: 0;
}

/* Botão Fechar (X) */
.modal-assinatura-content .modal-close {
    background: transparent;
    border: none;
    color: #999;
    font-size: 2rem; /* Tamanho maior para o X */
    font-weight: normal;
    cursor: pointer;
    line-height: 1;
    padding: 0 10px;
    transition: color 0.2s;
    outline: none;
}

    .modal-assinatura-content .modal-close:hover {
        color: var(--color-primary); /* Verde ao passar o mouse */
    }

/* Ajuste do corpo para o iframe não colar no header */
.modal-assinatura-content .modal-body {
    flex-grow: 1;
    background-color: #f4f7fa;
    position: relative;
    padding: 0;
    overflow: hidden; /* Evita scroll duplo */
}

/* Ajuste do Iframe */
.modal-iframe {
    width: 100%;
    height: 100%;
    border: none;
    display: block;
}

/* ==========================================================================
   13. GRIDS DE FORMULÁRIO RESPONSIVOS (PADRÃO)
   ========================================================================== */

/* Título de Seção (Linha colorida abaixo) */
.section-title {
    color: var(--color-primary);
    border-bottom: 2px solid var(--color-secondary);
    margin-top: 25px;
    margin-bottom: 15px;
    font-size: 0.9em;
    font-weight: 600;
    padding-bottom: 5px;
}

/* Grid Base (Mobile First - 1 Coluna) */
.custom-grid {
    display: grid;
    gap: 15px;
    grid-template-columns: 1fr;
    margin-bottom: 10px;
}

/* ==========================================================================
   14. FEEDBACK VISUAL (ICONES DE VALIDAÇÃO)
   ========================================================================== */

/* SUCESSO: Check Verde */
.input-success {
    /*border-color: #28a745 !important;*/
    padding-right: 35px !important;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%2328a745'%3E%3Cpath d='M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 20px;
}

/* ERRO: X Vermelho */
.input-error {
    border-color: #dc3545 !important;
    background-color: #fff8f8 !important; /* Fundo levemente avermelhado */
    padding-right: 35px !important;
    /* Ícone de X Vermelho (SVG Base64) */
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23dc3545'%3E%3Cpath d='M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 20px;
}

    /* Remove ícones em campos desabilitados ou readonly */
    .input-success:disabled, .input-success[readonly],
    .input-error:disabled, .input-error[readonly] {
        background-image: none !important;
        border-color: #ddd !important;
        background-color: #e9ecef !important;
    }

.field-error-msg {
    color: #dc3545;
    font-size: 11px;
    font-weight: bold;
}
