            /* === LAYOUT PRINCIPAL === */
            .fi-main, 
            .fi-main > .max-w-7xl, 
            .max-w-7xl {
                max-width: 100% !important;
                width: 100% !important;
            }
    
            .fi-main {
                padding-left: 1rem; 
                padding-right: 1rem;
                position: relative;
                animation: fadeIn 0.4s ease-in;
                transition: padding 0.3s cubic-bezier(0.4, 0, 0.2, 1), 
                            margin 0.3s cubic-bezier(0.4, 0, 0.2, 1);
                flex: 1;
                min-width: 0;
                width: 100%;
            }
            
            .fi-layout {
                min-height: 100vh;
                display: flex;
            }

            /* === SIDEBAR BASE (ESCRITORIO) === */
            .fi-sidebar {
                width: var(--sidebar-width);
                min-height: 100vh;
                position: sticky;
                top: 0;
                align-self: flex-start;
                transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1), 
                            opacity 0.5s cubic-bezier(0.4, 0, 0.2, 1),
                            visibility 0.5s cubic-bezier(0.4, 0, 0.2, 1);
                z-index: 30;
                overflow-y: auto;
                overflow-x: hidden;
                height: 100vh;
            }

            /* Sidebar visible en escritorio */
            html:not(.sidebar-hidden) .fi-sidebar {
                width: var(--sidebar-width);
                opacity: 1;
                visibility: visible;
                pointer-events: auto;
            }

            /* Sidebar oculto en escritorio */
            html.sidebar-hidden .fi-sidebar {
                width: 0 !important;
                min-width: 0 !important;
                opacity: 0;
                visibility: hidden;
                pointer-events: none;
                overflow: hidden;
                border: none !important;
                padding: 0 !important;
            }

            #sidebar-overlay {
                transition: opacity 0.5s cubic-bezier(0.4, 0, 0.2, 1);
                z-index: 100 !important;
            }

            html.sidebar-hidden .fi-sidebar-close-overlay {
                opacity: 0 !important;
                pointer-events: none !important;
            }

            /* === MODO CLARO === */
            html:not(.dark) .fi-main {
                background: linear-gradient(135deg, #f9fafb 0%, #ffffff 50%, #f3f4f6 100%) !important;
            }

            html:not(.dark) .fi-main::before {
                content: "";
                position: absolute;
                top: 0;
                left: 0;
                right: 0;
                height: 3px;
                background: linear-gradient(90deg, 
                    #C9A24D 0%, 
                    #E1C36A 50%, 
                    #C9A24D 100%
                );
                opacity: 0.8;
                box-shadow: 0 1px 5px rgba(201, 162, 77, 0.2);

            }

                /* === SIDEBAR UNIFICADO (MISMO ESTILO EN MODO CLARO Y OSCURO) === */

                /* Sidebar - Base común para ambos modos */
                .fi-sidebar,
                .fi-sidebar-header,
                .fi-sidebar-nav {
                    background-color: #0E1A24 !important;
                    color: #C9A24D !important;
                    padding-left: 0.55rem !important;
                    padding-right: 0.55rem !important;
                }

                /* El header necesita padding simétrico para que el logo
                   quede ópticamente centrado (el resto del sidebar también
                   es simétrico ahora, pero blindamos por si Filament añade
                   estilo en línea). */
                .fi-sidebar-header {
                    padding-left: 0.55rem !important;
                    padding-right: 0.55rem !important;
                }

                /* Sidebar - Borde dorado en ambos modos */
                .fi-sidebar {
                    background:
                        linear-gradient(180deg, rgba(255, 255, 255, 0.025) 0%, rgba(255, 255, 255, 0) 18%),
                        linear-gradient(180deg, #0E1A24 0%, #0c1822 52%, #09131b 100%) !important;
                    border-right: 2px solid rgba(201, 162, 77, 0.92) !important;
                    box-shadow: inset -1px 0 0 rgba(255, 255, 255, 0.03), 18px 0 44px rgba(2, 6, 23, 0.28);
                }

                .fi-sidebar-header {
                    min-height: 6rem !important;
                    padding-top: 1.35rem !important;
                    padding-bottom: 1.35rem !important;
                    border-bottom: 1px solid rgba(201, 162, 77, 0.14) !important;
                    box-shadow: inset 0 -1px 0 rgba(255, 255, 255, 0.03);
                    display: flex !important;
                    align-items: center !important;
                    /* NO usamos justify-content: center aquí porque el header
                       puede tener un segundo hijo (icon-button para colapsar)
                       y el conjunto quedaría centrado, desplazando el logo
                       hacia la izquierda. En su lugar, el wrapper del logo
                       ocupa todo el ancho restante y se centra internamente. */
                }

                /* Wrapper Alpine del logo: ocupa todo el ancho disponible
                   y centra al hijo (el <a> con el logo). */
                .fi-sidebar-header > div:first-child {
                    flex: 1 1 auto !important;
                    display: flex !important;
                    align-items: center !important;
                    justify-content: center !important;
                    min-width: 0 !important;
                }

                .fi-sidebar-header a {
                    display: inline-flex !important;
                    align-items: center !important;
                    justify-content: center !important;
                    min-width: 0 !important;
                }

                .fi-sidebar-nav {
                    padding-top: 1.05rem !important;
                    padding-bottom: 1.5rem !important;
                }

                .fi-sidebar-nav-groups {
                    gap: 0.45rem !important;
                }

                .fi-sidebar-group-button {
                    padding: 0.18rem 0.55rem !important;
                    margin-bottom: 0.1rem !important;
                }

                .fi-sidebar-group-label {
                    color: rgba(201, 162, 77, 0.72) !important;
                    font-size: 0.74rem !important;
                    font-weight: 700 !important;
                    letter-spacing: 0.08em !important;
                    text-transform: none !important;
                }

                .fi-sidebar-group-icon {
                    color: rgba(201, 162, 77, 0.7) !important;
                    width: 1.1rem !important;
                    height: 1.1rem !important;
                }

                .fi-sidebar-group-collapse-button {
                    color: rgba(201, 162, 77, 0.72) !important;
                }

                /* Ocultar las flechas collapse/expand que Filament inserta
                   al lado del logo en el header del sidebar. La funcionalidad
                   de plegar el sidebar sigue disponible vía el botón
                   #toggle-sidebar del topbar. */
                .fi-sidebar-header .fi-icon-btn {
                    display: none !important;
                }

                .fi-sidebar,
                .fi-sidebar-nav {
                    scrollbar-width: thin;
                    scrollbar-color: rgba(201, 162, 77, 0.78) rgba(255, 255, 255, 0.03);
                }

                .fi-sidebar::-webkit-scrollbar,
                .fi-sidebar-nav::-webkit-scrollbar {
                    width: 0.28rem;
                }

                .fi-sidebar::-webkit-scrollbar-track,
                .fi-sidebar-nav::-webkit-scrollbar-track {
                    background: rgba(255, 255, 255, 0.03);
                    border-radius: 0;
                }

                .fi-sidebar::-webkit-scrollbar-thumb,
                .fi-sidebar-nav::-webkit-scrollbar-thumb {
                    background: linear-gradient(180deg, rgba(201, 162, 77, 0.92) 0%, rgba(225, 195, 106, 0.74) 100%);
                    border-radius: 0;
                }

                /* ──────────────────────────────────────────────────────
                   WIDGETS TIPO TABLA — search input al mismo nivel del
                   título, pegado a la derecha. Aplica sólo a `.fi-wi-table`
                   (TableWidget de Filament) para no afectar las tablas
                   principales (Resource list pages).
                   ────────────────────────────────────────────────────── */
                .fi-wi-table .fi-ta-header-ctn {
                    position: relative;
                }

                .fi-wi-table .fi-ta-header-ctn > .fi-ta-header-toolbar {
                    position: absolute !important;
                    top: 0.85rem !important;
                    right: 1rem !important;
                    padding: 0 !important;
                    margin: 0 !important;
                    background: transparent !important;
                    border: 0 !important;
                    width: auto !important;
                    min-height: 0 !important;
                    z-index: 5;
                }

                .fi-wi-table .fi-ta-header-ctn > .fi-ta-header-toolbar > div {
                    gap: 0.5rem !important;
                }

                .fi-wi-table .fi-ta-search-field {
                    width: 16rem !important;
                }

                .fi-wi-table .fi-ta-search-field input {
                    padding-top: 0.45rem !important;
                    padding-bottom: 0.45rem !important;
                    font-size: 0.85rem !important;
                }

                /* Reservar espacio en el header de la tabla para que el
                   título no se solape con el search posicionado a la derecha. */
                .fi-wi-table .fi-ta-header-ctn > .fi-ta-header {
                    padding-right: 18.5rem !important;
                }

                /* Quitar la línea divisoria entre header y toolbar (ya no
                   son hermanos visualmente, el toolbar está superpuesto). */
                .fi-wi-table .fi-ta-header-ctn {
                    border-bottom: 1px solid rgba(0,0,0,0.05);
                }
                .fi-wi-table .fi-ta-header-ctn > .fi-ta-header-toolbar {
                    border-top: 0 !important;
                }

                /* En móvil el search vuelve abajo del título (flujo normal). */
                @media (max-width: 768px) {
                    .fi-wi-table .fi-ta-header-ctn > .fi-ta-header-toolbar {
                        position: static !important;
                        padding: 0.75rem 1rem !important;
                    }
                    .fi-wi-table .fi-ta-search-field {
                        width: 100% !important;
                    }
                    .fi-wi-table .fi-ta-header-ctn > .fi-ta-header {
                        padding-right: inherit !important;
                    }
                }

                /* Items del Sidebar - Ambos modos (compactado) */
                .fi-sidebar-item {
                    border-radius: 10px;
                    margin: 0.04rem 0 !important;
                    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
                }

                .fi-sidebar-item-label {
                    flex: 1;
                    min-width: 0;
                    padding-right: 0 !important;
                    margin-right: 0 !important;
                }

                .fi-sidebar-item-button {
                    min-height: 2.35rem !important;
                    padding-top: 0.3rem !important;
                    padding-bottom: 0.3rem !important;
                    padding-left: 0.55rem !important;
                    padding-right: 0.55rem !important;
                    gap: 0.5rem !important;
                    border: 1px solid transparent !important;
                    border-radius: 10px !important;
                }

                .fi-sidebar-item:hover {
                    background: transparent;
                    transform: translateX(2px);
                }

                .fi-sidebar-item:hover .fi-sidebar-item-button {
                    background: linear-gradient(90deg, rgba(201, 162, 77, 0.15) 0%, rgba(201, 162, 77, 0.06) 100%) !important;
                    border-color: rgba(201, 162, 77, 0.12) !important;
                    box-shadow: inset -3px 0 0 #C9A24D, 0 10px 24px rgba(2, 6, 23, 0.22);
                }

                .fi-sidebar-item-active,
                .fi-sidebar-item.fi-active {
                    background: transparent;
                }

                .fi-sidebar-item-active .fi-sidebar-item-button,
                .fi-sidebar-item.fi-active .fi-sidebar-item-button {
                    background: linear-gradient(90deg, rgba(201, 162, 77, 0.22) 0%, rgba(201, 162, 77, 0.08) 100%) !important;
                    border-color: rgba(201, 162, 77, 0.18) !important;
                    box-shadow: inset -3px 0 0 #E1C36A, 0 12px 26px rgba(2, 6, 23, 0.28);
                }

                .fi-sidebar-item-icon {
                    color: #C9A24D !important;
                    width: 1.15rem !important;
                    height: 1.15rem !important;
                    transition: all 0.2s ease;
                }

                .fi-sidebar-item:hover .fi-sidebar-item-icon {
                    color: #E1C36A !important;
                    transform: scale(1.1);
                    filter: drop-shadow(0 0 8px rgba(201, 162, 77, 0.5));
                }

                /* Labels del Sidebar - Modo Claro */
                html:not(.dark) .fi-sidebar-item-label {
                    color: #C9A24D !important;
                    font-weight: 600;
                    font-size: 0.9rem !important;
                    transition: all 0.2s ease;
                }

                html:not(.dark) .fi-sidebar-item:hover .fi-sidebar-item-label {
                    color: #E1C36A !important;
                    text-shadow: 0 0 8px rgba(201, 162, 77, 0.3);
                }

                /* Labels del Sidebar - Modo Oscuro */
                html.dark .fi-sidebar-item-label {
                    color: #e2e8f0;
                    font-weight: 600;
                    font-size: 0.9rem !important;
                    transition: all 0.2s ease;
                }

                html.dark .fi-sidebar-item:hover .fi-sidebar-item-label {
                    color: #C9A24D;
                    text-shadow: 0 0 8px rgba(201, 162, 77, 0.3);
                }

                
            /* Topbar Global (Modo Claro y Oscuro) */
            .fi-topbar .fi-icon-btn,
            .fi-topbar .fi-btn-icon,
            .fi-topbar svg,
            .fi-topbar .fi-breadcrumbs *,
            .fi-topbar .fi-user-menu *,
            .fi-topbar .fi-nav-link * {
                
                color: #C9A24D !important;
            }
            
            .fi-topbar .fi-icon-btn:hover,
            .fi-topbar .fi-btn-icon:hover,
            .fi-topbar .fi-nav-link:hover * {
                background-color: rgba(201, 162, 77, 0.15) !important;
                color: #E5C06D !important;
            }

            /* Nav / Header de Página en Modo Claro */

            .fi-sidebar,
            .fi-sidebar-header,
            .fi-sidebar-nav {
                background-color: #0E1A24 !important;
                color: #C9A24D !important;
            }

            html.sidebar-hidden .fi-main {
                margin-left: 0 !important;
                padding-left: 0.5rem !important;
            }

            /* === MODO OSCURO === */
            html.dark .fi-main {
                background-color: #0E1A24 !important;
                background-image: none !important;
                color: #FFFFFF !important;
            }

            html.dark .fi-main::before {
                content: "";
                position: absolute;
                top: 0;
                left: 0;
                right: 0;
                height: 3px;
                background: linear-gradient(90deg, 
                    #C9A24D 0%, 
                    #E1C36A 50%, 
                    #C9A24D 100%
                );
                opacity: 0.6;
                box-shadow: 0 0 15px rgba(201, 162, 77, 0.4);
            }

            /* === COMPONENTES INTERACTIVOS === */

            /* Botones */
            .fi-btn {
                transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
            }

            .fi-btn:hover {
                transform: translateY(-1px);
                box-shadow: 0 4px 12px rgba(47, 143, 91, 0.25);
            }

            .fi-btn:active {
                transform: translateY(0);
            }

            html.dark .fi-btn:hover {
                box-shadow: 0 4px 16px rgba(201, 162, 77, 0.35);
            }

            /* Enlaces con clase fi-btn - Modo Claro */
            html:not(.dark) a.fi-btn {
                background-color: #1B5536 !important;
                background-image: linear-gradient(135deg, #1B5536 0%, #144229 100%) !important;
                color: #C9A24D !important;
                border-radius: 14px !important;
                padding: 0.75rem 1.75rem !important;
                transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) !important;
                font-weight: 800 !important;
                border: 1px solid rgba(201, 162, 77, 0.25) !important;
                box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3), inset 0 1px 1px rgba(255, 255, 255, 0.05) !important;
            }

            html:not(.dark) a.fi-btn:hover {
                transform:translateY(-3px) scale(1.02);
                background-color:#216340;
                color:#E1C36A;
                box-shadow:0 12px 25px rgba(0,0,0,0.45), 0 0 15px rgba(201,162,77,0.15);
            }

            html:not(.dark) a.fi-btn:active {
                transform: translateY(0);
                box-shadow: 0 2px 6px rgba(47, 143, 91, 0.25);
            }

            /* Enlaces con clase fi-btn - Modo Oscuro */
            html.dark a.fi-btn {
                background-color: #1B5536 !important;
                background-image: linear-gradient(135deg, #1B5536 0%, #144229 100%) !important;
                color: #C9A24D !important;
                border-radius: 14px !important;
                padding: 0.75rem 1.75rem !important;
                transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) !important;
                font-weight: 800 !important;
                border: 1px solid rgba(201, 162, 77, 0.25) !important;
                box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3), inset 0 1px 1px rgba(255, 255, 255, 0.05) !important;
            }

            html.dark a.fi-btn:hover {
                transform:translateY(-3px) scale(1.02);
                background-color: #216340;
                color: #E1C36A;
                box-shadow:0 12px 25px rgba(0,0,0,0.45), 0 0 15px rgba(201,162,77,0.15);
            }

            html.dark a.fi-btn:active {
                background-color: #1B5536;
                color: #C9A24D;
                transform: translateY(0);
                box-shadow: 0 2px 8px rgba(201, 162, 77, 0.35), 0 0 12px rgba(201, 162, 77, 0.2);
            }

            /* Cards y Widgets */
            .fi-section, 
            .fi-widget,
            .fi-fo-field-wrp {
                animation: fadeIn 0.3s ease-in;
                transition: all 0.2s ease;
            }

            html:not(.dark) .fi-section:hover,
            html:not(.dark) .fi-widget:hover {
                box-shadow: 0 4px 12px rgba(47, 143, 91, 0.1);
            }

            html.dark .fi-section:hover,
            html.dark .fi-widget:hover {
                box-shadow: 0 4px 16px rgba(201, 162, 77, 0.15);
            }

            /* Inputs y Forms */
            html:not(.dark) input:focus,
            html:not(.dark) select:focus,
            html:not(.dark) textarea:focus {
                border-color: #2F8F5B !important;
                box-shadow: 0 0 0 2px rgba(47, 143, 91, 0.1) !important;
            }

            html.dark input:focus,
            html.dark select:focus,
            html.dark textarea:focus {
                border-color: #C9A24D !important;
                box-shadow: 0 0 0 2px rgba(201, 162, 77, 0.2) !important;
            }
            /* ESTO SON LAS TABLAS QUE SE VEN ANTES DE CREAR UN CONTRATO O LO QUE SEA*/ 
            /* Tablas Corporativas - Modo Oscuro */
            html.dark .fi-ta-ctn,
            html.dark .fi-ta-content,
            html.dark .fi-ta-table {
                background-color: #1A2A36 !important;
                border-color: rgba(201, 162, 77, 0.2) !important;
            }

            /* Tablas Corporativas - Modo Claro */
            html:not(.dark) .fi-ta-ctn,
            html:not(.dark) .fi-ta-content,
            html:not(.dark) .fi-ta-table {
                background-color: #ffffff !important;
                border-color: #f3f4f6 !important;
            }

            
            /* Scrollbar personalizado */
            html:not(.dark) ::-webkit-scrollbar-thumb {
                background: linear-gradient(180deg, #C9A24D, #FFFFFF);
                border-radius: 10px;
            }

            html.dark ::-webkit-scrollbar-thumb {
                background: linear-gradient(180deg, #C9A24D, #1A2A36);
                border-radius: 10px;
                box-shadow: 0 0 10px rgba(201, 162, 77, 0.3);
            }

            ::-webkit-scrollbar {
                width: 8px;
                height: 8px;
            }

            ::-webkit-scrollbar-track {
                background: transparent;
            }

            .fi-sidebar-item .fi-badge {
                background-color: #fb71854d;
                color: red;
                transition: all 0.2s ease;
            }

            /* Widget de Bienvenida Personalizado - Estilo Refinado */
            .fi-bienvenida-widget {
                display: flex !important;
                align-items: center !important;
                justify-content: center !important;
                background-size: cover !important;
                background-position: center !important;
                background-repeat: no-repeat !important;
                transition: all 0.3s ease !important;
                padding: 3rem 4rem !important;
                min-height: 300px !important;
                border: none !important;
                border-radius: 1rem !important;
            }

            .fi-bienvenida-widget__inner {
                width: 100% !important;
                margin-left: auto !important;
                margin-right: auto !important;
                justify-content: center !important;
                align-items: center !important;
                text-align: center !important;
            }

            .fi-bienvenida-widget__content {
                align-items: center !important;
                justify-content: center !important;
                text-align: center !important;
            }

            .fi-bienvenida-widget__media {
                display: flex !important;
                align-items: center !important;
                justify-content: center !important;
            }

            @media (max-width: 768px) {
                .fi-bienvenida-widget {
                    flex-direction: column !important;
                    text-align: center !important;
                    padding: 2rem !important;
                }

                .fi-bienvenida-widget__inner {
                    flex-direction: column !important;
                    gap: 2rem !important;
                }
            }

            .fi-footer-brand-widget {
                width: 100% !important;
                max-width: 100% !important;
                margin-top: 3rem !important;
                border: none !important;
                box-shadow: none !important;
            }

            /* Estilos para la sección de widgets de cabecera */
            .fi-header-widgets {
                margin-bottom: 2rem !important;
            }

            .fi-header-widgets-grid {
                display: flex !important;
                flex-direction: column !important;
                gap: 1.5rem !important;
            }

            .fi-header-widgets-grid > * {
                flex: 1 1 auto !important;
            }

            /* Modo Claro - Widget */
            html:not(.dark) .fi-bienvenida-widget {
                background-image: linear-gradient(rgba(255, 255, 255, 0.7), rgba(255, 255, 255, 0.7)), url('/images/fondo_claro.jpg') !important;
            }

            /* Modo Oscuro - Widget */
            html.dark .fi-bienvenida-widget {
                background-image: linear-gradient(rgba(14, 26, 36, 0.6), rgba(14, 26, 36, 0.8)), url('/images/fondo_oscuro.jpg') !important;
                box-shadow: inset 0 0 100px rgba(0,0,0,0.5), 0 10px 30px rgba(0,0,0,0.5) !important;
            }


            html:not(.dark) .fi-bienvenida-widget h2 {
                color: #05345aff !important;
                font-weight: 800 !important;
            }

            html.dark .fi-bienvenida-widget h2 {
                color: #C9A24D !important;
                font-weight: 800 !important;
            }

            html:not(.dark) .fi-bienvenida-widget .usuario {
                color: #05345aff !important;
                font-weight: 800 !important;
            }

            html.dark .fi-bienvenida-widget .usuario {
                color: #C9A24D !important;
                font-weight: 800 !important;
            }

            html:not(.dark) .fi-footer-brand-widget {
                background-image: linear-gradient(rgba(255, 255, 255, 0.7), rgba(255, 255, 255, 0.7)), url('/images/fondo_claro.jpg') !important;
            }

            html.dark .fi-footer-brand-widget {
                background-image: linear-gradient(rgba(14, 26, 36, 0.6), rgba(14, 26, 36, 0.8)), url('/images/fondo_oscuro.jpg') !important;
                box-shadow: inset 0 0 100px rgba(0,0,0,0.5), 0 10px 30px rgba(0,0,0,0.5) !important;
            }

            /* Logo por defecto (modo oscuro) */
            .footer-logo {
                content: url('/images/icono_solo.png');
            }

            /* Logo en modo claro */
            html:not(.dark) .footer-logo {
                content: url('/images/icono_solo_claro.png');
            }


            html:not(.dark) .fi-footer-brand-widget .usuario {
                color: #05345aff !important;
                font-weight: 800 !important;
            }

            html.dark .fi-footer-brand-widget .usuario {
                color: #C9A24D !important;
                font-weight: 800 !important;
            }

            @media (max-width: 1280px) {
                .fi-main {
                    padding-left: 0.5rem;
                    padding-right: 0.5rem;
                }
            }

            /* === RESPONSIVE - MÓVIL === */
            @media (max-width: 1024px) {
                :root {
                    --mobile-topbar-height: 4rem;
                    --sidebar-width: min(17rem, 82vw);
                }

                .fi-main {
                    padding-left: 0.1rem !important;
                    padding-right: 0.1rem !important;
                }

                .fi-topbar,
                .fi-topbar > nav {
                    position: sticky !important;
                    top: 0;
                    z-index: 80 !important;
                }

                .fi-topbar > nav {
                    min-height: var(--mobile-topbar-height);
                    padding-left: 0.85rem !important;
                    padding-right: 0.85rem !important;
                    box-shadow: 0 6px 16px rgba(15, 23, 42, 0.18);
                }

                .fi-topbar > nav > [x-persist^="topbar.end"] {
                    margin-left: auto !important;
                    flex-shrink: 0 !important;
                    display: flex !important;
                    align-items: center !important;
                    gap: 0.65rem !important;
                }

                .fi-topbar .fi-user-menu,
                .fi-topbar .fi-user-menu .fi-dropdown-trigger,
                .fi-topbar .fi-user-menu button[aria-label*="usuario" i] {
                    display: flex !important;
                    visibility: visible !important;
                    opacity: 1 !important;
                    flex-shrink: 0 !important;
                    align-items: center !important;
                }

                .fi-topbar .fi-user-menu button[aria-label*="usuario" i] {
                    padding: 0 !important;
                    background: transparent !important;
                }

                .fi-sidebar .fi-sidebar-header {
                    display: none !important;
                }

                .crm-sidebar-mobile-brand {
                    display: block !important;
                    margin: -0.25rem -0.1rem 0.45rem !important;
                    padding: calc(env(safe-area-inset-top, 0px) + 0.1rem) 0.2rem 0.95rem !important;
                    border-bottom: 1px solid rgba(201, 162, 77, 0.14) !important;
                    display: flex !important;
                    align-items: center !important;
                    justify-content: space-between !important;
                    gap: 0.75rem !important;
                }

                .crm-sidebar-mobile-brand__link {
                    display: inline-flex !important;
                    align-items: center !important;
                    flex: 1 1 auto !important;
                    min-width: 0 !important;
                    max-width: 100% !important;
                }

                .crm-sidebar-mobile-brand__close {
                    display: inline-flex !important;
                    align-items: center !important;
                    justify-content: center !important;
                    flex-shrink: 0 !important;
                    width: 2.85rem !important;
                    height: 2.85rem !important;
                    border-radius: 9999px !important;
                    color: #f3f4f6 !important;
                    background: rgba(255, 255, 255, 0.04) !important;
                    border: 1px solid rgba(201, 162, 77, 0.28) !important;
                    box-shadow: 0 10px 24px rgba(2, 6, 23, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.04) !important;
                    transition: background-color 0.2s ease, border-color 0.2s ease, transform 0.2s ease, color 0.2s ease !important;
                }

                .crm-sidebar-mobile-brand__close:hover,
                .crm-sidebar-mobile-brand__close:focus-visible {
                    background: rgba(201, 162, 77, 0.14) !important;
                    border-color: rgba(225, 195, 106, 0.52) !important;
                    color: #E1C36A !important;
                    transform: translateY(-1px) !important;
                }

                .crm-sidebar-mobile-brand .crm-brand {
                    gap: 0.6rem !important;
                    min-width: 0 !important;
                }

                .crm-sidebar-mobile-brand .crm-brand-mark {
                    height: 2.15rem !important;
                    width: auto !important;
                    flex-shrink: 0 !important;
                }

                .crm-sidebar-mobile-brand .crm-brand-copy {
                    min-width: 0 !important;
                    max-width: 9rem !important;
                }

                .crm-sidebar-mobile-brand .crm-brand-name {
                    font-size: 1.08rem !important;
                    line-height: 1 !important;
                }

                .crm-sidebar-mobile-brand .crm-brand-subtitle {
                    display: block !important;
                    font-size: 0.54rem !important;
                    letter-spacing: 0.16em !important;
                    margin-top: 0.05rem !important;
                }

                /* Sidebar fixed en móvil con transform */
                .fi-sidebar {
                    position: fixed;
                    top: 0;
                    left: 0;
                    height: 100dvh;
                    z-index: 110;
                    transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1),
                                opacity 0.5s cubic-bezier(0.4, 0, 0.2, 1);
                    box-shadow: 16px 0 40px rgba(2, 6, 23, 0.34);
                    margin-left: 0;
                }

                .fi-sidebar .fi-sidebar-nav {
                    padding-top: 1rem !important;
                }

                .fi-topbar {
                    position: relative;
                    z-index: 80;
                }

                /* Sidebar visible en móvil */
                html:not(.sidebar-hidden) .fi-sidebar {
                    transform: translateX(0);
                    opacity: 1;
                    visibility: visible;
                    pointer-events: auto;
                    width: var(--sidebar-width);
                }

                /* Sidebar oculto en móvil */
                html.sidebar-hidden .fi-sidebar {
                    transform: translateX(-100%);
                    opacity: 0;
                    visibility: hidden;
                    pointer-events: none;
                    width: var(--sidebar-width);
                }

                html.sidebar-hidden .fi-main {
                    padding-left: 0.1rem !important;
                    padding-right: 0.1rem !important;
                }

                .crm-brand {
                    gap: 0.7rem !important;
                    min-width: 0;
                    align-items: center !important;
                }

                .crm-brand-mark {
                    height: 2.4rem !important;
                    width: auto !important;
                    flex-shrink: 0;
                }

                .crm-brand-copy {
                    min-width: 0;
                }

                .crm-brand-name {
                    font-size: 1.2rem !important;
                    line-height: 1 !important;
                }

                .crm-brand-subtitle {
                    font-size: 0.58rem !important;
                    letter-spacing: 0.18em !important;
                    margin-top: 0.05rem !important;
                }
            }

            @media (max-width: 768px) {
                :root {
                    --sidebar-width: min(16.5rem, 84vw);
                }

                .fi-main {
                    padding-left: 0.1rem !important;
                    padding-right: 0.1rem !important;
                }

                html:not(.sidebar-hidden) .fi-topbar > nav {
                    padding-left: 0.85rem !important;
                    padding-right: 0.85rem !important;
                }

                .crm-brand-copy {
                    max-width: 6.5rem;
                    overflow: hidden;
                }

                .crm-brand-subtitle {
                    display: none !important;
                }
            }

            @media (max-width: 640px) {
                :root {
                    --sidebar-width: min(15.75rem, 88vw);
                }

                .fi-main {
                    padding-left: 0.05rem !important;
                    padding-right: 0.05rem !important;
                }
            }

            /* =====================================================
            SIDEBAR — FORZAR DARK NATIVO DE FILAMENT
            (sin estilos custom)
            ===================================================== */

            /* <a> base */
            .fi-sidebar .fi-sidebar-item-button {
                background-color: transparent !important;
            }

            /* === FORMULARIOS (fi-section) - FONDO AZUL MODO OSCURO === */
        
        /* Modo Oscuro - Formularios */
        html.dark .fi-section,
        html.dark .fi-fo-section,
        html.dark .fi-section-content-ctn {
            background: linear-gradient(135deg, #0c1e2e 0%, #0E1A24 50%, #0a1621 100%) !important;
            border: 1px solid rgba(201, 162, 77, 0.2) !important;
            border-radius: 0.75rem !important; /* 12px - redondeado */
            box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3), 
                        inset 0 1px 0 rgba(201, 162, 77, 0.1) !important;
        }

        /* Headers de secciones - Modo Oscuro */
        html.dark .fi-section-header,
        html.dark .fi-section-header-heading {
            color: #C9A24D !important;
        }

        /* Hover effect para formularios - Modo Oscuro */
        html.dark .fi-section:hover {
            box-shadow: 0 4px 16px rgba(201, 162, 77, 0.15),
                        inset 0 1px 0 rgba(201, 162, 77, 0.15) !important;
        }

        /* Modo Oscuro - Stats Widget */
        html.dark .fi-wi-stats-overview-stat {
            background: linear-gradient(135deg, #0c1e2e 0%, #0E1A24 50%, #0a1621 100%) !important;
            border: 1px solid rgba(201, 162, 77, 0.2) !important;
            border-radius: 0.75rem !important; /* 12px - redondeado */
            box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3), 
                        inset 0 1px 0 rgba(201, 162, 77, 0.1) !important;
        }

        /* Hover effect para stats - Modo Oscuro */
        html.dark .fi-wi-stats-overview-stat:hover {
            box-shadow: 0 4px 16px rgba(201, 162, 77, 0.15),
                        inset 0 1px 0 rgba(201, 162, 77, 0.15) !important;
        }

        /* Títulos de stats - Modo Oscuro */
        html.dark .fi-wi-stats-overview-stat .fi-wi-stats-overview-stat-label {
            color: #C9A24D !important;
        }

        /* Valores de stats - Modo Oscuro */
        html.dark .fi-wi-stats-overview-stat .fi-wi-stats-overview-stat-value {
            color: rgba(255, 255, 255, 0.95) !important;
        }

        /* Descripciones de stats - Modo Oscuro */
        html.dark .fi-wi-stats-overview-stat .fi-wi-stats-overview-stat-description {
            color: rgba(201, 162, 77, 0.8) !important;
        }

        /* === PULIDO GLOBAL CRM === */

        :root {
            --crm-shell-gutter: clamp(0.75rem, 1.4vw, 1.35rem);
            --crm-card-radius: 0.95rem;
            --crm-control-height: 2.875rem;
        }

        .fi-topbar > nav {
            min-height: 4.25rem;
            padding-left: var(--crm-shell-gutter) !important;
            padding-right: var(--crm-shell-gutter) !important;
        }

        .fi-main {
            padding-left: var(--crm-shell-gutter) !important;
            padding-right: var(--crm-shell-gutter) !important;
        }

        .fi-main > div,
        .fi-page,
        .fi-resource-list-records-page {
            width: 100%;
            max-width: 100%;
        }

        .fi-page {
            display: grid;
            gap: 1.25rem;
            align-content: start;
        }

        .fi-header,
        .fi-page-header-widgets,
        .fi-header-widgets {
            margin-bottom: 0 !important;
        }

        .fi-header {
            padding-top: 0.25rem;
            row-gap: 0.75rem;
        }

        .fi-section,
        .fi-widget,
        .fi-ta-ctn,
        .fi-wi-stats-overview-stat {
            border-radius: var(--crm-card-radius) !important;
            overflow: hidden;
        }

        html:not(.dark) .fi-section,
        html:not(.dark) .fi-widget,
        html:not(.dark) .fi-ta-ctn,
        html:not(.dark) .fi-wi-stats-overview-stat {
            border: 1px solid rgba(148, 163, 184, 0.14) !important;
            box-shadow: 0 10px 24px rgba(15, 23, 42, 0.04);
        }

        .fi-section-header,
        .fi-ta-header-ctn {
            padding: 0.95rem 1.15rem !important;
        }

        .fi-section-content-ctn,
        .fi-fo-section > div:last-child {
            padding: 1.15rem !important;
        }

        .fi-fo-field-wrp {
            min-width: 0;
        }

        .fi-fo-field-wrp-label,
        .fi-fo-field-wrp-label span {
            line-height: 1.3;
        }

        .fi-input-wrp,
        .fi-select-input,
        .ts-control,
        .choices__inner {
            min-height: var(--crm-control-height);
            border-radius: 0.85rem !important;
        }

        .fi-input-wrp input,
        .fi-input-wrp select,
        .fi-input-wrp textarea,
        .ts-control input,
        .choices__inner input,
        .fi-main input:not([type='checkbox']):not([type='radio']):not([type='range']),
        .fi-main select,
        .fi-main textarea {
            font-size: 0.9375rem !important;
            line-height: 1.45 !important;
        }

        .fi-main textarea {
            min-height: 7.5rem;
        }

        .fi-fo-actions,
        .fi-form-actions {
            gap: 0.75rem !important;
        }

        .fi-breadcrumbs {
            row-gap: 0.35rem;
        }

        .fi-sidebar-nav {
            padding-bottom: 1.25rem !important;
        }

        .fi-sidebar-item {
            margin: 0.125rem 0 !important;
        }

        .fi-sidebar-item-button {
            min-height: 2.75rem;
            padding-top: 0.5rem !important;
            padding-bottom: 0.5rem !important;
            padding-left: 0.85rem !important;
            padding-right: 0.65rem !important;
            gap: 0.75rem;
        }

        .fi-sidebar-item-label {
            line-height: 1.2;
            white-space: normal;
        }

        .fi-header-widgets-grid,
        .fi-wi-stats-overview {
            gap: 1rem !important;
        }

        .fi-wi-stats-overview-stat {
            min-height: 100%;
            padding: 1rem !important;
        }

        .fi-bienvenida-widget {
            min-height: clamp(15rem, 28vw, 18.75rem) !important;
            padding: clamp(1.5rem, 3vw, 3rem) !important;
            gap: clamp(1.5rem, 4vw, 3.5rem) !important;
        }

        .fi-bienvenida-widget .footer-logo {
            width: clamp(8.5rem, 18vw, 14rem) !important;
            height: clamp(8.5rem, 18vw, 14rem) !important;
        }

        .fi-bienvenida-widget__cta {
            display: inline-flex;
            align-items: center;
            gap: 0.75rem;
            max-width: 100%;
            background-color: #1B5536 !important;
            background-image: linear-gradient(135deg, #1B5536 0%, #144229 100%) !important;
            color: #C9A24D !important;
            border-radius: 14px !important;
            padding: 0.8rem 1.35rem !important;
            font-weight: 800 !important;
            border: 1px solid rgba(201, 162, 77, 0.25) !important;
            box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3), inset 0 1px 1px rgba(255, 255, 255, 0.05) !important;
            text-transform: capitalize !important;
            letter-spacing: 0.05em !important;
            transition: transform 0.25s ease, box-shadow 0.25s ease, color 0.25s ease !important;
        }

        .fi-bienvenida-widget__cta:hover {
            transform: translateY(-2px);
            color: #E1C36A !important;
            box-shadow: 0 12px 25px rgba(0, 0, 0, 0.45), 0 0 15px rgba(201, 162, 77, 0.15) !important;
        }

        .fi-bienvenida-widget__cta span {
            line-height: 1.2;
        }

        /* === TABLAS === */
        .fi-ta-header-cell {
            padding-top: 0.75rem !important;
            padding-bottom: 0.75rem !important;
            padding-left: 0.875rem !important;
            padding-right: 0.875rem !important;
            vertical-align: middle;
        }

        .fi-ta-cell {
            padding-top: 0.825rem !important;
            padding-bottom: 0.825rem !important;
            padding-left: 0.875rem !important;
            padding-right: 0.875rem !important;
            vertical-align: top;
        }

        .fi-ta-cell-content,
        .fi-ta-text-item-label {
            font-size: 0.8125rem !important;
            line-height: 1.25rem !important;
        }

        .fi-ta-cell-content {
            white-space: normal;
            overflow-wrap: anywhere;
        }

        .fi-ta-cell-content svg {
            width: 1rem !important;
            height: 1rem !important;
            flex-shrink: 0;
        }

        .fi-ta-content {
            gap: 0.35rem !important;
        }

        .fi-ta-actions {
            gap: 0.35rem !important;
            justify-content: flex-end;
        }

        .fi-ta-actions .fi-icon-btn {
            padding: 0.35rem !important;
            min-width: 2rem;
            min-height: 2rem;
        }

        .fi-ta-table tbody tr {
            transition: background-color 0.18s ease, box-shadow 0.18s ease;
        }

        html:not(.dark) .fi-ta-table tbody tr:hover {
            background-color: rgba(201, 162, 77, 0.06);
        }

        html.dark .fi-ta-table tbody tr:hover {
            background-color: rgba(201, 162, 77, 0.08);
        }

        .fi-ta-header-heading {
            font-size: 0.95rem !important;
            line-height: 1.2 !important;
        }

        @media (max-width: 1280px) {
            .fi-page {
                gap: 1.1rem;
            }

            .fi-section-content-ctn,
            .fi-fo-section > div:last-child {
                padding: 1rem !important;
            }
        }

        @media (max-width: 1024px) {
            .fi-main {
                padding-left: 0.85rem !important;
                padding-right: 0.85rem !important;
            }

            .fi-topbar > nav {
                min-height: 4rem;
            }

            .fi-page {
                gap: 1rem;
            }

            .fi-section-header,
            .fi-ta-header-ctn {
                padding: 0.875rem 1rem !important;
            }

            .fi-section-content-ctn,
            .fi-fo-section > div:last-child {
                padding: 0.95rem !important;
            }
        }

        @media (max-width: 768px) {
            .fi-main {
                padding-left: 0.65rem !important;
                padding-right: 0.65rem !important;
            }

            .fi-topbar > nav {
                padding-left: 0.65rem !important;
                padding-right: 0.65rem !important;
            }

            .fi-header {
                padding-top: 0;
            }

            .fi-section,
            .fi-widget,
            .fi-ta-ctn,
            .fi-wi-stats-overview-stat {
                border-radius: 0.875rem !important;
            }

            .fi-ta-header-cell,
            .fi-ta-cell {
                padding-left: 0.75rem !important;
                padding-right: 0.75rem !important;
            }

            .fi-ta-table {
                min-width: 48rem;
            }

            .fi-ta-header-ctn {
                padding: 0.8rem 0.9rem !important;
            }

            .fi-ta-header-ctn > div {
                row-gap: 0.75rem;
            }

            .fi-bienvenida-widget {
                min-height: auto !important;
                padding: 1.5rem !important;
                gap: 1.5rem !important;
            }

            .fi-bienvenida-widget .footer-logo {
                width: 8.5rem !important;
                height: 8.5rem !important;
            }

            .fi-bienvenida-widget .usuario {
                text-align: center;
                word-break: break-word;
            }
        }

        @media (max-width: 640px) {
            .fi-main {
                padding-left: 0.5rem !important;
                padding-right: 0.5rem !important;
            }

            .fi-topbar > nav {
                padding-left: 0.5rem !important;
                padding-right: 0.5rem !important;
            }

            .fi-section-header,
            .fi-ta-header-ctn {
                padding: 0.75rem 0.9rem !important;
            }

            .fi-section-content-ctn,
            .fi-fo-section > div:last-child {
                padding: 0.9rem !important;
            }

            .fi-ta-header-cell,
            .fi-ta-cell {
                padding-top: 0.65rem !important;
                padding-bottom: 0.65rem !important;
            }

            .fi-ta-table {
                min-width: 42rem;
            }

            .fi-bienvenida-widget h2 {
                font-size: 1.75rem !important;
            }

            .fi-bienvenida-widget .usuario {
                font-size: 1rem !important;
                letter-spacing: 0.08em !important;
            }

            .fi-bienvenida-widget__cta {
                width: 100%;
                justify-content: center;
                padding: 0.875rem 1rem !important;
            }
        }



/* ============================================================
   Formulario compacto de Contrato (create/edit)
   Scope: solo descendientes de .contrato-form-compact
   ============================================================ */

.contrato-form-compact .fi-section {
    padding: 1rem 1.1rem;
    border-radius: 0.75rem;
}

.contrato-form-compact .fi-section-header {
    padding-bottom: 0.6rem;
}

.contrato-form-compact .fi-section-header-heading {
    font-size: 0.95rem;
    line-height: 1.2;
    font-weight: 600;
}

.contrato-form-compact .fi-section-header-description {
    font-size: 0.78rem;
}

.contrato-form-compact .fi-section-content,
.contrato-form-compact .fi-section-content-ctn {
    gap: 0.6rem;
}

.contrato-form-compact .fi-fo-field-wrp {
    gap: 0.25rem;
}

.contrato-form-compact .fi-fo-field-wrp-label,
.contrato-form-compact .fi-fo-field-wrp-label * {
    font-size: 0.78rem;
    line-height: 1.1;
    font-weight: 500;
}

.contrato-form-compact .fi-fo-field-wrp-helper-text {
    font-size: 0.7rem;
    line-height: 1.1;
}

.contrato-form-compact .fi-input,
.contrato-form-compact .fi-select-input,
.contrato-form-compact .fi-input-wrp input,
.contrato-form-compact .fi-input-wrp select,
.contrato-form-compact textarea.fi-input {
    font-size: 0.82rem;
    padding-top: 0.4rem;
    padding-bottom: 0.4rem;
    min-height: 2rem;
}

.contrato-form-compact .fi-input-wrp {
    border-radius: 0.45rem;
}

.contrato-form-compact .fi-input-wrp-prefix,
.contrato-form-compact .fi-input-wrp-suffix {
    padding: 0 0.5rem;
}

.contrato-form-compact .fi-input-wrp-prefix svg,
.contrato-form-compact .fi-input-wrp-suffix svg {
    width: 0.95rem;
    height: 0.95rem;
}

.contrato-form-compact .fi-btn,
.contrato-form-compact .fi-link {
    font-size: 0.78rem;
    padding: 0.35rem 0.65rem;
    gap: 0.3rem;
}

.contrato-form-compact .fi-btn svg,
.contrato-form-compact .fi-link svg {
    width: 0.95rem;
    height: 0.95rem;
}

/* ToggleButtons inline (tipo_cliente) → forzar 4 botones en una sola fila.
   Filament 3 markup: <div class="fi-fo-toggle-buttons flex flex-wrap">
                        <div><input><label class="fi-btn">…</label></div>
                        …
                      </div>
   Hay que ganar al `flex flex-wrap` de Tailwind con !important. */
.contrato-form-compact .fi-fo-toggle-buttons {
    display: grid !important;
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
    gap: 0.35rem !important;
    flex-wrap: nowrap !important;
    width: 100%;
    justify-content: stretch;
}

.contrato-form-compact .fi-fo-toggle-buttons > div {
    width: 100%;
    min-width: 0;
}

.contrato-form-compact .fi-fo-toggle-buttons > div > .fi-btn,
.contrato-form-compact .fi-fo-toggle-buttons > div > label.fi-btn {
    width: 100%;
    font-size: 0.7rem;
    padding: 0.3rem 0.45rem;
    white-space: nowrap;
    justify-content: center;
    min-width: 0;
    gap: 0.25rem;
    overflow: hidden;
    text-overflow: ellipsis;
}

.contrato-form-compact .fi-fo-toggle-buttons > div > .fi-btn svg,
.contrato-form-compact .fi-fo-toggle-buttons > div > label.fi-btn svg {
    width: 0.85rem;
    height: 0.85rem;
    flex-shrink: 0;
}

/* tipo_documento usa ->grouped(): renderiza .fi-btn-grp en lugar de .fi-fo-toggle-buttons.
   No le aplicamos el grid de 4 columnas; sólo ajustamos tamaño. */
.contrato-form-compact .fi-btn-grp .fi-btn,
.contrato-form-compact .fi-btn-grp label.fi-btn {
    font-size: 0.72rem;
    padding: 0.3rem 0.6rem;
}

.contrato-form-compact .fi-fo-toggle .fi-fo-toggle-label {
    font-size: 0.78rem;
}

.contrato-form-compact .fi-fo-toggle button {
    transform: scale(0.85);
    transform-origin: left center;
}

.contrato-form-compact .fi-fo-grid {
    gap: 0.6rem 0.75rem;
}

.contrato-form-compact .fi-fo-file-upload {
    padding: 0.55rem;
}

.contrato-form-compact .fi-fo-file-upload-dropzone {
    padding: 0.85rem;
    font-size: 0.8rem;
}

.contrato-form-compact .fi-fo-file-upload-item {
    font-size: 0.78rem;
}

.contrato-form-compact .fi-fo-textarea textarea {
    min-height: 4.5rem;
}

/* Reducir spacing entre Sections apiladas (columnas izquierda/derecha) */
.contrato-form-compact .fi-fo-component-ctn > .fi-fo-grid,
.contrato-form-compact > .fi-fo-grid {
    gap: 0.85rem;
}

/* Permitir que los dropdowns de Select se vean fuera de la Section sin ser
   recortados por overflow:hidden (que la propia Section pone por su border-radius). */
.contrato-form-compact .fi-section,
.contrato-form-compact .fi-section-content,
.contrato-form-compact .fi-section-content-ctn,
.contrato-form-compact .fi-fo-component-ctn,
.contrato-form-compact .fi-fo-grid {
    overflow: visible !important;
}

/* El panel emergente del Select debe quedar por encima de todo y no recortarse */
.contrato-form-compact .fi-fo-select-input-pn,
.contrato-form-compact .fi-dropdown-panel,
.contrato-form-compact [x-ref="panel"],
.contrato-form-compact [role="listbox"] {
    z-index: 50;
    max-height: 18rem;
    overflow-y: auto;
}

/* ============================================================
   Override Bienvenida widget — soporte layout 2-columnas
   (la versión nueva usa grid grid-cols-2 lg+ con panel derecho
   para "Próximas actualizaciones"). El CSS anterior forzaba
   flex centered con !important, lo desactivamos cuando el
   inner contiene el wrapper __updates.
   ============================================================ */

.fi-bienvenida-widget:has(.fi-bienvenida-widget__updates) {
    padding: 1.5rem 2rem !important;
    min-height: 0 !important;
    display: block !important;
    background-image: linear-gradient(rgba(255, 255, 255, 0.65), rgba(255, 255, 255, 0.85)), url('/images/fondo_claro.jpg') !important;
}
html.dark .fi-bienvenida-widget:has(.fi-bienvenida-widget__updates) {
    background-image: linear-gradient(rgba(14, 26, 36, 0.78), rgba(14, 26, 36, 0.92)), url('/images/fondo_oscuro.jpg') !important;
}
.fi-bienvenida-widget:has(.fi-bienvenida-widget__updates) .fi-bienvenida-widget__inner {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) minmax(320px, 0.85fr) !important;
    align-items: center !important;
    text-align: left !important;
    gap: 1.5rem !important;
    max-width: 100% !important;
}
@media (max-width: 1024px) {
    .fi-bienvenida-widget:has(.fi-bienvenida-widget__updates) .fi-bienvenida-widget__inner {
        grid-template-columns: 1fr !important;
    }
}
.fi-bienvenida-widget:has(.fi-bienvenida-widget__updates) .fi-bienvenida-widget__content {
    align-items: flex-start !important;
    text-align: left !important;
}

/* Panel de actualizaciones — compacto y minimal */
.fi-bienvenida-widget__updates {
    background: rgba(255, 255, 255, 0.94) !important;
    border: 1px solid rgba(201, 162, 77, 0.22) !important;
    border-left: 3px solid #C9A24D !important;
    backdrop-filter: blur(6px);
    border-radius: 0.55rem !important;
    color: #1e293b;
    padding: 0.7rem 0.85rem !important;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.05);
    min-width: 0;
}
html.dark .fi-bienvenida-widget__updates {
    background: rgba(15, 26, 36, 0.92) !important;
    border-color: rgba(201, 162, 77, 0.3) !important;
    border-left-color: #C9A24D !important;
    color: #f8fafc;
}
.fi-bienvenida-widget__updates h3 {
    color: #6b4f1a !important;
    margin: 0 !important;
}
html.dark .fi-bienvenida-widget__updates h3 {
    color: #d9b461 !important;
}
.fi-bienvenida-widget__updates ul {
    list-style: none !important;
    padding: 0 !important;
    margin: 0 !important;
}
.fi-bienvenida-widget__updates li {
    background: transparent !important;
    border: none !important;
    padding: 0.18rem 0 !important;
    border-bottom: 1px dotted rgba(148, 163, 184, 0.25) !important;
}
.fi-bienvenida-widget__updates li:last-child {
    border-bottom: none !important;
}
html.dark .fi-bienvenida-widget__updates li {
    border-bottom-color: rgba(201, 162, 77, 0.15) !important;
}

/* ==========================================================
 * === Loading overlay para tablas (Productos, etc.) ===
 * Se activa via JS en /js/admin/table-loading.js cuando
 * Livewire procesa cambios en tabla (paginación, filtros...)
 * ========================================================== */
.fi-ta-ctn,
.fi-ta-content-ctn {
    position: relative;
}
.fi-ta-ctn.is-loading,
.fi-ta-content-ctn.is-loading {
    pointer-events: none;
}
.fi-ta-ctn.is-loading::before,
.fi-ta-content-ctn.is-loading::before {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.65);
    z-index: 10;
    border-radius: inherit;
    animation: cmpd-table-fadein 0.18s ease;
}
html.dark .fi-ta-ctn.is-loading::before,
html.dark .fi-ta-content-ctn.is-loading::before {
    background: rgba(15, 23, 42, 0.55);
}
/* Spinner global — siempre visible en el centro del viewport
 * (independiente de la altura del contenedor de la tabla). Se inyecta
 * dinámicamente por table-loading.js y se elimina al terminar la carga. */
.cmpd-table-spinner {
    position: fixed;
    top: 50%;
    left: 50%;
    margin: -1.4rem 0 0 -1.4rem;
    width: 2.8rem;
    height: 2.8rem;
    border: 3px solid rgba(201, 162, 77, 0.22);
    border-top-color: #C9A24D;
    border-radius: 50%;
    z-index: 9999;
    pointer-events: none;
    box-shadow: 0 6px 18px rgba(14, 26, 36, 0.18);
    background: rgba(255, 255, 255, 0.9);
    animation: cmpd-table-spin 0.7s linear infinite, cmpd-table-fadein 0.18s ease;
}
html.dark .cmpd-table-spinner {
    background: rgba(15, 23, 42, 0.85);
    border-color: rgba(201, 162, 77, 0.18);
    border-top-color: #C9A24D;
}
@keyframes cmpd-table-fadein {
    from { opacity: 0; }
    to   { opacity: 1; }
}
@keyframes cmpd-table-spin {
    to { transform: rotate(360deg); }
}

/* ==========================================================
 * === Animaciones SUAVES de filas (enter/leave) ===
 * Sólo las filas que entran o salen se animan.
 * Las que se mantienen no se tocan.
 * ========================================================== */
.fi-ta-table tbody tr.is-row-enter {
    animation: cmpd-row-enter 320ms cubic-bezier(0.22, 0.61, 0.36, 1) backwards;
    will-change: opacity, transform;
}
.cmpd-row-ghost.is-row-leave {
    animation: cmpd-row-leave 280ms cubic-bezier(0.4, 0, 1, 1) backwards;
    will-change: opacity, transform;
}
.cmpd-row-ghost.is-row-leave table {
    background: transparent !important;
}

@keyframes cmpd-row-enter {
    0%   { opacity: 0; transform: translateY(-6px); }
    100% { opacity: 1; transform: translateY(0); }
}

@keyframes cmpd-row-leave {
    0%   { opacity: 1; transform: translateY(0); }
    100% { opacity: 0; transform: translateY(-8px); }
}


/* ========================================================
 * /admin/productos · filas COMPACTAS
 *
 * El listado tiene muchas columnas y ~37 000 tarifas. Reducimos
 * padding y font-size sin forzar `line-height` agresivo (causaba
 * solapes entre filas vecinas con badges). Los multi-valor
 * (tipos_cliente, tipos_renovacion) se pintan como badges
 * APILADOS — uno por línea — con colores semánticos.
 * ======================================================== */
.fi-resource-productos .fi-ta-row .fi-ta-cell,
.fi-resource-productos .fi-ta-header-cell {
    padding-top: 0.3rem !important;
    padding-bottom: 0.3rem !important;
    padding-left: 0.55rem !important;
    padding-right: 0.55rem !important;
    vertical-align: middle !important;
}
.fi-resource-productos .fi-ta-row .fi-ta-cell { font-size: 0.78rem !important; }
.fi-resource-productos .fi-ta-header-cell { font-size: 0.7rem !important; }

/* Badges: NO les forzamos line-height tight — rompía el centrado
 * vertical con tabular-nums y causaba solapes entre filas. */
.fi-resource-productos .fi-badge {
    font-size: 0.7rem !important;
    padding: 0.12rem 0.45rem !important;
    line-height: 1.3 !important;
    white-space: nowrap;
}

/* Celdas con `listWithLineBreaks()` → badges apilados verticalmente
 * con mini-gap (típico tipos_cliente / tipos_renovacion). */
.fi-resource-productos .fi-ta-cell .fi-ta-text-item-list {
    display: flex !important;
    flex-direction: column;
    gap: 0.15rem;
    align-items: flex-start;
}

.fi-resource-productos .fi-icon-btn,
.fi-resource-productos .fi-ta-actions { min-height: auto !important; }
.fi-resource-productos .fi-icon { width: 1rem; height: 1rem; }
.fi-resource-productos .fi-ta-record-actions .fi-icon-btn {
    width: 1.65rem !important;
    height: 1.65rem !important;
}

/* Nombre del producto: única celda con tendencia a desbordar.
 * Solo limitamos su ancho con ellipsis — NO aplicamos max-width
 * global a todas las celdas (causaba solapes entre vecinas). */
.fi-resource-productos td:nth-child(7) .fi-ta-text-item-label,
.fi-resource-productos td:nth-child(7) .fi-ta-text > span {
    max-width: 16rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: inline-block;
    vertical-align: middle;
}

/* ========================================================
 * Modal "Gestor de tarifas" · FULL-SCREEN
 *
 * Ancho casi total (96vw) y alto cap-eado al 95vh con scroll
 * NATIVO del modal. Padding agresivamente reducido para
 * aprovechar todo el espacio horizontal y vertical (el catálogo
 * tiene 37 000 tarifas → cada píxel cuenta).
 * ======================================================== */
.mv-gestor-fullscreen {
    width: 96vw !important;
    max-width: 96vw !important;
    max-height: 95vh !important;
    margin: 2.5vh auto !important;
}
.mv-gestor-fullscreen .fi-modal-window {
    width: 96vw !important;
    max-width: 96vw !important;
    max-height: 95vh !important;
}
.mv-gestor-fullscreen .fi-modal-content,
.mv-gestor-fullscreen .fi-modal-body {
    max-height: calc(95vh - 4rem) !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    padding: 0.65rem 0.85rem !important;
}

/* Header del modal — compacto */
.mv-gestor-fullscreen .fi-modal-header {
    padding: 0.65rem 0.85rem 0.5rem !important;
}
.mv-gestor-fullscreen .fi-modal-heading { font-size: 1.05rem !important; line-height: 1.2 !important; }
.mv-gestor-fullscreen .fi-modal-description { font-size: 0.78rem !important; line-height: 1.35 !important; margin-top: 0.15rem !important; }

/* Sections Filament dentro del modal — padding minimal */
.mv-gestor-fullscreen .fi-section,
.mv-gestor-fullscreen .fi-fo-section {
    padding: 0 !important;
}
.mv-gestor-fullscreen .fi-section-content-ctn,
.mv-gestor-fullscreen .fi-section-content {
    padding: 0.55rem 0.7rem !important;
}
.mv-gestor-fullscreen .fi-section-header {
    padding: 0.45rem 0.7rem !important;
    border-bottom: 1px solid rgba(201,162,77,0.18);
}
.mv-gestor-fullscreen .fi-section-header-heading {
    font-size: 0.82rem !important;
    line-height: 1.2 !important;
}
.mv-gestor-fullscreen .fi-section-header-description {
    font-size: 0.72rem !important;
    line-height: 1.3 !important;
    margin-top: 0.15rem !important;
}

/* Grid del form — gap reducido entre celdas */
.mv-gestor-fullscreen .fi-fo-grid { gap: 0.5rem !important; }
.mv-gestor-fullscreen .fi-fo-component-ctn { margin: 0 !important; }

/* Inputs y selects — reducir altura y padding */
.mv-gestor-fullscreen .fi-input,
.mv-gestor-fullscreen .fi-select-input { font-size: 0.82rem !important; }
.mv-gestor-fullscreen .fi-input-wrp { min-height: 2rem !important; }
.mv-gestor-fullscreen .fi-fo-field-wrp-label { font-size: 0.74rem !important; margin-bottom: 0.15rem !important; }

/* (La lista live antigua basada en CheckboxList se reemplazó por
 * mv-tl-* — toggles inline con cambio instantáneo. Los estilos
 * de la nueva lista van inline en el Placeholder del gestor.) */

/* En móvil/tablet: full-bleed sin margen, el modal entero scrollea. */
@media (max-width: 1023px) {
    .mv-gestor-fullscreen {
        width: 100vw !important;
        max-width: 100vw !important;
        max-height: 100vh !important;
        margin: 0 !important;
        border-radius: 0 !important;
    }
    .mv-gestor-fullscreen .fi-modal-window {
        width: 100vw !important;
        max-width: 100vw !important;
        max-height: 100vh !important;
    }
    .mv-gestor-fullscreen .fi-modal-content,
    .mv-gestor-fullscreen .fi-modal-body {
        max-height: calc(100vh - 4rem) !important;
    }
    .mv-gestor-results-list { max-height: 50vh; min-height: 12rem; }
}
