/* =====================================================================
   Menú lateral estilo "vidrio" (2026-11-18) — inc/aside.inc.php
   Basado en preview_menu_vidrio.html. Se carga después de modern.css y
   modo-oscuro.css. Para revertir: quitar el <link> en inc/css.inc.php y
   regresar inc/aside.inc.php e inc/menu_items.inc.php del respaldo
   _respaldo_menu_vidrio_2026-11-18/.
   Rendimiento: el desenfoque (backdrop-filter) se usa SOLO en el panel
   del menú, que es un único elemento fijo. Íconos = SVG (sin imágenes).
   ===================================================================== */

/* ---------- Colores de los cuadros de ícono (también en el menú del celular) ---------- */
.jb-tile {
    width: 32px; height: 32px; flex: none; border-radius: 9px;
    display: inline-grid; place-items: center; margin-right: 11px;
    border: 1px solid transparent; /* Tonos suaves (2026-11-18): fondo pastel + ícono de color, sin sombra */
}
.jb-tile .jb-mi { width: 17px; height: 17px; margin: 0 !important; color: inherit !important; stroke: currentColor; }
.t-home    { background: #fdeee3; color: #c9612a; border-color: #f8dcc8; }
.t-doc     { background: #e8f1fd; color: #3b74c9; border-color: #d6e5fa; }
.t-pin     { background: #fdecea; color: #c8443f; border-color: #f8d8d5; }
.t-users   { background: #e3f6f3; color: #18877d; border-color: #cbece6; }
.t-list    { background: #ecebfc; color: #5a55c9; border-color: #dcdaf7; }
.t-chat    { background: #e6f4ec; color: #2f8350; border-color: #d0e9db; }
.t-truck   { background: #e6f4ec; color: #2f8350; border-color: #d0e9db; }
.t-calyear { background: #f2ebfc; color: #7b4fc4; border-color: #e4d7f7; }
.t-box     { background: #f8efe4; color: #a86a2c; border-color: #efdfca; }
.t-chart   { background: #e3f6f3; color: #18877d; border-color: #cbece6; }
.t-heart   { background: #fcebf1; color: #c4447a; border-color: #f6d6e2; }
.t-grid    { background: #eef1ef; color: #5f6d66; border-color: #e1e6e3; }
.t-card    { background: #fdf3e1; color: #b97a12; border-color: #f6e5c3; }
.t-user    { background: #e8f1fd; color: #3b74c9; border-color: #d6e5fa; }
.t-shield  { background: #e7ebe9; color: #3d4843; border-color: #d7ddda; }
.t-moon    { background: #e8f1fd; color: #3b74c9; border-color: #d6e5fa; }
.t-cal     { background: #fff; color: #18211d; border-color: rgba(24, 33, 29, .1); display: inline-flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1; }
.t-cal small { font-size: 7.5px; font-weight: 800; color: #e5484d; letter-spacing: .3px; }
.t-cal b { font-size: 15px; font-weight: 700; color: inherit; }
/* Modo noche: fondo casi transparente e ícono en tono claro */
html.jb-dark .jb-tile { background: rgba(255, 255, 255, .06); border-color: rgba(255, 255, 255, .07); }
html.jb-dark .t-home { color: #f2a06e; } html.jb-dark .t-doc, html.jb-dark .t-user, html.jb-dark .t-moon { color: #7fb0f5; }
html.jb-dark .t-pin { color: #f08a85; } html.jb-dark .t-users, html.jb-dark .t-chart { color: #5fd3c6; }
html.jb-dark .t-list { color: #a3a0f5; } html.jb-dark .t-chat, html.jb-dark .t-truck { color: #78c99a; }
html.jb-dark .t-calyear { color: #c0a0f2; } html.jb-dark .t-box { color: #e0b07a; } html.jb-dark .t-heart { color: #f08cb4; }
html.jb-dark .t-grid { color: #a9b6af; } html.jb-dark .t-card { color: #f0c065; } html.jb-dark .t-shield { color: #c3cec8; }
html.jb-dark .t-cal { color: #fff; } html.jb-dark .t-cal small { color: #ff8a8a; }

/* Menú del celular: mismos cuadros, un poco más chicos */
.mobile-drawer__nav .jb-tile { width: 28px; height: 28px; border-radius: 8px; margin-right: 12px; }
.mobile-drawer__nav .jb-tile .jb-mi { width: 15px; height: 15px; }
.mobile-drawer__nav .navbar__list > li > a { display: flex; align-items: center; }

@media (min-width: 992px) {
    :root { --jb-sbw: 284px; }
    html.jb-menu-min { --jb-sbw: 100px; }

    /* El <aside> solo reserva el espacio; el panel de vidrio flota encima */
    .menu-sidebar.jb-sb,
    .menu-sidebar.jb-sb.desplegable {
        width: var(--jb-sbw); padding: 0; background: transparent !important;
        border: 0; overflow: visible; box-shadow: none; position: relative;
    }
    .menu-sidebar.jb-sb::before { display: none; }
    .page-container,
    .page-container.desplegable { width: calc(100% - var(--jb-sbw)); }
    .header-desktop,
    .page-container.desplegable .header-desktop { left: var(--jb-sbw); }
    .menu_desplegable { display: none !important; } /* el botón anterior; ahora está dentro del panel */

    /* ---------- Panel de vidrio ---------- */
    .jb-glass {
        position: fixed; top: 14px; left: 14px; bottom: 14px; z-index: 40;
        width: calc(var(--jb-sbw) - 28px);
        display: flex; flex-direction: column; padding: 14px 12px 12px;
        border-radius: 26px;
        background: rgba(255, 255, 255, .62);
        border: 1px solid rgba(255, 255, 255, .75);
        -webkit-backdrop-filter: blur(16px) saturate(1.4);
        backdrop-filter: blur(16px) saturate(1.4);
        box-shadow: 0 20px 50px rgba(20, 40, 30, .14), inset 0 1px 0 rgba(255, 255, 255, .6);
    }
    /* Navegadores sin desenfoque: color casi sólido */
    @supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
        .jb-glass { background: rgba(246, 250, 247, .97); }
    }

    .jb-brand { position: relative; padding: 0 4px 12px; margin-bottom: 4px; border-bottom: 1px solid rgba(24, 33, 29, .07); }
    .jb-brand-link { display: flex; align-items: center; gap: 10px; text-decoration: none !important; }
    .jb-brand-link img { width: 58px; height: 58px; object-fit: contain; flex: none; }
    .jb-brand-txt { min-width: 0; line-height: 1.15; }
    .jb-brand-txt small { display: block; font-size: 10.5px; font-weight: 700; letter-spacing: .2px; text-transform: uppercase; color: var(--jb-muted, #6b7871); margin-bottom: 3px; }
    .jb-brand-txt b { font-size: 16px; letter-spacing: 1.5px; color: var(--jb-brand, #1a6137); }
    .jb-sb-toggle {
        position: absolute; right: -27px; top: 14px; width: 30px; height: 30px; padding: 0; border-radius: 50%;
        border: 1px solid rgba(24, 33, 29, .08); background: #fff; color: #6b7871; cursor: pointer;
        display: grid; place-items: center; box-shadow: 0 4px 12px rgba(0, 0, 0, .12);
    }
    .jb-sb-toggle:hover { color: var(--jb-brand, #1a6137); }
    .jb-sb-toggle svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
    html.jb-menu-min .jb-sb-toggle svg { transform: rotate(180deg); }

    /* ---------- Opciones ---------- */
    .jb-nav { flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; margin: 0 -6px; padding: 0 6px; scrollbar-width: thin; }
    .jb-nav .navbar__list { margin: 0; padding: 0; }
    .jb-nav .navbar__list > li { margin: 0; padding: 0; list-style: none; }
    .jb-nav .navbar__list > li.jb-solo-movil { display: none; } /* Mi ruta de hoy: solo en el celular */
    .jb-nav .navbar__list > li.jb-menu-grp { font-size: 11px; font-weight: 600; letter-spacing: 0; text-transform: none; color: var(--jb-muted, #6b7871); padding: 12px 10px 4px; }
    .jb-nav .navbar__list > li > a,
    .jb-noche {
        position: relative; display: flex; align-items: center; width: 100%;
        padding: 6px 8px; margin: 2px 0; border-radius: 13px; border: 0; background: transparent;
        color: var(--jb-ink, #18211d); font-size: 14px; font-weight: 500; text-align: left; text-decoration: none; cursor: pointer;
    }
    .jb-nav .navbar__list > li > a > span:not(.jb-tile),
    .jb-lbl { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .jb-nav .navbar__list > li > a:hover,
    .jb-noche:hover { background: rgba(255, 255, 255, .5); color: var(--jb-ink, #18211d); }
    .jb-nav .navbar__list > li.active > a {
        background: #fff; font-weight: 650;
        box-shadow: 0 4px 14px rgba(20, 40, 30, .10), inset 0 0 0 1px rgba(255, 255, 255, .7);
    }
    .jb-nav .navbar__list > li.has-sub > a::after {
        content: ""; width: 7px; height: 7px; margin: 0 6px 0 auto; flex: none;
        border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; opacity: .45;
        transform: rotate(45deg); transition: transform .2s;
    }
    .jb-nav .navbar__list > li.has-sub > a.open::after { transform: rotate(-135deg); }
    .jb-nav .navbar__sub-list { margin: 2px 0 6px 26px; padding-left: 10px; border-left: 1px solid rgba(24, 33, 29, .1); }
    .jb-nav .navbar__sub-list li a { display: flex; align-items: center; padding: 6px 10px; border-radius: 9px; font-size: 13px; color: var(--jb-muted, #6b7871); text-decoration: none; }
    .jb-nav .navbar__sub-list li a i { width: 18px; margin-right: 8px; text-align: center; font-size: 12px; opacity: .8; }
    .jb-nav .navbar__sub-list li a:hover,
    .jb-nav .navbar__sub-list li.active > a { background: rgba(255, 255, 255, .6); color: var(--jb-brand, #1a6137); }

    /* Modo noche (interruptor) y usuario */
    .jb-noche { margin-top: 6px; font-family: inherit; }
    .jb-noche:focus { outline: 0; }
    .jb-switch { position: relative; width: 38px; height: 22px; flex: none; border-radius: 999px; background: rgba(24, 33, 29, .15); }
    .jb-switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .25); transition: left .2s; }
    html.jb-dark .jb-switch { background: #57b77d; }
    html.jb-dark .jb-switch::after { left: 19px; }

    /* Usuario + cerrar sesión (el encabezado ya no muestra perfil ni modo noche en computadora) */
    .jb-yo { display: flex; align-items: center; gap: 4px; margin-top: 8px; padding-top: 8px; border-top: 1px solid rgba(24, 33, 29, .07); }
    .jb-me { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; padding: 2px 6px; text-decoration: none !important; }
    .jb-salir { position: relative; width: 34px; height: 34px; flex: none; border-radius: 10px; display: grid; place-items: center; color: var(--jb-muted, #6b7871); }
    .jb-salir:hover { background: #fdecea; color: #c8443f; }
    .jb-salir svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
    /* Barra superior ya sin uso en computadora (modo noche, perfil y salir están en el menú) */
    .header-desktop { display: none !important; }
    .main-content { padding-top: 14px; }
    .jb-av {
        position: relative; width: 38px; height: 38px; flex: none; border-radius: 50%; overflow: visible;
        display: grid; place-items: center; font-weight: 800; color: #fff; font-size: 14px;
        background: linear-gradient(160deg, #58b97f, #1a6137);
    }
    .jb-av img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }
    .jb-av::after { content: ""; position: absolute; right: -1px; bottom: -1px; width: 11px; height: 11px; border-radius: 50%; background: #34c759; border: 2px solid #fff; }
    .jb-me-txt { min-width: 0; line-height: 1.2; }
    .jb-me-txt b { display: block; font-size: 13px; color: var(--jb-ink, #18211d); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .jb-me-txt span { display: block; font-size: 11.5px; color: var(--jb-muted, #6b7871); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

    /* ---------- Contraído: barra de íconos ---------- */
    html.jb-menu-min .jb-glass { padding: 14px 10px 12px; }
    html.jb-menu-min .jb-brand-link { justify-content: center; }
    html.jb-menu-min .jb-brand-link img { width: 46px; height: 46px; }
    html.jb-menu-min .jb-brand-txt,
    html.jb-menu-min .jb-nav .navbar__list > li > a > span:not(.jb-tile),
    html.jb-menu-min .jb-lbl,
    html.jb-menu-min .jb-switch,
    html.jb-menu-min .jb-me-txt,
    html.jb-menu-min .jb-nav .navbar__sub-list,
    html.jb-menu-min .jb-nav .navbar__list > li.has-sub > a::after { display: none !important; }
    html.jb-menu-min .jb-nav .navbar__list > li.jb-menu-grp { height: 1px; padding: 0; margin: 8px 10px; background: rgba(24, 33, 29, .1); font-size: 0; }
    html.jb-menu-min .jb-nav .navbar__list > li > a,
    html.jb-menu-min .jb-noche { justify-content: center; padding: 4px 0; }
    html.jb-menu-min .jb-tile { width: 40px; height: 40px; border-radius: 12px; margin-right: 0; }
    html.jb-menu-min .jb-tile .jb-mi { width: 20px; height: 20px; }
    html.jb-menu-min .t-cal b { font-size: 17px; }
    html.jb-menu-min .t-cal small { font-size: 8.5px; }
    html.jb-menu-min .jb-nav .navbar__list > li.active > a { background: transparent; box-shadow: none; }
    html.jb-menu-min .jb-nav .navbar__list > li.active > a::before { content: ""; position: absolute; left: -3px; top: 50%; width: 5px; height: 5px; margin-top: -2px; border-radius: 50%; background: var(--jb-ink, #18211d); }
    html.jb-menu-min .jb-me { justify-content: center; padding-left: 0; padding-right: 0; }
    html.jb-menu-min .jb-yo { flex-direction: column; gap: 6px; }

    /* Globo con el nombre (lo crea js/functions.js) */
    .jb-globo {
        position: fixed; z-index: 60; transform: translateY(-50%); pointer-events: none;
        padding: 5px 10px; border-radius: 9px; background: #fff; color: #18211d; font-size: 12.5px; font-weight: 600; white-space: nowrap;
        box-shadow: 0 6px 18px rgba(0, 0, 0, .15);
    }

    /* ---------- Modo oscuro ---------- */
    html.jb-dark .jb-glass { background: rgba(24, 34, 29, .62); border-color: rgba(255, 255, 255, .08); box-shadow: 0 20px 50px rgba(0, 0, 0, .45), inset 0 1px 0 rgba(255, 255, 255, .05); }
    html.jb-dark .jb-brand,
    html.jb-dark .jb-yo { border-color: rgba(255, 255, 255, .07); }
    html.jb-dark .jb-salir:hover { background: rgba(240, 138, 133, .12); color: #f08a85; }
    html.jb-dark .jb-sb-toggle { background: #1b2721; border-color: rgba(255, 255, 255, .1); color: #8fa199; }
    html.jb-dark .jb-nav .navbar__list > li > a:hover,
    html.jb-dark .jb-noche:hover,
    html.jb-dark .jb-nav .navbar__sub-list li a:hover,
    html.jb-dark .jb-nav .navbar__sub-list li.active > a { background: rgba(255, 255, 255, .06); }
    html.jb-dark .jb-nav .navbar__list > li.active > a { background: rgba(255, 255, 255, .09); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .08); }
    html.jb-dark .jb-nav .navbar__sub-list { border-left-color: rgba(255, 255, 255, .1); }
    html.jb-dark.jb-menu-min .jb-nav .navbar__list > li.jb-menu-grp { background: rgba(255, 255, 255, .08); }
    html.jb-dark .jb-av::after { border-color: #18221d; }
    html.jb-dark .jb-globo { background: #1b2721; color: #e6eee9; }
}

/* Fondo de la página con brillo suave para que se note el vidrio */
@media (min-width: 992px) {
    body { background-attachment: fixed; }
    .page-wrapper { background: radial-gradient(1200px 600px at 0% 0%, #d9eadf 0%, transparent 60%), var(--jb-bg, #eef2f0); }
    .page-container { background: transparent; }
    html.jb-dark .page-wrapper { background: radial-gradient(1200px 600px at 0% 0%, #163024 0%, transparent 60%), var(--jb-bg, #0e1512); }
}
