{"id":308,"date":"2026-02-05T17:54:32","date_gmt":"2026-02-05T17:54:32","guid":{"rendered":"https:\/\/saca-plan.com\/inicio\/?page_id=308"},"modified":"2026-11-29T21:13:44","modified_gmt":"2026-11-29T21:13:44","slug":"portal-eventos","status":"publish","type":"page","link":"https:\/\/saca-plan.com\/inicio\/portal-eventos\/","title":{"rendered":"Portal Eventos"},"content":{"rendered":"\n<!DOCTYPE html>\n<html lang=\"es\">\n\n<head>\n    <meta charset=\"UTF-8\" \/>\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" \/>\n    <title>Mis Eventos &#8211; Saca Plan<\/title>\n    <link rel=\"preconnect\" href=\"https:\/\/fonts.googleapis.com\">\n    <link rel=\"preconnect\" href=\"https:\/\/fonts.gstatic.com\" crossorigin>\n    <link href=\"https:\/\/fonts.googleapis.com\/css2?family=Inter:wght@400;500;600;700;800&#038;display=swap\" rel=\"stylesheet\">\n    <script src=\"https:\/\/cdn.tailwindcss.com\"><\/script>\n    <script>\n        \/\/ Remap blue palette \u2192 app brand teal #58C1A4 (planapp primary).\n        \/\/ Mantiene todas las utilidades bg-blue-*, text-blue-*, border-blue-*, ring-blue-* funcionando\n        \/\/ pero con color brand, para que la p\u00e1gina se vea como el app sin reescribir HTML.\n        tailwind.config = {\n            theme: {\n                extend: {\n                    fontFamily: {\n                        sans: ['Inter', 'system-ui', '-apple-system', 'Segoe UI', 'Roboto', 'sans-serif']\n                    },\n                    colors: {\n                        brand: {\n                            50: '#ecfaf5',\n                            100: '#d1f3e6',\n                            200: '#a8e8d0',\n                            300: '#7ad8b5',\n                            400: '#58c1a4',\n                            500: '#58C1A4',\n                            600: '#4aa78d',\n                            700: '#3d8d77',\n                            800: '#306e5e',\n                            900: '#255848'\n                        },\n                        blue: {\n                            50: '#ecfaf5',\n                            100: '#d1f3e6',\n                            200: '#a8e8d0',\n                            300: '#7ad8b5',\n                            400: '#58c1a4',\n                            500: '#58C1A4',\n                            600: '#4aa78d',\n                            700: '#3d8d77',\n                            800: '#306e5e',\n                            900: '#255848'\n                        }\n                    },\n                    borderRadius: {\n                        xl: '14px',\n                        '2xl': '18px'\n                    }\n                }\n            }\n        };\n    <\/script>\n    <script src=\"https:\/\/cdn.jsdelivr.net\/npm\/@supabase\/supabase-js@2\"><\/script>\n    <style>\n        :root {\n            --app-primary: #58C1A4;\n            --app-primary-dark: #4aa78d;\n            --app-primary-soft: #ecfaf5;\n            --app-bg: #f8f9fa;\n            --app-surface: #ffffff;\n            --app-text: #0f172a;\n            --app-text-mute: #475569;\n            --app-text-soft: #94a3b8;\n            --app-border: #e5e7eb;\n            --app-border-soft: #eef0f3;\n            --app-shadow-sm: 0 1px 2px rgba(16, 24, 40, .05);\n            --app-shadow: 0 2px 6px -1px rgba(16, 24, 40, .06), 0 1px 3px -1px rgba(16, 24, 40, .04);\n            --app-shadow-md: 0 10px 24px -8px rgba(16, 24, 40, .12), 0 4px 8px -2px rgba(16, 24, 40, .04);\n            --app-ease: cubic-bezier(.2, .8, .2, 1);\n            --app-dur: 200ms;\n            --sat: env(safe-area-inset-top);\n            --sab: env(safe-area-inset-bottom);\n        }\n\n        body {\n            font-family: 'Inter', system-ui, -apple-system, Segoe UI, Roboto, sans-serif;\n            -webkit-font-smoothing: antialiased;\n            text-rendering: optimizeLegibility;\n            color: var(--app-text);\n            background: var(--app-bg);\n            padding-top: var(--sat);\n            padding-bottom: var(--sab);\n        }\n\n        h1,\n        h2,\n        h3,\n        h4 {\n            letter-spacing: -0.015em;\n        }\n\n        h1 {\n            letter-spacing: -0.025em;\n        }\n\n        .form-label {\n            @apply block text-sm font-semibold text-gray-800 mb-2 mt-4;\n            font-family: 'Inter', sans-serif;\n            letter-spacing: 0.01em;\n        }\n\n        .form-input {\n            @apply w-full p-3 border border-gray-300 rounded-xl bg-white focus:outline-none shadow-sm;\n            transition: border-color var(--app-dur) var(--app-ease),\n                box-shadow var(--app-dur) var(--app-ease),\n                background var(--app-dur) var(--app-ease);\n        }\n\n        .form-input:hover {\n            border-color: #cbd5e1;\n        }\n\n        .form-input:focus {\n            border-color: var(--app-primary);\n            box-shadow: 0 0 0 4px rgba(88, 193, 164, .22);\n        }\n\n        .form-input:read-only {\n            @apply bg-gray-100 border-gray-200 cursor-not-allowed;\n        }\n\n        input[type=\"file\"].form-input {\n            @apply border-2 border-dashed p-4 cursor-pointer;\n            border-color: #a8e8d0;\n            background: var(--app-primary-soft);\n        }\n\n        input[type=\"file\"].form-input:hover {\n            border-color: var(--app-primary);\n            background: #d1f3e6;\n        }\n\n        textarea.form-input {\n            resize: vertical;\n            min-height: 100px;\n            width: 100%;\n        }\n\n        .btn-primary {\n            @apply text-white font-semibold py-3 px-6 rounded-full disabled:opacity-50 disabled:cursor-not-allowed;\n            background: var(--app-primary);\n            box-shadow: 0 4px 14px rgba(88, 193, 164, .3);\n            transition: background var(--app-dur) var(--app-ease),\n                transform var(--app-dur) var(--app-ease),\n                box-shadow var(--app-dur) var(--app-ease);\n        }\n\n        .btn-primary:hover:not(:disabled) {\n            background: var(--app-primary-dark);\n            transform: translateY(-1px);\n            box-shadow: 0 6px 20px rgba(88, 193, 164, .4);\n        }\n\n        .btn-primary:active:not(:disabled) {\n            transform: translateY(0);\n        }\n\n        .btn-secondary {\n            @apply bg-white text-gray-700 font-semibold py-3 px-6 rounded-full border border-gray-300;\n            transition: background var(--app-dur) var(--app-ease), border-color var(--app-dur) var(--app-ease);\n        }\n\n        .btn-secondary:hover {\n            background: #f8fafc;\n            border-color: #94a3b8;\n        }\n\n        .btn-danger {\n            @apply bg-red-600 text-white font-semibold py-2 px-4 rounded-full;\n            box-shadow: 0 4px 14px rgba(220, 38, 38, .25);\n            transition: background var(--app-dur) var(--app-ease), transform var(--app-dur) var(--app-ease);\n        }\n\n        .btn-danger:hover {\n            background: #b91c1c;\n            transform: translateY(-1px);\n        }\n\n        .badge {\n            @apply inline-block px-3 py-1 text-xs font-semibold rounded-full;\n        }\n\n        .badge-borrador {\n            @apply bg-gray-100 text-gray-700 border border-gray-200;\n        }\n\n        .badge-enviado {\n            background: var(--app-primary-soft);\n            color: #306e5e;\n            border: 1px solid #a8e8d0;\n        }\n\n        .badge-en_revision {\n            @apply bg-amber-50 text-amber-800 border border-amber-200;\n        }\n\n        .badge-aprobado {\n            @apply bg-emerald-50 text-emerald-800 border border-emerald-200;\n        }\n\n        .badge-rechazado {\n            @apply bg-red-50 text-red-700 border border-red-200;\n        }\n\n        .badge-publicado {\n            @apply bg-violet-50 text-violet-800 border border-violet-200;\n        }\n\n        \/* Focus visible global (WCAG 2.2) *\/\n        :where(button, a, [role=\"button\"], [tabindex]):focus-visible {\n            outline: 2px solid var(--app-primary);\n            outline-offset: 2px;\n            border-radius: 8px;\n        }\n\n        \/* App-shell: phone frame feel on wide screens *\/\n        @media (min-width: 768px) {\n            .portal-eventos-wrapper {\n                max-width: 1100px !important;\n                margin-left: auto !important;\n                margin-right: auto !important;\n            }\n        }\n\n        \/* App-like cards *\/\n        .app-card {\n            background: var(--app-surface);\n            border-radius: 18px;\n            box-shadow: var(--app-shadow);\n            border: 1px solid var(--app-border-soft);\n        }\n\n        \/* Hero brand mark (login) *\/\n        .app-brand-mark {\n            display: flex;\n            align-items: center;\n            justify-content: center;\n            width: 64px;\n            height: 64px;\n            margin: 0 auto 16px;\n            border-radius: 20px;\n            background: linear-gradient(135deg, var(--app-primary) 0%, var(--app-primary-dark) 100%);\n            box-shadow: 0 10px 24px -8px rgba(88, 193, 164, .5);\n            color: #fff;\n            font-weight: 800;\n            font-size: 28px;\n            letter-spacing: -0.03em;\n        }\n\n        .app-brand-mark svg {\n            width: 36px;\n            height: 36px;\n        }\n\n        \/* Reduced motion *\/\n        @media (prefers-reduced-motion: reduce) {\n\n            *,\n            *::before,\n            *::after {\n                animation-duration: .01ms !important;\n                transition-duration: .01ms !important;\n            }\n\n            .btn-primary:hover,\n            .btn-danger:hover {\n                transform: none !important;\n            }\n        }\n\n        \/* Mobile: cards edge-to-edge, menos padding lateral, sin bordes visibles *\/\n        @media (max-width: 639px) {\n            .portal-eventos-wrapper {\n                background: var(--app-bg);\n            }\n\n            #app-screen>div.container {\n                padding-left: 10px !important;\n                padding-right: 10px !important;\n            }\n\n            .app-card {\n                border-radius: 16px;\n                box-shadow: var(--app-shadow-sm);\n            }\n\n            \/* Section forms: reducir padding ruidoso *\/\n            .form-section {\n                padding: 14px !important;\n            }\n\n            .form-section>h3 {\n                font-size: 15px !important;\n            }\n\n            \/* Nav tabs full-width container *\/\n            .inline-flex.p-1.bg-gray-100.rounded-full {\n                width: 100% !important;\n                display: flex;\n            }\n\n            \/* Botones ocupan todo ancho *\/\n            .btn-primary,\n            .btn-secondary {\n                width: 100%;\n            }\n        }\n\n        \/* Scrollbar polish *\/\n        ::-webkit-scrollbar {\n            width: 10px;\n            height: 10px;\n        }\n\n        ::-webkit-scrollbar-track {\n            background: transparent;\n        }\n\n        ::-webkit-scrollbar-thumb {\n            background: #cbd5e1;\n            border-radius: 10px;\n            border: 2px solid var(--app-bg);\n        }\n\n        ::-webkit-scrollbar-thumb:hover {\n            background: #94a3b8;\n        }\n\n        .hidden {\n            display: none !important;\n        }\n\n        \/* Mejor visualizaci\u00f3n de placeholders *\/\n        input::placeholder,\n        textarea::placeholder {\n            color: #9CA3AF;\n            opacity: 0.7;\n        }\n\n        \/* Mejorar inputs de fecha y hora *\/\n        input[type=\"date\"],\n        input[type=\"time\"] {\n            color-scheme: light;\n        }\n\n        \/* ===== Secciones del formulario \u2014 Pro redesign ===== *\/\n        .form-section {\n            position: relative;\n            background: #ffffff !important;\n            border: 1px solid var(--app-border) !important;\n            border-radius: 20px !important;\n            box-shadow: var(--app-shadow-sm) !important;\n            padding: 20px !important;\n            overflow: hidden;\n            transition: transform var(--app-dur) var(--app-ease),\n                border-color var(--app-dur) var(--app-ease),\n                box-shadow var(--app-dur) var(--app-ease);\n        }\n\n        .form-section::before {\n            content: \"\";\n            position: absolute;\n            left: 0;\n            top: 0;\n            bottom: 0;\n            width: 4px;\n            background: var(--section-accent, var(--app-primary));\n        }\n\n        .form-section:hover {\n            border-color: #cbd5e1 !important;\n            box-shadow: var(--app-shadow) !important;\n        }\n\n        .form-section h3 {\n            border: 0 !important;\n            padding: 0 0 14px !important;\n            margin: 0 0 16px !important;\n            border-bottom: 1px solid var(--app-border) !important;\n            display: flex;\n            align-items: center;\n            gap: 12px;\n            font-size: 16px !important;\n            font-weight: 700 !important;\n            color: var(--app-text) !important;\n            letter-spacing: -0.01em;\n        }\n\n        .form-section h3 .section-icon {\n            display: inline-flex;\n            align-items: center;\n            justify-content: center;\n            width: 36px;\n            height: 36px;\n            border-radius: 10px;\n            background: var(--section-accent-soft, var(--app-primary-soft));\n            color: var(--section-accent, var(--app-primary));\n            flex-shrink: 0;\n        }\n\n        .form-section h3 .section-icon svg {\n            width: 18px;\n            height: 18px;\n        }\n\n        .form-section h3 .section-step {\n            margin-left: auto;\n            font-family: 'JetBrains Mono', ui-monospace, monospace;\n            font-size: 11px;\n            font-weight: 600;\n            color: var(--app-text-soft);\n            letter-spacing: 0.08em;\n            text-transform: uppercase;\n        }\n\n        \/* Section accent map *\/\n        .form-section[data-accent=\"basic\"] {\n            --section-accent: #58C1A4;\n            --section-accent-soft: #ecfaf5;\n        }\n\n        .form-section[data-accent=\"image\"] {\n            --section-accent: #0ea5e9;\n            --section-accent-soft: #ecfeff;\n        }\n\n        .form-section[data-accent=\"location\"] {\n            --section-accent: #10b981;\n            --section-accent-soft: #ecfdf5;\n        }\n\n        .form-section[data-accent=\"dates\"] {\n            --section-accent: #8b5cf6;\n            --section-accent-soft: #f5f3ff;\n        }\n\n        .form-section[data-accent=\"publish\"] {\n            --section-accent: #6366f1;\n            --section-accent-soft: #eef2ff;\n        }\n\n        .form-section[data-accent=\"price\"] {\n            --section-accent: #f59e0b;\n            --section-accent-soft: #fffbeb;\n        }\n\n        \/* ===== Wizard \u2014 un paso a la vez ===== *\/\n        .form-section {\n            display: none;\n        }\n\n        .form-section.active {\n            display: block;\n            animation: wizard-fade-in 0.25s var(--app-ease);\n        }\n\n        @keyframes wizard-fade-in {\n            from {\n                opacity: 0;\n                transform: translateY(8px);\n            }\n\n            to {\n                opacity: 1;\n                transform: translateY(0);\n            }\n        }\n\n        .wizard-progress {\n            display: flex;\n            align-items: center;\n            gap: 12px;\n            margin-bottom: 18px;\n            padding: 12px 16px;\n            background: #ffffff;\n            border: 1px solid var(--app-border);\n            border-radius: 14px;\n            box-shadow: var(--app-shadow-sm);\n        }\n\n        .wizard-progress__text {\n            font-family: 'JetBrains Mono', ui-monospace, monospace;\n            font-size: 12px;\n            font-weight: 700;\n            color: var(--app-text);\n            letter-spacing: 0.04em;\n            white-space: nowrap;\n        }\n\n        .wizard-progress__bar {\n            flex: 1;\n            height: 8px;\n            background: #e5e7eb;\n            border-radius: 999px;\n            overflow: hidden;\n        }\n\n        .wizard-progress__fill {\n            height: 100%;\n            background: linear-gradient(135deg, var(--app-primary) 0%, var(--app-primary-dark) 100%);\n            border-radius: 999px;\n            transition: width 0.3s var(--app-ease);\n        }\n\n        .action-nav {\n            display: flex;\n            gap: 10px;\n        }\n\n        .action-secondary {\n            flex: 1;\n            display: inline-flex;\n            align-items: center;\n            justify-content: center;\n            gap: 8px;\n            padding: 11px 20px;\n            background: #ffffff;\n            color: var(--app-text);\n            border: 1px solid var(--app-border);\n            border-radius: 12px;\n            font-size: 14px;\n            font-weight: 600;\n            cursor: pointer;\n            transition: background var(--app-dur) var(--app-ease),\n                border-color var(--app-dur) var(--app-ease);\n        }\n\n        .action-secondary:hover:not([disabled]) {\n            background: #f9fafb;\n            border-color: #cbd5e1;\n        }\n\n        \/* Siguiente = primary dentro del wizard (acci\u00f3n esperada) *\/\n        #btn-next {\n            background: linear-gradient(135deg, var(--app-primary) 0%, var(--app-primary-dark) 100%) !important;\n            color: #ffffff !important;\n            border: 0 !important;\n            padding: 13px 20px !important;\n            font-size: 15px !important;\n            font-weight: 700 !important;\n            box-shadow: 0 6px 18px -6px rgba(88, 193, 164, .55),\n                0 1px 0 rgba(255, 255, 255, .3) inset !important;\n        }\n\n        #btn-next:hover:not([disabled]) {\n            filter: brightness(1.04);\n            transform: translateY(-1px);\n        }\n\n        \/* Anterior = outline sutil *\/\n        #btn-prev {\n            flex: 0 0 auto;\n            min-width: 110px;\n        }\n\n        \/* Guardar borrador = ghost m\u00e1s discreto (secundario al Siguiente\/Enviar) *\/\n        #btn-guardar.action-ghost {\n            background: transparent !important;\n            border: 1px dashed #a8e8d0 !important;\n            color: var(--app-primary-dark) !important;\n            padding: 9px 16px !important;\n            font-size: 13px !important;\n            font-weight: 600 !important;\n        }\n\n        #btn-guardar.action-ghost:hover:not([disabled]) {\n            background: var(--app-primary-soft) !important;\n            border-style: solid !important;\n        }\n\n        .action-secondary[disabled],\n        .action-primary[disabled],\n        .action-ghost[disabled] {\n            opacity: 0.5;\n            cursor: not-allowed;\n            pointer-events: none;\n        }\n\n        \/* Quote summary (cost estimation) *\/\n        .quote-card {\n            background: linear-gradient(135deg, var(--app-primary-soft) 0%, #ffffff 100%);\n            border: 1px solid #a8e8d0;\n            border-radius: 14px;\n            padding: 14px 16px;\n            margin-top: 14px;\n            position: relative;\n        }\n\n        .quote-card__row {\n            display: flex;\n            align-items: baseline;\n            justify-content: space-between;\n            gap: 12px;\n        }\n\n        .quote-card__label {\n            font-size: 11px;\n            font-weight: 600;\n            color: var(--app-text-soft);\n            text-transform: uppercase;\n            letter-spacing: 0.08em;\n            font-family: 'JetBrains Mono', ui-monospace, monospace;\n        }\n\n        .quote-card__value {\n            font-size: 16px;\n            font-weight: 700;\n            color: var(--app-text);\n        }\n\n        .quote-card__value--big {\n            font-size: 24px;\n            color: var(--app-primary);\n            letter-spacing: -0.02em;\n            font-weight: 800;\n        }\n\n        .quote-card__meta {\n            font-size: 12px;\n            color: var(--app-text-mute);\n            margin-top: 6px;\n        }\n\n        \/* Form card wrapper polish *\/\n        #tab-nuevo>.bg-white {\n            background: transparent !important;\n            box-shadow: none !important;\n            padding: 0 !important;\n        }\n\n        #form-titulo {\n            border: 0 !important;\n            padding: 0 !important;\n            margin-bottom: 20px !important;\n            display: flex;\n            align-items: center;\n            gap: 12px;\n        }\n\n        #form-titulo::before {\n            content: \"\";\n            display: inline-block;\n            width: 4px;\n            height: 24px;\n            background: var(--app-primary);\n            border-radius: 2px;\n        }\n\n        \/* ===== Action bar \u2014 jerarqu\u00eda primary\/ghost\/link ===== *\/\n        .action-bar {\n            background: #ffffff;\n            border: 1px solid var(--app-border);\n            padding: 16px;\n            display: flex;\n            flex-direction: column;\n            align-items: stretch;\n            gap: 10px;\n            border-radius: 20px;\n            box-shadow: var(--app-shadow);\n            margin-top: 24px;\n        }\n\n        \/* Primary CTA \u2014 Enviar a revisi\u00f3n (acci\u00f3n principal, grande) *\/\n        .action-primary {\n            display: inline-flex;\n            align-items: center;\n            justify-content: center;\n            gap: 10px;\n            padding: 14px 24px;\n            background: linear-gradient(135deg, var(--app-primary) 0%, var(--app-primary-dark) 100%);\n            color: #ffffff;\n            border: 0;\n            border-radius: 14px;\n            font-size: 15px;\n            font-weight: 700;\n            letter-spacing: -0.005em;\n            cursor: pointer;\n            box-shadow: 0 6px 20px -4px rgba(88, 193, 164, .5),\n                0 1px 0 rgba(255, 255, 255, .3) inset;\n            transition: transform var(--app-dur) var(--app-ease),\n                box-shadow var(--app-dur) var(--app-ease),\n                filter var(--app-dur) var(--app-ease);\n            position: relative;\n            overflow: hidden;\n        }\n\n        .action-primary:hover {\n            transform: translateY(-2px);\n            box-shadow: 0 10px 28px -6px rgba(88, 193, 164, .6),\n                0 1px 0 rgba(255, 255, 255, .3) inset;\n            filter: brightness(1.03);\n        }\n\n        .action-primary:active {\n            transform: translateY(0);\n        }\n\n        .action-primary svg {\n            flex-shrink: 0;\n        }\n\n        \/* Ghost \u2014 Guardar borrador (secondary, outline brand) *\/\n        .action-ghost {\n            display: inline-flex;\n            align-items: center;\n            justify-content: center;\n            gap: 8px;\n            padding: 11px 20px;\n            background: var(--app-primary-soft);\n            color: var(--app-primary-dark);\n            border: 1px solid #a8e8d0;\n            border-radius: 12px;\n            font-size: 14px;\n            font-weight: 600;\n            cursor: pointer;\n            transition: background var(--app-dur) var(--app-ease),\n                border-color var(--app-dur) var(--app-ease);\n        }\n\n        .action-ghost:hover {\n            background: #d1f3e6;\n            border-color: var(--app-primary);\n        }\n\n        \/* Text link \u2014 Cancelar (acci\u00f3n destructiva m\u00ednima) *\/\n        .action-link {\n            background: transparent;\n            border: 0;\n            padding: 6px;\n            font-size: 13px;\n            font-weight: 500;\n            color: var(--app-text-soft);\n            cursor: pointer;\n            text-decoration: none;\n            transition: color var(--app-dur) var(--app-ease);\n            align-self: center;\n        }\n\n        .action-link:hover {\n            color: #dc2626;\n            text-decoration: underline;\n        }\n\n        @media (max-width: 639px) {\n            .action-bar {\n                position: sticky;\n                bottom: 0;\n                z-index: 20;\n                border-radius: 20px 20px 0 0;\n                margin-left: -10px;\n                margin-right: -10px;\n                padding-bottom: calc(14px + env(safe-area-inset-bottom));\n                border-bottom: 0;\n                box-shadow: 0 -8px 24px -8px rgba(16, 24, 40, .12);\n            }\n        }\n\n        \/* List: event card *\/\n        .evento-card-pro {\n            background: #ffffff;\n            border: 1px solid var(--app-border);\n            border-radius: 18px;\n            box-shadow: var(--app-shadow-sm);\n            overflow: hidden;\n            transition: transform var(--app-dur) var(--app-ease),\n                box-shadow var(--app-dur) var(--app-ease),\n                border-color var(--app-dur) var(--app-ease);\n        }\n\n        .evento-card-pro:hover {\n            transform: translateY(-2px);\n            box-shadow: var(--app-shadow-md);\n            border-color: #cbd5e1;\n        }\n\n        \/* Search box app-like con icon *\/\n        .search-wrap {\n            position: relative;\n        }\n\n        .search-wrap input {\n            padding-left: 44px !important;\n        }\n\n        .search-wrap .search-icon {\n            position: absolute;\n            left: 14px;\n            top: 50%;\n            transform: translateY(-50%);\n            color: var(--app-text-soft);\n            pointer-events: none;\n        }\n\n        \/* Full-bleed: romper el container de WordPress y usar viewport completo *\/\n        .portal-eventos-wrapper {\n            width: 100vw !important;\n            max-width: 100vw !important;\n            position: relative !important;\n            left: 50% !important;\n            right: 50% !important;\n            margin-left: -50vw !important;\n            margin-right: -50vw !important;\n            overflow-x: hidden;\n        }\n\n        \/* Neutralizar restricciones de ancho del tema en todos los ancestros comunes *\/\n        body .is-layout-constrained>.wp-block-html,\n        body .wp-block-html,\n        body .wp-block-group,\n        body .entry-content,\n        body .entry-content>*,\n        body .site-main,\n        body .site-content {\n            max-width: none !important;\n        }\n\n        .portal-eventos-wrapper *,\n        .portal-eventos-wrapper>*,\n        .portal-eventos-wrapper .container,\n        .portal-eventos-wrapper #app-screen,\n        .portal-eventos-wrapper #app-screen>* {\n            max-width: none !important;\n            margin-left: 0 !important;\n            margin-right: 0 !important;\n        }\n\n        .portal-eventos-wrapper #app-screen .container.max-w-7xl,\n        .portal-eventos-wrapper nav>.container.max-w-7xl {\n            max-width: 1280px !important;\n            margin-left: auto !important;\n            margin-right: auto !important;\n        }\n\n        \/* Centrar card de login *\/\n        #auth-screen:not(.hidden) {\n            display: flex !important;\n            align-items: center !important;\n            justify-content: center !important;\n            padding: 16px !important;\n        }\n\n        #auth-screen.hidden {\n            display: none !important;\n        }\n\n        #auth-screen>div {\n            max-width: 440px !important;\n            width: 100% !important;\n            margin-left: auto !important;\n            margin-right: auto !important;\n        }\n\n        \/* Forzar que los inputs ocupen todo el ancho disponible *\/\n        .portal-eventos-wrapper .form-input,\n        .portal-eventos-wrapper input.form-input,\n        .portal-eventos-wrapper textarea.form-input,\n        .portal-eventos-wrapper select.form-input {\n            width: 100% !important;\n            max-width: 100% !important;\n        }\n\n        \/* ===== UX pro: inputs con contraste visible (override WP + Tailwind) ===== *\/\n        .portal-eventos-wrapper .form-input,\n        .portal-eventos-wrapper input.form-input,\n        .portal-eventos-wrapper textarea.form-input,\n        .portal-eventos-wrapper select.form-input {\n            background: #f8fafc !important;\n            border: 1.5px solid #cbd5e1 !important;\n            border-radius: 12px !important;\n            padding: 12px 14px !important;\n            font-size: 15px !important;\n            color: var(--app-text) !important;\n            box-shadow: inset 0 1px 2px rgba(15, 23, 42, .04) !important;\n            transition: background .15s ease, border-color .15s ease, box-shadow .15s ease !important;\n        }\n\n        .portal-eventos-wrapper .form-input::placeholder,\n        .portal-eventos-wrapper input.form-input::placeholder,\n        .portal-eventos-wrapper textarea.form-input::placeholder {\n            color: #94a3b8 !important;\n            opacity: 1 !important;\n        }\n\n        .portal-eventos-wrapper .form-input:hover:not(:read-only):not(:disabled) {\n            border-color: #94a3b8 !important;\n            background: #ffffff !important;\n        }\n\n        .portal-eventos-wrapper .form-input:focus,\n        .portal-eventos-wrapper input.form-input:focus,\n        .portal-eventos-wrapper textarea.form-input:focus,\n        .portal-eventos-wrapper select.form-input:focus {\n            background: #ffffff !important;\n            border-color: var(--app-primary) !important;\n            box-shadow: 0 0 0 4px rgba(88, 193, 164, .18), inset 0 1px 2px rgba(15, 23, 42, .04) !important;\n            outline: none !important;\n        }\n\n        .portal-eventos-wrapper .form-input:read-only,\n        .portal-eventos-wrapper input.form-input:read-only {\n            background: #f1f5f9 !important;\n            border-color: #e2e8f0 !important;\n            color: #64748b !important;\n            cursor: not-allowed !important;\n        }\n\n        .portal-eventos-wrapper textarea.form-input {\n            min-height: 110px !important;\n            line-height: 1.5 !important;\n            resize: vertical !important;\n        }\n\n        \/* Labels: m\u00e1s fuertes, con marcador de requerido visible *\/\n        .portal-eventos-wrapper .form-label {\n            display: block !important;\n            font-size: 13px !important;\n            font-weight: 700 !important;\n            color: #0f172a !important;\n            text-transform: uppercase !important;\n            letter-spacing: 0.04em !important;\n            margin: 14px 0 6px !important;\n        }\n\n        .portal-eventos-wrapper .form-label:first-child {\n            margin-top: 4px !important;\n        }\n\n        \/* Intereses scroller contenido visualmente *\/\n        .portal-eventos-wrapper #interes.form-input {\n            padding: 10px !important;\n            background: #ffffff !important;\n            overflow-y: auto !important;\n            scrollbar-gutter: stable;\n        }\n\n        .portal-eventos-wrapper #interes.form-input label {\n            padding: 4px 6px;\n            border-radius: 6px;\n            transition: background .12s ease;\n        }\n\n        .portal-eventos-wrapper #interes.form-input label:hover {\n            background: #f1f5f9;\n        }\n\n        \/* File input: mantener su estilo dashed *\/\n        .portal-eventos-wrapper input[type=\"file\"].form-input {\n            background: var(--app-primary-soft) !important;\n            border: 2px dashed #a8e8d0 !important;\n            padding: 16px !important;\n            cursor: pointer !important;\n        }\n\n        .portal-eventos-wrapper input[type=\"file\"].form-input:hover {\n            border-color: var(--app-primary) !important;\n            background: #d1f3e6 !important;\n        }\n\n        \/* Separaci\u00f3n visible entre campos dentro de una secci\u00f3n *\/\n        .form-section>div+div {\n            margin-top: 4px;\n        }\n\n        \/* Hint helper text: menos ruidoso *\/\n        .portal-eventos-wrapper .form-section p.text-xs {\n            color: #64748b !important;\n            font-size: 12px !important;\n            margin-top: 6px !important;\n            line-height: 1.4 !important;\n        }\n\n        \/* ===== Imagen upload: preview + overlay durante procesamiento ===== *\/\n        .img-preview-wrap {\n            position: relative;\n            min-height: 180px;\n        }\n\n        .img-upload-overlay {\n            position: absolute;\n            inset: 0;\n            display: flex;\n            align-items: center;\n            justify-content: center;\n            flex-direction: column;\n            gap: 10px;\n            padding: 20px;\n            background: rgba(248, 250, 252, 0.95);\n            border: 2px dashed #cbd5e1;\n            border-radius: 12px;\n            z-index: 5;\n        }\n\n        .img-upload-overlay.hidden {\n            display: none;\n        }\n\n        .img-upload-spinner {\n            width: 36px;\n            height: 36px;\n            border: 3px solid #e2e8f0;\n            border-top-color: var(--app-primary);\n            border-radius: 50%;\n            animation: img-spin 0.9s linear infinite;\n        }\n\n        @keyframes img-spin {\n            to {\n                transform: rotate(360deg);\n            }\n        }\n\n        .img-upload-text {\n            font-size: 13px;\n            font-weight: 600;\n            color: var(--app-text-soft);\n        }\n\n        \/* Eliminar restricciones de WordPress para esta p\u00e1gina *\/\n        .portal-eventos-wrapper.is-layout-constrained> :where(:not(.alignleft):not(.alignright):not(.alignfull)),\n        .portal-eventos-wrapper .is-layout-constrained> :where(:not(.alignleft):not(.alignright):not(.alignfull)) {\n            max-width: none !important;\n            margin-left: 0 !important;\n            margin-right: 0 !important;\n        }\n\n        .pago-loading-overlay {\n            position: fixed;\n            inset: 0;\n            background: rgba(0, 0, 0, 0.7);\n            display: none;\n            align-items: center;\n            justify-content: center;\n            z-index: 9999;\n        }\n\n        .pago-loading-overlay.active {\n            display: flex;\n        }\n\n        .pago-loading-content {\n            background: #fff;\n            padding: 32px 40px;\n            border-radius: 14px;\n            text-align: center;\n            box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);\n            max-width: 360px;\n        }\n\n        .pago-loading-spinner {\n            border: 3px solid #f3f3f3;\n            border-top: 3px solid #3498db;\n            border-radius: 50%;\n            width: 44px;\n            height: 44px;\n            margin: 0 auto 16px;\n            animation: pago-spin 1s linear infinite;\n        }\n\n        @keyframes pago-spin {\n            100% {\n                transform: rotate(360deg);\n            }\n        }\n\n        .pago-loading-msg {\n            font-weight: 700;\n            color: #111827;\n            font-size: 16px;\n            margin-bottom: 4px;\n        }\n\n        .pago-loading-step {\n            font-size: 13px;\n            color: #6b7280;\n        }\n\n        \/* Modal selector tier (listado \/ carrusel) *\/\n        .tier-modal-overlay {\n            position: fixed;\n            inset: 0;\n            background: rgba(0, 0, 0, 0.65);\n            display: none;\n            align-items: center;\n            justify-content: center;\n            z-index: 10000;\n            padding: 16px;\n        }\n\n        .tier-modal-overlay.active {\n            display: flex;\n        }\n\n        .tier-modal-card {\n            background: #fff;\n            border-radius: 16px;\n            padding: 24px;\n            max-width: 420px;\n            width: 100%;\n            box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);\n        }\n\n        .tier-modal-title {\n            font-size: 18px;\n            font-weight: 800;\n            color: #0f172a;\n            margin: 0 0 6px;\n        }\n\n        .tier-modal-sub {\n            font-size: 13px;\n            color: #64748b;\n            margin: 0 0 18px;\n        }\n\n        .tier-option {\n            display: block;\n            width: 100%;\n            text-align: left;\n            padding: 14px 16px;\n            border-radius: 12px;\n            margin-bottom: 10px;\n            border: 2px solid #e5e7eb;\n            background: #fff;\n            cursor: pointer;\n            transition: border-color 0.15s, background 0.15s;\n        }\n\n        .tier-option:hover {\n            border-color: #58C1A4;\n            background: #f0faf7;\n        }\n\n        .tier-option-title {\n            font-weight: 700;\n            color: #0f172a;\n            font-size: 15px;\n            margin-bottom: 2px;\n        }\n\n        .tier-option-desc {\n            font-size: 12px;\n            color: #64748b;\n        }\n\n        .tier-option-price {\n            font-weight: 800;\n            color: #0f6f5d;\n            font-size: 14px;\n            margin-top: 4px;\n        }\n\n        .tier-modal-cancel {\n            width: 100%;\n            margin-top: 6px;\n            padding: 10px;\n            background: transparent;\n            border: 0;\n            color: #64748b;\n            font-weight: 600;\n            cursor: pointer;\n        }\n    <\/style>\n    <script\n        src=\"https:\/\/maps.googleapis.com\/maps\/api\/js?key=AIzaSyAUHrO1Xc9to3V8La2Yv4OchGBla2ybocc&#038;libraries=places&#038;callback=initGooglePlaces&#038;loading=async\"\n        async defer><\/script>\n    <script>\n        window.__gmapsInitRequested = false;\n        window.initGooglePlaces = function () {\n            window.__gmapsInitRequested = true;\n        };\n    <\/script>\n<\/head>\n\n<body class=\"bg-gray-50 font-sans\">\n    <div class=\"portal-eventos-wrapper\">\n        <!-- Auth Screen -->\n        <div id=\"auth-screen\" class=\"min-h-screen flex items-center justify-center p-3 sm:p-4\">\n            <div class=\"app-card p-6 sm:p-8 w-full max-w-md\">\n                <div class=\"app-brand-mark\" aria-hidden=\"true\">\n                    <svg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2.3\" stroke-linecap=\"round\"\n                        stroke-linejoin=\"round\">\n                        <path d=\"M21 10c0 7-9 13-9 13s-9-6-9-13a9 9 0 0 1 18 0z\" \/>\n                        <circle cx=\"12\" cy=\"10\" r=\"3\" \/>\n                    <\/svg>\n                <\/div>\n                <h1 class=\"text-2xl font-bold text-gray-800 mb-1 text-center\">Portal de Eventos<\/h1>\n                <p class=\"text-sm text-gray-500 text-center mb-6\">Publica y administra tus eventos de Saca Plan<\/p>\n\n                <div id=\"login-form\">\n                    <h2 class=\"text-lg font-semibold mb-4\">Iniciar Sesi\u00f3n<\/h2>\n                    <div class=\"space-y-4\">\n                        <div>\n                            <label class=\"form-label\">Email<\/label>\n                            <input type=\"email\" id=\"login-email\" class=\"form-input\" placeholder=\"tu@email.com\"\n                                required \/>\n                        <\/div>\n                        <div>\n                            <label class=\"form-label\">Contrase\u00f1a<\/label>\n                            <input type=\"password\" id=\"login-password\" class=\"form-input\" placeholder=\"\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022\"\n                                required \/>\n                        <\/div>\n                        <button onclick=\"handleLogin()\" class=\"btn-primary w-full\">Entrar<\/button>\n\n                        <div class=\"flex items-center gap-2 my-3\">\n                            <div class=\"flex-1 h-px bg-gray-200\"><\/div>\n                            <span class=\"text-gray-400 text-sm\">o<\/span>\n                            <div class=\"flex-1 h-px bg-gray-200\"><\/div>\n                        <\/div>\n\n                        <button onclick=\"handleGoogleLogin()\"\n                            class=\"w-full flex items-center justify-center gap-3 py-2.5 px-4 border border-gray-300 rounded-lg bg-white hover:bg-gray-50 text-gray-700 font-medium text-sm transition-colors\">\n                            <svg width=\"18\" height=\"18\" viewBox=\"0 0 18 18\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\">\n                                <path fill=\"#4285F4\"\n                                    d=\"M17.64 9.2c0-.637-.057-1.251-.164-1.84H9v3.481h4.844c-.209 1.125-.843 2.078-1.796 2.717v2.258h2.908c1.702-1.567 2.684-3.875 2.684-6.615z\" \/>\n                                <path fill=\"#34A853\"\n                                    d=\"M9 18c2.43 0 4.467-.806 5.956-2.18l-2.908-2.259c-.806.54-1.837.86-3.048.86-2.344 0-4.328-1.584-5.036-3.711H.957v2.332C2.438 15.983 5.482 18 9 18z\" \/>\n                                <path fill=\"#FBBC05\"\n                                    d=\"M3.964 10.71c-.18-.54-.282-1.117-.282-1.71s.102-1.17.282-1.71V4.958H.957C.347 6.173 0 7.548 0 9s.348 2.827.957 4.042l3.007-2.332z\" \/>\n                                <path fill=\"#EA4335\"\n                                    d=\"M9 3.58c1.321 0 2.508.454 3.44 1.345l2.582-2.58C13.463.891 11.426 0 9 0 5.482 0 2.438 2.017.957 4.958L3.964 7.29C4.672 5.163 6.656 3.58 9 3.58z\" \/>\n                            <\/svg>\n                            Continuar con Google\n                        <\/button>\n\n                        <p class=\"text-center text-xs text-gray-400 mt-1\">\n                            <a href=\"https:\/\/saca-plan.com\/inicio\/forgot-password\/\" class=\"hover:underline\">\u00bfOlvidaste\n                                tu contrase\u00f1a?<\/a>\n                        <\/p>\n\n                        <div class=\"mt-4 pt-4 border-t border-gray-100 text-center\">\n                            <p class=\"text-sm text-gray-500 mb-3\">\u00bfA\u00fan no tienes la app? Descargala desde aqu\u00ed:<\/p>\n                            <div class=\"flex gap-2 justify-center\">\n                                <a href=\"https:\/\/play.google.com\/store\/apps\/details?id=com.santi_anayav.planapp&#038;pcampaignid=web_share\"\n                                    target=\"_blank\"\n                                    class=\"flex items-center gap-2 px-3 py-2 bg-black text-white text-xs font-medium rounded-lg hover:bg-gray-800 transition-colors\">\n                                    <svg width=\"16\" height=\"16\" viewBox=\"0 0 24 24\" fill=\"currentColor\">\n                                        <path d=\"M3.18 23.76c.3.17.64.24.99.2l12.6-11.58L13.23 9l-10.05 14.76z\" \/>\n                                        <path\n                                            d=\"M20.49 10.39L17.3 8.58l-3.43 3.16 3.43 3.16 3.22-1.85c.92-.53.92-1.85-.03-2.66z\" \/>\n                                        <path\n                                            d=\"M3.18.24C2.88.07 2.54 0 2.19.04v23.92c.35.04.69-.03.99-.2L16.06 12 3.18.24z\" \/>\n                                        <path d=\"M4.17 1.03L13.23 9l3.54-3.26L4.17 1.03z\" \/>\n                                    <\/svg>\n                                    Google Play\n                                <\/a>\n                                <a href=\"https:\/\/apps.apple.com\/mx\/app\/planapp\/id6776222508\" target=\"_blank\"\n                                    class=\"flex items-center gap-2 px-3 py-2 bg-black text-white text-xs font-medium rounded-lg hover:bg-gray-800 transition-colors\">\n                                    <svg width=\"16\" height=\"16\" viewBox=\"0 0 24 24\" fill=\"currentColor\">\n                                        <path\n                                            d=\"M18.71 19.5c-.83 1.24-1.71 2.45-3.05 2.47-1.34.03-1.77-.79-3.29-.79-1.53 0-2 .77-3.27.82-1.31.05-2.3-1.32-3.14-2.53C4.25 17 2.94 12.45 4.7 9.39c.87-1.52 2.43-2.48 4.12-2.51 1.28-.02 2.5.87 3.29.87.78 0 2.26-1.07 3.8-.91.65.03 2.47.26 3.64 1.98-.09.06-2.17 1.28-2.15 3.81.03 3.02 2.65 4.03 2.68 4.04-.03.07-.42 1.44-1.38 2.83M13 3.5c.73-.83 1.94-1.46 2.94-1.5.13 1.17-.34 2.35-1.04 3.19-.69.85-1.83 1.51-2.95 1.42-.15-1.15.41-2.35 1.05-3.11z\" \/>\n                                    <\/svg>\n                                    App Store\n                                <\/a>\n                            <\/div>\n                        <\/div>\n                    <\/div>\n                <\/div>\n\n                <div id=\"auth-message\" class=\"mt-4 p-3 rounded-lg text-sm hidden\"><\/div>\n            <\/div>\n        <\/div>\n\n        <!-- Main App -->\n        <div id=\"app-screen\" class=\"hidden min-h-screen\">\n            <nav class=\"bg-white border-b border-gray-100 sticky top-0 z-30\"\n                style=\"box-shadow: var(--app-shadow-sm); backdrop-filter: saturate(140%) blur(8px);\">\n                <div class=\"container mx-auto px-4 sm:px-8 py-3 flex justify-between items-center max-w-7xl gap-3\">\n                    <div class=\"flex items-center gap-3 min-w-0\">\n                        <div class=\"app-brand-mark\"\n                            style=\"width:40px; height:40px; margin:0; border-radius:12px; font-size:18px\">\n                            <svg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2.3\"\n                                stroke-linecap=\"round\" stroke-linejoin=\"round\" style=\"width:22px; height:22px\">\n                                <path d=\"M21 10c0 7-9 13-9 13s-9-6-9-13a9 9 0 0 1 18 0z\" \/>\n                                <circle cx=\"12\" cy=\"10\" r=\"3\" \/>\n                            <\/svg>\n                        <\/div>\n                        <div class=\"min-w-0\">\n                            <h1 class=\"text-base sm:text-lg font-bold text-gray-800 leading-tight truncate\">Mis Eventos\n                            <\/h1>\n                            <span id=\"user-email\"\n                                class=\"text-xs text-gray-500 truncate block max-w-[180px] sm:max-w-none\"><\/span>\n                        <\/div>\n                    <\/div>\n                    <button onclick=\"handleLogout()\" title=\"Cerrar sesi\u00f3n\"\n                        class=\"flex items-center gap-1.5 text-xs sm:text-sm font-medium text-gray-600 hover:text-red-600 whitespace-nowrap px-3 py-2 rounded-full hover:bg-red-50 transition-colors\">\n                        <svg width=\"16\" height=\"16\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\"\n                            stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\">\n                            <path d=\"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4\" \/>\n                            <polyline points=\"16 17 21 12 16 7\" \/>\n                            <line x1=\"21\" y1=\"12\" x2=\"9\" y2=\"12\" \/>\n                        <\/svg>\n                        <span class=\"hidden sm:inline\">Salir<\/span>\n                    <\/button>\n                <\/div>\n            <\/nav>\n\n            <div class=\"container mx-auto max-w-7xl px-4 sm:px-8 py-4 sm:py-6\">\n                <!-- Tabs (app-style segmented) -->\n                <div class=\"inline-flex gap-1 mb-5 sm:mb-6 p-1 bg-gray-100 rounded-full w-full sm:w-auto\">\n                    <button onclick=\"mostrarTab('lista')\"\n                        class=\"tab-btn flex-1 sm:flex-none px-4 sm:px-6 py-2 text-sm font-semibold rounded-full transition-colors text-center text-gray-600\"\n                        data-tab=\"lista\">Mis Eventos<\/button>\n                    <button onclick=\"mostrarTab('nuevo')\"\n                        class=\"tab-btn flex-1 sm:flex-none px-4 sm:px-6 py-2 text-sm font-semibold rounded-full transition-colors text-center text-gray-600\"\n                        data-tab=\"nuevo\">Nuevo Evento<\/button>\n                    <button onclick=\"mostrarTab('facturas')\"\n                        class=\"tab-btn flex-1 sm:flex-none px-4 sm:px-6 py-2 text-sm font-semibold rounded-full transition-colors text-center text-gray-600\"\n                        data-tab=\"facturas\">Mis Facturas<\/button>\n                <\/div>\n\n                <!-- Tab: Lista de eventos -->\n                <div id=\"tab-lista\" class=\"hidden\">\n                    <div class=\"mb-5 search-wrap\">\n                        <span class=\"search-icon\">\n                            <svg width=\"18\" height=\"18\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\"\n                                stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\">\n                                <circle cx=\"11\" cy=\"11\" r=\"8\" \/>\n                                <path d=\"m21 21-4.3-4.3\" \/>\n                            <\/svg>\n                        <\/span>\n                        <input type=\"text\" id=\"search-input\" placeholder=\"Buscar por nombre del evento...\"\n                            oninput=\"filtrarMisEventos()\" class=\"form-input\" aria-label=\"Buscar eventos\" \/>\n                    <\/div>\n                    <div id=\"lista-eventos\" class=\"space-y-4\"><\/div>\n                <\/div>\n\n                <!-- Tab: Nuevo\/Editar evento -->\n                <div id=\"tab-nuevo\" class=\"hidden\">\n                    <div class=\"bg-white rounded-xl shadow-lg p-4 sm:p-8\">\n                        <h2 id=\"form-titulo\"\n                            class=\"text-xl sm:text-2xl font-bold mb-4 sm:mb-6 text-gray-800 pb-3 sm:pb-4 border-b-2 border-gray-200\">\n                            Nuevo Evento<\/h2>\n\n                        <form id=\"evento-form\" class=\"space-y-6\" novalidate>\n                            <input type=\"hidden\" id=\"evento-id\" \/>\n\n                            <!-- Wizard progress indicator -->\n                            <div class=\"wizard-progress\">\n                                <span class=\"wizard-progress__text\">Paso <span id=\"wizard-step-current\">1<\/span> \/ <span\n                                        id=\"wizard-step-total\">6<\/span><\/span>\n                                <div class=\"wizard-progress__bar\">\n                                    <div class=\"wizard-progress__fill\" id=\"wizard-progress-fill\" style=\"width:16.6666%\">\n                                    <\/div>\n                                <\/div>\n                            <\/div>\n\n                            <!-- Secci\u00f3n: Informaci\u00f3n B\u00e1sica -->\n                            <div class=\"form-section active\" data-accent=\"basic\">\n                                <h3>\n                                    <span class=\"section-icon\" aria-hidden=\"true\">\n                                        <svg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\"\n                                            stroke-linecap=\"round\" stroke-linejoin=\"round\">\n                                            <path d=\"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z\" \/>\n                                            <polyline points=\"14 2 14 8 20 8\" \/>\n                                            <line x1=\"9\" y1=\"13\" x2=\"15\" y2=\"13\" \/>\n                                            <line x1=\"9\" y1=\"17\" x2=\"13\" y2=\"17\" \/>\n                                        <\/svg>\n                                    <\/span>\n                                    Informaci\u00f3n B\u00e1sica\n                                    <span class=\"section-step\">Paso 1 \/ 6<\/span>\n                                <\/h3>\n\n                                <div class=\"grid grid-cols-1 lg:grid-cols-3 gap-4\">\n                                    <div class=\"lg:col-span-2\">\n                                        <label class=\"form-label\">Nombre del evento *<\/label>\n                                        <input name=\"nombre\" id=\"nombre\" class=\"form-input\" required maxlength=\"255\"\n                                            placeholder=\"Ej: Concierto de Rock en Le\u00f3n\" \/>\n                                    <\/div>\n\n                                    <div>\n                                        <label class=\"form-label\">Intereses * <span\n                                                style=\"font-size:12px; font-weight:normal; color:#666\">(selecciona 1 o 2\n                                                categor\u00edas principales)<\/span><\/label>\n                                        <div id=\"interes\" class=\"form-input\"\n                                            style=\"max-height:140px; overflow-y:auto; display:flex; flex-direction:column; gap:4px; padding:8px;\">\n                                        <\/div>\n                                    <\/div>\n                                <\/div>\n\n                                <div>\n                                    <label class=\"form-label\">Descripci\u00f3n *<\/label>\n                                    <textarea name=\"descripcion\" id=\"descripcion\" class=\"form-input\" rows=\"4\"\n                                        placeholder=\"Describe el evento, que incluye, p\u00fablico objetivo, etc.\"\n                                        required><\/textarea>\n                                <\/div>\n\n                                <div>\n                                    <label class=\"form-label\">Keywords (separadas por comas)<\/label>\n                                    <input name=\"keywords\" id=\"keywords\" class=\"form-input\"\n                                        placeholder=\"Ej: rock, musica, concierto\" \/>\n                                    <p class=\"text-xs text-gray-600 mt-1\">Se usar\u00e1n para b\u00fasqueda y recomendaciones<\/p>\n                                <\/div>\n                            <\/div>\n\n                            <!-- Secci\u00f3n: Imagen -->\n                            <div class=\"form-section\" data-accent=\"image\">\n                                <h3>\n                                    <span class=\"section-icon\" aria-hidden=\"true\">\n                                        <svg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\"\n                                            stroke-linecap=\"round\" stroke-linejoin=\"round\">\n                                            <rect x=\"3\" y=\"3\" width=\"18\" height=\"18\" rx=\"2\" ry=\"2\" \/>\n                                            <circle cx=\"9\" cy=\"9\" r=\"2\" \/>\n                                            <path d=\"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21\" \/>\n                                        <\/svg>\n                                    <\/span>\n                                    Imagen del Evento\n                                    <span class=\"section-step\">Paso 2 \/ 6<\/span>\n                                <\/h3>\n\n                                <div>\n                                    <label class=\"form-label\">Imagen del evento<\/label>\n                                    <input type=\"file\" id=\"imagen-file\" accept=\"image\/jpeg,image\/png,image\/webp\"\n                                        class=\"form-input\" \/>\n                                    <p class=\"text-xs text-gray-600 mt-1\">\ud83d\udccc JPG, PNG o WEBP. Se comprimir\u00e1\n                                        autom\u00e1ticamente.\n                                        M\u00e1ximo 8MB.<\/p>\n                                    <div id=\"imagen-preview-wrap\" class=\"img-preview-wrap mt-4\">\n                                        <div id=\"imagen-preview\" class=\"hidden\">\n                                            <p class=\"text-sm text-gray-600 mb-2\">Vista previa:<\/p>\n                                            <img id=\"imagen-preview-img\"\n                                                class=\"h-40 w-auto object-cover rounded-lg border-2 border-gray-300\" \/>\n                                            <button type=\"button\" id=\"btn-quitar-imagen\" class=\"btn-secondary mt-3\"\n                                                style=\"font-size:14px; padding:8px 16px\">\n                                                Quitar imagen\n                                            <\/button>\n                                        <\/div>\n                                        <div id=\"imagen-upload-overlay\" class=\"img-upload-overlay hidden\">\n                                            <div class=\"img-upload-spinner\"><\/div>\n                                            <div class=\"img-upload-text\">Procesando imagen&#8230;<\/div>\n                                        <\/div>\n                                    <\/div>\n                                <\/div>\n                            <\/div>\n\n                            <!-- Secci\u00f3n: Ubicaci\u00f3n -->\n                            <div class=\"form-section\" data-accent=\"location\">\n                                <h3>\n                                    <span class=\"section-icon\" aria-hidden=\"true\">\n                                        <svg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\"\n                                            stroke-linecap=\"round\" stroke-linejoin=\"round\">\n                                            <path d=\"M21 10c0 7-9 13-9 13s-9-6-9-13a9 9 0 0 1 18 0z\" \/>\n                                            <circle cx=\"12\" cy=\"10\" r=\"3\" \/>\n                                        <\/svg>\n                                    <\/span>\n                                    Ubicaci\u00f3n\n                                    <span class=\"section-step\">Paso 3 \/ 6<\/span>\n                                <\/h3>\n\n                                <div>\n                                    <label class=\"form-label\">Ubicaci\u00f3n (Google Maps) *<\/label>\n                                    <input name=\"ubicacion\" id=\"ubicacion\" placeholder=\"Busca en Google Maps...\"\n                                        class=\"form-input !border-blue-600\" required \/>\n                                    <p class=\"text-xs text-gray-600 mt-1\">\ud83d\udccc Escribe y selecciona un lugar de Google\n                                        Maps\n                                    <\/p>\n                                <\/div>\n\n                                <div class=\"grid grid-cols-1 lg:grid-cols-2 gap-4\">\n                                    <div>\n                                        <label class=\"form-label\">Lugar \/ Venue<\/label>\n                                        <input name=\"lugar\" id=\"lugar\" class=\"form-input\"\n                                            placeholder=\"Ej: Teatro Manuel Doblado\" \/>\n                                        <p class=\"text-xs text-gray-600 mt-1\">Nombre espec\u00edfico del lugar donde se\n                                            realiza\n                                            el evento<\/p>\n                                    <\/div>\n\n                                    <div>\n                                        <label class=\"form-label\">Ciudad (se completa autom\u00e1ticamente)<\/label>\n                                        <input name=\"ciudad\" id=\"ciudad\" type=\"text\" class=\"form-input\" readonly \/>\n                                        <p class=\"text-xs text-gray-600 mt-1\">Se llena autom\u00e1ticamente al seleccionar la\n                                            ubicaci\u00f3n<\/p>\n                                    <\/div>\n                                <\/div>\n                            <\/div>\n\n                            <input type=\"hidden\" id=\"latitud\" name=\"latitud\" \/>\n                            <input type=\"hidden\" id=\"longitud\" name=\"longitud\" \/>\n                            <input type=\"hidden\" id=\"place_id\" name=\"place_id\" \/>\n                            <input type=\"hidden\" id=\"ciudad_key\" name=\"ciudad_key\" \/>\n                            <input type=\"hidden\" id=\"ciudad_label\" name=\"ciudad_label\" \/>\n                            <input type=\"hidden\" id=\"ciudad_place_id\" name=\"ciudad_place_id\" \/>\n\n                            <!-- Secci\u00f3n: Fechas y Horarios -->\n                            <div class=\"form-section\" data-accent=\"dates\">\n                                <h3>\n                                    <span class=\"section-icon\" aria-hidden=\"true\">\n                                        <svg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\"\n                                            stroke-linecap=\"round\" stroke-linejoin=\"round\">\n                                            <rect x=\"3\" y=\"4\" width=\"18\" height=\"18\" rx=\"2\" ry=\"2\" \/>\n                                            <line x1=\"16\" y1=\"2\" x2=\"16\" y2=\"6\" \/>\n                                            <line x1=\"8\" y1=\"2\" x2=\"8\" y2=\"6\" \/>\n                                            <line x1=\"3\" y1=\"10\" x2=\"21\" y2=\"10\" \/>\n                                        <\/svg>\n                                    <\/span>\n                                    Fechas y Horarios\n                                    <span class=\"section-step\">Paso 4 \/ 6<\/span>\n                                <\/h3>\n\n                                <div class=\"grid grid-cols-1 md:grid-cols-2 gap-4\">\n                                    <div>\n                                        <label class=\"form-label\">Fecha de inicio *<\/label>\n                                        <input name=\"fecha_inicio\" id=\"fecha_inicio\" type=\"date\" class=\"form-input\"\n                                            required \/>\n                                    <\/div>\n                                    <div>\n                                        <label class=\"form-label\">Fecha de fin<\/label>\n                                        <input name=\"fecha_fin\" id=\"fecha_fin\" type=\"date\" class=\"form-input\" \/>\n                                        <p class=\"text-xs text-gray-600 mt-1\">Opcional, para eventos de varios d\u00edas<\/p>\n                                    <\/div>\n                                <\/div>\n\n                                <div class=\"grid grid-cols-1 md:grid-cols-3 gap-4\">\n                                    <div>\n                                        <label class=\"form-label\">Hora de inicio<\/label>\n                                        <input name=\"hora\" id=\"hora\" type=\"time\" class=\"form-input\" \/>\n                                    <\/div>\n                                    <div>\n                                        <label class=\"form-label\">Hora de apertura de puerta<\/label>\n                                        <input name=\"hora_apertura_puerta\" id=\"hora_apertura_puerta\" type=\"time\"\n                                            class=\"form-input\" \/>\n                                    <\/div>\n                                    <div>\n                                        <label class=\"form-label\">Hora de cierre<\/label>\n                                        <input name=\"hora_cierre\" id=\"hora_cierre\" type=\"time\" class=\"form-input\" \/>\n                                    <\/div>\n                                <\/div>\n                            <\/div>\n\n                            <!-- Secci\u00f3n: Publicaci\u00f3n (visibilidad) -->\n                            <div class=\"form-section\" data-accent=\"publish\">\n                                <h3>\n                                    <span class=\"section-icon\" aria-hidden=\"true\">\n                                        <svg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\"\n                                            stroke-linecap=\"round\" stroke-linejoin=\"round\">\n                                            <path d=\"M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z\" \/>\n                                            <circle cx=\"12\" cy=\"12\" r=\"3\" \/>\n                                        <\/svg>\n                                    <\/span>\n                                    Visibilidad en la app\n                                    <span class=\"section-step\">Paso 5 \/ 6<\/span>\n                                <\/h3>\n\n                                <div class=\"grid grid-cols-1 md:grid-cols-2 gap-4\">\n                                    <div>\n                                        <label class=\"form-label\">Visible desde *<\/label>\n                                        <input name=\"publicar_desde\" id=\"publicar_desde\" type=\"date\" class=\"form-input\"\n                                            required \/>\n                                        <p class=\"text-xs text-gray-600 mt-1\">\ud83d\udccc Desde qu\u00e9 d\u00eda quieres que aparezca en\n                                            la app<\/p>\n                                    <\/div>\n\n                                    <div>\n                                        <label class=\"form-label\">Visible hasta<\/label>\n                                        <input name=\"publicar_hasta\" id=\"publicar_hasta\" type=\"date\"\n                                            class=\"form-input\" \/>\n                                        <p class=\"text-xs text-gray-600 mt-1\">\ud83d\udccc Si lo dejas vac\u00edo, se usar\u00e1 la fecha\n                                            fin del evento (o inicio si no hay fin)<\/p>\n                                    <\/div>\n                                <\/div>\n\n                                <div class=\"quote-card\" role=\"status\" aria-live=\"polite\">\n                                    <div class=\"quote-card__row\">\n                                        <div>\n                                            <div class=\"quote-card__label\">Duraci\u00f3n estimada<\/div>\n                                            <div class=\"quote-card__value\"><span id=\"quote-dias\">&#8211;<\/span> d\u00edas<\/div>\n                                        <\/div>\n                                        <div style=\"text-align:right\">\n                                            <div class=\"quote-card__label\">Elige al pagar<\/div>\n                                            <div class=\"quote-card__value\"\n                                                style=\"font-size:13px; color:#64748b; font-weight:600\">2 paquetes\n                                                disponibles<\/div>\n                                        <\/div>\n                                    <\/div>\n\n                                    <div style=\"display:grid; grid-template-columns:1fr 1fr; gap:10px; margin-top:12px\">\n                                        <div\n                                            style=\"padding:10px 12px; background:#fff; border:1px solid #e2e8f0; border-radius:10px\">\n                                            <div\n                                                style=\"font-size:11px; font-weight:700; color:#64748b; text-transform:uppercase; letter-spacing:.04em\">\n                                                Listado por inter\u00e9s<\/div>\n                                            <div style=\"font-size:11px; color:#94a3b8; margin-top:2px\"><span\n                                                    id=\"quote-price-listado\">&#8211;<\/span> MXN \/ d\u00eda<\/div>\n                                            <div style=\"font-size:16px; font-weight:800; color:#0f6f5d; margin-top:4px\"\n                                                id=\"quote-total-listado\">&#8211;<\/div>\n                                        <\/div>\n                                        <div\n                                            style=\"padding:10px 12px; background:#fff; border:1px solid #c7d2fe; border-radius:10px\">\n                                            <div\n                                                style=\"font-size:11px; font-weight:700; color:#4338ca; text-transform:uppercase; letter-spacing:.04em\">\n                                                Carrusel destacado<\/div>\n                                            <div style=\"font-size:11px; color:#6366f1; margin-top:2px\"><span\n                                                    id=\"quote-price-carrusel\">&#8211;<\/span> MXN \/ d\u00eda<\/div>\n                                            <div style=\"font-size:16px; font-weight:800; color:#4338ca; margin-top:4px\"\n                                                id=\"quote-total-carrusel\">&#8211;<\/div>\n                                        <\/div>\n                                    <\/div>\n\n                                    <div class=\"quote-card__meta\" id=\"quote-rango\" style=\"margin-top:10px\">Rango de\n                                        cobro: &#8211;<\/div>\n                                    <div class=\"quote-card__meta\" style=\"color: var(--app-text-soft)\">* C\u00e1lculo\n                                        inclusivo: el \u00faltimo d\u00eda S\u00cd cuenta. Puedes pagar uno o ambos paquetes de\n                                        publicidad despu\u00e9s de aprobar.<\/div>\n                                <\/div>\n                            <\/div>\n\n                            <!-- Secci\u00f3n: Costo y Boletos -->\n                            <div class=\"form-section\" data-accent=\"price\">\n                                <h3>\n                                    <span class=\"section-icon\" aria-hidden=\"true\">\n                                        <svg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\"\n                                            stroke-linecap=\"round\" stroke-linejoin=\"round\">\n                                            <line x1=\"12\" y1=\"1\" x2=\"12\" y2=\"23\" \/>\n                                            <path d=\"M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6\" \/>\n                                        <\/svg>\n                                    <\/span>\n                                    Costo y Boletos\n                                    <span class=\"section-step\">Paso 6 \/ 6<\/span>\n                                <\/h3>\n\n                                <div class=\"grid grid-cols-1 lg:grid-cols-2 gap-4\">\n                                    <div>\n                                        <label class=\"form-label\">Costo \/ Precio<\/label>\n                                        <input name=\"costo\" id=\"costo\" type=\"text\" class=\"form-input\"\n                                            placeholder=\"Ej: Gratis, $100, $50-$200\" \/>\n                                        <p class=\"text-xs text-gray-600 mt-1\">Indica el costo o rango de precios<\/p>\n                                    <\/div>\n\n                                    <div>\n                                        <label class=\"form-label\">\u00bfD\u00f3nde comprar boletos?<\/label>\n                                        <input name=\"boletos\" id=\"boletos\" class=\"form-input\"\n                                            placeholder=\"Ej: Ticketmaster, taquilla del lugar, www.ejemplo.com\" \/>\n                                        <p class=\"text-xs text-gray-600 mt-1\">URL o lugar donde conseguir boletos<\/p>\n                                    <\/div>\n                                <\/div>\n                            <\/div>\n\n                            <!-- Action bar: wizard nav + guardar\/enviar\/cancelar -->\n                            <div class=\"action-bar\">\n                                <div class=\"action-nav\">\n                                    <button type=\"button\" class=\"action-secondary\" id=\"btn-prev\" onclick=\"wizardPrev()\"\n                                        style=\"display:none\">\n                                        <svg width=\"16\" height=\"16\" viewBox=\"0 0 24 24\" fill=\"none\"\n                                            stroke=\"currentColor\" stroke-width=\"2.3\" stroke-linecap=\"round\"\n                                            stroke-linejoin=\"round\" aria-hidden=\"true\">\n                                            <polyline points=\"15 18 9 12 15 6\" \/>\n                                        <\/svg>\n                                        <span>Anterior<\/span>\n                                    <\/button>\n                                    <button type=\"button\" class=\"action-secondary\" id=\"btn-next\" onclick=\"wizardNext()\">\n                                        <span>Siguiente<\/span>\n                                        <svg width=\"16\" height=\"16\" viewBox=\"0 0 24 24\" fill=\"none\"\n                                            stroke=\"currentColor\" stroke-width=\"2.3\" stroke-linecap=\"round\"\n                                            stroke-linejoin=\"round\" aria-hidden=\"true\">\n                                            <polyline points=\"9 18 15 12 9 6\" \/>\n                                        <\/svg>\n                                    <\/button>\n                                <\/div>\n                                <button type=\"button\" onclick=\"enviarARevision()\" class=\"action-primary\" id=\"btn-enviar\"\n                                    style=\"display:none\">\n                                    <svg width=\"20\" height=\"20\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\"\n                                        stroke-width=\"2.3\" stroke-linecap=\"round\" stroke-linejoin=\"round\"\n                                        aria-hidden=\"true\">\n                                        <path d=\"M22 2 11 13\" \/>\n                                        <path d=\"m22 2-7 20-4-9-9-4Z\" \/>\n                                    <\/svg>\n                                    <span>Enviar a Revisi\u00f3n<\/span>\n                                <\/button>\n                                <button type=\"submit\" class=\"action-ghost\" id=\"btn-guardar\">\n                                    <svg width=\"16\" height=\"16\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\"\n                                        stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"\n                                        aria-hidden=\"true\">\n                                        <path d=\"M19 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11l5 5v11a2 2 0 0 1-2 2z\" \/>\n                                        <polyline points=\"17 21 17 13 7 13 7 21\" \/>\n                                        <polyline points=\"7 3 7 8 15 8\" \/>\n                                    <\/svg>\n                                    <span class=\"btn-label\">Guardar borrador<\/span>\n                                <\/button>\n                                <button type=\"button\" onclick=\"cancelarEdicion()\" class=\"action-link\">\n                                    Cancelar\n                                <\/button>\n                            <\/div>\n                        <\/form>\n                    <\/div>\n                <\/div>\n\n                <!-- Tab: Mis Facturas -->\n                <div id=\"tab-facturas\" class=\"hidden\">\n                    <div class=\"bg-white rounded-xl shadow-lg p-4 sm:p-6\">\n                        <h2 class=\"text-xl font-bold text-gray-800 mb-1\">Mis facturas<\/h2>\n                        <p class=\"text-sm text-gray-500 mb-4\">\n                            Solicita factura CFDI 4.0 de tus pagos capturados. Ventana: 3 dias desde el pago y antes del cierre del mes.\n                        <\/p>\n                        <div id=\"facturas-area\" class=\"space-y-3\">\n                            <div class=\"text-sm text-gray-500\">Cambia a esta pestana para cargar tus pagos.<\/div>\n                        <\/div>\n                    <\/div>\n                <\/div>\n            <\/div>\n        <\/div>\n\n        <script>\n            const SUPABASE_URL = \"https:\/\/rwmemutdnkwufokiaosz.supabase.co\";\n            const SUPABASE_ANON = \"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6InJ3bWVtdXRkbmt3dWZva2lhb3N6Iiwicm9sZSI6ImFub24iLCJpYXQiOjE3OTE1ODU0MzEsImV4cCI6MjEwNzE2MTQzMX0.7MgGY28QWiSc9Uep8mubyTgr7ElVJ8rEmnwxkznixx0\";\n            const BUCKET_NAME = \"imagenes\";\n\n            const sb = supabase.createClient(SUPABASE_URL, SUPABASE_ANON);\n            window.sb = sb;\n            let currentUser = null;\n            let mayorEdadCache = null;\n            let misEventosGlobal = [];\n            let eventoEditando = null;\n            let autocompleteGoogle = null;\n            let PRICE_PER_DAY = null;      \/\/ legacy fallback\n            let EVENT_PRICES = null;        \/\/ { listado, carrusel }\n            let interesesPermitidos = []; \/\/ array de ids v\u00e1lidos (como string)\n            let interesesMapNombre = {};   \/\/ id \u2192 nombre para display\n            let subcategoriasEv = {};     \/\/ keyed by interes_id\n\n            function parseKeywordsInput(raw) {\n                return String(raw || '')\n                    .split(',')\n                    .map(token => token.trim())\n                    .filter(Boolean);\n            }\n\n            function moneyMXN(n) {\n                return new Intl.NumberFormat('es-MX', { style: 'currency', currency: 'MXN' }).format(n);\n            }\n\n            async function cargarPreciosEvento() {\n                if (EVENT_PRICES !== null) return EVENT_PRICES;\n                try {\n                    const { data, error } = await sb.rpc('get_event_prices_mxn');\n                    if (error) {\n                        console.warn('RPC get_event_prices_mxn fall\u00f3, usando legacy:', error.message);\n                    } else if (data && typeof data === 'object') {\n                        const listado = Number(data.listado);\n                        const carrusel = Number(data.carrusel);\n                        if (Number.isFinite(listado) && Number.isFinite(carrusel)) {\n                            EVENT_PRICES = { listado: listado, carrusel: carrusel };\n                            return EVENT_PRICES;\n                        }\n                    }\n                } catch (e) {\n                    console.warn('Excepci\u00f3n cargarPreciosEvento:', e);\n                }\n\n                \/\/ Fallback legacy (si no existe la nueva RPC)\n                try {\n                    const legacy = await sb.rpc('get_event_price_per_day_mxn');\n                    if (!legacy.error && legacy.data !== null && legacy.data !== undefined) {\n                        const v = Number(legacy.data);\n                        EVENT_PRICES = { listado: v, carrusel: v };\n                        return EVENT_PRICES;\n                    }\n                } catch (_) { \/* noop *\/ }\n\n                EVENT_PRICES = null;\n                return null;\n            }\n\n            \/\/ Compatibilidad: c\u00f3digo viejo que llamaba cargarPrecioEvento()\n            async function cargarPrecioEvento() {\n                const p = await cargarPreciosEvento();\n                return p ? p.listado : null;\n            }\n\n            \/\/ ==================== AUTH ====================\n            async function checkAuth() {\n                \/\/ Si la app m\u00f3vil pas\u00f3 tokens por hash, establecer sesi\u00f3n antes de getSession()\n                const hash = window.location.hash.substring(1);\n                if (hash) {\n                    const params = new URLSearchParams(hash);\n                    const accessToken = params.get('access_token');\n                    const refreshToken = params.get('refresh_token');\n                    if (accessToken) {\n                        if (refreshToken) {\n                            const { error: sessErr } = await sb.auth.setSession({ access_token: accessToken, refresh_token: refreshToken });\n                            if (sessErr) {\n                                console.error('setSession failed:', sessErr.message, sessErr);\n                            }\n                        } else {\n                            console.warn('Hash contiene access_token pero NO refresh_token \u2014 login auto no proceder\u00e1.');\n                        }\n                        history.replaceState(null, '', window.location.pathname + window.location.search);\n                    }\n                }\n\n                const { data: { session } } = await sb.auth.getSession();\n                if (session ? session.user : false) {\n                    currentUser = session.user;\n                    mostrarApp();\n                    await manejarRetornoPagoEvento();\n                } else {\n                    mostrarAuth();\n                }\n            }\n\n            function mostrarAuth() {\n                document.getElementById('auth-screen').classList.remove('hidden');\n                document.getElementById('app-screen').classList.add('hidden');\n            }\n\n            function mostrarApp() {\n                document.getElementById('auth-screen').classList.add('hidden');\n                document.getElementById('app-screen').classList.remove('hidden');\n                document.getElementById('user-email').textContent = currentUser.email;\n                cargarIntereses();\n                cargarMisEventos();\n                mostrarTab('lista');\n            }\n\n            async function handleGoogleLogin() {\n                try {\n                    const redirectTo = window.location.origin + window.location.pathname;\n                    const { error } = await sb.auth.signInWithOAuth({\n                        provider: 'google',\n                        options: { redirectTo }\n                    });\n                    if (error) mostrarMensajeAuth(error.message, 'error');\n                } catch (e) {\n                    mostrarMensajeAuth(e.message, 'error');\n                }\n            }\n\n            async function handleLogin() {\n                const email = document.getElementById('login-email').value.trim();\n                const password = document.getElementById('login-password').value;\n\n                if (!email || !password) {\n                    mostrarMensajeAuth('Por favor completa todos los campos', 'error');\n                    return;\n                }\n\n                try {\n                    const { data, error } = await sb.auth.signInWithPassword({ email, password });\n                    if (error) throw error;\n                    currentUser = data.user;\n                    mostrarApp();\n                    await manejarRetornoPagoEvento();\n                } catch (error) {\n                    mostrarMensajeAuth(error.message, 'error');\n                }\n            }\n\n            async function handleLogout() {\n                await sb.auth.signOut();\n                currentUser = null;\n                mayorEdadCache = null;\n                mostrarAuth();\n            }\n\n            function mostrarMensajeAuth(mensaje, tipo) {\n                const div = document.getElementById('auth-message');\n                div.textContent = mensaje;\n                div.className = `mt-4 p-3 rounded-lg text-sm ${tipo === 'error' ? 'bg-red-100 text-red-700' : 'bg-green-100 text-green-700'}`;\n                div.classList.remove('hidden');\n                setTimeout(() => div.classList.add('hidden'), 5000);\n            }\n\n            \/\/ ==================== TABS ====================\n            function mostrarTab(tab) {\n                document.querySelectorAll('.tab-btn').forEach(btn => {\n                    \/\/ Inactive: transparente, texto gris. Active: fondo brand + texto blanco + shadow.\n                    btn.classList.remove('bg-blue-600', 'text-white', 'shadow-md');\n                    btn.classList.add('text-gray-600');\n                    btn.style.background = 'transparent';\n                    btn.style.boxShadow = '';\n                    if (btn.dataset.tab === tab) {\n                        btn.classList.remove('text-gray-600');\n                        btn.classList.add('text-white');\n                        btn.style.background = 'var(--app-primary)';\n                        btn.style.boxShadow = '0 2px 8px rgba(88,193,164,.35)';\n                    }\n                });\n\n                document.getElementById('tab-lista').classList.add('hidden');\n                document.getElementById('tab-nuevo').classList.add('hidden');\n                const tabFactEl = document.getElementById('tab-facturas');\n                if (tabFactEl) tabFactEl.classList.add('hidden');\n                document.getElementById(`tab-${tab}`).classList.remove('hidden');\n\n                if (tab === 'lista') {\n                    cargarMisEventos();\n                } else if (tab === 'nuevo') {\n                    \/\/ \u2705 Solo resetea si NO est\u00e1s editando\n                    if (!eventoEditando) resetFormulario();\n                } else if (tab === 'facturas') {\n                    cargarFacturasPanel();\n                }\n            }\n\n            \/\/ ==================== INTERESES ====================\n            const MAX_INTERESES_PRINCIPALES = 2;\n\n            function enforceMaxIntereses(checkbox) {\n                if (!checkbox.checked) return true;\n                const checked = document.querySelectorAll('.interes-cb:checked');\n                if (checked.length > MAX_INTERESES_PRINCIPALES) {\n                    checkbox.checked = false;\n                    alert('Puedes seleccionar m\u00e1ximo ' + MAX_INTERESES_PRINCIPALES + ' categor\u00edas principales. Desmarca una antes de elegir otra.');\n                    return false;\n                }\n                return true;\n            }\n\n            function toggleSubcatsEv(checkbox, interesId) {\n                if (!enforceMaxIntereses(checkbox)) return;\n                const panel = checkbox.closest('div').querySelector(`.ev-subcats[data-interes=\"${interesId}\"]`);\n                if (!panel) return;\n                if (checkbox.checked) {\n                    panel.style.display = 'flex';\n                } else {\n                    panel.style.display = 'none';\n                    panel.querySelectorAll('input[type=\"checkbox\"]').forEach(cb => cb.checked = false);\n                }\n            }\n\n            async function cargarIntereses(selectedIds = [], selectedSubIds = []) {\n                try {\n                    const [{ data, error }, { data: subData, error: subError }] = await Promise.all([\n                        sb.from('intereses').select('id, nombre').order('orden', { ascending: true }),\n                        sb.from('subcategorias_intereses').select('id, interes_id, nombre').order('orden', { ascending: true })\n                    ]);\n\n                    if (error) throw error;\n                    if (subError) console.warn('Error al cargar subcategor\u00edas:', subError);\n\n                    const intereses = (data || []).filter(r => r.id && r.nombre);\n                    interesesPermitidos = intereses.map(r => String(r.id));\n                    interesesMapNombre = {};\n                    intereses.forEach(r => { interesesMapNombre[String(r.id)] = String(r.nombre).trim(); });\n\n                    subcategoriasEv = {};\n                    (subData || []).forEach(s => {\n                        if (!subcategoriasEv[s.interes_id]) subcategoriasEv[s.interes_id] = [];\n                        subcategoriasEv[s.interes_id].push(s);\n                    });\n\n                    const container = document.getElementById('interes');\n                    if (!container) return;\n\n                    const normIds = selectedIds.map(x => Number(x));\n                    const normSubIds = selectedSubIds.map(x => Number(x));\n\n                    container.innerHTML = intereses.map(r => {\n                        const isChecked = normIds.includes(Number(r.id));\n                        const subs = subcategoriasEv[r.id] || [];\n                        const subsHtml = subs.length === 0 ? '' : `\n                            <div class=\"ev-subcats\" data-interes=\"${r.id}\" style=\"display:${isChecked ? 'flex' : 'none'}; flex-direction:column; gap:2px; padding-left:24px; margin-top:2px;\">\n                                ${subs.map(s => `\n                                    <label style=\"display:flex; align-items:center; gap:6px; cursor:pointer; padding:1px 4px; border-radius:4px;\">\n                                        <input type=\"checkbox\" class=\"subcat-cb\" value=\"${s.id}\" ${normSubIds.includes(Number(s.id)) ? 'checked' : ''} style=\"width:13px; height:13px; cursor:pointer;\" \/>\n                                        <span style=\"font-size:13px; color:#555;\">${String(s.nombre).trim()}<\/span>\n                                    <\/label>\n                                `).join('')}\n                            <\/div>`;\n                        return `\n                            <div>\n                                <label style=\"display:flex; align-items:center; gap:8px; cursor:pointer; padding:2px 4px; border-radius:4px;\">\n                                    <input type=\"checkbox\" class=\"interes-cb\" value=\"${r.id}\" ${isChecked ? 'checked' : ''}\n                                        onchange=\"toggleSubcatsEv(this, ${r.id})\"\n                                        style=\"width:16px; height:16px; cursor:pointer;\" \/>\n                                    <span style=\"font-size:14px\">${String(r.nombre).trim()}<\/span>\n                                    ${subs.length > 0 ? `<span style=\"font-size:11px; color:#aaa;\">(${subs.length})<\/span>` : ''}\n                                <\/label>\n                                ${subsHtml}\n                            <\/div>`;\n                    }).join('');\n                } catch (error) {\n                    console.error('Error cargando intereses:', error);\n                }\n            }\n\n            function esInteresPermitido(idInteres) {\n                const valor = String(idInteres || '').trim();\n                if (!valor) return false;\n                return interesesPermitidos.includes(valor);\n            }\n\n            \/\/ ==================== MIS EVENTOS ====================\n            \/\/ Map submission_id \u2192 ['listado','carrusel'] (tiers ya pagados y aplicados)\n            let tiersPagadosPorSubmission = {};\n\n            const TIER_PRECIOS = { listado: 30, carrusel: 100 };\n            const TIER_LABELS = {\n                listado: 'Listado por inter\u00e9s',\n                carrusel: 'Carrusel destacado'\n            };\n\n            async function cargarMisEventos() {\n                try {\n                    \/\/ Precios centralizados para calcular prorrateos en los cards\n                    await cargarPreciosEvento();\n\n                    const { data, error } = await sb\n                        .from('eventos_submissions')\n                        .select('*, submission_intereses(interes_id, intereses(nombre))')\n                        .eq('creado_por', currentUser.id)\n                        .order('creado_en', { ascending: false });\n\n                    if (error) throw error;\n                    misEventosGlobal = data || [];\n\n                    \/\/ Fetch tiers_activos de eventos ya publicados (lee tabla eventos,\n                    \/\/ RLS p\u00fablica). Para submissions sin evento_id, tiers=[]\n                    tiersPagadosPorSubmission = {};\n                    const eventoIds = misEventosGlobal\n                        .map(s => s.evento_id)\n                        .filter(id => id);\n\n                    if (eventoIds.length) {\n                        const { data: evData, error: evErr } = await sb\n                            .from('eventos')\n                            .select('id, tiers_activos')\n                            .in('id', eventoIds);\n                        if (evErr) {\n                            console.warn('No se pudieron leer eventos:', evErr.message);\n                        } else {\n                            const mapEv = {};\n                            (evData || []).forEach(ev => {\n                                mapEv[ev.id] = Array.isArray(ev.tiers_activos) ? ev.tiers_activos : [];\n                            });\n                            misEventosGlobal.forEach(s => {\n                                if (s.evento_id && mapEv[s.evento_id]) {\n                                    tiersPagadosPorSubmission[s.id] = mapEv[s.evento_id];\n                                }\n                            });\n                        }\n                    }\n\n                    renderizarMisEventos();\n                } catch (error) {\n                    console.error('Error cargando eventos:', error);\n                    document.getElementById('lista-eventos').innerHTML =\n                        `<div class=\"bg-red-50 border border-red-200 rounded-lg p-4 text-red-700\">\n            Error al cargar eventos: ${error.message}\n          <\/div>`;\n                }\n            }\n\n            function filtrarMisEventos() {\n                const search = document.getElementById('search-input').value.toLowerCase();\n                const filtrados = misEventosGlobal.filter(e =>\n                    e.nombre.toLowerCase().includes(search)\n                );\n                renderizarMisEventos(filtrados);\n            }\n\n            function diasRestantesHasta(publicarHastaStr) {\n                if (!publicarHastaStr) return null;\n                const partes = String(publicarHastaStr).split('-').map(Number);\n                if (partes.length !== 3) return null;\n                const hasta = new Date(partes[0], partes[1] - 1, partes[2]);\n                const hoy = new Date();\n                hoy.setHours(0, 0, 0, 0);\n                const dias = Math.floor((hasta - hoy) \/ 86400000) + 1;\n                return dias;\n            }\n\n            const TIER_HOOKS = {\n                listado: {\n                    titulo: 'Llega a m\u00e1s personas',\n                    bullet: 'Aparece en el listado por inter\u00e9s con marca de evento pagado.',\n                    gradient: 'linear-gradient(135deg,#ecfdf5,#d1fae5)',\n                    border: '#6ee7b7',\n                    textColor: '#047857',\n                    icon: '\ud83d\udccb'\n                },\n                carrusel: {\n                    titulo: 'Impulsa tu publicidad',\n                    bullet: 'Aparece primero en el carrusel destacado de tu ciudad.',\n                    gradient: 'linear-gradient(135deg,#eef2ff,#e0e7ff)',\n                    border: '#c7d2fe',\n                    textColor: '#4338ca',\n                    icon: '\ud83d\ude80'\n                }\n            };\n\n            function construirPromoTierFaltante(evento, tiersPagados, tiersFaltantes) {\n                \/\/ Solo cuando evento ya publicado y faltan tiers\n                if (evento.estado !== 'publicado') return '';\n                if (!tiersFaltantes || tiersFaltantes.length === 0) return '';\n                if (!EVENT_PRICES) return '';\n\n                const dias = diasRestantesHasta(evento.publicar_hasta);\n                if (dias === null || dias <= 0) {\n                    return '<div style=\"margin-top:8px; padding:8px 10px; background:#f1f5f9; border:1px solid #e2e8f0; border-radius:8px; font-size:12px; color:#64748b\">Ventana de publicaci\u00f3n terminada. Ya no se puede mejorar la publicidad de este evento.<\/div>';\n                }\n\n                const bloques = tiersFaltantes.map(tier => {\n                    const precioDia = EVENT_PRICES[tier];\n                    if (!Number.isFinite(precioDia)) return '';\n                    const total = Math.round(dias * precioDia * 100) \/ 100;\n                    const hook = TIER_HOOKS[tier];\n                    return `\n                        <div style=\"padding:10px 12px; background:${hook.gradient}; border:1px solid ${hook.border}; border-radius:10px; margin-top:8px\">\n                          <div style=\"display:flex; align-items:center; justify-content:space-between; gap:8px; flex-wrap:wrap\">\n                            <div style=\"font-size:13px; font-weight:700; color:${hook.textColor}\">\n                              ${hook.icon} ${hook.titulo} con <span style=\"text-decoration:underline\">${TIER_LABELS[tier]}<\/span>\n                            <\/div>\n                            <div style=\"font-size:15px; font-weight:800; color:${hook.textColor}\">\n                              ${moneyMXN(total)}\n                            <\/div>\n                          <\/div>\n                          <div style=\"font-size:11px; color:#475569; margin-top:4px\">\n                            ${hook.bullet} Solo pagas <span style=\"font-weight:700\">${dias} d\u00edas restantes<\/span> por $${precioDia.toFixed(2)}\/d\u00eda.\n                          <\/div>\n                        <\/div>`;\n                });\n\n                return bloques.join('');\n            }\n\n            function renderizarMisEventos(eventos = misEventosGlobal) {\n                const container = document.getElementById('lista-eventos');\n\n                if (!eventos || eventos.length === 0) {\n                    container.innerHTML = `\n          <div class=\"app-card p-8 text-center\">\n            <div class=\"app-brand-mark\" style=\"width:56px; height:56px; margin:0 auto 16px; border-radius:16px; opacity:.9\">\n              <svg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" style=\"width:28px; height:28px\"><rect x=\"3\" y=\"4\" width=\"18\" height=\"18\" rx=\"2\" ry=\"2\"\/><line x1=\"16\" y1=\"2\" x2=\"16\" y2=\"6\"\/><line x1=\"8\" y1=\"2\" x2=\"8\" y2=\"6\"\/><line x1=\"3\" y1=\"10\" x2=\"21\" y2=\"10\"\/><line x1=\"12\" y1=\"14\" x2=\"12\" y2=\"18\"\/><line x1=\"10\" y1=\"16\" x2=\"14\" y2=\"16\"\/><\/svg>\n            <\/div>\n            <h3 class=\"text-lg font-bold text-gray-800 mb-1\">A\u00fan no tienes eventos<\/h3>\n            <p class=\"text-sm text-gray-500 mb-5\">Crea tu primer evento para publicarlo en Saca Plan.<\/p>\n            <button onclick=\"mostrarTab('nuevo')\" class=\"btn-primary\" style=\"max-width:260px; margin:0 auto; display:inline-block\">Crear mi primer evento<\/button>\n          <\/div>`;\n                    return;\n                }\n\n                container.innerHTML = eventos.map(evento => {\n                    const puedeEditar = ['borrador', 'rechazado'].includes(evento.estado);\n                    const puedeEnviar = ['borrador', 'rechazado'].includes(evento.estado);\n                    const puedeEliminar = ['borrador', 'rechazado', 'en_revision', 'aprobado'].includes(evento.estado);\n                    const tiersPagados = tiersPagadosPorSubmission[evento.id] || [];\n                    const tiersFaltantes = ['listado', 'carrusel'].filter(t => tiersPagados.indexOf(t) === -1);\n                    let puedePagar = false;\n                    if (['aprobado', 'publicado'].includes(evento.estado)) {\n                        if (tiersFaltantes.length > 0) {\n                            puedePagar = true;\n                        }\n                    }\n                    const chipTiersPagados = tiersPagados.length\n                        ? `<span class=\"inline-block text-[11px] font-semibold text-emerald-700 bg-emerald-50 border border-emerald-200 px-2 py-0.5 rounded-full ml-1\">\u2713 ${tiersPagados.map(t => TIER_LABELS[t]).join(' + ')}<\/span>`\n                        : '';\n                    const btnPagarLabel = tiersPagados.length === 0\n                        ? 'Pagar'\n                        : 'Mejorar anuncio';\n\n                    \/\/ Promo tier faltante: c\u00e1lculo prorrateado para evento publicado\n                    const promoFaltanteHtml = construirPromoTierFaltante(evento, tiersPagados, tiersFaltantes);\n                    const imagenUrl = evento.imagen_path\n                        ? `${SUPABASE_URL}\/storage\/v1\/object\/public\/${BUCKET_NAME}\/${evento.imagen_path}`\n                        : `${SUPABASE_URL}\/storage\/v1\/object\/public\/${BUCKET_NAME}\/defaults\/placeholder.jpeg`;\n                    const intereses = (evento.submission_intereses || []).map(x => x.intereses?.nombre).filter(Boolean);\n\n                    return `\n          <article class=\"evento-card-pro flex gap-3 sm:gap-4 p-3 sm:p-4\">\n            <div class=\"shrink-0 relative\" style=\"width:92px; height:92px\">\n              <img decoding=\"async\" src=\"${imagenUrl}\" class=\"w-full h-full object-cover rounded-xl\" alt=\"${evento.nombre}\" loading=\"lazy\" \/>\n            <\/div>\n            <div class=\"flex-1 min-w-0 flex flex-col\">\n              <div class=\"flex items-start justify-between gap-2 mb-1\">\n                <h3 class=\"text-base sm:text-lg font-bold text-gray-800 leading-tight truncate\" style=\"letter-spacing:-0.015em\">${evento.nombre}<\/h3>\n                <span class=\"badge badge-${evento.estado} shrink-0\">${formatearEstado(evento.estado)}<\/span>\n              <\/div>\n              ${intereses.length ? `<div class=\"flex flex-wrap gap-1 mb-2\">${intereses.slice(0, 3).map(n => `<span class=\"inline-block text-[11px] font-semibold text-gray-600 bg-gray-100 border border-gray-200 px-2 py-0.5 rounded-full\">${n}<\/span>`).join('')}${intereses.length > 3 ? `<span class=\"text-[11px] text-gray-500 self-center\">+${intereses.length - 3}<\/span>` : ''}${chipTiersPagados}<\/div>` : (chipTiersPagados ? `<div class=\"flex flex-wrap gap-1 mb-2\">${chipTiersPagados}<\/div>` : '')}\n              <div class=\"flex flex-wrap items-center gap-x-3 gap-y-1 text-xs sm:text-sm text-gray-500 mb-1\">\n                <span class=\"inline-flex items-center gap-1.5\">\n                  <svg width=\"13\" height=\"13\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><rect x=\"3\" y=\"4\" width=\"18\" height=\"18\" rx=\"2\" ry=\"2\"\/><line x1=\"16\" y1=\"2\" x2=\"16\" y2=\"6\"\/><line x1=\"8\" y1=\"2\" x2=\"8\" y2=\"6\"\/><line x1=\"3\" y1=\"10\" x2=\"21\" y2=\"10\"\/><\/svg>\n                  ${formatearFecha(evento.fecha_inicio)}${evento.fecha_fin ? ' \u2013 ' + formatearFecha(evento.fecha_fin) : ''}\n                <\/span>\n                <span class=\"inline-flex items-center gap-1.5 truncate\" title=\"${evento.ciudad_label || evento.ciudad || ''}\">\n                  <svg width=\"13\" height=\"13\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M21 10c0 7-9 13-9 13s-9-6-9-13a9 9 0 0 1 18 0z\"\/><circle cx=\"12\" cy=\"10\" r=\"3\"\/><\/svg>\n                  ${evento.ciudad_label || evento.ciudad || 'Sin ubicaci\u00f3n'}\n                <\/span>\n              <\/div>\n              ${evento.estado === 'rechazado' && evento.razon_rechazo ? `<p class=\"text-xs sm:text-sm text-red-600 mt-1 mb-1\"><strong>Rechazo:<\/strong> ${evento.razon_rechazo}<\/p>` : ''}\n              ${promoFaltanteHtml}\n              <div class=\"flex flex-wrap gap-1.5 mt-2\">\n                ${puedeEditar ? `<button onclick=\"editarEvento(${evento.id})\" class=\"text-xs font-semibold text-gray-700 bg-white border border-gray-300 hover:border-gray-500 px-3 py-1.5 rounded-full transition-colors\">Editar<\/button>` : ''}\n                ${puedeEnviar ? `<button onclick=\"enviarDirectoARevision(${evento.id})\" class=\"text-xs font-semibold text-white px-3 py-1.5 rounded-full transition-colors\" style=\"background: var(--app-primary); box-shadow: 0 2px 6px rgba(88,193,164,.3)\">Enviar<\/button>` : ''}\n                ${puedeEliminar ? `<button onclick=\"eliminarEvento(${evento.id}, '${evento.estado}')\" class=\"text-xs font-semibold text-red-600 bg-white border border-red-200 hover:bg-red-50 px-3 py-1.5 rounded-full transition-colors\">Eliminar<\/button>` : ''}\n                ${puedePagar ? `<button onclick=\"pagarEvento(${evento.id})\" class=\"text-xs font-semibold text-white px-3 py-1.5 rounded-full transition-colors inline-flex items-center gap-1.5\" style=\"background:linear-gradient(135deg,#8b5cf6,#6366f1); box-shadow: 0 2px 8px rgba(139,92,246,.35)\"><svg width=\"12\" height=\"12\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><rect x=\"2\" y=\"6\" width=\"20\" height=\"12\" rx=\"2\"\/><line x1=\"2\" y1=\"10\" x2=\"22\" y2=\"10\"\/><\/svg>${btnPagarLabel}<\/button>` : ''}\n              <\/div>\n            <\/div>\n          <\/article>`;\n                }).join('');\n            }\n\n            function formatearEstado(estado) {\n                const estados = {\n                    'borrador': 'Borrador',\n                    'enviado': 'Enviado',\n                    'en_revision': 'En Revisi\u00f3n',\n                    'aprobado': 'Aprobado',\n                    'rechazado': 'Rechazado',\n                    'publicado': 'Publicado'\n                };\n                return estados[estado] || estado;\n            }\n\n            function formatearFecha(fecha) {\n                if (!fecha) return '';\n                \/\/ DATE puro YYYY-MM-DD \u2192 parsear local, NO UTC\n                \/\/ (new Date('2026-11-02') se interpreta UTC y en UTC-6 muestra nov 1)\n                const base = String(fecha).split('T')[0];\n                const partes = base.split('-');\n                if (partes.length === 3) {\n                    const yyyy = Number(partes[0]);\n                    const mm = Number(partes[1]);\n                    const dd = Number(partes[2]);\n                    if (yyyy && mm && dd) {\n                        return new Date(yyyy, mm - 1, dd).toLocaleDateString('es-MX', {\n                            year: 'numeric',\n                            month: 'short',\n                            day: 'numeric'\n                        });\n                    }\n                }\n                return new Date(fecha).toLocaleDateString('es-MX', {\n                    year: 'numeric',\n                    month: 'short',\n                    day: 'numeric'\n                });\n            }\n\n            \/\/ ==================== WIZARD ====================\n            let wizardStep = 1;\n            const WIZARD_TOTAL = 6;\n            let formBusy = false;\n\n            function wizardShow(n) {\n                wizardStep = Math.max(1, Math.min(WIZARD_TOTAL, n));\n                const sections = document.querySelectorAll('#evento-form .form-section');\n                sections.forEach((s, i) => s.classList.toggle('active', i + 1 === wizardStep));\n\n                const cur = document.getElementById('wizard-step-current');\n                const fill = document.getElementById('wizard-progress-fill');\n                if (cur) cur.textContent = String(wizardStep);\n                if (fill) fill.style.width = `${(wizardStep \/ WIZARD_TOTAL) * 100}%`;\n\n                const btnPrev = document.getElementById('btn-prev');\n                const btnNext = document.getElementById('btn-next');\n                const btnEnviar = document.getElementById('btn-enviar');\n                if (btnPrev) btnPrev.style.display = wizardStep === 1 ? 'none' : 'inline-flex';\n                if (btnNext) btnNext.style.display = wizardStep === WIZARD_TOTAL ? 'none' : 'inline-flex';\n                if (btnEnviar) btnEnviar.style.display = wizardStep === WIZARD_TOTAL ? 'inline-flex' : 'none';\n\n                document.getElementById('evento-form')?.scrollIntoView({ behavior: 'smooth', block: 'start' });\n            }\n\n            function wizardValidateCurrent() {\n                const active = document.querySelector('#evento-form .form-section.active');\n                if (!active) return true;\n\n                const requireds = active.querySelectorAll('input[required], textarea[required], select[required]');\n                for (const el of requireds) {\n                    if (!el.checkValidity()) {\n                        el.reportValidity();\n                        return false;\n                    }\n                }\n\n                if (wizardStep === 1) {\n                    const checked = document.querySelectorAll('.interes-cb:checked');\n                    if (!checked.length) {\n                        alert('\u26a0\ufe0f Selecciona al menos un inter\u00e9s para continuar.');\n                        return false;\n                    }\n                    if (checked.length > MAX_INTERESES_PRINCIPALES) {\n                        alert('\u26a0\ufe0f M\u00e1ximo ' + MAX_INTERESES_PRINCIPALES + ' categor\u00edas principales. Desmarca algunas antes de continuar.');\n                        return false;\n                    }\n                }\n\n                if (wizardStep === 3) {\n                    const lat = document.getElementById('latitud')?.value;\n                    const lng = document.getElementById('longitud')?.value;\n                    const ciudadKey = document.getElementById('ciudad_key')?.value;\n                    if (!lat || !lng || !ciudadKey) {\n                        alert('\u26a0\ufe0f Debes seleccionar la ubicaci\u00f3n desde el autocompletado de Google Maps.');\n                        return false;\n                    }\n                }\n\n                return true;\n            }\n\n            function wizardNext() {\n                if (!wizardValidateCurrent()) return;\n                wizardShow(wizardStep + 1);\n            }\n\n            function wizardPrev() {\n                wizardShow(wizardStep - 1);\n            }\n\n            function setFormBusy(busy) {\n                formBusy = busy;\n                ['btn-prev', 'btn-next', 'btn-enviar', 'btn-guardar'].forEach(id => {\n                    const el = document.getElementById(id);\n                    if (el) {\n                        el.disabled = busy;\n                        if (busy) el.setAttribute('disabled', '');\n                        else el.removeAttribute('disabled');\n                    }\n                });\n            }\n\n            \/\/ ==================== FORMULARIO ====================\n            function resetFormulario() {\n                eventoEditando = null;\n                document.getElementById('form-titulo').textContent = 'Nuevo Evento';\n                document.getElementById('evento-form').reset();\n                document.getElementById('evento-id').value = '';\n                document.getElementById('imagen-preview').classList.add('hidden');\n                { const lbl = document.querySelector('#btn-guardar .btn-label'); if (lbl) lbl.textContent = 'Guardar borrador'; }\n                document.getElementById('btn-enviar').classList.remove('hidden');\n                document.getElementById('imagen-file').value = '';\n\n                \/\/ defaults de publicaci\u00f3n\n                const hoy = new Date();\n                const yyyy = hoy.getFullYear();\n                const mm = String(hoy.getMonth() + 1).padStart(2, '0');\n                const dd = String(hoy.getDate()).padStart(2, '0');\n                const hoyStr = `${yyyy}-${mm}-${dd}`;\n\n                document.getElementById('publicar_desde').value = hoyStr;\n                document.getElementById('publicar_hasta').value = '';\n\n                actualizarCotizacionUI();\n                wizardShow(1);\n            }\n\n            async function editarEvento(eventoId) {\n                try {\n                    const { data, error } = await sb\n                        .from('eventos_submissions')\n                        .select('*, submission_intereses(interes_id), submission_subcategorias(subcategoria_id)')\n                        .eq('id', eventoId)\n                        .single();\n\n                    if (error) throw error;\n\n                    if (!['borrador', 'rechazado'].includes(data.estado)) {\n                        alert('Este evento no se puede editar en este estado.');\n                        return;\n                    }\n\n                    eventoEditando = data;\n                    document.getElementById('form-titulo').textContent = 'Editar Evento';\n                    document.getElementById('evento-id').value = data.id;\n\n                    \/\/ Llenar formulario\n                    document.getElementById('nombre').value = data.nombre || '';\n                    document.getElementById('descripcion').value = data.descripcion || '';\n                    document.getElementById('keywords').value = Array.isArray(data.keywords) ? data.keywords.join(', ') : '';\n                    await cargarIntereses(\n                        (data.submission_intereses || []).map(x => x.interes_id),\n                        (data.submission_subcategorias || []).map(x => x.subcategoria_id)\n                    );\n                    document.getElementById('ubicacion').value = data.ubicacion || '';\n                    document.getElementById('lugar').value = data.lugar || '';\n                    document.getElementById('ciudad').value = data.ciudad_label || data.ciudad || '';\n                    document.getElementById('latitud').value = data.latitud || '';\n                    document.getElementById('longitud').value = data.longitud || '';\n                    document.getElementById('place_id').value = data.place_id || '';\n                    document.getElementById('ciudad_key').value = data.ciudad_key || '';\n                    document.getElementById('ciudad_label').value = data.ciudad_label || '';\n                    document.getElementById('ciudad_place_id').value = data.ciudad_place_id || '';\n                    document.getElementById('fecha_inicio').value = data.fecha_inicio || '';\n                    document.getElementById('fecha_fin').value = data.fecha_fin || '';\n                    document.getElementById('hora').value = formatearHora(data.hora);\n                    document.getElementById('hora_apertura_puerta').value = formatearHora(data.hora_apertura_puerta);\n                    document.getElementById('hora_cierre').value = formatearHora(data.hora_cierre);\n                    document.getElementById('costo').value = data.costo || '';\n                    document.getElementById('boletos').value = data.boletos || '';\n                    document.getElementById('publicar_desde').value = data.publicar_desde || data.fecha_inicio || '';\n                    document.getElementById('publicar_hasta').value = data.publicar_hasta || '';\n                    actualizarCotizacionUI();\n\n                    if (data.imagen_path) {\n                        const imagenUrl = `${SUPABASE_URL}\/storage\/v1\/object\/public\/${BUCKET_NAME}\/${data.imagen_path}`;\n                        document.getElementById('imagen-preview-img').src = imagenUrl;\n                        document.getElementById('imagen-preview').classList.remove('hidden');\n                    } else {\n                        document.getElementById('imagen-preview').classList.add('hidden');\n                    }\n\n                    mostrarTab('nuevo');\n                    wizardShow(1);\n                } catch (error) {\n                    alert('Error al cargar evento: ' + error.message);\n                }\n            }\n\n\n            function formatearHora(hora) {\n                if (!hora) return '';\n                return hora.substring(0, 5); \/\/ HH:MM\n            }\n\n            function cancelarEdicion() {\n                resetFormulario();\n                mostrarTab('lista');\n            }\n\n            async function eliminarEvento(eventoId, estado = 'borrador') {\n                const mensajes = {\n                    borrador: '\u00bfEliminar este evento borrador?',\n                    rechazado: '\u00bfEliminar este evento rechazado?',\n                    en_revision: '\u26a0\ufe0f Este evento est\u00e1 en revisi\u00f3n por el equipo.\\n\\n\u00bfSeguro que quieres cancelarlo y eliminarlo?',\n                    aprobado: '\u26a0\ufe0f Este evento ya fue aprobado y est\u00e1 listo para pagar.\\n\\nSi lo eliminas tendr\u00e1s que volver a crearlo y enviarlo a revisi\u00f3n.\\n\\n\u00bfEliminar de todos modos?'\n                };\n                const msg = mensajes[estado] || '\u00bfEliminar este evento?';\n                if (!confirm(msg)) return;\n\n                try {\n                    const { data: borrados, error } = await sb\n                        .from('eventos_submissions')\n                        .delete()\n                        .eq('id', eventoId)\n                        .eq('creado_por', currentUser.id)\n                        .select('id');\n\n                    if (error) throw error;\n                    if (!borrados || borrados.length === 0) {\n                        alert('\u274c No se pudo eliminar.\\n\\nLa base de datos no permite borrar en el estado actual (puede ser por pol\u00edtica RLS o porque el evento ya est\u00e1 publicado y vinculado a un cobro). Contacta al admin.');\n                        return;\n                    }\n                    alert('Evento eliminado correctamente');\n                    cargarMisEventos();\n                } catch (error) {\n                    alert('Error al eliminar: ' + (error.message || error));\n                }\n            }\n\n            const _enviandoDirecto = new Set();\n            async function enviarDirectoARevision(eventoId) {\n                if (_enviandoDirecto.has(eventoId)) return;\n                if (!confirm('\u00bfEnviar este evento a revisi\u00f3n?')) return;\n                _enviandoDirecto.add(eventoId);\n\n                try {\n                    const { data, error } = await sb.rpc('enviar_evento_a_revision', {\n                        p_submission_id: eventoId\n                    });\n\n                    if (error) throw error;\n                    if (data !== 'OK') throw new Error(data);\n\n                    alert('\u2705 Evento enviado a revisi\u00f3n');\n                    cargarMisEventos();\n                } catch (error) {\n                    alert('Error: ' + (error.message || error));\n                } finally {\n                    _enviandoDirecto.delete(eventoId);\n                }\n            }\n\n            async function guardarEventoSoloDatos(options = {}) {\n                const { strict = true } = options;\n                const eventoId = document.getElementById('evento-id').value;\n                const formData = new FormData(document.getElementById('evento-form'));\n\n                \/\/ Gate 18+ antes de INSERT\/UPDATE en eventos_submissions.\n                \/\/ RLS policy mayor_edad_check_eventos_submissions bloquea INSERT\n                \/\/ si mayor_edad!=true. Cache impide re-pregunta.\n                const okEdad = await asegurarMayorEdad();\n                if (!okEdad) throw new Error('VALIDATION');\n\n                const fechaInicio = formData.get('fecha_inicio') || null;\n                const fechaFin = formData.get('fecha_fin') || null;\n                const publicarDesde = formData.get('publicar_desde') || null;\n                const publicarHastaCapturada = formData.get('publicar_hasta') || null;\n                \/\/ Guardar literal: si usuario dej\u00f3 vac\u00edo, va null. Edge\/RPC hacen fallback a fecha_fin.\n                const publicarHastaParaBD = publicarHastaCapturada;\n\n                const interesesSeleccionados = [...document.querySelectorAll('.interes-cb:checked')].map(cb => parseInt(cb.value));\n                const subcategoriasSeleccionadas = [...document.querySelectorAll('.subcat-cb:checked')].map(cb => parseInt(cb.value));\n\n                if (interesesSeleccionados.length > MAX_INTERESES_PRINCIPALES) {\n                    alert('\u26a0\ufe0f M\u00e1ximo ' + MAX_INTERESES_PRINCIPALES + ' categor\u00edas principales\\n\\nDesmarca algunas antes de guardar.');\n                    throw new Error('VALIDATION');\n                }\n                const data = {\n                    nombre: formData.get('nombre'),\n                    descripcion: formData.get('descripcion'),\n                    keywords: parseKeywordsInput(formData.get('keywords')),\n                    ubicacion: formData.get('ubicacion'),\n                    lugar: formData.get('lugar'),\n                    ciudad: formData.get('ciudad'), \/\/ opcional\n                    ciudad_key: formData.get('ciudad_key'),\n                    ciudad_label: formData.get('ciudad_label'),\n                    ciudad_place_id: formData.get('ciudad_place_id'),\n                    latitud: parseFloat(formData.get('latitud')) || null,\n                    longitud: parseFloat(formData.get('longitud')) || null,\n                    place_id: formData.get('place_id'),\n                    fecha_inicio: fechaInicio,\n                    fecha_fin: fechaFin,\n                    hora: formData.get('hora') || null,\n                    hora_apertura_puerta: formData.get('hora_apertura_puerta') || null,\n                    hora_cierre: formData.get('hora_cierre') || null,\n                    costo: formData.get('costo'),\n                    boletos: formData.get('boletos'),\n                    publicar_desde: publicarDesde,\n                    publicar_hasta: publicarHastaParaBD\n                };\n\n                \/\/ M\u00ednimo imprescindible incluso para borrador: nombre identifica la fila\n                if (!data.nombre || !data.nombre.trim()) {\n                    alert('\u26a0\ufe0f Campo requerido\\n\\nEl nombre del evento es obligatorio aunque sea borrador.');\n                    throw new Error('VALIDATION');\n                }\n\n                if (strict) {\n                    if (interesesSeleccionados.length === 0) {\n                        alert('\u26a0\ufe0f Inter\u00e9s requerido\\n\\nSelecciona al menos un inter\u00e9s de la lista.');\n                        throw new Error('VALIDATION');\n                    }\n                    if (!data.descripcion || !data.descripcion.trim()) {\n                        alert('\u26a0\ufe0f Campo requerido\\n\\nLa descripci\u00f3n del evento es obligatoria.');\n                        throw new Error('VALIDATION');\n                    }\n                    if (!data.ubicacion || !data.ubicacion.trim()) {\n                        alert('\u26a0\ufe0f Ubicaci\u00f3n requerida\\n\\nEscribe y selecciona una ubicaci\u00f3n v\u00e1lida del autocompletado de Google Maps.');\n                        throw new Error('VALIDATION');\n                    }\n                    if (!data.latitud || !data.longitud || !data.ciudad_key || !data.ciudad_label || !data.ciudad_place_id) {\n                        alert('\u26a0\ufe0f Ubicaci\u00f3n incompleta\\n\\nDebes seleccionar la ubicaci\u00f3n desde el autocompletado de Google Maps para obtener coordenadas y ciudad correctamente.\\n\\nBorra el campo y vuelve a escribir para ver las sugerencias.');\n                        throw new Error('VALIDATION');\n                    }\n                    if (!data.fecha_inicio) {\n                        alert('\u26a0\ufe0f Campo requerido\\n\\nLa fecha de inicio es obligatoria.');\n                        throw new Error('VALIDATION');\n                    }\n                    if (!data.publicar_desde) {\n                        alert('\u26a0\ufe0f Campo requerido\\n\\nLa fecha \"Visible desde\" es obligatoria.');\n                        throw new Error('VALIDATION');\n                    }\n                }\n\n                if (publicarHastaCapturada && data.publicar_desde) {\n                    if (publicarHastaCapturada < data.publicar_desde) {\n                        alert('\u26a0\ufe0f Fechas inv\u00e1lidas\\n\\nLa fecha \"Visible hasta\" no puede ser menor que \"Visible desde\".');\n                        throw new Error('VALIDATION');\n                    }\n                }\n\n                \/\/ Confirmaci\u00f3n si no hay imagen \u2014 solo al enviar a revisi\u00f3n\n                const fileInput = document.getElementById('imagen-file');\n                const archivoSeleccionado = fileInput.files ? fileInput.files[0] : null;\n                const tieneImagenExistente = !!(eventoEditando?.imagen_path);\n                if (strict) {\n                    if (!(archivoSeleccionado || tieneImagenExistente)) {\n                        const continuar = confirm('\u26a0\ufe0f Sin imagen\\n\\nEste evento no tiene imagen adjunta. Los eventos con imagen tienen mayor visibilidad.\\n\\n\u00bfDeseas continuar sin imagen?');\n                        if (!continuar) throw new Error('VALIDATION');\n                    }\n                }\n\n                let submissionId = eventoId ? parseInt(eventoId) : null;\n\n                if (submissionId) {\n                    const { error } = await sb\n                        .from('eventos_submissions')\n                        .update(data)\n                        .eq('id', submissionId)\n                        .eq('creado_por', currentUser.id);\n\n                    if (error) throw error;\n                } else {\n                    data.creado_por = currentUser.id;\n                    data.estado = 'borrador'; \/\/ siempre al crear\n                    const { data: newData, error } = await sb\n                        .from('eventos_submissions')\n                        .insert([data])\n                        .select('id')\n                        .single();\n\n                    if (error) throw error;\n                    submissionId = newData.id;\n                }\n\n                \/\/ Actualizar junction table de intereses\n                await sb.from('submission_intereses').delete().eq('submission_id', submissionId);\n                const interesRows = interesesSeleccionados.map(interes_id => ({ submission_id: submissionId, interes_id }));\n                const { error: insErr } = await sb.from('submission_intereses').insert(interesRows);\n                if (insErr) throw insErr;\n\n                \/\/ Actualizar junction table de subcategor\u00edas\n                await sb.from('submission_subcategorias').delete().eq('submission_id', submissionId);\n                if (subcategoriasSeleccionadas.length > 0) {\n                    const subRows = subcategoriasSeleccionadas.map(subcategoria_id => ({ submission_id: submissionId, subcategoria_id }));\n                    const { error: subInsErr } = await sb.from('submission_subcategorias').insert(subRows);\n                    if (subInsErr) throw subInsErr;\n                }\n\n                if (archivoSeleccionado) {\n                    await subirImagen(archivoSeleccionado, submissionId);\n                }\n\n                return submissionId;\n            }\n\n            const RPC_ERR_MSG = {\n                NOT_ALLOWED: 'No tienes permiso para enviar este evento (puede ser que ya no est\u00e9 en borrador o rechazado).',\n                FALTA_NOMBRE: 'Falta el nombre del evento.',\n                FALTA_DESCRIPCION: 'Falta la descripci\u00f3n del evento.',\n                FALTA_FECHA_INICIO: 'Falta la fecha de inicio del evento.',\n                FALTA_UBICACION: 'Falta la ubicaci\u00f3n.',\n                FALTA_COORDENADAS: 'Falta seleccionar la ubicaci\u00f3n en Google Maps (sin coordenadas).',\n                FALTA_CIUDAD: 'Falta la ciudad. Vuelve a seleccionar la ubicaci\u00f3n en Google Maps.',\n                FALTA_PUBLICAR_DESDE: 'Falta la fecha \"Visible desde\".',\n                FALTA_INTERES: 'Debes seleccionar al menos un inter\u00e9s.'\n            };\n\n            async function enviarARevisionRPC(submissionId) {\n                const { data, error } = await sb.rpc('enviar_evento_a_revision', {\n                    p_submission_id: parseInt(submissionId)\n                });\n                if (error) throw error;\n                if (data !== 'OK') {\n                    const amigable = RPC_ERR_MSG[data] || data;\n                    throw new Error(amigable);\n                }\n            }\n\n            \/\/ ==================== VERSI\u00d3N DEL SNIPPET (bump en cada cambio) ====================\n            const PLAN_EVENTOS_VERSION = 'v2026-11-19.03';\n            console.log('%c[plan-eventos] versi\u00f3n cargada: ' + PLAN_EVENTOS_VERSION,\n                'background:#58C1A4; color:#fff; padding:3px 8px; border-radius:4px; font-weight:700');\n\n            \/\/ ==================== IMAGEN: preview con overlay ====================\n            (function instalarPreviewImagen() {\n                const fileInput = document.getElementById('imagen-file');\n                const preview = document.getElementById('imagen-preview');\n                const previewImg = document.getElementById('imagen-preview-img');\n                const overlay = document.getElementById('imagen-upload-overlay');\n                if (!fileInput || !preview || !previewImg || !overlay) return;\n\n                let currentObjectUrl = null;\n\n                async function mostrarPreview(file) {\n                    console.log('[plan-eventos] preview iniciando, size:', file.size, 'type:', file.type);\n\n                    if (currentObjectUrl) {\n                        URL.revokeObjectURL(currentObjectUrl);\n                        currentObjectUrl = null;\n                    }\n\n                    \/\/ Preview visible desde ya: iOS Safari no decodifica imgs ocultas\n                    preview.classList.remove('hidden');\n                    overlay.classList.remove('hidden');\n\n                    \/\/ FileReader base64 \u2014 compat total mobile incluyendo iOS\/HEIC-converted\n                    const dataUrl = await new Promise((resolve, reject) => {\n                        const r = new FileReader();\n                        r.onload = () => resolve(r.result);\n                        r.onerror = () => reject(r.error || new Error('FileReader error'));\n                        r.readAsDataURL(file);\n                    });\n\n                    \/\/ Timeout: si decode nunca termina, forzar ocultar overlay a los 8s\n                    const timeoutId = setTimeout(() => {\n                        console.warn('[plan-eventos] preview timeout 8s, ocultando overlay');\n                        overlay.classList.add('hidden');\n                    }, 8000);\n\n                    previewImg.src = dataUrl;\n\n                    try {\n                        if (typeof previewImg.decode === 'function') {\n                            await previewImg.decode();\n                        } else {\n                            await new Promise((res, rej) => {\n                                previewImg.onload = res;\n                                previewImg.onerror = rej;\n                            });\n                        }\n                        console.log('[plan-eventos] preview listo');\n                    } catch (err) {\n                        console.warn('[plan-eventos] decode fall\u00f3:', err);\n                    } finally {\n                        clearTimeout(timeoutId);\n                        overlay.classList.add('hidden');\n                    }\n                }\n\n                fileInput.addEventListener('change', async (e) => {\n                    const file = e.target.files && e.target.files[0];\n                    if (!file) return;\n\n                    if (!validarImagen(file)) {\n                        fileInput.value = '';\n                        return;\n                    }\n\n                    try {\n                        await mostrarPreview(file);\n                    } catch (err) {\n                        console.error('[plan-eventos] preview error:', err);\n                        overlay.classList.add('hidden');\n                        alert('No se pudo mostrar la vista previa: ' + (err.message || err));\n                    }\n                });\n\n                const btnQuitar = document.getElementById('btn-quitar-imagen');\n                if (btnQuitar) {\n                    btnQuitar.addEventListener('click', async () => {\n                        const confirmar = confirm('\u00bfQuitar la imagen? La imagen es obligatoria para enviar a revisi\u00f3n, deber\u00e1s seleccionar otra antes de enviar.');\n                        if (!confirmar) return;\n\n                        btnQuitar.disabled = true;\n                        const prevLabel = btnQuitar.textContent;\n                        btnQuitar.textContent = 'Quitando...';\n\n                        try {\n                            if (eventoEditando && eventoEditando.imagen_path) {\n                                const pathABorrar = eventoEditando.imagen_path;\n                                const { error: delError } = await sb.storage\n                                    .from(BUCKET_NAME)\n                                    .remove([pathABorrar]);\n                                if (delError) console.warn('[plan-eventos] storage remove warning:', delError);\n\n                                const { error: updError } = await sb\n                                    .from('eventos_submissions')\n                                    .update({ imagen_path: null })\n                                    .eq('id', eventoEditando.id)\n                                    .eq('creado_por', currentUser.id);\n                                if (updError) throw updError;\n\n                                eventoEditando.imagen_path = null;\n                            }\n\n                            if (currentObjectUrl) {\n                                URL.revokeObjectURL(currentObjectUrl);\n                                currentObjectUrl = null;\n                            }\n                            fileInput.value = '';\n                            previewImg.src = '';\n                            preview.classList.add('hidden');\n                            overlay.classList.add('hidden');\n                        } catch (err) {\n                            console.error('[plan-eventos] error al quitar imagen:', err);\n                            alert('Error al quitar imagen: ' + (err.message || err));\n                        } finally {\n                            btnQuitar.disabled = false;\n                            btnQuitar.textContent = prevLabel;\n                        }\n                    });\n                }\n            })();\n\n            \/\/ ==================== SUBMIT FORMULARIO ====================\n            \/\/ Belt-and-suspenders: forzar noValidate + strippear required attrs\n            \/\/ (WP sanitize puede remover novalidate del HTML y mobile Chrome valida igual)\n            (function neutralizarValidacionNativa() {\n                const f = document.getElementById('evento-form');\n                if (!f) return;\n                f.noValidate = true;\n                f.setAttribute('novalidate', 'novalidate');\n                const requireds = f.querySelectorAll('[required]');\n                requireds.forEach(el => {\n                    el.removeAttribute('required');\n                    el.dataset.required = '1'; \/\/ marker opcional por si lo necesitamos luego\n                });\n                console.log('[plan-eventos] validaci\u00f3n nativa desactivada; required stripeados:', requireds.length);\n            })();\n\n            document.getElementById('evento-form').addEventListener('submit', async (e) => {\n                e.preventDefault();\n                if (formBusy) return;\n                setFormBusy(true);\n                try {\n                    await guardarEventoSoloDatos({ strict: false });\n                    alert('\u2705 Evento guardado como borrador');\n                    resetFormulario();\n                    mostrarTab('lista');\n                    cargarMisEventos();\n                } catch (err) {\n                    const errMsg = err ? err.message : null;\n                    if (!err || errMsg !== 'VALIDATION') alert('Error al guardar: ' + (errMsg || err));\n                } finally {\n                    setFormBusy(false);\n                }\n            });\n\n            async function enviarARevision() {\n                if (formBusy) return;\n                setFormBusy(true);\n                try {\n                    \/\/ 1) guarda cambios como borrador\/rechazado (sin tocar estado) \u2014 validaci\u00f3n completa\n                    const submissionId = await guardarEventoSoloDatos({ strict: true });\n                    \/\/ 2) cambia estado por RPC\n                    await enviarARevisionRPC(submissionId);\n                    alert('\u2705 Evento enviado a revisi\u00f3n');\n                    resetFormulario();\n                    mostrarTab('lista');\n                    cargarMisEventos();\n                } catch (err) {\n                    const errMsg = err ? err.message : null;\n                    if (!err || errMsg !== 'VALIDATION') alert('Error al enviar: ' + (errMsg || err));\n                } finally {\n                    setFormBusy(false);\n                }\n            }\n\n            \/\/ ==================== SUBIR IMAGEN ====================\n            async function subirImagen(file, submissionId) {\n                try {\n                    console.log('\ud83d\udce4 Iniciando subida de imagen para submission ID:', submissionId);\n\n                    if (!submissionId) {\n                        throw new Error('No se proporcion\u00f3 submissionId');\n                    }\n\n                    if (!validarImagen(file)) {\n                        console.warn('\u26a0\ufe0f Imagen no v\u00e1lida');\n                        return;\n                    }\n\n                    \/\/ Comprimir\n                    console.log('\ud83d\udd04 Comprimiendo imagen...');\n                    const fileComprimido = await compressToJpg(file, {\n                        maxWidth: 1280,\n                        maxHeight: 1280,\n                        quality: 0.75\n                    });\n                    console.log('\u2705 Imagen comprimida:', fileComprimido.size, 'bytes');\n\n                    \/\/ Path: eventos_submissions\/<uid>\/evento-<id>.jpg\n                    const path = `eventos_submissions\/${currentUser.id}\/evento-${submissionId}.jpg`;\n                    console.log('\ud83d\udcc1 Ruta de destino:', path);\n\n                    \/\/ Subir a storage\n                    console.log('\u2b06\ufe0f Subiendo a Storage...');\n                    const { data: uploadData, error: uploadError } = await sb.storage\n                        .from(BUCKET_NAME)\n                        .upload(path, fileComprimido, {\n                            contentType: 'image\/jpeg',\n                            upsert: true\n                        });\n\n                    if (uploadError) {\n                        console.error('\u274c Error al subir a Storage:', uploadError);\n                        throw uploadError;\n                    }\n                    console.log('\u2705 Subida exitosa a Storage:', uploadData);\n\n                    \/\/ Actualizar registro con el path\n                    console.log('\ud83d\udcbe Actualizando imagen_path en la base de datos...');\n                    const { data: updateData, error: updateError } = await sb\n                        .from('eventos_submissions')\n                        .update({ imagen_path: path })\n                        .eq('id', parseInt(submissionId))\n                        .eq('creado_por', currentUser.id)\n                        .select();\n\n                    if (updateError) {\n                        console.error('\u274c Error al actualizar imagen_path:', updateError);\n                        throw new Error(`Error al actualizar imagen_path: ${updateError.message}`);\n                    }\n\n                    console.log('\u2705 imagen_path actualizado:', updateData);\n                    console.log('\ud83c\udf89 Proceso completo. Ruta guardada:', path);\n                } catch (error) {\n                    console.error('\u274c Error en subirImagen:', error);\n                    throw error; \/\/ Re-lanzar el error para que guardarEvento lo maneje\n                }\n            }\n\n            function validarImagen(file) {\n                const tipos = [\"image\/jpeg\", \"image\/png\", \"image\/webp\"];\n                if (!tipos.includes(file.type)) {\n                    alert(\"Solo se permiten im\u00e1genes JPG, PNG o WEBP\");\n                    return false;\n                }\n                const maxMB = 8;\n                if (file.size > maxMB * 1024 * 1024) {\n                    alert(`La imagen es muy grande. M\u00e1ximo ${maxMB} MB`);\n                    return false;\n                }\n                return true;\n            }\n\n            function loadImageFromFile(file) {\n                return new Promise((resolve, reject) => {\n                    const url = URL.createObjectURL(file);\n                    const img = new Image();\n                    img.onload = () => {\n                        URL.revokeObjectURL(url);\n                        resolve(img);\n                    };\n                    img.onerror = (e) => {\n                        URL.revokeObjectURL(url);\n                        reject(e);\n                    };\n                    img.src = url;\n                });\n            }\n\n            async function compressToJpg(file, { maxWidth = 1600, maxHeight = 1600, quality = 0.8 } = {}) {\n                const img = await loadImageFromFile(file);\n\n                let { width, height } = img;\n                const ratio = Math.min(maxWidth \/ width, maxHeight \/ height, 1);\n                const newW = Math.round(width * ratio);\n                const newH = Math.round(height * ratio);\n\n                const canvas = document.createElement(\"canvas\");\n                canvas.width = newW;\n                canvas.height = newH;\n                const ctx = canvas.getContext(\"2d\");\n\n                ctx.imageSmoothingEnabled = true;\n                ctx.imageSmoothingQuality = \"high\";\n                ctx.fillStyle = \"#ffffff\";\n                ctx.fillRect(0, 0, newW, newH);\n                ctx.drawImage(img, 0, 0, newW, newH);\n\n                const blob = await new Promise((resolve) => {\n                    canvas.toBlob((b) => resolve(b), \"image\/jpeg\", quality);\n                });\n\n                if (!blob) throw new Error(\"No se pudo comprimir la imagen\");\n                return new File([blob], \"imagen.jpg\", { type: \"image\/jpeg\" });\n            }\n\n            \/\/ ==================== GOOGLE PLACES ====================\n            function initGooglePlaces() {\n                const inputUbicacion = document.getElementById(\"ubicacion\");\n                const mapsPlaces = inputUbicacion\n                    ? (window.google\n                        ? (window.google.maps\n                            ? window.google.maps.places\n                            : null)\n                        : null)\n                    : null;\n\n                if (mapsPlaces) {\n                    autocompleteGoogle = new google.maps.places.Autocomplete(inputUbicacion, {\n                        fields: [\"formatted_address\", \"place_id\", \"geometry\", \"address_components\"],\n                        componentRestrictions: { country: \"mx\" }\n                    });\n\n                    \/\/ Limpiar todos los campos de ubicaci\u00f3n si el usuario edita manualmente\n                    inputUbicacion.addEventListener(\"input\", () => {\n                        document.getElementById(\"latitud\").value = \"\";\n                        document.getElementById(\"longitud\").value = \"\";\n                        document.getElementById(\"place_id\").value = \"\";\n                        document.getElementById(\"ciudad\").value = \"\";\n                        document.getElementById(\"ciudad_key\").value = \"\";\n                        document.getElementById(\"ciudad_label\").value = \"\";\n                        document.getElementById(\"ciudad_place_id\").value = \"\";\n                    });\n\n                    autocompleteGoogle.addListener(\"place_changed\", async () => {\n                        const place = autocompleteGoogle.getPlace();\n                        if (!place.geometry) return;\n\n                        inputUbicacion.value = place.formatted_address || '';\n                        document.getElementById(\"latitud\").value = place.geometry.location.lat();\n                        document.getElementById(\"longitud\").value = place.geometry.location.lng();\n                        document.getElementById(\"place_id\").value = place.place_id || '';\n\n                        if (place.address_components) {\n                            let ciudadKey = buildCityKey(place.address_components);\n                            let ciudadLabel = buildCityLabel(place.address_components);\n\n                            const ciudadDB = await resolverCiudad(place.address_components);\n                            if (ciudadDB) { ciudadKey = ciudadDB.ciudad_key; ciudadLabel = ciudadDB.ciudad_label; }\n\n                            document.getElementById(\"ciudad\").value = ciudadLabel;\n                            document.getElementById(\"ciudad_key\").value = ciudadKey;\n                            document.getElementById(\"ciudad_label\").value = ciudadLabel;\n                            document.getElementById(\"ciudad_place_id\").value = place.place_id || '';\n                        }\n                    });\n                }\n            }\n\n            function stripAccents(s) {\n                return (s || \"\").normalize(\"NFD\").replace(\/[\\u0300-\\u036f]\/g, \"\");\n            }\n\n            function slugify(s) {\n                return stripAccents(s)\n                    .toLowerCase()\n                    .trim()\n                    .replace(\/[^a-z0-9]+\/g, \"-\")\n                    .replace(\/-+\/g, \"-\")\n                    .replace(\/^-|-$\/g, \"\");\n            }\n\n            function getComponent(addressComponents, type) {\n                return (addressComponents || []).find(c => (c.types || []).includes(type)) || null;\n            }\n\n            function pickCityName(addressComponents) {\n                const city =\n                    getComponent(addressComponents, \"locality\") ||\n                    getComponent(addressComponents, \"postal_town\") ||\n                    getComponent(addressComponents, \"administrative_area_level_2\");\n                return city ? city.long_name : null;\n            }\n\n            function buildCityKey(addressComponents) {\n                const countryComp = getComponent(addressComponents, \"country\");\n                const stateComp = getComponent(addressComponents, \"administrative_area_level_1\");\n                const country = (countryComp ? countryComp.short_name : null) || \"xx\";\n                const state =\n                    (stateComp ? stateComp.short_name : null)\n                    || (stateComp ? stateComp.long_name : null)\n                    || \"xx\";\n                const cityName = pickCityName(addressComponents) || \"unknown\";\n                return `${slugify(country)}-${slugify(state)}-${slugify(cityName)}`;\n            }\n\n            function buildCityLabel(addressComponents) {\n                const cityName = pickCityName(addressComponents) || \"Ciudad\";\n                const stateComp = getComponent(addressComponents, \"administrative_area_level_1\");\n                const stateShort =\n                    (stateComp ? stateComp.short_name : null)\n                    || (stateComp ? stateComp.long_name : null)\n                    || \"\";\n                return stateShort ? `${cityName} (${stateShort})` : cityName;\n            }\n\n            async function resolverCiudad(components) {\n                const cpComp = (components || []).find(c => c.types.includes(\"postal_code\"));\n                const cp = cpComp ? parseInt(cpComp.long_name, 10) : null;\n\n                if (cp) {\n                    const { data } = await sb.from(\"ciudades\")\n                        .select(\"ciudad_key, ciudad_label\")\n                        .lte(\"cp_inicio\", cp).gte(\"cp_fin\", cp)\n                        .eq(\"activa\", true).maybeSingle();\n                    if (data) return data;\n                }\n\n                const locality = getComponent(components, \"locality\")?.long_name\n                    || getComponent(components, \"administrative_area_level_2\")?.long_name;\n                if (locality) {\n                    const { data } = await sb.from(\"ciudades\")\n                        .select(\"ciudad_key, ciudad_label\")\n                        .contains(\"google_localities\", [locality])\n                        .eq(\"activa\", true).maybeSingle();\n                    if (data) return data;\n                }\n                return null;\n            }\n\n            \/\/ ==================== COTIZACI\u00d3N (D\u00cdAS Y TOTAL) ====================\n            function parseISODate(s) {\n                if (!s) return null;\n                const [y, m, d] = s.split('-').map(Number);\n                return new Date(Date.UTC(y, m - 1, d));\n            }\n\n            function formatISODateDisplay(isoDate) {\n                if (!isoDate) return '-';\n                const [y, m, d] = isoDate.split('-');\n                if (!y || !m || !d) return '-';\n                return `${d}\/${m}\/${y}`;\n            }\n\n            function diffDaysInclusive(aStr, bStr) {\n                const a = parseISODate(aStr);\n                const b = parseISODate(bStr);\n                if (!a || !b) return null;\n                const ms = (b - a);\n                const days = Math.floor(ms \/ (24 * 3600 * 1000)) + 1; \/\/ inclusivo\n                return days;\n            }\n\n            function resolvePublicarHasta({ publicarDesde, publicarHasta, fechaInicio, fechaFin }) {\n                if (publicarHasta) return publicarHasta;\n\n                const fallback = fechaFin || fechaInicio || publicarDesde || null;\n                if (!fallback) return null;\n\n                if (publicarDesde) {\n                    if (fallback < publicarDesde) return publicarDesde;\n                }\n                return fallback;\n            }\n\n            async function actualizarCotizacionUI() {\n                const elPubDesde = document.getElementById('publicar_desde');\n                const elPubHasta = document.getElementById('publicar_hasta');\n                const elFechaInicio = document.getElementById('fecha_inicio');\n                const elFechaFin = document.getElementById('fecha_fin');\n\n                const pubDesde = elPubDesde ? elPubDesde.value : '';\n                const pubHastaInput = elPubHasta ? elPubHasta.value : '';\n\n                const fechaInicio = elFechaInicio ? elFechaInicio.value : '';\n                const fechaFin = elFechaFin ? elFechaFin.value : '';\n                const pubHasta = resolvePublicarHasta({\n                    publicarDesde: pubDesde,\n                    publicarHasta: pubHastaInput,\n                    fechaInicio,\n                    fechaFin\n                });\n\n                const dias = diffDaysInclusive(pubDesde, pubHasta);\n                const diasValidos = Number.isFinite(dias) ? (dias > 0) : false;\n                const elQuoteRango = document.getElementById('quote-rango');\n\n                if (elQuoteRango) {\n                    if (pubDesde) {\n                        if (pubHasta) {\n                            elQuoteRango.textContent = `Rango de cobro: ${formatISODateDisplay(pubDesde)} a ${formatISODateDisplay(pubHasta)}`;\n                        } else {\n                            elQuoteRango.textContent = 'Rango de cobro: -';\n                        }\n                    } else {\n                        elQuoteRango.textContent = 'Rango de cobro: -';\n                    }\n                }\n\n                document.getElementById('quote-dias').textContent = diasValidos ? `${dias}` : '-';\n\n                const elPL = document.getElementById('quote-price-listado');\n                const elPC = document.getElementById('quote-price-carrusel');\n                const elTL = document.getElementById('quote-total-listado');\n                const elTC = document.getElementById('quote-total-carrusel');\n\n                const prices = await cargarPreciosEvento();\n\n                if (prices) {\n                    if (elPL) elPL.textContent = `$${prices.listado.toFixed(2)}`;\n                    if (elPC) elPC.textContent = `$${prices.carrusel.toFixed(2)}`;\n                } else {\n                    if (elPL) elPL.textContent = '-';\n                    if (elPC) elPC.textContent = '-';\n                }\n\n                if (!diasValidos || !prices) {\n                    if (elTL) elTL.textContent = '-';\n                    if (elTC) elTC.textContent = '-';\n                    return;\n                }\n\n                const totalListado = Math.round(dias * prices.listado * 100) \/ 100;\n                const totalCarrusel = Math.round(dias * prices.carrusel * 100) \/ 100;\n                if (elTL) elTL.textContent = moneyMXN(totalListado);\n                if (elTC) elTC.textContent = moneyMXN(totalCarrusel);\n            }\n\n            \/\/ ==================== PAGO PAYPAL ====================\n            async function elegirTierEvento(tiersPagados, submission) {\n                tiersPagados = tiersPagados || [];\n                const prices = await cargarPreciosEvento();\n                const precioListado = prices ? prices.listado : null;\n                const precioCarrusel = prices ? prices.carrusel : null;\n                const fmtPrice = (p) => p === null ? '-' : `$${p.toFixed(2)} MXN \/ d\u00eda`;\n\n                \/\/ Si publicar_desde ya pas\u00f3 \u2192 aviso prorrateo (aplica primer pago tambi\u00e9n).\n                \/\/ Nested ifs para evitar que WP texturize encode operadores\n                let avisoProrrateoHtml = '';\n                if (submission) {\n                    if (submission.publicar_desde) {\n                        if (submission.publicar_hasta) {\n                            const partes = String(submission.publicar_desde).split('-').map(Number);\n                            if (partes.length === 3) {\n                                const pubDesde = new Date(partes[0], partes[1] - 1, partes[2]);\n                                const hoy = new Date();\n                                hoy.setHours(0, 0, 0, 0);\n                                const esAtrasado = pubDesde < hoy;\n                                if (esAtrasado) {\n                                    if (prices) {\n                                        const partesFin = String(submission.publicar_hasta).split('-').map(Number);\n                                        const pubHasta = new Date(partesFin[0], partesFin[1] - 1, partesFin[2]);\n                                        const diasRestantes = Math.floor((pubHasta - hoy) \/ 86400000) + 1;\n                                        if (diasRestantes > 0) {\n                                            avisoProrrateoHtml = `<div style=\"margin-bottom:12px; padding:10px 12px; background:#fef3c7; border:1px solid #fde68a; border-radius:8px; font-size:12px; color:#78350f; font-weight:600\">\u26a0\ufe0f Tu evento comenz\u00f3 el ${formatearFecha(submission.publicar_desde)}. Solo pagas los <span style=\"font-weight:800\">${diasRestantes} d\u00edas restantes<\/span> hasta ${formatearFecha(submission.publicar_hasta)}.<\/div>`;\n                                        }\n                                    }\n                                }\n                            }\n                        }\n                    }\n                }\n\n                return new Promise(function (resolve) {\n                    const existente = document.getElementById('tier-modal-overlay');\n                    if (existente) existente.remove();\n\n                    const overlay = document.createElement('div');\n                    overlay.id = 'tier-modal-overlay';\n                    overlay.className = 'tier-modal-overlay';\n\n                    function optionHtml(tier, title, desc, price) {\n                        return ''\n                            + '<button type=\"button\" class=\"tier-option\" data-tier=\"' + tier + '\">'\n                            + '<div class=\"tier-option-title\">' + title + '<\/div>'\n                            + '<div class=\"tier-option-desc\">' + desc + '<\/div>'\n                            + '<div class=\"tier-option-price\">' + price + '<\/div>'\n                            + '<\/button>';\n                    }\n\n                    const opcionesHtml = [];\n                    if (tiersPagados.indexOf('listado') === -1) {\n                        opcionesHtml.push(optionHtml('listado', 'Listado por inter\u00e9s', 'Aparece en el listado de la categor\u00eda con marca de evento pagado.', fmtPrice(precioListado)));\n                    }\n                    if (tiersPagados.indexOf('carrusel') === -1) {\n                        opcionesHtml.push(optionHtml('carrusel', 'Carrusel destacado', 'Aparece primero en el carrusel de tu ciudad. Cupo limitado por ciudad.', fmtPrice(precioCarrusel)));\n                    }\n\n                    const chipPagados = tiersPagados.length\n                        ? '<div style=\"margin-bottom:14px; padding:8px 12px; background:#ecfdf5; border:1px solid #a7f3d0; border-radius:8px; font-size:12px; color:#047857; font-weight:600\">\u2713 Ya pagado: ' + tiersPagados.map(t => TIER_LABELS[t]).join(', ') + '<\/div>'\n                        : '';\n\n                    const titulo = tiersPagados.length\n                        ? 'Mejora tu anuncio'\n                        : 'Elige c\u00f3mo publicar tu evento';\n                    const sub = tiersPagados.length\n                        ? 'Agrega el paquete que falta para aparecer en listado y carrusel.'\n                        : 'Puedes pagar ambos paquetes para aparecer en listado y carrusel.';\n\n                    overlay.innerHTML = ''\n                        + '<div class=\"tier-modal-card\">'\n                        + '<h3 class=\"tier-modal-title\">' + titulo + '<\/h3>'\n                        + '<p class=\"tier-modal-sub\">' + sub + '<\/p>'\n                        + chipPagados\n                        + avisoProrrateoHtml\n                        + opcionesHtml.join('')\n                        + '<button type=\"button\" class=\"tier-modal-cancel\" data-tier=\"cancel\">Cancelar<\/button>'\n                        + '<\/div>';\n                    document.body.appendChild(overlay);\n\n                    function cerrar(tier) {\n                        overlay.classList.remove('active');\n                        setTimeout(function () { overlay.remove(); }, 60);\n                        resolve(tier);\n                    }\n\n                    overlay.querySelectorAll('button').forEach(function (btn) {\n                        btn.addEventListener('click', function () {\n                            if (btn.disabled) return;\n                            const t = btn.getAttribute('data-tier');\n                            cerrar(t === 'cancel' ? null : t);\n                        });\n                    });\n\n                    overlay.classList.add('active');\n                });\n            }\n\n            function mostrarModalMayorEdad() {\n                return new Promise(function (resolve) {\n                    const existente = document.getElementById('mayor-edad-modal');\n                    if (existente) existente.remove();\n\n                    const overlay = document.createElement('div');\n                    overlay.id = 'mayor-edad-modal';\n                    overlay.className = 'tier-modal-overlay';\n                    overlay.innerHTML = ''\n                        + '<div class=\"tier-modal-card\">'\n                        + '<h3 class=\"tier-modal-title\">Confirmaci\u00f3n de edad<\/h3>'\n                        + '<p class=\"tier-modal-sub\">Confirma que eres mayor de edad para continuar.<\/p>'\n                        + '<label style=\"display:flex; align-items:flex-start; gap:10px; margin:6px 0 16px; cursor:pointer; font-size:13px; color:#0f172a; line-height:1.4;\">'\n                        +   '<input type=\"checkbox\" id=\"chk-mayor-edad\" style=\"margin-top:3px; width:16px; height:16px; cursor:pointer;\" \/>'\n                        +   '<span>Declaro ser mayor de 18 a\u00f1os<\/span>'\n                        + '<\/label>'\n                        + '<button type=\"button\" id=\"btn-mayor-edad-confirm\" class=\"tier-option\" style=\"opacity:0.5; pointer-events:none;\">'\n                        +   '<div class=\"tier-option-title\">Continuar<\/div>'\n                        + '<\/button>'\n                        + '<button type=\"button\" id=\"btn-mayor-edad-cancel\" class=\"tier-modal-cancel\">Cancelar<\/button>'\n                        + '<\/div>';\n                    document.body.appendChild(overlay);\n\n                    const chk = overlay.querySelector('#chk-mayor-edad');\n                    const btnOk = overlay.querySelector('#btn-mayor-edad-confirm');\n                    const btnCancel = overlay.querySelector('#btn-mayor-edad-cancel');\n\n                    function cerrar(resultado) {\n                        overlay.classList.remove('active');\n                        setTimeout(function () { overlay.remove(); }, 60);\n                        resolve(resultado);\n                    }\n\n                    chk.addEventListener('change', function () {\n                        if (chk.checked) {\n                            btnOk.style.opacity = '1';\n                            btnOk.style.pointerEvents = 'auto';\n                            btnOk.style.borderColor = '#58C1A4';\n                            btnOk.style.background = '#f0faf7';\n                        } else {\n                            btnOk.style.opacity = '0.5';\n                            btnOk.style.pointerEvents = 'none';\n                            btnOk.style.borderColor = '#e5e7eb';\n                            btnOk.style.background = '#fff';\n                        }\n                    });\n\n                    btnOk.addEventListener('click', function () {\n                        if (!chk.checked) return;\n                        cerrar(true);\n                    });\n                    btnCancel.addEventListener('click', function () { cerrar(false); });\n\n                    overlay.classList.add('active');\n                });\n            }\n\n            async function asegurarMayorEdad() {\n                if (mayorEdadCache === true) return true;\n                try {\n                    const { data: sessionData } = await sb.auth.getSession();\n                    const userId = sessionData && sessionData.session ? sessionData.session.user.id : null;\n                    if (!userId) return false;\n\n                    if (mayorEdadCache === null) {\n                        const { data: row, error } = await sb\n                            .from('usuarios')\n                            .select('mayor_edad')\n                            .eq('id', userId)\n                            .maybeSingle();\n                        if (!error && row && row.mayor_edad === true) {\n                            mayorEdadCache = true;\n                            return true;\n                        }\n                    }\n\n                    const confirmado = await mostrarModalMayorEdad();\n                    if (!confirmado) return false;\n\n                    const { error: rpcErr } = await sb.rpc('set_mayor_edad');\n                    if (rpcErr) {\n                        alert('No se pudo registrar tu consentimiento: ' + rpcErr.message);\n                        return false;\n                    }\n\n                    mayorEdadCache = true;\n                    return true;\n                } catch (e) {\n                    console.error(e);\n                    alert('Error validando mayoria de edad: ' + (e.message || e));\n                    return false;\n                }\n            }\n\n            async function pagarEvento(submissionId) {\n                try {\n                    const { data: sessionData } = await sb.auth.getSession();\n                    if (!sessionData || !sessionData.session) {\n                        alert('Necesitas iniciar sesi\u00f3n para pagar.');\n                        return;\n                    }\n\n                    const yaPagados = tiersPagadosPorSubmission[submissionId] || [];\n                    const submission = misEventosGlobal.find(e => e.id === submissionId) || null;\n                    const tier = await elegirTierEvento(yaPagados, submission);\n                    if (!tier) return;\n\n                    const okEdad = await asegurarMayorEdad();\n                    if (!okEdad) return;\n\n                    const baseUrl = `${window.location.origin}${window.location.pathname}`;\n                    const returnUrl = `${baseUrl}?tipo=evento`;\n                    const cancelUrl = `${baseUrl}?tipo=evento&cancelado=1`;\n\n                    const { data, error } = await sb.functions.invoke('create_paypal_order_evento', {\n                        body: {\n                            submission_id: Number(submissionId),\n                            tier: tier,\n                            return_url: returnUrl,\n                            cancel_url: cancelUrl,\n                        },\n                    });\n\n                    if (error) {\n                        const msg =\n                            error.message ||\n                            error.details ||\n                            (error.context ? JSON.stringify(error.context) : '') ||\n                            JSON.stringify(error);\n                        throw new Error(msg);\n                    }\n\n                    \/\/ Si el backend logr\u00f3 publicar usando un pago ya capturado, no reenviar a PayPal.\n                    if (data?.status === 'OK' && data?.event_updated === true) {\n                        alert('\u2705 Este evento ya ten\u00eda un pago capturado y se public\u00f3 correctamente.');\n                        await cargarMisEventos();\n                        return;\n                    }\n\n                    if (data?.status === 'CAPTURADO_SIN_APLICAR') {\n                        const detalle = data?.event_error || data?.event_result || 'No se pudo aplicar el pago capturado.';\n                        throw new Error(`Ya existe un pago capturado para este evento, pero no se pudo publicar: ${detalle}`);\n                    }\n\n                    if (!data || !data.approve_url) {\n                        throw new Error('No lleg\u00f3 approve_url. Verifica create_paypal_order_evento.');\n                    }\n\n                    window.location.href = data.approve_url;\n                } catch (e) {\n                    console.error(e);\n                    alert(e.message || e);\n                }\n            }\n\n            function mostrarPagoLoading(msg, step) {\n                let overlay = document.getElementById('pago-loading-overlay');\n                if (!overlay) {\n                    overlay = document.createElement('div');\n                    overlay.id = 'pago-loading-overlay';\n                    overlay.className = 'pago-loading-overlay';\n                    overlay.innerHTML = '<div class=\"pago-loading-content\"><div class=\"pago-loading-spinner\"><\/div><div class=\"pago-loading-msg\" id=\"pago-loading-msg\"><\/div><div class=\"pago-loading-step\" id=\"pago-loading-step\"><\/div><\/div>';\n                    document.body.appendChild(overlay);\n                }\n                document.getElementById('pago-loading-msg').textContent = msg || 'Procesando...';\n                document.getElementById('pago-loading-step').textContent = step || '';\n                overlay.classList.add('active');\n            }\n\n            function ocultarPagoLoading() {\n                const overlay = document.getElementById('pago-loading-overlay');\n                if (overlay) overlay.classList.remove('active');\n            }\n\n            async function manejarRetornoPagoEvento() {\n                const url = new URL(window.location.href);\n                const pagoIdPreview = url.searchParams.get('pago_id');\n                const orderIdPreview = url.searchParams.get('token');\n                const tipoPreview = url.searchParams.get('tipo');\n                const canceladoPreview = url.searchParams.get('cancelado');\n\n                if (!(pagoIdPreview || orderIdPreview)) return;\n                if (tipoPreview ? (tipoPreview !== 'evento') : false) return;\n\n                if (canceladoPreview === '1') {\n                    url.searchParams.delete('pago_id');\n                    url.searchParams.delete('token');\n                    url.searchParams.delete('tipo');\n                    url.searchParams.delete('cancelado');\n                    url.searchParams.delete('PayerID');\n                    window.history.replaceState({}, document.title, url.toString());\n                    alert('Pago cancelado. Puedes volver a intentarlo cuando quieras.');\n                    return;\n                }\n\n                mostrarPagoLoading('Validando pago...', 'Esto puede tardar unos segundos');\n\n                try {\n                    const { data: s } = await sb.auth.getSession();\n                    if (!s || !s.session) return;\n\n                    const pagoId = pagoIdPreview;\n                    const orderId = orderIdPreview;\n\n                    url.searchParams.delete('pago_id');\n                    url.searchParams.delete('token');\n                    url.searchParams.delete('tipo');\n                    window.history.replaceState({}, document.title, url.toString());\n\n                    const { data, error } = await sb.functions.invoke('capture_paypal_order_evento', {\n                        body: {\n                            pago_id: pagoId ? Number(pagoId) : null,\n                            paypal_order_id: orderId || null,\n                        },\n                    });\n\n                    if (error) {\n                        const msg = error.message || error.details || JSON.stringify(error);\n                        alert('No se pudo confirmar el pago: ' + msg);\n                        return;\n                    }\n\n                    if (data ? (data.status ? (data.status !== 'OK') : false) : false) {\n                        alert('No se pudo confirmar el pago: ' + data.status);\n                        return;\n                    }\n\n                    if (data?.event_updated === false) {\n                        alert('Pago capturado, pero no se pudo publicar el evento: ' + (data?.event_error || data?.event_result || 'sin detalle'));\n                        return;\n                    }\n\n                    alert('\u2705 Pago confirmado correctamente.');\n                    await cargarMisEventos();\n                } finally {\n                    ocultarPagoLoading();\n                }\n            }\n\n            \/\/ ==================== INIT ====================\n            \/\/ listeners para cotizaci\u00f3n\n            ['publicar_desde', 'publicar_hasta', 'fecha_inicio', 'fecha_fin'].forEach(id => {\n                const el = document.getElementById(id);\n                if (!el) return;\n                el.addEventListener('change', () => actualizarCotizacionUI());\n                el.addEventListener('input', () => actualizarCotizacionUI());\n            });\n\n            window.initGooglePlaces = initGooglePlaces;\n            if (window.__gmapsInitRequested) {\n                initGooglePlaces();\n            }\n\n            \/\/ ====================== FACTURAS CFDI 4.0 (Fase 5) ======================\n            const SAT_REGIMENES_EV = [\n                { c: \"601\", n: \"General de Ley Personas Morales\" },\n                { c: \"603\", n: \"Personas Morales con Fines no Lucrativos\" },\n                { c: \"605\", n: \"Sueldos y Salarios e Ingresos Asimilados\" },\n                { c: \"606\", n: \"Arrendamiento\" },\n                { c: \"608\", n: \"Demas ingresos\" },\n                { c: \"610\", n: \"Residentes en el Extranjero sin EP en Mexico\" },\n                { c: \"611\", n: \"Ingresos por Dividendos\" },\n                { c: \"612\", n: \"PF con Actividades Empresariales y Profesionales\" },\n                { c: \"614\", n: \"Ingresos por intereses\" },\n                { c: \"615\", n: \"Obtencion de premios\" },\n                { c: \"616\", n: \"Sin obligaciones fiscales\" },\n                { c: \"620\", n: \"Sociedades Cooperativas de Produccion\" },\n                { c: \"621\", n: \"Incorporacion Fiscal\" },\n                { c: \"622\", n: \"Actividades Agricolas, Ganaderas, Silvicolas y Pesqueras\" },\n                { c: \"623\", n: \"Opcional para Grupos de Sociedades\" },\n                { c: \"624\", n: \"Coordinados\" },\n                { c: \"625\", n: \"Plataformas Tecnologicas\" },\n                { c: \"626\", n: \"Regimen Simplificado de Confianza (RESICO)\" }\n            ];\n            const SAT_USOS_CFDI_EV = [\n                { c: \"G01\", n: \"Adquisicion de mercancias\" },\n                { c: \"G02\", n: \"Devoluciones, descuentos o bonificaciones\" },\n                { c: \"G03\", n: \"Gastos en general\" },\n                { c: \"I04\", n: \"Equipo de computo y accesorios\" },\n                { c: \"I06\", n: \"Comunicaciones telefonicas\" },\n                { c: \"I08\", n: \"Otra maquinaria y equipo\" },\n                { c: \"D01\", n: \"Honorarios medicos\" },\n                { c: \"S01\", n: \"Sin efectos fiscales\" },\n                { c: \"CP01\", n: \"Pagos\" }\n            ];\n\n            function nombreConceptoPagoEv(p) {\n                const t = p.tipo, te = p?.metadata?.tier;\n                if (t === \"vip\") return \"VIP (30 dias)\";\n                if (t === \"desplegado\") return \"Desplegado (30 dias)\";\n                if (t === \"upgrade_vip\") return \"Upgrade a VIP\";\n                if (t === \"lealtad\") return \"Lealtad\";\n                if (t === \"evento\") {\n                    if (te === \"carrusel\") return \"Evento - Carrusel\";\n                    if (te === \"listado\") return \"Evento - Listado\";\n                    return \"Evento\";\n                }\n                return t || \"Servicio\";\n            }\n\n            function fmtFechaEv(iso) {\n                if (!iso) return \"-\";\n                try { return new Date(iso).toLocaleDateString(\"es-MX\", { year: \"numeric\", month: \"short\", day: \"2-digit\" }); }\n                catch { return String(iso).slice(0, 10); }\n            }\n\n            function dentroVentanaFacturaEv(creado_en, ventanaDias) {\n                try {\n                    const vd = Number(ventanaDias || 3);\n                    const d = new Date(creado_en);\n                    const hoy = new Date();\n                    const limDias = new Date(d.getTime() + vd * 86400000);\n                    const finMes = new Date(d.getFullYear(), d.getMonth() + 1, 0, 23, 59, 59);\n                    const tope = limDias < finMes ? limDias : finMes;\n                    return hoy <= tope;\n                } catch { return false; }\n            }\n\n            async function cargarFacturasPanel() {\n                const area = document.getElementById(\"facturas-area\");\n                if (!area) return;\n                area.innerHTML = '<div class=\"text-sm text-gray-500\">Cargando pagos...<\/div>';\n\n                try {\n                    const { data: sessionData } = await sb.auth.getSession();\n                    const uid = sessionData?.session?.user?.id;\n                    if (!uid) { area.innerHTML = '<div class=\"text-red-600 text-sm\">No hay sesion.<\/div>'; return; }\n\n                    const { data: pagos, error } = await sb\n                        .from(\"pagos\")\n                        .select(\"id, tipo, estado, monto_mxn, creado_en, metadata, beneficio_aplicado\")\n                        .eq(\"usuario_id\", uid)\n                        .eq(\"estado\", \"capturado\")\n                        .eq(\"beneficio_aplicado\", true)\n                        .eq(\"tipo\", \"evento\")\n                        .order(\"creado_en\", { ascending: false })\n                        .limit(50);\n                    if (error) throw error;\n\n                    let ventanaDias = 3;\n                    try {\n                        const { data: cfg } = await sb\n                            .from(\"app_config\")\n                            .select(\"value\")\n                            .eq(\"key\", \"FACTURA_VENTANA_DIAS\")\n                            .maybeSingle();\n                        if (cfg?.value) ventanaDias = Number(cfg.value) || 3;\n                    } catch {}\n\n                    const pagoIds = (pagos || []).map(p => p.id);\n                    let solsMap = {};\n                    if (pagoIds.length > 0) {\n                        const { data: sols } = await sb\n                            .from(\"facturas_solicitudes\")\n                            .select(\"id, pago_id, estado, uuid_sat, xml_url, pdf_url, motivo_rechazo, creado_en\")\n                            .in(\"pago_id\", pagoIds)\n                            .order(\"creado_en\", { ascending: false });\n                        (sols || []).forEach(s => { if (!solsMap[s.pago_id]) solsMap[s.pago_id] = s; });\n                    }\n\n                    if (!pagos || pagos.length === 0) {\n                        area.innerHTML = '<div class=\"text-sm text-gray-500\">No tienes pagos capturados.<\/div>';\n                        return;\n                    }\n\n                    area.innerHTML = pagos.map(p => {\n                        const sol = solsMap[p.id];\n                        const dentro = dentroVentanaFacturaEv(p.creado_en, ventanaDias);\n                        let right = \"\";\n                        if (sol && sol.estado === \"emitida\") {\n                            right = '<div class=\"flex flex-col items-end gap-1\">'\n                                + '<span class=\"px-2 py-1 bg-green-100 text-green-800 rounded-full text-xs font-bold\">Emitida<\/span>'\n                                + (sol.uuid_sat ? '<div class=\"text-xs text-gray-500\">UUID ' + sol.uuid_sat + '<\/div>' : '')\n                                + '<div class=\"flex gap-2\">'\n                                + (sol.xml_url ? '<a href=\"' + sol.xml_url + '\" target=\"_blank\" class=\"text-xs text-sky-700\">XML<\/a>' : '')\n                                + (sol.pdf_url ? '<a href=\"' + sol.pdf_url + '\" target=\"_blank\" class=\"text-xs text-sky-700\">PDF<\/a>' : '')\n                                + '<\/div><\/div>';\n                        } else if (sol && sol.estado === \"pendiente\") {\n                            right = '<span class=\"px-2 py-1 bg-amber-100 text-amber-800 rounded-full text-xs font-bold\">Pendiente admin<\/span>';\n                        } else if (sol && sol.estado === \"rechazada\") {\n                            right = '<div class=\"flex flex-col items-end gap-1 max-w-[220px] text-right\">'\n                                + '<span class=\"px-2 py-1 bg-red-100 text-red-800 rounded-full text-xs font-bold\">Rechazada<\/span>'\n                                + '<div class=\"text-xs text-red-800\">' + (sol.motivo_rechazo || '') + '<\/div>'\n                                + (dentro ? '<button class=\"btn-solicitar-factura text-xs bg-indigo-600 text-white rounded-lg px-3 py-1 font-bold\" data-pago=\"' + p.id + '\">Reintentar<\/button>' : '')\n                                + '<\/div>';\n                        } else if (dentro) {\n                            right = '<button class=\"btn-solicitar-factura bg-indigo-600 text-white rounded-lg px-3 py-2 text-sm font-bold\" data-pago=\"' + p.id + '\">Solicitar factura<\/button>';\n                        } else {\n                            right = '<span class=\"text-xs text-gray-500\">Ventana vencida<\/span>';\n                        }\n\n                        return '<div class=\"border border-gray-200 rounded-xl p-3 flex items-center justify-between gap-3 bg-white\">'\n                            + '<div class=\"flex-1 min-w-0\">'\n                            + '<div class=\"font-bold text-gray-900\">' + nombreConceptoPagoEv(p) + '<\/div>'\n                            + '<div class=\"text-xs text-gray-500 mt-1\">Pagado ' + fmtFechaEv(p.creado_en) + '<\/div>'\n                            + '<div class=\"text-sm font-semibold text-gray-900 mt-1\">$' + Number(p.monto_mxn).toFixed(2) + ' MXN<\/div>'\n                            + '<\/div>' + right + '<\/div>';\n                    }).join(\"\");\n\n                    area.querySelectorAll(\".btn-solicitar-factura\").forEach(btn => {\n                        btn.addEventListener(\"click\", () => {\n                            const id = Number(btn.getAttribute(\"data-pago\"));\n                            const pago = pagos.find(x => x.id === id);\n                            if (pago) mostrarModalSolicitarFactura(pago);\n                        });\n                    });\n                } catch (e) {\n                    area.innerHTML = '<div class=\"text-red-600 text-sm\">Error: ' + (e?.message || e) + '<\/div>';\n                }\n            }\n\n            function mostrarModalSolicitarFactura(pago) {\n                const prev = document.getElementById(\"modal-factura\");\n                if (prev) prev.remove();\n\n                const overlay = document.createElement(\"div\");\n                overlay.id = \"modal-factura\";\n                overlay.style.cssText = \"position:fixed; inset:0; background:rgba(0,0,0,0.6); display:flex; align-items:center; justify-content:center; z-index:10000; padding:16px; overflow-y:auto\";\n\n                const regOpts = SAT_REGIMENES_EV.map(r => '<option value=\"' + r.c + '\">' + r.c + ' - ' + r.n + '<\/option>').join(\"\");\n                const usoOpts = SAT_USOS_CFDI_EV.map(u => '<option value=\"' + u.c + '\">' + u.c + ' - ' + u.n + '<\/option>').join(\"\");\n\n                overlay.innerHTML =\n                    '<div style=\"background:#fff; border-radius:16px; padding:22px; max-width:500px; width:100%; box-shadow:0 20px 60px rgba(0,0,0,0.35); max-height:92vh; overflow-y:auto\">'\n                    + '<h3 style=\"font-size:18px; font-weight:800; color:#0f172a; margin:0 0 4px\">Solicitar factura<\/h3>'\n                    + '<div style=\"font-size:12px; color:#64748b; margin-bottom:14px\">' + nombreConceptoPagoEv(pago) + ' - $' + Number(pago.monto_mxn).toFixed(2) + ' MXN<\/div>'\n                    + '<form id=\"form-factura\" style=\"display:grid; gap:10px\">'\n                    + '<div><label style=\"font-size:12px; font-weight:700; color:#334155\">RFC<\/label>'\n                    + '<input id=\"f-rfc\" type=\"text\" required maxlength=\"13\" placeholder=\"XAXX010101000\" style=\"width:100%; padding:10px; border:1px solid #cbd5e1; border-radius:8px; text-transform:uppercase; font-family:monospace\" \/><\/div>'\n                    + '<div><label style=\"font-size:12px; font-weight:700; color:#334155\">Razon social<\/label>'\n                    + '<input id=\"f-razon\" type=\"text\" required style=\"width:100%; padding:10px; border:1px solid #cbd5e1; border-radius:8px\" \/><\/div>'\n                    + '<div style=\"display:grid; grid-template-columns:1fr 1fr; gap:10px\">'\n                    + '<div><label style=\"font-size:12px; font-weight:700; color:#334155\">CP fiscal<\/label>'\n                    + '<input id=\"f-cp\" type=\"text\" required maxlength=\"5\" style=\"width:100%; padding:10px; border:1px solid #cbd5e1; border-radius:8px\" \/><\/div>'\n                    + '<div><label style=\"font-size:12px; font-weight:700; color:#334155\">Regimen fiscal<\/label>'\n                    + '<select id=\"f-regimen\" required style=\"width:100%; padding:10px; border:1px solid #cbd5e1; border-radius:8px\"><option value=\"\">Selecciona...<\/option>' + regOpts + '<\/select><\/div><\/div>'\n                    + '<div><label style=\"font-size:12px; font-weight:700; color:#334155\">Uso de CFDI<\/label>'\n                    + '<select id=\"f-uso\" required style=\"width:100%; padding:10px; border:1px solid #cbd5e1; border-radius:8px\"><option value=\"\">Selecciona...<\/option>' + usoOpts + '<\/select><\/div>'\n                    + '<div><label style=\"font-size:12px; font-weight:700; color:#334155\">Email para recibir factura<\/label>'\n                    + '<input id=\"f-email\" type=\"email\" required style=\"width:100%; padding:10px; border:1px solid #cbd5e1; border-radius:8px\" \/><\/div>'\n                    + '<div id=\"f-msg\" style=\"font-size:12px; color:#b91c1c; min-height:14px\"><\/div>'\n                    + '<div style=\"display:flex; gap:8px; margin-top:4px\">'\n                    + '<button type=\"submit\" id=\"f-submit\" style=\"flex:1; padding:12px; background:#4f46e5; color:#fff; border:0; border-radius:10px; font-weight:700; cursor:pointer\">Enviar solicitud<\/button>'\n                    + '<button type=\"button\" id=\"f-cancel\" style=\"padding:12px 18px; background:#f1f5f9; color:#334155; border:0; border-radius:10px; font-weight:700; cursor:pointer\">Cancelar<\/button>'\n                    + '<\/div><\/form><\/div>';\n                document.body.appendChild(overlay);\n\n                try {\n                    sb.auth.getSession().then(function (r) {\n                        const em = r?.data?.session?.user?.email;\n                        const inp = overlay.querySelector(\"#f-email\");\n                        if (em && inp && !inp.value) inp.value = em;\n                    });\n                } catch (e) { \/* no-op *\/ }\n\n                overlay.querySelector(\"#f-cancel\").addEventListener(\"click\", function () { overlay.remove(); });\n                overlay.querySelector(\"#form-factura\").addEventListener(\"submit\", async function (e) {\n                    e.preventDefault();\n                    const msg = overlay.querySelector(\"#f-msg\");\n                    const btn = overlay.querySelector(\"#f-submit\");\n                    msg.textContent = \"\";\n                    btn.disabled = true;\n                    btn.textContent = \"Enviando...\";\n\n                    const payload = {\n                        p_pago_id: pago.id,\n                        p_rfc: overlay.querySelector(\"#f-rfc\").value.trim().toUpperCase(),\n                        p_razon_social: overlay.querySelector(\"#f-razon\").value.trim(),\n                        p_cp_fiscal: overlay.querySelector(\"#f-cp\").value.trim(),\n                        p_regimen: overlay.querySelector(\"#f-regimen\").value,\n                        p_uso_cfdi: overlay.querySelector(\"#f-uso\").value,\n                        p_email: overlay.querySelector(\"#f-email\").value.trim().toLowerCase()\n                    };\n\n                    try {\n                        const { data, error } = await sb.rpc(\"solicitar_factura\", payload);\n                        if (error) throw error;\n                        if (!data?.ok) {\n                            const map = {\n                                NO_AUTH: \"Sesion caducada.\",\n                                PAGO_NOT_FOUND: \"Pago no encontrado.\",\n                                NO_OWNER: \"Este pago no es tuyo.\",\n                                PAGO_NO_ELEGIBLE: \"Pago no esta capturado.\",\n                                VENTANA_VENCIDA: \"Ventana de solicitud vencida.\",\n                                RFC_INVALIDO: \"RFC invalido (12 o 13 caracteres).\",\n                                EMAIL_INVALIDO: \"Email invalido.\",\n                                CP_INVALIDO: \"Codigo postal debe ser 5 digitos.\",\n                                YA_SOLICITADA: \"Ya existe una solicitud activa para este pago.\"\n                            };\n                            msg.textContent = map[data?.code] || data?.code || \"Error desconocido.\";\n                            btn.disabled = false;\n                            btn.textContent = \"Enviar solicitud\";\n                            return;\n                        }\n                        overlay.remove();\n                        alert(\"Solicitud enviada. El admin la revisara y te enviara la factura por correo.\");\n                        cargarFacturasPanel();\n                    } catch (err) {\n                        msg.textContent = \"Error: \" + (err?.message || err);\n                        btn.disabled = false;\n                        btn.textContent = \"Enviar solicitud\";\n                    }\n                });\n            }\n            window.cargarFacturasPanel = cargarFacturasPanel;\n            window.mostrarModalSolicitarFactura = mostrarModalSolicitarFactura;\n\n            checkAuth();\n        <\/script>\n    <\/div>\n<\/body>\n\n<\/html>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Mis Eventos &#8211; Saca Plan Portal de Eventos Publica y administra tus eventos de Saca Plan Iniciar Sesi\u00f3n Email Contrase\u00f1a Entrar o Continuar con Google \u00bfOlvidaste tu contrase\u00f1a? \u00bfA\u00fan no tienes la app? Descargala desde aqu\u00ed: Google Play App Store Mis Eventos Salir Mis Eventos Nuevo Evento Mis Facturas Nuevo Evento Paso 1 \/ 6 [&hellip;]<\/p>\n","protected":false},"author":5,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-308","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/saca-plan.com\/inicio\/wp-json\/wp\/v2\/pages\/308","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/saca-plan.com\/inicio\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/saca-plan.com\/inicio\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/saca-plan.com\/inicio\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/saca-plan.com\/inicio\/wp-json\/wp\/v2\/comments?post=308"}],"version-history":[{"count":86,"href":"https:\/\/saca-plan.com\/inicio\/wp-json\/wp\/v2\/pages\/308\/revisions"}],"predecessor-version":[{"id":682,"href":"https:\/\/saca-plan.com\/inicio\/wp-json\/wp\/v2\/pages\/308\/revisions\/682"}],"wp:attachment":[{"href":"https:\/\/saca-plan.com\/inicio\/wp-json\/wp\/v2\/media?parent=308"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}