:root {
    --xex-nav-h: 56px;
    --xex-subnav-h: 0px;
    --xex-bottomnav-h: 0px;
    --xex-sticky-top: calc(var(--xex-nav-h) + var(--xex-subnav-h));
}

body.xex-has-bottomnav {
    padding-bottom: calc(var(--xex-bottomnav-h) + 8px);
}

/* ── Navbar principal ── */
.xex-navbar {
    background: #000 !important;
    min-height: var(--xex-nav-h);
    z-index: 1030;
    padding-top: env(safe-area-inset-top, 0px);
}

.xex-navbar .navbar-brand img {
    height: 36px;
    object-fit: contain;
}

.xex-nav-desktop .nav-link {
    color: rgba(255, 255, 255, .85) !important;
    font-size: .82rem;
    font-weight: 600;
    padding: .4rem .65rem !important;
    border-radius: 8px;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: .35rem;
}

.xex-nav-desktop .nav-link:hover {
    color: #fff !important;
    background: rgba(255, 255, 255, .1);
}

.xex-nav-desktop .nav-link.active {
    color: #fff !important;
    background: rgba(13, 110, 253, .55);
}

.xex-nav-desktop .nav-link.xex-nav-accent {
    background: #0d6efd;
    color: #fff !important;
}

.xex-nav-desktop .nav-link.xex-nav-accent:hover {
    background: #0b5ed7;
}

.xex-nav-dropdown .dropdown-menu {
    border: none;
    box-shadow: 0 8px 24px rgba(0, 0, 0, .15);
    border-radius: 12px;
    padding: .35rem;
}

.xex-nav-dropdown .dropdown-item {
    border-radius: 8px;
    font-size: .85rem;
    font-weight: 600;
    padding: .45rem .75rem;
}

.xex-nav-dropdown .dropdown-item.active {
    background: #e7f1ff;
    color: #0d6efd;
}

/* ── Offcanvas móvil ── */
.xex-offcanvas .offcanvas-header {
    background: #111;
    color: #fff;
}

.xex-offcanvas .offcanvas-body {
    padding: 0;
    padding-bottom: calc(var(--xex-bottomnav-h, 0px) + 96px + env(safe-area-inset-bottom, 0px));
    background: #fafbfc;
}

.xex-mobile-nav-group {
    padding: .75rem 1rem .25rem;
    font-size: .68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: #6c757d;
}

.xex-mobile-nav-link {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .85rem 1rem;
    color: #212529;
    text-decoration: none;
    font-weight: 600;
    font-size: .92rem;
    border-bottom: 1px solid #eee;
}

.xex-mobile-nav-link i {
    width: 1.25rem;
    text-align: center;
    color: #0d6efd;
}

.xex-mobile-nav-link.active {
    background: #e7f1ff;
    color: #0d6efd;
}

.xex-mobile-nav-link:hover {
    background: #f1f3f5;
    color: #212529;
}

/* ── Sub-navegación contextual ── */
.xex-subnav-wrap {
    position: sticky;
    top: var(--xex-nav-h);
    z-index: 1020;
    background: #fff;
    border-bottom: 1px solid #dee2e6;
    box-shadow: 0 2px 6px rgba(0, 0, 0, .04);
}

.xex-subnav {
    display: flex;
    gap: .25rem;
    overflow-x: auto;
    padding: .5rem 0;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
}

.xex-subnav::-webkit-scrollbar {
    display: none;
}

.xex-subnav-label {
    font-size: .72rem;
    font-weight: 700;
    color: #6c757d;
    white-space: nowrap;
    padding: .35rem .5rem .35rem 0;
    align-self: center;
}

.xex-subnav a {
    white-space: nowrap;
    font-size: .8rem;
    font-weight: 600;
    padding: .35rem .75rem;
    border-radius: 999px;
    text-decoration: none;
    color: #495057;
    border: 1px solid #dee2e6;
    background: #fff;
}

.xex-subnav a:hover {
    background: #f8f9fa;
    color: #212529;
}

.xex-subnav a.active {
    background: #0d6efd;
    border-color: #0d6efd;
    color: #fff;
}

/* ── Breadcrumbs ── */
.xex-breadcrumb-bar {
    padding: .65rem 0 .25rem;
}

.xex-breadcrumb-bar .breadcrumb {
    margin: 0;
    font-size: .82rem;
}

/* ── Barra inferior móvil ── */
.xex-bottomnav {
    display: none;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    height: 62px;
    background: #fff;
    border-top: 1px solid #dee2e6;
    box-shadow: 0 -4px 16px rgba(0, 0, 0, .08);
    z-index: 1040;
    padding: 0 .25rem;
    padding-bottom: env(safe-area-inset-bottom, 0);
}

.xex-bottomnav-inner {
    display: flex;
    height: 100%;
    align-items: stretch;
    justify-content: space-around;
    max-width: 520px;
    margin: 0 auto;
}

.xex-bottomnav a,
.xex-bottomnav button {
    flex: 1 1 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    font-size: .62rem;
    font-weight: 700;
    color: #6c757d;
    text-decoration: none;
    border: none;
    background: transparent;
    padding: .25rem;
    min-width: 0;
}

.xex-bottomnav a i,
.xex-bottomnav button i {
    font-size: 1.15rem;
}

.xex-bottomnav a.active,
.xex-bottomnav button.active {
    color: #0d6efd;
}

.xex-bottomnav .xex-bn-accent {
    color: #fff;
    background: #0d6efd;
    border-radius: 12px;
    margin: 6px 4px;
    flex: 0 0 auto;
    width: 52px;
}

.xex-bottomnav .xex-bn-accent i {
    font-size: 1.25rem;
}

/* ── Inquilino: nav secciones en dashboard ── */
.xex-inq-section-nav {
    position: sticky;
    top: var(--xex-sticky-top);
    z-index: 1015;
    background: #fff;
    border-bottom: 1px solid #eee;
    margin: 0 0 1rem;
    padding: .5rem 0;
    overflow-x: auto;
    scrollbar-width: none;
}

.xex-inq-section-nav::-webkit-scrollbar {
    display: none;
}

.xex-inq-section-nav-inner {
    display: flex;
    gap: .35rem;
    min-width: min-content;
}

.xex-inq-section-nav a {
    white-space: nowrap;
    font-size: .78rem;
    font-weight: 600;
    padding: .4rem .85rem;
    border-radius: 999px;
    text-decoration: none;
    color: #495057;
    border: 1px solid #dee2e6;
}

.xex-inq-section-nav a.active {
    background: #198754;
    border-color: #198754;
    color: #fff;
}

/* ── Ajustes sticky existentes ── */
.gantt-head-sticky {
    top: var(--xex-sticky-top) !important;
}

.listado-sticky-top {
    top: var(--xex-sticky-top) !important;
}

@media (max-width: 991.98px) {
    :root {
        --xex-bottomnav-h: 62px;
    }

    body.xex-auth .xex-bottomnav {
        display: none !important;
    }

    body.xex-auth {
        padding-bottom: 0 !important;
    }

    .xex-bottomnav {
        display: block;
    }

    body.xex-has-bottomnav {
        --xex-bottomnav-h: 62px;
    }
}

@media (min-width: 992px) {
    .xex-subnav-wrap + .container .xex-breadcrumb-bar:first-child,
    .xex-subnav-wrap ~ .container .xex-breadcrumb-bar {
        padding-top: .5rem;
    }
}
