:root {
    --ad-menu-size: 360px;
    --ad-menu-item-color: #26A69A;

    --bs-primary:        #1E3A5F;
    --bs-primary-rgb:    30, 58, 95;
    --bs-link-color:     #1E3A5F;
    --bs-link-color-rgb: 30, 58, 95;
    --bs-link-hover-color:     #152D4D;
    --bs-link-hover-color-rgb: 21, 45, 77;
}

/* Botões primários */
.btn-primary, .btn-primary:focus {
    background-color: #1E3A5F !important;
    border-color: #1E3A5F !important;
    color: #fff !important;
}
.btn-primary:hover, .btn-primary:active, .btn-primary:focus-visible,
.btn-primary.active, .btn-primary:disabled {
    background-color: #152D4D !important;
    border-color: #152D4D !important;
    color: #fff !important;
}
.btn-outline-primary {
    color: #1E3A5F !important;
    border-color: #1E3A5F !important;
}
.btn-outline-primary:hover, .btn-outline-primary:focus, .btn-outline-primary.active {
    background-color: #1E3A5F !important;
    color: #fff !important;
}

/* Links genéricos */
a { color: #1E3A5F; }
a:hover { color: #152D4D; }
.text-primary { color: #1E3A5F !important; }

/* Badges / fundos primários */
.bg-primary { background-color: #1E3A5F !important; }
.border-primary { border-color: #1E3A5F !important; }

/* Foco de inputs em verde (em vez de azul Bootstrap) */
.form-control:focus, .form-select:focus, .form-check-input:focus {
    border-color: #7EB0DE !important;
    box-shadow: 0 0 0 .15rem rgba(30,58,95,.18) !important;
}
.form-check-input:checked {
    background-color: #1E3A5F !important;
    border-color: #1E3A5F !important;
}

/* Cor verde nativa para todos os checkboxes/radios (incluindo Adianti TCheckButton/TRadioButton) */
input[type="checkbox"], input[type="radio"] {
    accent-color: #1E3A5F;
}
input[type="checkbox"]:checked, input[type="radio"]:checked {
    accent-color: #1E3A5F;
}
/* Fallback para classes específicas do Adianti */
input.filled-in:checked + label::after,
input.filled-in:checked + label::before,
input.tswitch:checked,
.btn-check:checked + .btn { background-color: #1E3A5F !important; border-color: #1E3A5F !important; }

/* ===== Sidebar verde (gestão ambiental) ===== */
#sidebar {
    display: flex !important;
    flex-direction: row !important;
    overflow: hidden !important;
}
#module-menu {
    background: #002E25 !important;
    flex-shrink: 0;
}
#menu-wrapper {
    flex: 1 1 0%;
    overflow-y: auto;
    overflow-x: hidden;
    max-height: 100vh;
}
[data-menu-theme=dark] #sidebar,
[data-menu-theme=light] #sidebar {
    background: linear-gradient(180deg, #004D40 0%, #00695C 100%) !important;
    color: #fff !important;
}
#sidebar a, #sidebar .nav-link, #sidebar .menu-title, #sidebar span, #sidebar .name {
    color: #B2DFDB !important;
}
#sidebar a:hover, #sidebar .nav-link:hover {
    background: rgba(255,255,255,.10) !important;
    color: #fff !important;
}
#sidebar .nav-link.active,
#sidebar a.active,
#sidebar li.active > a {
    background: rgba(0,0,0,.25) !important;
    color: #fff !important;
    box-shadow: inset 3px 0 0 #F5941E !important;
}
#sidebar .sidebar-system-name {
    color: #fff !important;
    border-bottom: 1px solid rgba(255,255,255,.15) !important;
}
#sidebar .sidebar-menu-title { color: rgba(255,255,255,.6) !important; }
#sidebar i { color: #80CBC4 !important; }
#sidebar .nav-link:hover i,
#sidebar .nav-link.active i { color: #fff !important; }
/* Search box e barra superior */
#sidebar #search-box input {
    background: rgba(255,255,255,.12) !important;
    color: #fff !important;
    border-color: rgba(255,255,255,.2) !important;
}
#sidebar #search-box input::placeholder { color: rgba(255,255,255,.6) !important; }

/* Footer fixo na base da área de conteúdo */
.main { padding-bottom: 46px !important; }
.main > footer.footer {
    position: fixed;
    bottom: 0;
    left: var(--ad-menu-size, 300px);
    right: 0;
    z-index: 1000;
    background: #fff;
    border-top: 1px solid #dee2e6;
    box-shadow: 0 -2px 6px rgba(0,0,0,.04);
    margin: 0 !important;
    padding: 6px 12px !important;
}
.main > footer.footer .container-fluid { padding: 0; }
.main > footer.footer .row { margin: 0; }
.main > footer.footer .col-12 { padding: 0; }
.main > footer.footer .col-12 > div { display: flex; align-items: center; justify-content: flex-end; gap: 6px; flex-wrap: wrap; }
body:has(#sidebar.collapsed) .main > footer.footer { left: 0; }

@media (max-width: 767.98px) {
    .main > footer.footer {
        left: 0;
        z-index: 0;
        padding: 4px 8px !important;
    }
    .main > footer.footer .col-12 {
        display: flex !important;
        align-items: center;
        justify-content: space-between;
    }
    .main > footer.footer .col-12 > span {
        font-size: 11px !important;
        white-space: nowrap;
        float: none !important;
        padding: 0 !important;
        flex-shrink: 0;
    }
    .main > footer.footer .col-12 > div {
        justify-content: flex-end;
        flex-wrap: nowrap;
        gap: 4px;
    }
    .main > footer.footer .col-12 > div > a.btn {
        font-size: 11px;
        padding: 2px 6px !important;
        white-space: nowrap;
    }
}

/* ===== Hierarquia visual: submenus vs links diretos ===== */
#sidebar .dropdown-submenu > a.sidebar-link[data-bs-toggle="collapse"] {
    border-left: 2px solid #F5941E;
    background: rgba(255,255,255,.06);
    font-weight: 500;
    padding-left: 12px;
}
#sidebar .dropdown-submenu > a.sidebar-link[data-bs-toggle="collapse"]:hover {
    background: rgba(255,255,255,.12) !important;
}
#sidebar .sidebar-link[data-bs-toggle="collapse"]::after {
    border-color: #F5941E;
    padding: 3px;
}