/* =================================================================================================
   Armazón del panel: barra superior, menú lateral, contenido y pie (etapa 3 del plan de tema)

   Sustituye al armazón del tema UBold. Conserva sus nombres de clase —`.topbar`, `.side-menu`,
   `.content-page`, `#wrapper.enlarged`— porque son los que ya traen las 46 vistas: el tema cambia,
   el marcado no. El menú tiene tres estados, y los tres salen del mismo atributo:

     - ancho:    el de partida en escritorio
     - corto:    `#wrapper.enlarged` en escritorio, solo iconos
     - cajón:    debajo de 992 px el menú sale por encima del contenido y `.enlarged` lo muestra
   ================================================================================================= */

html {
    height: 100%;
}

body {
    min-height: 100%;
    margin: 0;
    background-color: var(--tema-fondo);
    color: var(--tema-texto);
    font-family: var(--tema-fuente);
    font-size: var(--tema-texto-md);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

/* Bootstrap 5 subraya los enlaces; en un panel de administración eso es ruido. */
a {
    color: var(--tema-acento);
    text-decoration: none;
}

a:hover {
    color: var(--tema-acento-hover);
    text-decoration: underline;
}

/* Cifras, RFC e importes en columna: tipografía monoespaciada con números de ancho fijo. */
.cifra, .col-rfc, .k-grid td.text-end {
    font-family: var(--tema-fuente-mono);
    font-variant-numeric: tabular-nums;
}

/* --- Barra superior ---------------------------------------------------------------------------- */

.topbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1030;
    background-color: var(--tema-barra-fondo);
    border-bottom: 1px solid var(--tema-barra-borde);
}

.topbar-left {
    position: absolute;
    /* Debajo de la barra de suplantación: es lo único de la barra superior que está posicionado, y
       sin esto se metía debajo del aviso en lugar de correrse. */
    top: var(--tema-suplantacion-alto);
    left: 0;
    width: var(--tema-menu-ancho);
    height: var(--tema-barra-alto);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: width .2s ease;
}

.topbar-left > div {
    width: 100%;
}

.logo {
    display: inline-flex;
    align-items: center;
    gap: var(--tema-esp-2);
    color: var(--tema-barra-texto);
    font-size: var(--tema-texto-lg);
    font-weight: 600;
    letter-spacing: .02em;
    text-transform: uppercase;
}

.logo:hover {
    color: var(--tema-barra-texto);
    text-decoration: none;
}

.navbar-custom {
    height: var(--tema-barra-alto);
    margin-left: var(--tema-menu-ancho);
    padding: 0 var(--tema-esp-4);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-direction: row-reverse;   /* el marcado trae primero las opciones de la derecha */
    transition: margin-left .2s ease;
}

.navbar-custom ul {
    display: flex;
    align-items: center;
    gap: var(--tema-esp-2);
    list-style: none;
    margin: 0;
    padding: 0;
}

.button-menu-mobile {
    width: var(--tema-control-alto);
    height: var(--tema-control-alto);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 0;
    border-radius: var(--tema-radio-sm);
    color: var(--tema-barra-texto);
    font-size: 1.125rem;
    cursor: pointer;
}

.button-menu-mobile:hover {
    background-color: var(--tema-barra-hover);
}

.nav-user {
    display: inline-flex;
    align-items: center;
    gap: var(--tema-esp-2);
    height: var(--tema-control-alto);
    padding: 0 var(--tema-esp-2);
    border-radius: var(--tema-radio-sm);
    color: var(--tema-barra-texto);
    font-size: var(--tema-texto-sm);
}

.nav-user:hover {
    background-color: var(--tema-barra-hover);
    color: var(--tema-barra-texto);
    text-decoration: none;
}

.nav-user img {
    width: 28px;
    height: 28px;
    border-radius: 999px;
}

.nav-user .rfc-usuario {
    font-family: var(--tema-fuente-mono);
}

.profile-dropdown {
    min-width: 220px;
}

.profile-dropdown .noti-title {
    color: var(--tema-texto-tenue);
    white-space: normal;
}

.profile-dropdown .noti-title h5 {
    margin: 0;
    font-size: var(--tema-texto-sm);
}

/* Botón de modo claro / oscuro, que lo pone tema.js junto al menú de usuario. */
.btn-tema {
    width: var(--tema-control-alto);
    height: var(--tema-control-alto);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 0;
    border-radius: var(--tema-radio-sm);
    color: var(--tema-barra-texto);
    font-size: 1rem;
    cursor: pointer;
}

.btn-tema:hover {
    background-color: var(--tema-barra-hover);
}

/* --- Menú lateral ------------------------------------------------------------------------------ */

.left.side-menu {
    position: fixed;
    top: calc(var(--tema-barra-alto) + var(--tema-suplantacion-alto));
    bottom: 0;
    left: 0;
    width: var(--tema-menu-ancho);
    z-index: 1020;
    background-color: var(--tema-barra-fondo);
    border-right: 1px solid var(--tema-barra-borde);
    overflow-x: hidden;
    overflow-y: auto;
    transition: width .2s ease, transform .2s ease;
}

#sidebar-menu ul {
    list-style: none;
    margin: 0;
    padding: var(--tema-esp-2) 0 var(--tema-esp-5);
}

#sidebar-menu .menu-title {
    padding: var(--tema-esp-4) var(--tema-esp-4) var(--tema-esp-1);
    color: var(--tema-barra-texto-tenue) !important;
    font-size: var(--tema-texto-xs);
    font-weight: 600;
    letter-spacing: .06em;
    text-transform: uppercase;
    white-space: nowrap;
}

#sidebar-menu li a {
    display: flex;
    align-items: center;
    gap: var(--tema-esp-3);
    min-height: var(--tema-control-alto);
    padding: var(--tema-esp-2) var(--tema-esp-4);
    color: var(--tema-barra-texto);
    font-size: var(--tema-texto-md);
    white-space: nowrap;
}

#sidebar-menu li a:hover {
    background-color: var(--tema-barra-hover);
    color: var(--tema-barra-texto);
    text-decoration: none;
}

#sidebar-menu li a i {
    width: 20px;
    flex: 0 0 20px;
    text-align: center;
    font-size: 1rem;
    color: var(--tema-barra-texto-tenue);
}

/* La página en la que se está: se marca con una barra y con el color de acento, no solo con fondo. */
#sidebar-menu li a.active {
    background-color: var(--tema-barra-hover);
    box-shadow: inset 3px 0 0 var(--tema-barra-activo);
    color: #FFFFFF;
    font-weight: 600;
}

#sidebar-menu li a.active i {
    color: var(--tema-barra-activo);
}

/* --- Contenido y pie --------------------------------------------------------------------------- */

.content-page {
    margin-left: var(--tema-menu-ancho);
    padding-top: calc(var(--tema-barra-alto) + var(--tema-suplantacion-alto));
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: margin-left .2s ease;
}

.content {
    flex: 1 0 auto;
    padding: var(--tema-esp-5) 0;
}

.content > .container-fluid {
    padding: 0 var(--tema-esp-5);
}

.footer {
    flex: 0 0 auto;
    padding: var(--tema-esp-3) var(--tema-esp-5);
    border-top: 1px solid var(--tema-borde);
    color: var(--tema-texto-tenue);
    font-size: var(--tema-texto-sm);
}

/*
 * Barra de suplantación: es un aviso permanente, va arriba de todo y se nota.
 *
 * DESPLAZA AL RESTO DEL ARMAZÓN, no se le encima. Vive dentro de .topbar, que está fija arriba, así
 * que su alto tiene que ser una medida conocida: lo dice --tema-suplantacion-alto, que el menú
 * lateral y el contenido también suman. Por eso el alto es fijo y el texto no se parte: si se
 * partiera en dos renglones, volvería a taparse con lo de abajo.
 */
body.con-suplantacion {
    --tema-suplantacion-alto: 32px;
}

.title-impersonate {
    height: var(--tema-suplantacion-alto);
    line-height: var(--tema-suplantacion-alto);
    padding: 0 var(--tema-esp-4);
    background-color: var(--tema-aviso);
    color: #FFFFFF;
    font-size: var(--tema-texto-sm);
    white-space: nowrap;
    overflow: hidden;
}

.title-impersonate a {
    color: #FFFFFF;
    text-decoration: underline;
}

/* --- Menú corto (#wrapper.enlarged en escritorio) ---------------------------------------------- */

@media (min-width: 992px) {
    #wrapper.enlarged .topbar-left {
        width: var(--tema-menu-ancho-corto);
    }

    #wrapper.enlarged .logo span {
        display: none;
    }

    #wrapper.enlarged .navbar-custom {
        margin-left: var(--tema-menu-ancho-corto);
    }

    #wrapper.enlarged .left.side-menu {
        width: var(--tema-menu-ancho-corto);
    }

    #wrapper.enlarged #sidebar-menu li a {
        justify-content: center;
        padding: var(--tema-esp-2);
    }

    #wrapper.enlarged #sidebar-menu li a span,
    #wrapper.enlarged #sidebar-menu .menu-title {
        display: none;
    }

    #wrapper.enlarged .content-page {
        margin-left: var(--tema-menu-ancho-corto);
    }
}

/* --- Teléfono y tableta: el menú es un cajón que sale por encima ------------------------------- */

@media (max-width: 991.98px) {
    .topbar-left {
        width: auto;
        padding: 0 var(--tema-esp-3);
        position: static;
        justify-content: flex-start;
    }

    .navbar-custom {
        margin-left: 0;
    }

    /* El logotipo a la izquierda y, después, la barra con el botón del menú y el usuario. */
    .topbar {
        display: flex;
        align-items: center;
        /* Con la barra de suplantación son dos renglones: el aviso completo arriba y el resto abajo.
           Sin esto, el aviso entraría como una columna más al lado del logotipo. */
        flex-wrap: wrap;
    }

    .title-impersonate {
        flex: 0 0 100%;
    }

    .topbar .navbar-custom {
        flex: 1;
    }

    .left.side-menu {
        transform: translateX(-100%);
        box-shadow: var(--tema-sombra-menu);
    }

    #wrapper.enlarged .left.side-menu {
        transform: translateX(0);
    }

    .content-page {
        margin-left: 0;
    }

    .content {
        padding: var(--tema-esp-4) 0;
    }

    .content > .container-fluid {
        padding: 0 var(--tema-esp-3);
    }

    .footer {
        padding: var(--tema-esp-3);
    }
}

/* --- Páginas de acceso (entrar, recuperar contraseña, capturar correo) ------------------------- */

/*
 * No llevan armazón: una tarjeta centrada sobre el lienzo. El marcado viene del tema anterior
 * —`.wrapper-page` dentro de `.account-pages`— y se conserva; lo que cambia es de dónde salen las
 * medidas y los colores.
 */
.account-pages {
    display: none;
}

.wrapper-page {
    width: 100%;
    max-width: 420px;
    margin: var(--tema-esp-6) auto;
    padding: 0 var(--tema-esp-4);
}

.wrapper-page .card-box {
    padding: var(--tema-esp-5);
}

.wrapper-page .panel-heading img {
    max-width: 180px;
    height: auto;
}

.wrapper-page .panel-heading h4 {
    margin: var(--tema-esp-4) 0 0;
    font-size: var(--tema-texto-xl);
    font-weight: 600;
}

.p-20 {
    padding: 20px;
}

.m-t-20 { margin-top: 20px !important; }
.m-t-40 { margin-top: 40px !important; }
.m-r-5  { margin-right: 5px !important; }
.m-l-5  { margin-left: 5px !important; }
