/* ═══════════════════════════════════════════════════════════
   GESTEMAS MODULAR DESIGN SYSTEM - REFACTOR V2
   "Legibilidad Suprema, Estructura Modular y Alto Contraste"
   ═══════════════════════════════════════════════════════════ */

/* 1. RESET & BASE CORE */
html {
    overflow-y: auto !important;
    height: auto !important;
}

body.gestemas-app-body {
    background-color: var(--gestemas-bg);
    color: var(--text-main);
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    margin: 0;
    height: auto !important;
    min-height: 100vh;
    overflow-x: clip !important;
    overflow-y: visible !important;
    -webkit-overflow-scrolling: touch;
}

/* Shell app: remove any theme-level width cap so the sidebar + content can use
   the full viewport width again. This only applies to the authenticated app. */
body.gestemas-app-body #page,
body.gestemas-app-body .site,
body.gestemas-app-body .site-content,
body.gestemas-app-body .content-area,
body.gestemas-app-body .site-main,
body.gestemas-app-body #primary,
body.gestemas-app-body .ast-container,
body.gestemas-app-body .ast-container-fluid {
    width: 100% !important;
    max-width: none !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
    box-sizing: border-box !important;
}

/* Oculta header/footer del tema WP cuando estamos dentro del shell Gestemas
   (mantiene visibles los headers propios del plugin: .gestemas-top-header y .gestemas-public-header). */
body.gestemas-app-body > header:not(.gestemas-top-header):not(.gestemas-public-header),
body.gestemas-app-body > div > header:not(.gestemas-top-header):not(.gestemas-public-header),
body.gestemas-app-body .site-header,
body.gestemas-app-body #masthead,
body.gestemas-app-body .main-header-bar,
body.gestemas-app-body .ast-header-break-point .main-header-bar,
body.gestemas-app-body .elementor-location-header,
body.gestemas-app-body .astra-theme-header,
body.gestemas-app-body .entry-header,
body.gestemas-app-body .page-header,
body.gestemas-app-body .site-footer,
body.gestemas-app-body #colophon,
body.gestemas-app-body footer.site-footer,
body.gestemas-app-body .elementor-location-footer {
    display: none !important;
    visibility: hidden !important;
    height: 0 !important;
    max-height: 0 !important;
    overflow: hidden !important;
    margin: 0 !important;
    padding: 0 !important;
}

/* Si el shell directo se monta, el contenedor principal debe ocupar el ancho completo
   sin paddings heredados del tema. */
body.gestemas-app-body #gestemas-direct-view-shell,
body.gestemas-app-body .gestemas-direct-view-shell {
    margin: 0 !important;
    padding: 0 !important;
    max-width: none !important;
    width: 100% !important;
}

/* Oculta header/footer del tema WP cuando estamos dentro del shell Gestemas
   (mantiene visibles los headers propios del plugin: .gestemas-top-header y .gestemas-public-header). */
body.gestemas-app-body > header:not(.gestemas-top-header):not(.gestemas-public-header),
body.gestemas-app-body > div > header:not(.gestemas-top-header):not(.gestemas-public-header),
body.gestemas-app-body .site-header,
body.gestemas-app-body #masthead,
body.gestemas-app-body .main-header-bar,
body.gestemas-app-body .ast-header-break-point .main-header-bar,
body.gestemas-app-body .elementor-location-header,
body.gestemas-app-body .astra-theme-header,
body.gestemas-app-body .entry-header,
body.gestemas-app-body .page-header,
body.gestemas-app-body .site-footer,
body.gestemas-app-body #colophon,
body.gestemas-app-body footer.site-footer,
body.gestemas-app-body .elementor-location-footer {
    display: none !important;
    visibility: hidden !important;
    height: 0 !important;
    max-height: 0 !important;
    overflow: hidden !important;
    margin: 0 !important;
    padding: 0 !important;
}

/* Si el shell directo se monta, el contenedor principal debe ocupar el ancho completo
   sin paddings heredados del tema. */
body.gestemas-app-body #gestemas-direct-view-shell,
body.gestemas-app-body .gestemas-direct-view-shell {
    margin: 0 !important;
    padding: 0 !important;
    max-width: none !important;
    width: 100% !important;
}

/* Fluid Layout System — aplicado via body.gestemas-campus-fullwidth-view (campus-master.css)
   is-fluid queda como fallback opt-in para otras vistas que lo necesiten */
.gestemas-content-wrapper.is-fluid {
    max-width: none !important;
    padding-left: var(--page-padding-desktop, 40px) !important;
    padding-right: var(--page-padding-desktop, 40px) !important;
}

.gestemas-content-wrapper {
    width: 100%;
    padding-left: var(--gst-page-padding-desktop, 40px);
    padding-right: var(--gst-page-padding-desktop, 40px);
    max-width: none;
    margin: 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-sizing: border-box;
    position: relative;
    overflow-x: clip;
}

.gestemas-page-container {
    padding: var(--gst-page-padding-desktop, 40px);
    max-width: none;
    margin: 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-sizing: border-box;
    position: relative;
}

@media (max-width: 1024px) {
    .gestemas-content-wrapper {
        padding-left: 0;
        padding-right: 0;
    }
}

@media (max-width: 768px) {
    .gestemas-content-wrapper {
        padding-left: 0;
        padding-right: 0;
        padding-bottom: var(--section-margin, 32px);
    }
}

.gestemas-app {
    min-height: 100vh;
    background-color: var(--gestemas-bg);
    background-image: var(--gestemas-gradient-mesh);
    background-attachment: fixed;
    display: flex;
    flex-direction: column;
}

/* Modal Open Helper - Prevents body scroll while keeping modal scrollable */
body.gestemas-modal-open,
html.gst-lock-scroll,
body.gst-lock-scroll {
    overflow: hidden !important;
    position: fixed !important;
    width: 100% !important;
    height: 100% !important;
    touch-action: none !important;
}

/* PREMIUM MODAL SYSTEM (PONE STANDARD) */
.pone-modal-premium {
    position: fixed;
    inset: 0;
    z-index: var(--z-modal);
    display: none;
    align-items: center;
    justify-content: center;
    padding: var(--page-padding-mobile, 12px);
    background: rgba(15, 23, 42, 0.45);
    backdrop-filter: blur(10px);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.pone-modal-premium.active {
    display: flex;
    opacity: 1;
}

/* Standalone Modal Overlay (Profile Edit, etc.) */
.gestemas-modal {
    position: fixed;
    inset: 0;
    z-index: var(--z-modal);
    display: none;
    align-items: center;
    justify-content: center;
    padding: var(--page-padding-mobile, 16px);
    background: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(12px);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.gestemas-modal.active,
.gestemas-modal[style*="display: flex"] {
    opacity: 1;
}

.pone-modal-premium.active .gestemas-modal-premium {
    transform: translateY(0) scale(1);
}

.pone-modal-premium .gestemas-modal-premium {
    width: 100%;
    max-width: 850px;
    max-height: 94vh;
    transform: translateY(20px) scale(0.95);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    background: var(--glass-bg);
    backdrop-filter: blur(var(--glass-blur));
    border-radius: var(--radius-mega, 32px);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: var(--glass-shadow);
    border: 1px solid var(--glass-border);
    position: relative;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
}

#gestemas-modal-container.gestemas-modal-contents {
    display: contents !important;
}

#gestemas-modal-backdrop.pone-modal-premium {
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100vh;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 10000;
}

#gestemas-modal-backdrop.pone-modal-premium.active {
    display: flex;
}

/* NEXUS V5.2 - PREMIUM COMPONENTS (STANDARD) */
.nexus-section-glass {
    background: rgba(255, 255, 255, 0.4);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    padding: 24px;
    margin-bottom: 24px;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.nexus-section-glass:hover {
    background: rgba(255, 255, 255, 0.5);
    border-color: var(--gestemas-primary);
    box-shadow: var(--glass-shadow);
}

.nexus-section-heading {
    font-size: 0.85rem;
    text-transform: uppercase;
    color: var(--gestemas-primary);
    font-weight: 800;
    letter-spacing: 0.05em;
    margin: 0 0 16px 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.modal-close-premium-hero {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.2);
    color: #ef4444;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 100;
}

.modal-close-premium-hero:not(.gestemas-btn):hover {
    background: #ef4444;
    color: white;
    transform: scale(1.1);
    box-shadow: 0 4px 15px rgba(239, 68, 68, 0.4);
}

.nexus-horizontal-selector {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    padding: 4px;
}

.gestemas-container,
.nexus-container {
    width: 100%;
    max-width: none;
    margin: 0;
    padding-left: var(--nexus-container-padding);
    padding-right: var(--nexus-container-padding);
    box-sizing: border-box;
}

/* Padding Override Guard - Antigravity Methodology
   Excluye dashboard, campus y recursos (el layout lo provee body.gestemas-campus-fullwidth-view vía campus-master.css) */
.gestemas-content-wrapper .gestemas-page-wrapper:not(.gestemas-view-dashboard-v2):not(.gestemas-campus-fullwidth-view):not(.campus-layout-root):not(.recursos-module):not([class*="gestemas-view-campus"]):not(.gestemas-view-recursos-v2) {
    /* Padding Guard relaxed to allow 40px margins on desktop by default */
    padding-left: var(--gst-page-padding-desktop, 40px);
    padding-right: var(--gst-page-padding-desktop, 40px);
}

/* PIXEL PERFECT PAGE CONTAINER (Standardized Responsive Layout) */
body.gestemas-campus-fullwidth-view #gestemas-content {
    padding-left: 0 !important;
    padding-right: 0 !important;
}

#gestemas-content {
    width: 100%;
    margin: 0 !important;
    max-width: none !important;
    min-height: calc(100vh - 80px);
    padding-left: var(--gst-page-padding-desktop, 40px);
    padding-right: var(--gst-page-padding-desktop, 40px);
    padding-bottom: var(--section-margin, 32px);
    box-sizing: border-box;
}

body.gestemas-campus-fullwidth-view .gestemas-page {
    padding-left: 0 !important;
    padding-right: 0 !important;
}

.gestemas-page {
    width: 100%;
    max-width: none;
    margin: 0;
    padding-left: var(--gst-page-padding-desktop, 40px);
    padding-right: var(--gst-page-padding-desktop, 40px);
    padding-bottom: var(--section-margin, 32px);
    box-sizing: border-box;
    position: relative;
    z-index: 1;
}

@media (max-width: 1024px) {
    .gestemas-page {
        padding-left: var(--page-padding-tablet, 24px);
        padding-right: var(--page-padding-tablet, 24px);
    }
}

@media (max-width: 768px) {
    .gestemas-page {
        padding-left: var(--page-padding-mobile, 4px);
        padding-right: var(--page-padding-mobile, 4px);
    }
}

/* Premium Page Container (Standardized) */
.gestemas-page-premium {
    width: 100%;
    max-width: var(--gst-page-max-width, 1600px);
    margin-left: auto;
    margin-right: auto;
    padding-left: var(--gst-page-padding-desktop, 40px);
    padding-right: var(--gst-page-padding-desktop, 40px);
    padding-bottom: var(--section-margin, 32px);
    box-sizing: border-box;
    position: relative;
    z-index: 1;
    min-height: 100%;
}

@media (max-width: 1024px) {
    .gestemas-page-premium {
        padding-left: var(--page-padding-tablet, 24px);
        padding-right: var(--page-padding-tablet, 24px);
    }
}

@media (max-width: 768px) {
    .gestemas-page-premium {
        max-width: 100%;
        padding-left: 4px;
        /* Reduced from 12px */
        padding-right: 4px;
        /* Reduced from 12px */
        padding-top: 8px;
        padding-bottom: 100px;
    }
}

@media (max-width: 480px) {
    .gestemas-page-premium {
        padding-left: 8px;
        padding-right: 8px;
        padding-top: 8px;
    }
}

/* Standardized Block/Card Spacing */
.gestemas-block {
    padding: var(--block-padding, 24px);
    margin-bottom: var(--block-gap, 24px);
    border-radius: var(--block-radius, 20px);
}

.gestemas-card {
    background: var(--glass-bg);
    backdrop-filter: blur(var(--glass-blur));
    border-radius: var(--gestemas-radius-lg);
    box-shadow: var(--glass-shadow);
    border: 1px solid var(--glass-border);
    overflow: hidden;
    transition: var(--gestemas-transition);
    width: 100%;
}

@media (max-width: 768px) {
    .gestemas-block {
        padding: var(--block-padding-mobile, 16px);
        margin-bottom: var(--block-gap-mobile, 16px);
        border-radius: var(--block-radius-mobile, 16px);
    }

    .gestemas-card {
        border-radius: var(--block-radius-mobile, 16px);
    }
}

/* ═══════════════════════════════════════════════════════════
   NEXUS V5.2 / PONE STANDARD COMPONENTS
   ═══════════════════════════════════════════════════════════ */

/* Glassmorphism V3 Global Utility */
.glass-v3-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(var(--glass-blur));
    border: 1px solid var(--glass-border);
    border-radius: var(--block-radius, 24px);
    box-shadow: var(--glass-shadow);
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.glass-v3-panel:hover {
    border-color: var(--gestemas-primary);
    transform: translateY(-2px);
    box-shadow: var(--gestemas-shadow-lg);
}

/* Subnav 100% Fluidity */
.gestemas-subnav-wrapper {
    width: 100%;
    margin-bottom: var(--block-gap, 24px);
}

@media (max-width: 768px) {
    .gestemas-subnav-wrapper {
        margin-left: calc(var(--page-padding-mobile) * -1);
        width: 100vw;
    }
}

/* Premium Header (PONE Standard) */
.gestemas-premium-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--block-gap, 32px);
    padding-top: 10px;
}

@media (max-width: 768px) {
    .gestemas-premium-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }

    .gestemas-premium-header .gestemas-btn {
        width: 100%;
    }
}

/* Consolidated Control Bar */
.gestemas-control-bar {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 24px;
    background: var(--glass-bg);
    backdrop-filter: blur(var(--glass-blur));
    border-radius: var(--gestemas-radius-md);
    border: 1px solid var(--glass-border);
    margin-bottom: var(--block-gap, 24px);
    flex-wrap: wrap;
}

.gestemas-control-bar .control-search {
    flex: 1;
    min-width: 280px;
    position: relative;
}

.gestemas-control-bar .control-search i {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--gestemas-gray-400);
    width: 18px;
}

.gestemas-control-bar .control-search-input {
    width: 100%;
    padding: 12px 16px 12px 48px;
    background: rgba(0, 0, 0, 0.03);
    border: 1px solid transparent;
    border-radius: 12px;
    font-size: 14px;
    transition: var(--gestemas-transition);
}

.gestemas-control-bar .control-search-input:focus {
    background: white;
    border-color: var(--gestemas-primary);
    box-shadow: 0 0 0 4px var(--gestemas-primary-light);
}

.gestemas-control-bar .control-filters {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

@media (max-width: 768px) {
    .gestemas-control-bar {
        padding: 16px;
    }

    .gestemas-control-bar .control-search {
        width: 100%;
        order: -1;
    }

    .gestemas-control-bar .control-filters {
        width: 100%;
    }

    .gestemas-control-bar .premium-select {
        flex: 1;
        min-width: 140px;
    }
}

/* Responsive Table-to-Card System */
.gestemas-responsive-table-wrapper {
    width: 100%;
    overflow-x: auto;
    border-radius: var(--gestemas-radius-lg);
    border: 1px solid var(--theme-border);
    background: var(--theme-surface);
}

/* Responsive Bridge Integration: Tables v2 */
body[data-gst-view="mobile"] .gestemas-responsive-table-wrapper {
    background: transparent;
    border: none;
}

.gestemas-table thead {
    display: none;
}

.gestemas-table,
.gestemas-table tbody,
.gestemas-table tr,
.gestemas-table td {
    display: block;
    width: 100%;
}

.gestemas-table tr {
    background: var(--glass-bg);
    margin-bottom: 16px;
    border-radius: var(--gestemas-radius-md);
    border: 1px solid var(--glass-border);
    padding: 16px;
    box-shadow: var(--gestemas-shadow-sm);
}

.gestemas-table td {
    text-align: right;
    padding: 8px 0;
    border-bottom: 1px solid var(--gestemas-gray-100);
    position: relative;
    padding-left: 50%;
}

.gestemas-table td:last-child {
    border-bottom: none;
    padding-top: 16px;
}

.gestemas-table td::before {
    content: attr(data-label);
    position: absolute;
    left: 0;
    width: 45%;
    padding-right: 10px;
    white-space: nowrap;
    text-align: left;
    font-weight: 800;
    text-transform: uppercase;
    font-size: 10px;
    color: var(--gestemas-gray-500);
}

/* Grid with standardized gaps */
.gestemas-grid {
    display: grid;
    gap: var(--grid-gap, 24px);
}

@media (max-width: 768px) {
    .gestemas-grid {
        gap: var(--grid-gap-mobile, 12px);
    }
}

/* 2. TYPOGRAPHY BLOCK - SCOPED */
.gestemas-app h1,
.gestemas-admin-v2 h1 {
    font-size: var(--header-title-size, var(--fs-h1));
    line-height: 1.1;
}

.gestemas-card__title {
    font-size: var(--card-title-size, var(--fs-h2));
    margin: 0;
}

.gestemas-app h1,
.gestemas-admin-v2 h1,
.gestemas-app h2,
.gestemas-admin-v2 h2,
.gestemas-app h3,
.gestemas-admin-v2 h3,
.gestemas-app h4,
.gestemas-admin-v2 h4,
.gestemas-app h5,
.gestemas-admin-v2 h5,
.gestemas-app h6,
.gestemas-admin-v2 h6,
.gestemas-outfit {
    font-family: 'Outfit', sans-serif;
    font-weight: 800;
    color: var(--gestemas-gray-900);
    margin-top: 0;
    letter-spacing: -0.02em;
}

.gestem.auth-loading-text {
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
    background: linear-gradient(135deg, var(--gestemas-primary), var(--gestemas-secondary));
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    font-size: 14px;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.gestemas-app p,
.gestemas-admin-v2 p,
.gestemas-app span,
.gestemas-admin-v2 span,
.gestemas-app li,
.gestemas-admin-v2 li,
.gestemas-app a,
.gestemas-admin-v2 a,
.gestemas-app div,
.gestemas-admin-v2 div,
.gestemas-app b,
.gestemas-admin-v2 b,
.gestemas-app strong,
.gestemas-admin-v2 strong,
.gestemas-app label,
.gestemas-admin-v2 label {
    color: var(--gestemas-gray-800);
}

.gestemas-text-muted {
    color: var(--gestemas-gray-600) !important;
    font-weight: 500;
}

/* 3. COMPONENT: HEADER & NAVIGATION */
.gestemas-header {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(20px) saturate(180%);
    border-bottom: 1px solid var(--gestemas-gray-200);
    position: sticky;
    top: 0;
    z-index: 1100;
    height: 80px;
    display: flex;
    align-items: center;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.gestemas-header__inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.gestemas-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none !important;
}

.gestemas-logo span {
    font-size: 26px;
    font-weight: 900;
    color: var(--gestemas-gray-900) !important;
    font-family: 'Outfit';
}

.gestemas-nav {
    display: flex;
    gap: 8px;
    background: var(--gestemas-gray-100);
    padding: 6px;
    border-radius: 99px;
}

.gestemas-nav__link {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 22px;
    text-decoration: none !important;
    color: var(--gestemas-gray-700) !important;
    font-size: 14px;
    font-weight: 700;
    border-radius: 99px;
    transition: var(--gestemas-transition);
}

.gestemas-nav__link:hover {
    color: var(--gestemas-primary) !important;
    background: white;
}

.gestemas-nav__link--active {
    background: white !important;
    color: var(--gestemas-primary) !important;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
}

/* Premium Header Elements */
.search-shortcut {
    position: absolute;
    right: 12px;
    background: rgba(0, 0, 0, 0.05);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 700;
    color: var(--gestemas-gray-400);
}

.gestemas-nav__link i {
    width: 18px;
    height: 18px;
}

/* 4. COMPONENT: USER & NOTIFICATIONS */
.gestemas-header__user {
    display: flex;
    align-items: center;
    gap: 12px;
}

.gestemas-user-badge {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 6px 12px;
    background: white;
    border: 1px solid var(--gestemas-gray-200);
    border-radius: 12px;
    transition: var(--gestemas-transition);
}

.gestemas-user-badge:hover {
    border-color: var(--gestemas-primary-light);
}

.gestemas-user-name {
    font-weight: 800;
    font-size: 14px;
    color: var(--gestemas-gray-900) !important;
}

.gestemas-user-role {
    font-size: 11px;
    font-weight: 800;
    color: var(--gestemas-primary);
    text-transform: uppercase;
}

/* 5. COMPONENT: SKELETONS (LOADING STATES) */
.gestemas-skeleton {
    background: linear-gradient(90deg, #f1f5f9 25%, #f8fafc 50%, #f1f5f9 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite linear;
    border-radius: 12px;
    width: 100%;
}

.g-skeleton-h1 {
    height: 40px;
    width: 40%;
    margin-bottom: 30px;
    border-radius: 20px;
}

.g-skeleton-card {
    height: 160px;
    border-radius: 24px;
}

.g-skeleton-text {
    height: 14px;
    margin-bottom: 12px;
    border-radius: 6px;
}

.g-skeleton-circle {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    flex-shrink: 0;
}

.g-skeleton-btn {
    height: 44px;
    width: 120px;
    border-radius: 10px;
}

@keyframes skeleton-loading {
    0% {
        background-position: 200% 0;
    }

    100% {
        background-position: -200% 0;
    }
}

/* 5.1 PREMIUM ANIMATIONS */
@keyframes fade-up {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.g-fade-up {
    animation: fade-up 0.5s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.g-delay-1 {
    animation-delay: 0.1s;
}

.g-delay-2 {
    animation-delay: 0.2s;
}

.g-delay-3 {
    animation-delay: 0.3s;
}

/* 5.2 HYDRATION & OFFLINE INDICATORS */
#gestemas-content.is-hydrating {
    opacity: 0.85;
    pointer-events: none;
    filter: saturate(0.8);
    transition: opacity 0.3s ease;
}

body.gestemas-offline::before {
    content: "Sin conexión a internet - Modo de consulta local activo";
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: var(--gestemas-warning);
    color: #000;
    text-align: center;
    font-size: 11px;
    font-weight: 700;
    padding: 2px 0;
    z-index: 10001;
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from {
        transform: translateY(-100%);
    }

    to {
        transform: translateY(0);
    }
}

/* 6. COMPONENT: STAT CARDS */
.gestemas-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr));
    gap: clamp(12px, 2.5vw, 24px);
    margin-top: 24px;
}

@media (max-width: 600px) {
    .gestemas-stats-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }
}

.stat-card-premium {
    background: var(--theme-surface);
    padding: var(--block-padding, 24px);
    border-radius: var(--block-radius, 24px);
    border: 1px solid var(--theme-border);
    display: flex;
    align-items: center;
    gap: var(--grid-gap-mobile, 16px);
    box-shadow: var(--gestemas-shadow-premium);
    transition: var(--gestemas-transition);
}

.stat-card-premium:hover {
    transform: translateY(-4px);
    border-color: var(--gestemas-primary-light);
}

.stat-icon {
    width: 50px;
    height: 50px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white !important;
}

.stat-icon i {
    color: white !important;
}

.stat-label {
    font-size: 11px;
    font-weight: 900;
    text-transform: uppercase;
    color: var(--gestemas-gray-700) !important;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.stat-value {
    font-size: 28px;
    font-weight: 900;
    color: var(--gestemas-gray-900) !important;
    line-height: 1;
}

/* 6. COMPONENT: CARDS & GLASS */
.gestemas-card {
    background: white;
    border-radius: 24px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
    border: 1px solid var(--gestemas-gray-100);
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    width: 100%;
}

.gestemas-glass,
.glass-premium {
    background: var(--glass-bg) !important;
    backdrop-filter: blur(var(--glass-blur)) saturate(180%) !important;
    -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(180%) !important;
    border: 1px solid var(--glass-border) !important;
    box-shadow: var(--glass-shadow) !important;
    box-shadow: var(--glass-shadow), var(--glass-edge-highlight) !important;
}

.gestemas-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--gestemas-shadow-lg);
    border-color: var(--gestemas-primary);
}

.gestemas-card__header {
    padding: var(--block-padding, 24px);
    border-bottom: 1px solid var(--theme-border);
    background: var(--glass-bg-accent);
}

.gestemas-card__body {
    padding: var(--block-padding, 24px);
}

.gestemas-card {
    margin-bottom: var(--block-gap, 24px);
}

/* Dashboard Pulse specific fix */
.collective-mesh h1,
.collective-mesh h2,
.collective-mesh h3,
.collective-mesh p,
.collective-mesh span {
    color: var(--gestemas-gray-800) !important;
}

/* 7. COMPONENT: BUTTONS */
.gestemas-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 10px 24px;
    font-weight: 600;
    border-radius: var(--gestemas-radius-md);
    border: 1px solid transparent;
    cursor: pointer;
    transition: var(--gestemas-transition);
    font-size: 14px;
    font-family: 'Outfit', sans-serif;
    user-select: none;
}

.gestemas-btn:active {
    transform: scale(0.96);
}

.gestemas-btn--primary {
    background: var(--gestemas-primary);
    color: white !important;
    box-shadow: var(--gestemas-shadow-sm);
}

.gestemas-btn--primary:hover {
    background: var(--gestemas-primary-dark);
    color: white !important;
    box-shadow: var(--gestemas-shadow-md);
}

.gestemas-btn--secondary {
    background: white;
    color: var(--gestemas-gray-700) !important;
    border-color: var(--gestemas-gray-300);
}

.gestemas-btn--secondary:hover {
    background: var(--gestemas-gray-50);
    border-color: var(--gestemas-gray-400);
}

.gestemas-btn-premium {
    background: linear-gradient(135deg, #4285f4 0%, #34a853 100%);
    color: white !important;
    font-weight: 700;
    padding: 12px 28px;
    border-radius: var(--gestemas-radius-md);
    border: none;
    box-shadow: 0 4px 6px rgba(66, 133, 244, 0.2);
}

.gestemas-btn-premium:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 12px rgba(66, 133, 244, 0.3);
}

.gestemas-btn--icon {
    padding: 8px;
    border-radius: 8px;
    background: var(--gestemas-gray-50);
}

/* 7.1 PREMIUM BUTTON VARIANTS */
.gestemas-btn--primary-premium {
    background: var(--gestemas-primary);
    color: white !important;
    font-weight: 700;
    box-shadow: var(--gestemas-shadow-md);
}

.gestemas-btn--outline-premium {
    background: white;
    color: var(--gestemas-gray-700) !important;
    border: 1px solid var(--gestemas-gray-300);
}

.gestemas-btn--primary-premium:hover {
    background: var(--gestemas-primary-dark);
    transform: translateY(-2px);
    box-shadow: var(--gestemas-shadow-lg);
}

.gestemas-btn--outline-premium:hover {
    background: var(--gestemas-gray-50);
    border-color: var(--gestemas-gray-400);
    transform: translateY(-1px);
}

.gestemas-btn--ghost {
    background: transparent;
    color: var(--gestemas-primary) !important;
    border: 1px solid transparent;
}

.gestemas-btn--ghost:hover {
    background: var(--gestemas-primary-light);
    color: var(--gestemas-primary-dark) !important;
}

/* 7.2 GLASS UTILITIES */
.g-glass-card {
    background: var(--glass-bg);
    backdrop-filter: blur(var(--glass-blur));
    border: 1px solid var(--glass-border);
    border-radius: var(--gestemas-radius-lg);
    box-shadow: var(--gestemas-shadow-md);
    transition: var(--gestemas-transition);
    overflow: hidden;
}

.g-glass-card:hover {
    box-shadow: var(--gestemas-shadow-lg);
    transform: translateY(-4px);
}

.gestemas-table-wrapper,
.premium-table-container {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: var(--gestemas-radius-md);
    margin-bottom: 20px;
    background: white;
    border: 1px solid var(--gestemas-gray-100);
}

.premium-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    min-width: 800px;
    /* Force scroll on small screens */
}

.premium-table th {
    text-align: left;
    padding: 16px;
    background: var(--gestemas-gray-50);
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    color: var(--gestemas-gray-600);
    border-bottom: 2px solid var(--gestemas-gray-100);
    white-space: nowrap;
}

.premium-table td {
    padding: 16px;
    border-bottom: 1px solid var(--gestemas-gray-100);
    font-size: 14px;
    color: var(--gestemas-gray-800);
    vertical-align: middle;
}

.premium-table tr:last-child td {
    border-bottom: none;
}

.premium-table tr:hover td {
    background: var(--gestemas-gray-50);
}

/* 8. COMPONENT: FORMS & INPUTS */
/* 8. COMPONENT: FORMS & INPUTS v3 (Silicon Valley Standard) */
.gestemas-form-group {
    margin-bottom: var(--block-gap, 24px);
    position: relative;
}

.gestemas-label {
    display: block;
    font-size: var(--type-caption, 0.75rem);
    font-weight: 800;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 8px;
    letter-spacing: 0.05em;
}

.gestemas-input,
.gestemas-select,
.gestemas-textarea {
    width: 100%;
    padding: 12px 16px;
    background: var(--theme-surface);
    border: 1.5px solid var(--theme-border);
    border-radius: var(--gestemas-radius-md);
    color: var(--text-main);
    font-family: inherit;
    font-size: var(--type-base);
    transition: var(--gestemas-transition);
    box-sizing: border-box;
}

.gestemas-input:focus,
.gestemas-select:focus,
.gestemas-textarea:focus {
    outline: none;
    border-color: var(--gestemas-primary);
    box-shadow: 0 0 0 4px rgba(var(--gestemas-primary-rgb), 0.1);
    transform: translateY(-1px);
}

/* 8.1 FLOATING LABEL GROUPS (PREMIUM GLASS v3) */
.gestemas-floating-group {
    position: relative;
    width: 100%;
    margin-bottom: var(--block-gap-mobile, 16px);
}

.gestemas-floating-group input,
.gestemas-floating-group select,
.gestemas-floating-group textarea {
    width: 100%;
    padding: 26px 16px 10px;
    border: 1.5px solid var(--theme-border);
    border-radius: var(--gestemas-radius-md);
    /* Light mode: explicit white bg for full contrast. Dark mode: glass-bg-accent (set in dark theme tokens) */
    background: var(--theme-surface, #ffffff);
    font-size: 15px;
    color: var(--text-main);
    font-family: inherit;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-sizing: border-box;
    -webkit-appearance: none;
    appearance: none;
}

.gestemas-floating-group select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
    padding-right: 48px;
    cursor: pointer;
}

.gestemas-floating-group label {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 15px;
    font-weight: 500;
    pointer-events: none;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: calc(100% - 32px);
}

/* States: focus and has-content */
.gestemas-floating-group input:focus,
.gestemas-floating-group select:focus,
.gestemas-floating-group textarea:focus {
    outline: none;
    border-color: var(--gestemas-primary);
    background: var(--theme-surface);
    box-shadow: 0 10px 25px -5px rgba(var(--gestemas-primary-rgb), 0.1), 0 0 0 4px rgba(var(--gestemas-primary-rgb), 0.05);
    transform: translateY(-2px);
}

.gestemas-floating-group input:focus+label,
.gestemas-floating-group input:not(:placeholder-shown)+label,
.gestemas-floating-group select:focus+label,
.gestemas-floating-group select:not([value=""]):not(:disabled)+label,
.gestemas-floating-group select:valid+label,
.gestemas-floating-group textarea:focus+label,
.gestemas-floating-group textarea:not(:placeholder-shown)+label {
    top: 12px;
    font-size: 11px;
    font-weight: 800;
    color: var(--gestemas-primary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    transform: translateY(0);
}

/* Multi-line adjustment */
.gestemas-floating-group textarea {
    min-height: 100px;
    resize: vertical;
}

.gestemas-floating-group textarea+label {
    top: 24px;
    transform: none;
}

.gestemas-floating-group textarea:focus+label,
.gestemas-floating-group textarea:not(:placeholder-shown)+label {
    top: 12px;
}

/* Responsive Overrides (No Zoom Logic) */
@media (max-width: 768px) {

    .gestemas-floating-group input,
    .gestemas-floating-group select,
    .gestemas-floating-group textarea {
        font-size: 16px;
        /* Essential for mobile UX */
        padding: 24px 14px 8px;
    }

    .gestemas-floating-group label {
        font-size: 14px;
        left: 14px;
    }
}

/* Responsive adjustments */
/* 8.2 PREMIUM FORM REFINEMENTS */
/* 8.2 PREMIUM FORM REFINEMENTS (Silicon Valley Layout) */
.gestemas-premium-form {
    display: flex;
    flex-direction: column;
    gap: var(--block-gap, 32px);
}

.gestemas-form-layout {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: var(--grid-gap, 24px);
}

/* Logic: Enforce 2 columns on wide screens / 1 on mobile */
.gestemas-form-layout--two-cols {
    grid-template-columns: repeat(2, 1fr);
}

@media (max-width: 960px) {
    .gestemas-form-layout--two-cols {
        grid-template-columns: 1fr;
    }
}

/* Fix for Potential White-on-White Text in Cards */
.gestemas-card p,
.gestemas-card span,
.gestemas-card li {
    color: var(--gestemas-gray-700);
}

.gestemas-card--dark p,
.gestemas-card--dark span,
.gestemas-card--dark li {
    color: var(--gestemas-gray-200);
}

/* Specialized Sections inside forms */
.wizard-section {
    animation: fade-up 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    padding: var(--block-padding, 24px);
    background: var(--glass-bg-accent);
    border-radius: var(--gestemas-radius-lg);
    border: 1px solid var(--theme-border);
    backdrop-filter: blur(var(--glass-blur));
}

.section-title {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: var(--grid-gap, 24px);
}

.section-title i {
    color: var(--gestemas-primary);
    width: 20px;
    height: 20px;
}

.section-title h4 {
    margin: 0;
    font-size: var(--type-h3, 1.25rem);
    font-weight: 800;
}

/* Error States Integrated with Tokens */
.gestemas-floating-group.has-error input,
.gestemas-floating-group.has-error select,
.gestemas-floating-group.has-error textarea {
    border-color: var(--gestemas-danger) !important;
    background: rgba(var(--gestemas-danger-rgb), 0.05);
}

.gestemas-floating-group.has-error label {
    color: var(--gestemas-danger) !important;
}

/* 8.3 SPECIALIZED FORM COMPONENTS */
.student-multi-selector {
    padding: var(--block-padding, 24px);
    border-radius: var(--gestemas-radius-lg);
    background: var(--nexus-blue-soft);
    border: 1.5px solid var(--theme-border);
}

.selector-actions-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--grid-gap-mobile, 16px);
    gap: 16px;
}

.search-box-pill {
    position: relative;
    flex: 1;
}

.search-box-pill i {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    width: 16px;
}

.search-box-pill input {
    width: 100%;
    padding: 12px 16px 12px 40px;
    border-radius: var(--gestemas-radius-full);
    border: 1.5px solid var(--theme-border);
    background: var(--theme-surface);
    font-size: var(--type-small);
    transition: var(--gestemas-transition);
}

.search-box-pill input:focus {
    border-color: var(--gestemas-primary);
    box-shadow: 0 0 0 4px rgba(var(--gestemas-primary-rgb), 0.1);
    outline: none;
}

.students-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: var(--grid-gap-mobile, 12px);
    max-height: 250px;
    overflow-y: auto;
    padding: 4px;
}

.student-chip-selectable {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    background: var(--theme-surface);
    border: 1.5px solid var(--theme-border);
    border-radius: var(--gestemas-radius-md);
    cursor: pointer;
    transition: var(--gestemas-transition);
}

.student-chip-selectable:hover {
    border-color: var(--gestemas-primary-light);
    transform: translateY(-2px);
}

.chip-avatar {
    width: 32px;
    height: 32px;
    background: var(--gestemas-primary-light);
    color: var(--gestemas-primary);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 800;
}

.chip-name {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-soft);
}

/* Topic Selector */
.intelligent-topic-selector {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding: var(--block-padding-mobile, 16px);
    background: var(--nexus-blue-soft);
    border-radius: var(--gestemas-radius-lg);
    border: 1.5px solid rgba(var(--gestemas-primary-rgb), 0.1);
}

.premium-topic-btn {
    padding: 10px 18px;
    border: 1.5px solid var(--theme-border);
    background: var(--theme-surface);
    border-radius: var(--gestemas-radius-md);
    font-size: var(--type-small);
    font-weight: 700;
    color: var(--text-soft);
    cursor: pointer;
    transition: var(--gestemas-transition);
}

.premium-topic-btn:hover {
    border-color: var(--gestemas-primary);
    color: var(--gestemas-primary);
    transform: translateY(-2px);
}

.premium-topic-btn.is-selected {
    border-color: var(--gestemas-primary);
    color: white;
    background: var(--gestemas-primary);
    box-shadow: 0 8px 20px -5px rgba(var(--gestemas-primary-rgb), 0.4);
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-5px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Tag Selector */
.gestemas-tag-selector {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.gestemas-tag-btn {
    padding: 10px 18px;
    border-radius: 99px;
    border: 1px solid var(--gestemas-gray-200);
    background: white;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    color: var(--gestemas-gray-700);
}

.gestemas-tag-btn:hover {
    background: var(--gestemas-gray-50);
    border-color: var(--gestemas-primary-light);
    transform: translateY(-1px);
}

.gestemas-tag-btn.is-active {
    background: var(--gestemas-primary);
    color: white;
    border-color: var(--gestemas-primary);
    box-shadow: 0 4px 12px rgba(14, 165, 233, 0.3);
}

/* Button Loaders */
.gestemas-spinner-sm {
    width: 16px;
    height: 16px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spinner 0.6s linear infinite;
    display: inline-block;
}

@keyframes spinner {
    to {
        transform: rotate(360deg);
    }
}

/* 9. PREMIUM MODAL SYSTEM (Silicon Valley Standard) */
.gestemas-modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    height: 100dvh; /* Dynamic viewport height for mobile */
    background: rgba(15, 23, 42, 0.7);
    backdrop-filter: blur(12px);
    z-index: 100000;
    display: none;
    align-items: flex-start; /* Start from top to allow scrolling if too tall */
    justify-content: center;
    padding: 20px 10px;
    opacity: 0;
    transition: opacity 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    overflow-y: auto;
    overflow-x: clip;
    -webkit-overflow-scrolling: touch;
}

.gestemas-modal-backdrop.active {
    opacity: 1;
}

.gestemas-modal-wrapper {
    margin: auto; /* Vertically and horizontally center the modal within scrollable backdrop */
    width: 100%;
    max-width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transform: translateY(20px) scale(0.98);
    opacity: 0;
    transition: transform 0.5s cubic-bezier(0.2, 1, 0.3, 1), opacity 0.4s;
    z-index: var(--z-modal);
    pointer-events: none;
}

/* Ensure modal container centers content properly */
#gestemas-modal-container {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    /* Removido min-height: 100% confuso */
    width: 100% !important;
}

@media (max-width: 768px) {
    #gestemas-modal-container {
        align-items: flex-end !important;
    }
}

.gestemas-modal-wrapper>* {
    pointer-events: auto;
    /* Re-enable for the modal itself */
}

.gestemas-modal-backdrop.active .gestemas-modal-wrapper {
    transform: translateY(0) scale(1);
    opacity: 1;
}

.gestemas-modal-premium,
.gestemas-modal-content {
    background: var(--glass-bg);
    backdrop-filter: blur(var(--glass-blur));
    border-radius: var(--gestemas-radius-lg);
    box-shadow: var(--glass-shadow);
    display: flex;
    flex-direction: column;
    max-height: 85vh;
    overflow: hidden;
    border: 1px solid var(--glass-border);
    animation: slideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.gestemas-modal-header-premium,
.gestemas-modal-header {
    padding: var(--block-padding, 24px) var(--block-padding, 32px);
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--theme-border);
    background: var(--glass-bg-accent);
}

.gestemas-modal-body-premium,
.gestemas-modal-body {
    padding: var(--block-padding, 32px);
    overflow-y: auto;
    flex: 1;
    min-height: 0;
    /* Critical for flex child scroll */
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    touch-action: pan-y;
    scrollbar-width: thin;
    scrollbar-color: rgba(148, 163, 184, 0.3) transparent;
}

.gestemas-modal-body-premium::-webkit-scrollbar {
    width: 6px;
}

.gestemas-modal-body-premium::-webkit-scrollbar-thumb {
    background-color: rgba(148, 163, 184, 0.3);
    border-radius: 4px;
}

.gestemas-modal-footer-premium,
.modal-footer {
    padding: var(--block-padding-tablet, 20px) var(--block-padding, 32px);
    border-top: 1px solid var(--theme-border);
    background: var(--glass-bg-accent);
    display: flex;
    justify-content: flex-end;
    gap: var(--grid-gap-mobile, 12px);
}

/* Modal Responsive (Centro Absoluto) - Sincronizado Universalmente */
@media (max-width: 768px) {
    .gestemas-modal-backdrop {
        padding: 0;
        align-items: flex-end;
        overflow-y: hidden;
    }

    .gestemas-modal-wrapper {
        margin: 0;
        width: 100% !important;
        max-width: 100% !important;
        transform: translateY(20px);
    }

    .gestemas-modal-backdrop.active .gestemas-modal-wrapper {
        transform: translateY(0);
    }

    .gestemas-modal-premium,
    .gestemas-modal-content {
        width: 100% !important;
        max-width: 100% !important;
        max-height: 95dvh !important;
        border-radius: 28px 28px 0 0 !important;
        margin: 0 !important;
    }

    .gestemas-modal-header-premium,
    .gestemas-modal-body-premium,
    .gestemas-modal-footer-premium {
        padding: 16px 14px;
    }

    .gestemas-modal-footer-premium,
    .gestemas-modal-footer {
        flex-direction: column-reverse;
        gap: 12px;
        box-shadow: none;
        border-top: 1px solid var(--theme-border);
        flex-shrink: 0;
    }

    .gestemas-modal-footer-premium .gestemas-btn {
        width: 100%;
        justify-content: center;
    }
    
    /* Override para modal consultoria - Estandarizado */
    #gestemas-modal-container .gestemas-modal-premium.consultoria-modal {
        border-radius: 20px !important;
    }
}

/* 9.1 WIZARD GRIDS (FOR MODALS) */
.wizard-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

@media (max-width: 600px) {
    .wizard-grid {
        grid-template-columns: 1fr;
        gap: 0;
    }
}

.wizard-section {
    margin-bottom: 32px;
}

.section-title {
    display: flex;
    align-items: baseline;
    gap: 12px;
    margin-bottom: 20px;
}

.step-num {
    font-size: 10px;
    font-weight: 800;
    color: var(--gestemas-primary);
    background: var(--gestemas-primary-light);
    padding: 3px 8px;
    border-radius: 6px;
}

/* 10. NOTIFICATIONS DROPDOWN (PREMIUM GLASS) */
.gestemas-notifications-trigger {
    position: relative;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: white;
    border: 1px solid var(--gestemas-gray-200);
    border-radius: 12px;
    cursor: pointer;
    transition: var(--gestemas-transition);
}

.gestemas-notifications-trigger:hover {
    border-color: var(--gestemas-primary-light);
    color: var(--gestemas-primary);
}

.gestemas-notif-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: var(--gestemas-error, #f43f5e);
    color: white !important;
    font-size: 10px;
    font-weight: 800;
    min-width: 18px;
    height: 18px;
    padding: 0 4px;
    border-radius: 99px;
    display: none;
    /* Hidden by default, shown by JS */
    align-items: center;
    justify-content: center;
    border: 2px solid white;
    box-shadow: 0 2px 4px rgba(244, 63, 94, 0.4);
    animation: gestemas-pulse 2s infinite;
    z-index: 10;
    pointer-events: none;
    line-height: 1;
}

@keyframes gestemas-pulse {
    0% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7);
    }

    70% {
        transform: scale(1.1);
        box-shadow: 0 0 0 6px rgba(239, 68, 68, 0);
    }

    100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0);
    }
}

.icon-btn-ghost.has-unread i {
    animation: gestemas-bell-ring 2s infinite ease-in-out;
    transform-origin: top center;
    color: var(--gestemas-primary) !important;
}

@keyframes gestemas-bell-ring {

    0%,
    100% {
        transform: rotate(0);
    }

    10%,
    30%,
    50%,
    70%,
    90% {
        transform: rotate(10deg);
    }

    20%,
    40%,
    60%,
    80% {
        transform: rotate(-10deg);
    }
}

.gestemas-notif-dropdown {
    position: absolute;
    top: calc(100% + 12px);
    right: 0;
    width: min(360px, 90vw);
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    border: 1px solid var(--gestemas-gray-200);
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    z-index: 1001;
    display: none;
    overflow: hidden;
    animation: slideDown 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.gestemas-notif-dropdown.active {
    display: block;
}

.gestemas-notif-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--gestemas-gray-100);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.gestemas-notif-header h4 {
    margin: 0;
    font-size: 14px;
    font-weight: 800;
}

.gestemas-notif-header span {
    font-size: 11px;
    color: var(--gestemas-primary);
    cursor: pointer;
    font-weight: 700;
}

.gestemas-notif-list {
    max-height: 400px;
    overflow-y: auto;
}

.gestemas-notif-item {
    padding: 16px 20px;
    display: flex;
    gap: 12px;
    cursor: pointer;
    transition: var(--gestemas-transition);
    border-bottom: 1px solid var(--gestemas-gray-50);
}

.gestemas-notif-item:hover {
    background: rgba(var(--gestemas-primary-rgb), 0.05);
}

.gestemas-notif-item.unread {
    background: rgba(var(--gestemas-primary-rgb), 0.02);
}

.gestemas-notif-icon {
    width: 40px;
    height: 40px;
    background: var(--gestemas-gray-100);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.gestemas-notif-body {
    flex: 1;
}

.gestemas-notif-title {
    font-size: 13px;
    font-weight: 800;
    color: var(--gestemas-gray-900);
    margin-bottom: 2px;
}

.gestemas-notif-msg {
    font-size: 12px;
    color: var(--gestemas-gray-600);
    line-height: 1.4;
}

.gestemas-notif-time {
    font-size: 10px;
    color: var(--gestemas-gray-400);
    margin-top: 4px;
}

.gestemas-notif-footer {
    padding: 12px;
    text-align: center;
    background: var(--gestemas-gray-50);
}

.gestemas-notif-footer a {
    font-size: 12px;
    font-weight: 700;
    color: var(--gestemas-gray-600);
    text-decoration: none;
}

/* 11. INTELLIGENT RESPONSIVE SYSTEM - Mobile-First Nivel 6 */

/* ========== MOBILE FIRST BREAKPOINTS ==========
   Mobile: 0 - 480px (default)
   Tablet: 481px - 768px
   Laptop: 769px - 1024px
   Desktop: 1025px+
   ============================================== */

/* Container adapts automatically */
@media (max-width: 1200px) {
    .gestemas-container {
        max-width: 100%;
        overflow-x: clip;
    }

    body {
        overflow-x: clip;
    }
}

/* Tablet optimizations */
/* Mobile optimizations - Nav móvil eliminado */
@media (max-width: 768px) {
    /* DEPRECATED: .gestemas-mobile-nav ha sido eliminado en v2.5 */
    /* Usar navegación en header superior en su lugar */

    /* Deprecated: Removed empty ruleset for gestemas-nav__link span */

    .mobile-nav-item.is-active {
        color: var(--gestemas-primary);
    }

    .nav-icon-wrapper {
        width: 40px;
        height: 40px;
        display: flex;
        align-items: center;
        justify-content: center;
        border-radius: 12px;
    }

    .mobile-nav-item.is-active .nav-icon-wrapper {
        background: rgba(var(--gestemas-primary-rgb), 0.1);
    }

    /* DEPRECATED: btn-action-plus relacionado al nav móvil eliminado en v2.5 */

    .nav-icon-plus {
        width: 60px;
        height: 60px;
        background: var(--gestemas-primary);
        background-image: linear-gradient(135deg, var(--gestemas-primary) 0%, #4f46e5 100%);
        color: white;
        border-radius: var(--gestemas-radius-full);
        display: flex;
        align-items: center;
        justify-content: center;
        box-shadow: 0 10px 25px -5px rgba(var(--gestemas-primary-rgb), 0.5);
        border: 4px solid var(--theme-surface);
        transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    }

    .nav-icon-plus:active {
        transform: scale(0.9) rotate(45deg);
    }

    .nav-icon-plus i {
        width: 32px;
        height: 32px;
    }

    /* 12. UNIVERSAL FAB SPEED DIAL (PRO SYSTEM) */
    .gestemas-fab-container {
        position: fixed;
        bottom: 32px;
        right: 32px;
        z-index: var(--z-fixed);
        display: flex;
        flex-direction: column;
        align-items: flex-end;
        gap: 16px;
    }

    .gestemas-fab-options {
        display: flex;
        flex-direction: column;
        align-items: flex-end;
        gap: 12px;
        opacity: 0;
        pointer-events: none;
        transform: translateY(20px);
        transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    }

    /* Logic: Stagger animations for options */
    .fab-option-wrapper {
        transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
        transform: translateY(10px) scale(0.8);
        opacity: 0;
    }

    #gestemas-global-fab.is-active .gestemas-fab-options {
        opacity: 1;
        pointer-events: auto;
        transform: translateY(0);
    }

    #gestemas-global-fab.is-active .fab-option-wrapper {
        transform: translateY(0) scale(1);
        opacity: 1;
    }

    #gestemas-global-fab.is-active .fab-option-wrapper:nth-child(1) {
        transition-delay: 0.05s;
    }

    #gestemas-global-fab.is-active .fab-option-wrapper:nth-child(2) {
        transition-delay: 0.1s;
    }

    #gestemas-global-fab.is-active .fab-option-wrapper:nth-child(3) {
        transition-delay: 0.15s;
    }

    #gestemas-global-fab.is-active .fab-option-wrapper:nth-child(4) {
        transition-delay: 0.2s;
    }

    #gestemas-global-fab.is-active .fab-option-wrapper:nth-child(5) {
        transition-delay: 0.25s;
    }

    .fab-option-wrapper {
        display: flex;
        align-items: center;
        gap: 12px;
    }

    .fab-label {
        background: var(--fab-label-bg, var(--theme-surface));
        padding: 6px 12px;
        border-radius: 8px;
        font-size: var(--fab-label-size, 12px);
        font-weight: 800;
        color: var(--fab-label-text, var(--text-main));
        box-shadow: var(--gestemas-shadow-sm);
        border: 1px solid var(--theme-border);
        white-space: nowrap;
        opacity: 0;
        transform: translateX(10px);
        transition: all 0.2s ease;
        display: var(--fab-labels-display, flex);
    }

    .fab-option-wrapper:hover .fab-label {
        opacity: 1;
        transform: translateX(0);
    }

    .fab-option {
        width: var(--fab-option-size, 48px);
        height: var(--fab-option-size, 48px);
        border-radius: var(--gestemas-radius-full);
        background: var(--theme-surface);
        border: 1px solid var(--theme-border);
        color: var(--fab-color, var(--gestemas-primary));
        display: flex;
        align-items: center;
        justify-content: center;
        box-shadow: var(--gestemas-shadow-md);
        cursor: pointer;
        transition: var(--gestemas-transition);
    }

    .fab-option:hover {
        background: var(--gestemas-primary);
        color: white;
        transform: scale(1.1);
    }

    .fab-option i {
        width: var(--fab-option-icon-size, 20px);
        height: var(--fab-option-icon-size, 20px);
    }

    #gestemas-main-fab {
        width: var(--fab-main-size, 64px);
        height: var(--fab-main-size, 64px);
        border-radius: var(--gestemas-radius-full);
        background: var(--fab-color, var(--gestemas-primary));
        background-image: linear-gradient(135deg, var(--fab-color, var(--gestemas-primary)) 0%, #4f46e5 100%);
        color: white;
        border: none;
        display: flex;
        align-items: center;
        justify-content: center;
        box-shadow: 0 12px 30px -10px rgba(var(--gestemas-primary-rgb), 0.5);
        cursor: pointer;
        transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
        z-index: 2;
    }

    #gestemas-main-fab i {
        width: var(--fab-main-icon-size, 28px);
        height: var(--fab-main-icon-size, 28px);
    }


    #gestemas-main-fab:hover {
        transform: scale(1.05) translateY(-2px);
        box-shadow: 0 15px 35px -10px rgba(var(--gestemas-primary-rgb), 0.6);
    }

    #gestemas-main-fab.is-active {
        transform: rotate(135deg);
        background: var(--gestemas-danger);
    }

    /* Mobile Adjustments for Speed Dial (FAB repositioned without bottom nav) */
    @media (max-width: 768px) {
        .gestemas-fab-container {
            bottom: 32px;
            right: 20px;
        }

        /* Hide speed dial if mobile nav already has a plus button */
        body:has(.btn-action-plus) .gestemas-fab-container {
            display: none;
        }
    }

    /* Universal Responsive Grid */
    .gestemas-grid-adaptive,
    .gestemas-grid {
        grid-template-columns: 1fr !important;
    }

    .gestemas-stats-grid {
        grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)) !important;
    }

    /* Table Fix for Mobile */
    .gestemas-table-wrapper,
    .premium-table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        margin: 0 -12px;
        padding: 0 12px;
        width: calc(100% + 24px);
    }

    .stat-card-premium {
        padding: var(--block-padding-mobile, 18px);
    }

    /* Modal adjustments for mobile */
    .gestemas-modal-wrapper {
        max-width: calc(100% - 32px);
        max-height: calc(100vh - 100px);
        margin: auto 16px;
        border-radius: var(--block-radius-mobile, 20px);
    }

    .gestemas-modal__header,
    .gestemas-modal__footer,
    .modal-header,
    .modal-footer {
        padding: var(--block-padding-mobile, 16px) 20px;
    }

    .gestemas-modal__body,
    .modal-body {
        padding: var(--block-padding-mobile, 20px);
    }
}

/* Small mobile optimizations */
@media (max-width: 480px) {

    /* Tighter spacing on small screens */
    .gestemas-card__header,
    .gestemas-card__body {
        padding: var(--block-padding-mobile, 16px);
    }

    .stat-card-premium {
        padding: var(--block-padding-mobile, 14px);
        flex-direction: column;
        text-align: center;
    }

    .stat-icon {
        width: 44px;
        height: 44px;
    }

    .stat-value {
        font-size: 24px;
    }
}

/* Touch Support Improvements */
@media (hover: none) {

    .gestemas-btn,
    .gestemas-nav__link,
    .stat-card-premium {
        cursor: default;
    }

    .gestemas-nav__link:active {
        background: var(--gestemas-gray-100);
    }

    /* Increase tap targets */
    .gestemas-btn {
        min-height: 44px;
    }
}

/* ========== VISIBILITY UTILITIES ========== */
.hide-mobile {
    display: block !important;
}

.show-mobile {
    display: none !important;
}

@media (max-width: 768px) {
    .hide-mobile {
        display: none !important;
    }

    .show-mobile {
        display: block !important;
    }

    .show-mobile-flex {
        display: flex !important;
    }

    /* Fixed Overflows for Toolbars */
    .gestemas-control-bar,
    .gestemas-toolbar-glass {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 16px !important;
        padding: 16px !important;
    }

    .control-filters,
    .gestemas-toolbar__filters {
        flex-wrap: wrap !important;
        width: 100% !important;
    }

    .control-filters select,
    .gestemas-toolbar__filters select,
    .premium-select,
    .gestemas-select-glass {
        flex: 1 !important;
        min-width: 140px !important;
    }

    .control-search,
    .gestemas-toolbar__search {
        width: 100% !important;
    }

    .dashboard-split-layout {
        grid-template-columns: 1fr !important;
    }
}

/* ========== ANIMATIONS ========== */
@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
    }

    to {
        transform: translateX(0);
    }
}

@keyframes slideInLeft {
    from {
        transform: translateX(-100%);
    }

    to {
        transform: translateX(0);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes spinner {
    to {
        transform: rotate(360deg);
    }
}

.gestemas-spinner {
    width: 20px;
    height: 20px;
    border: 3px solid rgba(var(--gestemas-primary-rgb), 0.2);
    border-top-color: var(--gestemas-primary);
    border-radius: 50%;
    animation: spinner 0.6s linear infinite;
}

/* ========== TOAST NOTIFICATIONS (STACKABLE) ========== */
/* PREMIUM TOAST SYSTEM - GLASSMORPHISM V3 */
.gestemas-toast-container {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 1000000;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 12px;
    pointer-events: none;
    width: auto;
    max-width: 420px;
}

.gestemas-toast {
        background: rgba(255, 255, 255, 0.75);
        backdrop-filter: blur(16px) saturate(180%);
        -webkit-backdrop-filter: blur(16px) saturate(180%);
        color: var(--gestemas-gray-900);
        padding: 16px 20px;
        border-radius: 20px;
        display: flex;
        align-items: center;
        gap: 14px;
        box-shadow: 0 12px 40px rgba(0, 0, 0, 0.08),
            0 4px 12px rgba(0, 0, 0, 0.03);
        pointer-events: auto;
        animation: toastInRight 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
        width: 360px;
        border: 1px solid rgba(255, 255, 255, 0.4);
        position: relative;
        overflow: hidden;
    }

    .gestemas-toast::before {
        content: '';
        position: absolute;
        top: 0;
        left: 0;
        width: 4px;
        height: 100%;
    }

    .gestemas-toast-inner {
        display: flex;
        align-items: center;
        gap: 14px;
        width: 100%;
    }

    .gestemas-toast i {
        width: 24px;
        height: 24px;
        flex-shrink: 0;
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 6px;
        border-radius: 10px;
    }

    .gestemas-toast__content {
        font-size: 14px;
        font-weight: 600;
        line-height: 1.4;
        color: var(--gestemas-gray-800);
        flex: 1;
    }

    .toast-close {
        background: transparent;
        border: none;
        color: var(--gestemas-gray-400);
        cursor: pointer;
        font-size: 18px;
        padding: 4px;
        transition: all 0.2s;
        border-radius: 8px;
    }

    .toast-close:hover {
        background: rgba(0, 0, 0, 0.05);
        color: var(--gestemas-gray-800);
    }

    .gestemas-toast--success i {
        background: rgba(16, 185, 129, 0.1);
        color: #059669;
    }

    .gestemas-toast--error i {
        background: rgba(239, 68, 68, 0.1);
        color: #dc2626;
    }

    .gestemas-toast--warning i {
        background: rgba(245, 158, 11, 0.1);
        color: #d97706;
    }

    .gestemas-toast--info i {
        background: rgba(59, 130, 246, 0.1);
        color: #2563eb;
    }

    .gestemas-toast--success::before {
        background: #10b981;
    }

    .gestemas-toast--error::before {
        background: #ef4444;
    }

    .gestemas-toast--warning::before {
        background: #f59e0b;
    }

    .gestemas-toast--info::before {
        background: #3b82f6;
    }

    .gestemas-toast--out {
        animation: toastOutRight 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    }

    /* SEARCH RESULTS - MASTER GLASS */
    .gestemas-search-results {
        position: absolute;
        top: calc(100% + 12px);
        left: 0;
        width: 100%;
        background: var(--glass-bg);
        backdrop-filter: blur(var(--glass-blur)) saturate(180%);
        -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(180%);
        border: 1px solid var(--glass-border);
        border-radius: var(--gestemas-radius-lg);
        box-shadow: var(--gestemas-shadow-lg);
        z-index: var(--z-modal);
        /* Boosted z-index for search */
        max-height: 480px;
        overflow-y: auto;
        display: none;
        animation: slideDown 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    }

    .search-item {
        display: flex;
        align-items: center;
        padding: 14px 20px;
        gap: 16px;
        cursor: pointer;
        transition: var(--gestemas-transition);
        border-bottom: 1px solid rgba(0, 0, 0, 0.03);
    }

    .search-item:last-child {
        border-bottom: none;
    }

    .search-item:hover {
        background: rgba(var(--gestemas-primary-rgb), 0.05);
    }

    .search-item-icon {
        width: 40px;
        height: 40px;
        border-radius: 12px;
        display: flex;
        align-items: center;
        justify-content: center;
        background: white;
        box-shadow: var(--gestemas-shadow-sm);
        color: var(--gestemas-primary);
    }

    .search-item-info {
        flex: 1;
        display: flex;
        flex-direction: column;
    }

    .search-item-title {
        font-size: 14px;
        font-weight: 700;
        color: var(--gestemas-gray-900);
    }

    .search-item-subtitle {
        font-size: 11px;
        font-weight: 600;
        color: var(--gestemas-gray-500);
        text-transform: uppercase;
        letter-spacing: 0.5px;
    }

    /* Mobile Search Results Overlay */
    @media (max-width: 1024px) {
        .header-search.is-active .gestemas-search-results {
            position: relative;
            top: 20px;
            left: 0;
            right: 0;
            bottom: 0;
            width: 100%;
            max-height: calc(100vh - 120px);
            overflow-y: auto;
            border-radius: 0;
            border: none;
            display: block !important;
            padding: 0;
            z-index: 100;
            box-shadow: none;
            background: transparent;
        }
    }

    @keyframes toastInRight {
        from {
            transform: translateX(100%);
            opacity: 0;
        }

        to {
            transform: translateX(0);
            opacity: 1;
        }
    }

    @keyframes toastOutRight {
        to {
            transform: translateX(100%);
            opacity: 0;
        }
    }

    @media (max-width: 768px) {
        .gestemas-toast-container {
            bottom: var(--element-margin, 16px);
        }
    }





    @media (min-width: 1025px) {
        .gestemas-toast {
            bottom: 30px;
        }
    }

    /* 11. PREMIUM FORM PATTERNS (Cleanup & Unification) */
    /* Floating Group logic is already defined above in 8.1 */

    /* Specialized Selectors (Priority, Tags) */
    .priority-selector {
        display: flex;
        gap: var(--grid-gap-mobile, 12px);
        margin-top: 8px;
    }

    .priority-option {
        flex: 1;
        cursor: pointer;
        position: relative;
        user-select: none;
    }

    .priority-option input {
        position: absolute;
        opacity: 0;
        width: 0;
        height: 0;
    }

    .priority-option span {
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 12px;
        border-radius: var(--gestemas-radius-md);
        font-size: var(--type-small, 0.875rem);
        font-weight: 800;
        border: 1.5px solid var(--theme-border);
        background: var(--theme-surface);
        transition: var(--gestemas-transition);
        text-transform: uppercase;
        letter-spacing: 0.05em;
    }

    .priority-option:hover span {
        border-color: var(--gestemas-primary-light);
        transform: translateY(-2px);
    }

    .priority-option.option-low input:checked+span {
        background: rgba(34, 197, 94, 0.1);
        color: #166534;
        border-color: #22c55e;
        box-shadow: 0 4px 12px rgba(34, 197, 94, 0.2);
    }

    .priority-option.option-med input:checked+span {
        background: rgba(245, 158, 11, 0.1);
        color: #92400e;
        border-color: #f59e0b;
        box-shadow: 0 4px 12px rgba(245, 158, 11, 0.2);
    }

    .priority-option.option-high input:checked+span {
        background: rgba(239, 68, 68, 0.1);
        color: #991b1b;
        border-color: #ef4444;
        box-shadow: 0 4px 12px rgba(239, 68, 68, 0.2);
    }

    /* Responsive Priority Selector */
    @media (max-width: 480px) {
        .priority-selector {
            flex-direction: column;
            gap: 8px;
        }
    }

    /* Diagnostic Tags */
    .gestemas-tag-selector {
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
    }

    .gestemas-tag-btn {
        padding: 6px 14px;
        border-radius: 99px;
        font-size: 12px;
        font-weight: 600;
        border: 1px solid var(--gestemas-gray-200);
        background: white;
        cursor: pointer;
        transition: 0.2s;
    }

    .gestemas-tag-btn.is-active {
        background: var(--gestemas-primary);
        border-color: var(--gestemas-primary);
        color: white;
    }

    /* Universal Glass Components */
    .gestemas-glass-heavy {
        background: rgba(255, 255, 255, 0.85);
        backdrop-filter: blur(24px) saturate(180%);
        -webkit-backdrop-filter: blur(24px) saturate(180%);
        border: 1px solid rgba(255, 255, 255, 0.5);
        box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.15);
    }

    .gestemas-glass-panel {
        background: rgba(255, 255, 255, 0.5);
        border: 1px solid rgba(255, 255, 255, 0.3);
        border-radius: 16px;
        padding: 16px;
    }

    .gestemas-input-glass {
        background: rgba(255, 255, 255, 0.6) !important;
        border: 1px solid rgba(0, 0, 0, 0.08) !important;
    }

    .gestemas-input-glass:focus {
        background: white !important;
        border-color: var(--gestemas-primary) !important;
    }

    /* Premium Glass Inputs */
    .gestemas-input-glass {
        background: rgba(255, 255, 255, 0.6);
        backdrop-filter: blur(12px);
        -webkit-backdrop-filter: blur(12px);
        border: 1px solid rgba(255, 255, 255, 0.5);
        box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.02), inset 0 2px 4px rgba(255, 255, 255, 0.8);
        border-radius: 12px;
        padding: 12px 16px;
        font-size: 14px;
        width: 100%;
        transition: all 0.3s ease;
        color: var(--gestemas-gray-900);
    }

    .gestemas-input-glass:focus {
        background: white;
        border-color: var(--gestemas-primary);
        box-shadow: 0 0 0 4px rgba(14, 165, 233, 0.15), 0 10px 15px -3px rgba(0, 0, 0, 0.05);
        outline: none;
        transform: translateY(-1px);
    }

    .gestemas-label-mini {
        font-size: 11px;
        text-transform: uppercase;
        letter-spacing: 0.5px;
        font-weight: 700;
        color: var(--gestemas-gray-500);
        margin-bottom: 6px;
        display: block;
    }

    /* ═══════════════════════════════════════════════════════════
   ADMIN PREMIUM DESIGN TOKENS (Opus 4.5 Standard)
   ═══════════════════════════════════════════════════════════ */
    :root {
        --nexus-blue: #0ea5e9;
        --nexus-blue-soft: rgba(14, 165, 233, 0.1);
        --nexus-glass: rgba(255, 255, 255, 0.7);
        --nexus-blur: 12px;
    }

    /* Premium Settings Container */
    .g-settings-container {
        display: flex;
        flex-direction: column;
        gap: 40px;
    }

    /* Smart Section Grouping */
    .g-settings-section {
        border-top: 1px solid var(--nexus-border);
        padding-top: 30px;
    }

    .g-settings-section-header {
        margin-bottom: 24px;
    }

    .g-settings-section-header h3 {
        font-size: 16px !important;
        font-weight: 800 !important;
        color: var(--nexus-text-main);
        margin: 0 0 8px 0 !important;
        text-transform: uppercase;
        letter-spacing: 0.5px;
    }

    .g-settings-section-header p {
        font-size: 13px;
        color: var(--nexus-text-muted);
        margin: 0;
    }

    /* Silicon Valley Interactive Cards */
    .g-selection-grid {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
        gap: 20px;
    }

    .g-selection-card {
        background: white;
        border: 2px solid var(--nexus-border);
        border-radius: 16px;
        padding: 24px;
        text-align: center;
        cursor: pointer;
        transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
        position: relative;
        overflow: hidden;
    }

    .g-selection-card:hover {
        border-color: var(--nexus-primary);
        transform: translateY(-4px);
        box-shadow: 0 10px 20px rgba(0, 0, 0, 0.05);
    }

    .g-selection-card.is-active {
        border-color: var(--nexus-primary);
        background: var(--nexus-blue-soft);
    }

    .g-selection-card .card-icon {
        font-size: 32px;
        margin-bottom: 12px;
        display: block;
    }

    .g-selection-card .card-label {
        font-weight: 700;
        font-size: 14px;
        color: var(--nexus-text-main);
    }

    .g-selection-card input[type="radio"] {
        position: absolute;
        opacity: 0;
    }

    /* Checkbox Modern List */
    .g-checkbox-group {
        display: grid;
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
        gap: 12px;
    }

    .g-checkbox-button {
        display: flex;
        align-items: center;
        gap: 12px;
        padding: 12px 16px;
        background: white;
        border: 1px solid var(--nexus-border);
        border-radius: 10px;
        cursor: pointer;
        transition: all 0.2s;
    }

    .g-checkbox-button:hover {
        background: #f8fafc;
        border-color: var(--nexus-text-muted);
    }

    .g-checkbox-button input[type="checkbox"] {
        width: 18px;
        height: 18px;
        border-radius: 4px;
        border: 2px solid var(--nexus-border);
        accent-color: var(--nexus-primary);
    }

    .g-checkbox-button span {
        font-size: 14px;
        font-weight: 600;
        color: var(--nexus-text-main);
    }

    /* Professional Save Hook */
    .g-admin-sticky-footer {
        position: sticky;
        bottom: -40px;
        background: rgba(255, 255, 255, 0.9);
        backdrop-filter: blur(8px);
        border-top: 1px solid var(--nexus-border);
        margin: 40px -30px -40px -30px;
        padding: 20px 30px;
        display: flex;
        justify-content: flex-end;
        z-index: 10;
    }

    /* ═══════════════════════════════════════════════════════════
   CRITICAL MOBILE FIXES (Z-INDEX & OVERLAYS)
   ═══════════════════════════════════════════════════════════ */
    @media screen and (max-width: 960px) {

        /* Ensure WP Admin Menu & Sidebar are ALWAYS on top */
        #adminmenuback,
        #adminmenuwrap,
        #adminmenu {
            z-index: var(--z-toast) !important;
            /* Superior to everything */
        }

        .auto-fold #adminmenu {
            z-index: var(--z-toast) !important;
        }

        /* Fix Header Layering */
        .gestemas-nexus-header,
        .gestemas-profile-header-premium,
        .gestemas-header {
            z-index: 9000 !important;
            /* Below sidebar, above content */
        }

        /* Fix "Boron" / Primary Button Overlap */
        .gestemas-btn-premium-hub,
        .profile-primary-btn {
            z-index: 9001;
            /* Slightly above header background */
            position: relative;
        }
    }

    /* ═══════════════════════════════════════════════════════════
   12. PREMIUM MICRO-INTERACTIONS
   ═══════════════════════════════════════════════════════════ */

    /* Ripple Effect */
    .gestemas-ripple {
        position: relative;
        overflow: hidden;
    }

    .g-ripple-effect {
        position: absolute;
        border-radius: 50%;
        background: rgba(255, 255, 255, 0.4);
        transform: scale(0);
        animation: ripple-animation 0.6s linear;
        pointer-events: none;
    }

    @keyframes ripple-animation {
        to {
            transform: scale(4);
            opacity: 0;
        }
    }

    /* 3D Tilt Utility */
    .gestemas-tilt {
        transition: transform 0.15s cubic-bezier(0.23, 1, 0.32, 1);
        transform-style: preserve-3d;
        will-change: transform;
    }

    /* Magnetic Utility */
    .gestemas-magnetic {
        transition: transform 0.3s cubic-bezier(0.23, 1, 0.32, 1);
        will-change: transform;
    }

    /* Visual Haptics */
    @keyframes haptic-pop {
        0% {
            transform: scale(1);
        }

        50% {
            transform: scale(1.08);
        }

        100% {
            transform: scale(1);
        }
    }

    @keyframes haptic-shake {

        0%,
        100% {
            transform: translateX(0);
        }

        25% {
            transform: translateX(-4px);
        }

        75% {
            transform: translateX(4px);
        }
    }

    .g-haptic-pop {
        animation: haptic-pop 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    }

    .g-haptic-shake {
        animation: haptic-shake 0.4s cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
    }

    /* Fluid Transitions */
    .g-transition-fluid {
        transition: all 0.5s cubic-bezier(0.85, 0, 0.15, 1);
    }

    /* ═══════════════════════════════════════════════════════════
   13. NEXUS V5.2 STANDARDIZED COMPONENTS
   ═══════════════════════════════════════════════════════════ */

    /* -- Nexus List Blocks (Silicon Valley Lists) -- */
    .nexus-list-block {
        display: flex;
        align-items: center;
        gap: 24px;
        background: var(--glass-bg);
        backdrop-filter: blur(var(--glass-blur));
        border: 1px solid var(--glass-border);
        padding: 16px 24px;
        border-radius: var(--gestemas-radius-lg);
        margin-bottom: 12px;
        transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
        cursor: pointer;
        position: relative;
        box-shadow: var(--glass-shadow);
    }

    .nexus-list-block:hover {
        transform: translateX(8px);
        box-shadow: var(--gestemas-shadow-lg);
        border-color: var(--gestemas-primary);
        background: rgba(255, 255, 255, 0.9);
    }

    .nexus-list-block.is-completed {
        opacity: 0.6;
        background: var(--gestemas-gray-50);
    }

    .nexus-block-left {
        display: flex;
        align-items: center;
        gap: 16px;
        min-width: 80px;
    }

    .nexus-block-main {
        flex: 1;
        display: flex;
        flex-direction: column;
        gap: 4px;
        overflow: hidden;
    }

    .nexus-block-actions {
        display: flex;
        align-items: center;
        gap: 8px;
        opacity: 0;
        transition: 0.2s;
    }

    .nexus-list-block:hover .nexus-block-actions {
        opacity: 1;
    }

    /* -- Nexus Status Pills -- */
    .nexus-status-pill {
        display: inline-flex;
        align-items: center;
        gap: 6px;
        padding: 6px 12px;
        border-radius: 99px;
        font-size: 11px;
        font-weight: 800;
        letter-spacing: 0.02em;
        text-transform: uppercase;
        transition: all 0.2s;
        border: 1px solid transparent;
    }

    .nexus-status-pill .dot {
        width: 6px;
        height: 6px;
        border-radius: 50%;
        background: currentColor;
    }

    /* -- Premium Cards -- */
    .premium-card {
        background: var(--glass-bg);
        backdrop-filter: blur(var(--glass-blur));
        border: 1px solid var(--glass-border);
        border-radius: var(--radius-mega, 32px);
        padding: 24px;
        transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
        position: relative;
        overflow: hidden;
        box-shadow: var(--glass-shadow);
    }

    .premium-card:hover {
        transform: translateY(-8px);
        box-shadow: var(--gestemas-shadow-xl);
        border-color: var(--gestemas-primary);
    }

    /* -- Glass Card V3 (Universal Standard) -- */
    .glass-card-v3 {
        background: var(--glass-bg);
        backdrop-filter: blur(24px) saturate(180%);
        border: 1px solid var(--glass-border);
        border-radius: 28px;
        padding: 24px;
        box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.07);
        transition: all 0.4s ease;
    }

    .nexus-badge-soft {
        background: var(--gestemas-gray-100);
        color: var(--gestemas-gray-600);
        font-size: 11px;
        font-weight: 700;
        padding: 4px 10px;
        border-radius: 8px;
        text-transform: uppercase;
        display: inline-block;
    }

    .dimension-tag {
        display: inline-block;
        padding: 4px 12px;
        border-radius: 99px;
        font-size: 12px;
        font-weight: 700;
        background: var(--gestemas-primary-light);
        color: var(--gestemas-primary);
    }

    /* -- Responsive Nexus Adjustments -- */
    @media (max-width: 768px) {
        .nexus-list-block {
            flex-direction: column;
            align-items: flex-start;
            padding: 16px;
            gap: 12px;
        }

        .nexus-block-actions {
            opacity: 1;
            width: 100%;
            justify-content: flex-end;
        }

        .premium-card {
            border-radius: 24px;
            padding: 20px;
        }
    }

    .nexus-summary-shell {
        display: flex;
        align-items: center;
        gap: 16px;
    }

    .nexus-summary-metrics {
        display: flex;
        align-items: center;
        flex-wrap: wrap;
        gap: 8px;
    }

    @media (max-width: 900px) {
        .nexus-summary-shell {
            flex-wrap: wrap;
            align-items: flex-start;
        }

        .nexus-summary-shell .summary-left,
        .nexus-summary-shell .summary-excerpt {
            width: 100%;
            min-width: 0 !important;
            max-width: 100%;
        }
    }


    #gestemas-content.is-hydrating {
        filter: blur(4px);
        opacity: 0.7;
        transition: filter 0.3s ease, opacity 0.3s ease;
    }

    .gestemas-skeleton {
        will-change: background-position;
        transform: translateZ(0);
    }
}

/* ==========================================================================
   NEXUS V5.3 - UNIVERSAL EXPANDED MODALS (PONE STANDARD)
   Garantiza que Intervenciones, Tareas y Salud se vean expandidos en móvil.
   Uso de Selectores de Alta Especificidad para evitar colisiones.
   ========================================================================== */

/* 1. Reset de Facto para el Contenedor en Móvil */
@media (max-width: 768px) {
    #gestemas-modal-container {
        align-items: flex-end !important;
    }

    /* NEXUS PRO STANDARD - 98% FLOATING BOTTOM SHEET FOR PREMIUM MODULES */
    #gestemas-modal-container.nexus-pro-expanded-wrapper {
        padding-bottom: 2dvh !important; /* Espacio para que flote desde el borde inferior */
    }

    #gestemas-modal-backdrop.pone-modal-premium #gestemas-modal-container.nexus-pro-expanded-wrapper .gestemas-modal-premium {
        width: 98vw !important;
        max-width: 98% !important;
        margin: 0 auto !important; /* Centrado horizontal flotante */
        border-radius: 24px !important; /* Redondeado completo para tarjeta flotante */
        height: auto !important;
        max-height: 94dvh !important;
        transform: scale(1) !important;
        box-shadow: 0 15px 40px rgba(0, 0, 0, 0.35), inset 0 1px 1px rgba(255, 255, 255, 0.1) !important;
    }
    
    /* Fallback full screen default para otros modales */
    #gestemas-modal-backdrop.pone-modal-premium #gestemas-modal-container:not(.nexus-pro-expanded-wrapper) .gestemas-modal-premium {
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 !important;
        border-bottom-left-radius: 0 !important;
        border-bottom-right-radius: 0 !important;
        max-height: 95dvh !important;
    }

    /* Ajuste de Espaciado para Legibilidad Premium en Móvil */
    #gestemas-modal-container .gestemas-modal-header-premium {
        padding: 14px 16px !important;
    }

    #gestemas-modal-container .gestemas-modal-body-premium {
        padding: 14px 14px 12px !important;
        min-height: 0 !important;
    }

    #gestemas-modal-container .gestemas-modal-footer-premium {
        padding: 10px 14px !important;
        flex-direction: column-reverse !important;
        gap: 8px !important;
    }

    /* Botones a Ancho Completo en Móvil para Ergonomía */
    #gestemas-modal-container .gestemas-modal-footer-premium .gestemas-btn,
    #gestemas-modal-container .gestemas-modal-footer-premium .g-btn-premium {
        width: 100% !important;
        min-width: 100% !important;
        margin: 0 !important;
        height: 54px !important; /* Altura táctil optimizada */
    }

    /* Limpieza de la 'Cruz' de cierre en móvil para que no flote mal */
    #gestemas-modal-container .gestemas-modal-footer-premium .gestemas-btn,
    #gestemas-modal-container .gestemas-modal-footer-premium .g-btn-premium {
        height: 48px !important;
    }

    #gestemas-modal-container .gestemas-modal-footer-premium .gestemas-btn--ghost {
        width: auto !important;
        min-width: 0 !important;
        height: 40px !important;
        align-self: flex-end;
        padding-inline: 12px !important;
    }

    #gestemas-modal-container .gradient-icon {
        width: 36px !important;
        height: 36px !important;
        border-radius: 12px !important;
    }

    #gestemas-modal-container .modal-header-title {
        gap: 10px !important;
    }

    #gestemas-modal-container .strategic-link-header {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
        margin-bottom: 14px;
    }

    #gestemas-modal-container .strategic-link-header > .gestemas-btn {
        width: 100%;
        justify-content: center;
    }

    #gestemas-modal-container .health-link-grid,
    #gestemas-modal-container .health-medication-grid {
        display: grid !important;
        grid-template-columns: 1fr !important;
        gap: 10px !important;
    }

    #gestemas-modal-container .medication-row-health .g-floating-group {
        margin-bottom: 10px;
    }

    #gestemas-modal-container .modal-close-premium-hero {
        top: 15px !important;
        right: 15px !important;
        width: 40px !important;
        height: 40px !important;
    }
}

/* 2. Soporte para Desktop (Consistencia con PONE 850px) */
@media (min-width: 769px) {
    #gestemas-modal-container .gestemas-modal-premium {
        max-width: 850px !important; /* Estándar PONE */
        width: 95% !important;
        border-radius: 32px !important;
    }
}

/* ═══════════════════════════════════════════════════════════
   REQUIRED FIELD INDICATORS & GUIDED VALIDATION
   ═══════════════════════════════════════════════════════════ */

/* Required Star — Visual asterisk for mandatory fields */
.required-star {
    color: #ef4444;
    font-weight: 700;
    font-size: 1.1em;
    margin-left: 2px;
    vertical-align: top;
    line-height: 1;
}

/* Field Required Error — Red border + shake animation for empty mandatory fields */
.field-required-error,
.field-required-error:focus {
    border-color: #ef4444 !important;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.15) !important;
    animation: gestemas-shake 0.4s cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
}

.field-required-error::placeholder {
    color: rgba(239, 68, 68, 0.5);
}

@keyframes gestemas-shake {
    10%, 90% { transform: translateX(-1px); }
    20%, 80% { transform: translateX(2px); }
    30%, 50%, 70% { transform: translateX(-3px); }
    40%, 60% { transform: translateX(3px); }
}

/* Form Alert Container — Error summary box within modals */
.form-alert-container {
    display: none;
    background: linear-gradient(135deg, #fef2f2, #fff1f2);
    border: 1px solid rgba(239, 68, 68, 0.25);
    border-radius: 16px;
    padding: 16px 20px;
    margin-bottom: 20px;
    font-size: 13.5px;
    color: #7f1d1d;
    line-height: 1.6;
    animation: gestemas-shake 0.35s ease-out;
}

.form-alert-container ul {
    margin: 6px 0 0 0;
    padding-left: 18px;
}

.form-alert-container li {
    margin-bottom: 4px;
    color: #991b1b;
}

/* Modal Standard Expanded — Wider modal for high-legibility registration forms */
.modal-standard-expanded .gestemas-modal-premium {
    max-width: 950px !important;
}

@media (min-width: 1200px) {
    .modal-standard-expanded .gestemas-modal-premium {
        max-width: 1050px !important;
    }
}

@media (max-width: 768px) {
    .modal-standard-expanded .gestemas-modal-premium {
        max-width: 98% !important;
    }
}

