/**
 * ============================================================================
 * PLATAFORMA: Roomora OS (Gestión Hotelera & Facturación Electrónica)
 * CREADOR: Jhon Espinoza Arquinigo
 * WHATSAPP: +51 931455647
 * ============================================================================
 * Archivo: public/assets/css/layout/admin-layout.css
 * Descripción: Estilos estructurales puros del layout principal. Posicionamiento,
 * flexbox y transiciones del esqueleto de la aplicación.
 * ============================================================================
 */

/* =========================================================
   UX PREMIUM: Bloqueo de animaciones en la carga (FOUC Fix)
   ========================================================= */
.hold-transitions * {
    -webkit-transition: none !important;
    -moz-transition: none !important;
    -ms-transition: none !important;
    -o-transition: none !important;
    transition: none !important;
}

/* =========================================================
   RESET UNIVERSAL (PREVIENE DESBORDAMIENTOS Y SCROLL ROTO)
   ========================================================= */
*, *::before, *::after {
    box-sizing: border-box;
}

body { 
    margin: 0; 
    display: flex; 
    height: 100vh; 
    overflow: hidden; 
    background: var(--bg-base);
    color: var(--text-primary);
    font-family: var(--font-body);
}

.sidebar { 
    width: var(--sidebar-width); 
    background: var(--bg-surface); 
    transition: width var(--transition-base); /* Transición más suave */
    border-right: 1px solid var(--border-default); 
    z-index: 100;
    flex-shrink: 0; /* LA SOLUCIÓN MÁGICA: Prohíbe que se aplaste */
    overflow-x: hidden; /* Evita que el texto se salga al animar */
    white-space: nowrap; /* Mantiene el texto en una sola línea */
}

.sidebar.collapsed { 
    width: var(--sidebar-collapsed-width); 
}

.main-wrapper { 
    flex: 1; 
    display: flex; 
    flex-direction: column; 
    background: var(--bg-base); 
    min-width: 0; /* Previene desbordamiento en flex hijos */
}

.topbar { 
    height: var(--topbar-height); 
    display: flex; 
    justify-content: space-between; 
    align-items: center;
    padding: 0 var(--space-4); 
    border-bottom: 1px solid var(--border-default); 
    background: var(--bg-surface); 
    z-index: 90; 
}

.content { 
    padding: var(--space-6); 
    overflow-y: auto; 
    flex: 1; 
}

/* Clases utilitarias para los componentes del topbar */
.topbar-left, .topbar-right {
    display: flex;
    align-items: center;
    gap: var(--space-4);
}

.btn-icon {
    background: transparent;
    border: none;
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-2);
    border-radius: var(--radius-sm);
    transition: background var(--transition-fast);
}

.btn-icon:hover {
    background: var(--bg-hover);
}

.theme-selector {
    display: flex;
    align-items: center;
    gap: var(--space-3); /* MÁS ESPACIO entre ícono y texto */
    background: var(--bg-elevated);
    padding: var(--space-2) var(--space-3); /* Más relleno interno para que no asfixie */
    border-radius: var(--radius-md);
    border: 1px solid var(--border-subtle);
}

.theme-selector select {
    background: transparent;
    color: var(--text-primary);
    border: none;
    outline: none;
    cursor: pointer;
    font-family: var(--font-body);
}

/* =========================================================
   TOPBAR RIGHT: CONTROLES Y USUARIO (NIVEL ENTERPRISE)
   ========================================================= */
.topbar-right {
    display: flex;
    align-items: center;
    gap: var(--space-4);
}

.topbar-divider {
    width: 1px;
    height: 32px;
    background-color: var(--border-default);
    margin: 0 var(--space-2);
}

/* El botón transparente que agrupa todo */
.user-dropdown-container {
    position: relative;
}

.user-dropdown-toggle {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    background: transparent;
    border: none;
    padding: var(--space-1) var(--space-2);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: background var(--transition-fast);
}

.user-dropdown-toggle:hover {
    background: var(--bg-hover);
}

/* El Avatar de Iniciales */
.user-avatar {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--accent-primary);
    color: var(--text-inverse, #fff);
    border-radius: 50%;
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 1rem;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}

/* Los textos del usuario */
.user-info-wrapper {
    display: flex;
    flex-direction: column;
    text-align: left;
}

.user-name-text {
    font-family: var(--font-body);
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-primary);
    line-height: 1.2;
}

.user-role-text {
    font-size: 0.7rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.user-chevron {
    color: var(--text-secondary);
    transition: transform var(--transition-base);
}

.user-dropdown-toggle.active .user-chevron {
    transform: rotate(180deg);
}

/* =========================================================
   TARJETA FLOTANTE (DROPDOWN MENU)
   ========================================================= */
.user-dropdown-menu {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    width: 240px;
    background: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all var(--transition-base);
    z-index: 1000;
}

.user-dropdown-menu.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.user-dropdown-header {
    padding: var(--space-4);
    border-bottom: 1px solid var(--border-default);
    display: flex;
    flex-direction: column;
}

.user-fullname {
    font-size: 0.95rem;
    color: var(--text-primary);
    font-family: var(--font-display);
}

.user-email {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-top: 2px;
}

.user-dropdown-list {
    list-style: none;
    margin: 0;
    padding: var(--space-2);
}

.user-dropdown-item {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-2) var(--space-3);
    color: var(--text-primary);
    text-decoration: none;
    font-size: 0.9rem;
    border-radius: var(--radius-sm);
    transition: background var(--transition-fast), color var(--transition-fast);
}

.user-dropdown-item:hover {
    background: var(--bg-hover);
}

.user-dropdown-item.text-danger {
    color: var(--status-error);
}

.user-dropdown-item.text-danger:hover {
    background: rgba(255, 71, 87, 0.1); /* Fondo rojizo suave */
}

.user-dropdown-divider {
    height: 1px;
    background: var(--border-default);
    margin: var(--space-2) 0;
}

.user-name-text {
    font-weight: 600;
    font-size: 0.95rem;
    line-height: 1.2;
    color: var(--text-primary);
}

.user-role-text {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn-logout {
    display: flex;
    align-items: center;
    gap: var(--space-1);
    color: var(--status-error);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
}

/* =========================================================
   CABECERAS DE PÁGINA (PAGE HEADERS GLOBALES)
   ========================================================= */
.page-header {
    margin-bottom: var(--space-6);
    padding-bottom: var(--space-4);
    /* Reemplazamos la línea sólida por un gradiente sutil y moderno */
    border-bottom: 1px solid transparent;
    border-image: linear-gradient(to right, var(--accent-primary), transparent) 1;
}

.page-title-wrapper {
    display: flex;
    align-items: center;
    gap: var(--space-4);
}

.page-title-icon {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-elevated);
    color: var(--accent-primary);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-subtle);
    box-shadow: var(--shadow-sm);
    flex-shrink: 0;
}

.page-title-icon svg {
    width: 24px;
    height: 24px;
}

.page-title {
    font-family: var(--font-display);
    font-size: 1.875rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 4px 0;
    letter-spacing: -0.5px;
}

.page-subtitle {
    font-family: var(--font-body);
    font-size: 0.9375rem;
    color: var(--text-secondary);
    margin: 0;
}
/* =========================================================
   ESTILOS DEL MENÚ LATERAL (SIDEBAR) AL FONDO DEL ARCHIVO
   ========================================================= */
.sidebar-header {
    height: var(--topbar-height);
    padding: 0 var(--space-4);
    border-bottom: 1px solid var(--border-default);
    display: flex;
    align-items: center;
    overflow: hidden;
}

/* =========================================================
   CONTENEDOR DEL LOGO Y LOGO PERSONALIZADO (SAAS)
   ========================================================= */
.brand-logo {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    /* Eliminamos el width:100% que estaba aplastando al botón de colapsar */
}

.custom-brand-img {
    max-height: 32px; 
    max-width: 140px; /* Reducimos un poco el ancho para respetar al botón de flechita */
    width: auto;
    object-fit: contain;
    flex-shrink: 0; /* Prohíbe que el navegador aplaste la imagen */
    border-radius: 4px;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.15));
    transition: transform var(--transition-fast);
}

.custom-brand-img:hover {
    transform: scale(1.05);
}

.brand-icon {
    width: 28px;
    height: 28px;
    color: var(--accent-primary);
    flex-shrink: 0;
}

.brand-text {
    margin: 0;
    font-family: var(--font-display);
    color: var(--text-primary);
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: 1px;
    transition: opacity var(--transition-fast), visibility var(--transition-fast);
}

/* Ocultar texto al colapsar, dejar solo el ícono */
.sidebar.collapsed .brand-text {
    opacity: 0;
    visibility: hidden;
}

.sidebar-nav ul {
    list-style: none;
    padding: 0;
    margin: var(--space-4) 0;
}

.sidebar-nav li {
    margin-bottom: var(--space-1);
}

/* Flexbox para alinear Icono y Texto */
.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    transition: all var(--transition-fast);
    border-left: 3px solid transparent;
}

.sidebar-nav a svg {
    width: 24px;
    height: 24px;
    flex-shrink: 0; /* Prohíbe que el ícono se encoja */
}

.sidebar-nav .nav-text {
    transition: opacity var(--transition-fast);
}

.sidebar-nav a:hover, 
.sidebar-nav li.active > a {
    color: var(--text-primary);
    background: var(--bg-hover);
    border-left-color: var(--accent-primary);
}

/* =========================================================
   UX PREMIUM: SUBMENÚS Y ACORDEONES (VERSIÓN BLINDADA)
   ========================================================= */
.chevron {
    width: 16px;
    height: 16px;
    margin-left: auto;
    transition: transform var(--transition-base);
}

.nav-item.open > a .chevron {
    transform: rotate(180deg);
}

/* Animación a prueba de balas (Max-Height) - Elimina el hueco */
.submenu-wrapper {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-in-out;
}

.nav-item.open > .submenu-wrapper {
    max-height: 400px; /* Suficiente para expandir el menú */
}

.submenu {
    list-style: none;
    padding: 0;
    margin: 0;
    background: rgba(0, 0, 0, 0.15); /* Sutil contraste oscuro */
    position: relative;
}

/* Líneas de árbol estilo SaaS Premium */
.submenu::before {
    content: '';
    position: absolute;
    left: 28px; 
    top: 0;
    bottom: 20px;
    width: 1px;
    background: var(--text-secondary);
    opacity: 0.3;
}

.submenu li {
    position: relative;
}

.submenu li::before {
    content: '';
    position: absolute;
    left: 28px;
    top: 50%;
    width: 12px;
    height: 1px;
    background: var(--text-secondary);
    opacity: 0.3;
}

/* Enlaces internos del submenú */
.submenu a {
    padding: var(--space-2) var(--space-4) var(--space-2) 48px; 
    font-size: 0.875rem;
    border-left: none; /* Quitamos el borde para no chocar con las líneas */
    position: relative;
    z-index: 2;
}

.submenu li.active > a {
    color: var(--accent-primary); /* Solo el texto cambia al color del tema */
    background: transparent;
    font-weight: 600;
}

.submenu a:hover {
    background: var(--bg-hover);
}

/* =========================================================
   UX PREMIUM: MODO COLAPSADO, TOOLTIPS Y FLYOUTS (BLINDADO)
   ========================================================= */
.sidebar.collapsed {
    overflow: visible !important; 
}

/*  Forzar desaparición absoluta de textos y chevrons */
.sidebar.collapsed .brand-text,
.sidebar.collapsed .nav-text,
.sidebar.collapsed .chevron {
    display: none !important;
    opacity: 0 !important;
    visibility: hidden !important;
}

.sidebar.collapsed .nav-item > a {
    position: relative;
    justify-content: center;
    padding: var(--space-3) 0 !important;
}

/* 1. TOOLTIPS CON EFECTO BURBUJA */
.sidebar.collapsed .nav-item > a::after {
    content: attr(data-tooltip);
    position: absolute;
    left: 100%;
    top: 50%;
    transform: translateY(-50%);
    margin-left: 15px;
    background: var(--text-primary);
    color: var(--bg-base);
    padding: var(--space-2) var(--space-3);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    white-space: nowrap;
    font-size: 0.85rem;
    font-weight: 700;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: all var(--transition-fast);
}

.sidebar.collapsed .nav-item > a::before {
    content: '';
    position: absolute;
    left: 100%;
    top: 50%;
    transform: translateY(-50%);
    margin-left: 10px;
    border-width: 5px 6px 5px 0;
    border-style: solid;
    border-color: transparent var(--text-primary) transparent transparent;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: all var(--transition-fast);
}

.sidebar.collapsed .nav-item > a:hover::after {
    opacity: 1;
    visibility: visible;
    margin-left: 20px;
}

.sidebar.collapsed .nav-item > a:hover::before {
    opacity: 1;
    visibility: visible;
    margin-left: 14px;
}

/* 2. MENÚS DESPLEGABLES FLOTANTES (FLYOUTS) BLINDADOS */
.sidebar.collapsed .nav-item {
    position: relative; 
}

.sidebar.collapsed .nav-item.has-submenu > a::after,
.sidebar.collapsed .nav-item.has-submenu > a::before {
    display: none !important;
}

/*  CRÍTICO: Ocultar forzosamente el wrapper por defecto para que no se desborde */
.sidebar.collapsed .nav-item.has-submenu .submenu-wrapper {
    position: absolute !important;
    left: 100% !important;
    top: 0 !important;
    width: 220px !important;
    max-height: none !important;
    background: var(--bg-elevated) !important;
    border: 1px solid var(--border-subtle) !important;
    border-radius: var(--radius-lg) !important;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.5) !important;
    margin-left: 25px !important;
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important; /* Evita que el HTML intercepte clics invisibles */
    overflow: hidden !important;
    transition: opacity 0.2s, visibility 0.2s, margin-left 0.2s !important;
    z-index: 1001 !important; 
}

.sidebar.collapsed .nav-item.has-submenu .submenu-wrapper::after {
    content: '';
    position: absolute;
    left: -20px;
    top: 0;
    width: 20px;
    height: 100%;
    background: transparent;
}

/* Hover para mostrar el flyout de forma segura */
.sidebar.collapsed .nav-item.has-submenu:hover .submenu-wrapper {
    opacity: 1 !important;
    visibility: visible !important;
    pointer-events: auto !important;
    margin-left: 15px !important; 
}

.sidebar.collapsed .submenu::before,
.sidebar.collapsed .submenu li::before {
    display: none !important; 
}

.sidebar.collapsed .submenu {
    background: transparent !important;
    padding: var(--space-2) !important;
}

.sidebar.collapsed .submenu a {
    padding: var(--space-2) var(--space-3) !important;
    border-radius: var(--radius-sm) !important;
    font-weight: 500 !important;
    color: var(--text-secondary) !important;
}
.sidebar.collapsed .submenu a:hover {
    background: var(--bg-hover) !important;
    color: var(--text-primary) !important;
}

/* =========================================================
   CHOICES.JS - ADAPTACIÓN AL DISEÑO OSCURO ESTRICTA
   ========================================================= */
.theme-selector {
    border: none;
    background: transparent;
    padding: 0;
}

.choices {
    margin-bottom: 0 !important;
    min-width: 180px;
}

/* 1. La caja principal cerrada (Unificada con .form-control) */
.choices__inner {
    background-color: var(--bg-elevated) !important;
    border: 1px solid var(--border-default) !important;
    border-radius: var(--radius-md) !important;
    min-height: auto !important;
    padding: var(--space-3) !important; /* El mismo padding exacto del input normal */
    display: flex !important;
    align-items: center !important;
    font-family: var(--font-body);
}

/* Alineación vertical perfecta del texto interior */
.choices[data-type*="select-one"] .choices__list--single {
    padding: 0 !important;
    margin: 0 !important;
    line-height: 1 !important;
    width: 100%;
}

/* Forzar color del texto seleccionado en la caja */
.choices__inner .choices__item {
    color: var(--text-primary) !important;
}

/* 2. El contenedor desplegable */
.choices__list--dropdown {
    background-color: var(--bg-surface) !important;
    border: 1px solid var(--border-default) !important;
    border-radius: var(--radius-md) !important;
    box-shadow: var(--shadow-md) !important;
}

/* =========================================================
   ELIMINAR EL BLANCO DE CHOICES.JS (OVERRIDE TOTAL)
   ========================================================= */
/* 1. Fondo general del menú desplegable */
html body .choices__list--dropdown {
    background-color: var(--bg-surface) !important;
    border: 1px solid var(--border-default) !important;
}

/* 2. Todos los elementos de la lista por defecto */
html body .choices__list--dropdown .choices__item {
    background-color: transparent !important;
    color: var(--text-secondary) !important;
    transition: background-color var(--transition-fast), color var(--transition-fast);
}

/* 3. Elemento que está actualmente seleccionado */
html body .choices__list--dropdown .choices__item.is-selected {
    background-color: var(--bg-base) !important;
    color: var(--text-primary) !important;
    font-weight: 600;
}

/* 4. Elemento al pasar el mouse (Hover / Highlighted) */
html body .choices__list--dropdown .choices__item.is-highlighted,
html body .choices__list--dropdown .choices__item:hover {
    background-color: var(--bg-hover) !important;
    color: var(--accent-primary) !important;
}

/* 5. Color de la flechita indicadora */
.choices[data-type*="select-one"]::after {
    border-color: var(--text-secondary) transparent transparent transparent !important;
}
.choices.is-open[data-type*="select-one"]::after {
    border-color: transparent transparent var(--text-secondary) transparent !important;
}

/* =========================================================
   RESPONSIVIDAD MÓVIL (APP NATIVA OFF-CANVAS)
   ========================================================= */

/* Fondo oscuro desenfocado que aparece detrás del menú en móviles */
.sidebar-overlay {
    position: fixed;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(2px);
    z-index: 95; /* Debajo del sidebar (100) pero encima de todo lo demás */
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--transition-base), visibility var(--transition-base);
}

.sidebar-overlay.active {
    opacity: 1;
    visibility: visible;
}

@media (max-width: 768px) {
    /* 1. El menú se esconde a la izquierda por completo */
    .sidebar {
        position: fixed;
        top: 0;
        left: calc(var(--sidebar-width) * -1);
        height: 100vh;
        box-shadow: none;
    }

    /* 2. Cuando está activo, desliza hacia el centro de la pantalla */
    .sidebar.mobile-active {
        left: 0;
        box-shadow: 4px 0 15px rgba(0,0,0,0.4);
    }

    /* 3. Desactivamos el "collapsed" de iconos en móviles */
    .sidebar.collapsed {
        width: var(--sidebar-width);
    }

    /* SOLUCIÓN: FORZAR APARICIÓN DE TEXTO EN MÓVILES */
    .sidebar .brand-text,
    .sidebar .nav-text {
        opacity: 1 !important;
        visibility: visible !important;
    }

    /* 4. Limpiamos la cabecera para que no se apriete todo */
    .topbar-title, .user-info-wrapper {
        display: none;
    }

    /* SOLUCIÓN: SELECT MÁS ANCHO PARA EVITAR EL SALTO DE LÍNEA */
    .choices {
        min-width: 200px !important; 
    }

    .content {
        padding: var(--space-4);
    }

    /* Ajuste de Cabecera Móvil */
    .page-header { margin-bottom: var(--space-4); padding-bottom: var(--space-3); }
    .page-title-wrapper { gap: var(--space-3); }
    .page-title-icon { width: 40px; height: 40px; border-radius: var(--radius-md); }
    .page-title-icon svg { width: 20px; height: 20px; }
    .page-title { font-size: 1.25rem; }
    .page-subtitle { font-size: 0.8rem; }
}

/* =========================================================
   SCROLLBAR GLOBAL PREMIUM (Se adapta a todos los Temas)
   ========================================================= */

/* 1. Soporte moderno para Firefox */
* {
    scrollbar-width: thin;
    scrollbar-color: var(--border-default) var(--bg-surface);
}

/* 2. Soporte avanzado para Chrome, Edge, Safari, Opera */
::-webkit-scrollbar {
    width: 8px;  /* Vertical */
    height: 8px; /* Horizontal */
}

/* El fondo por donde corre la barra */
::-webkit-scrollbar-track {
    background: var(--bg-surface); 
    border-left: 1px solid var(--border-subtle);
}

/* La barra deslizable en sí */
::-webkit-scrollbar-thumb {
    background: var(--border-default);
    border-radius: 10px;
    border: 2px solid var(--bg-surface); /* Crea un pequeño margen interior */
}

/* Efecto al pasar el mouse por encima de la barra */
::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary); 
}

/* Efecto al hacer clic y arrastrar la barra */
::-webkit-scrollbar-thumb:active {
    background: var(--accent-primary); /* Brilla con el color del tema activo */
}

/* =========================================================
   UX PREMIUM: FORZAR CAPA SUPERIOR PARA ALERTAS (TOASTS)
   ========================================================= */
#toast-container, 
.toast-container, 
.toast-box, 
.swal2-container {
    z-index: 9999999 !important; /* Un 9 más que el Mostrador Express */
}

/* =========================================================
   TABLAS GLOBALES (DISEÑO PREMIUM UNIFICADO)
   ========================================================= */
.table-container { 
    width: 100%; 
    overflow-x: auto; 
    -webkit-overflow-scrolling: touch; 
    margin-top: var(--space-4); 
}

.custom-table { 
    width: 100%; 
    border-collapse: separate !important; 
    border-spacing: 0; 
    min-width: 900px; 
}

.custom-table th { 
    text-transform: uppercase; 
    font-size: 0.75rem; 
    letter-spacing: 0.5px; 
    color: var(--text-secondary); 
    padding: var(--space-3) var(--space-4); 
    border-bottom: 2px solid var(--border-default); 
    text-align: left; 
}

.custom-table th.text-center { text-align: center; }
.custom-table th.text-right { text-align: right; }

.custom-table td { 
    padding: var(--space-3) var(--space-4); 
    vertical-align: middle; 
    border-bottom: 1px solid var(--border-subtle); 
}

/* =========================================================
   MAGIA MÓVIL GLOBAL: TABLAS A TARJETAS
   ========================================================= */
@media (max-width: 768px) {
    .table-container { overflow-x: hidden !important; }
    .custom-table { min-width: 100% !important; border-collapse: separate !important; border-spacing: 0; }
    .custom-table thead { display: none; }
    
    .custom-table, .custom-table tbody, .custom-table tr, .custom-table td {
        display: block; width: 100%; box-sizing: border-box;
    }
    
    .custom-table tr {
        margin-bottom: var(--space-4);
        background: var(--bg-surface);
        border: 1px solid var(--border-default);
        border-radius: var(--radius-md);
        padding: 0;
        box-shadow: var(--shadow-sm);
        overflow: hidden; 
    }
    
    .custom-table td {
        display: flex; justify-content: space-between; align-items: center;
        text-align: right; padding: var(--space-3) var(--space-4);
        border-bottom: 1px dashed var(--border-subtle); gap: 10px;
    }
    
    .custom-table td:last-child { border-bottom: none; justify-content: flex-end; }
    
    .custom-table td::before {
        content: attr(data-label);
        font-family: var(--font-display); font-size: 0.75rem; font-weight: 700;
        color: var(--text-secondary); text-transform: uppercase;
        letter-spacing: 0.5px; text-align: left; flex-shrink: 0;
    }
    
    .custom-table .text-right, .custom-table .text-center { text-align: right !important; }
}

/* ==========================================================================
   BLINDAJE ESTÉTICO: BOTÓN DE COMPROBANTE EN FOLIO
   ========================================================================== */
#btn-view-invoice {
    text-decoration: none !important;
}

#btn-view-invoice:hover,
#btn-view-invoice:focus {
    text-decoration: none !important;
}

/* ==========================================================================
    ÓPTICO: CÁPSULAS DE ORIGEN (RES, DIR, WEB)
   ========================================================================== */
html body .doc-badge {
    display: inline-flex !important; 
    align-items: stretch !important; 
    border-radius: var(--radius-md) !important; 
    overflow: hidden !important; 
    border: 1px solid var(--border-default) !important; 
    background: var(--bg-elevated) !important;
    height: 26px !important; /* Fijamos la altura estricta para matar la ilusión óptica */
}

html body .doc-type {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 0 10px !important; 
    font-size: 0.75rem !important; 
    font-weight: 800 !important; 
    text-transform: uppercase !important; 
    letter-spacing: 0.5px !important;
}

html body .doc-number {
    display: flex !important;
    align-items: center !important;
    padding: 0 10px !important; 
    font-size: 0.85rem !important; 
    font-family: var(--font-mono, monospace) !important; 
    font-weight: 600 !important; 
    color: var(--text-primary) !important;
}

/* COLORES SÓLIDOS QUE BRILLAN PERFECTO EN TEMAS CLAROS Y OSCUROS */
html body .doc-type.type-res { background: #64748b !important; color: #ffffff !important; }
html body .doc-type.type-dir { background: #f59e0b !important; color: #ffffff !important; }
html body .doc-type.type-web { background: #0ea5e9 !important; color: #ffffff !important; }

/* ¡NO BORRAR ESTA LÍNEA! Es el posicionamiento de la campanita de notificaciones */
#btn-notifications .badge { position: absolute; top: -5px; right: -5px; padding: 2px 5px; font-size: 10px; border-radius: 50%; }

/* =========================================================
   PANEL FLOTANTE DE NOTIFICACIONES (LA CAMPANITA)
   ========================================================= */
.notification-dropdown-container { position: relative; display: flex; align-items: center; }

.notification-dropdown-menu {
    position: absolute; top: calc(100% + 10px); right: -10px; width: 320px;
    background: var(--bg-elevated); border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg); box-shadow: var(--shadow-lg);
    opacity: 0; visibility: hidden; transform: translateY(-10px);
    transition: all var(--transition-base); z-index: 1000;
}
.notification-dropdown-menu.active { opacity: 1; visibility: visible; transform: translateY(0); }

.notification-header {
    padding: var(--space-3) var(--space-4); border-bottom: 1px solid var(--border-default);
    display: flex; justify-content: space-between; align-items: center;
}
.notification-header strong { font-family: var(--font-display); color: var(--text-primary); font-size: 0.95rem; }
.notification-count-text { font-size: 0.70rem; background: var(--status-error); color: #fff; padding: 2px 8px; border-radius: 10px; font-weight: bold; }

.notification-list { list-style: none; margin: 0; padding: 0; max-height: 320px; overflow-y: auto; }
.notification-item {
    display: flex; flex-direction: column; gap: 4px; padding: var(--space-3) var(--space-4);
    border-bottom: 1px solid var(--border-subtle); text-decoration: none; transition: background var(--transition-fast);
}
.notification-item:hover { background: var(--bg-hover); }
.notification-item-title { font-size: 0.85rem; font-weight: 600; color: var(--text-primary); }
.notification-item-time { font-size: 0.75rem; color: var(--text-secondary); display: flex; align-items: center; gap: 5px; }

.notification-empty {
    padding: var(--space-6) var(--space-4); text-align: center; color: var(--text-muted);
    font-size: 0.85rem; display: flex; flex-direction: column; align-items: center; gap: 8px;
}

.notification-footer { padding: var(--space-3); text-align: center; border-top: 1px solid var(--border-default); background: var(--bg-surface); border-radius: 0 0 var(--radius-lg) var(--radius-lg); }
.notification-footer a { color: var(--accent-primary); font-size: 0.80rem; text-decoration: none; font-weight: 700; }
.notification-footer a:hover { text-decoration: underline; }

/* ==========================================================================
    COLORES DINÁMICOS PARA ORÍGENES DE RESERVA (RES, DIR, WEB)
   ========================================================================== */
html body .doc-type.badge-res { 
    background: var(--bg-hover) !important; 
    color: var(--text-primary) !important; 
}
html body .doc-type.badge-dir { 
    background: var(--status-warning, #f59e0b) !important; 
    color: #fff !important; 
}
html body .doc-type.badge-web { 
    background: var(--accent-primary) !important; 
    color: var(--text-inverse, #fff) !important; 
}

/* Excepción de lujo para el tema Titanium (fondos transparentes metálicos) */
html[data-theme="titanium"] body .doc-type.type-res {
    background-color: rgba(255, 255, 255, 0.15) !important;
    color: #ffffff !important;
    border-right: 1px solid rgba(255, 255, 255, 0.3) !important;
}
html[data-theme="titanium"] body .doc-type.type-dir {
    background-color: rgba(245, 158, 11, 0.15) !important; 
    color: #f59e0b !important; 
    border-right: 1px solid rgba(245, 158, 11, 0.4) !important;
}
html[data-theme="titanium"] body .doc-type.type-web {
    background-color: rgba(14, 165, 233, 0.15) !important; /* Azul eléctrico translúcido */
    color: #0ea5e9 !important; /* Texto azul brillante */
    border-right: 1px solid rgba(14, 165, 233, 0.4) !important;
}

/* ==========================================================================
    BLINDAJE TOTAL: MENÚ CONTEXTUAL FLOTANTE (EVITA RENDERIZADO DETRÁS)
   ========================================================================== */
html body .pos-context-menu {
    position: absolute !important;
    z-index: 999999 !important; /* Un número masivo para superar cualquier tarjeta o grid */
    background: var(--bg-elevated, #2c2c2c) !important; /* Fondo sólido para que no sea transparente */
    border: 1px solid var(--border-default) !important;
    border-radius: var(--radius-md) !important;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.6) !important;
    padding: 8px !important;
    min-width: 180px !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 4px !important;
}

html body .ctx-header {
    font-size: 0.75rem !important;
    color: var(--text-secondary) !important;
    text-transform: uppercase !important;
    font-weight: 700 !important;
    letter-spacing: 0.5px !important;
    padding: 6px 8px !important;
    border-bottom: 1px solid var(--border-subtle) !important;
    margin-bottom: 4px !important;
}

html body .ctx-item {
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    width: 100% !important;
    background: transparent !important;
    border: none !important;
    color: var(--text-primary) !important;
    padding: 8px !important;
    border-radius: var(--radius-sm) !important;
    cursor: pointer !important;
    font-size: 0.85rem !important;
    font-weight: 500 !important;
    text-align: left !important;
    transition: background 0.2s !important;
}

html body .ctx-item:hover {
    background: var(--bg-hover, #333333) !important;
}

html body .status-dot {
    width: 8px !important;
    height: 8px !important;
    border-radius: 50% !important;
    display: inline-block !important;
}
html body .status-dot.dot-free { background: #64748b !important; }
html body .status-dot.dot-cleaning { background: #0ea5e9 !important; }
html body .status-dot.dot-maintenance { background: #f59e0b !important; }

/* ==========================================================================
    UX: TOOLBAR INLINE EXPANDIBLE AL 100% CON ÍCONO FIJO
   ========================================================================== */
html body .content-toolbar {
    display: flex !important;
    flex-direction: row !important;
    justify-content: space-between !important;
    align-items: center !important;
    gap: 16px !important;
    width: 100% !important;
    max-width: 100% !important;
    margin-bottom: 20px !important;
}

html body .content-toolbar .search-wrapper {
    flex: 1 !important; /* Hace que el buscador se estire y tome todo el espacio sobrante */
    position: relative !important; /* Contexto de posicionamiento obligatorio para el ícono */
    max-width: none !important; /* Eliminamos cualquier restricción de tamaño previa */
    margin-bottom: 0 !important;
}

html body .content-toolbar .search-wrapper .search-icon {
    position: absolute !important;
    left: 14px !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    width: 16px !important;
    height: 16px !important;
    color: var(--text-secondary) !important;
    z-index: 3 !important; /* Fuerza al ícono a flotar encima del fondo del input */
    pointer-events: none !important;
    display: block !important;
}

html body .content-toolbar .search-wrapper #search-room.form-control {
    width: 100% !important;
    padding-left: 42px !important; /* Margen interno para que el texto empiece después del ícono */
}

html body .content-toolbar #btn-new-room,
html body .content-toolbar #btn-new-service {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 8px !important; /* Espaciado perfecto entre el ícono + y el texto */
    width: auto !important;
    white-space: nowrap !important;
    margin-top: 0 !important;
}

html body .content-toolbar #btn-new-room svg,
html body .content-toolbar #btn-new-service svg {
    width: 18px !important; /* Forzamos el tamaño real del ícono para que no colapse */
    height: 18px !important;
    flex-shrink: 0 !important;
    display: block !important;
}

/* Conservamos la adaptabilidad para pantallas móviles pequeñas */
@media (max-width: 768px) {
    html body .content-toolbar {
        flex-direction: column !important;
        align-items: stretch !important;
    }
}

/* ==========================================================================
    MÓDULO ENTERPRISE: MODAL DE ESTADO PREMIUM (CENTRALIZADO)
   ========================================================================== */
html body .drc-modal-btn {
    display: flex !important;
    align-items: center !important;
    gap: 12px !important;
    width: 100% !important;
    padding: 12px 16px !important;
    border-radius: var(--radius-md) !important;
    background: var(--bg-hover) !important;
    border: 1px solid var(--border-default) !important;
    color: var(--text-primary) !important;
    font-size: 0.95rem !important;
    font-weight: 600 !important;
    cursor: pointer !important;
    transition: all 0.2s !important;
}

html body .drc-modal-btn:hover {
    transform: translateY(-2px) !important;
    box-shadow: 0 4px 10px rgba(0,0,0,0.15) !important;
    border-color: var(--text-secondary) !important;
}

html body .drc-modal-btn.cancel:hover {
    background: var(--status-error) !important;
    color: #fff !important;
}

/* Spinner premium para cuando esté guardando */
.drc-spinner {
    width: 24px; height: 24px;
    border: 3px solid rgba(255,255,255,0.3);
    border-radius: 50%; border-top-color: #fff;
    animation: drc-spin 1s ease-in-out infinite;
}
@keyframes drc-spin { to { transform: rotate(360deg); } }

/* ==========================================================================
    TRANSICIONES PREMIUM (FAKE SPA / PAGE TRANSITION)
   ========================================================================== */
#roomora-loader-bar {
    position: fixed;
    top: 0;
    left: 0;
    height: 3px;
    background-color: var(--accent-primary);
    z-index: 999999;
    width: 0%;
    opacity: 0;
    transition: width 0.3s ease, opacity 0.3s ease;
    box-shadow: 0 0 10px var(--accent-primary);
    pointer-events: none;
}

.content {
    animation: contentFadeIn 0.35s ease-out forwards;
}

@keyframes contentFadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
/* FIN DEL ARCHIVO - NO AGREGAR NADA DEBAJO DE ESTO */

/* ==========================================================================
    MODALES GLOBALES ENTERPRISE (Ventanas Flotantes)
   ========================================================================== */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px); /* Efecto cristal premium */
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.modal.active {
    opacity: 1;
    visibility: visible;
}

/* El contenedor que hace la animación de entrada */
.modal-dialog {
    width: 100%;
    max-width: 600px;
    margin: 20px;
    transform: translateY(-20px);
    transition: transform 0.3s ease;
}

.modal.active .modal-dialog {
    transform: translateY(0);
}

/* Modales más anchos (como el de nuestras tablas) */
.modal-lg {
    max-width: 850px;
}

/* La tarjeta física del modal */
.modal-content {
    background: var(--bg-base);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* Cabecera del Modal */
.modal-header {
    padding: var(--space-4) var(--space-5);
    border-bottom: 1px solid var(--border-default);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-surface);
}

.modal-title {
    margin: 0;
    font-family: var(--font-display);
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Botón de cierre superior (X) */
.modal-close {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: var(--space-1);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.modal-close:hover {
    background: var(--status-error);
    color: #fff;
}

/* Cuerpo del Modal (Donde va la tabla) */
.modal-body {
    padding: var(--space-5);
    max-height: 70vh; /* Si hay muchos datos, permite hacer scroll interno */
    overflow-y: auto;
}

/* Utilidad para quitar bordes extra en tablas pegadas a la ventana */
.modal-body.p-0 { 
    padding: 0; 
}
.modal-body.p-0 .table-container {
    margin-top: 0;
}

/* ==========================================================================
    COMPONENTE: EMPTY STATE (Estados sin datos para tablas y paneles)
   ========================================================================== */
.empty-state-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--space-6) var(--space-4);
    text-align: center;
    color: var(--text-secondary);
}

.empty-state-container svg {
    width: 48px;
    height: 48px;
    color: var(--text-muted);
    margin-bottom: var(--space-3);
    opacity: 0.5;
}

.empty-state-container .empty-title {
    margin: 0 0 4px 0;
    font-family: var(--font-display);
    color: var(--text-primary);
    font-size: 1.1rem;
    font-weight: 600;
}

.empty-state-container .empty-subtitle {
    margin: 0;
    font-size: 0.9rem;
}


/* CRÍTICO: Le enseñamos al menú flotante a respetar la clase d-none */
html body .pos-context-menu.d-none {
    display: none !important;
}

/* ==========================================================================
   COLORES DINÁMICOS PARA SERVICIOS EXTRA (INVENTARIO)
   ========================================================================== */
.badge-category { font-weight: 700; text-transform: uppercase; font-size: 0.70rem; padding: 4px 8px; letter-spacing: 0.5px; }
.badge-minibar { background: rgba(59, 130, 246, 0.1) !important; color: #3b82f6 !important; border: 1px solid rgba(59, 130, 246, 0.2); }
.badge-restaurant { background: rgba(245, 158, 11, 0.1) !important; color: #f59e0b !important; border: 1px solid rgba(245, 158, 11, 0.2); }
.badge-laundry { background: rgba(16, 185, 129, 0.1) !important; color: #10b981 !important; border: 1px solid rgba(16, 185, 129, 0.2); }
.badge-transfer { background: rgba(139, 92, 246, 0.1) !important; color: #8b5cf6 !important; border: 1px solid rgba(139, 92, 246, 0.2); }
.badge-experience { background: rgba(236, 72, 153, 0.1) !important; color: #ec4899 !important; border: 1px solid rgba(236, 72, 153, 0.2); }
.badge-other { background: rgba(107, 114, 128, 0.1) !important; color: #6b7280 !important; border: 1px solid rgba(107, 114, 128, 0.2); }

/* ==========================================================================
   MENÚ DE NOTIFICACIONES EN MÓVIL (ESTILO APP NATIVA)
   ========================================================================== */
@media (max-width: 768px) {
    html body .notification-dropdown-menu {
        position: fixed !important;
        top: calc(var(--topbar-height) + 10px) !important;
        right: var(--space-4) !important;
        left: var(--space-4) !important;
        width: auto !important; /* Libera el ancho estricto de 320px */
        max-width: none !important;
        transform: translateY(-20px) !important;
    }
    
    html body .notification-dropdown-menu.active {
        transform: translateY(0) !important;
    }

    /* Opcional: si la lista es muy larga, en móvil le damos más espacio de scroll */
    html body .notification-list {
        max-height: 50vh !important;
    }
}

/* ==========================================================================
    EVITAR DESBORDAMIENTO DEL TOPBAR EN MÓVILES
   ========================================================================== */
@media (max-width: 768px) {
    /* 1. Reducimos el margen interno del topbar general */
    .topbar {
        padding: 0 var(--space-3) !important;
    }
    
    /* 2. Juntamos más los elementos de la derecha */
    .topbar-right {
        gap: 8px !important; 
    }

    /* 3. Ocultamos la rayita vertical separadora (roba espacio) */
    .topbar-divider {
        display: none !important; 
    }

    /* 4. Compactamos la caja del selector de temas */
    .theme-selector {
        padding: 4px 8px !important; 
    }

    /* 5. Escondemos el ícono de la paleta (solo en móvil) para ganar espacio */
    .theme-selector > svg {
        display: none !important; 
    }

    /* 6. Tamaño dinámico a 1 sola línea (con puntos suspensivos si no cabe) */
    .choices {
        min-width: 100px !important;
        max-width: 150px !important; /* Protege tu avatar */
    }
    
    .choices__inner {
        font-size: 0.8rem !important;
        padding-right: 15px !important; /* Espacio seguro para la flecha */
    }

    /* Forzamos a que el texto seleccionado jamás salte de línea */
    .choices[data-type*="select-one"] .choices__list--single {
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        display: block !important;
    }

    /* Forzamos a que la lista desplegada también sea de 1 sola línea */
    html body .choices__list--dropdown .choices__item {
        white-space: nowrap !important;
        font-size: 0.85rem !important;
    }

    /* Ajustamos la flechita para que quede bien alineada */
    .choices[data-type*="select-one"]::after {
        right: 6px !important;
    }
}