:root {
    --primary: #085979;
    --secondary: #F97316;
    --neutral-light: #F4F7F9;
    --neutral-mid: #CBD5DF;
    --neutral-dark: #0F172A;
    --text-light: #F8F9FA;
    --text-dark: #212529;
    --bs-danger-rgb: 220, 53, 69;
}

body {
    background-color: var(--neutral-light);
    color: var(--text-dark);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    font-size: 1.2em;
}

.app-wrapper {
    display: flex;
    flex-grow: 1;
}

.sidebar {
    width: 240px;
    flex-shrink: 0;
    background-color: #FFF;
    border-right: 1px solid var(--neutral-mid);
    padding: 1rem;
    transition: transform 0.3s ease;
}

.sidebar-header {
    display: none; /* Oculto en desktop, visible en mobile */
}

.sidebar .nav-link {
    color: var(--text-dark);
    border-radius: 0.375rem;
    margin-bottom: 0.25rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.sidebar .nav-link.active,
.sidebar .nav-link:hover {
    background-color: rgba(8, 89, 121, 0.1);
    color: var(--primary);
    font-weight: 600;
}

.sidebar-footer {
    margin-top: auto;
    padding-top: 1rem;
    border-top: 1px solid var(--neutral-mid);
}

.main-content {
    flex-grow: 1;
    overflow-y: auto;
    padding: 1.5rem;
    background-color: var(--neutral-light);
}

.top-header {
    background-color: var(--primary);
    color: var(--text-light);
    padding: 0.75rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.top-header .navbar-brand {
    color: var(--text-light);
    font-weight: 600;
    font-size: 1.25rem;
}

.top-header .navbar-brand:hover {
    color: white;
}

.top-header .user-info {
    color: var(--text-light);
}

.sidebar-toggler {
    color: rgba(255, 255, 255, 0.8);
    border: none;
    background: transparent;
    font-size: 1.5rem;
    display: none; /* Oculto en escritorio */
}

.sidebar-toggler:hover {
    color: white;
}

/* Estilos Responsivos */
@media (max-width: 991.98px) {
    .app-wrapper {
        flex-direction: column;
    }

    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        height: 100%;
        z-index: 1050;
        transform: translateX(-100%);
        box-shadow: 0 0.5rem 1rem rgba(0,0,0,0.15);
        display: flex;
        flex-direction: column;
    }

    .sidebar.show {
        transform: translateX(0);
    }
    
    .sidebar-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding-bottom: 1rem;
        border-bottom: 1px solid var(--neutral-mid);
        margin-bottom: 1rem;
    }
    
    .sidebar-header .navbar-brand {
        color: var(--primary);
    }

    .sidebar-toggler {
        display: block; /* Visible en móvil */
    }

    .main-content {
        padding-top: 1rem;
    }

    .overlay {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background-color: rgba(0, 0, 0, 0.5);
        z-index: 1040;
        display: none;
    }

    .overlay.show {
        display: block;
    }
}

/* --- Sidebar Submenu --- */
.sidebar .nav-item .collapse {
    padding-left: 1.25rem;
    border-left: 3px solid var(--neutral-mid);
    margin-left: 0.75rem;
}

.sidebar .nav-item .list-unstyled {
    padding-left: 0;
    margin-top: 0.25rem;
}

.sidebar .nav-item .list-unstyled .nav-link {
    padding: 0.35rem 1rem;
    font-size: 0.9rem;
}

    .sidebar .nav-item .list-unstyled .nav-link:hover,
    .sidebar .nav-item .list-unstyled .nav-link.active {
        background-color: rgba(8, 89, 121, 0.15); /* Un fondo más sutil para el hover/active */
    }


.sidebar .nav-link[data-bs-toggle="collapse"] {
    position: relative;
}

.sidebar .nav-link[data-bs-toggle="collapse"]::after {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    content: "\F285"; /* Bootstrap Icon chevron-right */
    font-family: 'bootstrap-icons';
    transition: transform 0.2s ease-in-out;
}

.sidebar .nav-link[data-bs-toggle="collapse"][aria-expanded="true"]::after {
    transform: translateY(-50%) rotate(90deg);
}

/* DataTables header fix */
.dataTables_wrapper .dataTables_length label,
.dataTables_wrapper .dataTables_filter label,
.dataTables_wrapper .dataTables_info,
.dataTables_wrapper .dataTables_paginate .paginate_button {
    color: var(--text-dark) !important;
}

table.dataTable thead th {
    color: var(--text-dark) !important;
    background-color: var(--neutral-mid) !important; /* Ensure a distinct background */
}

table.dataTable tbody td {
    color: var(--text-dark) !important;
}

.form-label {
    margin-bottom: 0;
}

.form-control, .form-select {
    padding: 1px 8px;
}