/* ==========================================================================
   RESTHO CST - DARK THEME DESIGN SYSTEM (HOTELS, POS & BANQUETS)
   Based on Antigravity Aesthetics-hotels-and-restaurants Skill
   ========================================================================== */

:root {
    /* 1. SURFACE & BACKGROUND TOKENS */
    --surface-bg: #0B0F19;         /* Midnight Blue-Gray (Main Background) */
    --surface-elevated: #1A2035;   /* Elevated Surface for Cards & Modals */
    --surface-card-header: #141A29;/* Darker Card Header */
    --surface-border: #2A344D;     /* Subtle Surface Border */
    
    /* 2. ACCENT & BRAND TOKENS */
    --accent-gold: #D4AF37;        /* Modern Amber Gold (Luxury & Banquets) */
    --accent-cyan: #38bdf8;        /* PMS Cyan Accent */
    --accent-emerald: #10b981;     /* POS Emerald Green */
    --accent-purple: #8b5cf6;      /* Security & RBAC */
    --accent-orange: #FF5722;      /* High Energy / Alerts */

    /* 3. TYPOGRAPHY & TEXT CONTRAST (WCAG AAA) */
    --text-primary: #F5F5F7;       /* Off-White (Never pure #FFFFFF) */
    --text-secondary: #94a3b8;     /* Slate Muted Text */
    --text-input-value: #fef08a;   /* Pastel Yellow for High-Contrast Form Inputs */
    --text-error: #FF6B6B;         /* Accessible Error Red */

    /* 4. UTILITY & GLASSMORPHISM */
    --glass-bg: rgba(26, 32, 53, 0.88);
    --glass-border: rgba(255, 255, 255, 0.08);
}

body {
    background-color: var(--surface-bg) !important;
    color: var(--text-primary) !important;
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    margin: 0;
    min-height: 100vh;
}

/* ==========================================================================
   Navegación & Navbar Glassmorphism
   ========================================================================== */
.navbar-custom {
    background: var(--glass-bg) !important;
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--glass-border) !important;
    transition: all 0.3s ease;
}

.navbar-custom .nav-link {
    color: var(--text-secondary) !important;
    font-weight: 500;
    transition: color 0.2s ease;
}

.navbar-custom .nav-link:hover,
.navbar-custom .nav-link.active {
    color: var(--accent-cyan) !important;
}

/* ==========================================================================
   Tarjetas & Contenedores Elevados (.card, .card-premium)
   ========================================================================== */
.card, .card-premium {
    background-color: var(--surface-elevated) !important;
    border: 1px solid var(--surface-border) !important;
    border-radius: 0.75rem !important;
    color: var(--text-primary) !important;
    box-shadow: 0 4px 15px -3px rgba(0, 0, 0, 0.4);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card-header {
    background-color: var(--surface-card-header) !important;
    border-bottom: 1px solid var(--surface-border) !important;
    border-top-left-radius: 0.75rem !important;
    border-top-right-radius: 0.75rem !important;
}

.card-premium:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.6);
}

/* ==========================================================================
   ESTILOS MAESTROS DE FORMULARIOS & FLOATING LABELS (SKILL AESTHETICS)
   ========================================================================== */
.form-control, 
.form-select {
    background-color: #141A29 !important;
    border: 1px solid var(--surface-border) !important;
    color: var(--text-input-value) !important;
    font-weight: 600 !important;
    border-radius: 0.5rem !important;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-control:focus, 
.form-select:focus {
    background-color: #141A29 !important;
    border-color: var(--accent-gold) !important;
    color: var(--text-input-value) !important;
    box-shadow: 0 0 0 0.25rem rgba(212, 175, 55, 0.25) !important;
}

.form-control::placeholder {
    color: var(--text-secondary) !important;
    opacity: 0.6;
}

/* OCULTAR PLACEHOLDER EN REPOSO DENTRO DE FORM-FLOATING PARA PREVENIR SUPERPOSICIÓN */
.form-floating > .form-control::placeholder {
    color: transparent !important;
}

.form-floating > .form-control:focus::placeholder {
    color: var(--text-secondary) !important;
    opacity: 0.7;
}

/* ANTI-AUTOFILL BLANCO EN TEMA OSCURO (CHROME / EDGE / FIREFOX) */
input:-webkit-autofill,
input:-webkit-autofill:hover, 
input:-webkit-autofill:focus,
input:-webkit-autofill:active,
select:-webkit-autofill,
select:-webkit-autofill:hover,
select:-webkit-autofill:focus,
textarea:-webkit-autofill,
textarea:-webkit-autofill:hover,
textarea:-webkit-autofill:focus {
    -webkit-box-shadow: 0 0 0px 1000px #141A29 inset !important;
    -webkit-text-fill-color: #fef08a !important;
    caret-color: #fef08a !important;
    transition: background-color 5000s ease-in-out 0s !important;
}

/* MAQUETACIÓN DE FLOATING LABELS — ESTÁNDAR INSIGNIA FLOTANTE (SISTEMA ARI) */
.form-floating {
    position: relative !important;
    margin-bottom: 1.5rem !important;
}

.form-floating > .form-control,
.form-floating > .form-select {
    height: 3.5rem !important;
    min-height: 3.5rem !important;
    padding-top: 1.25rem !important;
    padding-bottom: 0.5rem !important;
    padding-left: 0.85rem !important;
    padding-right: 0.85rem !important;
    font-size: 0.95rem !important;
    line-height: 1.25 !important;
}

/* ETIQUETA EN REPOSO (CAMPO VACÍO Y SIN FOCO) — CENTRADO PERFECTO EN EL CAMPO */
.form-floating > label {
    position: absolute !important;
    top: 0 !important;
    left: 0.85rem !important;
    height: 100% !important;
    display: flex !important;
    align-items: center !important;
    padding: 0 !important;
    margin: 0 !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
    pointer-events: none !important;
    border: 1px solid transparent !important;
    transform-origin: 0 0 !important;
    transition: all .2s cubic-bezier(0.4, 0, 0.2, 1) !important;
    color: var(--text-secondary) !important;
    font-size: 0.88rem !important;
    font-weight: 500;
    z-index: 20 !important;
}

/* ETIQUETA EN INSIGNIA FLOTANTE SOBRE EL BORDE SUPERIOR (AL ENFOCAR O CON VALOR) */
.form-floating > .form-control:focus ~ label,
.form-floating > .form-control:not(:placeholder-shown) ~ label,
.form-floating > .form-control:-webkit-autofill ~ label,
.form-floating > .form-select ~ label,
.form-floating > .form-select:focus ~ label {
    background-color: #1E293B !important;
    color: #F5F5F7 !important;
    border: 1px solid #334155 !important;
    transform: translateY(-1.75rem) scale(.85) !important;
    padding: 0 10px !important;
    height: 24px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    border-radius: 6px !important;
    font-weight: 800 !important;
    font-size: 0.75rem !important;
    letter-spacing: 0.5px !important;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.5) !important;
    z-index: 30 !important;
    text-transform: uppercase !important;
    width: fit-content !important;
    left: 0.75rem !important;
    pointer-events: none;
}

/* DESTACADO ORO ÁMBAR AL ENFOCAR EL CAMPO */
.form-floating > .form-control:focus ~ label,
.form-floating > .form-select:focus ~ label {
    background-color: var(--accent-gold) !important;
    color: #0B0F19 !important;
    border-color: var(--accent-gold) !important;
    box-shadow: 0 0 10px rgba(212, 175, 55, 0.5) !important;
}

/* Modales Oscuros Elevados */
.modal-content {
    background-color: var(--surface-elevated) !important;
    border: 1px solid var(--surface-border) !important;
    color: var(--text-primary) !important;
    border-radius: 1rem !important;
    box-shadow: 0 20px 40px -10px rgba(0, 0, 0, 0.7);
}

.modal-header, .modal-footer {
    border-color: var(--surface-border) !important;
    background-color: var(--surface-card-header) !important;
}

/* Tablas Oscuras Estilizadas */
.table-dark {
    --bs-table-bg: var(--surface-elevated) !important;
    --bs-table-border-color: var(--surface-border) !important;
    color: var(--text-primary) !important;
}

.table-dark thead th {
    background-color: var(--surface-card-header) !important;
    border-bottom: 2px solid var(--surface-border) !important;
    color: var(--accent-gold) !important;
    font-size: 0.8rem;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

/* Scrollbars Personalizados para Lienzos 2D */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--surface-bg);
}

::-webkit-scrollbar-thumb {
    background: #2A344D;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #3B496C;
}

/* ==========================================================================
   INTERRUPTORES (FORM-SWITCH) DE ALTO CONTRASTE HORECA (WCAG AAA)
   ========================================================================== */
.form-switch .form-check-input {
    width: 2.75rem !important;
    height: 1.5rem !important;
    background-color: #1e293b !important;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3e%3ccircle r='3' fill='%2394a3b8'/%3e%3c/svg%3e") !important;
    border: 1.5px solid #475569 !important;
    border-radius: 2rem !important;
    transition: background-position .2s ease-in-out, background-color .2s ease, border-color .2s ease, box-shadow .2s ease !important;
    cursor: pointer !important;
}

.form-switch .form-check-input:checked {
    background-color: #10b981 !important;
    border-color: #34d399 !important;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3e%3ccircle r='3' fill='%23ffffff'/%3e%3c/svg%3e") !important;
    box-shadow: 0 0 10px rgba(16, 185, 129, 0.4) !important;
}

.form-switch .form-check-input:focus {
    box-shadow: 0 0 0 0.25rem rgba(56, 189, 248, 0.25) !important;
    border-color: #38bdf8 !important;
}

.form-switch .form-check-input:disabled {
    opacity: 1 !important;
    cursor: not-allowed !important;
}

.form-switch .form-check-input:disabled:checked {
    background-color: #059669 !important;
    border-color: #10b981 !important;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3e%3ccircle r='3' fill='%23ffffff'/%3e%3c/svg%3e") !important;
    box-shadow: 0 0 8px rgba(16, 185, 129, 0.3) !important;
}

.form-switch .form-check-input:disabled:not(:checked) {
    background-color: #0f172a !important;
    border-color: #334155 !important;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3e%3ccircle r='3' fill='%23475569'/%3e%3c/svg%3e") !important;
}

/* ==========================================================================
   INSIGNIAS Y ALERTAS DE ALTO CONTRASTE (CERO FONDOS GRISES/AMARILLOS/VERDES LAVADOS)
   ========================================================================== */
.badge-horeca-gold {
    background: rgba(245, 158, 11, 0.18) !important;
    color: #fef08a !important;
    border: 1px solid rgba(245, 158, 11, 0.4) !important;
    font-weight: 700 !important;
}

.badge-horeca-emerald {
    background: rgba(16, 185, 129, 0.18) !important;
    color: #6ee7b7 !important;
    border: 1px solid rgba(16, 185, 129, 0.4) !important;
    font-weight: 700 !important;
}

.badge-horeca-purple {
    background: rgba(139, 92, 246, 0.2) !important;
    color: #c4b5fd !important;
    border: 1px solid rgba(139, 92, 246, 0.45) !important;
    font-weight: 700 !important;
}

.badge-horeca-cyan {
    background: rgba(56, 189, 248, 0.18) !important;
    color: #7dd3fc !important;
    border: 1px solid rgba(56, 189, 248, 0.4) !important;
    font-weight: 700 !important;
}

.badge-horeca-slate {
    background: #1e293b !important;
    color: #f1f5f9 !important;
    border: 1px solid #475569 !important;
    font-weight: 600 !important;
}

/* ==========================================================================
   CONTENEDORES DE ITEMS Y TARJETAS OSCURAS CRISTALINAS
   ========================================================================== */
.card-item-dark {
    background: #0f172a !important;
    border: 1px solid rgba(255, 255, 255, 0.08) !important;
    transition: all 0.2s ease;
}

.card-item-dark:hover {
    border-color: rgba(56, 189, 248, 0.3) !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

/* ==========================================================================
   ALERTAS Y CALLOUTS DE ALTO CONTRASTE HORECA (WCAG AAA - NUNCA FONDOS BLANCOS/GRISES)
   ========================================================================== */
.alert,
.alert-dark {
    background-color: #141A29 !important;
    border: 1px solid var(--surface-border) !important;
    color: var(--text-primary) !important;
    border-radius: 0.75rem !important;
}

.alert-warning {
    background: rgba(245, 158, 11, 0.09) !important;
    border: 1px solid rgba(245, 158, 11, 0.35) !important;
    border-left: 4px solid #f59e0b !important;
    color: #f8fafc !important;
}

.alert-warning .alert-heading,
.alert-warning strong {
    color: #fbbf24 !important;
}

.alert-success {
    background: rgba(16, 185, 129, 0.09) !important;
    border: 1px solid rgba(16, 185, 129, 0.35) !important;
    border-left: 4px solid #10b981 !important;
    color: #f8fafc !important;
}

.alert-success .alert-heading,
.alert-success strong {
    color: #34d399 !important;
}

.alert-danger {
    background: rgba(239, 68, 68, 0.09) !important;
    border: 1px solid rgba(239, 68, 68, 0.35) !important;
    border-left: 4px solid #ef4444 !important;
    color: #f8fafc !important;
}

.alert-danger .alert-heading,
.alert-danger strong {
    color: #f87171 !important;
}

.alert-info {
    background: rgba(56, 189, 248, 0.09) !important;
    border: 1px solid rgba(56, 189, 248, 0.35) !important;
    border-left: 4px solid #38bdf8 !important;
    color: #f8fafc !important;
}

.alert-info .alert-heading,
.alert-info strong {
    color: #7dd3fc !important;
}

.callout-horeca-warning {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.12) 0%, rgba(15, 23, 42, 0.95) 100%) !important;
    border: 1px solid rgba(245, 158, 11, 0.35) !important;
    border-left: 4px solid #f59e0b !important;
    border-radius: 0.75rem;
    padding: 1rem 1.25rem;
    color: #f8fafc !important;
}

/* ==========================================================================
   ESTILOS TOMSELECT DARK THEME (REGLA: LA MUERTE DEL COMBO BOX)
   ========================================================================== */
.ts-wrapper {
    width: 100% !important;
    font-family: inherit !important;
}

.ts-wrapper.form-select,
.ts-wrapper.form-select-sm {
    padding: 0 !important;
    border: none !important;
    background: transparent !important;
}

.ts-control {
    background-color: #141A29 !important;
    border: 1px solid var(--surface-border) !important;
    border-radius: 0.5rem !important;
    color: var(--text-input-value) !important;
    font-weight: 600 !important;
    padding: 0.45rem 0.75rem !important;
    min-height: calc(1.5em + 0.9rem + 2px) !important;
    box-shadow: none !important;
    display: flex !important;
    align-items: center !important;
    cursor: pointer !important;
}

.ts-wrapper.form-select-sm .ts-control {
    padding: 0.25rem 0.5rem !important;
    min-height: calc(1.5em + 0.5rem + 2px) !important;
    font-size: 0.825rem !important;
}

.ts-control input {
    color: #f8fafc !important;
    font-weight: 500 !important;
}

.ts-control .item {
    color: var(--text-input-value) !important;
    font-weight: 600 !important;
}

.ts-wrapper.focus .ts-control {
    border-color: var(--accent-gold) !important;
    box-shadow: 0 0 0 0.25rem rgba(212, 175, 55, 0.25) !important;
}

.ts-dropdown {
    background-color: #0f172a !important;
    border: 1px solid rgba(255, 255, 255, 0.18) !important;
    border-radius: 0.5rem !important;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.75) !important;
    color: #f8fafc !important;
    z-index: 9999 !important;
    backdrop-filter: blur(12px) !important;
}

.ts-dropdown .option {
    padding: 0.5rem 0.85rem !important;
    color: #cbd5e1 !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05) !important;
    cursor: pointer !important;
    transition: background-color 0.12s ease, color 0.12s ease !important;
}

.ts-dropdown .option:hover,
.ts-dropdown .option.active {
    background-color: #1e293b !important;
    color: #f59e0b !important;
}

.ts-dropdown .option.selected {
    background-color: rgba(245, 158, 11, 0.2) !important;
    color: #fde68a !important;
    font-weight: 700 !important;
}

.ts-dropdown .no-results {
    padding: 0.75rem !important;
    color: #94a3b8 !important;
    text-align: center !important;
}

.ts-wrapper .clear-button {
    color: #94a3b8 !important;
    opacity: 0.7 !important;
}

.ts-wrapper .clear-button:hover {
    color: #ef4444 !important;
    opacity: 1 !important;
}

/* ==========================================================================
   SWEETALERT2 DARK THEME ESTÁNDAR SISTEMA ARI (RESTHO CST)
   ========================================================================== */
.swal2-popup {
    background: #0f172a !important;
    border: 1px solid rgba(255, 255, 255, 0.12) !important;
    border-radius: 1rem !important;
    box-shadow: 0 20px 40px -10px rgba(0, 0, 0, 0.8) !important;
    color: #f8fafc !important;
    font-family: 'Inter', system-ui, -apple-system, sans-serif !important;
}

.swal2-title {
    color: #ffffff !important;
    font-weight: 700 !important;
    font-size: 1.35rem !important;
}

.swal2-html-container {
    color: #cbd5e1 !important;
    font-size: 0.95rem !important;
    line-height: 1.5 !important;
}

.swal2-icon.swal2-success {
    border-color: #10b981 !important;
    color: #10b981 !important;
}

.swal2-icon.swal2-success .swal2-success-ring {
    border: 0.25em solid rgba(16, 185, 129, 0.3) !important;
}

.swal2-icon.swal2-success [class^='swal2-success-line'] {
    background-color: #10b981 !important;
}

.swal2-icon.swal2-error {
    border-color: #ef4444 !important;
    color: #ef4444 !important;
}

.swal2-icon.swal2-error [class^='swal2-x-mark-line'] {
    background-color: #ef4444 !important;
}

.swal2-icon.swal2-warning {
    border-color: #f59e0b !important;
    color: #f59e0b !important;
}

.swal2-icon.swal2-info {
    border-color: #38bdf8 !important;
    color: #38bdf8 !important;
}

.swal2-icon.swal2-question {
    border-color: #8b5cf6 !important;
    color: #8b5cf6 !important;
}

.swal2-toast {
    background: #0f172a !important;
    border: 1px solid rgba(255, 255, 255, 0.15) !important;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.6) !important;
    color: #f8fafc !important;
}

/* ==========================================================================
   TOMSELECT - TEMA OSCURO HORECA PREMIUM (WCAG AAA ALTO CONTRASTE)
   ========================================================================== */
.ts-wrapper {
    width: 100% !important;
}

.ts-control {
    background-color: #141A29 !important;
    border: 1px solid var(--surface-border) !important;
    color: #f8fafc !important;
    border-radius: 0.5rem !important;
    min-height: 42px !important;
    padding: 0.35rem 0.65rem !important;
    box-shadow: none !important;
    display: flex !important;
    flex-wrap: wrap !important;
    align-items: center !important;
    gap: 0.35rem !important;
}

.ts-control:focus,
.ts-wrapper.focus .ts-control {
    background-color: #141A29 !important;
    border-color: var(--accent-cyan) !important;
    box-shadow: 0 0 0 0.25rem rgba(56, 189, 248, 0.25) !important;
}

/* CHIPS / BADGES SELECCIONADOS (MULTI-SELECT) */
.ts-control .item {
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.35) 0%, rgba(30, 64, 175, 0.5) 100%) !important;
    color: #93c5fd !important; /* Azul cielo luminoso de alto contraste */
    border: 1px solid rgba(96, 165, 250, 0.6) !important;
    border-radius: 9999px !important;
    padding: 0.2rem 0.65rem !important;
    font-size: 0.8rem !important;
    font-weight: 700 !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 0.35rem !important;
    margin: 0 !important;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.4) !important;
    text-shadow: 0 1px 2px rgba(0,0,0,0.5);
}

/* BOTÓN 'X' PARA ELIMINAR CHIP */
.ts-control .item .remove {
    color: #fca5a5 !important; /* Rojo suave pastel */
    font-weight: bold !important;
    margin-left: 0.35rem !important;
    padding-left: 0.35rem !important;
    border-left: 1px solid rgba(255, 255, 255, 0.2) !important;
    opacity: 0.9;
    text-decoration: none !important;
    transition: all 0.15s ease;
}

.ts-control .item .remove:hover {
    color: #ffffff !important;
    background: rgba(239, 68, 68, 0.4) !important;
    border-radius: 0 9999px 9999px 0 !important;
    opacity: 1 !important;
}

/* INPUT DENTRO DE TOMSELECT */
.ts-control > input {
    color: #fef08a !important; /* Texto de tipeo en amarillo pastel */
    font-weight: 600 !important;
    font-size: 0.875rem !important;
}

.ts-control > input::placeholder {
    color: #64748b !important;
    font-weight: 400 !important;
}

/* DROPDOWN DESPLEGABLE DE TOMSELECT */
.ts-dropdown {
    background: #0f172a !important; /* Slate oscuro profundo */
    border: 1px solid rgba(56, 189, 248, 0.35) !important;
    border-radius: 0.5rem !important;
    box-shadow: 0 12px 30px -5px rgba(0, 0, 0, 0.85) !important;
    color: #f8fafc !important;
    margin-top: 4px !important;
    z-index: 1065 !important;
}

.ts-dropdown .option {
    padding: 0.55rem 0.85rem !important;
    color: #cbd5e1 !important;
    font-size: 0.875rem !important;
    font-weight: 500 !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04) !important;
    transition: background 0.15s ease, color 0.15s ease;
}

.ts-dropdown .option:hover,
.ts-dropdown .option.active {
    background: rgba(56, 189, 248, 0.18) !important;
    color: #38bdf8 !important;
    font-weight: 600 !important;
}

.ts-dropdown .option.selected {
    background: rgba(37, 99, 235, 0.25) !important;
    color: #93c5fd !important;
}

.ts-dropdown .no-results {
    color: #94a3b8 !important;
    padding: 0.75rem !important;
    font-size: 0.825rem !important;
}

/* ==========================================================================
   RESTHO CST — SIDEBAR COLAPSABLE HORECA (ESTÁNDAR SISTEMA ARI)
   Arquitectura de 4 Cuadrantes: Sidebar + TopNavbar + PageContent
   Variables de control: --restho-sidebar-expanded / --restho-sidebar-collapsed
   Persistencia: localStorage['restho_sidebar_collapsed']
   ========================================================================== */

:root {
    --restho-sidebar-expanded: 260px;
    --restho-sidebar-collapsed: 68px;
    --restho-header-height: 64px;
    --restho-sidebar-bg: #0D1220;
    --restho-sidebar-border: rgba(255, 255, 255, 0.06);
}

/* --------------------------------------------------------------------------
   WRAPPER RAÍZ DE 4 CUADRANTES
   -------------------------------------------------------------------------- */
#restho-wrapper {
    display: flex;
    min-height: 100vh;
    overflow-x: hidden;
}

/* --------------------------------------------------------------------------
   SECCIÓN 1 & 3: SIDEBAR LATERAL
   -------------------------------------------------------------------------- */
#sidebar-wrapper {
    width: var(--restho-sidebar-expanded);
    min-width: var(--restho-sidebar-expanded);
    max-width: var(--restho-sidebar-expanded);
    min-height: 100vh;
    background: var(--restho-sidebar-bg);
    border-right: 1px solid var(--restho-sidebar-border);
    display: flex;
    flex-direction: column;
    transition:
        width 0.28s cubic-bezier(0.4, 0, 0.2, 1),
        min-width 0.28s cubic-bezier(0.4, 0, 0.2, 1),
        max-width 0.28s cubic-bezier(0.4, 0, 0.2, 1);
    overflow-x: hidden;
    overflow-y: auto;
    white-space: nowrap;
    position: relative;
    z-index: 1030;
    flex-shrink: 0;
}

/* SECCIÓN 1: Cabecera del Sidebar (64px exactos) */
.restho-sidebar-heading {
    height: var(--restho-header-height) !important;
    min-height: var(--restho-header-height) !important;
    max-height: var(--restho-header-height) !important;
    padding: 0 1rem !important;
    box-sizing: border-box !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    border-bottom: 1px solid var(--restho-sidebar-border) !important;
    background: linear-gradient(135deg, rgba(13, 18, 32, 0.95), rgba(26, 32, 53, 0.9)) !important;
    flex-shrink: 0;
}

.restho-sidebar-brand {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    text-decoration: none !important;
    overflow: hidden;
    white-space: nowrap;
    min-width: 0;
}

.restho-sidebar-brand-logo {
    width: 32px;
    height: 32px;
    object-fit: contain;
    flex-shrink: 0;
    transition: transform 0.2s ease;
}

.restho-sidebar-brand:hover .restho-sidebar-brand-logo {
    transform: rotate(-5deg) scale(1.05);
}

.restho-sidebar-brand-text {
    font-weight: 800;
    font-size: 1.05rem;
    color: var(--text-primary) !important;
    letter-spacing: -0.3px;
    transition: opacity 0.2s ease;
    white-space: nowrap;
    overflow: hidden;
}

.restho-sidebar-toggle {
    background: transparent !important;
    border: none !important;
    color: var(--text-secondary) !important;
    padding: 0.4rem !important;
    border-radius: 6px !important;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: color 0.2s ease, background-color 0.2s ease !important;
    flex-shrink: 0;
}

.restho-sidebar-toggle:hover {
    color: var(--accent-gold) !important;
    background: rgba(212, 175, 55, 0.12) !important;
}

.restho-sidebar-toggle .bi {
    font-size: 1.35rem;
}

.restho-mobile-sidebar-toggle {
    background: transparent !important;
    border: none !important;
    color: var(--text-secondary) !important;
    padding: 0.4rem !important;
    border-radius: 6px !important;
    display: none;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: color 0.2s ease, background-color 0.2s ease !important;
    flex-shrink: 0;
}

.restho-mobile-sidebar-toggle:hover {
    color: var(--accent-gold) !important;
    background: rgba(212, 175, 55, 0.12) !important;
}

.restho-mobile-sidebar-toggle .bi {
    font-size: 1.35rem;
}

/* SECCIÓN 3: Lista de Navegación del Sidebar */
.restho-sidebar-nav {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 0.75rem 0.5rem;
    scrollbar-width: thin;
    scrollbar-color: rgba(212, 175, 55, 0.2) transparent;
}

.restho-sidebar-nav::-webkit-scrollbar {
    width: 4px;
}

.restho-sidebar-nav::-webkit-scrollbar-track {
    background: transparent;
}

.restho-sidebar-nav::-webkit-scrollbar-thumb {
    background: rgba(212, 175, 55, 0.25);
    border-radius: 2px;
}

/* Títulos de Sección */
.restho-sidebar-section {
    font-size: 0.68rem !important;
    font-weight: 800 !important;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    padding: 0.85rem 0.75rem 0.35rem !important;
    color: var(--text-secondary) !important;
    transition: opacity 0.2s ease;
    overflow: hidden;
    white-space: nowrap;
}

.restho-sidebar-divider {
    display: none; /* visible solo en modo colapsado */
    border: 0 !important;
    border-top: 1px solid rgba(255, 255, 255, 0.08) !important;
    margin: 0.4rem auto !important;
    width: 50% !important;
}

/* Ítems de Navegación */
.restho-nav-item {
    display: flex !important;
    align-items: center !important;
    gap: 0.7rem !important;
    padding: 0.52rem 0.75rem !important;
    border-radius: 8px !important;
    margin-bottom: 0.15rem !important;
    text-decoration: none !important;
    color: #c8d3e8 !important;
    font-size: 0.875rem !important;
    font-weight: 500 !important;
    transition:
        background-color 0.18s ease,
        color 0.18s ease,
        border-left-color 0.18s ease,
        transform 0.12s ease !important;
    white-space: nowrap;
    overflow: hidden;
    border-left: 3px solid transparent !important;
    position: relative;
}

.restho-nav-item:hover {
    background-color: rgba(56, 189, 248, 0.08) !important;
    color: var(--accent-cyan) !important;
    border-left-color: rgba(56, 189, 248, 0.4) !important;
    transform: translateX(2px) !important;
}

.restho-nav-item.active,
.restho-nav-item.active:hover {
    background: linear-gradient(90deg, rgba(212, 175, 55, 0.18) 0%, rgba(56, 189, 248, 0.06) 100%) !important;
    color: var(--accent-gold) !important;
    border-left-color: var(--accent-gold) !important;
    font-weight: 700 !important;
    transform: none !important;
}

/* Variantes de color accent por módulo */
.restho-nav-item.accent-pms:hover      { color: var(--accent-cyan) !important;    border-left-color: rgba(56,189,248,0.5) !important;   background-color: rgba(56,189,248,0.08) !important; }
.restho-nav-item.accent-pos:hover      { color: var(--accent-emerald) !important; border-left-color: rgba(16,185,129,0.5) !important;  background-color: rgba(16,185,129,0.08) !important; }
.restho-nav-item.accent-inv:hover      { color: var(--accent-emerald) !important; border-left-color: rgba(16,185,129,0.5) !important;  background-color: rgba(16,185,129,0.08) !important; }
.restho-nav-item.accent-eventos:hover  { color: var(--accent-gold) !important;    border-left-color: rgba(212,175,55,0.5) !important;  background-color: rgba(212,175,55,0.08) !important; }
.restho-nav-item.accent-admin:hover    { color: var(--accent-purple) !important;  border-left-color: rgba(139,92,246,0.5) !important;  background-color: rgba(139,92,246,0.08) !important; }
.restho-nav-item.accent-gastos:hover   { color: var(--accent-orange) !important;  border-left-color: rgba(255,87,34,0.5) !important;   background-color: rgba(255,87,34,0.08) !important; }

/* ==========================================================================
   GRUPOS COLAPSABLES Y SUBMENÚS (ACCORDION NAVIGATION)
   ========================================================================== */
.restho-nav-group {
    margin-bottom: 0.25rem;
}

/* Encabezado/Toggle del Grupo */
.restho-group-toggle {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    cursor: pointer;
    background: transparent;
    user-select: none;
}

.restho-group-header {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    overflow: hidden;
    min-width: 0;
}

/* Chevron animado */
.restho-group-chevron {
    font-size: 0.75rem;
    color: var(--text-secondary);
    transition: transform 0.22s cubic-bezier(0.4, 0, 0.2, 1), color 0.18s ease;
    flex-shrink: 0;
    margin-left: auto;
    margin-right: 0.15rem;
}

/* Cuando el grupo está expandido */
.restho-group-toggle[aria-expanded="true"] .restho-group-chevron,
.restho-group-toggle:not(.collapsed) .restho-group-chevron {
    transform: rotate(90deg);
    color: var(--accent-gold);
}

.restho-group-toggle[aria-expanded="true"] {
    background-color: rgba(255, 255, 255, 0.03) !important;
}

/* Contenedor del Submenú */
.restho-submenu-collapse {
    position: relative;
    padding-left: 0.75rem;
    margin-left: 0.65rem;
    margin-top: 0.15rem;
    margin-bottom: 0.35rem;
    border-left: 1px dashed rgba(255, 255, 255, 0.12);
    transition: height 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Ítems del Submenú */
.restho-nav-subitem {
    font-size: 0.815rem !important;
    padding: 0.42rem 0.65rem !important;
    margin-bottom: 0.1rem !important;
    gap: 0.55rem !important;
    border-radius: 6px !important;
    color: #94a3b8 !important;
}

.restho-nav-subitem .restho-nav-icon {
    font-size: 0.95rem !important;
    width: 1.1rem !important;
}

.restho-nav-subitem:hover {
    color: #f8fafc !important;
}

/* Iconos del Sidebar */
.restho-nav-icon {
    font-size: 1.1rem;
    flex-shrink: 0;
    transition: font-size 0.2s ease;
    width: 1.25rem;
    text-align: center;
}

.restho-nav-text {
    transition: opacity 0.15s ease;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
}

/* Footer de Usuario en Sidebar */
.restho-sidebar-user {
    border-top: 1px solid var(--restho-sidebar-border);
    padding: 0.75rem 0.85rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    flex-shrink: 0;
    background: rgba(10, 14, 24, 0.5);
    overflow: hidden;
}

.restho-user-info {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    overflow: hidden;
    min-width: 0;
}

.restho-user-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 0.85rem;
    flex-shrink: 0;
    background: linear-gradient(135deg, var(--accent-cyan), var(--accent-purple));
    color: #fff;
    box-shadow: 0 2px 8px rgba(56, 189, 248, 0.3);
}

.restho-user-details {
    overflow: hidden;
    min-width: 0;
    transition: opacity 0.2s ease;
}

.restho-user-name {
    font-weight: 700;
    font-size: 0.8rem;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.2;
}

.restho-user-badge {
    font-size: 0.6rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-secondary);
    line-height: 1;
    margin-top: 1px;
    display: block;
}

.restho-logout-btn {
    background: transparent !important;
    border: 1px solid rgba(239, 68, 68, 0.3) !important;
    color: rgba(239, 68, 68, 0.7) !important;
    border-radius: 6px !important;
    padding: 0.3rem 0.45rem !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    transition: all 0.2s ease !important;
    flex-shrink: 0;
}

.restho-logout-btn:hover {
    background: rgba(239, 68, 68, 0.15) !important;
    color: #f87171 !important;
    border-color: rgba(239, 68, 68, 0.6) !important;
}

.restho-logout-btn .bi {
    font-size: 1rem;
}

/* --------------------------------------------------------------------------
   SECCIÓN 2 & 4: ÁREA DE CONTENIDO PRINCIPAL
   -------------------------------------------------------------------------- */
#page-content-wrapper {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    background-color: var(--surface-bg);
    overflow-x: hidden;
}

/* Top Navbar del área de contenido (64px exactos) */
.restho-top-navbar {
    height: var(--restho-header-height) !important;
    min-height: var(--restho-header-height) !important;
    max-height: var(--restho-header-height) !important;
    background: rgba(13, 18, 32, 0.95) !important;
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--restho-sidebar-border) !important;
    padding: 0 1.5rem !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    box-sizing: border-box !important;
    flex-shrink: 0;
    position: sticky;
    top: 0;
    z-index: 1020;
}

.restho-top-navbar .restho-empresa-badge {
    background: rgba(212, 175, 55, 0.12);
    border: 1px solid rgba(212, 175, 55, 0.35);
    color: var(--accent-gold);
    font-size: 0.78rem;
    font-weight: 700;
    padding: 0.3rem 0.75rem;
    border-radius: 20px;
    letter-spacing: 0.02em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 300px;
}

/* Área del contenido de la página */
.restho-page-body {
    flex: 1;
    padding: 1.75rem 1.75rem 3rem;
    overflow-x: hidden;
}

/* --------------------------------------------------------------------------
   ESTADO COLAPSADO — MINI SIDEBAR (68px, solo iconos + tooltips)
   -------------------------------------------------------------------------- */
#sidebar-wrapper.collapsed,
html.restho-sidebar-collapsed #sidebar-wrapper {
    width: var(--restho-sidebar-collapsed) !important;
    min-width: var(--restho-sidebar-collapsed) !important;
    max-width: var(--restho-sidebar-collapsed) !important;
}

/* Cabecera en modo colapsado: centrar solo el botón toggle */
#sidebar-wrapper.collapsed .restho-sidebar-heading,
html.restho-sidebar-collapsed #sidebar-wrapper .restho-sidebar-heading {
    justify-content: center !important;
    padding: 0 !important;
}

#sidebar-wrapper.collapsed .restho-sidebar-brand,
html.restho-sidebar-collapsed #sidebar-wrapper .restho-sidebar-brand {
    display: none !important;
}

/* Secciones: ocultar título, mostrar divisor */
#sidebar-wrapper.collapsed .restho-sidebar-section,
html.restho-sidebar-collapsed #sidebar-wrapper .restho-sidebar-section {
    opacity: 0 !important;
    height: 0 !important;
    padding: 0 !important;
    overflow: hidden !important;
}

#sidebar-wrapper.collapsed .restho-sidebar-divider,
html.restho-sidebar-collapsed #sidebar-wrapper .restho-sidebar-divider {
    display: block !important;
}

/* Nav items: centrar icono, ocultar texto */
#sidebar-wrapper.collapsed .restho-sidebar-nav,
html.restho-sidebar-collapsed #sidebar-wrapper .restho-sidebar-nav {
    padding-left: 0.3rem !important;
    padding-right: 0.3rem !important;
}

#sidebar-wrapper.collapsed .restho-nav-item,
html.restho-sidebar-collapsed #sidebar-wrapper .restho-nav-item {
    justify-content: center !important;
    padding: 0.7rem 0 !important;
    gap: 0 !important;
    border-left: 3px solid transparent !important;
    transform: none !important;
}

#sidebar-wrapper.collapsed .restho-nav-item.active,
html.restho-sidebar-collapsed #sidebar-wrapper .restho-nav-item.active {
    background: rgba(212, 175, 55, 0.18) !important;
    border-left: 3px solid var(--accent-gold) !important;
}

#sidebar-wrapper.collapsed .restho-nav-item:hover,
html.restho-sidebar-collapsed #sidebar-wrapper .restho-nav-item:hover {
    transform: scale(1.1) !important;
}

#sidebar-wrapper.collapsed .restho-nav-icon,
html.restho-sidebar-collapsed #sidebar-wrapper .restho-nav-icon {
    font-size: 1.3rem !important;
    width: auto !important;
}

#sidebar-wrapper.collapsed .restho-nav-text,
html.restho-sidebar-collapsed #sidebar-wrapper .restho-nav-text {
    display: none !important;
}

/* Ocultar chevrons y submenús en modo mini-sidebar (68px) */
#sidebar-wrapper.collapsed .restho-group-chevron,
html.restho-sidebar-collapsed #sidebar-wrapper .restho-group-chevron {
    display: none !important;
}

#sidebar-wrapper.collapsed .restho-group-header,
html.restho-sidebar-collapsed #sidebar-wrapper .restho-group-header {
    justify-content: center !important;
    width: 100% !important;
    gap: 0 !important;
}

#sidebar-wrapper.collapsed .restho-submenu-collapse,
html.restho-sidebar-collapsed #sidebar-wrapper .restho-submenu-collapse {
    display: none !important;
}

#sidebar-wrapper.collapsed .restho-nav-group,
html.restho-sidebar-collapsed #sidebar-wrapper .restho-nav-group {
    margin-bottom: 0.1rem;
}

/* Footer de usuario en modo colapsado */
#sidebar-wrapper.collapsed .restho-sidebar-user,
html.restho-sidebar-collapsed #sidebar-wrapper .restho-sidebar-user {
    flex-direction: column !important;
    justify-content: center !important;
    padding: 0.6rem 0 !important;
    gap: 0.4rem !important;
}

#sidebar-wrapper.collapsed .restho-user-details,
html.restho-sidebar-collapsed #sidebar-wrapper .restho-user-details {
    display: none !important;
}

/* --------------------------------------------------------------------------
   RESPONSIVE MOBILE (< 992px) — Drawer Overlay
   -------------------------------------------------------------------------- */
@media (max-width: 991.98px) {
    .restho-mobile-sidebar-toggle {
        display: flex !important;
    }

    #sidebar-wrapper {
        position: fixed !important;
        left: 0;
        top: 0;
        height: 100vh;
        z-index: 1045;
        transform: translateX(-100%);
        transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1) !important;
        width: var(--restho-sidebar-expanded) !important;
        min-width: var(--restho-sidebar-expanded) !important;
        max-width: var(--restho-sidebar-expanded) !important;
    }

    #sidebar-wrapper.mobile-open {
        transform: translateX(0) !important;
    }

    #restho-sidebar-overlay {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.55);
        z-index: 1044;
        backdrop-filter: blur(3px);
    }

    #restho-sidebar-overlay.active {
        display: block;
    }

    #page-content-wrapper {
        width: 100%;
    }

    .restho-page-body {
        padding: 1.25rem 1rem 2rem;
    }
}

/* ==========================================================================
   BOTÓN IMPRIMIR PREMIUM (Estilo Cristal Reports / Celeste Cyan Outline)
   ========================================================================== */
.btn-print-premium {
    background: transparent !important;
    color: #38bdf8 !important; /* Cyan / Celeste */
    border: 1.5px solid #38bdf8 !important;
    border-radius: 50px !important;
    padding: 6px 18px !important;
    font-weight: 600 !important;
    font-size: 0.85rem !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
    cursor: pointer !important;
    text-transform: uppercase !important;
    letter-spacing: 0.5px !important;
    text-decoration: none !important;
}

.btn-print-premium i {
    font-size: 1.05rem !important;
    transition: transform 0.3s ease !important;
}

.btn-print-premium:hover, 
.btn-print-premium:focus {
    background-color: #38bdf8 !important;
    color: #0b0f19 !important; /* Texto Oscuro */
    box-shadow: 0 0 15px rgba(56, 189, 248, 0.45) !important;
    transform: translateY(-1px) !important;
}

.btn-print-premium:hover i {
    color: #0b0f19 !important;
    transform: scale(1.1) !important;
}

.btn-print-premium:active {
    transform: translateY(0) !important;
}