body {
    font-family: 'Manrope', sans-serif;
    background: #f4f7fb;
    color: #1f2937;
}

.app-shell {
    overflow-x: hidden;
}

.sidebar {
    width: 292px;
    min-width: 292px;
    background: linear-gradient(180deg, #0a4785 0%, #0f5fa8 42%, #1068b6 100%);
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    transition: width 0.25s ease, min-width 0.25s ease, transform 0.25s ease;
    z-index: 1030;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.28) transparent;
}

.sidebar-brand-copy {
    padding: 0.85rem 1rem 0.4rem;
}

.sidebar-brand-copy img {
    max-width: 100%;
    opacity: 0.98;
}

.sidebar-nav .nav-item {
    list-style: none;
}

.sidebar-nav .nav-link {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    padding: 0.7rem 0.8rem;
    color: #f8fbff;
    border-radius: 0.95rem;
    border: 1px solid transparent;
    background: transparent;
}

.sidebar-nav .nav-link p {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin: 0;
    flex: 1;
}

.sidebar-nav .nav-link:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.08);
    color: #ffffff;
}

.sidebar-nav .nav-link.active {
    background: rgba(255, 255, 255, 0.98);
    color: #0b4a8b;
    font-weight: 700;
}

.sidebar-nav .nav-treeview {
    display: none;
    margin: 0.15rem 0 0.45rem;
    padding-left: 1rem;
    position: relative;
}

.sidebar-nav .menu-open > .nav-treeview {
    display: block;
}

.sidebar-nav .nav-treeview .nav-link {
    padding: 0.58rem 0.75rem;
    color: rgba(248, 251, 255, 0.92);
}

body.sidebar-collapsed .sidebar {
    width: 88px;
    min-width: 88px;
}

body.sidebar-collapsed .sidebar-section-title,
body.sidebar-collapsed .sidebar-nav .nav-link p {
    display: none;
}

body.sidebar-collapsed .sidebar-nav .nav-link {
    justify-content: center;
    padding-inline: 0.5rem;
}

body.sidebar-collapsed .sidebar-nav .nav-treeview {
    display: none !important;
}

@media (max-width: 991.98px) {
    .sidebar {
        position: fixed;
        left: 0;
        transform: translateX(-100%);
        box-shadow: 0 24px 60px rgba(15, 23, 42, 0.18);
    }

    body.sidebar-open .sidebar {
        transform: translateX(0);
    }

    body.sidebar-open::before {
        content: '';
        position: fixed;
        inset: 0;
        background: rgba(15, 23, 42, 0.3);
        z-index: 1020;
    }
}

@media (min-width: 992px) {
    body.sidebar-open::before {
        display: none;
    }
}


.topbar {
    backdrop-filter: blur(10px);
}

.content-card,
.auth-card {
    background: #fff;
    border-radius: 20px;
    border: 1px solid rgba(148, 163, 184, 0.16);
}

.stat-card {
    border-radius: 18px;
    padding: 1.25rem;
    background: #fff;
    border: 1px solid rgba(148, 163, 184, 0.15);
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.05);
}

.avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
}

.avatar-fallback {
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: #0f172a;
    color: #fff;
}

.notification-menu {
    width: 320px;
}

.auth-shell {
    min-height: 100vh;
    background: #004c9e;
}

.auth-shell .btn-primary {
    background-color: #004c9e;
    border-color: #004c9e;
}

.auth-shell .btn-primary:hover,
.auth-shell .btn-primary:focus,
.auth-shell .btn-primary:active {
    background-color: #003d7f;
    border-color: #003d7f;
}

.auth-shell .btn-primary:focus {
    box-shadow: 0 0 0 0.25rem rgba(0, 76, 158, 0.25);
}

.table td,
.table th {
    vertical-align: middle;
}

.select2-container {
    width: 100% !important;
}

.select2-container .select2-selection--single,
.select2-container .select2-selection--multiple {
    min-height: calc(1.5em + 0.75rem + 2px);
    border: 1px solid #ced4da;
    border-radius: 0.375rem;
    background-color: #fff;
}

.select2-container--default .select2-selection--single {
    padding: 0.375rem 2.25rem 0.375rem 0.75rem;
}

.select2-container--default .select2-selection--single .select2-selection__rendered {
    color: #212529;
    line-height: 1.5;
    padding-left: 0;
    padding-right: 0;
}

.select2-container--default .select2-selection--single .select2-selection__arrow {
    height: 100%;
    right: 0.5rem;
}

.select2-container--default .select2-selection--single .select2-selection__placeholder {
    color: #6c757d;
}

.select2-container--default .select2-selection--multiple {
    padding: 0.25rem 0.5rem;
}

.select2-container--default .select2-selection--multiple .select2-search__field {
    margin-top: 0;
}

.select2-container--default.select2-container--focus .select2-selection--single,
.select2-container--default.select2-container--focus .select2-selection--multiple,
.select2-container--default .select2-selection--single:focus,
.select2-container--default .select2-selection--multiple:focus {
    border-color: #86b7fe;
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
}

.select2-dropdown {
    border: 1px solid rgba(148, 163, 184, 0.35);
    border-radius: 0.75rem;
    overflow: hidden;
    box-shadow: 0 16px 40px rgba(15, 23, 42, 0.12);
}

.select2-search--dropdown {
    padding: 0.75rem;
}

.select2-search--dropdown .select2-search__field {
    border: 1px solid #ced4da;
    border-radius: 0.5rem;
    padding: 0.5rem 0.75rem;
}

.select2-results__option {
    padding: 0.5rem 0.75rem;
}

.select2-container--default .select2-results__option--highlighted.select2-results__option--selectable {
    background-color: rgb(0, 76, 158);
}

.dataTables_wrapper .dataTables_filter input,
.dataTables_wrapper .dataTables_length select {
    border: 1px solid #ced4da;
    border-radius: 0.375rem;
    padding: 0.375rem 0.75rem;
    background: #fff;
}

.dataTables_wrapper .dataTables_filter input:focus,
.dataTables_wrapper .dataTables_length select:focus {
    border-color: #86b7fe;
    outline: 0;
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
}

.dataTables_wrapper .dataTables_paginate .paginate_button {
    padding: 0 !important;
    border: 0 !important;
    background: transparent !important;
}

.dataTables_wrapper .dataTables_paginate .page-link {
    border-radius: 0.5rem !important;
}

/* Sidebar Specific Visual Overrides for active nodes and readability */
.sidebar-nav .nav-link.active,
.sidebar-nav .show > .nav-link {
    background-color: rgba(255, 255, 255, 0.98) !important;
    color: #0b4a8b !important;
    font-weight: 600;
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.12) !important;
    border-radius: 12px !important;
}

.sidebar-nav .nav-link.active .nav-icon,
.sidebar-nav .nav-link.active p,
.sidebar-nav .nav-link.active .nav-arrow {
    color: #004c9e !important;
}

.sidebar-nav .nav-link {
    border-radius: 12px !important;
    transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.sidebar-nav .nav-link:hover {
    background-color: rgba(255, 255, 255, 0.08);
}

.sidebar-nav .nav-icon {
    font-size: 1.1rem;
    min-width: 1.1rem;
    text-align: center;
    opacity: 0.95;
}

/* Espaciado del arbol secundario - aplica SOLO cuando la barra no esta colapsada */
body:not(.sidebar-collapsed) .sidebar-nav .nav-treeview {
    padding-left: 1.25rem;
}

body:not(.sidebar-collapsed) .sidebar-nav .nav-treeview::before {
    content: '';
    position: absolute;
    top: 0.35rem;
    bottom: 0.45rem;
    left: 0.3rem;
    width: 1px;
    background: rgba(255, 255, 255, 0.16);
}
