﻿/* Estilos inline para asegurar que funcionen en todos los mÃ³dulos */
.navbar {
    min-height: 58px;
    padding: 0.4rem 1rem;
}

.brand-container {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    line-height: 1.1;
    padding: 0.1rem 0;
}

.brand-top {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin-bottom: 0;
}

.brand-icon {
    width: 45px;
    height: 45px;
    object-fit: cover;
    object-position: center;
    border-radius: 50%;
    margin-right: 0.5rem;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    transition: transform 0.3s ease, box-shadow 0.3s ease, filter 0.3s ease;
    filter: none;
    image-rendering: -webkit-optimize-contrast;
    image-rendering: high-quality;
}

.brand-title {
    font-size: 1.35rem;
    font-weight: 700;
    color: #FFFFFF;
    letter-spacing: 0.02em;
    text-transform: none;
    line-height: 1;
    white-space: nowrap;
}

.brand-line {
    width: 100%;
    height: 1.5px;
    background: #5C9EFF;
    margin: 0.2rem 0 0.2rem 0;
    position: relative;
}

.brand-line::after {
    content: '';
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 4px;
    background: #5C9EFF;
    border-radius: 50%;
    box-shadow: 5px 0 0 1.5px #5C9EFF, 10px 0 0 1px rgba(92, 158, 255, 0.6);
}

.brand-subtitle {
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.7);
    font-weight: 400;
    letter-spacing: 0.01em;
    text-transform: capitalize;
    margin-top: 0.05rem;
    white-space: nowrap;
}

.navbar-brand {
    padding: 0.3rem 0;
    text-decoration: none;
}

.navbar-brand:hover {
    text-decoration: none;
}

.navbar-brand:hover .brand-title {
    color: rgba(255, 255, 255, 0.9);
}

.navbar-brand:hover .brand-icon {
    transform: scale(1.08);
    filter: none;
    box-shadow: 0 4px 14px rgba(0,0,0,0.3), 0 0 18px rgba(255,255,255,0.35);
}

.navbar-brand:hover .brand-line {
    background: #7BB3FF;
}

.navbar-brand:hover .brand-line::after {
    background: #7BB3FF;
    box-shadow: 8px 0 0 2.5px #7BB3FF, 16px 0 0 2px rgba(123, 179, 255, 0.6);
}

.navbar-brand:hover .brand-subtitle {
    color: rgba(255, 255, 255, 0.85);
}

.navbar-nav .nav-link {
    font-size: 0.88rem;
    font-weight: 500;
    padding: 0.4rem 0.7rem;
    margin: 0 0.03rem;
    white-space: nowrap;
    position: relative;
    transition: background-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease, color 0.2s ease;
}

.navbar-nav .nav-link i {
    font-size: 0.88rem;
    margin-right: 0.25rem;
    transition: transform 0.2s ease, opacity 0.2s ease;
}

.navbar-nav .nav-link.active {
    background: linear-gradient(90deg, rgba(255, 255, 255, 0.26) 0%, rgba(255, 255, 255, 0.14) 100%) !important;
    border-radius: 0.375rem;
    font-weight: 600;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.16), inset 0 0 0 1px rgba(255, 255, 255, 0.14);
    transform: translateX(2px);
}

.navbar-nav .nav-link:hover {
    background-color: rgba(255, 255, 255, 0.16);
    border-radius: 0.375rem;
    transform: translateX(2px);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.14);
}

.navbar-nav .nav-link:hover i,
.navbar-nav .nav-link.active i {
    transform: translateX(1px);
}

.dropdown-menu {
    border: none;
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
    border-radius: 0.5rem;
    margin-top: 0.5rem;
    padding: 0.5rem 0;
    min-width: 220px;
}

.dropdown-item {
    padding: 0.6rem 1.25rem;
    font-size: 0.95rem;
    transition: all 0.2s ease;
}

.dropdown-item i {
    font-size: 1rem;
    width: 1.3rem;
    text-align: center;
}

.dropdown-item:hover {
    background-color: #f8f9fa;
    color: #495057;
    transform: translateX(5px);
}

.dropdown-toggle::after {
    margin-left: 0.4rem;
    transition: transform 0.2s ease;
}

.dropdown.show .dropdown-toggle::after {
    transform: rotate(180deg);
}

.navbar-toggler {
    padding: 0.35rem 0.6rem;
    font-size: 0.95rem;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.navbar-toggler-icon {
    width: 1.15em;
    height: 1.15em;
}

/* Responsive - Tablets y MÃ³viles */
@media (max-width: 991.98px) {
    .navbar {
        min-height: 56px;
        padding: 0.5rem 1rem;
    }
    
    .brand-title {
        font-size: 1.2rem;
    }
    
    .brand-icon {
        font-size: 1.1rem;
    }
    
    .brand-subtitle {
        font-size: 0.65rem;
    }
    
    .brand-line {
        height: 1.5px;
    }
    
    .brand-container {
        padding: 0.1rem 0;
    }
    
    .navbar-brand {
        padding: 0.3rem 0;
        max-width: calc(100% - 60px);
    }

    /* Navbar toggler mÃ¡s grande y visible */
    .navbar-toggler {
        padding: 0.6rem 0.9rem;
        font-size: 1.1rem;
        border: 2px solid rgba(255, 255, 255, 0.5);
        border-radius: 0.5rem;
        min-width: 48px;
        min-height: 48px;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .navbar-toggler:focus {
        box-shadow: 0 0 0 0.25rem rgba(255, 255, 255, 0.25);
    }

    .navbar-toggler-icon {
        width: 1.5em;
        height: 1.5em;
    }

    /* MenÃº colapsado con mejor espaciado - !important para prevenir conflictos */
    .navbar-collapse {
        background-color: rgba(13, 110, 253, 0.98) !important;
        margin-top: 0.5rem !important;
        padding: 1rem !important;
        border-radius: 0.5rem !important;
        box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1) !important;
        max-height: calc(100vh - 80px) !important;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch !important;
    }

    /* Links con Ã¡rea de toque mÃ¡s grande - !important para prevenir conflictos */
    .navbar-nav {
        width: 100% !important;
    }

    .navbar-nav .nav-item {
        width: 100% !important;
        margin-bottom: 0.25rem !important;
    }

    .navbar-nav .nav-link {
        padding: 0.85rem 1rem !important;
        font-size: 0.95rem !important;
        width: 100% !important;
        display: flex !important;
        align-items: center !important;
        border-radius: 0.5rem !important;
        min-height: 48px !important;
        touch-action: manipulation !important;
        -webkit-tap-highlight-color: rgba(255, 255, 255, 0.2) !important;
    }

    .navbar-nav .nav-link i {
        font-size: 1.1rem;
        margin-right: 0.75rem;
        width: 24px;
        text-align: center;
    }

    /* Dropdowns mÃ¡s amigables en mÃ³vil - !important para prevenir conflictos */
    .nav-item.dropdown {
        width: 100% !important;
    }

    .dropdown-toggle {
        display: flex !important;
        align-items: center !important;
        justify-content: space-between !important;
        width: 100% !important;
    }

    .dropdown-toggle::after {
        margin-left: auto !important;
        margin-right: 0.5rem !important;
        transition: transform 0.3s ease !important;
    }

    .dropdown.show .dropdown-toggle::after {
        transform: rotate(180deg) !important;
    }

    .dropdown-menu {
        position: static !important;
        float: none !important;
        width: 100% !important;
        margin-top: 0.5rem !important;
        margin-bottom: 0.5rem !important;
        background-color: rgba(0, 0, 0, 0.2) !important;
        border: 1px solid rgba(255, 255, 255, 0.1) !important;
        box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1) !important;
        border-radius: 0.5rem !important;
        padding: 0.5rem 0 !important;
        margin-left: 0 !important;
    }

    .dropdown-item {
        padding: 0.9rem 1.25rem !important;
        font-size: 0.95rem !important;
        color: rgba(255, 255, 255, 0.9) !important;
        display: flex !important;
        align-items: center !important;
        min-height: 48px !important;
        touch-action: manipulation !important;
        -webkit-tap-highlight-color: rgba(255, 255, 255, 0.2) !important;
    }

    .dropdown-item i {
        font-size: 1.1rem;
        width: 24px;
        margin-right: 0.75rem;
        text-align: center;
    }

    .dropdown-item:active,
    .dropdown-item:focus {
        background-color: rgba(255, 255, 255, 0.25);
        color: white;
    }

    .dropdown-item:hover {
        background-color: rgba(255, 255, 255, 0.2);
        color: white;
        transform: none;
    }

    /* Separador visual para dropdowns */
    .dropdown-menu .dropdown-item:first-child {
        border-top-left-radius: 0.5rem;
        border-top-right-radius: 0.5rem;
    }

    .dropdown-menu .dropdown-item:last-child {
        border-bottom-left-radius: 0.5rem;
        border-bottom-right-radius: 0.5rem;
    }

    /* Mejorar visibilidad del usuario dropdown */
    .navbar-nav .dropdown-menu-end {
        margin-top: 0.5rem;
    }

    /* Espaciado para el menÃº de usuario */
    .navbar-nav:last-child {
        border-top: 1px solid rgba(255, 255, 255, 0.2);
        margin-top: 0.75rem;
        padding-top: 0.75rem;
    }
}

/* Responsive - MÃ³viles pequeÃ±os */
@media (max-width: 576px) {
    .navbar {
        min-height: 54px;
        padding: 0.4rem 0.75rem;
    }
    
    .brand-title {
        font-size: 1.1rem;
    }
    
    .brand-icon {
        font-size: 1rem;
        margin-right: 0.3rem;
    }
    
    .brand-subtitle {
        font-size: 0.6rem;
    }
    
    .brand-line {
        height: 1.5px;
        margin: 0.2rem 0 0.1rem 0;
    }
    
    .brand-container {
        padding: 0.08rem 0;
    }
    
    .navbar-brand {
        padding: 0.25rem 0;
        max-width: calc(100% - 55px);
    }
    
    .brand-top {
        gap: 0.3rem;
    }

    .navbar-toggler {
        padding: 0.55rem 0.8rem;
        font-size: 1rem;
        min-width: 44px;
        min-height: 44px;
    }

    .navbar-toggler-icon {
        width: 1.3em;
        height: 1.3em;
    }

    .navbar-collapse {
        padding: 0.75rem;
        margin-top: 0.5rem;
    }

    .navbar-nav .nav-link {
        padding: 0.8rem 0.9rem;
        font-size: 0.9rem;
        min-height: 44px;
    }

    .navbar-nav .nav-link i {
        font-size: 1rem;
        width: 22px;
        margin-right: 0.65rem;
    }

    .dropdown-item {
        padding: 0.85rem 1rem;
        font-size: 0.9rem;
        min-height: 44px;
    }

    .dropdown-item i {
        font-size: 1rem;
        width: 22px;
        margin-right: 0.65rem;
    }
}

/* Mejorar scroll en mÃ³viles y tablets */
@media (max-width: 991.98px) {
    .navbar-collapse::-webkit-scrollbar {
        width: 6px;
    }

    .navbar-collapse::-webkit-scrollbar-track {
        background: rgba(0, 0, 0, 0.1);
        border-radius: 3px;
    }

    .navbar-collapse::-webkit-scrollbar-thumb {
        background: rgba(255, 255, 255, 0.3);
        border-radius: 3px;
    }

    .navbar-collapse::-webkit-scrollbar-thumb:hover {
        background: rgba(255, 255, 255, 0.4);
    }
}

/* Ajustes especÃ­ficos para tablets (768px - 991px) */
@media (min-width: 768px) and (max-width: 991.98px) {
    .navbar-collapse {
        padding: 1.25rem;
    }

    .navbar-nav .nav-link {
        padding: 0.9rem 1.1rem;
        font-size: 1rem;
    }

    .dropdown-item {
        padding: 1rem 1.5rem;
        font-size: 1rem;
    }

    /* Mejorar el espaciado en tablets */
    .navbar-nav .nav-item {
        margin-bottom: 0.4rem;
    }
}

/* Pantallas grandes */
@media (min-width: 1400px) {
    .navbar {
        padding: 0.45rem 1.1rem;
    }
    
    .brand-title {
        font-size: 1.5rem;
    }
    
    .brand-icon {
        width: 50px;
        height: 50px;
    }
    
    .brand-subtitle {
        font-size: 0.75rem;
    }
}

/* Escritorio: mÃ³dulos en columna fija a la IZQUIERDA + marca en el panel */
@media (min-width: 992px) {
    body {
        --sidebar-rail-topbar-h: 52px;
        --sidebar-rail-w: 232px;
    }

    /* Por encima del contenido del mÃ³dulo (cards, sticky, etc.) pero debajo del backdrop de modal (1050) */
    .navbar {
        position: sticky;
        top: 0;
        z-index: 1048;
        min-height: 0;
        padding: 0;
        background: transparent !important;
        border: none;
        box-shadow: none;
    }

    main.app-content {
        position: relative;
    }

    .navbar .container-fluid {
        display: block;
        padding-left: 0;
        padding-right: 0;
    }

    .navbar .navbar-toggler {
        display: none !important;
    }

    /* Barra superior solo mÃ³vil */
    .navbar-top-mobile {
        display: none !important;
    }

    #navbarMain.navbar-collapse {
        position: fixed !important;
        top: 0;
        left: 0;
        right: auto !important;
        bottom: 0;
        width: min(var(--sidebar-rail-w), 92vw);
        max-height: 100vh !important;
        display: flex !important;
        flex-direction: column !important;
        align-items: stretch !important;
        justify-content: flex-start;
        padding: 0.5rem 0.42rem 0.7rem !important;
        margin: 0 !important;
        background: linear-gradient(180deg, #0d6efd 0%, #0b5ed7 50%, #0a58ca 100%) !important;
        box-shadow: 8px 0 24px rgba(0, 0, 0, 0.12);
        overflow-y: auto !important;
        overflow-x: hidden;
        -webkit-overflow-scrolling: touch;
        z-index: 1049;
        border-right: 1px solid rgba(255, 255, 255, 0.2);
        border-radius: 0 !important;
        transition: transform 0.28s ease, box-shadow 0.28s ease, visibility 0.28s ease;
        will-change: transform;
    }

    body.nav-rail-collapsed:not(.pos-fullscreen) #navbarMain.navbar-collapse {
        transform: translateX(calc(-100% - 8px));
        visibility: hidden;
        box-shadow: none;
        pointer-events: none;
    }

    /* Primer frame tras carga: sin transiciÃ³n para evitar parpadeo al restaurar rail colapsado desde localStorage */
    body.nav-rail-collapsing-init:not(.pos-fullscreen),
    body.nav-rail-collapsing-init:not(.pos-fullscreen) #navbarMain.navbar-collapse {
        transition: none !important;
    }

    /* Cabecera escritorio: marca con espacio amplio; botÃ³n al extremo derecho del rail */
    #navbarMain .sidebar-brand-header {
        display: flex;
        flex-direction: row;
        align-items: center;
        justify-content: flex-start;
        gap: 0.45rem;
        width: 100%;
        margin: 0 0 0.5rem;
        padding: 0.25rem 0.2rem 0.55rem 0.15rem;
        border-bottom: 1px solid rgba(255, 255, 255, 0.25);
        flex-shrink: 0;
        position: sticky;
        top: 0;
        z-index: 2;
        /* Mantener visible la marca al hacer scroll del menÃº lateral */
        background: linear-gradient(180deg, #0d6efd 0%, #0b5ed7 55%, #0a58ca 100%);
    }

    /* Marca dentro del panel (escritorio): ocupa el ancho disponible; el botÃ³n queda separado */
    #navbarMain .navbar-brand-sidebar {
        flex-direction: column;
        align-items: center;
        text-align: center;
        margin: 0;
        padding: 0 0.25rem 0 0;
        flex: 1 1 auto;
        min-width: 0;
        border-bottom: none;
    }

    #navbarMain .sidebar-brand-header .sidebar-rail-toggle {
        flex-shrink: 0;
        align-self: center;
        margin-left: auto;
    }

    /* BotÃ³n rail: animaciÃ³n y feedback (panel y barra superior) */
    .sidebar-rail-toggle {
        width: 38px;
        height: 38px;
        padding: 0;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        border: 1px solid rgba(255, 255, 255, 0.55);
        border-radius: 0.45rem;
        background: linear-gradient(180deg, rgba(255, 255, 255, 0.2) 0%, rgba(255, 255, 255, 0.08) 100%);
        color: #fff !important;
        cursor: pointer;
        transition: background 0.26s ease, border-color 0.26s ease, transform 0.24s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.26s ease, filter 0.26s ease;
        box-shadow: 0 2px 10px rgba(0, 0, 0, 0.16);
    }

    .sidebar-rail-toggle:not(.sidebar-rail-toggle--panel-open) {
        border-color: rgba(255, 255, 255, 0.75);
        background: linear-gradient(180deg, rgba(255, 255, 255, 0.28) 0%, rgba(255, 255, 255, 0.12) 100%);
        box-shadow: 0 4px 16px rgba(13, 110, 253, 0.24);
    }

    .sidebar-rail-toggle.sidebar-rail-toggle--panel-open {
        background: linear-gradient(180deg, rgba(255, 255, 255, 0.22) 0%, rgba(255, 255, 255, 0.08) 100%);
        box-shadow: 0 2px 10px rgba(0, 0, 0, 0.16);
    }

    .sidebar-rail-toggle:hover {
        background: linear-gradient(180deg, rgba(255, 255, 255, 0.3) 0%, rgba(255, 255, 255, 0.16) 100%);
        border-color: rgba(255, 255, 255, 0.9);
        transform: translateY(-1px) scale(1.06);
        box-shadow: 0 6px 18px rgba(0, 0, 0, 0.24);
        filter: brightness(1.05);
    }

    .sidebar-rail-toggle:active {
        transform: translateY(0) scale(0.93);
        transition-duration: 0.09s;
    }

    .sidebar-rail-toggle:focus-visible {
        outline: 2px solid rgba(255, 255, 255, 0.95);
        outline-offset: 3px;
    }

    /* Icono hamburguesa â†’ X cuando el panel estÃ¡ abierto (ocultar menÃº) */
    .sidebar-rail-toggle-burger {
        width: 20px;
        height: 14px;
        position: relative;
        display: inline-block;
        vertical-align: middle;
        transition: transform 0.34s cubic-bezier(0.22, 1, 0.36, 1);
    }

    .sidebar-rail-toggle-burger span {
        position: absolute;
        left: 0;
        right: 0;
        height: 2px;
        background: currentColor;
        border-radius: 2px;
        transition: transform 0.34s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.22s ease, top 0.34s cubic-bezier(0.22, 1, 0.36, 1), width 0.22s ease;
    }

    .sidebar-rail-toggle-burger span:nth-child(1) { top: 0; }
    .sidebar-rail-toggle-burger span:nth-child(2) { top: 6px; }
    .sidebar-rail-toggle-burger span:nth-child(3) { top: 12px; }

    .sidebar-rail-toggle--panel-open .sidebar-rail-toggle-burger span:nth-child(1) {
        top: 6px;
        transform: rotate(45deg);
    }

    .sidebar-rail-toggle--panel-open .sidebar-rail-toggle-burger span:nth-child(2) {
        opacity: 0;
        transform: scaleX(0);
        width: 0;
    }

    .sidebar-rail-toggle--panel-open .sidebar-rail-toggle-burger span:nth-child(3) {
        top: 6px;
        transform: rotate(-45deg);
    }

    .sidebar-rail-toggle--panel-open .sidebar-rail-toggle-burger {
        transform: rotate(90deg);
    }

    /* Barra superior cuando el menÃº estÃ¡ colapsado: no tapa tÃ­tulos del mÃ³dulo */
    .sidebar-rail-topbar {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        height: var(--sidebar-rail-topbar-h, 52px);
        z-index: 1048;
        align-items: center;
        justify-content: space-between;
        gap: 1rem;
        padding: 0 16px 0 14px;
        box-sizing: border-box;
        background: linear-gradient(90deg, #0d6efd 0%, #0b5ed7 55%, #0a58ca 100%);
        border-bottom: 1px solid rgba(255, 255, 255, 0.2);
        box-shadow: 0 4px 20px rgba(13, 110, 253, 0.25);
    }

    .sidebar-rail-quick {
        flex: 1 1 auto;
        min-width: 0;
        display: none;
        align-items: center;
        justify-content: center;
        gap: 0.45rem;
        flex-wrap: nowrap;
        overflow-x: auto;
        overflow-y: hidden;
        padding: 0 0.35rem;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: thin;
        scrollbar-color: rgba(255, 255, 255, 0.45) transparent;
    }

    .sidebar-rail-quick::-webkit-scrollbar {
        height: 4px;
    }

    .sidebar-rail-quick::-webkit-scrollbar-thumb {
        background: rgba(255, 255, 255, 0.35);
        border-radius: 4px;
    }

    .sidebar-rail-quick-link {
        display: inline-flex;
        align-items: center;
        gap: 0.35rem;
        padding: 0.32rem 0.72rem;
        border-radius: 999px;
        background: rgba(255, 255, 255, 0.14);
        border: 1px solid rgba(255, 255, 255, 0.32);
        color: #fff !important;
        font-size: 0.78rem;
        font-weight: 600;
        text-decoration: none !important;
        white-space: nowrap;
        flex-shrink: 0;
        transition: background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease, transform 0.15s ease;
        box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12);
    }

    .sidebar-rail-quick-link:hover {
        background: rgba(255, 255, 255, 0.26);
        border-color: rgba(255, 255, 255, 0.5);
        color: #fff !important;
        transform: translateY(-1px);
        box-shadow: 0 3px 10px rgba(0, 0, 0, 0.18);
    }

    .sidebar-rail-quick-link i {
        font-size: 0.82rem;
        opacity: 0.95;
    }

    body.nav-rail-collapsed:not(.pos-fullscreen) .sidebar-rail-quick {
        display: flex;
    }

    .sidebar-rail-topbar-brand {
        display: inline-flex;
        align-items: center;
        gap: 0.5rem;
        min-width: 0;
        flex: 0 0 auto;
        color: #fff !important;
        text-decoration: none !important;
        margin-right: 0.5rem;
        transition: opacity 0.2s ease;
    }

    .sidebar-rail-topbar .sidebar-rail-toggle {
        flex-shrink: 0;
    }

    .sidebar-rail-topbar-right {
        display: flex;
        align-items: center;
        gap: 0.45rem;
        flex-shrink: 0;
    }

    .sidebar-rail-end {
        display: flex;
        align-items: center;
        gap: 0.4rem;
        flex-shrink: 0;
    }

    .sidebar-rail-quick-link--logout {
        border-color: rgba(255, 200, 200, 0.45);
        background: rgba(255, 255, 255, 0.1);
    }

    .sidebar-rail-quick-link--logout:hover {
        background: rgba(220, 53, 69, 0.35);
        border-color: rgba(255, 200, 200, 0.65);
        color: #fff !important;
    }

    .sidebar-rail-topbar-brand:hover {
        color: #fff !important;
        opacity: 0.92;
    }

    .sidebar-rail-topbar-brand img {
        width: 36px;
        height: 36px;
        object-fit: cover;
        border-radius: 50%;
        flex-shrink: 0;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    }

    .sidebar-rail-topbar-brand .sidebar-rail-topbar-title {
        font-weight: 700;
        font-size: 1.05rem;
        letter-spacing: 0.02em;
        white-space: nowrap;
    }


    #navbarMain .navbar-brand-sidebar .brand-container {
        align-items: center;
    }

    #navbarMain .navbar-brand-sidebar .brand-top {
        flex-direction: column;
        gap: 0.22rem;
    }

    #navbarMain .navbar-brand-sidebar .brand-icon {
        width: 42px;
        height: 42px;
        margin-right: 0 !important;
    }

    #navbarMain .navbar-brand-sidebar .brand-title {
        font-size: 1.02rem;
        letter-spacing: 0.02em;
    }

    #navbarMain .navbar-brand-sidebar .brand-line {
        width: 65%;
        max-width: 132px;
        margin: 0.22rem auto;
    }

    #navbarMain .navbar-brand-sidebar .brand-subtitle {
        font-size: 0.6rem;
    }

    body.nav-rail-collapsed:not(.pos-fullscreen) .sidebar-rail-topbar {
        display: flex !important;
    }

    body.pos-fullscreen .sidebar-rail-topbar {
        display: none !important;
    }

    #navbarMain .navbar-nav {
        flex-direction: column !important;
        width: 100% !important;
    }

    #navbarMain .navbar-nav.me-auto {
        margin-right: 0 !important;
        margin-left: 0 !important;
        flex: 1 1 auto;
    }

    #navbarMain .navbar-nav .nav-item {
        width: 100%;
    }

    #navbarMain .navbar-nav .nav-link {
        padding: 0.35rem 0.48rem;
        border-radius: 0.3rem;
        white-space: normal;
        border-left: 2px solid transparent;
        font-size: 0.82rem;
        font-weight: 500;
    }

    #navbarMain .navbar-nav .nav-link i {
        font-size: 0.8rem;
        margin-right: 0.22rem !important;
    }

    #navbarMain .navbar-nav .nav-link:hover {
        border-left-color: rgba(255, 255, 255, 0.45);
    }

    #navbarMain .navbar-nav .nav-link.active {
        border-left-color: #ffffff;
    }

    #navbarMain .nav-link.dropdown-toggle {
        display: flex;
        align-items: center;
        flex-wrap: nowrap;
        gap: 0.32rem;
        width: 100%;
        text-align: left;
    }

    #navbarMain .nav-link.dropdown-toggle::after {
        margin-left: auto;
        flex-shrink: 0;
    }

    #navbarMain .nav-module-ventas {
        margin-top: 0.28rem;
        padding-top: 0.28rem;
        border-top: 1px solid rgba(255, 255, 255, 0.18);
    }

    #navbarMain .dropdown-menu {
        position: static !important;
        transform: none !important;
        float: none !important;
        width: 100% !important;
        margin: 0.12rem 0 0.28rem !important;
        background: rgba(0, 0, 0, 0.22) !important;
        border: 1px solid rgba(255, 255, 255, 0.12) !important;
        box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
    }

    #navbarMain .dropdown-item {
        color: rgba(255, 255, 255, 0.95);
        padding: 0.32rem 0.55rem;
        font-size: 0.78rem;
        border-radius: 0.28rem;
        transition: background 0.2s ease, transform 0.2s ease, color 0.2s ease;
    }

    #navbarMain .dropdown-item i {
        font-size: 0.78rem;
        width: 1.1rem;
    }

    #navbarMain .dropdown-item:hover,
    #navbarMain .dropdown-item:focus {
        background: rgba(255, 255, 255, 0.15);
        color: #fff;
        transform: translateX(3px);
    }

    #navbarMain .dropdown-item.active {
        background: rgba(255, 255, 255, 0.2) !important;
        color: #fff !important;
        font-weight: 600;
    }

    #navbarMain .navbar-nav:last-child {
        border-top: 1px solid rgba(255, 255, 255, 0.2);
        margin-top: 0.38rem;
        padding-top: 0.38rem;
        flex: 0 0 auto;
    }

    body:not(.pos-fullscreen) {
        padding-left: min(var(--sidebar-rail-w), 92vw);
        padding-right: 0;
        padding-top: 0;
        box-sizing: border-box;
        transition: padding-left 0.28s ease, padding-top 0.28s ease;
    }

    body.nav-rail-collapsed:not(.pos-fullscreen) {
        padding-left: 0 !important;
        padding-top: var(--sidebar-rail-topbar-h, 52px);
    }

    body.pos-fullscreen {
        padding-left: 0 !important;
        padding-top: 0 !important;
    }
}

/* MÃ³vil: franja con logo + botÃ³n menÃº */
@media (max-width: 991.98px) {
    .navbar {
        background: var(--bs-primary) !important;
        padding: 0.35rem 0;
    }

    #navbarMain .sidebar-brand-header {
        display: none !important;
    }

    .navbar-top-mobile {
        display: flex !important;
        align-items: center;
        justify-content: space-between;
        width: 100%;
        padding: 0.35rem 0.65rem;
        gap: 0.5rem;
    }

    .navbar-top-mobile .navbar-brand {
        margin-right: 0;
        padding-top: 0.25rem;
        padding-bottom: 0.25rem;
        min-width: 0;
    }

    .navbar-top-mobile .navbar-toggler {
        flex-shrink: 0;
    }
}

@media (max-width: 991.98px) {
    body.nav-rail-collapsed {
        padding-left: 0 !important;
    }

    body.nav-rail-collapsed #navbarMain.navbar-collapse {
        transform: none;
        visibility: visible;
        pointer-events: auto;
    }

    .sidebar-rail-topbar {
        display: none !important;
    }
}

@media print {
    #navbarMain.navbar-collapse {
        display: none !important;
    }

    .sidebar-rail-topbar {
        display: none !important;
    }

    body {
        padding-left: 0 !important;
        padding-right: 0 !important;
        padding-top: 0 !important;
    }
}

.surgimax-sync-pill,
.surgimax-alertas-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.28rem 0.55rem;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 600;
    line-height: 1.2;
    white-space: nowrap;
    border: 1px solid rgba(255, 255, 255, 0.35);
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    text-decoration: none !important;
}

.surgimax-sync-pill--ok { background: rgba(25, 135, 84, 0.35); border-color: rgba(255, 255, 255, 0.4); }
.surgimax-sync-pill--pending { background: rgba(255, 193, 7, 0.35); color: #fff; }
.surgimax-sync-pill--fail { background: rgba(220, 53, 69, 0.45); }
.surgimax-sync-pill--offline { background: rgba(108, 117, 125, 0.55); }
.surgimax-sync-pill--idle { background: rgba(255, 255, 255, 0.1); }

.surgimax-sync-pill .surgimax-sync-pending.is-hidden {
    display: none !important;
}

.surgimax-tenant-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    max-width: min(240px, 42vw);
    padding: 0.26rem 0.55rem;
    border-radius: 999px;
    font-size: 0.68rem;
    font-weight: 600;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    border: 1px solid rgba(255, 255, 255, 0.32);
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
}

.surgimax-tenant-pill i {
    font-size: 0.72rem;
    opacity: 0.9;
    flex-shrink: 0;
}

.surgimax-tenant-pill__text {
    overflow: hidden;
    text-overflow: ellipsis;
}

.surgimax-navbar-meta {
    width: 100%;
    padding: 0 0.55rem 0.4rem;
    gap: 0.35rem;
    flex-wrap: wrap;
    border-top: 1px solid rgba(255, 255, 255, 0.14);
    background: rgba(0, 0, 0, 0.06);
}

.surgimax-nav-status-inline {
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
    margin-left: auto;
}

.sidebar-rail-topbar-right .surgimax-tenant-pill {
    max-width: min(280px, 28vw);
    font-size: 0.7rem;
}

#navbarMain .surgimax-nav-status {
    padding: 0.35rem 0.5rem 0.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.18);
    margin-top: 0.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

#navbarMain .surgimax-sidebar-sync {
    margin-top: auto;
}

.finca-sync-now-btn {
    font-weight: 700;
    letter-spacing: 0.01em;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
}

.finca-sync-now-btn--pending {
    background: #ffc107 !important;
    border-color: #ffca2c !important;
    color: #1a1a1a !important;
}

.finca-sync-now-btn--pending:hover,
.finca-sync-now-btn--pending:focus {
    background: #ffcd39 !important;
    border-color: #ffc720 !important;
    color: #111 !important;
}

#navbarMain .sidebar-brand-header .finca-sync-now-btn {
    margin-left: auto;
}

.sidebar-rail-topbar-right .finca-sync-now-btn {
    min-width: 7.5rem;
}

@media (min-width: 992px) {
    .sidebar-rail-topbar-right {
        max-width: 42vw;
        overflow: visible;
    }
}
