/* Estilos del editor (antes en un <style> dentro de Editor.razor, 28-nov-2026). Fuera del componente el navegador lo
   baja comprimido y lo guarda; antes viajaba entero (~340 KB sin comprimir) por la conexión de Blazor en cada carga.
   Se carga solo mientras se ve el editor (el <link> está dentro de Editor.razor). */
        .toggle-buttons {
            display: flex;
            border: 2px solid #e0e0e0;
            border-radius: 25px;
            overflow: hidden;
            background: #f8f9fa;
            margin-top: 8px;
            transition: all 0.3s ease
        }

        .canva-section {
            margin-top: 20px;
            margin-bottom: 15px
        }

        .canva-header {
            display: flex;
            flex-direction: column;
            gap: 5px;
            padding: 10px 0
        }

        .canva-title-wrapper {
            display: flex;
            align-items: center;
            justify-content: space-between
        }

        .canva-text {
            display: flex;
            flex-direction: column;
            gap: 3px
        }

        .canva-title {
            font-family: 'Poppins',sans-serif;
            font-weight: 600;
            font-size: 1.15rem;
            color: #1a73e8;
            margin: 0;
            letter-spacing: .02em;
            transition: color 0.3s ease
        }

        .canva-header:hover .canva-title {
            color: #005bb5
        }

        .canva-subtitle {
            font-family: 'Open Sans',sans-serif;
            font-size: .85rem;
            color: #4a5568;
            line-height: 1.3;
            margin: 0;
            opacity: .9;
            transition: opacity 0.3s ease;
            max-width: 80%
        }

        .canva-header:hover .canva-subtitle {
            opacity: 1
        }

        .btn-video-tutorial {
            display: flex;
            align-items: center;
            gap: 4px;
            padding: 5px 10px;
            font-family: 'Poppins',sans-serif;
            font-weight: 500;
            font-size: .8rem;
            color: #fff;
            background: #1a73e8;
            border: none;
            border-radius: 15px;
            box-shadow: 0 1px 4px rgb(0 0 0 / .1);
            transition: transform 0.3s ease,box-shadow 0.3s ease,background 0.3s ease;
            cursor: pointer
        }

            .btn-video-tutorial:hover {
                background: #1a73e8;
                transform: scale(1.05);
                box-shadow: 0 3px 8px rgb(0 0 0 / .15)
            }

            .btn-video-tutorial:active {
                transform: scale(.95);
                box-shadow: 0 1px 4px rgb(0 0 0 / .1)
            }

        .btn-icon {
            font-size: .7rem;
            transition: transform 0.3s ease
        }

        .btn-video-tutorial:hover .btn-icon {
            transform: scale(1.1)
        }

        .toggle-btn {
            flex: 1;
            padding: 12px 20px;
            border: none;
            background: #fff0;
            font-family: 'Poppins',sans-serif;
            font-size: .9rem;
            font-weight: 500;
            color: #6c757d;
            cursor: pointer;
            transition: all 0.3s ease;
            position: relative
        }

            .toggle-btn.active {
                background: #1a73e8;
                color: #fff;
                box-shadow: inset 0 0 0 1px rgb(255 255 255 / .2)
            }

            .toggle-btn:hover {
                color: #007bff;
                background: rgb(0 123 255 / .1)
            }

            .toggle-btn.active:hover {
                background: #1a73e8;
                transform: none
            }

        .toggle-hint {
            font-style: italic;
            text-align: center
        }

        .platform-btn-icon:hover {
            transform: scale(1.05);
            filter: drop-shadow(0 0 2px rgb(0 0 0 / .2))
        }

        .btn-logo {
            background-color: transparent !important;
            border: none !important;
            box-shadow: none !important
        }

        .date-selection-container {
            align-items: center;
            padding: 20px;
            margin-bottom: 20px;
            width: 100%;
            max-width: 400px
        }

            .date-selection-container label {
                font-family: 'Open Sans',sans-serif;
                font-weight: 600;
                color: #555;
                margin-bottom: 5px;
                display: block
            }

            .date-selection-container .form-control {
                border-radius: 8px;
                padding: 8px 12px;
                border: 1px solid #ced4da;
                width: 100%
            }

        .alert-danger {
            color: #721c24;
            background-color: #f8d7da;
            border-color: #f5c6cb;
            padding: 10px;
            border-radius: 5px;
            margin-top: 10px
        }

        .more-options {
            margin-top: 20px;
            border-top: 1px solid #e0e0e0;
            padding-top: 10px
        }

        .more-options-toggle {
            background-color: #007bff;
            color: #fff;
            padding: 10px;
            border: none;
            border-radius: 8px;
            cursor: pointer;
            width: 100%;
            text-align: center;
            font-family: 'Poppins',sans-serif;
            font-size: .9rem;
            transition: background-color 0.3s ease,transform 0.2s ease
        }

            .more-options-toggle:hover {
                background-color: #0056b3;
                transform: translateY(-2px)
            }

        .more-options-content {
            max-height: 0;
            overflow: hidden;
            transition: max-height 0.3s ease-out,opacity 0.3s ease-out;
            opacity: 0
        }

            .more-options-content.show {
                max-height: 1000px;
                opacity: 1;
                padding-top: 10px
            }

        .theme-grid {
            display: grid;
            grid-template-columns: repeat(auto-fit,minmax(100px,1fr));
            gap: 12px;
            margin-top: 10px
        }

        .theme-item {
            display: flex;
            flex-direction: column;
            align-items: center;
            padding: 10px;
            border-radius: 12px;
            background: #f9f9f9;
            cursor: pointer;
            transition: transform 0.3s ease,box-shadow 0.3s ease
        }

        .selected-theme {
            border: 2px solid #007bff;
            box-shadow: 0 0 12px rgb(0 123 255 / .6)
        }

        .theme-item:hover {
            transform: translateY(-3px);
            box-shadow: 0 4px 12px rgb(0 0 0 / .1)
        }

        .theme-preview {
            display: flex;
            gap: 8px;
            margin-bottom: 8px
        }

        .theme-color {
            width: 36px;
            height: 36px;
            border-radius: 8px;
            border: 2px solid #e0e0e0;
            transition: transform 0.2s ease-out;
            will-change: transform
        }

            .theme-color.top-color {
                transform: translateY(0)
            }

            .theme-color.middle-color {
                transform: translateY(0)
            }

        .theme-item:hover .theme-color {
            transform: translateY(0)
        }

        .theme-item span {
            font-family: 'Open Sans',sans-serif;
            font-size: .85rem;
            color: #333;
            font-weight: 500
        }

        .theme-preview2 {
            display: flex;
            flex-direction: column;
            gap: 5px
        }

        .theme-sample {
            padding: 10px;
            border-radius: 5px;
            font-size: .85rem;
            text-align: center
        }

        .theme-cover-back, .theme-cover-front {
            width: 50px;
            height: 70px;
            position: relative;
            display: flex;
            flex-direction: column;
            justify-content: center;
            align-items: center;
            padding: 5px;
            box-sizing: border-box;
            border: 1px solid #e0e0e0
        }

        .theme-cover-spine {
            width: 10px;
            height: 70px;
            display: flex;
            flex-direction: column;
            justify-content: center;
            align-items: center;
            padding: 2px;
            box-sizing: border-box;
            border: 1px solid #e0e0e0;
            writing-mode: vertical-rl;
            text-orientation: mixed
        }

        .theme-cover-text {
            text-align: center;
            color: inherit;
            text-shadow: 0 1px 2px rgb(0 0 0 / .3)
        }

        .theme-cover-front .theme-cover-text h2 {
            font-family: 'Poppins',sans-serif;
            font-size: .6rem;
            font-weight: 600;
            margin-bottom: 2px
        }

        .theme-cover-front .theme-cover-text p {
            font-family: 'Open Sans',sans-serif;
            font-size: .5rem
        }

        .theme-cover-back .theme-cover-text p {
            font-family: 'Open Sans',sans-serif;
            font-size: .5rem;
            line-height: 1.2;
            background: rgb(0 0 0 / .5);
            padding: 2px;
            border-radius: 5px
        }

        .theme-spine-text h3 {
            font-family: 'Poppins',sans-serif;
            font-size: .5rem;
            font-weight: 600;
            color: inherit;
            margin-bottom: 2px
        }

        .theme-spine-text p {
            font-family: 'Open Sans',sans-serif;
            font-size: .4rem;
            color: inherit
        }

        .cover-modal-overlay {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: rgb(0 0 0 / .6);
            display: flex;
            justify-content: center;
            align-items: center;
            z-index: 1000
        }

        .cover-modal {
            background: #fff;
            border-radius: 15px;
            width: 90%;
            max-width: 350mm;
            max-height: 90vh;
            height: 90vh;
            display: flex;
            flex-direction: column;
            overflow: hidden;
            box-shadow: 0 5px 25px rgb(0 0 0 / .2)
        }

            .cover-modal .modal-header {
                flex-shrink: 0;
                padding: 15px 20px;
                border-bottom: 1px solid #e0e0e0;
                background: #f8f9fa;
                border-top-left-radius: 15px;
                border-top-right-radius: 15px
            }

            .cover-modal .modal-body {
                flex: 1;
                overflow: hidden;
                padding: 0 !important;
                display: flex;
                gap: 0;
                align-items: stretch
            }

            .cover-modal .modal-footer {
                flex-shrink: 0;
                display: flex;
                justify-content: flex-end;
                gap: 10px;
                padding: 15px 20px;
                border-top: 1px solid #e0e0e0;
                background: #f8f9fa;
                border-bottom-left-radius: 15px;
                border-bottom-right-radius: 15px
            }

        .more-options-content {
            max-height: none;
            overflow-y: auto;
            transition: opacity 0.3s ease-out;
            opacity: 0
        }

            .more-options-content.show {
                opacity: 1
            }

        .cover-modal .modal-body::-webkit-scrollbar {
            width: 6px
        }

        .cover-modal .modal-body::-webkit-scrollbar-track {
            background: #f1f1f1;
            border-radius: 10px
        }

        .cover-modal .modal-body::-webkit-scrollbar-thumb {
            background: #c1c1c1;
            border-radius: 10px
        }

            .cover-modal .modal-body::-webkit-scrollbar-thumb:hover {
                background: #a8a8a8
            }

        .modal-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 15px 20px;
            border-bottom: 1px solid #e0e0e0;
            background: #f8f9fa;
            border-top-left-radius: 15px;
            border-top-right-radius: 15px
        }

            .modal-header h4 {
                margin: 0;
                font-family: 'Poppins',sans-serif;
                font-weight: 600;
                color: #1a73e8
            }

            .modal-header .btn-close {
                background: none;
                border: none;
                font-size: 1.2rem;
                cursor: pointer;
                color: #666;
                transition: color 0.2s ease
            }

                .modal-header .btn-close:hover {
                    color: #ff4d4f
                }

        .modal-body {
            padding: 20px;
            display: flex;
            flex-direction: column;
            gap: 20px;
            justify-content: center;
            align-items: center
        }

        .cover-tabs {
            display: flex;
            gap: 10px;
            margin-bottom: 20px
        }

            .cover-tabs button {
                flex: 1;
                padding: .8vh .5rem;
                border: none;
                background: #e9ecef;
                border-radius: 20px;
                font-family: 'Poppins',sans-serif;
                font-weight: 600;
                cursor: pointer;
                transition: all 0.3s ease;
                font-size: clamp(10px, 1.2vw, 0.9rem);
                white-space: nowrap;
                text-align: center;
                overflow: hidden;
                text-overflow: ellipsis
            }

                .cover-tabs button.active, .cover-tabs button:hover {
                    background: #1a73e8;
                    color: #fff
                }

                .cover-tabs button.active, .cover-tabs button:hover {
                    background: #1a73e8;
                    color: #fff
                }

        .cover-preview {
            display: flex;
            justify-content: center;
            align-items: center;
            gap: 0;
            background: #fff0;
            padding: 0;
            box-shadow: none;
            transform-origin: center center
        }

        .cover-back, .cover-front {
            height: 55vh;
            max-height: 108.2mm;
            width: auto;
            aspect-ratio: 74.04 / 108.2;
            padding: 2vh;
            position: relative;
            display: flex;
            flex-direction: column;
            justify-content: center;
            align-items: center;
            box-sizing: border-box;
            border: 1px solid #e0e0e0;
            background-size: cover;
            background-position: center;
            overflow: hidden
        }

        .cover-front {
            border-top-right-radius: 8px;
            border-bottom-right-radius: 8px
        }

        /* ===== Editor de portada tipo Canva (Fase 1+, solo móvil) ===== */
        .cover-fabric-canvas { display: block; }
        .cover-front .canvas-container { position: absolute !important; top: 0; left: 0; }
        /* Las guías de margen se dibujan por encima del lienzo pero NO capturan los toques */
        .cover-front .safety-margin-overlay.canva-guide { z-index: 5; pointer-events: none; }

        /* ===== Layout del editor Canva (móvil, Fase 6) ===== */
        /* Por encima de los botones flotantes de la app (1000/1100) y por debajo del diálogo de confirmar (1200) */
        .canva-editor { position: fixed; inset: 0; z-index: 1150; background: #f0f2f5; display: flex; flex-direction: column; }
        /* Editor cerrado pero mantenido montado (lienzos Fabric.js vivos para reabrir al instante):
           oculto de verdad (no pinta, no intercepta clics, no ocupa hueco), pero sigue en el DOM. */
        .canva-editor-hidden { display: none !important; }
        /* Fila 1: volver atrás / guardar (fondo blanco) */
        .canva-topbar { display: flex; align-items: center; justify-content: space-between; padding: 8px 12px; background: #fff; flex-shrink: 0; }
        .canva-back-btn { border: none; background: transparent; color: #0084FF; font-weight: 600; font-size: 0.9rem; display: inline-flex; align-items: center; gap: 2px; padding: 4px 2px; }
        .canva-topbar-history { display: flex; gap: 2px; }
        .canva-topbar-right { display: flex; align-items: center; gap: 8px; }
        .canva-later-btn { border: none; background: #eef0f2; color: #444; font-weight: 600; border-radius: 20px; padding: 8px 14px; font-size: 0.85rem; white-space: nowrap; }
        .canva-icon-btn2 { border: none; background: transparent; color: #444; width: 38px; height: 38px; border-radius: 8px; font-size: 1.1rem; display: inline-flex; align-items: center; justify-content: center; }
        .canva-icon-btn2:active { background: #eee; }
        .canva-save-btn { border: none; background: #0084FF; color: #fff; font-weight: 600; border-radius: 20px; padding: 8px 20px; font-size: 0.88rem; }
        .canva-save-btn:disabled { background: #a9cbf0; }
        /* Fila 2: superficies ocupando todo el ancho */
        .canva-surfaces { display: flex; width: 100%; background: #fff; border-bottom: 1px solid #dcdfe3; flex-shrink: 0; }
        .canva-surface-btn { flex: 1 1 0; min-width: 0; border: none; background: transparent; color: #65676b; font-size: 0.82rem; font-weight: 600; padding: 11px 4px; border-bottom: 2px solid transparent; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
        .canva-surface-btn.active { color: #0084FF; border-bottom-color: #0084FF; }
        /* Zona gris del editor (empieza aquí, separada por la línea de arriba) */
        .canva-stage-area { flex: 1; display: flex; flex-direction: column; background: #f0f2f5; min-height: 0; }
        .canva-margins-toggle { justify-content: flex-end; gap: 8px; padding: 8px 14px 2px; margin: 0; }
        .canva-margins-toggle .toggle-label { font-size: 0.72rem; font-weight: 700; color: #65676b; text-transform: uppercase; letter-spacing: .3px; }
        .canva-stage { flex: 1; display: flex; align-items: center; justify-content: center; overflow: hidden; padding: 6px 8px 10px; min-height: 0; }
        /* Aprovecha al máximo el espacio disponible (como Canva): la portada llena la altura del
           escenario y solo se reduce cuando el ancho no da (max-width) o cuando el escenario encoge
           (hoja/teclado abiertos). Así es más grande y se adapta a cada dispositivo (vh/flex).
           El transform (zoom con 2 dedos) lo aplica el JS por encima de este tamaño base. */
        .canva-surface-box { height: 100%; max-height: 100%; width: auto; max-width: 100%; position: relative; background-size: cover; background-position: center; border: 1px solid #d0d0d0; border-radius: 4px; overflow: hidden; box-shadow: 0 6px 24px rgba(0,0,0,.15); will-change: transform; }
        .canva-canvas-host { position: absolute; inset: 0; }
        .canva-surface-box .canvas-container { position: absolute !important; top: 0; left: 0; }
        /* El lomo: tira de color con el ancho real del libro. El min-width evita que en un libro fino
           se quede en una raya invisible. */
        .canva-spine-strip { min-width: 12px; }
        .canva-spine-panel { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 8px 12px 12px; }
        .canva-spine-colors { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: center; }
        .canva-spine-label { font-size: .8rem; font-weight: 600; color: #4a4a4a; }
        .canva-spine-colors .canva-colors-row { margin: 0; }
        /* Aviso de color muy claro (portada y lomo): informa, no bloquea. */
        .canva-color-aviso { display: flex; gap: 6px; align-items: flex-start; max-width: 340px; margin: 0 0 10px; padding: 7px 10px; border-radius: 10px; background: #fff3cd; color: #7a5a00; font-size: .76rem; line-height: 1.3; }
        .canva-color-aviso i { margin-top: 1px; }
        .canva-spine-panel .canva-color-aviso { margin: 2px 0 0; }
        .canva-toolbar-hidden { display: none !important; }
        /* ===== Editor Canva en PC: contraportada | lomo | portada JUNTAS (mismos aspect-ratio que móvil) ===== */
        /* El stage centra la portada vertical y horizontalmente y deja hacer scroll si con el zoom no cabe. */
        /* El centrado lo hace el margin:auto de .canva-pc-joined, NO justify-content/align-items:center: con
           esos, al hacer zoom el contenido desbordaba también por la izquierda y por arriba, y esa parte (un
           trozo de la contraportada) quedaba fuera del alcance del scroll. Los márgenes auto centran cuando
           cabe y, cuando no cabe, dejan que todo el desborde vaya hacia donde sí se puede desplazar. */
        .canva-stage-pc { position: relative; display: flex; align-items: flex-start; justify-content: flex-start; overflow: auto; padding: 24px; }
        /* --pc-zoom (por defecto 1) escala SOLO el tamaño VISUAL en pantalla; la resolución lógica del lienzo
           (y por tanto el PNG/PDF de imprenta) NO cambia. Al escalar la caja, fitDisplay reajusta el lienzo. */
        /* --pc-h = alto VISUAL de las superficies. Aprovecha la pantalla (crece en monitores grandes) y se limita
           por ancho para que las 3 quepan; --pc-zoom lo multiplica. */
        .canva-pc-joined { --pc-h: calc(min(72vh, 46vw) * var(--pc-zoom, 1)); display: flex; gap: 0; justify-content: center; align-items: center; flex-shrink: 0; margin: auto; }
        /* Ancho EXPLÍCITO desde el alto y el ratio real (--ar por superficie). NO usamos aspect-ratio para el
           tamaño porque en Safari los items flex a veces colapsan su ancho en el primer paint (la portada salía
           como una línea fina). El aspect-ratio inline se mantiene solo para que init lea la proporción lógica. */
        .canva-pc-box { height: var(--pc-h); width: calc(var(--pc-h) * var(--ar, 0.684288)); border-radius: 0; flex-shrink: 0; }
        /* Superficie que se está editando: resalte azul neón, para que se vea qué lienzo recibe las herramientas.
           Se usa outline + box-shadow (NUNCA border): no ocupan espacio, así la caja no cambia de tamaño y la
           medición del lienzo (y por tanto el PNG/PDF) queda intacta. z-index para que no lo tape la superficie
           contigua, que va pegada sin separación. */
        .canva-pc-box.canva-pc-active {
            outline: 3px solid #00B0FF;
            outline-offset: -1px;
            box-shadow: 0 0 14px 2px rgba(0,176,255,.55), 0 6px 24px rgba(0,0,0,.15);
            position: relative; z-index: 3;
        }
        .canva-soon { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: rgba(255,255,255,.9); font-size: .8rem; font-weight: 600; text-align: center; padding: 10px; }
        /* Barra flotante de opciones del objeto seleccionado (colores de la app) */
        /* Barra de acciones flotante junto al objeto (posición por inline style: left/top en px de viewport) */
        .canva-obj-toolbar { position: fixed; transform: translateX(-50%); display: flex; gap: 4px; background: #fff; border: 1px solid #dcdfe3; border-radius: 12px; padding: 5px; box-shadow: 0 6px 18px rgba(0,0,0,.18); z-index: 30; }

        /* Modal de confirmación de guardado (preview de la portada completa) */
        .canva-save-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.55); display: flex; align-items: center; justify-content: center; z-index: 3000; padding: 20px; }
        .canva-save-modal { background: #fff; border-radius: 16px; padding: 18px 18px 16px; width: 100%; max-width: 460px; box-shadow: 0 12px 40px rgba(0,0,0,.3); }
        /* El conjunto (contra+lomo+frontal) ocupa el ancho disponible con la proporción real, sin salirse */
        .canva-save-preview { display: flex; width: 100%; max-width: 300px; aspect-ratio: 160.28 / 108.2; margin: 0 auto 16px; align-items: stretch; }
        .csp-surface { height: 100%; background-size: cover; background-position: center; border: 1px solid rgba(0,0,0,.12); min-width: 0; }
        .csp-back { flex: 740 0 0; border-top-left-radius: 4px; border-bottom-left-radius: 4px; }
        .csp-spine { flex: 122 0 0; } /* el flex real va inline: depende de las páginas */
        .csp-front { flex: 740 0 0; border-top-right-radius: 4px; border-bottom-right-radius: 4px; box-shadow: 4px 0 10px rgba(0,0,0,.12); }
        .canva-save-question { text-align: center; font-weight: 600; font-size: 1.02rem; color: #1a1a1a; margin: 4px 0 16px; }
        .canva-save-actions { display: flex; gap: 10px; }
        .canva-save-actions button { flex: 1; border: none; border-radius: 12px; padding: 13px; font-weight: 600; font-size: 0.95rem; }
        .csa-keep { background: #eef0f2; color: #444; }
        .csa-save { background: #0084FF; color: #fff; }
        .canva-obj-toolbar button { border: none; background: transparent; color: #0084FF; width: 44px; height: 40px; border-radius: 8px; font-size: 1.05rem; display: inline-flex; align-items: center; justify-content: center; }
        .canva-obj-toolbar button:active { background: #eef7ff; }
        .canva-obj-toolbar .canva-obj-del { color: #E4405F; }
        /* ===== Edición de texto: barra de formato SOBRE el teclado + diseño grande (como la foto) ===== */
        /* El editor se recorta a la zona visible (sube por encima del teclado) usando --kbd (lo fija el JS
           desde visualViewport). Así el diseño se centra en el hueco visible y no queda tapado. */
        /* MÓVIL: al editar un texto el editor se encoge para dejar sitio al teclado y se gana espacio
           ocultando pestañas, márgenes y barra inferior.
           En PC NADA de esto se aplica: las herramientas de texto se abren en el lateral y la portada
           tiene que quedarse exactamente donde estaba. Ocultar las pestañas o cambiar el relleno del
           escenario cambiaba el alto disponible y hacía que la portada saltase de sitio y de tamaño.

           Las reglas responden a DOS clases: "editing" la pone Blazor (viaje al servidor) y "kbd-open"
           la pone el JS al instante, para que la barra y el hueco aparezcan sin esperar al servidor. */
        .canva-editor.editing:not(.canva-pc),
        .canva-editor.kbd-open:not(.canva-pc) { bottom: var(--kbd, 0px); }

        .canva-editor.editing:not(.canva-pc) .canva-surfaces,
        .canva-editor.kbd-open:not(.canva-pc) .canva-surfaces,
        .canva-editor.editing:not(.canva-pc) .canva-margins-toggle,
        .canva-editor.kbd-open:not(.canva-pc) .canva-margins-toggle,
        .canva-editor.editing:not(.canva-pc) .canva-bottom,
        .canva-editor.kbd-open:not(.canva-pc) .canva-bottom { display: none; }

        /* La barra flotante del objeto sí estorba en las dos: taparía el texto que se está escribiendo. */
        .canva-editor.editing .canva-obj-toolbar,
        .canva-editor.kbd-open .canva-obj-toolbar { display: none; }

        .canva-editor.editing:not(.canva-pc) .canva-stage,
        .canva-editor.kbd-open:not(.canva-pc) .canva-stage { padding: 8px 8px 6px; }

        /* La barra del teclado se dibuja siempre (solo en móvil) y se enseña por CSS: si dependiera de
           que Blazor la pintara, habría que esperar al viaje al servidor y por eso se notaba lenta. */
        .canva-kbd-wrap { display: none; }
        .canva-editor.editing .canva-kbd-wrap,
        .canva-editor.kbd-open .canva-kbd-wrap { display: block; }
        /* Contenedor de la barra del teclado (barra + fila de fuentes opcional), pegado abajo del editor. */
        .canva-kbd-wrap { flex-shrink: 0; background: #fff; border-top: 1px solid #e0e0e0; }
        .canva-kbd-fonts { display: flex; gap: 8px; overflow-x: auto; -webkit-overflow-scrolling: touch; padding: 8px 10px; border-bottom: 1px solid #eee; }
        .canva-kbd-toolbar { display: flex; align-items: center; gap: 4px; overflow-x: auto; -webkit-overflow-scrolling: touch; padding: 7px 10px; padding-bottom: max(7px, env(safe-area-inset-bottom)); }
        .canva-kbd-toolbar .kbt-sep { flex: 0 0 auto; width: 1px; height: 24px; background: #e3e3e3; margin: 0 2px; }
        .canva-kbd-toolbar button { flex: 0 0 auto; border: none; background: transparent; color: #1a1a1a; height: 38px; min-width: 38px; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center; gap: 4px; font-size: 1rem; padding: 0 8px; }
        .canva-kbd-toolbar button:active { background: #eef0f2; }
        .canva-kbd-toolbar .kbt-font span { font-size: 0.8rem; font-weight: 600; }
        .canva-kbd-toolbar .kbt-active { color: #0084FF; background: #eef7ff; }
        .canva-kbd-toolbar .kbt-color { flex: 0 0 auto; width: 30px; height: 30px; border-radius: 50%; border: 2px solid #e0e0e0; overflow: hidden; padding: 0; position: relative; }
        .canva-kbd-toolbar .kbt-color input { position: absolute; top: -25%; left: -25%; width: 150%; height: 150%; border: none; padding: 0; background: transparent; }
        .canva-kbd-toolbar .kbt-size { flex: 0 0 auto; width: 52px; height: 34px; text-align: center; border: 1px solid #dcdfe3; border-radius: 8px; font-size: 0.9rem; }
        .canva-kbd-toolbar .kbt-done { margin-left: auto; color: #0084FF; font-size: 1.2rem; }

        /* Barra inferior de herramientas + hoja (la hoja empuja hacia arriba y encoge la portada) */
        .canva-bottom { flex-shrink: 0; }
        .canva-toolbar { display: flex; background: #fff; border-top: 1px solid #e0e0e0; padding: 6px 4px; padding-bottom: max(6px, env(safe-area-inset-bottom)); }
        /* Mientras se prepara la vista previa de guardado, ignoramos los toques en la barra: si no, un
           toque de más sobre "Plantillas" (que ya está activa) la apaga justo durante la espera. */
        .canva-toolbar-busy { pointer-events: none; opacity: .6; }
        .canva-tool { flex: 1; border: none; background: transparent; color: #444; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; line-height: 1; padding: 6px 2px; border-radius: 10px; }
        .canva-tool i { font-size: 1.3rem; line-height: 1; }
        .canva-tool span { font-size: 0.66rem; }
        .canva-tool.active { color: #0084FF; background: #eef7ff; }
        .canva-sheet { background: #fff; border-top-left-radius: 16px; border-top-right-radius: 16px; box-shadow: 0 -6px 24px rgba(0,0,0,.12); max-height: 45vh; overflow-y: auto; -webkit-overflow-scrolling: touch; animation: canvaSheetUp .22s ease; }
        @keyframes canvaSheetUp { from { transform: translateY(100%); } to { transform: translateY(0); } }
        .canva-sheet-header { display: flex; justify-content: flex-end; align-items: center; padding: 6px 8px 2px; position: sticky; top: 0; background: #fff; border-top-left-radius: 16px; border-top-right-radius: 16px; z-index: 1; }
        .canva-sheet-close { border: none; background: transparent; color: #90949c; width: 34px; height: 34px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 1rem; }
        .canva-sheet-close:active { background: #eee; }
        .canva-sheet-body { padding: 6px 14px 16px; }

        /* ==== PC (escritorio): herramientas en barra lateral IZQUIERDA estilo Canva ====
           Reutiliza el MISMO markup (.canva-bottom > .canva-toolbar + .canva-sheet) que móvil,
           solo lo recoloca con CSS. A diferencia de móvil, la rejilla se mantiene también al editar
           texto (.editing): en PC no hay teclado virtual que tape el lienzo, así que la barra lateral
           se queda puesta y no hace falta "volver atrás" para cambiar de herramienta. */
        .canva-editor.canva-pc {
            display: grid;
            grid-template-columns: auto 1fr;
            grid-template-rows: auto 1fr;
            grid-template-areas: "topbar topbar" "rail stage";
        }
        .canva-editor.canva-pc .canva-topbar { grid-area: topbar; }
        .canva-editor.canva-pc .canva-stage-area { grid-area: stage; min-width: 0; }
        .canva-editor.canva-pc .canva-bottom {
            grid-area: rail; display: flex; flex-direction: row; align-items: stretch;
            min-height: 0; background: #fff;
        }
        /* Rail vertical de iconos (a la izquierda) */
        .canva-editor.canva-pc .canva-toolbar {
            flex-direction: column; order: 0; width: 78px; gap: 8px;
            border-top: none; border-right: 1px solid #e0e0e0;
            padding: 12px 8px; align-items: stretch; justify-content: center;
        }
        .canva-editor.canva-pc .canva-tool {
            flex: 0 0 auto; padding: 12px 4px; border-radius: 10px; gap: 5px;
            transition: background .12s ease, color .12s ease;
        }
        .canva-editor.canva-pc .canva-tool i { font-size: 1.35rem; }
        .canva-editor.canva-pc .canva-tool span { font-size: 0.68rem; }
        /* Hover = solo resaltar el icono (como imagen 2), sin asomar panel */
        .canva-editor.canva-pc .canva-tool:hover { background: #f0f2f5; color: #0084FF; }
        .canva-editor.canva-pc .canva-tool.active { color: #0084FF; background: #eef7ff; }
        /* Panel de la herramienta abierta: a la derecha del rail, altura completa */
        .canva-editor.canva-pc .canva-sheet {
            order: 1; width: 300px; height: 100%; max-height: none;
            border-radius: 0; border-right: 1px solid #e0e0e0;
            box-shadow: 6px 0 20px rgba(0,0,0,.05);
            animation: canvaSheetLeft .18s ease;
        }
        @keyframes canvaSheetLeft { from { transform: translateX(-16px); opacity: .3; } to { transform: translateX(0); opacity: 1; } }
        .canva-editor.canva-pc .canva-sheet-header { border-radius: 0; }
        /* En PC el panel es alto: mostramos más filas de elementos (en móvil se queda con su límite). */
        .canva-editor.canva-pc .canva-elements-grid { max-height: none; }
        /* En PC hay espacio de sobra: las opciones de texto NO se deslizan, se muestran todas (wrap) y más grandes.
           Fuentes y colores fluyen en varias líneas; los controles de formato también saltan de línea. */
        .canva-editor.canva-pc .canva-fonts-row,
        .canva-editor.canva-pc .canva-colors-row,
        .canva-editor.canva-pc .canva-format-row { flex-wrap: wrap; overflow-x: visible; }
        .canva-editor.canva-pc .canva-fonts-row { gap: 10px; }
        .canva-editor.canva-pc .canva-font-chip { padding: 10px 16px; font-size: 0.95rem; }
        .canva-editor.canva-pc .canva-color-chip { width: 34px; height: 34px; }
        .canva-editor.canva-pc .canva-fmt-btn { min-width: 44px; height: 44px; font-size: 1.05rem; }
        .canva-editor.canva-pc .canva-size-input { width: 64px; height: 44px; }

        /* Ocultar el botón flotante de ayuda ("No consigo subir mi archivo") mientras el editor de portada
           está abierto: se pintaba sobre la barra lateral y tapaba las herramientas. El editor de portada vive
           en la ruta home ("/"), donde el widget sí se permite; por eso aparecía. */
        body:has(.canva-editor) .contact-widget-container .contact-trigger { display: none !important; }

        /* Y tampoco mientras se edita el libro: a esas alturas el chat ya está subido, así que un botón de
           "no consigo subir mi archivo" no pinta nada y encima tapa la esquina. .app-layout solo existe
           cuando el libro ya está cargado en el editor (es la rama else de !Messages.Any()), así que en la
           pantalla de subida, que es donde de verdad hace falta, el botón se sigue viendo. */
        body:has(.app-layout) .contact-widget-container .contact-trigger { display: none !important; }

        /* Barra de zoom de la portada (solo PC): en escritorio no se puede pellizcar con los dedos. */
        .canva-pc-zoombar { position: absolute; bottom: 16px; left: 50%; transform: translateX(-50%);
            display: flex; align-items: center; gap: 4px; background: #fff; border: 1px solid #e0e0e0;
            border-radius: 999px; padding: 4px 6px; box-shadow: 0 4px 16px rgba(0,0,0,.10); z-index: 15; }
        .canva-pc-zoombar button { border: none; background: transparent; color: #444; width: 34px; height: 34px;
            border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 1rem; }
        .canva-pc-zoombar button:hover { background: #f0f2f5; color: #0084FF; }
        .canva-pc-zoombar .canva-pc-zoomval { min-width: 46px; text-align: center; font-size: .8rem; color: #444;
            font-weight: 600; cursor: pointer; user-select: none; }

        /* Herramienta de texto */
        .canva-add-text { position: relative; cursor: pointer; width: 100%; border: none; background: #0084FF; color: #fff; font-weight: 600; border-radius: 10px; padding: 12px; font-size: 0.95rem; display: flex; align-items: center; justify-content: center; gap: 6px; margin-bottom: 12px; }
        .canva-text-presets { display: flex; gap: 8px; margin-bottom: 14px; }
        .canva-text-presets button { flex: 1; border: 1px solid #dcdfe3; background: #f7f8fa; color: #222; border-radius: 8px; padding: 12px 6px; line-height: 1.1; }
        .canva-tool-section-label { font-size: 0.72rem; color: #90949c; margin: 4px 2px 8px; }
        .canva-fonts-row { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 8px; margin-bottom: 10px; -webkit-overflow-scrolling: touch; }
        .canva-font-chip { flex: 0 0 auto; border: 1px solid #dcdfe3; background: #fff; color: #222; border-radius: 8px; padding: 8px 14px; font-size: 0.9rem; white-space: nowrap; }
        .canva-font-chip.active { border-color: #0084FF; background: #eef7ff; color: #0084FF; }
        .canva-color-chip.active { box-shadow: 0 0 0 2px #fff, 0 0 0 4px #0084FF; }
        .canva-fmt-btn.active { border-color: #0084FF; background: #eef7ff; color: #0084FF; }
        .canva-colors-row { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 8px; margin-bottom: 12px; }
        .canva-color-chip { flex: 0 0 auto; width: 30px; height: 30px; border-radius: 50%; border: 1px solid rgba(0,0,0,.15); padding: 0; }
        /* Fila única deslizable: sin saltos de línea, el botón de eliminar queda alineado con el resto */
        .canva-format-row { display: flex; gap: 6px; align-items: center; flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; padding-bottom: 4px; }
        .canva-fmt-btn { flex: 0 0 auto; min-width: 40px; height: 40px; border: 1px solid #dcdfe3; background: #fff; color: #222; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center; font-size: 1rem; }
        .canva-fmt-caption { flex: 0 0 auto; font-size: 0.72rem; color: #90949c; padding: 0 2px; }
        .canva-size-input { flex: 0 0 auto; width: 56px; height: 40px; border: 1px solid #dcdfe3; border-radius: 8px; text-align: center; font-size: 0.9rem; color: #222; -moz-appearance: textfield; }
        .canva-size-input:focus { outline: none; border-color: #0084FF; }
        .canva-fmt-del { color: #E4405F; border-color: #f2c2cd; }
        /* Chip de color libre (selector nativo escondido dentro) */
        .canva-color-custom { position: relative; overflow: hidden; background: conic-gradient(red, yellow, lime, cyan, blue, magenta, red); display: inline-flex; }
        .canva-color-custom input { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; }
        /* Plantillas */
        .canva-templates-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 12px; }
        /* Cabecera plegable de cada familia de plantillas. */
        .canva-group-header { display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%;
                              background: none; border: 0; padding: 6px 2px; margin: 4px 0 8px; cursor: pointer;
                              font-size: 0.72rem; color: #90949c; text-align: left; }
        .canva-group-header:hover { color: #5b5b5b; }
        .canva-group-header i { font-size: 0.72rem; }
        .canva-grid-plegado { display: none; }

        /* En ordenador el panel es bastante más ancho que en el móvil: con cuatro columnas las miniaturas
           salían diminutas y no se distinguía el diseño. Tres columnas y algo más de aire. */
        @media (min-width: 992px) {
            .canva-templates-grid {
                grid-template-columns: repeat(3, 1fr);
                gap: 14px;
                margin-bottom: 18px
            }
        }

        /* "Mostrar más": sin expandir, 1ª fila entera + media 2ª fila que se desvanece.
           El alto de una fila depende del ancho del panel, por eso se calcula con cqw:
           ancho de tarjeta = (100cqw - huecos) / columnas, alto = ancho * 108/74. */
        .canva-tpl-wrap { container-type: inline-size; margin-bottom: 12px; }
        .canva-tpl-wrap .canva-templates-grid { margin-bottom: 0; }
        .canva-tpl-more { display: flex; align-items: center; justify-content: center; gap: 6px; width: 100%;
                          background: none; border: 0; padding: 6px 0 2px; margin-top: 2px; cursor: pointer;
                          font-size: 0.8rem; font-weight: 600; color: #0084FF; }
        .canva-tpl-more i { font-size: 0.75rem; }
        @supports (container-type: inline-size) {
            .canva-tpl-recortado .canva-templates-grid {
                --tpl-row: calc((100cqw - 30px) / 4 * 108 / 74);
                max-height: calc(var(--tpl-row) * 1.5 + 10px);
                overflow: hidden;
                -webkit-mask-image: linear-gradient(to bottom, #000 66%, transparent 100%);
                mask-image: linear-gradient(to bottom, #000 66%, transparent 100%);
            }
            @media (min-width: 992px) {
                .canva-tpl-recortado .canva-templates-grid {
                    --tpl-row: calc((100cqw - 28px) / 3 * 108 / 74);
                    max-height: calc(var(--tpl-row) * 1.5 + 14px);
                }
            }
        }
        /* En móvil (4 columnas) una familia de 4 cabe en una fila: ni recorte ni botón. */
        @media (max-width: 991.98px) {
            .canva-tpl-hasta4 .canva-templates-grid { max-height: none !important; -webkit-mask-image: none !important; mask-image: none !important; }
            .canva-tpl-hasta4 .canva-tpl-more { display: none; }
        }
        .canva-template-card {
            aspect-ratio: 74 / 108;
            border: 1px solid #dcdfe3;
            border-radius: 8px;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 1.35rem;
            padding: 0;
            /* La miniatura ocupa toda la tarjeta, así que hay que recortarla al radio del borde. */
            overflow: hidden;
        }
        .canva-template-blank { border: 1.5px dashed #b8bec7; }
        /* La miniatura llena la tarjeta: es la portada de verdad, dibujada con el motor del editor. */
        .canva-template-img {
            width: 100%;
            height: 100%;
            object-fit: cover;
            display: block;
            border-radius: inherit
        }

        /* Nombre de la plantilla dentro de su tarjeta. */
        .canva-template-name {
            font-size: .62rem;
            font-weight: 700;
            letter-spacing: .04em;
            text-align: center;
            line-height: 1.2;
            padding: 0 4px
        }

        .canva-blank-label { font-size: 0.6rem; color: #90949c; font-weight: 600; text-align: center; }
        /* Elementos (formas) */
        .canva-shapes-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; margin-bottom: 12px; }
        .canva-shapes-grid button { border: 1px solid #dcdfe3; background: #f7f8fa; color: #0084FF; border-radius: 8px; height: 48px; font-size: 1.25rem; display: inline-flex; align-items: center; justify-content: center; }
        /* Buscador de elementos + cuadrícula desplazable (se ven unos pocos, se desliza para ver más) */
        .canva-elements-search { display: flex; align-items: center; gap: 8px; border: 1px solid #dcdfe3; border-radius: 10px; padding: 9px 12px; margin-bottom: 10px; color: #90949c; }
        .canva-elements-search input { border: none; outline: none; flex: 1; font-size: 0.92rem; background: transparent; color: #222; min-width: 0; }
        .canva-search-clear { border: none; background: transparent; color: #90949c; padding: 0 2px; font-size: 0.9rem; }
        /* ~3 filas visibles (botón 48px + gap 8px) con un pequeño asomo de la 4ª para indicar que hay más */
        .canva-elements-grid { max-height: 172px; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 2px; }

        .cover-back {
            border-top-left-radius: 8px;
            border-bottom-left-radius: 8px
        }

        .cover-spine {
            height: 55vh;
            max-height: 108.2mm;
            width: auto;
            aspect-ratio: 12.2 / 108.2;
            padding: .5vh;
            display: flex;
            flex-direction: column;
            justify-content: space-between;
            align-items: center;
            box-sizing: border-box;
            border: 1px solid #e0e0e0;
            writing-mode: vertical-rl;
            text-orientation: mixed;
            position: relative
        }

        .cover-text {
            text-align: center;
            color: #fff;
            text-shadow: 0 2px 4px rgb(0 0 0 / .3)
        }

        .cover-front .cover-text h2 {
            font-family: 'Poppins',sans-serif;
            font-size: clamp(16px, 3vh, 2rem);
            font-weight: 600;
            margin-bottom: 1vh
        }

        .cover-front .cover-text p {
            font-family: 'Open Sans',sans-serif;
            font-size: clamp(12px, 2vh, 1.2rem)
        }

        .cover-back .cover-text p {
            font-family: 'Open Sans',sans-serif;
            font-size: clamp(10px, 1.5vh, 1rem);
            line-height: 1.4;
            background: rgb(0 0 0 / .5);
            padding: 1vh;
            border-radius: 1vh
        }

        .spine-text h3 {
            font-family: 'Poppins',sans-serif;
            font-size: clamp(10px, 1.8vh, 1.2rem);
            font-weight: 600;
            color: #fff;
            margin-bottom: 1vh
        }

        .spine-text p {
            font-family: 'Open Sans',sans-serif;
            font-size: .9rem;
            color: #fff
        }

        .customization-options {
            background: #f8f9fa;
            padding: 15px;
            border-radius: 10px;
            box-shadow: 0 2px 10px rgb(0 0 0 / .05)
        }

            .customization-options h5 {
                font-family: 'Poppins',sans-serif;
                font-weight: 600;
                color: #1a73e8;
                margin-bottom: 15px
            }

            .customization-options label {
                font-family: 'Open Sans',sans-serif;
                font-size: .9rem;
                color: #333;
                margin-bottom: 5px;
                display: block
            }

            .customization-options .form-control, .customization-options textarea {
                border-radius: 8px;
                padding: 8px;
                border: 1px solid #ced4da;
                transition: border-color 0.2s ease
            }

                .customization-options .form-control:focus, .customization-options textarea:focus {
                    border-color: #1a73e8;
                    outline: none;
                    box-shadow: 0 0 5px rgb(26 115 232 / .3)
                }

        .modal-footer {
            display: flex;
            justify-content: flex-end;
            gap: 10px;
            padding: 15px 20px;
            border-top: 1px solid #e0e0e0;
            background: #f8f9fa;
            border-bottom-left-radius: 15px;
            border-bottom-right-radius: 15px
        }

            .modal-footer .btn {
                border-radius: 20px;
                padding: 8px 20px;
                font-family: 'Poppins',sans-serif;
                font-weight: 600;
                transition: all 0.3s ease
            }

                .modal-footer .btn:hover {
                    transform: translateY(-2px);
                    box-shadow: 0 4px 12px rgb(0 0 0 / .2)
                }

        .title-container {
            display: flex;
            justify-content: center;
            margin-bottom: 2.5rem
        }

        h3 {
            font-family: 'Poppins',sans-serif;
            font-weight: 600;
            font-size: 2rem;
            display: inline-flex;
            align-items: center;
            gap: 12px;
            padding: 12px 25px;
            background: #1a73e8;
            color: #fff;
            border-radius: 30px;
            box-shadow: 0 6px 20px rgb(0 123 255 / .25);
            transition: transform 0.3s ease,box-shadow 0.3s ease
        }

            h3:hover {
                transform: scale(1.05);
                box-shadow: 0 8px 25px rgb(0 123 255 / .4)
            }

            h3 span.icon {
                font-size: 1.5rem;
                animation: pulse 1.5s infinite ease-in-out
            }

        @keyframes pulse {
            0% {
                transform: scale(1)
            }

            50% {
                transform: scale(1.1)
            }

            100% {
                transform: scale(1)
            }
        }

        .container-fluid {
            max-width: 90vw;
             padding-left:0;
            display: flex;
            flex-direction: row;
            align-items: center;
            justify-content: center;
            height: 100vh
        }

        .row {
            display: flex;
            justify-content: center;
            max-width: none;
            align-items: center
        }

        .sticky-header {
            position: sticky;
            top: 0;
            background: #fff;
            z-index: 100;
            padding: 1rem;
            border-bottom: 1px solid #eee
        }

        .col-md-3 {
            padding-right: 5px !important
        }

        .sidebar {
            background: #fff;
            border-radius: 15px;
            box-shadow: 0 4px 20px rgb(0 0 0 / .05);
            padding-top: 20px;
            padding-bottom: 20px;
            padding-left: 20px;
            position: sticky;
            top: 20px;
            width: 300px;
            min-width: 300px;
            overflow: hidden
        }

        .custom-accordion {
            margin-top: 15px;
            margin-bottom: 15px;
            padding-bottom: 20px
        }

        .accordion-item {
            margin-bottom: 10px;
            border-radius: 4px;
            overflow: hidden;
            background: #f8f9fa;
            transition: all 0.3s ease
        }

        .accordion-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 12px 15px;
            background: #ced4da;
            font-family: 'Poppins',sans-serif;
            font-weight: 600;
            cursor: pointer;
            user-select: none;
            transition: all 0.3s ease;
            color: #fff
        }

            .accordion-header:hover {
                background: #b8c1cc
            }

        .accordion-item:first-child .accordion-header {
            border-top-left-radius: 4px;
            border-top-right-radius: 4px
        }

        .accordion-item:last-child .accordion-header {
            border-bottom-left-radius: 4px;
            border-bottom-right-radius: 4px
        }

        .accordion-icon {
            font-size: 1.2rem;
            transition: transform 0.3s ease
        }

        .accordion-content {
            padding: 15px;
            background: #fff;
            animation: slideDown 0.3s ease-out
        }

        .accordion-item:last-child .accordion-content {
            border-bottom-left-radius: 4px;
            border-bottom-right-radius: 4px
        }

        @keyframes slideDown {
            from {
                opacity: 0;
                max-height: 0
            }

            to {
                opacity: 1;
                max-height: 500px
            }
        }

        .date-filter input[type="date"], .contact-management input[type="text"] {
            border-radius: 8px;
            padding: 8px;
            border: 1px solid #ced4da;
            transition: border-color 0.2s ease
        }

            .date-filter input[type="date"]:focus, .contact-management input[type="text"]:focus {
                border-color: #007bff;
                outline: none
            }

        .color-grid {
            display: grid;
            grid-template-columns: repeat(auto-fit,minmax(120px,1fr));
            gap: 8px
        }

        .color-columns {
            display: flex;
            gap: 20px;
            justify-content: space-between;
            padding: 10px 0
        }

        .color-column {
            flex: 1;
            display: flex;
            flex-direction: column;
            gap: 12px
        }

        .column-title {
            font-family: 'Poppins',sans-serif;
            font-size: .9rem;
            font-weight: 600;
            color: #666;
            margin-bottom: 8px;
            text-align: center
        }

        .color-item {
            display: flex;
            flex-direction: column;
            align-items: flex-start;
            padding: 8px 0
        }

            .color-item span {
                font-family: 'Open Sans',sans-serif;
                font-size: .85rem;
                color: #333;
                margin-bottom: 4px
            }

        .color-section {
            padding: 10px 0
        }

        .section-title {
            font-family: 'Poppins',sans-serif;
            font-size: 1rem;
            font-weight: 600;
            color: #333;
            margin-bottom: 12px;
            text-align: left
        }

        .color-grid {
            display: grid;
            grid-template-columns: repeat(auto-fit,minmax(160px,1fr));
            gap: 12px;
            padding: 0 5px
        }

        .color-option {
            display: flex;
            flex-direction: column;
            align-items: center;
            gap: 10px;
            padding: 10px;
            background: #f9f9f9;
            border-radius: 10px;
            transition: transform 0.2s ease,box-shadow 0.2s ease
        }

            .color-option:hover {
                transform: translateY(-2px);
                box-shadow: 0 4px 12px rgb(0 0 0 / .1)
            }

        .color-preview {
            width: 100%;
            height: 40px;
            border-radius: 8px;
            display: flex;
            align-items: center;
            justify-content: center;
            box-shadow: inset 0 0 4px rgb(0 0 0 / .2);
            position: relative;
            overflow: hidden
        }

        .preview-text {
            font-family: 'Roboto',sans-serif;
            font-size: .75rem;
            font-weight: 500;
            text-shadow: 0 1px 2px rgb(0 0 0 / .2)
        }

        .color-pickers {
            display: flex;
            gap: 10px;
            justify-content: center;
            width: 100%
        }

        .picker-group {
            display: flex;
            flex-direction: column;
            align-items: center;
            gap: 4px
        }

            .picker-group label {
                font-family: 'Open Sans',sans-serif;
                font-size: .75rem;
                font-weight: 500;
                color: #555;
                text-align: center
            }

        .color-picker-wrapper {
            position: relative;
            width: 32px;
            height: 32px;
            border-radius: 50%;
            overflow: hidden;
            box-shadow: 0 2px 6px rgb(0 0 0 / .15);
            transition: transform 0.2s ease
        }

            .color-picker-wrapper:hover {
                transform: scale(1.1)
            }

        .color-picker {
            width: 100%;
            height: 100%;
            padding: 0;
            margin: 0;
            border: none;
            background: #fff0;
            cursor: pointer;
            opacity: 0;
            position: absolute;
            top: 0;
            left: 0;
            z-index: 2
        }

        .color-picker-wrapper::before {
            content: '';
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: var(--color-picker-value,#ffffff);
            border-radius: 50%;
            border: 2px solid #fff;
            box-shadow: inset 0 0 3px rgb(0 0 0 / .2);
            z-index: 1
        }

        .color-picker:focus + .color-picker-wrapper::before, .color-picker-wrapper:hover::before {
            box-shadow: 0 0 6px rgb(0 123 255 / .5)
        }

        .book-container {
            background: linear-gradient(135deg,#ffffff,#f1f3f5);
            border-radius: 15px;
            padding: 15px;
            height: 95vh;
            max-height: 95vh;
            width: 100%;
             position:relative;
            overflow: hidden;
            box-shadow: 0 4px 20px rgb(0 0 0 / .05);
            margin: 0 auto;
            padding-bottom: 7vh !important
        }

        .book-open {
            display: flex;
            justify-content: center;
            gap: 20px;
            height: 100%
        }

        .book-page {
            aspect-ratio: 500 / 650;
            height: auto;
            max-height: 90vh;
            overflow: hidden;
            display: flex;
            flex-direction: column;
            box-shadow: 0 6px 12px rgb(0 0 0 / .08);
            border: 1px solid #e0e0e0;
            border-radius: 10px;
            padding: 5px;
            
        }

            .book-page:hover {
                transform: translateY(-5px)
            }

        .page-content {
            height: 100%;
            overflow: hidden;
            padding: 10px 15px;
            box-sizing: border-box;
            /* Referencia para la marca de corte, que va en posición absoluta sobre el borde de la hoja. */
            position: relative
        }

        .page-footer {
            position: absolute;
            bottom: 10px;
            left: 0;
            right: 0;
            height: 20px;
            font-size: .9rem;
            color: #555;
            font-family: 'Arial',sans-serif
        }

        .page-number-left {
            position: absolute;
            left: 20px
        }

        .page-number-right {
            position: absolute;
            right: 20px
        }

        .message-container {
            padding: 3.75px 0;
            display: flex;
            flex-direction: column;
            box-sizing: border-box
        }

        .message-wrapper {
            display: flex;
            align-items: flex-start;
            position: relative
        }

        .sent .message-wrapper {
            justify-content: flex-end
        }

        .received .message-wrapper {
            justify-content: flex-start
        }

        .message-content {
            display: flex;
            flex-direction: column;
            max-width: 75%
        }

        .sent .message-content {
            align-items: flex-end
        }

        .received .message-content {
            align-items: flex-start
        }

        .message-bubble {
            border-radius: 20px;
            box-shadow: 0 1.5px 4px rgb(0 0 0 / .05);
            position: relative;
            font-family: 'Roboto',sans-serif;
            transition: transform 0.2s ease;
            word-wrap: break-word;
            display: inline-block;
            box-sizing: border-box;
            width: fit-content;
            max-width: 100%;
            white-space: pre-wrap;
            font-size: clamp(9px, 1.8vh, 50px) !important;
             line-height:1.25 !important;
            padding: .5em 0.8em !important
        }

            .message-bubble:hover {
                transform: scale(1.02)
            }

            .message-bubble p {
                margin: 0;
                padding: 0
            }

            .message-bubble a {
                text-decoration: underline;
                color: inherit
            }

        .customization-modal-overlay {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: rgb(0 0 0 / .6);
            display: flex;
            justify-content: center;
            align-items: center;
            z-index: 1100
        }

        .customization-modal {
            background: #fff;
            border-radius: 15px;
            width: 90%;
            max-width: 550px;
            box-shadow: 0 5px 25px rgb(0 0 0 / .2)
        }

        .customization-container {
            padding: 20px
        }

            .customization-container label {
                font-family: 'Open Sans',sans-serif;
                font-weight: 600;
                color: #555;
                margin-bottom: 5px;
                display: block
            }

            .customization-container .form-control {
                border-radius: 8px;
                padding: 8px 12px;
                border: 1px solid #ced4da;
                width: 100%
            }

        .message-bubble-edit {
            min-height: 0 !important;
            margin: 0;
            border: none;
            background: none;
            color: inherit;
            font-family: inherit;
            resize: none;
            outline: none;
            box-sizing: border-box;
            display: block;
            height: auto;
            overflow-y: hidden;
            width: 100% !important;
            font-size: clamp(9px, 1.8vh, 50px) !important;
             line-height:1.25 !important;
            border-radius: 1.5vh !important;
            padding: .2vh 0.5vw !important
        }

        .date-header {
            text-align: center;
            margin-bottom: 0.8vh !important;
            font-size: clamp(8px, 1.1vh, 12px) !important;
            color: #666
        }

        .sender-name {
            font-size: clamp(7px, 1vh, 11px) !important;
            margin-top: 0.4vh !important;
            display: block;
            color: #666;
            font-family: 'Arial',sans-serif;
            line-height: 1.2 !important;
            width: fit-content
        }

        .message-image {
            height: auto;
            object-fit: contain;
            border-radius: 6.75px;
            margin-top: 6.75px;
            box-shadow: 0 1px 3px rgb(0 0 0 / .1);
            max-height: 30vh !important;
            height: auto;
            width: auto;
            max-width: clamp(13vw, 6vw + 10rem, 14vw) !important
        }

        .message-sticker {
             height:auto;
            object-fit: contain;
            border-radius: 6.75px;
            margin-top: 6.75px;
            box-shadow: 0 1px 3px rgb(0 0 0 / .1);
            max-width: 100%;
            max-height: 16dvh;
            height: auto;
            width: auto
        }

        .message-actions {
            display: flex;
            align-items: center;
            opacity: 0;
            transition: opacity 0.2s ease;
            gap: 0.6vh !important
        }

        .message-container:hover .message-actions {
            opacity: 1
        }

        .message-bubble-edit ~ .message-actions {
            opacity: 1 !important
        }

        .message-actions-left {
            margin-right: 7.5px;
            order: -1
        }

        .message-actions-right {
            margin-left: 7.5px
        }

        .btn-icon {
            border-radius: 50%;
            padding: 0;
            display: flex;
            align-items: center;
            justify-content: center;
            border: none;
            transition: transform 0.2s ease,background-color 0.2s ease;
            width: clamp(18px, 2.5vh, 24px) !important;
            height: clamp(18px, 2.5vh, 24px) !important
        }

            .btn-icon svg {
                width: 60% !important;
                height: 60% !important
            }

            .btn-icon:hover {
                transform: scale(1.1)
            }

        .btn-delete {
            background-color: #ff4d4f;
            color: #fff
        }

        .btn-edit {
            background-color: #fb3;
            color: #fff
        }

        /* Salto de página: gris cuando está desactivado y azul cuando el mensaje empieza página nueva,
           para que se vea de un vistazo en qué mensajes hay un corte. El icono se dimensiona igual que
           los svg de los otros botones (.btn-icon svg) para que la fila quede uniforme. */
        .btn-pagebreak {
            background-color: #8a94a6;
            color: #fff
        }

        .btn-pagebreak-on {
            background-color: #1a73e8;
            color: #fff
        }

            .btn-pagebreak i {
                font-size: 60%;
                line-height: 1
            }

        /* ===================== CAPÍTULOS ===================== */
        /* Solo la fila del capítulo va centrada y a todo el ancho; los mensajes normales siguen pegados a
           su lado con .sent/.received, que no se tocan. Va con !important porque .message-content trae un
           max-width del 75% pensado para las burbujas. */
        .chapter-row .message-wrapper {
            justify-content: center !important;
            width: 100%
        }

        .chapter-row .message-content {
            width: 100% !important;
            max-width: 100% !important;
            align-items: center !important
        }

        .chapter-row .chapter-heading {
            margin: 0 auto
        }

        /* Los botones de hover (.message-actions) llevan opacity:0 pero SIGUEN ocupando sitio en la fila,
           así que le robaban ancho al título y lo dejaban descentrado. En los capítulos los sacamos del
           flujo y los flotamos a la derecha: el título ocupa entonces todo el ancho real de la hoja y
           queda centrado de verdad. Los mensajes normales no se tocan. */
        .chapter-row .message-wrapper {
            position: relative
        }

        .chapter-row .message-actions {
            position: absolute;
            right: 0;
            top: 50%;
            transform: translateY(-50%);
            margin: 0 !important
        }

            /* El capítulo se dibuja con .chapter-heading. La burbuja de texto que generaría ese mismo
           mensaje se oculta aquí, y así no hemos tenido que tocar el bloque de render de mensajes,
           que es la parte más delicada del editor. */
            .chapter-row .message-bubble {
                display: none !important
            }

        .chapter-heading {
            width: 100%;
            text-align: center;
            padding: 10px 6px;
            color: #1a1a1a
        }

        /* Un título largo se reparte en varias líneas y TODAS quedan centradas (lo hereda del
           text-align:center de .chapter-heading), nunca pegadas a la izquierda ni desbordando la hoja.
           overflow-wrap:anywhere parte también una palabra sin espacios exageradamente larga. */
        .chapter-heading-title {
            display: inline-block;
            line-height: 1.25;
            max-width: 100%;
            white-space: normal;
            overflow-wrap: anywhere;
            word-break: break-word
        }

        /* ===================== ÍNDICE ===================== */
        /* Ocupa la hoja entera (el paginador le reserva todo el alto), con el título arriba y la lista
           de capítulos debajo. Reutiliza .chapter-row para ir a todo el ancho y centrado. */
        .book-index {
            width: 100%;
            /* A los lados, el mismo aire que deja la hoja impresa (40 pt de margen sobre 420 de ancho).
               El relleno de arriba y abajo se queda en 6: es el que entra en la cuenta del reparto. */
            padding: 6px 34px;
            color: #1a1a1a;
            /* Sin esto, el alto del 100% se SUMABA al padding y el bloque sobresalía 12 px de la hoja.
               Como la página recorta lo que se sale, la última entrada del índice desaparecía. */
            box-sizing: border-box
        }

        .book-index-title {
            text-align: center;
            font-size: 1.35rem;
            font-weight: 700;
            letter-spacing: .04em;
            margin-bottom: 16px
        }

        .book-index-list {
            list-style: none;
            margin: 0;
            padding: 0
        }

        .book-index-item {
            display: flex;
            align-items: center;
            gap: 6px;
            font-size: .92rem
        }

        /* La hoja del índice ocupa toda la página y reparte los 12 capítulos en 12 huecos del mismo alto,
           igual que hace el PDF. Así cada entrada cae siempre en la misma posición: si hay menos de 12
           sobra sitio abajo, pero las que hay no se estiran ni se amontonan, y nunca se sale ninguna.
           Para que los porcentajes funcionen, la altura tiene que propagarse desde la página hasta la
           lista, de ahí la cadena de height:100%. */
        .index-row,
        .index-row .message-wrapper,
        .index-row .message-content,
        .index-row .book-index {
            height: 100%
        }

        .index-row .book-index {
            display: flex;
            flex-direction: column;
            min-height: 0
        }

        /* El título ocupa un hueco más, igual que en el PDF: 13 en total (título + 12 capítulos). */
        /* Reparto en PÍXELES, no en porcentajes.
           La hoja lógica mide 555 px fijos (411x555, el modelo del paginador), así que los huecos se
           pueden fijar y el resultado es siempre el mismo. Antes se repartía con porcentajes de flex
           anidados, y ahí el flex-basis en % dentro de otro contenedor flex no resuelve de forma fiable:
           el último capítulo de cada hoja se salía y la página, que recorta, lo hacía desaparecer.

           Cuentas: 40 del título + 12 huecos de 38 = 496, más el relleno = 508, por debajo de los 535 de
           alto útil. Sobran casi 30 px, así que ni el redondeo puede volver a comerse una fila. */
        /* El alto del título y de las filas lo pone la ficha de cada diseño (atributo style), porque
           cambia de uno a otro. Aquí solo queda el comportamiento común. */
        .index-row .book-index-title {
            flex: 0 0 auto;
            margin-bottom: 0;
            display: flex;
            align-items: center;
            justify-content: center
        }

        .index-row .book-index-list {
            flex: 1 1 auto;
            min-height: 0;
            display: block
        }

        /* 12 huecos iguales: el alto de cada uno es una doceava parte de la lista. */
        /* Los 12 huecos se reparten dejando 4 px de holgura en total: repartir el 100% exacto depende
           del redondeo del navegador y bastaba una fracción de píxel para que el último se saliera. */
        /* El hueco de cada fila incluye su separación. El estilo "tarjetas" añade 6 px de margen propio,
           que no estaban contados: cada fila ocupaba 44 px en vez de 38 y la duodécima se salía de la
           hoja. Aquí se fija el margen para TODOS los estilos, de modo que la cuenta no dependa de cuál
           esté elegido.

           Cuentas: 535 de alto útil, menos 12 del relleno = 523. Título 36 + 12 filas de (35+5) = 516.
           Sobran 7 px. */
        .index-row .book-index-item {
            margin-bottom: 5px !important;
            box-sizing: border-box;
            flex: 0 0 auto
        }

        .book-index-name {
            flex: 0 1 auto;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap
        }

        /* El separador se estira y llena el hueco entre el título y el número */
        .book-index-fill {
            flex: 1 1 auto;
            min-width: 12px;
            align-self: center;
            height: 1px
        }

        .book-index-page {
            flex: 0 0 auto;
            font-variant-numeric: tabular-nums;
            font-weight: 600
        }

        /* Con líneas: un filete continuo une el título con la página */
        .book-index-lines .book-index-fill {
            border-bottom: 1px solid #c9c9c9
        }

        /* Con puntos: el clásico punteado de los libros */
        .book-index-dots .book-index-fill {
            border-bottom: 2px dotted #b5b5b5
        }

        /* Sencillo: sin separador, solo título y número a los extremos */
        .book-index-plain .book-index-item {
            border-bottom: 1px solid #eee
        }

        /* Tarjetas: cada capítulo en su recuadro */
        .book-index-cards .book-index-item {
            background: #f5f6f8;
            border: 1px solid #e6e8eb;
            border-radius: 8px;
            padding: 8px 10px;
            margin-bottom: 6px
        }

        /* ----- Diseños del índice -----
           Solo aspecto: los altos vienen de la ficha, así que aquí no hay ninguna medida que pueda
           descuadrar el reparto por hojas. */

        .bi-spacer {
            flex: 1 1 auto
        }

        /* Dos columnas */
        .book-index-list.bi-cols {
            display: grid;
            column-gap: 14px
        }

        .book-index-list.bi-cols-2 {
            grid-template-columns: 1fr 1fr;
            /* Raya de puntos por el centro, de arriba abajo, entre las dos columnas. */
            background: repeating-linear-gradient(to bottom, #c3c3c3 0 2px, transparent 2px 6px) center top / 1px 100% no-repeat
        }

        .book-index-list.bi-cols-3 {
            grid-template-columns: 1fr 1fr 1fr;
            column-gap: 10px
        }

        /* Entrada del diseño de revista: la página en grande y el capítulo debajo. */
        .bi-mag {
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            width: 100%;
            gap: 4px;
            text-align: center;
            border-bottom: 1px solid #e6e6e6;
            padding-bottom: 10px
        }

        .bi-mag-page {
            font-size: 26px;
            font-weight: 700;
            line-height: 1
        }

        .book-index-magazine .book-index-name {
            font-size: 9px;
            letter-spacing: .06em;
            text-transform: uppercase;
            line-height: 1.35
        }

        .book-index-magazine .book-index-title span {
            font-size: 26px;
            font-weight: 700
        }

        /* Raya corta entre el número y el título del diseño numerado. */
        .bi-rule {
            flex: 0 0 auto;
            width: 34px;
            height: 1px;
            background: #c9b9a0;
            margin: 0 12px
        }

        /* Segunda línea de la entrada del diseño serif: título, guía y número. */
        .bi-line {
            display: flex;
            align-items: baseline;
            gap: 6px;
            width: 100%
        }

        .bi-num {
            flex: 0 0 auto;
            min-width: 26px;
            font-weight: 300;
            color: #b3a184;
            letter-spacing: .02em
        }

        /* Entrada de dos líneas */
        .bi-stack {
            flex: 1 1 auto;
            display: flex;
            flex-direction: column;
            justify-content: center;
            width: 100%;
            min-width: 0;
            overflow: hidden
        }

        .bi-chap {
            font-size: 11px;
            font-weight: 700;
            line-height: 1.25
        }

        /* Titulares con adorno debajo (caligráfico e imprenta) */
        .bi-titlewrap {
            display: flex;
            flex-direction: column;
            align-items: center;
            width: 100%
        }

        .bi-script {
            font-family: 'Great Vibes', cursive;
            font-size: 30px;
            line-height: 1.15
        }

        .bi-vintage-t {
            font-family: 'Times New Roman', serif;
            font-size: 18px;
            letter-spacing: .12em;
            text-transform: uppercase
        }

        .bi-orn {
            width: 140px;
            height: 18px
        }

            .bi-orn svg {
                width: 100%;
                height: 100%;
                display: block
            }

        /* Serif clásico: versalitas espaciadas y filete dorado */
        .book-index-serif .book-index-title span {
            font-family: 'Cormorant Garamond', serif;
            font-size: 19px;
            letter-spacing: .26em;
            text-transform: uppercase;
            border-bottom: 2px solid #b3a184;
            padding-bottom: 7px
        }

        .book-index-serif .book-index-name {
            font-size: 10px;
            color: #666;
            /* Sin crecer: así la guía de puntos arranca justo detrás del título, no en un punto fijo. */
            flex: 0 1 auto;
            min-width: 0;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis
        }

        .book-index-serif .book-index-fill {
            border-bottom: 1.5px dotted #b5b5b5
        }

        /* Editorial: versalitas muy espaciadas, sin guía */
        .book-index-editorial .book-index-title span {
            font-size: 11px;
            letter-spacing: .32em;
            text-transform: uppercase;
            color: #8a8a8a
        }

        .book-index-editorial .book-index-name {
            font-size: 10px;
            letter-spacing: .13em;
            text-transform: uppercase
        }

        /* Numerado */
        .book-index-numbered .book-index-title span {
            font-family: 'Cormorant Garamond', serif;
            font-size: 25px
        }

        .book-index-numbered .bi-num {
            font-size: 19px;
            min-width: 34px
        }

        .book-index-numbered .book-index-name {
            font-size: 11px;
            letter-spacing: .11em;
            text-transform: uppercase;
            flex: 1 1 auto;
            min-width: 0;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis
        }

        /* Caligráfico */
        .book-index-script .book-index-name {
            font-family: 'Cormorant Garamond', serif;
            font-size: 11px;
            letter-spacing: .05em
        }

        /* Imprenta */
        .book-index-vintage .book-index-name {
            font-family: 'Times New Roman', serif;
            font-size: 10px;
            letter-spacing: .05em;
            text-transform: uppercase
        }

        .book-index-vintage .book-index-fill {
            border-bottom: 2px dotted #7a7a7a
        }

        /* Dos columnas */
        .book-index-twocol .book-index-title span {
            font-size: 21px;
            font-weight: 700
        }

        .book-index-twocol .book-index-name {
            font-size: 9px
        }

        .book-index-twocol .bi-num {
            font-size: 13px;
            min-width: 22px
        }

        /* ----- Modal de elección de diseño del índice ----- */
        /* Se escribe con las dos clases para ganarle al .customization-modal genérico (max-width 550px). */
        .customization-modal.index-modal {
            max-width: 980px;
            width: 94vw;
            max-height: 90vh;
            display: flex;
            flex-direction: column
        }

            /* El .modal-body de la app es un flex en columna con align-items:center, y eso encogía la
               rejilla al ancho de su contenido (las plantillas salían apiladas en una sola columna).
               Aquí lo devolvemos a bloque normal y le damos scroll propio, para que el modal no se salga
               de la pantalla por muchos diseños que haya. */
            .customization-modal.index-modal .modal-body {
                display: block;
                flex: 1 1 auto;
                min-height: 0;
                overflow-y: auto;
                text-align: left
            }

            .customization-modal.index-modal .modal-header,
            .customization-modal.index-modal .modal-footer {
                flex: 0 0 auto
            }

        .index-style-grid {
            display: grid;
            /* Columnas de ancho FIJO, no elástico: la miniatura se reduce con una escala fija, así que la
               tarjeta tiene que medir justo lo que ocupa la hoja reducida (411 x escala + relleno + borde).
               Si la columna se estirara, la hoja se quedaría corta o se saldría por los lados. */
            grid-template-columns: repeat(auto-fill, 213px);
            justify-content: center;
            gap: 12px;
            --prevscale: .46
        }

        @media (max-width: 768px) {
            /* En el móvil, una sola tarjeta por fila y más grande: es la pantalla donde no se distinguía. */
            .index-style-grid {
                grid-template-columns: minmax(0, 279px);
                --prevscale: .62
            }
        }

        .index-style-card {
            border: 2px solid #dcdfe3;
            background: #fff;
            border-radius: 10px;
            padding: 10px;
            display: flex;
            flex-direction: column;
            align-items: center;
            gap: 8px;
            cursor: pointer
        }

            .index-style-card.selected {
                border-color: #0d6efd;
                box-shadow: 0 0 0 3px rgba(13,110,253,.15)
            }

        .index-style-preview {
            width: 100%;
            height: 170px; /* solo para la dedicatoria; las hojas reducidas se lo redefinen */
            overflow: hidden;
            background: #fff;
            border: 1px solid #eee;
            border-radius: 6px;
            padding: 10px
        }

        .index-style-label {
            font-size: .82rem;
            font-weight: 600;
            color: #444
        }

        /* ===================== MARCA DE CORTE DE PÁGINA ===================== */
        /* Señala dónde el cliente ha cortado la página y sirve para deshacerlo con un toque. Antes el
           corte era invisible: había que ir mensaje por mensaje con el ratón buscando las tijeras azules,
           así que en un libro largo, al volver otro día, en la práctica no se podía quitar.

           Va en posición ABSOLUTA sobre el borde superior de la hoja: el mensaje que abre página es
           siempre el primero, así que ahí es donde está el corte. Al no ocupar sitio en el flujo, el
           paginador sigue cuadrando y no le roba margen a la hoja.

           Solo se dibuja en el editor; en el PDF impreso no existe. */
        .page-cut-mark {
            position: absolute;
            top: 2px;
            left: 6px;
            right: 6px;
            height: 16px;
            display: flex;
            align-items: center;
            gap: 6px;
            cursor: pointer;
            z-index: 4;
            opacity: .5;
            transition: opacity .15s ease
        }

            /* La franja entera es pulsable, no solo el icono: así en el móvil hay sitio de sobra para
               acertar con el dedo. */
            .page-cut-mark::before,
            .page-cut-mark::after {
                content: "";
                flex: 1;
                border-top: 1px dashed #9aa3ad
            }

            .page-cut-mark:hover {
                opacity: 1
            }

        /* La zona de "añadir contenido" (la barra con el +) vive también en el borde superior de la hoja:
           mide 24 px con margen negativo, así que su área de ratón caía justo encima de la marca. No basta
           con ocultar una: al solaparse las zonas sensibles, el ratón activaba la de insertar y la marca no
           se podía pulsar. Se separan bajando esa primera barra.

           Solo afecta a las hojas que empiezan con un corte, y son unos pocos píxeles frente al margen que
           le sobra a la página, así que no compromete el reparto del paginador. */
        .insert-zone:has(~ .page-cut-mark) {
            margin-top: 16px
        }

        .page-cut-icon {
            flex: 0 0 auto;
            width: 17px;
            height: 17px;
            border-radius: 50%;
            background: #fff;
            border: 1px solid #cfd4da;
            color: #6b7480;
            font-size: 9px;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            line-height: 1
        }

        .page-cut-mark:hover .page-cut-icon {
            border-color: #1a73e8;
            color: #1a73e8
        }

        /* ===================== ESTADÍSTICAS ===================== */
        /* Ocupa la hoja entera. Todo se construye con recursos que también existen en el PDF (filetes,
           recuadros y barras), para que la versión impresa pueda ser idéntica. */
        .book-stats {
            width: 100%;
            height: 100%;
            box-sizing: border-box;
            padding: 6% 7%;
            color: #1a1a1a;
            display: flex;
            flex-direction: column
        }

        .bs-title {
            text-align: center;
            font-size: 1.05rem;
            font-weight: 700;
            letter-spacing: .03em;
            margin-bottom: 14px
        }

        /* --- Titular --- */
        .bs-hero {
            display: flex;
            flex-direction: column;
            height: 100%;
            justify-content: center;
            text-align: center
        }

        .bs-hero-num {
            font-size: 3.4rem;
            font-weight: 800;
            line-height: 1
        }

        .bs-hero-label {
            font-size: .85rem;
            letter-spacing: .16em;
            text-transform: uppercase;
            color: #666;
            margin-top: 6px
        }

        .bs-rule {
            height: 1px;
            background: #d8d8d8;
            margin: 18px 0
        }

        .bs-pairs {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 4px 22px;
            text-align: left
        }

            .bs-pairs > div {
                display: flex;
                justify-content: space-between;
                align-items: baseline;
                border-bottom: 1px solid #eee;
                padding: 4px 0;
                font-size: .78rem
            }

                .bs-pairs > div span {
                    color: #777
                }

        .bs-senders {
            display: flex;
            justify-content: center;
            gap: 18px;
            margin-top: 16px;
            flex-wrap: wrap
        }

        .bs-sender {
            display: flex;
            flex-direction: column;
            align-items: center;
            font-size: .78rem
        }

            .bs-sender span {
                color: #777
            }

        /* --- Balance --- */
        /* La barra reparte el ancho según cuánto escribió cada persona; funciona con 2 o con 6. */
        .bs-bar {
            display: flex;
            height: 14px;
            border-radius: 7px;
            overflow: hidden;
            margin-bottom: 12px;
            background: #eee
        }

        .bs-bar-seg {
            background: #3a3a3a
        }

            .bs-bar-seg:nth-child(2) { background: #9aa3ad }
            .bs-bar-seg:nth-child(3) { background: #c8ccd2 }
            .bs-bar-seg:nth-child(4) { background: #6b7480 }
            .bs-bar-seg:nth-child(5) { background: #e0e3e7 }
            .bs-bar-seg:nth-child(6) { background: #b0b6bd }

        .bs-legend-row {
            display: flex;
            align-items: center;
            gap: 8px;
            padding: 4px 0;
            border-bottom: 1px solid #f0f0f0;
            font-size: .8rem
        }

        .bs-dot {
            width: 8px;
            height: 8px;
            border-radius: 50%;
            background: #3a3a3a;
            flex-shrink: 0
        }

        .bs-legend-row b {
            flex: 1;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap
        }

        .bs-legend-num {
            color: #777
        }

        .bs-legend-pct {
            font-weight: 700;
            min-width: 34px;
            text-align: right
        }

        /* --- Rejilla de cifras (Balance y Panel) --- */
        .bs-tiles {
            display: grid;
            grid-template-columns: repeat(4, 1fr);
            gap: 6px;
            margin: 10px 0
        }

            .bs-tiles > div {
                background: #f5f6f8;
                border: 1px solid #e9ebee;
                border-radius: 8px;
                padding: 8px 4px;
                text-align: center;
                display: flex;
                flex-direction: column;
                gap: 2px
            }

                .bs-tiles > div b {
                    font-size: .95rem;
                    line-height: 1.1
                }

                .bs-tiles > div span {
                    font-size: .6rem;
                    color: #777;
                    line-height: 1.15
                }

        /* --- Línea de tiempo --- */
        /* Los hitos son reales (día más activo, racha, silencio), no adornos. */
        .bs-timeline {
            position: relative;
            padding-left: 22px;
            flex: 1
        }

            .bs-timeline::before {
                content: "";
                position: absolute;
                left: 6px;
                top: 6px;
                bottom: 6px;
                width: 2px;
                background: #ddd
            }

        .bs-tl-item {
            position: relative;
            padding: 8px 0
        }

            .bs-tl-item::before {
                content: "";
                position: absolute;
                left: -20px;
                top: 14px;
                width: 9px;
                height: 9px;
                border-radius: 50%;
                background: #3a3a3a
            }

        .bs-tl-date {
            font-size: .68rem;
            color: #777;
            letter-spacing: .04em
        }

        .bs-tl-body b {
            display: block;
            font-size: .88rem
        }

        .bs-tl-body span {
            font-size: .7rem;
            color: #777
        }

        /* --- Panel --- */
        .bs-sec {
            font-size: .62rem;
            letter-spacing: .16em;
            text-transform: uppercase;
            color: #999;
            border-bottom: 1px solid #eee;
            padding-bottom: 3px;
            margin-top: 10px
        }

        /* Emojis más usados, al pie de cualquier plantilla */
        .bs-emojis {
            margin-top: auto;
            padding-top: 10px;
            text-align: center;
            font-size: 1.1rem;
            letter-spacing: .18em
        }


        /* ===================== PLANTILLAS NUEVAS DE ESTADÍSTICAS =====================
           Medidas en unidades de la hoja lógica (1 = 1 px en el editor = 1 pt en el PDF). Cada plantilla
           cabe de sobra en los 535 de alto útil; lo comprobado va anotado en cada una. */

        .book-stats-classic, .book-stats-wrapped, .book-stats-letter, .book-stats-charts {
            display: flex;
            flex-direction: column;
            height: 100%;
            padding: 4px 8px;
            box-sizing: border-box;
            color: #1a1a1a
        }

        /* ---------- Clásico: tarjetas de color ---------- */
        .bs-c-title {
            font-size: 15px;
            font-weight: 700;
            letter-spacing: .16em;
            text-transform: uppercase;
            text-align: center;
            line-height: 1.5;
            margin: 20px 0 26px
        }

        .bs-c-grid {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 10px
        }

        .bs-card {
            border-radius: 10px;
            padding: 30px 8px;
            text-align: center
        }

            .bs-card b {
                display: block;
                font-size: 30px;
                font-weight: 700;
                line-height: 1.1
            }

            .bs-card span {
                font-size: 8px;
                letter-spacing: .18em;
                text-transform: uppercase;
                color: #6a6a6a
            }

        .bs-card-1 { background: #EFEBFF }
        .bs-card-2 { background: #E7F5F0 }
        .bs-card-3 { background: #FFF1E4 }
        .bs-card-4 { background: #FDE9EE }

        .bs-c-band {
            display: grid;
            grid-template-columns: 1fr 1fr;
            background: #F5F5F7;
            border-radius: 10px;
            padding: 24px 8px;
            margin-top: 14px
        }

            .bs-c-band > div {
                text-align: center
            }

            .bs-c-band span {
                display: block;
                font-size: 8px;
                letter-spacing: .18em;
                text-transform: uppercase;
                color: #6a6a6a;
                margin-top: 6px
            }

        .bs-c-emoji {
            font-size: 26px;
            line-height: 1.1
        }

        .bs-c-word {
            font-size: 20px;
            font-weight: 700;
            line-height: 1.4
        }

        .bs-c-foot {
            display: grid;
            grid-template-columns: 1fr 1fr 1fr;
            /* Reparto fijo, no "margin-top:auto": el PDF no puede estirar un hueco sin partir la hoja, así
               que las dos vistas usan la misma medida. */
            padding-top: 74px
        }

            .bs-c-foot > div {
                text-align: center
            }

            .bs-c-foot b {
                display: block;
                font-size: 15px;
                font-weight: 700
            }

            .bs-c-foot span {
                font-size: 8px;
                letter-spacing: .18em;
                text-transform: uppercase;
                color: #8a8a8a
            }

        /* ---------- Wrapped: panel oscuro ---------- */
        .bs-wrapped {
            padding: 0 !important
        }

        .bs-w-panel {
            flex: 1 1 auto;
            display: flex;
            flex-direction: column;
            background: #141414;
            border-radius: 14px;
            color: #fff;
            padding: 20px 18px;
            text-align: center
        }

        .bs-w-intro {
            font-size: 9px;
            letter-spacing: .22em;
            text-transform: uppercase;
            color: #C8FF5E
        }

        .bs-w-big {
            font-size: 58px;
            font-weight: 800;
            line-height: 1;
            letter-spacing: -.02em;
            margin-top: 4px
        }

        .bs-w-times {
            font-size: 11px;
            letter-spacing: .3em;
            text-transform: uppercase;
            color: #9a9a9a
        }

        .bs-w-tops {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 14px;
            margin-top: 34px;
            text-align: left
        }

        .bs-w-sec {
            font-size: 8px;
            letter-spacing: .2em;
            text-transform: uppercase;
            color: #C8FF5E
        }

        .bs-w-sec-c {
            text-align: center;
            margin-top: 34px
        }

        .bs-w-list {
            list-style: none;
            margin: 6px 0 0;
            padding: 0
        }

            .bs-w-list li {
                display: flex;
                align-items: center;
                gap: 6px;
                font-size: 10px;
                line-height: 1.5;
                padding: 2px 0;
                border-bottom: 1px solid #2a2a2a
            }

            .bs-w-list i {
                font-style: normal;
                font-weight: 700;
                color: #6a6a6a;
                width: 10px
            }

            .bs-w-list span {
                flex: 1 1 auto;
                overflow: hidden;
                text-overflow: ellipsis;
                white-space: nowrap
            }

            .bs-w-list em {
                font-style: normal;
                font-size: 8px;
                color: #9a9a9a
            }

        .bs-w-em {
            font-size: 13px
        }

        .bs-w-bars {
            margin-top: 8px;
            text-align: left
        }

        .bs-w-bar {
            margin-bottom: 8px
        }

        .bs-w-bar-top {
            display: flex;
            justify-content: space-between;
            font-size: 10px;
            margin-bottom: 3px
        }

        .bs-w-track {
            height: 8px;
            background: #2a2a2a;
            border-radius: 4px;
            overflow: hidden
        }

            .bs-w-track i {
                display: block;
                height: 100%;
                background: #C8FF5E
            }

        .bs-w-day {
            margin-top: 46px
        }

        .bs-w-date {
            font-size: 24px;
            font-weight: 700;
            margin-top: 6px
        }

        .bs-w-daycount {
            font-size: 9px;
            letter-spacing: .16em;
            text-transform: uppercase;
            color: #9a9a9a;
            margin-top: 2px
        }

        /* ---------- Romántico ---------- */
        .bs-letter {
            text-align: center;
            justify-content: center;
            font-family: 'Cormorant Garamond', serif
        }

        .bs-l-title {
            font-size: 17px;
            letter-spacing: .16em;
            text-transform: uppercase;
            line-height: 1.6;
            margin-bottom: 24px
        }

        .bs-l-num {
            font-size: 36px;
            font-weight: 700;
            line-height: 1.1;
            margin-top: 14px
        }

        .bs-l-txt {
            font-size: 12px;
            font-style: italic;
            color: #555
        }

        .bs-l-soft {
            font-size: 11px;
            font-style: italic;
            color: #8a8a8a;
            margin-top: 22px
        }

        .bs-l-word {
            font-size: 26px;
            font-weight: 700;
            letter-spacing: .04em;
            margin-top: 4px
        }

        .bs-l-emoji {
            font-size: 30px;
            line-height: 1.3;
            margin-top: 14px
        }

        .bs-l-date {
            font-size: 22px;
            font-weight: 700;
            letter-spacing: .08em;
            margin-top: 4px
        }

        /* ---------- Infográfico ---------- */
        .bs-g-title {
            font-size: 16px;
            font-weight: 700;
            letter-spacing: .16em;
            text-transform: uppercase;
            margin: 8px 0 4px
        }

        .bs-g-sec {
            font-size: 8px;
            letter-spacing: .2em;
            text-transform: uppercase;
            color: #8a8a8a;
            margin: 34px 0 10px
        }

        .bs-g-row {
            display: flex;
            align-items: center;
            gap: 8px;
            margin-bottom: 9px
        }

        .bs-g-lab {
            flex: 0 0 78px;
            font-size: 9px;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis
        }

        .bs-g-track {
            flex: 1 1 auto;
            height: 7px;
            background: #eeeeee;
            border-radius: 4px;
            overflow: hidden
        }

            .bs-g-track i {
                display: block;
                height: 100%;
                background: #1a1a1a
            }

        .bs-g-val {
            flex: 0 0 28px;
            text-align: right;
            font-size: 9px;
            font-weight: 700
        }

        .bs-g-hours {
            display: flex;
            align-items: flex-end;
            gap: 2px;
            height: 52px
        }

            .bs-g-hours i {
                flex: 1 1 auto;
                background: #d8d8d8;
                border-radius: 1px
            }

                .bs-g-hours i.on {
                    background: #1a1a1a
                }

        .bs-g-hlabels {
            display: flex;
            justify-content: space-between;
            font-size: 7px;
            color: #9a9a9a;
            margin-top: 3px
        }

        .bs-g-days {
            display: flex;
            align-items: flex-end;
            gap: 6px;
            height: 62px
        }

        .bs-g-day {
            flex: 1 1 auto;
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: flex-end;
            height: 100%
        }

            .bs-g-day i {
                width: 100%;
                background: #1a1a1a;
                border-radius: 2px
            }

            .bs-g-day span {
                font-size: 7px;
                color: #9a9a9a;
                margin-top: 3px
            }


        .book-stats-records, .book-stats-story, .book-stats-chat, .book-stats-editorial {
            display: flex;
            flex-direction: column;
            height: 100%;
            padding: 4px 8px;
            box-sizing: border-box;
            color: #1a1a1a
        }

        /* ---------- Récords ---------- */
        .bs-r-title {
            font-size: 17px;
            font-weight: 700;
            letter-spacing: .16em;
            text-transform: uppercase;
            text-align: center;
            margin: 18px 0 24px
        }

        .bs-r-card {
            display: flex;
            align-items: center;
            gap: 12px;
            background: #F7F7F9;
            border-radius: 12px;
            padding: 14px 14px;
            margin-bottom: 12px
        }

        .bs-r-icon {
            flex: 0 0 34px;
            font-size: 24px;
            line-height: 1;
            text-align: center
        }

        .bs-r-body {
            flex: 1 1 auto;
            display: flex;
            flex-direction: column;
            min-width: 0
        }

        .bs-r-lab {
            font-size: 8px;
            letter-spacing: .18em;
            text-transform: uppercase;
            color: #8a8a8a
        }

        .bs-r-val {
            font-size: 24px;
            font-weight: 700;
            line-height: 1.2
        }

        .bs-r-det {
            flex: 0 0 auto;
            font-size: 9px;
            color: #8a8a8a;
            text-align: right;
            white-space: nowrap
        }

        /* ---------- Cronología ---------- */
        .bs-y-title {
            font-size: 17px;
            font-weight: 700;
            letter-spacing: .16em;
            text-transform: uppercase;
            text-align: center;
            margin: 16px 0 20px
        }

        .bs-y-edge {
            display: flex;
            justify-content: space-between;
            align-items: baseline;
            font-size: 9px;
            color: #8a8a8a;
            border-top: 1px solid #e6e6e6;
            padding-top: 8px;
            margin-top: 8px
        }

            .bs-y-edge b {
                font-size: 8px;
                letter-spacing: .18em;
                text-transform: uppercase
            }

            .bs-y-edge span {
                font-size: 12px;
                font-weight: 700;
                color: #1a1a1a
            }

        .bs-y-line {
            position: relative;
            padding-left: 22px;
            margin-top: 14px
        }

            /* La línea del tiempo, por detrás de los puntos. */
            .bs-y-line::before {
                content: "";
                position: absolute;
                left: 4px;
                top: 6px;
                bottom: 6px;
                width: 1px;
                background: #d8d8d8
            }

        .bs-y-row {
            position: relative;
            display: flex;
            align-items: center;
            gap: 10px
        }

        .bs-y-dot {
            position: absolute;
            left: -22px;
            width: 9px;
            height: 9px;
            border-radius: 50%;
            background: #1a1a1a
        }

        .bs-y-year {
            font-size: 20px;
            font-weight: 700;
            letter-spacing: .02em;
            min-width: 54px
        }

        .bs-y-count {
            font-size: 10px;
            color: #6a6a6a
        }

        /* ---------- Chat ---------- */
        .bs-h-heads {
            display: flex;
            gap: 10px;
            margin: 10px 0 18px
        }

            .bs-h-heads > div {
                flex: 1 1 0;
                background: #F7F7F9;
                border-radius: 10px;
                padding: 10px 8px;
                text-align: center
            }

            .bs-h-heads b {
                display: block;
                font-size: 11px
            }

            .bs-h-heads span {
                font-size: 8px;
                letter-spacing: .12em;
                text-transform: uppercase;
                color: #8a8a8a
            }

        .bs-h-in, .bs-h-out {
            max-width: 74%;
            border-radius: 14px;
            padding: 9px 12px;
            font-size: 11px;
            line-height: 1.35;
            margin-bottom: 8px
        }

        .bs-h-in {
            background: #EDEDF0;
            border-bottom-left-radius: 4px
        }

        .bs-h-out {
            background: #1a1a1a;
            color: #fff;
            margin-left: auto;
            border-bottom-right-radius: 4px;
            text-align: right
        }

            .bs-h-out.big {
                font-size: 20px;
                font-weight: 700
            }

        .bs-h-foot {
            margin-top: 10px;
            text-align: center;
            font-size: 9px;
            letter-spacing: .14em;
            text-transform: uppercase;
            color: #8a8a8a
        }

        /* ---------- Editorial ---------- */
        .bs-editorial {
            text-align: center
        }

        .bs-e-big {
            font-size: 62px;
            font-weight: 800;
            line-height: 1;
            letter-spacing: -.02em;
            margin-top: 24px
        }

        .bs-e-lab {
            font-size: 9px;
            letter-spacing: .28em;
            text-transform: uppercase;
            color: #8a8a8a;
            margin-top: 6px
        }

        .bs-e-rule {
            height: 1px;
            background: #dcdcdc;
            margin: 24px 40px
        }

        .bs-e-trio {
            display: flex
        }

            .bs-e-trio > div {
                flex: 1 1 0
            }

            .bs-e-trio b {
                display: block;
                font-size: 20px;
                font-weight: 700
            }

            .bs-e-trio span {
                font-size: 8px;
                letter-spacing: .18em;
                text-transform: uppercase;
                color: #8a8a8a
            }

        .bs-e-cap {
            font-size: 8px;
            letter-spacing: .22em;
            text-transform: uppercase;
            color: #8a8a8a
        }

        .bs-e-word {
            font-size: 26px;
            font-weight: 700;
            margin-top: 6px
        }

        .bs-e-emoji {
            font-size: 22px;
            line-height: 1.6
        }

        .bs-e-date {
            font-size: 22px;
            font-weight: 700;
            letter-spacing: .08em;
            margin-bottom: 4px
        }

        /* Miniaturas del modal: la página se dibuja a su TAMAÑO REAL (411x555, el mismo modelo que usa la
           hoja del editor) y se reduce entera con una escala. Antes se encogía elemento por elemento y el
           reparto no cuadraba nunca: el contenido se salía de la tarjeta. Así la miniatura es fiel a lo
           que se va a imprimir. */
        .stats-preview {
            position: relative;
            overflow: hidden;
            padding: 0;
            /* La caja mide EXACTAMENTE lo que ocupa la hoja reducida y se centra sola con el margen
               automático. Antes se estiraba al ancho de la tarjeta y la hoja se colocaba con un margen
               negativo calculado: bastaba con que la cuenta no cuadrase por un pelo para que la hoja
               quedase descentrada y se cortase por un lado. Así no hay ninguna cuenta que pueda fallar.
               El valor de reserva de la escala evita que la caja se quede sin medidas si la variable no
               llega por lo que sea. */
            box-sizing: content-box;
            width: calc(411px * var(--prevscale, .46));
            height: calc(555px * var(--prevscale, .46));
            margin-left: auto;
            margin-right: auto
        }

            /* El índice sí se recorta: se ven el título y las 3 o 4 primeras entradas, pero grandes. Es
               mejor distinguir el diseño con pocos capítulos que verlos todos y no leer ninguno. */
            .idx-preview.stats-preview {
                height: calc(250px * var(--prevscale, .46))
            }

            .stats-preview > .book-stats,
            .stats-preview > .book-index {
                width: 411px;
                height: 555px;
                position: absolute;
                top: 0;
                left: 0;
                transform: scale(var(--prevscale, .46));
                transform-origin: top left
            }

        /* --- Romance (parejas) --- */
        .bs-romance {
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            height: 100%;
            text-align: center
        }

        .bs-rom-label {
            font-size: .68rem;
            letter-spacing: .22em;
            text-transform: uppercase;
            color: #999
        }

        .bs-rom-big {
            font-size: 3.6rem;
            font-weight: 800;
            line-height: 1;
            margin-top: 4px
        }

        .bs-rom-unit {
            font-size: .8rem;
            letter-spacing: .18em;
            text-transform: uppercase;
            color: #777
        }

        .bs-rom-dates {
            font-size: .72rem;
            color: #888;
            margin-top: 10px
        }

        .bs-rom-names {
            display: flex;
            gap: 26px;
            margin: 18px 0 14px
        }

            .bs-rom-names > div {
                display: flex;
                flex-direction: column;
                font-size: .78rem
            }

                .bs-rom-names > div span {
                    color: #888;
                    font-size: .68rem
                }

        .bs-tiles-3 {
            grid-template-columns: repeat(3, 1fr);
            width: 100%
        }

        /* --- Grupo (familia y amigos) --- */
        .bs-ranking {
            display: flex;
            flex-direction: column;
            gap: 7px;
            margin-bottom: 10px
        }

        .bs-rank-name {
            display: flex;
            justify-content: space-between;
            font-size: .78rem;
            margin-bottom: 2px
        }

            .bs-rank-name span {
                color: #888
            }

        .bs-rank-track {
            height: 7px;
            background: #eef0f2;
            border-radius: 4px;
            overflow: hidden
        }

        .bs-rank-fill {
            height: 100%;
            background: #3a3a3a;
            border-radius: 4px
        }

        /* --- Elegante (regalo formal) --- */
        .bs-elegant {
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            height: 100%;
            text-align: center;
            gap: 22px
        }

        .bs-eleg-title {
            font-size: .68rem;
            letter-spacing: .24em;
            text-transform: uppercase;
            color: #999
        }

        .bs-eleg-item b {
            display: block;
            font-size: 2.1rem;
            font-weight: 300;
            line-height: 1
        }

        .bs-eleg-item span {
            display: block;
            font-size: .62rem;
            letter-spacing: .16em;
            text-transform: uppercase;
            color: #999;
            margin-top: 4px
        }

        .bs-eleg-dates {
            font-size: .68rem;
            color: #aaa;
            border-top: 1px solid #e6e6e6;
            padding-top: 12px
        }

        /* Emojis más usados, con su etiqueta para que se entienda qué son */
        .bs-emojis-block {
            margin-top: auto;
            padding-top: 10px;
            text-align: center
        }

        .bs-emojis-label {
            font-size: .58rem;
            letter-spacing: .16em;
            text-transform: uppercase;
            color: #999;
            margin-bottom: 4px
        }

        /* En la hoja calibrada de escritorio, todo en píxeles fijos como el resto del libro. */
        /* Se aplica en escritorio Y en móvil: la hoja lógica es la misma, solo cambia la escala. */
            .book-stats .bs-hero-num { font-size: 40px }
            .book-stats .bs-hero-label { font-size: 9px }
            .book-stats .bs-title { font-size: 13px }
            .book-stats .bs-pairs > div,
            .book-stats .bs-legend-row { font-size: 9px }
            .book-stats .bs-sender { font-size: 9px }
            .book-stats .bs-tiles > div b { font-size: 11px }
            .book-stats .bs-tiles > div span { font-size: 7px }
            .book-stats .bs-sec { font-size: 7px }
            .book-stats .bs-tl-date { font-size: 8px }
            .book-stats .bs-tl-body b { font-size: 10px }
            .book-stats .bs-tl-body span { font-size: 8px }
            .book-stats .bs-emojis { font-size: 14px }

        /* ===================== DEDICATORIA ===================== */
        /* Ocupa la hoja entera (el paginador le reserva todo el alto) con el texto centrado. Reutiliza
           .index-row para estirarse a toda la página, igual que el índice. */
        .book-dedication {
            width: 100%;
            height: 100%;
            display: flex;
            align-items: center;
            justify-content: center;
            padding: 8% 10%;
            box-sizing: border-box;
            color: #1a1a1a;
            text-align: center
        }

        /* overflow-wrap:anywhere parte también las palabras larguísimas sin espacios; sin esto el texto se
           salía por los lados de la hoja en lugar de bajar de línea. */
        .book-dedication-inner {
            white-space: pre-wrap;
            line-height: 1.6;
            max-width: 100%;
            overflow-wrap: anywhere;
            word-break: break-word
        }

        /* Sencilla: texto centrado y sin adornos */
        .book-dedication-simple .book-dedication-inner {
            font-size: 1rem
        }

        /* Clásica: cursiva con filetes arriba y abajo */
        .book-dedication-classic .book-dedication-inner {
            font-size: 1.05rem;
            font-style: italic;
            border-top: 1px solid #bdbdbd;
            border-bottom: 1px solid #bdbdbd;
            padding: 18px 6px
        }

        /* Amor: cursiva con un corazón encima */
        .book-dedication-love .book-dedication-inner {
            font-size: 1.05rem;
            font-style: italic
        }

            .book-dedication-love .book-dedication-inner::before {
                content: "♥";
                display: block;
                font-size: 1.6rem;
                color: #d6455d;
                margin-bottom: 14px
            }

        /* Familia: recuadro suave */
        .book-dedication-family .book-dedication-inner {
            font-size: 1rem;
            background: #f6f3ee;
            border: 1px solid #e4ddd2;
            border-radius: 10px;
            padding: 20px 18px
        }

        /* Amigos: comillas grandes de apertura */
        .book-dedication-friends .book-dedication-inner {
            font-size: 1rem;
            position: relative;
            padding-top: 26px
        }

            .book-dedication-friends .book-dedication-inner::before {
                content: "“";
                position: absolute;
                top: -10px;
                left: 50%;
                transform: translateX(-50%);
                font-size: 3rem;
                color: #c9c9c9;
                line-height: 1
            }

        /* Minimalista: versalitas espaciadas y pequeñas */
        .book-dedication-minimal .book-dedication-inner {
            font-size: .8rem;
            letter-spacing: .12em;
            text-transform: uppercase;
            line-height: 2
        }

        /* ----- Diseños con titular -----
           Medidas en unidades de la hoja lógica (1 = 1 px en el editor = 1 pt en el PDF), nunca en
           porcentajes: son los porcentajes los que hacen que lo que se ve y lo que se imprime se separen. */

        .book-dedication {
            position: relative
        }

        .bd-body {
            display: flex;
            flex-direction: column;
            align-items: center;
            width: 100%;
            position: relative;
            z-index: 1
        }

        .bd-heading {
            font-family: 'Cormorant Garamond', serif;
            margin-bottom: 14px
        }

        /* Guirnalda: enmarca la hoja entera, por detrás del texto. */
        .bd-frame {
            position: absolute;
            top: 2.5%;
            bottom: 2.5%;
            left: 1.2%;
            right: 1.2%;
            z-index: 0;
            pointer-events: none
        }

            .bd-frame svg {
                width: 100%;
                height: 100%;
                display: block
            }

        .bd-feather {
            width: 150px;
            height: 33px;
            margin: -4px 0 12px
        }

            .bd-feather svg {
                width: 100%;
                height: 100%;
                display: block
            }

        /* Inicial gigante de fondo. */
        .bd-initial {
            position: absolute;
            top: 66px;
            left: 50%;
            transform: translateX(-50%);
            font-family: 'Cormorant Garamond', serif;
            color: #4A9FD8;
            line-height: .8;
            z-index: 0;
            user-select: none
        }

        /* --- Filetes --- */
        .book-dedication-rules .bd-heading {
            font-size: 17px;
            font-weight: 700;
            font-style: italic
        }

        .book-dedication-rules .book-dedication-inner {
            font-style: italic;
            border-top: 1px solid #333;
            border-bottom: 1px solid #333;
            padding: 16px 4px
        }

        /* --- Voluta --- */
        .book-dedication-flourish .bd-heading {
            font-size: 34px;
            font-weight: 400;
            margin-bottom: 4px
        }

        /* --- Inicial --- */
        .book-dedication-initial {
            align-items: flex-start;
            /* En unidades de la hoja, no en %: el relleno en porcentaje se calcula sobre el ANCHO, así que
               no habría caído a la misma altura que en el PDF. */
            padding-top: 145px
        }

        .book-dedication-initial .bd-initial {
            font-size: 250px;
            /* Rebajada: a plena tinta, el texto que le pasa por encima no se leía. */
            opacity: .35
        }

        .book-dedication-initial .bd-heading {
            font-size: 19px;
            font-weight: 700;
            letter-spacing: .08em;
            text-transform: uppercase
        }

        .book-dedication-initial .book-dedication-inner {
            text-align: justify;
            /* Ancho en unidades de la hoja, no en porcentaje: tiene que ser el MISMO que en el PDF. */
            width: 250px
        }

        /* --- Guirnalda --- */
        .book-dedication-wreath .book-dedication-inner {
            font-family: 'Cormorant Garamond', serif;
            font-style: italic;
            /* Columna estrecha y letra pequeña: la guirnalda es un óvalo, así que arriba y abajo se cierra.
               Con el texto más ancho, las primeras y últimas líneas se salían por encima de las ramas.
               Comprobado con los 600 caracteres que como mucho admite el editor. */
            width: 214px;
            color: #3A3A3A
        }

        /* Elegir dónde va (principio o final) */
        .ded-position {
            display: flex;
            gap: 10px
        }

        .ded-pos-btn {
            flex: 1;
            border: 2px solid #dcdfe3;
            background: #fff;
            border-radius: 10px;
            padding: 10px;
            font-weight: 600;
            color: #444
        }

            .ded-pos-btn.selected {
                border-color: #0d6efd;
                background: #eef5ff;
                color: #0d6efd
            }

        /* ----- Lista de capítulos del lateral ----- */
        .chapter-list-item {
            display: flex;
            align-items: center;
            gap: 6px;
            padding: 7px 9px;
            margin-bottom: 6px;
            background: #f7f8fa;
            border: 1px solid #e6e8eb;
            border-radius: 8px;
            font-size: .85rem;
            color: #333
        }

        .chapter-list-title {
            flex: 1;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
            font-weight: 600
        }

        /* Número de página en la que ha quedado el capítulo */
        .chapter-list-page {
            flex-shrink: 0;
            min-width: 24px;
            text-align: center;
            background: #e7f1ff;
            color: #0d6efd;
            border-radius: 999px;
            padding: 1px 7px;
            font-size: .75rem;
            font-weight: 700
        }

        /* Adornos: el SVG ocupa el ancho del bloque y su alto fijo, igual que el hueco que le reserva
           ChapterBlockHeight. */
        .chapter-orn {
            width: 100%;
            max-width: 200px;
            height: 22px;
            margin: 2px auto
        }

            .chapter-orn svg {
                width: 100%;
                height: 100%;
                display: block
            }

        /* "Capítulo 1" encima del título */
        .chapter-num {
            font-size: 9px;
            letter-spacing: .22em;
            text-transform: uppercase;
            color: #9a9a9a;
            margin-bottom: 5px
        }

        /* Estilos con fondo o recuadro */
        .chapter-x-banner .chapter-heading-title {
            display: block;
            background: #222;
            color: #fff;
            padding: 10px 12px
        }

        .chapter-x-box {
            border: 1px solid #cfcfcf;
            padding: 12px 10px
        }

        /* ----- Selector de estilo dentro del modal ----- */
        /* Con 16 estilos, las tarjetas se reparten solas: en escritorio caben 4 o 5 por fila, así el
           cliente compara de un vistazo en vez de ir de dos en dos. */
        .chapter-group-title {
            font-size: .7rem;
            letter-spacing: .14em;
            text-transform: uppercase;
            color: #999;
            border-bottom: 1px solid #eee;
            padding-bottom: 4px;
            margin: 14px 0 8px
        }

        .chapter-style-grid {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
            gap: 10px
        }

        /* En móvil dos columnas: con una sola se ve enorme y hay que desplazarse demasiado, y con más
           las filigranas finas dejan de distinguirse en pantalla pequeña. */
        @media (max-width: 768px) {
            .chapter-style-grid {
                grid-template-columns: repeat(2, 1fr)
            }

            /* La miniatura se agranda un poco y el adorno se dibuja más grueso, porque a este tamaño una
               línea de 1 px prácticamente desaparece en un móvil. */
            .chapter-style-preview {
                height: 92px
            }

                .chapter-style-preview .chapter-orn {
                    height: 18px
                }

                .chapter-style-preview .chapter-orn svg {
                    stroke-width: 1.6
                }
        }

        .chapter-style-card {
            border: 2px solid #dcdfe3;
            background: #fff;
            border-radius: 10px;
            padding: 8px;
            display: flex;
            flex-direction: column;
            align-items: center;
            gap: 6px;
            cursor: pointer
        }

            .chapter-style-card.selected {
                border-color: #0d6efd;
                box-shadow: 0 0 0 3px rgba(13,110,253,.15)
            }

        .chapter-style-preview {
            width: 100%;
            height: 86px;
            display: flex;
            align-items: center;
            justify-content: center;
            overflow: hidden;
            background: #f7f8fa;
            border-radius: 6px;
            padding: 6px
        }

            /* En la miniatura reducimos el texto para que quepan los 4 estilos por igual */
            /* La miniatura NO fuerza el tamaño: cada estilo debe verse con el suyo, que es justo lo que
               el cliente está comparando. Los cuerpos de la ficha (10-28) caben de sobra en la tarjeta. */

        .chapter-style-label {
            font-size: .8rem;
            font-weight: 600;
            color: #444
        }

        /* ----- Modo "elegir dónde va el capítulo" ----- */
        .chapter-dim {
            position: fixed;
            inset: 0;
            background: rgba(245,246,248,.6);
            backdrop-filter: blur(3px);
            -webkit-backdrop-filter: blur(3px);
            z-index: 1180
        }

        /* El libro y sus botones de pasar página quedan por encima del velo y siguen funcionando. */
        .chapter-placing .book-container,
        .chapter-placing .navigation-buttons {
            position: relative;
            z-index: 1200
        }

        /* Durante la colocación, las zonas donde se puede soltar el capítulo se ven siempre. */
        .chapter-placing .insert-zone {
            opacity: 1 !important;
            cursor: pointer
        }

            .chapter-placing .insert-zone .insert-line {
                background: #0d6efd !important;
                height: 3px
            }

        .chapter-placement-hint {
            position: fixed;
            top: 14px;
            left: 50%;
            transform: translateX(-50%);
            z-index: 1250;
            display: flex;
            align-items: center;
            gap: 10px;
            background: #0d6efd;
            color: #fff;
            padding: 10px 16px;
            border-radius: 999px;
            font-weight: 600;
            box-shadow: 0 6px 20px rgba(0,0,0,.2);
            max-width: 94vw
        }

        /* ----- Colocación en móvil (doble toque) ----- */
        /* Franja discreta entre mensajes: se ve que es tocable, pero no tapa el contenido. */
        .chapter-tap-zone {
            height: 26px;
            margin: 2px 0;
            border-radius: 6px;
            border: 2px dashed rgba(13,110,253,.45);
            background: rgba(13,110,253,.06)
        }

        /* Tras el primer toque, la franja se convierte en el botón de confirmar. */
        .chapter-confirm-bar {
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 4px;
            height: 40px;
            margin: 6px 0;
            border-radius: 8px;
            background: #0d6efd;
            color: #fff;
            font-weight: 700;
            font-size: .9rem;
            box-shadow: 0 4px 14px rgba(13,110,253,.35)
        }

        .chapter-hint-cancel {
            border: none;
            background: rgba(255,255,255,.22);
            color: #fff;
            border-radius: 999px;
            padding: 4px 12px;
            font-weight: 600
        }

        .btn-save {
            background-color: #28a745;
            color: #fff
        }

        .btn-cancel {
            background-color: #6c757d;
            color: #fff
        }

        .navigation-buttons {
            position: absolute;
            bottom: 0;
            left: 0;
            right: 0;
            background: linear-gradient(to top,rgb(255 255 255 / .95),rgb(255 255 255 / .8),transparent);
            border-top: none;
            font-family: 'Arial',sans-serif;
            padding: 1.5vh 20px !important;
            display: flex;
            justify-content: space-between;
            align-items: center;
            z-index: 10
        }

            .navigation-buttons button {
                font-size: clamp(11px, 1.6vh, 15px) !important;
                padding: .6em 1.8em !important;
                border-radius: 2em !important;
                transition: all 0.3s ease;
                white-space: nowrap;
                height: auto !important;
                line-height: normal !important
            }

                .navigation-buttons button:hover {
                    transform: translateY(-2px) !important;
                    box-shadow: 0 4px 12px rgb(0 0 0 / .2)
                }

        .page-selector {
            display: flex;
            align-items: center;
            gap: 8px
        }

            .page-selector .form-select {
                width: auto;
                font-size: clamp(11px, 1.6vh, 15px) !important;
                padding: .4em 1.2em !important;
                border-radius: 2em !important;
                border: 1px solid #ced4da;
                background-color: #fff;
                cursor: pointer;
                line-height: normal !important
            }

            .page-selector .text-muted {
                font-size: clamp(10px, 1.4vh, 13px) !important;
                margin-left: 5px !important
            }

        .guide-page-container {
            min-height: calc(100vh - 2rem);
            max-width: 900px;
            margin: 1rem auto;
            padding: 2rem;
            background: linear-gradient(135deg,#f5f7fa 0%,#e4e9f0 100%);
            border-radius: 16px;
            box-shadow: 0 4px 20px rgb(0 0 0 / .15);
            display: flex;
            flex-direction: column;
            transition: transform 0.3s ease;
            overflow: hidden
        }

            .guide-page-container:hover {
                transform: translateY(-5px)
            }

        .guide-header {
            font-family: 'Poppins',sans-serif;
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding-bottom: 1.5rem;
            border-bottom: 2px solid #e0e0e0
        }

            .guide-header h4 {
                margin: 0;
                font-size: 1.8rem;
                font-weight: 600;
                color: #1a1a1a;
                display: flex;
                align-items: center;
                gap: .5rem
            }

        .btn-close {
            background: none;
            border: none;
            font-size: 1.2rem;
            cursor: pointer;
            color: #555;
            transition: color 0.2s ease
        }

            .btn-close:hover {
                color: #ff4d4d
            }

        .guide-body {
            flex: 1;
            padding: 2rem 0;
            overflow: hidden
        }

        .guide-step {
            animation: slideIn 0.5s ease forwards;
            opacity: 0;
            transform: translateY(20px)
        }

        @keyframes slideIn {
            to {
                opacity: 1;
                transform: translateY(0)
            }
        }

        .guide-progress {
            margin-bottom: 2rem;
            text-align: center
        }

            .guide-progress p {
                font-size: 1.1rem;
                font-weight: 500;
                color: #333;
                margin-bottom: .5rem
            }

        .progress-bar {
            width: 100%;
            height: 10px;
            background-color: #e0e0e0;
            border-radius: 5px;
            overflow: hidden;
            position: relative
        }

        .progress-fill {
            height: 100%;
            background: linear-gradient(135deg,#1a73e8,#00d4ff);
            transition: width 0.4s ease-in-out;
            position: relative;
            overflow: hidden
        }

            .progress-fill::after {
                content: '';
                position: absolute;
                top: 0;
                left: 0;
                width: 100%;
                height: 100%;
                background-size: 30px 30px;
                animation: progressShine 2s linear infinite
            }

        @keyframes progressShine {
            0% {
                background-position: 0 0
            }

            100% {
                background-position: 30px 30px
            }
        }

        .device-tabs {
            display: flex;
            gap: 1rem;
            margin-bottom: 1.5rem;
            justify-content: center
        }

            .device-tabs button {
                padding: .75rem 1.5rem;
                border: none;
                border-radius: 8px;
                background-color: #e0e0e0;
                color: #333;
                font-weight: 500;
                cursor: pointer;
                transition: all 0.3s ease
            }

                .device-tabs button.active {
                    background: #1a73e8;
                    color: #fff;
                    transform: scale(1.05)
                }

                .device-tabs button:hover {
                    background-color: #d0d0d0;
                    transform: scale(1.05)
                }

        .guide-list {
            list-style-type: none;
            padding: 0;
            counter-reset: step-counter
        }

            .guide-list li {
                display: flex;
                align-items: flex-start;
                gap: .75rem;
                margin-bottom: 1rem;
                font-size: 1rem;
                color: #333
            }

                .guide-list li::before {
                    content: counter(step-counter) ". ";
                    counter-increment: step-counter;
                    color: #333;
                    font-size: 1rem;
                    font-weight: 600
                }

        .file-upload-wrapper.guide-upload {
            display: flex;
            flex-direction: column;
            align-items: center;
            width: 100%
        }

            .file-upload-wrapper.guide-upload .file-label {
                width: 100%;
                max-width: 350px !important;
                justify-content: center;
                text-align: center;
                display: inline-flex;
                box-sizing: border-box
            }

        .file-upload-wrapper {
            margin: 1.5rem 0;
            text-align: center
        }

        .file-label {
            display: inline-block;
            padding: .75rem 1.5rem;
            background: #1a73e8;
            color: #fff;
            border-radius: 8px;
            cursor: pointer;
            transition: transform 0.2s ease
        }

            .file-label:hover {
                transform: scale(1.05)
            }

        .file-label-selected {
            background: #28a745
        }

        .file-selected {
            margin-top: .5rem;
            color: #333;
            font-size: .9rem
        }

        .guide-footer {
            display: flex;
            justify-content: flex-start;
            gap: 1rem;
            padding-top: 1.5rem;
            border-top: 2px solid #e0e0e0
        }

            .guide-footer .btn-align-right {
                margin-left: auto
            }

            .guide-footer button {
                padding: .75rem 1.5rem;
                border-radius: 8px;
                font-weight: 500;
                transition: all 0.3s ease
            }

        .btn-outline-secondary {
            border: 1px solid #ccc;
            background: #fff0;
            color: #333
        }

            .btn-outline-secondary:hover {
                background: #f0f0f0;
                transform: scale(1.05);
                color: #888
            }

        .btn-primary {
            background: #1a73e8;
            border: none;
            color: #fff
        }

            .btn-primary:hover {
                background: linear-gradient(135deg,#0056b3,#009688);
                transform: scale(1.05)
            }

        .btn-outline-primary {
            border: 1px solid #007bff;
            color: #007bff;
            background: #fff0
        }

            .btn-outline-primary:hover {
                background: #e6f0ff;
                transform: scale(1.05);
                color: #0056b3
            }

        .guide-split-layout {
            display: block !important;
            margin-top: 2vh
        }

        .guide-col-instructions {
            border-right: none !important;
            border-bottom: 1px solid #eee !important;
            padding-right: 2vh !important;
            padding-bottom: 2vh !important;
            margin-bottom: 2vh !important;
            width: 100% !important
        }

        .guide-col-actions {
            width: 100% !important;
            display: flex;
            flex-direction: column;
            justify-content: flex-start;
            border-radius: 1.5vh;
            padding-right: 2vh !important
        }

        .compact-upload {
            margin: 1vh 0 2vh 0 !important
        }

            .compact-upload .file-label {
                width: 100%;
                justify-content: center;
                padding: 1.2vh 1vw !important
            }

        .guide-notes {
            border-top: 1px dashed #ccc;
            padding-top: 1.5vh
        }

        .text-truncate {
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
            max-width: 100%
        }

        @media (max-width:1400px) {
            .guide-split-layout {
                display: grid !important;
                grid-template-columns: 1.2fr 0.8fr;
                gap: 3vw;
                align-items: start
            }

            .guide-col-instructions {
                border-right: 1px solid #eee !important;
                border-bottom: none !important;
                padding-right: 2vw !important;
                padding-bottom: 0 !important;
                margin-bottom: 0 !important;
                height: 100%
            }
        }

        @media (max-width:768px) {
            .guide-page-container {
                margin: .5rem;
                padding: 1.5rem;
                background: none;
                box-shadow: none;
                min-height: calc(100vh - 1rem)
            }

            .guide-header h4 {
                font-size: 1.4rem
            }

            .guide-body {
                padding: 1.5rem 0
            }

            .device-tabs {
                flex-direction: column;
                gap: .75rem
            }

                .device-tabs button {
                    width: 100%;
                    text-align: center
                }

            .guide-list li {
                font-size: .95rem
            }
        }

        @media (max-width:480px) {
            .guide-page-container {
                padding: 1rem
            }

            .guide-header h4 {
                font-size: 1.2rem
            }

            .guide-footer {
                flex-direction: column;
                gap: .75rem
            }

                .guide-footer button {
                    width: 100%;
                    text-align: center
                }

            .file-label {
                padding: .5rem 1rem;
                font-size: .9rem
            }
        }

        .font-times-new-roman {
            font-family: 'Times New Roman',Times,serif !important
        }

        .font-calibri {
            font-family: 'Calibri',sans-serif !important
        }

        .font-helvetica {
            font-family: 'Helvetica',sans-serif
        }

        .font-open-sans {
            font-family: 'Open Sans',sans-serif
        }

        .font-roboto {
            font-family: 'Roboto',sans-serif
        }

        .font-lato {
            font-family: 'Lato',sans-serif
        }

        .font-montserrat {
            font-family: 'Montserrat',sans-serif
        }

        .font-source-sans {
            font-family: 'Source Sans Pro',sans-serif
        }

        .font-selector {
            margin-top: 15px
        }

            .font-selector label {
                font-size: .85rem;
                color: #666;
                margin-bottom: 4px;
                display: block
            }

            .font-selector .form-select {
                border-radius: 8px;
                padding: 6px 12px;
                font-size: .9rem;
                border: 1px solid #ced4da;
                background-color: #fff;
                cursor: pointer;
                transition: border-color 0.2s ease
            }

                .font-selector .form-select:focus {
                    border-color: #007bff;
                    box-shadow: 0 0 5px rgb(0 123 255 / .5);
                    outline: none
                }

        .welcome-container {
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            height: 100vh;
             text-align:center;
            padding: 20px
        }

        .welcome-title {
            font-family: 'Poppins',sans-serif;
            font-size: 3rem;
            font-weight: 600;
            color: #1a73e8;
            margin-bottom: 20px;
            text-shadow: 0 2px 4px rgb(0 0 0 / .1);
            border: none;
            outline: none
        }

        .welcome-subtitle {
            font-family: 'Open Sans',sans-serif;
            font-size: 1.2rem;
            color: #555;
            margin-bottom: 40px;
            max-width: 600px
        }

        .file-upload-wrapper {
            position: relative
        }

        .file-input {
            opacity: 0;
            position: absolute;
            width: 100%;
            height: 100%;
            cursor: pointer
        }

        .file-label {
            display: inline-flex;
            align-items: center;
            padding: 15px 30px;
            background: #1a73e8;
            color: #fff;
            font-family: 'Poppins',sans-serif;
            font-size: 1.1rem;
            border-radius: 50px;
            cursor: pointer;
            transition: all 0.3s ease;
            box-shadow: 0 4px 15px rgb(26 115 232 / .3);
            animation: pulseButton 2s infinite ease-in-out
        }

            .file-label:hover {
                background: #1557b0;
                transform: scale(1.05) rotate(2deg);
                box-shadow: 0 6px 20px rgb(26 115 232 / .4)
            }

            .file-label:active {
                transform: scale(.95);
                box-shadow: 0 2px 10px rgb(26 115 232 / .2)
            }

        .file-label-selected {
            background: #28a745;
            animation: none
        }

            .file-label-selected:hover {
                background: #218838;
                transform: scale(1.05)
            }

        .file-icon {
            font-size: 1.5rem;
            margin-right: 10px;
            transition: transform 0.3s ease
        }

        .file-label:hover .file-icon {
            transform: rotate(10deg)
        }

        .file-selected {
            margin-top: 15px;
            font-family: 'Open Sans',sans-serif;
            font-size: .9rem;
            color: #333
        }

        .loading-overlay {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: rgb(0 0 0 / .6);
            display: none;
            justify-content: center;
            align-items: center;
            z-index: 1000;
            opacity: 0;
            transition: opacity 0.3s ease
        }

            .loading-overlay.active {
                display: flex;
                opacity: 1
            }

        .loader-container {
            text-align: center;
            background: #fff;
            padding: 30px;
            border-radius: 15px;
            box-shadow: 0 5px 25px rgb(0 0 0 / .2);
            animation: float 2s ease-in-out infinite
        }

        .modern-spinner {
            position: relative;
            width: 60px;
            height: 60px;
            margin: 0 auto 20px
        }

        .spinner-dot {
            position: absolute;
            width: 16px;
            height: 16px;
            background: #1a73e8;
            border-radius: 50%;
            animation: pulseDot 1.5s ease-in-out infinite
        }

            .spinner-dot:nth-child(1) {
                top: 0;
                left: 50%;
                transform: translateX(-50%);
                animation-delay: 0s
            }

            .spinner-dot:nth-child(2) {
                top: 50%;
                left: 0;
                transform: translateY(-50%);
                animation-delay: 0.5s
            }

            .spinner-dot:nth-child(3) {
                top: 50%;
                right: 0;
                transform: translateY(-50%);
                animation-delay: 1s
            }

        .loading-text {
            color: #333;
            font-family: 'Poppins',sans-serif;
            font-size: 1.1rem;
            margin: 0
        }

        @keyframes pulseDot {
            0%, 100% {
                transform: scale(1) translateY(-50%);
                opacity: .8
            }

            50% {
                transform: scale(1.5) translateY(-50%);
                opacity: 1
            }
        }

        @keyframes float {
            0%, 100% {
                transform: translateY(0)
            }

            50% {
                transform: translateY(-10px)
            }
        }

        .col-md-9.p-4 {
            max-width: 100%;
            padding: 0 !important;
            margin-top: 0 !important;
            padding-bottom: 0 !important;
            margin-bottom: 0 !important
        }

        @keyframes pulseButton {
            0% {
                transform: scale(1)
            }

            50% {
                transform: scale(1.03)
            }

            100% {
                transform: scale(1)
            }
        }

        .toast-container {
            position: fixed;
            top: 20px;
            /* Centramos el toast horizontalmente en lugar de pegarlo a la derecha */
            left: 50%;
            transform: translateX(-50%);
            z-index: 9999 !important;
            max-width: 400px;
        }

        .toast-message {
            background: rgb(255 193 7 / .95);
            backdrop-filter: blur(10px);
            border: 1px solid rgb(255 193 7 / .2);
            border-radius: 12px;
            box-shadow: 0 8px 32px rgb(0 0 0 / .1);
            opacity: 0;
            visibility: hidden;
            transform: translateY(-20px);
            transition: all 0.4s cubic-bezier(.4,0,.2,1);
            overflow: hidden
        }

            .toast-message.show {
                opacity: 1;
                visibility: visible;
                transform: translateY(0)
            }

        .toast-content {
            display: flex;
            align-items: center;
            gap: 12px;
            padding: 16px 20px;
            min-height: 20px
        }

        .toast-icon {
            width: 20px;
            height: 20px;
            color: #856404;
            flex-shrink: 0
        }

        .toast-text {
            margin: 0;
            font-family: 'Open Sans',sans-serif;
            font-size: .95rem;
            font-weight: 500;
            color: #721c24;
            line-height: 1.4;
            flex: 1
        }

        .toast-close {
            background: none;
            border: none;
            width: 24px;
            height: 24px;
            display: flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            color: #856404;
            border-radius: 50%;
            transition: all 0.2s ease;
            flex-shrink: 0
        }

            .toast-close svg {
                width: 16px;
                height: 16px;
                stroke: currentColor
            }

            .toast-close:hover {
                background: rgb(0 0 0 / .1);
                color: #a94442;
                transform: scale(1.1)
            }

            .toast-close:focus {
                outline: 2px solid #007bff;
                outline-offset: 2px
            }

        @media (max-width:480px) {
            .toast-container {
                right: 10px;
                left: 10px;
                max-width: none
            }

            .toast-content {
                padding: 12px 16px;
                gap: 8px
            }

            .toast-text {
                font-size: .9rem
            }
        }

        .toast-message.fade-out {
            opacity: 0;
            transform: translateY(-10px)
        }

        .cover-messages {
            display: flex;
            flex-direction: column;
            align-items: center;
            gap: 10px;
            width: 100%
        }

        .message-bubble.top-bubble {
            font-family: 'Poppins',sans-serif !important;
            font-weight: 700 !important;
            padding: 1vh 2vh !important;
            border-radius: 2vh !important;
            font-size: clamp(12px, 2.0vh, 1.2rem) !important;
            max-width: 90% !important;
            width: auto !important;
            text-align: center;
            line-height: 1.25 !important
        }

        .message-bubble.middle-bubble {
            padding: 0.7vh !important;
            border-radius: 3vh !important;
            width: 85% !important;
            height: auto !important;
            aspect-ratio: 1/1;
            margin-top: 2vh !important
        }

        .bubble-photo {
            width: 100% !important;
            height: 100% !important;
            border-radius: 2.2vh !important;
            object-fit: cover
        }

        .cover-logo {
            position: relative;
            margin-top: auto;
            width: 40%;
            height: auto;
            object-fit: contain;
            z-index: 10;
            margin-bottom: 5%
        }

        .spine-logo {
            position: absolute;
            bottom: 3%;
            max-width: 80%;
            height: auto;
            max-height: 10%;
            object-fit: contain;
            left: 50%;
            transform: translateX(-50%)
        }

        .cover-layout {
            display: flex;
            height: 100%
        }

        .controls-column {
            flex: 1 0 auto !important;
            width: 45% !important;
            min-width: 380px !important;
            max-width: 40% !important;
            padding: 20px !important;
            border-right: 1px solid #eee;
            overflow-y: auto;
            height: 100%;
            background: #fff;
            box-sizing: border-box
        }

        .preview-column {
            flex: 1;
            padding: 20px;
            display: flex;
            flex-direction: column;
            justify-content: center;
            align-items: center;
            background: #f1f3f5;
            overflow: hidden
        }

        .preview-container {
            background: #f9f9f9;
            border-radius: 8px;
            padding: 1.5rem;
            flex: 1;
            display: flex;
            flex-direction: column;
            justify-content: center
        }

        .preview-title {
            margin-top: 0;
            margin-bottom: 1rem;
            color: #555;
            font-size: 1.1rem;
            font-weight: 500
        }

        .date-modal-overlay {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: rgb(0 0 0 / .6);
            display: flex;
            justify-content: center;
            align-items: center;
            z-index: 1000
        }

        .date-modal {
            background: #fff;
            border-radius: 15px;
            width: 90%;
            max-width: 550px;
            box-shadow: 0 5px 25px rgb(0 0 0 / .2)
        }

        /* ===== Popup "¿Cuántas páginas quieres?" (sustituye al de fechas al empezar un libro) ===== */
        .date-modal.paginas-modal { max-width: 640px; }
        .paginas-lead { margin: 0; font-size: .92rem; color: #4b5563; }
        .paginas-cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-top: 14px; }
        .paginas-card { position: relative; border: 2px solid #e3e6ea; border-radius: 14px; background: #fff; padding: 14px 6px 12px;
                        display: flex; flex-direction: column; align-items: center; gap: 3px; transition: border-color .15s, background .15s; }
        .paginas-card:hover { border-color: #b9d3fb; }
        .paginas-card.sel { border-color: #1a73e8; background: #f3f8ff; }
        .paginas-card.sel::after { content: "✓"; position: absolute; top: 7px; right: 8px; width: 20px; height: 20px; border-radius: 50%;
                                   background: #1a73e8; color: #fff; font-size: .7rem; font-weight: 700;
                                   display: flex; align-items: center; justify-content: center; }
        /* Librito de cada opción: el lomo (--grosor) engorda con las páginas. */
        .paginas-libro { display: flex; height: 62px; margin-bottom: 8px; filter: drop-shadow(0 4px 6px rgba(0,0,0,.18)); }
        .paginas-libro .lomo { width: var(--grosor, 6px); background: linear-gradient(90deg, #b85c4a, #d77d69); border-radius: 3px 0 0 3px; }
        .paginas-libro .tapa { width: 44px; background: linear-gradient(160deg, #fbe3d3, #f4b8a4 60%, #e99a86); border-radius: 0 4px 4px 0; position: relative; }
        .paginas-libro .tapa::before { content: ""; position: absolute; left: 9px; right: 9px; top: 36%; height: 5px; border-radius: 3px; background: rgba(91,42,36,.38); }
        .paginas-libro .tapa::after { content: ""; position: absolute; left: 14px; right: 14px; top: 50%; height: 3px; border-radius: 2px; background: rgba(91,42,36,.22); }
        .paginas-nombre { font-size: .66rem; color: #8a8a90; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; }
        .paginas-num { font-size: .92rem; font-weight: 700; color: #1a1a1a; }
        .paginas-precio { font-size: 1.2rem; font-weight: 800; color: #1a73e8; letter-spacing: -.3px; }
        .paginas-otro { margin-top: 12px; display: flex; align-items: center; flex-wrap: wrap; gap: 10px; min-height: 34px; font-size: .9rem; }
        .paginas-otro-link { border: none; background: transparent; color: #1a73e8; font-weight: 600; padding: 0; text-decoration: underline; }
        .paginas-otro-input { width: 84px; border: 1px solid #1a73e8; border-radius: 6px; padding: 5px 8px; box-shadow: 0 0 0 3px rgba(26,115,232,.15); }
        .paginas-otro b { color: #1a73e8; }
        .paginas-otro-aviso { color: #b45309; font-size: .8rem; }
        .paginas-info { display: flex; gap: 8px; align-items: flex-start; margin: 14px 0 0; font-size: .82rem; color: #4b5563;
                        background: #f3f8ff; border-radius: 10px; padding: 9px 12px; line-height: 1.45; }
        .paginas-info b { color: #1a73e8; }
        .paginas-nota-precio { margin-right: auto; font-size: .76rem; color: #8a8a90; }
        @media (max-width: 600px) {
            .paginas-cards { grid-template-columns: repeat(2, 1fr); }
            .paginas-nota-precio { width: 100%; }
        }

        .modal-header {
            padding: 15px 20px;
            border-bottom: 1px solid #e0e0e0
        }

            .modal-header h4 {
                margin: 0;
                font-family: 'Poppins',sans-serif;
                font-weight: 600;
                color: #1a73e8
            }

        .modal-body {
            padding: 20px
        }

        .modal-footer {
            display: flex;
            justify-content: flex-end;
            gap: 10px;
            padding: 15px 20px;
            border-top: 1px solid #e0e0e0
        }

            .modal-footer .btn {
                border-radius: 20px;
                padding: 8px 20px;
                font-family: 'Poppins',sans-serif;
                font-weight: 600;
                transition: all 0.3s ease
            }

            .modal-footer .btn-primary {
                background: #1a73e8;
                color: #fff
            }

            .modal-footer .btn-secondary {
                background: #6c757d;
                color: #fff
            }

            .modal-footer .btn-tertiary {
                background: rgb(220 53 69 / .9);
                color: #fff
            }

            .modal-footer .btn:hover {
                transform: translateY(-2px);
                box-shadow: 0 4px 12px rgb(0 0 0 / .2)
            }

        .btn-icon {
            vertical-align: middle;
            object-fit: contain
        }

        .canva-links {
            display: flex;
            gap: 10px;
            margin-top: 10px
        }

            .canva-links a {
                padding: 8px 16px;
                font-size: .9rem
            }

        .canva-links-grid {
            display: grid;
            grid-template-columns: repeat(auto-fit,minmax(120px,1fr));
            gap: 10px;
            max-width: 100%;
            overflow-x: auto;
            padding: 10px
        }

        .imagen-boton {
            width: 100%;
            height: auto;
            max-width: 100px;
            max-height: 150px;
            object-fit: cover;
            border-radius: 5px;
            transition: transform 0.2s
        }

            .imagen-boton:hover {
                transform: scale(1.05)
            }

        .loading-container {
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            min-height: 60vh;
            color: #475569;
            font-family: 'Poppins',sans-serif;
            background: linear-gradient(135deg,#f9f9f9,#eef2f7);
            border-radius: 8px;
            box-shadow: 0 2px 6px rgb(0 0 0 / .05)
        }

        .spinner {
            width: 36px;
            height: 36px;
            border: 3px solid #e5e7eb;
            border-top: 3px solid #007bff;
            border-radius: 50%;
            animation: spin 1s linear infinite;
            margin-bottom: 1rem
        }

        .loading-container p {
            font-size: 1rem;
            font-weight: 500;
            color: #1a1a1a;
            animation: pulse 1.5s infinite
        }

        @keyframes spin {
            0% {
                transform: rotate(0deg)
            }

            100% {
                transform: rotate(360deg)
            }
        }

        @keyframes pulse {
            0% {
                transform: scale(1)
            }

            50% {
                transform: scale(1.05)
            }

            100% {
                transform: scale(1)
            }
        }

        .audio-container, .video-container {
            width: clamp(50px, 8vw, 200px) !important;
            aspect-ratio: 1 / 1 !important;
            height: auto !important;
            background-color: #f8f9fa;
            border: 2px dashed #cbd5e1;
            border-radius: 12px;
            background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='100' height='100' viewBox='0 0 100 100' fill='%23e2e8f0'%3E%3Cpath d='M10 10h30v30h-30zM50 10h10v10h-10zM70 10h10v10h-10zM10 50h10v10h-10zM30 50h10v10h-10zM50 50h30v30h-30zM10 70h10v10h-10z'/%3E%3Cpath d='M15 15h20v20h-20zM55 55h20v20h-20z' fill='%23cbd5e1'/%3E%3C/svg%3E");
            background-size: 60%;
            background-repeat: no-repeat;
            background-position: center 30%;
            display: flex;
            flex-direction: column;
            justify-content: flex-end;
            align-items: center;
            padding: 10px !important;
            margin-top: 10px !important;
            margin-bottom: 10px !important;
            overflow: visible !important;
            position: relative
        }

        .message-audio {
            width: 100% !important;
            min-width: 0 !important;
            height: 40px !important;
            margin-top: 0 !important;
            border-radius: 20px !important;
            box-shadow: 0 2px 5px rgb(0 0 0 / .1);
            background: rgb(255 255 255 / .9);
            z-index: 2
        }

        .audio-placeholder {
            width: 100% !important;
            height: 40px !important;
            border-radius: 20px !important;
            background: rgb(255 255 255 / .8)
        }

        .info-icon:not(.audio-container .info-icon):not(.video-container .info-icon) {
            display: inline-flex !important;
            vertical-align: middle !important;
            position: relative !important;
            top: auto !important;
            right: auto !important;
            left: auto !important;
            margin-top: 0 !important;
            margin-bottom: 0 !important;
            width: 18px !important;
            height: 18px !important
        }

            .info-icon:not(.audio-container .info-icon):not(.video-container .info-icon) .info-symbol {
                width: 100% !important;
                height: 100% !important;
                line-height: 18px !important;
                font-size: 11px !important;
                margin: 0 !important;
                display: block !important
            }

        .audio-container .info-icon, .video-container .info-icon {
            position: absolute;
            top: -8px;
            right: -8px;
            margin: 0 !important;
            z-index: 5;
            background: #fff;
            border-radius: 50%
        }

        .info-icon {
            position: relative;
            display: inline-flex;
            align-items: center;
            cursor: pointer;
            margin-top: 5px
        }

        .info-symbol {
            display: inline-block;
            width: 16px;
            height: 16px;
            line-height: 16px;
            text-align: center;
            background-color: #007bff;
            color: #fff;
            border-radius: 50%;
            font-size: 12px;
            font-weight: 700
        }

        .info-tooltip {
            width: max-content !important;
            max-width: 180px !important;
            height: auto !important;
            min-height: 0 !important;
            white-space: normal !important;
            word-wrap: break-word !important;
            overflow-wrap: break-word !important;
            word-break: break-word !important;
            line-height: 1.4 !important;
            font-size: clamp(9px, 1.8vh, 50px) !important;
             font-family:'Open Sans',sans-serif;
            text-align: left;
            background-color: rgb(51 51 51 / .95);
            color: #fff;
            border-radius: 6px;
            padding: 8px 12px !important;
            box-shadow: 0 4px 10px rgb(0 0 0 / .2);
            position: absolute;
            z-index: 10000 !important;
            top: 50%;
            transform: translateY(-50%);
            margin-left: 10px;
            visibility: hidden;
            opacity: 0;
            transition: opacity 0.2s ease,visibility 0.2s ease
        }

        .sent .audio-container .info-tooltip, .sent .video-container .info-tooltip {
            top: 50% !important;
            bottom: auto !important;
            transform: translateY(-50%) !important;
            left: auto !important;
            right: 100% !important;
            margin-right: 12px !important;
            margin-top: 0 !important;
            margin-left: 0 !important
        }

        .video-container .info-tooltip {
            left: auto;
            right: calc(100% + 8px);
            text-align: left
        }

        .received .video-container .info-tooltip {
            left: calc(100% + 8px);
            right: auto;
            text-align: left
        }

        .info-icon:hover .info-tooltip {
            visibility: visible;
            opacity: 1
        }

        .custom-checkbox {
            cursor: pointer;
            user-select: none;
            font-family: 'Inter',sans-serif
        }

            .custom-checkbox input {
                display: none
            }

        .checkmark {
            width: 20px;
            height: 20px;
            border: 2px solid #6c757d;
            border-radius: 4px;
            position: relative;
            transition: all 0.3s ease
        }

        .custom-checkbox input:checked + .checkmark {
            background-color: #007bff;
            border-color: #007bff
        }

            .custom-checkbox input:checked + .checkmark::after {
                content: '\2713';
                color: #fff;
                font-size: 14px;
                position: absolute;
                top: 50%;
                left: 50%;
                transform: translate(-50%,-50%)
            }

        .text-modern {
            font-size: 1rem;
            color: #333;
            transition: color 0.3s ease
        }

        .custom-checkbox:hover .checkmark {
            border-color: #0056b3
        }

        .custom-checkbox:hover .text-modern {
            color: #0056b3
        }

        .video-container {
            justify-content: center !important;
            align-items: center !important
        }

        .video-placeholder {
            width: 100% !important;
            height: 100% !important;
            max-height: none !important;
            background: transparent !important;
            box-shadow: none !important;
            border-radius: 0 !important;
            display: flex;
            flex-direction: column;
            justify-content: center;
            align-items: center;
            gap: 8px !important
        }

        .video-icon {
            width: 48px !important;
            height: 48px !important;
            stroke: #1a73e8;
            stroke-width: 1.5;
            border-radius: 50%;
            padding: 8px;
            transition: transform 0.3s ease
        }

        .video-text {
            font-family: 'Poppins',sans-serif;
            font-weight: 600;
            font-size: clamp(12px, 1.5vh, 16px) !important;
            color: #1a73e8;
            text-transform: uppercase;
            letter-spacing: 1px;
            padding: 2px 6px;
            border-radius: 4px
        }

        .video-container:hover .video-icon {
            transform: scale(1.1)
        }

        .contact-bubble {
            padding: 8px 15px;
            border-radius: 12px;
            font-family: 'Poppins',sans-serif;
            font-size: .9rem;
            font-weight: 500;
            text-align: center;
            box-shadow: 0 2px 6px rgb(0 0 0 / .1);
            transition: transform 0.2s ease,box-shadow 0.2s ease;
            max-width: 100%;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
            margin: 0 15px 10px 15px
        }

            .contact-bubble:hover {
                transform: translateY(-2px);
                box-shadow: 0 4px 12px rgb(0 0 0 / .15)
            }

        .sender-bubble {
            background-color: var(--sent-color,#0078ff);
            color: var(--sent-text-color,#ffffff)
        }

        .label-consistent {
            font-family: 'Poppins',sans-serif;
            font-size: .85rem;
            color: #666;
            margin-bottom: 4px;
            display: block;
            font-weight: 600
        }

        .image-placeholder {
            width: auto !important;
            height: auto !important;
            max-width: 100%;
            max-height: 20vh;
            aspect-ratio: 1 / 1;
            min-width: 100px;
            background: #f0f0f0;
            border-radius: 6.75px;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            color: #666;
            font-size: clamp(9px, 1.1vh, 12px);
            margin-top: 6.75px;
            box-shadow: 0 1px 3px rgb(0 0 0 / .1)
        }

        .loading-container, .progress-overlay, .progress-container {
            backdrop-filter: blur(5px);
            background: rgb(255 255 255 / .95);
            border: 1px solid rgb(255 255 255 / .2);
            box-shadow: 0 8px 32px rgb(0 0 0 / .1);
            border-radius: 16px;
            transition: all 0.3s ease
        }

        .loading-container {
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            min-height: 60vh;
            color: #475569;
            font-family: 'Poppins',sans-serif;
            padding: 2rem;
            max-width: 400px;
            margin: 0 auto
        }

            .loading-container .spinner {
                width: 48px;
                height: 48px;
                border: 4px solid rgb(26 115 232 / .2);
                border-top: 4px solid #1a73e8;
                border-radius: 50%;
                animation: spin 1s linear infinite;
                margin-bottom: 1rem
            }

            .loading-container p {
                font-size: 1.1rem;
                font-weight: 500;
                color: #1a1a1a;
                margin: 0;
                text-shadow: 0 1px 2px rgb(0 0 0 / .1)
            }

        .progress-overlay {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: rgb(0 0 0 / .5);
            display: flex;
            justify-content: center;
            align-items: center;
            z-index: 990; /* por debajo de los modales (cover 1000 / custom 1100 / canva 1150) para no taparlos;
                             el nav lateral y el FAB se ocultan durante la carga con :has(), no con z-index */
            backdrop-filter: blur(8px)
        }

        .progress-container {
            padding: 2.5rem;
            text-align: center;
            max-width: 450px;
            width: 90%;
            position: relative;
            overflow: hidden
        }

            .progress-container h3 {
                margin: 0 0 1.5rem;
                font-size: 1.3rem;
                color: #1a1a1a;
                font-family: 'Poppins',sans-serif;
                font-weight: 600
            }

        .progress-bar {
            background: rgb(0 0 0 / .1);
            border-radius: 10px;
            height: 12px;
            overflow: hidden;
            margin-bottom: 1rem;
            box-shadow: inset 0 2px 4px rgb(0 0 0 / .05)
        }

        .progress-bar-fill {
            background: linear-gradient(90deg,#1a73e8,#00d4ff);
            height: 100%;
            transition: width 0.5s ease-in-out;
            border-radius: 10px;
            box-shadow: 0 0 10px rgb(26 115 232 / .3)
        }

        .progress-container p {
            margin: 0;
            font-size: 1rem;
            color: #555;
            font-family: 'Open Sans',sans-serif
        }

        .cancel-button {
            font-family: 'Poppins',sans-serif;
            margin-top: 1rem;
            padding: .75rem 1.5rem;
            background: rgb(220 53 69 / .9);
            color: #fff;
            border: none;
            border-radius: 25px;
            cursor: pointer;
            font-size: .95rem;
            transition: all 0.3s ease;
            backdrop-filter: blur(5px)
        }

            .cancel-button:hover {
                background: rgb(220 53 69);
                transform: translateY(-2px);
                box-shadow: 0 4px 12px rgb(220 53 69 / .3)
            }

        @keyframes spin {
            0% {
                transform: rotate(0deg)
            }

            100% {
                transform: rotate(360deg)
            }
        }

        .contact-info-text {
            font-family: 'Open Sans',sans-serif;
            font-size: .9rem;
            color: #555;
            margin-bottom: 15px;
            line-height: 1.4;
            text-align: left
        }

        @media (max-width:768px) {
            .main-content {
                margin-left: 0 !important;
                width: 100% !important
            }

            .container-fluid {
                margin-left: 0 !important;
                width: 100% !important;
                padding: 0.5rem !important
            }

            .col-md-9 {
                width: 100% !important;
                padding: 0.5rem !important
            }

            .back-button {
                display: flex !important
            }
        }

        .blank-right {
            display: block !important;
            background: #f9f9f9;
            border: 1px dashed #ddd
        }

        .light-loading-overlay {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            /* Opaco y por encima de TODO (nav lateral, FAB, ContactWidget) para una carga limpia */
            background: #ffffff;
            display: flex;
            flex-direction: column;
            justify-content: center;
            align-items: center;
            z-index: 2000000;
            transition: opacity 0.3s ease
        }

        /* Mientras se muestra CUALQUIER pantalla de carga (spinner inicial o barra de progreso),
           ocultamos el nav lateral azul y el FAB/botón de ayuda, para que la carga se vea 100% limpia
           (independiente de z-index / contextos de apilamiento). */
        body:has(.light-loading-overlay) .sidebar2,
        body:has(.light-loading-overlay) .fab-container,
        body:has(.progress-overlay) .sidebar2,
        body:has(.progress-overlay) .fab-container {
            display: none !important;
        }

        .light-spinner {
            width: 38px;
            height: 38px;
            border: 3px solid #e8f0fe;
            border-top: 3px solid #1a73e8;
            border-radius: 50%;
            animation: spin 1s linear infinite;
            margin-bottom: 18px
        }

        .typing-text {
            font-family: 'Poppins',sans-serif;
            font-size: 1.15rem;
            font-weight: 600;
            color: #1a73e8;
            letter-spacing: .5px
        }

        .light-loading-overlay .dots::after {
            content: '';
            display: inline-block;
            width: 1.5em;
            text-align: left;
            animation: dots 1.5s steps(4,end) infinite;
            color: #1a73e8;
            font-weight: bold
        }

        @keyframes dots {
            0% {
                content: ''
            }

            25% {
                content: '.'
            }

            50% {
                content: '..'
            }

            75% {
                content: '...'
            }

            100% {
                content: ''
            }
        }

        .dots::after {
            content: '';
            display: inline-block;
            width: 1.5em;
            text-align: left;
            animation: dots 1.5s steps(4,end) infinite;
            color: white
        }

        @keyframes dots {
            0% {
                content: ''
            }

            25% {
                content: '.'
            }

            50% {
                content: '..'
            }

            75% {
                content: '...'
            }

            100% {
                content: ''
            }
        }

        .app-layout {
            display: flex;
            align-items: center;
            justify-content: center;
            max-height: 100vh;
            min-height: 100vh;
            padding: 30px;
            gap: 20px;
            box-sizing: border-box
        }

        .customization-sidebar {
            flex-shrink: 0;
            width: 340px;
            min-width: 220px;
            max-width: 340px;
            max-height: 95vh;
            background: #fff;
            border-radius: 15px;
            box-shadow: 0 4px 20px rgb(0 0 0 / .05);
            display: flex;
            flex-direction: column;
            height: 95vh;
            overflow: hidden;
            transition: all 0.3s ease
        }

        .sidebar-header {
            padding: 20px;
            border-bottom: 1px solid #eee;
            flex-shrink: 0;
            background: #fff;
            z-index: 10
        }

        /* "Sin personalizar" en el botón de la portada: la misma pastilla naranja suave que las otras
           etiquetas de la app ("Solo ordenador"), en la esquina como la de "Recomendado". Con tres clases a
           propósito: Bootstrap trae ".btn .badge { position: relative }", que con una sola la ganaba y la
           dejaba arriba en el centro empujando el texto del botón. */
        .sidebar-header .btn .portada-sin-personalizar {
            position: absolute;
            top: 7px;
            right: 7px;
            background: #fff3e0;
            color: #e65100;
            font-size: .65rem;
            font-weight: 600
        }

        .sidebar-accordion-scroll {
            flex: 1;
            overflow-y: auto;
            padding: 0 10px;
            scrollbar-gutter: stable;
            scrollbar-width: thin;
            scrollbar-color: #c1c1c1 #fff0
        }

            .sidebar-accordion-scroll::-webkit-scrollbar {
                width: 6px
            }

            .sidebar-accordion-scroll::-webkit-scrollbar-track {
                background: #fff0
            }

            .sidebar-accordion-scroll::-webkit-scrollbar-thumb {
                background: #c1c1c1;
                border-radius: 3px
            }

                .sidebar-accordion-scroll::-webkit-scrollbar-thumb:hover {
                    background: #a8a8a8
                }

        @media (max-width:1500px) {
            .customization-sidebar {
                width: 310px
            }
        }

        @media (max-width:1350px) {
            .customization-sidebar {
                width: 280px;
                font-size: .93rem
            }
        }

        @media (max-width:1250px) {
            .customization-sidebar {
                width: 250px;
                font-size: .9rem
            }

            .custom-accordion {
                font-size: .85rem
            }
        }

        @media (max-width:768px) {
            /* SOLO ocultamos el contenido interno, NO la caja */
            .sidebar2 nav,
            .sidebar nav {
                display: none !important;
            }
            /* mantenemos estructura viva */
            .sidebar,
            .sidebar2 {
                width: 0 !important;
                min-width: 0 !important;
                padding: 0 !important;
                border: none !important;
            }
        }


        /* Contenedor del Switch */
        .safety-toggle-wrapper {
            display: flex;
            align-items: center;
            gap: 10px;
            background: #f8f9fa;
            padding: 5px 12px;
            border-radius: 20px;
            border: 1px solid #e9ecef;
        }

        .toggle-label {
            font-size: 11px;
            font-weight: 600;
            color: #6c757d;
            text-transform: uppercase;
        }

        /* El Switch (Checkbox oculto) */
        .modern-switch {
            position: relative;
            display: inline-block;
            width: 34px;
            height: 18px;
        }

            .modern-switch input {
                opacity: 0;
                width: 0;
                height: 0;
            }

        /* El Slider */
        .slider {
            position: absolute;
            cursor: pointer;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background-color: #ccc;
            transition: .4s;
            border-radius: 34px;
        }

            .slider:before {
                position: absolute;
                content: "";
                height: 12px;
                width: 12px;
                left: 3px;
                bottom: 3px;
                background-color: white;
                transition: .4s;
                border-radius: 50%;
            }

        input:checked + .slider {
            background-color: purple;
        }
            /* Color morado */
            input:checked + .slider:before {
                transform: translateX(16px);
            }

        /* Estilo del margen de seguridad mejorado */
        .safety-margin-overlay {
            position: absolute;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            border: 8px solid rgba(128, 0, 128, 0.2); /* Morado suave */
            box-shadow: inset 0 0 0 1px rgba(128, 0, 128, 0.4); /* Línea fina interior */
            pointer-events: none;
            z-index: 100;
        }

        @font-face {
            font-family: 'Poppins';
            /* Usamos la ruta absoluta desde la raíz para evitar errores de nivel */
            src: url('/fonts/Poppins-SemiBold.ttf') format('truetype');
            font-weight: 600;
            font-style: normal;
            font-display: block; /* Esto evita el parpadeo de fuente */
        }

        .limit-modal-overlay {
            position: fixed;
            inset: 0;
            background: rgba(0, 0, 0, 0.65);
            display: flex;
            align-items: center;
            justify-content: center;
            z-index: 2000; /* Más alto que otros modales */
            backdrop-filter: blur(4px);
        }

        .limit-modal {
            background: white;
            border-radius: 16px;
            width: 100%;
            max-width: 420px;
            box-shadow: 0 20px 60px rgba(0,0,0,0.25);
            overflow: hidden;
            animation: modalFadeIn 0.3s ease-out;
        }

            .limit-modal .modal-header {
                padding: 1.25rem 1.5rem;
                background: linear-gradient(135deg, #f8f9fa, #e9ecef);
                border-bottom: 1px solid #dee2e6;
                display: flex;
                justify-content: space-between;
                align-items: center;
            }

            .limit-modal .modal-body {
                padding: 2rem 1.5rem;
            }

        .limit-icon {
            font-size: 4.5rem;
            line-height: 1;
        }

        .limit-modal .modal-footer {
            padding: 1.25rem 1.5rem;
            border-top: 1px solid #dee2e6;
        }

        @keyframes modalFadeIn {
            from

        {
            opacity: 0;
            transform: scale(0.92);
        }

        to {
            opacity: 1;
            transform: scale(1);
        }

        }

        /* --- LAYOUT GRID (LADO A LADO) --- */
        .upload-grid {
            display: flex;
            align-items: stretch; /* Para que ambas cajas tengan la misma altura */
            justify-content: space-between;
            gap: 15px;
            margin-bottom: 20px;
        }

        /* Las tarjetas individuales */
        .upload-option {
            flex: 1; /* Ocupan el mismo ancho (50% / 50%) */
            background: #fff;
            border: 1px solid #eef0f2;
            border-radius: 16px;
            padding: 20px;
            display: flex;
            flex-direction: column; /* Contenido apilado dentro de la tarjeta */
            transition: all 0.3s ease;
            box-shadow: 0 2px 8px rgba(0,0,0,0.03);
            min-height: 280px; /* Altura mínima para que se vean iguales */
        }

            .upload-option:hover {
                transform: translateY(-5px);
                box-shadow: 0 8px 20px rgba(26, 115, 232, 0.1);
                border-color: #1a73e8;
            }

        /* Cabecera de la tarjeta */
        .option-header-row {
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 10px;
            margin-bottom: 20px;
        }

        .option-icon {
            width: 36px;
            height: 36px;
            background: #f0f7ff;
            color: #1a73e8;
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 1.1rem;
        }

        .option-title {
            font-weight: 700;
            margin: 0;
            color: #444;
            font-size: 1rem;
        }

        /* Cuerpo centrado */
        .option-body-center {
            flex: 1;
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            width: 100%;
        }

        /* --- SEPARADOR VERTICAL --- */
        .divider-vertical {
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            color: #ccc;
            font-weight: 600;
            font-size: 0.9rem;
        }

            .divider-vertical .line {
                width: 1px;
                background: #eee;
                flex: 1; /* Ocupa todo el espacio arriba y abajo */
                min-height: 20px;
            }

            .divider-vertical span {
                padding: 10px 0;
            }

        /* --- ESTILO BOTÓN SUBIDA PC --- */
        .file-upload-box {
            border: 2px dashed #dde1e6;
            border-radius: 12px;
            padding: 20px;
            text-align: center;
            cursor: pointer;
            transition: all 0.2s;
            width: 100%;
            display: block;
        }

            .file-upload-box:hover {
                border-color: #1a73e8;
                background: #f8fbff;
            }

        .file-name-badge {
            background: #e8f0fe;
            color: #1a73e8;
            padding: 5px 10px;
            border-radius: 20px;
            font-size: 0.8rem;
            max-width: 100%;
            overflow: hidden;
            text-overflow: ellipsis;
        }

       /* --- QR PROGRESS RING FIXED --- */

    /* 1. El contenedor principal del círculo */
    .qr-progress-wrapper {
        position: relative; /* Importante para que lo de adentro se posicione relativo a esto */
        width: 140px;       /* Tamaño fijo del círculo exterior */
        height: 140px;
        margin: 0 auto;     /* Centrado horizontalmente en la tarjeta */
        display: flex;
        align-items: center;
        justify-content: center;
    }

    /* 2. El SVG (El anillo de color) */
    .progress-ring {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        z-index: 1; /* Detrás de la caja blanca si fuera necesario */
    }

    /* 3. La caja blanca que contiene la imagen (Más pequeña que el anillo) */
    .qr-image-box {
        position: absolute;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%); /* Truco mágico para centrar perfecto */
        width: 110px;  /* Ancho fijo más pequeño que el wrapper (140px) */
        height: 110px; /* Alto fijo */
        background: white;
        padding: 8px;  /* Espacio blanco alrededor del QR */
        border-radius: 12px;
        box-shadow: 0 2px 10px rgba(0,0,0,0.05);
        z-index: 2; /* Encima del anillo */
        display: flex;
        align-items: center;
        justify-content: center;
        overflow: hidden; /* Corta si la imagen intenta salirse */
    }

    /* 4. La imagen del QR en sí */
    .qr-image-box img {
        width: 100%;   /* Ocupa el 100% de la caja blanca (110px) */
        height: 100%;
        object-fit: contain; /* Asegura que se vea entera sin estirarse */
        display: block;
    }

    /* 5. El icono de éxito (Check verde) */
    .success-icon {
        font-size: 3rem;
        color: #28a745;
        line-height: 1;
    }


        /* ---- Ventana para elegir el formato y selector lateral (19-nov-2026) ---- */
        .formato-fondo {
            position: fixed;
            inset: 0;
            background: rgb(0 0 0 / .55);
            display: flex;
            align-items: center;
            justify-content: center;
            z-index: 1200;
            padding: 16px;
        }

        .formato-ventana {
            position: relative;
            background: #fff;
            border-radius: 16px;
            max-width: 620px;
            width: 100%;
            padding: 24px 24px 18px;
            box-shadow: 0 10px 40px rgb(0 0 0 / .25);
        }

        .formato-cerrar {
            position: absolute;
            top: 14px;
            right: 14px;
        }

        .formato-titulo {
            font-weight: 700;
            margin: 0 28px 6px 0;
        }

        .formato-intro {
            color: #555;
            font-size: .92rem;
        }

        .formato-opciones {
            display: flex;
            gap: 14px;
        }

        .formato-opcion {
            flex: 1;
            display: flex;
            flex-direction: column;
            align-items: center;
            gap: 4px;
            padding: 14px 10px 12px;
            border: 2px solid #e2e2e2;
            border-radius: 12px;
            background: #fafafa;
            cursor: pointer;
            text-align: center;
            transition: border-color .15s, box-shadow .15s;
        }

            .formato-opcion:hover {
                border-color: #8fb5f9;
            }

            .formato-opcion.elegida {
                border-color: #0d6efd;
                background: #eef4ff;
                box-shadow: 0 0 0 3px rgb(13 110 253 / .15);
            }

        .formato-dato {
            font-size: .9rem;
            color: #333;
        }

        .formato-nota {
            font-size: .78rem;
            color: #777;
        }

        .formato-elegido {
            font-size: .75rem;
            font-style: normal;
            font-weight: 700;
            color: #0d6efd;
            text-transform: uppercase;
            letter-spacing: .04em;
        }

        .formato-pista {
            margin: 14px 0 0;
            font-size: .8rem;
            color: #777;
        }

        .formato-mini {
            width: 92px;
            height: 120px;
            background: #fff;
            border: 1px solid #ddd;
            border-radius: 4px;
            padding: 9px 8px;
            display: flex;
            flex-direction: column;
            gap: 6px;
            margin-bottom: 6px;
        }

        .formato-mini-dos {
            flex-direction: row;
            gap: 0;
        }

        .fm-col {
            flex: 1;
            display: flex;
            flex-direction: column;
            gap: 6px;
        }

        .fm-linea {
            width: 1px;
            background: #CACACA;
            margin: 0 4px;
        }

        .fm-b {
            display: block;
            height: 8px;
            border-radius: 4px;
        }

        .fm-r {
            background: #cccccc;
            align-self: flex-start;
        }

        .fm-s {
            background: #c2e0b8;
            align-self: flex-end;
        }

        .modo-libro {
            display: flex;
            gap: 10px;
            margin: 14px 0 12px;
        }

        .modo-tarjeta {
            flex: 1;
            display: flex;
            flex-direction: column;
            align-items: center;
            gap: 6px;
            padding: 10px 6px 8px;
            border: 2px solid #e2e2e2;
            border-radius: 12px;
            background: #fafafa;
            cursor: pointer;
            transition: border-color .15s, box-shadow .15s;
        }

            .modo-tarjeta:hover {
                border-color: #8fb5f9;
            }

            .modo-tarjeta.elegida {
                border-color: #0d6efd;
                background: #eef4ff;
                box-shadow: 0 0 0 3px rgb(13 110 253 / .15);
            }

            .modo-tarjeta .formato-mini {
                width: 70px;
                height: 92px;
                padding: 7px 6px;
                gap: 5px;
                margin-bottom: 0;
            }

            .modo-tarjeta .fm-col {
                gap: 5px;
            }

            .modo-tarjeta .fm-b {
                height: 6px;
            }

        .modo-nombre {
            font-size: .82rem;
            font-weight: 600;
            color: #333;
        }

        .fechas-libro {
            display: flex;
            gap: 14px;
            margin-bottom: 6px;
        }

        .fecha-libro {
            flex: 1;
            display: flex;
            flex-direction: column;
            gap: 3px;
            margin: 0;
            min-width: 0;
        }

        .fecha-titulo {
            font-size: .72rem;
            font-weight: 700;
            letter-spacing: .06em;
            text-transform: uppercase;
            color: #666;
        }

        /* Botón de la portada (antes con estilo en línea): en el móvil sigue igual que siempre. */
        .boton-portada {
            position: relative;
            height: 100px;
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            border: 2px dashed #0d6efd;
        }

            .boton-portada img {
                height: 60px;
                margin-bottom: 8px;
            }

        /* Barra lateral en PC (22-nov-2026): se desliza ENTERA. Antes la parte de arriba (portada, páginas,
           formato y fechas) era fija y medía 553 px, y Contactos, Capítulos, Colores... quedaban en una franja
           de 65 px en un portátil de 1366x768 (188 en un MacBook Air) que casi no se podía deslizar. Ahora es
           una sola columna, y lo de arriba es más bajo: portada en una fila y formatos con la maqueta en pequeño. */
        @media (min-width: 769px) {
            .customization-sidebar {
                overflow-y: auto;
                overscroll-behavior: contain;
                scrollbar-width: thin;
                scrollbar-color: #c1c1c1 transparent;
            }

                .customization-sidebar::-webkit-scrollbar {
                    width: 6px;
                }

                .customization-sidebar::-webkit-scrollbar-thumb {
                    background: #c1c1c1;
                    border-radius: 3px;
                }

            .customization-sidebar .sidebar-header {
                padding: 18px 16px 14px;
                border-bottom: none;
            }

                .customization-sidebar .sidebar-header h5 {
                    margin-bottom: 14px !important;
                }

            .customization-sidebar .sidebar-accordion-scroll {
                flex: none;
                overflow: visible;
                padding: 4px 10px 16px;
            }

            .customization-sidebar .boton-portada {
                height: auto;
                min-height: 52px;
                flex-direction: row;
                justify-content: flex-start;
                gap: 10px;
                padding: 8px 12px;
                text-align: left;
            }

                .customization-sidebar .boton-portada img {
                    height: 32px;
                    margin-bottom: 0;
                }

                /* La pastilla «Sin personalizar» ya no cabe en la esquina de un botón tan bajo: va en su fila. */
                .customization-sidebar .sidebar-header .btn.boton-portada .portada-sin-personalizar {
                    position: static;
                    order: 3;
                    margin-left: auto;
                }

            .customization-sidebar .modo-libro {
                gap: 8px;
                margin: 12px 0 10px;
            }

            .customization-sidebar .modo-tarjeta {
                flex-direction: row;
                justify-content: center;
                gap: 8px;
                padding: 6px 8px;
                border-radius: 10px;
            }

                .customization-sidebar .modo-tarjeta .formato-mini {
                    width: 26px;
                    height: 34px;
                    padding: 4px 3px;
                    gap: 3px;
                    flex-shrink: 0;
                }

                .customization-sidebar .modo-tarjeta .fm-col {
                    gap: 3px;
                }

                .customization-sidebar .modo-tarjeta .fm-b {
                    height: 3px;
                }

            .customization-sidebar .modo-nombre {
                font-size: .78rem;
                line-height: 1.15;
                text-align: left;
            }
        }

        @media (max-width: 576px) {
            .formato-opciones {
                flex-direction: column;
            }
        }
        /* ==================================================================================
           HOJA DEL EDITOR A TAMAÑO FIJO ("fotocopia") — solo escritorio
           ----------------------------------------------------------------------------------
           La hoja se dibuja SIEMPRE igual: 411 x 555 px, que es exactamente el modelo del
           paginador (535 unidades de alto útil una vez quitado el padding). Después se amplía o
           se reduce entera con una ÚNICA escala (--pgscale, que calcula window.fitBookPages), así
           que todas las páginas se ven del mismo tamaño, se mire en la pantalla que se mire.

           La calibración sigue una regla: cada elemento debe ocupar COMO MUCHO lo que el paginador
           le reserva. Si todo cumple eso, 535 unidades de contenido caben siempre en 535 px y no
           se puede cortar nada. Por eso los tamaños de abajo son algo menores que lo estimado:

             elemento          reserva el paginador     ocupa de verdad
             mensaje 1 línea          37,75                   28,5   (75%)
             línea adicional          16,5                    12,0   (73%)
             cabecera de fecha        23,7                    17,0   (72%)
             nombre del emisor        12                      10,0   (83%)
             foto                     200 (+28)              202,5   (89%)
             sticker                  126,75 (+28)           127,5   (82%)

           Se probó a apurar más (letra 11,5 px y burbuja al 90%, un 84% de aprovechamiento) y
           VOLVIÓ A CORTARSE contenido. El motivo es que los 53 caracteres por línea del paginador
           son una aproximación: según qué letras lleve la frase, entran bastantes menos y el
           mensaje ocupa más líneas de las previstas. Este margen no es espacio desperdiciado, es
           lo que absorbe esa variación. No apretar más sin una forma fiable de medir el texto.

           El tamaño de letra (10 px) sale de otra cuenta: el paginador cuenta 53 caracteres por
           línea, y con la burbuja limitada al 75% del ancho solo caben 53 si la letra mide ~10 px.
           Antes entraban 40, así que las frases largas ocupaban más líneas de las previstas, y ESE
           era el motivo principal de que se cortara el contenido.

           No toca el paginador ni el generador del PDF: número de páginas, lomo y precio no varían.
           Móvil queda fuera: allí la hoja crece con el contenido y no hay nada que recortar.
           ================================================================================== */
        /* Se aplica en escritorio Y EN MÓVIL: la hoja lógica es la misma en los dos, lo único que
           cambia es la escala con la que se muestra (--pgscale, que calcula window.fitBookPages). */
            /* El feed de móvil también necesita su valor por defecto: allí las hojas cuelgan de él. */
            .book-open,
            .mobile-book-feed {
                --pgscale: 1;
            }

            .book-open {
                align-items: flex-start;
            }

            .book-page {
                width: calc(411px * var(--pgscale, 1));
                height: calc(555px * var(--pgscale, 1));
                aspect-ratio: auto;
                max-height: none;
                padding: 0;
                box-sizing: border-box;
                overflow: hidden;
                flex: none;
            }

            /* La hoja lógica: tamaño fijo, y se escala entera para verse. */
            .book-page > .page-content {
                width: 411px;
                height: 555px;
                box-sizing: border-box;
                padding: 10px 15px;
                transform: scale(var(--pgscale, 1));
                transform-origin: top left;
                flex: none;
            }

            .message-container {
                padding: 3.75px 0;
            }

            .message-bubble {
                font-size: 10px !important;
                line-height: 1.2 !important;
                padding: .45em .8em !important;
                border-radius: 10px !important;
            }

            .date-header {
                font-size: 9px !important;
                line-height: 1.2 !important;
                margin-bottom: 6px !important;
            }

            .sender-name {
                font-size: 5px !important;
                line-height: 1.2 !important;
                margin-top: 4px !important;
            }

            .message-image {
                max-width: 190px !important;
                max-height: 190px !important;
                margin-top: 5px;
            }

            .message-sticker {
                max-width: 120px !important;
                max-height: 120px !important;
            }

            /* Audio y vídeo: el paginador les reserva 150 unidades. Su tamaño venía de clamp(50px, 8vw,
               200px), o sea que crecía con el ancho de la pantalla y en monitores grandes se pasaba de esa
               reserva. Con un cuadrado fijo de 130 siempre cabe, y además se ve igual en cualquier
               dispositivo, que es lo que buscamos con la hoja de tamaño fijo. */
            .audio-container,
            .video-container {
                width: 130px !important;
                height: 130px !important;
            }

            /* La dedicatoria, en las mismas unidades fijas que el resto de la hoja. Con 11 px y este
               interlineado caben de sobra los 600 caracteres que admite el campo. */
            .book-dedication-inner {
                font-size: 11px !important;
                line-height: 1.6 !important
            }

            .book-dedication-minimal .book-dedication-inner {
                font-size: 9px !important;
                line-height: 1.9 !important
            }

            .book-dedication-rules .book-dedication-inner,
            .book-dedication-flourish .book-dedication-inner {
                font-size: 12px !important;
                line-height: 1.7 !important
            }

            .book-dedication-wreath .book-dedication-inner {
                font-size: 9px !important;
                line-height: 1.7 !important
            }

            .book-dedication-initial .book-dedication-inner {
                font-size: 11px !important;
                line-height: 1.7 !important
            }

            .book-dedication-love .book-dedication-inner::before {
                font-size: 18px;
                margin-bottom: 10px
            }

            .book-dedication-friends .book-dedication-inner::before {
                font-size: 30px
            }

            .image-placeholder {
                max-width: 190px !important;
                max-height: 190px !important;
            }

            /* El número de página va fuera de la zona escalada, así que se ajusta a mano. */
            .book-page .page-footer {
                font-size: calc(8px * var(--pgscale, 1)) !important;
            }

            /* ---- Formato «dos columnas» (19-nov-2026) -------------------------------------------------
               Misma proporción que el PDF (LibroApp.Core.MedidasDosColumnas): allí 333 pt de ancho útil =
               dos columnas de 157,5 + 18 de hueco. Aquí la hoja lógica tiene 381 px útiles: columnas de 180
               y hueco de 21, con la línea fina en el centro. La burbuja llega al 91 % de la columna (en el PDF
               143,5 de 157,5) y la letra es la misma que en el formato normal. */
            .dc-hoja {
                display: flex;
                flex-direction: column;
                height: 100%;
            }

            .dc-columnas {
                display: flex;
                flex: 1;
                min-height: 0;
            }

            .dc-columna {
                width: 180px;
                flex: none;
                min-width: 0;
            }

            .dc-separador {
                width: 21px;
                flex: none;
                position: relative;
            }

                .dc-separador::after {
                    content: '';
                    position: absolute;
                    left: 50%;
                    top: 0;
                    bottom: 0;
                    border-left: 1px solid #CACACA;
                }

            .dc-columna .message-content {
                max-width: 91% !important;
            }

            /* Los botones de cada mensaje (mover, borrar, editar) están ocultos hasta pasar el ratón PERO ocupan
               su sitio en la fila. En la hoja normal sobra hueco; en una columna de 180 px se comían 80 y la
               burbuja quedaba en 100: el texto ocupaba más líneas de las medidas y el último mensaje de la
               columna se salía de la hoja (lo cazó DosColumnasTests). Aquí flotan encima, sin ocupar sitio. */
            .dc-columna .message-wrapper {
                position: relative;
            }

            .dc-columna .message-actions {
                position: absolute;
                top: 50%;
                transform: translateY(-50%);
                z-index: 5;
                margin: 0 !important;
                background: rgb(255 255 255 / .85);
                border-radius: 12px;
                padding: 2px;
            }

            .dc-columna .message-actions-left {
                left: 0;
            }

            .dc-columna .message-actions-right {
                right: 0;
            }

            .dc-columna .message-image,
            .dc-columna .image-placeholder {
                max-width: 100% !important;
            }

        /* --- RESPONSIVE: En móviles se pone uno encima del otro --- */
        @media (max-width: 768px) {
            .upload-grid

        {
            flex-direction: column;
        }

        .divider-vertical {
            flex-direction: row;
            width: 100%;
            margin: 10px 0;
        }

            .divider-vertical .line {
                width: auto;
                height: 1px;
                flex: 1;
            }

            .divider-vertical span {
                padding: 0 15px;
            }

        .upload-option {
            min-height: auto;
        }

        }
        /* Badge Wi-Fi */
    .wifi-badge {
        background: #fff3cd;
        color: #856404;
        font-size: 0.75rem;
        padding: 4px 10px;
        border-radius: 12px;
        display: inline-flex;
        align-items: center;
        gap: 5px;
        margin-bottom: 10px;
        border: 1px solid #ffeeba;
        font-weight: 600;
    }
        /* Contenedor tipo "Cápsula" */
        .device-selector-wrapper {
            background-color: #f1f3f4;
            border-radius: 16px;
            padding: 6px;
            display: inline-flex; /* Para que se ajuste al contenido */
            gap: 8px; /* Espacio entre botones */
            margin-bottom: 20px;
            box-shadow: inset 0 2px 4px rgba(0,0,0,0.03);
        }

        /* Estilo base del botón */
        .device-tab {
            border: none;
            background: transparent;
            padding: 10px 25px;
            border-radius: 12px;
            font-size: 1rem;
            font-weight: 600;
            color: #5f6368;
            display: flex;
            align-items: center;
            gap: 8px;
            transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
            cursor: pointer;
            outline: none;
        }

            .device-tab i {
                font-size: 1.2rem;
                transition: transform 0.2s;
            }

            /* Efecto Hover (cuando pasas el ratón por encima) */
            .device-tab:hover {
                background-color: rgba(0,0,0,0.05);
                color: #202124;
            }

                .device-tab:hover i {
                    transform: scale(1.1);
                }

            /* --- ESTADO ACTIVO: IPHONE (Negro Apple) --- */
            .device-tab.apple.active {
                background-color: #000000;
                color: #ffffff;
                box-shadow: 0 4px 12px rgba(0,0,0,0.2);
                transform: translateY(-1px);
            }

            /* --- ESTADO ACTIVO: ANDROID (Verde Android) --- */
            .device-tab.android.active {
                background-color: #3ddc84;
                color: #013215; /* Texto verde oscuro para contraste perfecto */
                box-shadow: 0 4px 12px rgba(61, 220, 132, 0.4);
                transform: translateY(-1px);
            }

        /* Ajuste responsive para móviles pequeños */
        @media (max-width: 400px) {
            .device-selector-wrapper

        {
            display: flex;
            width: 100%;
        }

        .device-tab {
            flex: 1;
            justify-content: center;
        }

        }

        .android-install-step {
        display: flex;
        align-items: center;
        background: #f1f8e9; /* Verde muy suave */
        border: 1px solid #c5e1a5;
        padding: 15px;
        border-radius: 12px;
        margin-bottom: 20px;
        gap: 20px;
    }

    .install-qr-box {
        background: white;
        padding: 5px;
        border-radius: 8px;
        box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    }

    .install-qr-box img {
        width: 80px;
        height: 80px;
        display: block;
    }

    .install-text h6 {
        color: #2e7d32;
        font-weight: 700;
        margin-bottom: 5px;
    }

    .install-text p {
        font-size: 0.9rem;
        margin-bottom: 5px;
        color: #555;
    }

    /* --- SIMULADOR WHATSAPP --- */
    .phone-mockup {
        width: 260px;
        height: 420px; /* Un poco más compacto */
        background: #fff;
        border: 8px solid #2d2d2d;
        border-radius: 25px;
        position: relative;
        overflow: hidden;
        margin: 0 auto;
        box-shadow: 0 10px 25px rgba(0,0,0,0.15);
        font-family: Helvetica, Arial, sans-serif;
        display: flex;
        flex-direction: column;
        pointer-events: none;
        user-select: none;
    }

    .mock-header {
        background: #008069;
        height: 45px;
        display: flex;
        align-items: center;
        padding: 0 10px;
        color: white;
        justify-content: space-between;
    }

    .mock-body {
        flex: 1;
        background: #e5ddd5;
        position: relative;
        padding: 10px;
        display: flex;
        flex-direction: column;
    }

    .chat-bubble {
        background: white;
        padding: 6px;
        border-radius: 6px;
        margin-bottom: 6px;
        width: 70%;
        box-shadow: 0 1px 1px rgba(0,0,0,0.1);
    }
    .chat-bubble.sent { background: #dcf8c6; align-self: flex-end; }
    .fake-text { height: 6px; background: #e0e0e0; border-radius: 3px; margin-bottom: 3px; }

    /* MENÚS FLOTANTES */
    .mock-menu-dropdown {
        position: absolute; top: 5px; right: 5px; background: white; width: 130px;
        box-shadow: 0 2px 10px rgba(0,0,0,0.2); border-radius: 4px; z-index: 10;
        animation: menuPop 0.2s ease-out;
    }
    .mock-menu-item { padding: 8px; font-size: 0.8rem; color: #333; border-bottom: 1px solid #eee; }
    .mock-menu-item:hover { background: #f5f5f5; }

    /* DEDO PULSADOR */
    .tap-indicator {
        position: absolute; width: 26px; height: 26px; border-radius: 50%;
        background: rgba(255, 255, 255, 0.4); border: 2px solid #1a73e8;
        z-index: 20; animation: pulseTap 1.5s infinite; pointer-events: none;
    }

    @keyframes pulseTap {
        0% { transform: scale(0.8); box-shadow: 0 0 0 0 rgba(26, 115, 232, 0.7); }
        100% { transform: scale(0.8); box-shadow: 0 0 0 15px rgba(26, 115, 232, 0); }
    }
    @keyframes menuPop { from { opacity: 0; transform: scale(0.9); } to { opacity: 1; transform: scale(1); } }

    /* CONTROLES */
    .tutorial-controls { display: flex; justify-content: center; gap: 10px; margin-top: 10px; align-items: center; position: relative; z-index: 50; pointer-events: auto; }
    .step-dot { width: 8px; height: 8px; background: #ddd; border-radius: 50%; transition: all 0.3s; }
    .step-dot.active { background: #1a73e8; transform: scale(1.3); }

    /* Botones de navegación robustos:
       - Tamaño FIJO aunque la fuente de iconos (Bootstrap Icons) no cargue en ese equipo/red,
         evitando que el botón colapse a un punto minúsculo imposible de pulsar.
       - Área de clic ampliada MÁS ALLÁ del círculo visible (clics "muertos" alrededor cuentan).
       - z-index/pointer-events para que ninguna capa lo intercepte. */
    .tutorial-controls > .btn {
        min-width: 44px; min-height: 44px;
        padding: 8px 14px;
        display: inline-flex; align-items: center; justify-content: center; gap: 5px;
        font-size: 0.95rem; line-height: 1; white-space: nowrap;
        position: relative; z-index: 51; pointer-events: auto;
        -webkit-tap-highlight-color: rgba(0,0,0,0.05);
        touch-action: manipulation;
    }
    .tutorial-controls > .btn::after {
        content: ""; position: absolute; top: -12px; left: -12px; right: -12px; bottom: -12px;
    }
    .tutorial-controls > .btn:disabled, .tutorial-controls > .btn[disabled] { pointer-events: none; }

    /* --- ESTILOS EXTRA PARA EL MENU COMPARTIR --- */
    .android-share-sheet {
        position: absolute;
        bottom: 0;
        left: 0;
        width: 100%;
        background: white;
        border-radius: 15px 15px 0 0;
        padding: 15px;
        box-shadow: 0 -5px 20px rgba(0,0,0,0.2);
        z-index: 50;
        animation: slideUp 0.3s ease-out;
        font-family: Roboto, Arial, sans-serif;
    }

    .share-title { font-size: 0.9rem; color: #555; margin-bottom: 15px; border-bottom: 1px solid #eee; padding-bottom: 10px; }

    .share-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }

    .share-item { display: flex; flex-direction: column; align-items: center; gap: 5px; }

    .share-icon-circle {
        width: 45px; height: 45px; border-radius: 50%; overflow: hidden;
        display: flex; align-items: center; justify-content: center;
        border: 1px solid #eee;
    }
    .share-icon-circle img { width: 100%; height: 100%; object-fit: cover; }
    .share-name { font-size: 0.7rem; color: #333; text-align: center; line-height: 1.1; width: 100%; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }

    @keyframes slideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }

    /* --- BOTONES DE SELECCIÓN GIGANTES --- */
    .big-device-selector {
        display: flex;
        gap: 20px;
        justify-content: center;
        padding: 40px 0;
    }

    .big-device-btn {
        width: 140px;
        height: 140px;
        border: 2px solid #eee;
        border-radius: 20px;
        background: white;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
        box-shadow: 0 5px 15px rgba(0,0,0,0.05);
    }

    .big-device-btn i { font-size: 3rem; margin-bottom: 10px; color: #555; }
    .big-device-btn span { font-weight: 700; font-size: 1.1rem; color: #333; }

    .big-device-btn:hover { transform: translateY(-5px); box-shadow: 0 10px 25px rgba(0,0,0,0.1); border-color: #1a73e8; }
    .big-device-btn.active { background: #e8f0fe; border-color: #1a73e8; color: #1a73e8; }
    .big-device-btn.active i, .big-device-btn.active span { color: #1a73e8; }


    /* --- ESTILOS MENU COMPARTIR CON SCROLL --- */
    .share-horizontal-scroll {
        display: flex;
        gap: 15px;
        overflow-x: auto;
        padding: 10px 5px;
        /* Ocultar barra de scroll visualmente pero permitir scroll */
        scrollbar-width: none;
        -ms-overflow-style: none;
    }
    .share-horizontal-scroll::-webkit-scrollbar { display: none; }

    .share-app-icon {
        flex: 0 0 auto; /* No encoger */
        display: flex;
        flex-direction: column;
        align-items: center;
        width: 50px;
    }
    .share-circle {
        width: 45px; height: 45px; border-radius: 50%;
        display: flex; align-items: center; justify-content: center;
        margin-bottom: 5px; border: 1px solid #f0f0f0;
    }
    .share-circle img { width: 100%; height: 100%; object-fit: contain; }
    .share-label { font-size: 0.65rem; color: #444; text-align: center; white-space: nowrap; }

    /* Animación de dedo deslizando */
    .swipe-hand {
        position: absolute;
        bottom: 40px;
        right: 20px;
        font-size: 2rem;
        color: rgba(0,0,0,0.5);
        animation: swipeLeft 2s infinite;
        pointer-events: none;
        z-index: 100;
    }

    @keyframes swipeLeft {
        0% { transform: translateX(0) rotate(10deg); opacity: 0; }
        20% { opacity: 1; }
        80% { transform: translateX(-60px) rotate(0deg); opacity: 1; }
        100% { transform: translateX(-60px) rotate(0deg); opacity: 0; }
    }

        /* --- ANIMACIÓN DESLIZAR (SWIPE) --- */
        .share-sheet-mask {
            overflow: hidden; /* Oculta lo que se sale del borde */
            width: 100%;
            position: relative;
            padding: 10px 0;
        }

        .share-scroll-track {
            display: flex;
            gap: 20px;
            padding-left: 10px;
            /* La animación mueve la lista hacia la izquierda */
            animation: scrollListLeft 3.5s infinite ease-in-out;
        }

        .swipe-hand-animated {
            position: absolute;
            bottom: 20px;
            right: 30px;
            font-size: 2.5rem;
            color: rgba(0,0,0,0.6);
            z-index: 100;
            pointer-events: none;
            /* La animación mueve la mano simulando el arrastre */
            animation: handSwipeGesture 3.5s infinite ease-in-out;
        }

        /* Mueve la lista de iconos */
        @keyframes scrollListLeft {
            0%, 15%

        {
            transform: translateX(0);
        }
        /* Quieto al principio */
        40%, 85% {
            transform: translateX(-90px);
        }
        /* Deslizado a la izquierda */
        100% {
            transform: translateX(0);
        }
        /* Reset */
        }

        /* Mueve la mano y hace el "TAP" */
        @keyframes handSwipeGesture {
            0%

        {
            transform: translateX(20px) scale(1);
            opacity: 0;
        }

        10% {
            transform: translateX(20px) scale(1);
            opacity: 1; /* Aparece mano */
        }

        40% {
            transform: translateX(-50px) scale(1);
            opacity: 1; /* Termina de deslizar */
        }

        50% {
            transform: translateX(-50px) scale(0.9); /* Efecto de pulsar (TAP) */
            color: rgba(26, 115, 232, 0.8); /* Se pone azul al pulsar */
        }

        60% {
            transform: translateX(-50px) scale(1);
            opacity: 1;
        }

        80% {
            opacity: 0; /* Desaparece */
        }

        100% {
            opacity: 0;
        }

        }

        /* Estilo específico para el botón "Más" */
        .more-btn-circle {
            border: 1px dashed #999;
            background: #f9f9f9;
            color: #555;
        }

        /* --- ESTILOS ESPECÍFICOS IOS (IPHONE) ---
           Rehechos para la ficha de contacto/grupo que WhatsApp estrenó en iOS:
           cabecera con botones redondos (flecha atras y tres puntos), foto grande, fila de acciones
           y tarjetas agrupadas. La opción "Exportar chat" ya no está en la lista,
           vive dentro del menú de los tres puntos. */

    .ios-body { background: #fff; flex: 1; padding: 0; position: relative; }

    /* Cabecera del chat (paso 0): se pulsa el nombre para abrir la ficha */
    .ios-chat-header {
        background: #008069; color: #fff; height: 45px; flex-shrink: 0;
        display: flex; align-items: center; gap: 7px; padding: 0 10px; position: relative;
    }
    .ios-chat-avatar { width: 26px; height: 26px; border-radius: 50%; background: rgba(255,255,255,0.35); }
    .ios-chat-name { font-size: 0.8rem; font-weight: 600; }

    /* Cabecera de la ficha: chevron y tres puntos, ambos en círculo gris */
    .ios-prof-header {
        background: #fff; height: 44px; flex-shrink: 0;
        display: flex; align-items: center; justify-content: space-between; padding: 0 10px;
    }
    .ios-round-btn {
        width: 30px; height: 30px; border-radius: 50%; background: #efeff4; color: #000;
        display: flex; align-items: center; justify-content: center; font-size: 0.9rem;
    }

    /* Bloque de identidad del contacto/grupo */
    .ios-prof-top { text-align: center; padding: 4px 0 10px; }
    .ios-prof-avatar {
        width: 62px; height: 62px; border-radius: 50%; margin: 0 auto 6px;
        background: linear-gradient(135deg, #8fd3f4, #3a7bd5);
    }
    .ios-prof-name { font-size: 1rem; font-weight: 800; color: #111; }
    .ios-prof-sub { font-size: 0.72rem; color: #8e8e93; }
    .ios-prof-dimmed { filter: blur(1.5px); opacity: 0.55; transition: all 0.2s; }

    /* Fila de acciones: llamar / estado / añadir / buscar */
    .ios-chips { display: flex; gap: 6px; padding: 8px 10px 12px; }
    .ios-chip {
        flex: 1; background: #f2f2f7; border-radius: 10px; padding: 7px 2px;
        text-align: center; font-size: 0.55rem; color: #111; font-weight: 600;
        overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
    }
    .ios-chip i { display: block; font-size: 0.85rem; color: #25d366; margin-bottom: 2px; }

    /* Tarjetas agrupadas (Medios, Ajustes, opciones de exportación) */
    .ios-sect-title { font-size: 0.62rem; font-weight: 800; color: #8e8e93; padding: 0 14px 4px; text-align: left; }
    .ios-card { background: #f2f2f7; border-radius: 12px; margin: 0 10px; overflow: hidden; }
    .ios-row {
        display: flex; justify-content: space-between; align-items: center; gap: 6px;
        padding: 9px 12px; font-size: 0.72rem; color: #111; text-align: left;
        border-bottom: 1px solid #e4e4ea;
    }
    .ios-row:last-child { border-bottom: none; }
    .ios-row span { color: #8e8e93; font-size: 0.66rem; white-space: nowrap; }

    /* Menú contextual de los tres puntos (aquí vive "Exportar chat") */
    .ios-ctx-menu {
        position: absolute; top: -38px; right: 6px; width: 176px; z-index: 25;
        background: rgba(250,250,250,0.98); border-radius: 14px; overflow: hidden;
        box-shadow: 0 8px 26px rgba(0,0,0,0.25);
        animation: menuPop 0.2s ease-out;
    }
    .ios-ctx-item {
        display: flex; align-items: center; gap: 8px; position: relative;
        padding: 9px 11px; font-size: 0.7rem; color: #111; text-align: left;
        border-bottom: 1px solid #e0e0e5;
    }
    .ios-ctx-item:last-child { border-bottom: none; }
    .ios-ctx-item i { width: 14px; text-align: center; opacity: 0.65; flex-shrink: 0; }

    /* Hoja inferior: elegir medios, y hoja de compartir de iOS */
    .ios-scrim { position: absolute; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.35); z-index: 15; }
    .ios-bottom-sheet {
        position: absolute; left: 0; right: 0; bottom: 0; z-index: 16;
        background: #fff; border-radius: 16px 16px 0 0; padding: 12px 10px 16px;
        animation: slideUpIOS 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    }
    .ios-sheet-head {
        display: flex; justify-content: space-between; align-items: center;
        font-weight: 800; font-size: 0.82rem; color: #111; margin-bottom: 8px;
    }
    .ios-sheet-head i { color: #8e8e93; font-size: 1rem; }
    .ios-sheet-note {
        background: #f2f2f7; border-radius: 10px; padding: 8px;
        font-size: 0.6rem; color: #6d6d72; margin-bottom: 10px;
    }
    .ios-opt {
        display: flex; align-items: center; gap: 9px; position: relative;
        padding: 10px 12px; font-size: 0.74rem; color: #111; text-align: left;
        border-bottom: 1px solid #e4e4ea;
    }
    .ios-opt:last-child { border-bottom: none; }
    .ios-opt i { opacity: 0.6; flex-shrink: 0; }

    /* Opción que hay que pulsar */
    .ios-ctx-item.highlight, .ios-opt.highlight { background: #e7f0ff; font-weight: 700; }

    /* Aviso para conversaciones muy pesadas (quitar los vídeos) */
    .ios-heavy-tip {
        display: flex; gap: 10px; align-items: flex-start; text-align: left;
        max-width: 280px; margin: 14px auto 0;
        background: #fffbf2; border: 1px solid #f0e0bd; border-radius: 10px;
        padding: 10px 12px; color: #856404;
    }

    /* Mini pantalla "Elige los tipos de medios": solo Fotos y Audios encendidos */
    .mini-toggles { margin-top: 8px; background: #fff; border: 1px solid #eee; border-radius: 8px; overflow: hidden; }
    .mini-toggle-row {
        display: flex; justify-content: space-between; align-items: center; gap: 8px;
        padding: 5px 9px; font-size: 0.7rem; color: #111; border-bottom: 1px solid #f0f0f0;
    }
    .mini-toggle-row:last-child { border-bottom: none; }
    .mini-switch { width: 26px; height: 15px; border-radius: 10px; background: #d1d5da; position: relative; flex-shrink: 0; }
    .mini-switch::after {
        content: ""; position: absolute; top: 1.5px; left: 2px; width: 12px; height: 12px;
        border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,0.25);
    }
    .mini-switch.on { background: #34c759; }
    .mini-switch.on::after { left: auto; right: 2px; }

    /* Escenario del tuto: el teléfono centrado y el aviso "chat pesado" A SU LADO (abajo nadie lo ve) */
    .tuto-stage { position: relative; display: inline-block; }
    .ios-heavy-tip.side {
        position: absolute; left: 100%; top: 50%; transform: translateY(-50%);
        margin: 0 0 0 14px; width: 200px;
    }
    @media (max-width: 700px) {
        .ios-heavy-tip.side { position: static; transform: none; margin: 14px auto 0; width: auto; max-width: 280px; }
    }
    .ios-heavy-tip i { color: #ffa117; font-size: 1rem; margin-top: 1px; }
    .ios-heavy-tip strong { display: block; font-size: 0.8rem; margin-bottom: 2px; }
    .ios-heavy-tip p { font-size: 0.75rem; line-height: 1.35; margin: 0; }

    @keyframes slideUpIOS { from { transform: translateY(110%); } to { transform: translateY(0); } }

    /* --- FIN WHATSAPP (compartir a uno mismo): hoja de compartir iOS, selector de contacto, envío --- */
    .ios-share-filehead { padding: 10px 12px 2px; font-size: 0.68rem; color: #8e8e93; font-weight: 700; text-align: left; }
    .ios-share-apps { display: flex; gap: 9px; padding: 12px 10px 10px; }
    .ios-share-app { width: 48px; text-align: center; font-size: 0.53rem; color: #3c3c43; position: relative; }
    .ios-share-app .ic {
        width: 44px; height: 44px; border-radius: 11px; margin: 0 auto 4px;
        display: flex; align-items: center; justify-content: center; font-size: 1.2rem; color: #fff;
    }
    .ios-share-app.hl { font-weight: 800; color: #007aff; }
    .ios-share-app.hl .ic { box-shadow: 0 0 0 3px #007aff; }

    .wa-mock-search { margin: 8px 10px; background: #f2f2f7; border-radius: 9px; padding: 6px 10px; font-size: 0.7rem; color: #8e8e93; text-align: left; }
    .wa-mock-contact { display: flex; align-items: center; gap: 9px; padding: 8px 12px; border-bottom: 1px solid #f0f0f0; position: relative; text-align: left; }
    .wa-mock-contact .av {
        width: 34px; height: 34px; border-radius: 50%; background: #cfd8dc; flex-shrink: 0;
        display: flex; align-items: center; justify-content: center; color: #fff;
    }
    .wa-mock-contact.me { background: #e7f7ed; }
    .wa-mock-contact.me .av { background: linear-gradient(135deg, #25d366, #128c7e); }
    .wa-mock-contact.dim { opacity: 0.4; }
    .wa-mock-contact .tx strong { display: block; font-size: 0.72rem; color: #111; }
    .wa-mock-contact .tx small { font-size: 0.6rem; color: #8e8e93; }

    .wa-mock-doc { background: #dcf8c6; border-radius: 8px; padding: 8px; width: 85%; align-self: flex-end; box-shadow: 0 1px 1px rgba(0,0,0,0.1); text-align: left; }
    .wa-mock-doc .row1 { display: flex; align-items: center; gap: 8px; background: rgba(255,255,255,0.55); border-radius: 6px; padding: 7px; }
    .wa-mock-doc .zipic {
        width: 28px; height: 28px; border-radius: 5px; background: #5f6b7a; color: #fff;
        display: flex; align-items: center; justify-content: center; font-size: 0.55rem; font-weight: 800; flex-shrink: 0;
    }
    .wa-mock-doc strong { display: block; font-size: 0.62rem; color: #111; }
    .wa-mock-doc small { font-size: 0.55rem; color: #667; }
    .wa-mock-doc .bar { height: 3px; background: #b9e3c6; border-radius: 2px; margin-top: 6px; overflow: hidden; }
    .wa-mock-doc .bar > div { height: 100%; background: #25d366; animation: waMockProg 3.5s linear infinite; }
    @keyframes waMockProg { from { width: 8%; } to { width: 92%; } }

    /* Panel final (PC): recuperar el archivo por WhatsApp Web */
    .wa-web-final { display: flex; flex-direction: column; gap: 14px; max-width: 340px; margin: 0 auto; }
    .wa-web-card { background: #fff; border: 1px solid #e3e8ee; border-radius: 14px; padding: 16px; text-align: center; box-shadow: 0 4px 14px rgba(0,0,0,0.05); }
    .wa-web-card p { font-size: 0.82rem; color: #5c6b7a; line-height: 1.5; margin: 0 0 10px; }
    .wa-web-stepnum {
        width: 26px; height: 26px; border-radius: 50%; background: #1a73e8; color: #fff;
        font-weight: 800; font-size: 0.8rem; display: flex; align-items: center; justify-content: center; margin: 0 auto 8px;
    }
    .btn-wa-web {
        display: inline-flex; align-items: center; justify-content: center; gap: 8px;
        background: #25d366; color: #fff !important; text-decoration: none; font-weight: 800; font-size: 0.95rem;
        border-radius: 50px; padding: 12px 24px; box-shadow: 0 4px 14px rgba(37,211,102,0.35); transition: background 0.2s;
    }
    .btn-wa-web:hover { background: #1fb958; }

    /* Aviso neutro, tarjeta uniforme (sin borde de color a la izquierda) */
    .ios-info-tip {
        display: flex; gap: 10px; align-items: flex-start; text-align: left;
        max-width: 280px; margin: 14px auto 0;
        background: #f5f7fa; border: 1px solid #e3e8ee; border-radius: 10px;
        padding: 10px 12px; color: #4a5568;
    }
    .ios-info-tip i { color: #8a95a1; font-size: 1rem; margin-top: 1px; }
    .ios-info-tip p { font-size: 0.75rem; line-height: 1.35; margin: 0; }

    /* ===== Plan B: "WhatsApp no acepta mi archivo" ===== */
    /* Enlace de entrada: gris y discreto, para no distraer al 90% que no tiene el problema. */
    .planb-link {
        display: block; margin: 12px auto 0; border: none; background: none;
        font-size: 0.78rem; color: #7a8794; text-decoration: underline; cursor: pointer;
    }
    .planb-link:hover { color: #007aff; }

    .planb-panel { max-width: 640px; margin: 0 auto; text-align: left; }
    .planb-title { font-weight: 800; color: #b06800; font-size: 1rem; margin-bottom: 4px; }
    .planb-lead { font-size: 0.82rem; line-height: 1.5; color: #4a5568; margin-bottom: 14px; }

    .planb-route { display: flex; gap: 10px; align-items: flex-start; border: 1px solid #e3e8ee; border-radius: 12px; padding: 10px 12px; margin-bottom: 10px; }
    .planb-route-head { margin-bottom: 4px; }
    .planb-route-ic {
        width: 34px; height: 34px; border-radius: 9px; flex-shrink: 0; color: #fff;
        display: flex; align-items: center; justify-content: center; font-size: 1.05rem;
    }
    .planb-route-tx strong { display: block; font-size: 0.82rem; color: #2c3e50; }
    .planb-route-tx p { font-size: 0.74rem; line-height: 1.4; color: #6b7684; margin: 2px 0 0; }

    /* Las 4 pantallitas de la ruta en línea (Mail Drop en iPhone, Drive en Android) */
    .planb-steps { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; margin: 10px 0 14px; }
    .planb-step { width: 132px; }
    .planb-cap { font-size: 0.66rem; line-height: 1.3; color: #4a5568; margin: 6px 0 0; text-align: center; }
    .planb-cap span {
        display: inline-flex; align-items: center; justify-content: center; width: 15px; height: 15px;
        border-radius: 50%; background: #007aff; color: #fff; font-size: 0.55rem; font-weight: 800; margin-right: 4px;
    }
    .planb-mini {
        width: 132px; height: 196px; background: #f2f2f7; border: 5px solid #2d2d2d; border-radius: 16px;
        position: relative; overflow: hidden; display: flex; flex-direction: column; box-shadow: 0 5px 14px rgba(0,0,0,0.12);
    }
    .pm-filehead { font-size: 0.55rem; font-weight: 700; padding: 7px 7px 5px; color: #111; background: #fff; }
    .pm-filehead small { display: block; font-weight: 500; color: #8e8e93; font-size: 0.5rem; }
    .pm-head { font-size: 0.58rem; font-weight: 700; padding: 7px; text-align: center; border-bottom: 1px solid #e4e4ea; }
    .pm-apps { display: flex; gap: 4px; padding: 7px 5px; background: #fff; }
    .pm-app { width: 38px; text-align: center; font-size: 0.42rem; color: #3c3c43; position: relative; }
    .pm-app .ic { width: 30px; height: 30px; border-radius: 8px; margin: 0 auto 2px; display: flex; align-items: center; justify-content: center; font-size: 0.85rem; color: #fff; }
    .pm-app.dim { opacity: 0.35; }
    .pm-list { background: #fff; flex: 1; }
    .pm-row { font-size: 0.55rem; padding: 6px 8px; border-top: 1px solid #ededf2; }
    .pm-row.dim { color: #b0b6bf; }
    .pm-field { display: flex; align-items: center; gap: 4px; font-size: 0.55rem; padding: 6px 8px; background: #fff; border-bottom: 1px solid #ededf2; position: relative; }
    .pm-field i { color: #8e8e93; font-style: normal; }
    .pm-attach { display: flex; gap: 5px; align-items: center; padding: 7px 8px; background: #fff; }
    .pm-attach.dim { opacity: 0.45; }
    .pm-attach .zipic { width: 22px; height: 26px; border-radius: 4px; background: #c4302b; color: #fff; font-size: 0.4rem; font-weight: 800; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
    .pm-attach b { font-size: 0.5rem; display: block; line-height: 1.2; }
    .pm-attach small { font-size: 0.45rem; color: #8e8e93; }
    .pm-bar { height: 4px; background: #e8ebef; margin: 0 8px; border-radius: 2px; overflow: hidden; }
    .pm-bar > div { height: 100%; width: 62%; background: #4285f4; }
    .pm-waitnote { font-size: 0.48rem; color: #8e8e93; padding: 6px 8px; }
    .pm-savebtn { position: relative; margin: auto 8px 8px; background: #1a73e8; color: #fff; font-size: 0.55rem; font-weight: 700; text-align: center; padding: 6px; border-radius: 16px; }
    .pm-scrim { position: absolute; inset: 0; background: rgba(0,0,0,0.25); z-index: 5; }
    .pm-alert {
        position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); width: 104px; z-index: 6;
        background: rgba(250,250,250,0.98); border-radius: 10px; box-shadow: 0 8px 22px rgba(0,0,0,0.3); text-align: center; overflow: hidden;
    }
    .pm-alert .t { font-size: 0.52rem; font-weight: 800; padding: 8px 6px 2px; }
    .pm-alert .d { font-size: 0.44rem; color: #3c3c43; line-height: 1.3; padding: 0 6px 7px; }
    .pm-alert .btns { display: flex; border-top: 1px solid #d5d5da; }
    .pm-alert .btns span { flex: 1; padding: 5px 2px; font-size: 0.48rem; color: #007aff; }
    .pm-alert .btns span.hl { border-left: 1px solid #d5d5da; font-weight: 800; }

    /* La 4ª pantalla ya no es el móvil: es este ordenador. */
    .planb-mini.desk { background: #fff; border-radius: 8px; border-width: 4px; height: 160px; align-self: center; margin-top: 18px; }
    .pm-deskbar { display: flex; gap: 3px; padding: 5px 6px; background: #edf0f4; }
    .pm-deskbar span { width: 5px; height: 5px; border-radius: 50%; background: #c8cfd8; }
    .pm-deskbody { padding: 7px; flex: 1; }
    .pm-mailrow { font-size: 0.5rem; color: #6b7684; margin-bottom: 6px; }
    .pm-icloud { display: flex; gap: 5px; align-items: center; border: 1px solid #e3e8ee; border-radius: 6px; padding: 5px; }
    .pm-icloud > i { font-size: 0.9rem; color: #34aadc; }
    .pm-icloud b { font-size: 0.48rem; display: block; line-height: 1.2; }
    .pm-icloud small { font-size: 0.42rem; color: #8e8e93; }
    .pm-dlbtn { margin-top: 7px; background: #25d366; color: #fff; font-size: 0.52rem; font-weight: 700; text-align: center; padding: 5px; border-radius: 14px; }
    .pm-desklabel { font-size: 0.45rem; font-weight: 800; letter-spacing: 0.4px; text-transform: uppercase; color: #8e8e93; text-align: center; padding: 3px 0 5px; }

    .planb-contact {
        display: block; width: 100%; margin-top: 10px; border: none; background: #25d366; color: #fff;
        font-size: 0.8rem; font-weight: 700; padding: 9px; border-radius: 22px; cursor: pointer;
    }

    /* Variante D: el mismo Plan B, colgado de la pantalla final del PC. */
    .planb-final { border: 1px dashed #ffd28a; background: #fffaf0; border-radius: 12px; padding: 11px 13px; margin-top: 14px; text-align: left; }
    .planb-final-title { font-size: 0.82rem; font-weight: 800; color: #7a5200; margin-bottom: 3px; }
    .planb-final p { font-size: 0.74rem; line-height: 1.4; color: #7a5200; margin: 0; }
    .planb-final-btn { border: none; background: none; padding: 0; margin-top: 6px; font-size: 0.76rem; font-weight: 700; color: #007aff; text-decoration: underline; cursor: pointer; }

    @media (max-width: 575px) {
        .planb-steps { gap: 10px; }
        .planb-step, .planb-mini { width: 120px; }
    }

    /* Píldora Conversación/Grupo del tuto iPhone */
    .chat-type-pill { display: inline-flex; background: #eef1f4; border-radius: 50px; padding: 3px; margin-bottom: 10px; }
    .chat-type-pill button {
        border: none; background: transparent; border-radius: 50px; padding: 5px 16px;
        font-size: 0.78rem; font-weight: 700; color: #5c6b7a; cursor: pointer; transition: all 0.15s;
    }
    .chat-type-pill button.active { background: #fff; color: #007aff; box-shadow: 0 2px 6px rgba(0,0,0,0.12); }

    /* Pista de "baja en la ficha" (chat de dos) */
    .scroll-hint { animation: scrollHint 1.2s infinite; }
    @keyframes scrollHint { 0%, 100% { transform: translateY(0); opacity: 0.5; } 50% { transform: translateY(5px); opacity: 1; } }

    /* Barra de progreso del "modo vídeo" */
    .tuto-progressbar { height: 4px; background: #e8ebef; border-radius: 2px; margin: 10px auto 0; max-width: 280px; overflow: hidden; }
    .tuto-progressbar > div { height: 100%; background: #25d366; width: 0; animation: tutoFill linear forwards; }
    @keyframes tutoFill { from { width: 0; } to { width: 100%; } }
    .btn-tuto-play { min-width: 44px; }



    .install-title {
        font-size: 1.1rem;
        font-weight: 800;
        color: #2c3e50;
        margin-bottom: 5px;
    }

    .install-subtitle {
        font-size: 0.9rem;
        color: #7f8c8d;
        margin-bottom: 20px;
    }

    .qr-frame-modern {
        padding: 12px;
        background: white;
        border-radius: 16px;
        border: 1px solid #eaeaea;
        box-shadow: 0 4px 15px rgba(0,0,0,0.05);
        margin-bottom: 20px;
    }
    .qr-frame-modern img {
        display: block;
        width: 140px;
        height: 140px;
    }

    /* --- BOTONES REDONDOS (PILL SHAPE) --- */
    .btn-pill {
        border-radius: 50px !important;
        padding: 10px 25px;
        font-weight: 600;
        letter-spacing: 0.5px;
        transition: all 0.3s ease;
        display: inline-flex;
        align-items: center;
        gap: 8px;
    }

    .btn-pill-primary {
        background: #1a73e8;
        color: white;
        border: none;
        box-shadow: 0 4px 12px rgba(26, 115, 232, 0.3);
    }
    .btn-pill-primary:hover {
        background: #1557b0;
        transform: translateY(-2px);
        box-shadow: 0 6px 15px rgba(26, 115, 232, 0.4);
    }

    .btn-pill-outline {
        background: transparent;
        border: 2px solid #e0e0e0;
        color: #555;
    }
    .btn-pill-outline:hover {
        border-color: #bbb;
        background: #f9f9f9;
        color: #333;
    }

    /* Ajuste para el botón pequeño de "cambiar dispositivo" */
    .btn-link-custom {
        text-decoration: none;
        color: #999;
        font-size: 0.85rem;
        font-weight: 500;
        padding: 5px 10px;
        border-radius: 20px;
        transition: background 0.2s;
    }
    .btn-link-custom:hover {
        background: #f5f5f5;
        color: #333;
    }

    /* --- ANIMACIÓN SWIPE (REVELAR ESCONDIDO) --- */
    .share-mask-container {
        width: 240px; /* Ancho justo para ver 3 iconos y medio */
        overflow: hidden;
        margin: 0 auto;
        position: relative;
        border: 1px solid #eee;
        border-radius: 12px;
        background: #fff;
    }

    .share-track-animated {
        display: flex;
        gap: 15px;
        padding: 15px 10px;
        /* La lista es más ancha que el contenedor */
        width: 320px;
        animation: slideReveal 4s infinite ease-in-out;
    }

    .hand-guide {
        position: absolute;
        bottom: 10px;
        right: 20px;
        font-size: 2.5rem;
        color: rgba(0,0,0,0.6);
        z-index: 50;
        pointer-events: none;
        animation: handDragReveal 4s infinite ease-in-out;
    }

    /* Mueve la lista para enseñar lo escondido */
    @keyframes slideReveal {
        0%, 20% { transform: translateX(0); } /* Quieto: Se ven 3 apps */
        40%, 80% { transform: translateX(-80px); } /* Deslizado: Se ven los 3 puntos */
        100% { transform: translateX(0); }
    }

    /* La mano arrastra y luego pulsa */
    @keyframes handDragReveal {
        0%, 10% { opacity: 0; transform: translateX(30px); }
        15% { opacity: 1; transform: translateX(30px); } /* Aparece mano */
        40% { opacity: 1; transform: translateX(-40px); } /* Arrastra */
        50% { transform: translateX(-40px) scale(0.9); color: #1a73e8; } /* Pulsa (Tap) */
        60% { transform: translateX(-40px) scale(1); color: rgba(0,0,0,0.6); }
        80% { opacity: 0; transform: translateX(-40px); }
        100% { opacity: 0; }
    }

    /* Estilo limpio para el paso de instalación (sin card) */
    .install-clean-wrapper {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 15px;
        padding: 10px;
    }
    .install-qr-clean {
        border: 4px solid #3ddc84; /* Borde verde Android */
        border-radius: 16px;
        padding: 5px;
        background: white;
    }
    /* --- SEPARADOR Y SUBIDA PC --- */
    .divider-with-text {
        display: flex;
        align-items: center;
        text-align: center;
        color: #9aa0a6;
        font-size: 0.85rem;
        margin: 30px 0 20px 0;
    }
    .divider-with-text::before, .divider-with-text::after {
        content: '';
        flex: 1;
        border-bottom: 1px solid #e0e0e0;
    }
    .divider-with-text::before { margin-right: 15px; }
    .divider-with-text::after { margin-left: 15px; }

    .btn-pc-upload-wide {
        display: block;
        width: 100%;
        max-width: 350px;
        margin: 0 auto;
        padding: 15px;
        background: #f8f9fa;
        border: 2px dashed #cbd5e1; /* Borde discontinuo para indicar "archivo" */
        border-radius: 12px;
        color: #475569;
        font-weight: 600;
        cursor: pointer;
        transition: all 0.2s ease;
        text-align: center;
    }

    .btn-pc-upload-wide:hover {
        border-color: #1a73e8;
        background: #e8f0fe;
        color: #1a73e8;
        transform: translateY(-2px);
    }
    /* --- SIMULADOR DE ESCRITORIO (PC/MAC) --- */
    .desktop-mockup {
        width: 100%;
        max-width: 420px;
        height: 320px;
        background: #fff;
        border: 1px solid #ccc;
        border-radius: 8px;
        position: relative;
        overflow: hidden;
        margin: 0 auto;
        box-shadow: 0 10px 30px rgba(0,0,0,0.15);
        display: flex;
        flex-direction: column;
        font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
        pointer-events: none;
        user-select: none;
    }

    /* Barra de título de ventana */
    .window-header {
        background: #e3e3e3;
        height: 30px;
        display: flex;
        align-items: center;
        padding: 0 10px;
        border-bottom: 1px solid #dcdcdc;
    }
    .window-controls { display: flex; gap: 6px; }
    .win-dot { width: 10px; height: 10px; border-radius: 50%; background: #ccc; }
    .win-dot.red { background: #ff5f57; }
    .win-dot.yellow { background: #ffbd2e; }
    .win-dot.green { background: #28c940; }
    .window-title { flex: 1; text-align: center; font-size: 0.8rem; color: #666; }

    /* Cuerpo Telegram */
    .tg-layout { display: flex; height: 100%; }
    .tg-sidebar { width: 80px; background: #2d3848; border-right: 1px solid #ddd; }
    .tg-main { flex: 1; background: #96b6c5; position: relative; display: flex; flex-direction: column; }

    /* Cabecera Chat Telegram */
    .tg-header-bar {
        height: 40px; background: white; display: flex; align-items: center;
        justify-content: space-between; padding: 0 15px;
    }

    /* Modal de Configuración de Exportación */
    .tg-export-modal {
        position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
        width: 280px; background: white; border-radius: 10px;
        box-shadow: 0 5px 25px rgba(0,0,0,0.3);
        padding: 15px; font-size: 0.85rem; z-index: 20;
    }
    .tg-setting-row { display: flex; justify-content: space-between; margin-bottom: 8px; align-items: center; }
    .tg-checkbox { width: 14px; height: 14px; border: 1px solid #ccc; border-radius: 3px; display: flex; align-items: center; justify-content: center; }
    .tg-checkbox.checked { background: #40a7e3; border-color: #40a7e3; color: white; }
    .tg-slider-track { height: 4px; background: #eee; width: 100%; border-radius: 2px; margin: 5px 0; position: relative; }
    .tg-slider-fill { height: 100%; background: #40a7e3; width: 50%; }
    .tg-btn-export { background: white; color: #40a7e3; font-weight: bold; text-align: right; margin-top: 10px; cursor: pointer; }

    /* Menú Contextual (Click Derecho) */
    .context-menu {
        position: absolute; top: 40px; left: 60px;
        background: white; border: 1px solid #ccc;
        box-shadow: 2px 2px 10px rgba(0,0,0,0.1);
        width: 160px; z-index: 30;
        padding: 5px 0;
    }
    .ctx-item { padding: 5px 15px; font-size: 0.85rem; color: #333; }
    .ctx-item:hover { background: #e8f0fe; }
    .ctx-divider { height: 1px; background: #eee; margin: 4px 0; }

    /* Simulador de Archivos (Paso final) */
    .file-explorer-layout { background: white; width: 100%; height: 100%; padding: 20px; }
    .file-icon { color: #f8d775; font-size: 3rem; text-shadow: 0 2px 5px rgba(0,0,0,0.1); }
    .file-label { font-size: 0.8rem; margin-top: 5px; color: #333; }

    /* Contenedor */
    /* Libro pagado en la landing (25-nov-2026): aviso bajo los logos, caja del código bajo el tutorial y selector de páginas */
    .libro-pagado-banda { display: flex; gap: 12px; align-items: center; text-align: left; max-width: 480px; margin: 22px auto 0;
                          background: linear-gradient(135deg, #007AFF, #3C9BFF); color: #fff; border-radius: 16px; padding: 12px 16px; }
    .libro-pagado-banda .lp-ico { font-size: 1.6rem; line-height: 1; }
    .libro-pagado-banda b { display: block; font-size: 1rem; }
    .libro-pagado-banda small { opacity: .92; font-size: .82rem; }
    .lp-caja { margin: 14px auto 6px; max-width: 520px; border: 2px solid #CFE3FF; background: #F5F9FF; border-radius: 14px; padding: 12px 14px; text-align: left; }
    .lp-caja b { display: block; font-size: .95rem; }
    .lp-caja small { display: block; color: #6C6C70; font-size: .82rem; margin-bottom: 8px; }
    .lp-fila { display: flex; gap: 8px; }
    .lp-input { flex: 1; min-width: 0; border: 2px solid #E5E5EA; border-radius: 10px; padding: 8px 10px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; }
    .lp-input:focus { outline: 0; border-color: #007AFF; }
    .lp-boton { background: #007AFF; color: #fff; border: 0; border-radius: 10px; padding: 8px 16px; font-weight: 700; }
    .lp-boton:disabled { opacity: .6; }
    .lp-error { margin-top: 8px; color: #D92D20; font-size: .85rem; font-weight: 600; }
    .lp-valido { margin-top: 8px; background: #E8F7EE; color: #157A40; border-radius: 10px; padding: 8px 12px; font-size: .85rem; font-weight: 600; }
    .small-price-text.lp-incluido { color: #157A40; }
    .small-price-text.lp-extra { color: #B4540A; }
    .lp-leyenda { font-size: .72rem; color: #157A40; font-weight: 600; margin-top: 4px; }
    .lp-leyenda.lp-extra { color: #B4540A; }

    .clean-widget {
        padding: 12px 0;
        border-top: 1px solid #f0f0f0;
        border-bottom: 1px solid #f0f0f0;
    }

    /* Etiquetas (Labels) */
    .widget-label {
        font-size: 0.7rem;
        text-transform: uppercase;
        color: #888;
        font-weight: 700;
        letter-spacing: 0.5px;
    }

    /* --- 1. CAJITA DEL INPUT (Siempre visible y ajustada) --- */
    .small-input-box {
        font-size: 1rem;       /* Tamaño mucho más pequeño */
        font-weight: 600;
        color: #212529;

        width: 55px;           /* Ancho ajustado a 3 dígitos (aprox) */
        text-align: center;    /* Número centrado en su cajita */

        background-color: #fff;
        border: 1px solid #ced4da; /* Borde SIEMPRE visible (gris suave) */
        border-radius: 4px;    /* Bordes ligeramente redondeados */

        padding: 4px 0;        /* Padding vertical ligero */
        outline: none;
        transition: all 0.2s;
        -moz-appearance: textfield;
    }

    /* Estado Focus (Al escribir) */
    .small-input-box:focus {
        border-color: #0d6efd;
        box-shadow: 0 0 0 2px rgba(13, 110, 253, 0.1);
    }

    /* Quitar flechas del input number */
    .small-input-box::-webkit-outer-spin-button,
    .small-input-box::-webkit-inner-spin-button {
        -webkit-appearance: none;
        margin: 0;
    }

    /* --- 2. PRECIO (Igual tamaño que el input) --- */
    .small-price-text {
        font-size: 1rem;       /* Mismo tamaño que el input */
        font-weight: 700;      /* Negrita */
        color: #0d6efd;        /* Azul corporativo */
        text-align: right;
    }

    /* --- SLIDER --- */
    .slider-container {
        margin-top: 8px; /* Un poco de aire respecto a los números */
    }

    .clean-range {
        width: 100%;
        height: 4px;
        background: #e9ecef;
        border-radius: 2px;
        -webkit-appearance: none;
        outline: none;
        cursor: pointer;
        display: block;
    }

    .clean-range::-webkit-slider-thumb {
        -webkit-appearance: none;
        height: 14px; /* Un poco más pequeño también */
        width: 14px;
        border-radius: 50%;
        background: #212529;
        border: 2px solid #fff;
        box-shadow: 0 1px 2px rgba(0,0,0,0.2);
        margin-top: -5px;
        transition: transform 0.1s;
    }

    .clean-range::-webkit-slider-thumb:hover {
        transform: scale(1.2);
    }

    .x-small { font-size: 0.75rem; }

        .mobile-settings-toggle {
            display: none;
        }

       @media (max-width: 768px) {
        /* --- 1. LAYOUT GENERAL --- */
        .app-layout {
            flex-direction: column;
            padding: 0 !important;
            background: #f0f2f5;
            height: 100vh;
            overflow: hidden;
            position: relative;
        }

        .col-md-9.p-4 {
            padding: 0 !important;
            width: 100% !important;
            height: 100%;
            margin-bottom: 80px; /* Espacio para la barra inferior */
        }

        /* El tope de la foto lo pone la calibración de la hoja (190 px de la hoja lógica), no el ancho de
           la pantalla: así nunca ocupa más de lo que el paginador le reserva y no se puede cortar aunque
           la hoja tenga ahora alto fijo. */
        .message-image {
            max-width: 190px !important;
            max-height: 190px !important;
        }

        /* --- 2. SIDEBAR COMO MENÚ DE PANTALLA COMPLETA --- */
        .mobile-settings-toggle {
            position: fixed;
            top: 15px;
            right: 15px;
            z-index: 1100;
            background: white;
            border: 1px solid #ddd;
            border-radius: 20px;
            padding: 8px 15px;
            font-weight: 600;
            box-shadow: 0 4px 10px rgba(0,0,0,0.1);
            color: #333;
            display: block !important;
        }

        .customization-sidebar {
            position: fixed !important;
            top: 0;
            left: 0;
            width: 100% !important;
            height: 100% !important;
            max-width: none !important;
            max-height: none !important;
            background: white;
            z-index: 1099; /* Debajo del botón toggle */
            padding: 60px 20px 20px 20px; /* Padding top para no tapar el botón cerrar */
            overflow-y: auto;
            transform: translateY(100%); /* Oculto por defecto (abajo) */
            transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
            display: flex !important; /* Forzamos display flex */
            border-radius: 0 !important;
        }

        .customization-sidebar.mobile-open {
            transform: translateY(0); /* Mostrar */
        }

        /* --- 3. BARRA DE NAVEGACIÓN FLOTANTE (Compacta) --- */
        .navigation-buttons {
            position: fixed !important;
            bottom: 20px;
            left: 50%;
            transform: translateX(-50%);
            width: 95%;
            background: none !important;
            max-width: 400px;
            backdrop-filter: blur(10px);
            padding: 10px 15px !important;
            border-radius: 50px;
            box-shadow: 0 5px 20px rgba(0,0,0,0.15);
            display: flex;
            justify-content: space-between;
            align-items: center;
            z-index: 1000;
            border: 1px solid rgba(0,0,0,0.05);
            gap: 8px;
        }

        /* Estilo de los botones de la barra inferior */
        .navigation-buttons button {
            padding: 0 !important;
            width: 45px !important;
            height: 45px !important;
            border-radius: 50% !important;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 0 !important; /* Ocultar texto */
            box-shadow: none !important;
        }

        /* Iconos para los botones (usando Pseudo-elementos si no tienen iconos dentro) */
        /* Anterior */
        .navigation-buttons button:nth-child(1)::before {
            content: "\F12F"; /* Icono flecha izq bootstrap */
            font-family: "bootstrap-icons";
            font-size: 20px;
            color: inherit;
        }
        /* Guardar */
        .navigation-buttons button:nth-child(2) {
            background-color: #28a745 !important;
            border-color: #28a745 !important;
            color: white !important;
        }

        
        /* Pedir (Order) */
        .navigation-buttons button:nth-child(4) {
            background-color: #1a73e8 !important;
            border-color: #1a73e8 !important;
            color: white !important;
            width: auto !important; /* El botón de pedir un poco más ancho */
            padding: 0 15px !important;
            border-radius: 20px !important;
            font-size: 14px !important; /* Mostrar texto en este */
        }
        /* Siguiente */
        .navigation-buttons button:nth-child(5)::before {
            content: "\F138"; /* Icono flecha der bootstrap */
            font-family: "bootstrap-icons";
            font-size: 20px;
            color: inherit;
        }

        /* Ocultar el selector de páginas que ocupa mucho sitio */
        .page-selector { display: none !important; }


        /* --- 4. ARREGLO DE LA PORTADA (COVER PREVIEW) --- */
            /* --- 4. ARREGLO DE LA PORTADA (Opción Sticky Top) --- */
            /* El modal ocupa toda la pantalla */
            .cover-modal {
                width: 100% !important;
                height: 100% !important;
                max-width: 100% !important;
                max-height: 100% !important;
                border-radius: 0 !important;
                display: flex;
                flex-direction: column;
            }
                /* Cabecera fija y compacta */
                .cover-modal .modal-header {
                    flex-shrink: 0;
                    padding: 10px 15px !important;
                    background: #fff;
                    z-index: 1050;
                    border-bottom: 1px solid #ddd;
                }
                /* El cuerpo permite el scroll, pero tiene trucos para el sticky */
                .cover-modal .modal-body {
                    flex: 1;
                    overflow-y: auto !important; /* Scroll vertical */
                    padding: 0 !important;
                    position: relative; /* Necesario para que sticky funcione dentro */
                    display: block !important; /* Importante para el flujo vertical */
                }

                .cover-modal .modal-footer {
                    display: flex !important;
                    flex-direction: row !important; /* Obligar fila */
                    flex-wrap: nowrap !important; /* Prohibir bajar de línea */
                    justify-content: space-between !important;
                    gap: 5px !important; /* Menos espacio entre botones */
                    padding: 10px 5px !important; /* Menos margen a los lados */
                }

                    .cover-modal .modal-footer .btn {
                        flex: 1 !important; /* Que los 3 botones se repartan el espacio igual */
                        padding: 8px 4px !important; /* Relleno lateral mínimo */
                        font-size: 11px !important; /* Letra un pelín más pequeña para que quepa "Volver atrás" */
                        white-space: nowrap !important; /* Que el texto no se parta */
                        min-width: 0 !important; /* Permite que el botón se encoja si hace falta */
                        border-radius: 15px !important; /* Más redondeados para ahorrar espacio visual */
                    }

            .cover-layout {
                display: flex;
                flex-direction: column;
                height: auto !important;
            }
            /* --- 4. ARREGLO DE LA PORTADA (Corrección del Container) --- */
            /* 1. La columna gris externa (El marco fijo) */
            .preview-column {
                order: 1;
                position: sticky !important;
                top: 0;
                z-index: 1040;
                /* Altura fija estricta: 230px es suficiente para ver el libro */
                height: 230px !important;
                min-height: 0 !important;
                width: 100% !important;
                background: #e9ecef;
                padding: 0 !important; /* IMPORTANTE: Sin padding */

                overflow: hidden !important; /* Cortar todo lo que sobre */
                border-bottom: 1px solid #ccc;
            }
            /* --- 4. ARREGLO DE LA PORTADA (Método de Redimensionado Físico) --- */
            /* 1. EL MARCO GRIS FIJO (Sticky) */
            .preview-column {
                order: 1;
                position: sticky !important;
                top: 0;
                z-index: 1040;
                /* Le damos altura fija suficiente para el libro + un poquito de margen */
                height: 230px !important;
                min-height: 0 !important;
                width: 100% !important;
                background: #e9ecef;
                padding: 10px 0 !important;
                border-bottom: 1px solid #ccc;
                display: flex;
                align-items: center;
                justify-content: center;
                overflow: hidden !important;
            }
            /* 2. ELIMINAR EL CONTENEDOR INTERMEDIO (El culpable del espacio blanco) */
            .preview-container {
                width: auto !important;
                height: auto !important;
                padding: 0 !important;
                margin: 0 !important;
                background: transparent !important; /* Fuera fondo blanco */
                box-shadow: none !important; /* Fuera sombras del contenedor */
                display: flex !important;
                align-items: center;
                justify-content: center;
            }
            /* 3. EL LIBRO EN SÍ (El wrapper) */
            .cover-preview {
                transform: none !important; /* QUITAMOS EL SCALE */
                margin: 0 !important;
                padding: 0 !important;
                box-shadow: 0 5px 15px rgba(0,0,0,0.2) !important; /* Sombra al libro directamente */
            }
            /* 4. LAS TAPAS Y EL LOMO (LA CLAVE: Forzar altura pequeña real) */
            .cover-front, .cover-back, .cover-spine {
                /* En escritorio es 55vh, en móvil lo forzamos a 180px fijos */
                height: 180px !important;
                min-height: 0 !important;
                max-height: none !important;
                width: auto !important; /* El ancho se ajustará por el aspect-ratio */
                padding: 5px !important; /* Reducir padding interno */
            }
            /* 5. AJUSTAR TEXTOS PARA EL TAMAÑO PEQUEÑO */
            /* Como el libro es más pequeño, forzamos textos pequeños para que no se salgan */
            .cover-text p, .spine-text p, .message-bubble.top-bubble p {
                font-size: 8px !important;
                line-height: 1.1 !important;
            }

            .cover-front .cover-text h2 {
                font-size: 12px !important;
                margin-bottom: 2px !important;
            }
            /* 6. Mover el botón de "Márgenes" fuera del medio */
            .preview-container .d-flex.justify-content-between {
                position: absolute;
                top: 5px;
                right: 10px;
                width: auto !important;
                z-index: 1050;
            }
            /* Ocultar título "Vista Previa" */
            .preview-title {
                display: none !important;
            }
            /* ZONA DE CONTROLES (Scrollable) */
            .controls-column {
                order: 2; /* Va segundo visualmente */
                width: 100% !important;
                max-width: 100% !important;
                height: auto !important;
                background: #fff;
                padding: 20px 20px 100px 20px !important; /* Padding abajo extra para no chocar con el footer */
                border: none !important;
            }
            /* Ajuste de las pestañas (Frontal, Lomo, Trasera) */
            .cover-tabs {
                position: sticky;
                top: 0; /* Se pegan justo debajo de la vista previa si haces mucho scroll */
                background: white;
                z-index: 1030;
                padding: 10px 0;
                margin-bottom: 15px;
            }

                .cover-tabs button {
                    font-size: 13px !important;
                    padding: 8px 5px !important;
                }
            /* Botones de Estilo (Burbuja vs Completa) - Ahora se verán bien */
            .toggle-buttons {
                flex-direction: row !important; /* Asegurar que estén en línea */
            }

            .toggle-btn {
                font-size: 12px !important;
                padding: 10px 5px !important;
            }
            /* Pie de página fijo */
            .cover-modal .modal-footer {
                flex-shrink: 0;
                padding: 10px 15px !important;
                background: #fff;
                border-top: 1px solid #ddd;
                z-index: 1050;
            }

            .safety-toggle-wrapper {
                background: rgba(255, 255, 255, 0.4) !important; /* Semitransparente */
                backdrop-filter: blur(2px); /* Un pequeño desenfoque elegante */
                border: none !important;
                box-shadow: none !important;
            }
            /* Hacemos el texto un poco más oscuro para que se lea sobre cualquier fondo */
            .toggle-label {
                color: #333 !important;
                font-weight: 700 !important;
                text-shadow: 0 1px 2px rgba(255,255,255,0.8);
            }

        /* --- 5. AJUSTES VISUALES DEL LIBRO (FEED) --- */
        .book-container {
                /*  height: calc(100vh - 100px) !important; */
            overflow-y: auto !important;
            box-shadow: none !important;
            padding-bottom: 100px !important;
            /* El libro empieza por debajo de la franja superior: así la primera página no queda
               escondida detrás de ella y se puede seguir desplazando todo con normalidad. */
            padding-top: var(--mob-edge-top, 78px) !important;
        }

        /* --- DIVISIÓN SUPERIOR / INFERIOR DEL EDITOR (solo móvil) ---
           Franjas opacas del MISMO color que el fondo de .app-layout (#f0f2f5) que ocultan el libro
           justo donde flotan los botones (menú, deshacer/rehacer y Personalizar arriba; guardar y
           "Order Book" abajo), para que el contenido no se vea por detrás de ellos.

           Detalles pensados para que funcione igual en cualquier móvil/navegador:
           - Altura en px, igual que el posicionado de los propios botones, así la franja siempre los
             cubre exactamente (arriba: 15px de margen + 50px de botón; abajo: 20px + 50px).
           - env(safe-area-inset-*) suma el recorte de pantallas con notch/barra gestual. Hoy vale 0
             porque el viewport no usa viewport-fit=cover, pero deja el diseño preparado sin cambiar nada.
           - z-index 900: por encima del libro, pero por debajo de los botones (1000/1100/5000) y del
             panel de personalización (1099), así nunca tapa nada con lo que se pueda interactuar.
           - pointer-events:none: son solo visuales, de modo que deslizar el dedo por el borde
             superior o inferior sigue desplazando el libro con normalidad. */
        .app-layout {
            --mob-edge-top: calc(78px + env(safe-area-inset-top, 0px));
            --mob-edge-bottom: calc(88px + env(safe-area-inset-bottom, 0px));
        }

        .mobile-edge-bar {
            position: fixed;
            left: 0;
            right: 0;
            /* Blancas y con un filete, no del color del fondo con sombra: así se leen como barras hechas
               a propósito. Antes eran del mismo tono que el fondo y con sombra, que es lo que hacía que
               pareciesen "algo que tapa" con botones flotando encima. */
            background: #fff;
            z-index: 900;
            pointer-events: none;
        }

        .mobile-edge-top {
            top: 0;
            height: var(--mob-edge-top, 78px);
            border-bottom: 1px solid #e4e6eb;
        }

        .mobile-edge-bottom {
            bottom: 0;
            height: var(--mob-edge-bottom, 88px);
            border-top: 1px solid #e4e6eb;
        }

        /* Acciones que viven DENTRO de las barras. Van fijas igual que ellas y se centran en su alto,
           descontando la zona segura del móvil (la muesca arriba, la barra de gestos abajo) para no
           quedar pegadas al borde de la pantalla. Sin fondo ni sombra propios: la barra ya es la
           superficie, y apilar cajas con sombra encima de otra superficie es lo que se veía sucio. */
        .mobile-bar-actions {
            position: fixed;
            top: env(safe-area-inset-top, 0px);
            right: 12px;
            height: 78px;
            z-index: 1100;
            display: flex;
            align-items: center;
            gap: 6px;
        }

        .mobile-actions-float {
            position: fixed;
            bottom: env(safe-area-inset-bottom, 0px);
            right: 16px;
            height: 88px;
            z-index: 1000;
            display: flex;
            align-items: center;
            gap: 10px;
        }

        /* "Personalizar": dentro de una barra blanca, un botón blanco con borde gris no se distingue.
           Se queda plano, con un fondo azul suave, que es la acción principal de la barra. */
        .mobile-settings-toggle.mobile-bar-chip {
            position: static !important;
            margin: 0;
            background: #eaf1fd;
            border: none;
            box-shadow: none;
            color: #1a73e8;
            padding: 8px 14px;
        }

        /* El aviso de "clica para añadir el capítulo" se coloca por DEBAJO de la franja superior, para no
           taparse con el botón de menú ni con el de Personalizar, que viven ahí arriba. */
        .chapter-placement-hint {
            top: calc(var(--mob-edge-top, 78px) + 8px);
            font-size: .82rem;
            padding: 8px 12px;
            gap: 6px
        }

        /* Pantallas muy bajas (móvil en horizontal): franjas más estrechas para no comerse el libro. */
        @media (max-height: 520px) {
            .app-layout {
                --mob-edge-top: calc(62px + env(safe-area-inset-top, 0px));
                --mob-edge-bottom: calc(70px + env(safe-area-inset-bottom, 0px));
            }
        }

        .book-open {
            flex-direction: column !important;
            gap: 15px;
            height: auto !important;
        }

        /* La hoja NO se ajusta al contenido: tiene el tamaño real del libro, igual que en escritorio.
           Su ancho y su alto salen de la hoja lógica (411x555) por la escala --pgscale, así que aquí
           solo queda centrarla. Si sobra sitio abajo se queda en blanco, que es como es un libro. */
        .book-page {
            margin: 0 auto !important;
            box-shadow: 0 1px 2px rgba(0,0,0,0.1) !important;
        }

        .book-page.blank-right { display: none !important; }
            /* 1. POSICIONAR EL BOTÓN (TOGGLE) */
            .preview-container .d-flex.justify-content-between {
                position: absolute;
                top: 0px !important; /* Pegado al techo de la zona gris */
                right: 0px !important; /* Pegado a la derecha */
                width: auto !important;
                z-index: 1050;
                padding: 10px !important; /* Un poco de margen interno para el dedo */
            }
            /* 2. EMPUJAR EL LIBRO HACIA ABAJO */
            .cover-preview {
                transform: none !important;
                /* AQUÍ ESTÁ EL TRUCO: 40px de margen arriba para librar el botón */
                margin-top: 40px !important;
                margin-bottom: 5px !important;
                padding: 0 !important;
                box-shadow: 0 5px 15px rgba(0,0,0,0.2) !important;
            }
            /* 3. AJUSTAR ALTURA DEL LIBRO PARA QUE QUEPA */
            /* Como añadimos margen arriba, reducimos un poco la altura (de 180 a 160) */
            .cover-front, .cover-back, .cover-spine {
                height: 160px !important;
                min-height: 0 !important;
                width: auto !important;
                padding: 4px !important;
            }
                /* Ajustes finos de texto para el nuevo tamaño de 160px */
                .cover-front .cover-text h2 {
                    font-size: 11px !important;
                    margin-bottom: 2px !important;
                }

            .cover-text p, .spine-text p {
                font-size: 7px !important;
                line-height: 1.1 !important;
            }
            .content {
                padding: 0px !important;
            }
    }

        .wa-mobile-upload-container {
            width: 100%;
            padding: 20px;
            display: flex;
            justify-content: center;
            align-items: center;
            min-height: 250px;
        }

        .wa-upload-dropzone {
            width: 100%;
            max-width: 320px;
            aspect-ratio: 1 / 1; /* Lo hace cuadrado o puedes quitarlo para que sea rectangular */
            border: 2px dashed #ced4da;
            border-radius: 24px;
            display: flex;
            flex-direction: column;
            justify-content: center;
            align-items: center;
            background-color: #f8f9fa;
            cursor: pointer;
            transition: all 0.3s ease;
            position: relative;
            overflow: hidden;
        }

            .wa-upload-dropzone:active {
                transform: scale(0.98);
                border-color: #25D366; /* Color verde WhatsApp */
                background-color: #f0fff4;
            }

        .wa-upload-icon-wrapper {
            width: 80px;
            height: 80px;
            background: white;
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            box-shadow: 0 10px 20px rgba(0,0,0,0.05);
            margin-bottom: 20px;
            color: #25D366;
            font-size: 2.5rem;
        }

        .wa-upload-content {
            text-align: center;
            display: flex;
            flex-direction: column;
            align-items: center;
        }

        .wa-upload-text .main-text {
            display: block;
            font-weight: 700;
            font-size: 1.2rem;
            color: #2c3e50;
            margin-bottom: 5px;
        }

        .wa-upload-text .sub-text {
            display: block;
            font-size: 0.9rem;
            color: #6c757d;
            background: #e9ecef;
            padding: 4px 15px;
            border-radius: 20px;
            font-weight: 500;
        }

        .install-container {
            padding: 40px 20px;
            text-align: center;
            max-width: 400px;
            margin: 0 auto;
        }

        .install-title {
            font-size: 1.5rem;
            font-weight: 700;
            color: #1e293b;
            letter-spacing: -0.02em;
            margin-bottom: 12px;
        }

        .install-subtitle {
            font-size: 0.95rem;
            color: #64748b;
            line-height: 1.5;
            margin-bottom: 35px;
        }

        /* Tarjeta Mobile Estilo Apple/Google */
        .mobile-install-card {
            background: #ffffff;
            border: 1px solid #e2e8f0;
            border-radius: 28px;
            padding: 30px 20px;
            box-shadow: 0 10px 30px rgba(0,0,0,0.04);
            display: flex;
            flex-direction: column;
            align-items: center;
        }

        .install-badge {
            font-size: 0.65rem;
            font-weight: 800;
            color: #1a73e8;
            background: #e8f0fe;
            padding: 4px 12px;
            border-radius: 20px;
            letter-spacing: 0.05em;
            margin-bottom: 20px;
        }

        .install-icon-box {
            width: 70px;
            height: 70px;
            background: #f8fafc;
            border-radius: 20px;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 2.5rem;
            color: #3ddc84; /* Verde Android */
            margin-bottom: 15px;
        }

        .install-info {
            margin-bottom: 25px;
        }

        .install-info-label {
            display: block;
            font-weight: 600;
            font-size: 1.1rem;
            color: #1e293b;
        }

        .install-info-version {
            font-size: 0.8rem;
            color: #94a3b8;
        }

        .btn-install-modern {
            width: 100%;
            background: #000000;
            color: #ffffff;
            padding: 16px;
            border-radius: 18px;
            font-weight: 600;
            text-decoration: none;
            transition: transform 0.2s ease;
        }

        .btn-install-modern:active {
            transform: scale(0.96);
        }

        /* Estilo QR Desktop */
        .qr-wrapper-minimal {
            position: relative;
            padding: 15px;
            background: white;
            border-radius: 24px;
            display: inline-block;
            box-shadow: 0 4px 20px rgba(0,0,0,0.05);
            margin-bottom: 15px;
        }

        .qr-wrapper-minimal img {
            width: 160px;
            height: 160px;
            display: block;
        }

        .qr-caption {
            font-size: 0.85rem;
            color: #94a3b8;
        }

        /* Footer */
        .install-footer {
            margin-top: 30px;
        }

        .btn-secondary-flat {
            background: transparent;
            border: none;
            color: #64748b;
            font-size: 0.9rem;
            font-weight: 500;
            display: flex;
            align-items: center;
            gap: 5px;
            margin: 0 auto;
        }

        /* Cabecera de cada paso dentro de la card */
        .step-header {
            display: flex;
            align-items: center;
            gap: 10px;
            margin-bottom: 12px;
            width: 100%;
        }

        /* Badge de "PASO 1" / "PASO 2" */
        .step-badge {
            background: #e8f0fe;
            color: #1a73e8;
            font-size: 0.75rem;
            font-weight: 800;
            padding: 4px 10px;
            border-radius: 8px;
            letter-spacing: 0.5px;
        }

            .step-badge.secondary {
                background: #f1f5f9;
                color: #64748b;
            }

        /* Conector visual (Línea --- Texto --- Línea) */
        .step-connector {
            display: flex;
            align-items: center;
            width: 100%;
            margin: 20px 0;
        }

            .step-connector .line {
                flex: 1;
                height: 1px;
                background: #e2e8f0;
            }

        .connector-text {
            padding: 0 15px;
            font-size: 0.8rem;
            color: #94a3b8;
            font-weight: 500;
            text-transform: uppercase;
        }

        /* Botones Modernos Grandes */
        .btn-install-modern {
            width: 100%;
            padding: 16px;
            border-radius: 16px;
            font-size: 1rem;
            font-weight: 600;
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 10px;
            text-decoration: none;
            transition: transform 0.2s ease, box-shadow 0.2s ease;
            border: none;
            cursor: pointer;
        }

            .btn-install-modern:active {
                transform: scale(0.97);
            }

            /* Botón Primario (Descargar) - Resalta mucho */
            .btn-install-modern.primary {
                background: #1a73e8; /* Azul Google */
                color: white;
                box-shadow: 0 4px 15px rgba(26, 115, 232, 0.25);
            }

                .btn-install-modern.primary:hover {
                    background: #1557b0;
                    box-shadow: 0 6px 20px rgba(26, 115, 232, 0.35);
                    color: white;
                }

       

       /* --- TOAST: TAMAÑO DE MÓVIL, DISEÑO DE ESCRITORIO --- */
        @media (max-width: 768px) {
            .toast-container {
                /* POSICIÓN Y TAMAÑO (Lo que te gustó) */
                top: 20px !important;
                left: 50% !important;
                right: auto !important;
                transform: translateX(-50%) !important;
                width: 90vw !important; /* 90% del ancho de pantalla */
                max-width: 400px !important;
                z-index: 9999 !important;
            }

            /* ELIMINAMOS el bloque .toast-message de aquí para que use el estilo
               original (amarillo/transparente, bordes de 12px, sombras) del PC. */

            .toast-content {
                /* Solo ajustamos un poco el relleno interno para aprovechar espacio */
                padding: 12px 15px !important;
            }

            .toast-text {
                /* Ajustamos solo el tamaño de letra para que quepa bien */
                font-size: clamp(12px, 3.5vw, 14px) !important;
                /* Mantenemos el color y estilo original */
            }

            .toast-icon {
                 /* Aseguramos que el icono no se haga gigante */
                 width: 20px !important;
                 height: 20px !important;
                 min-width: 20px !important;
            }

            .mobile-settings-toggle:disabled {
                opacity: 0.6; /* Se vuelve semitransparente */
                background-color: #f2f2f2 !important; /* Fondo gris claro */
                color: #999 !important; /* Texto gris apagado */
                border-color: #e0e0e0 !important;
                box-shadow: none !important; /* Le quitamos la sombra (efecto plano) */
                cursor: not-allowed;
                pointer-events: none; /* Asegura que no reciba clics */
            }

            .message-bubble.top-bubble {

                padding: 0.8vh !important;
        }
         .message-bubble.middle-bubble {

                margin-bottom: 0px !important;
                margin-top: 0px !important;
        }
        }

        .btn-install-modern.secondary {
            background-color: #ffffff; /* Fondo blanco */
            border: 2px solid #1a73e8; /* Borde AZUL (color Google) */
            color: #1a73e8; /* Texto AZUL para combinar */
            font-weight: 600;
            /* Aseguramos que mantenga el padding y forma del botón moderno */
            padding: 12px 20px;
            border-radius: 12px; /* O el radio que uses en el primary */
            width: 100%;
            display: flex;
            align-items: center;
            justify-content: space-between;
            margin-top: 10px;
        }

            /* Opcional: Efecto al pasar el mouse o tocar */
            .btn-install-modern.secondary:active {
                background-color: #eff6ff; /* Fondo azul muy clarito al pulsar */
                transform: scale(0.98);
            }

        
            /* --- ZONAS DE INSERCIÓN FANTASMA --- */
    .insert-zone {
        position: relative;
        height: 24px;
        margin: -8px 0; /* Solapa ligeramente para capturar el ratón fácilmente */
        display: flex;
        align-items: center;
        justify-content: center;
        cursor: default; /* la franja ya no abre nada: solo el "+" (ver ZonaDeInsertarClicada) */
        opacity: 0; /* Invisible por defecto */
        transition: opacity 0.2s ease;
        z-index: 10;
    }

    .insert-zone:hover {
        opacity: 1; /* Aparece al pasar el ratón */
    }

    .insert-line {
        position: absolute;
        width: 90%;
        height: 2px;
        background-color: #1a73e8; /* Azul principal */
        border-radius: 2px;
    }

    .insert-btn {
        position: relative;
        width: 26px;
        height: 26px;
        cursor: pointer; /* es lo único que abre "Insertar mensaje" */
        background-color: #1a73e8;
        color: white;
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 14px;
        box-shadow: 0 2px 8px rgba(26, 115, 232, 0.4);
        transition: transform 0.2s ease, background-color 0.2s ease;
    }

    .insert-zone:hover .insert-btn {
        transform: scale(1.15);
    }

    .insert-btn:active {
        transform: scale(0.95);
        background-color: #1557b0;
    }



    .coach-mark-tooltip {
        position: absolute;
        top: 35px; /* Se sitúa justo debajo del botón + */
        left: 50%;
        transform: translateX(-50%);
        width: 220px;
        background: linear-gradient(135deg, #1a73e8, #00d4ff); /* Tu degradado azul */
        color: white;
        padding: 12px;
        border-radius: 12px;
        box-shadow: 0 8px 25px rgba(26, 115, 232, 0.4);
        z-index: 1000;
        cursor: default;
        animation: bounceIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
    }

    .coach-mark-tooltip p {
        margin: 0;
        font-size: 0.85rem;
        line-height: 1.3;
        font-family: 'Poppins', sans-serif;
        text-align: center;
    }

    .tooltip-arrow {
        position: absolute;
        top: -6px;
        left: 50%;
        transform: translateX(-50%);
        width: 0;
        height: 0;
        border-left: 8px solid transparent;
        border-right: 8px solid transparent;
        border-bottom: 8px solid #1a73e8; /* La flechita apunta al botón */
    }

    .wave-emoji {
        display: block;
        font-size: 1.5rem;
        margin-bottom: 5px;
        text-align: center;
        animation: wave 2.5s infinite;
        transform-origin: 70% 70%;
    }

    .btn-got-it {
        background: white;
        color: #1a73e8;
        border: none;
        border-radius: 20px;
        padding: 6px 12px;
        font-size: 0.8rem;
        font-weight: 800;
        width: 100%;
        cursor: pointer;
        transition: transform 0.2s;
    }

    .btn-got-it:hover {
        transform: scale(1.05);
    }

    @keyframes wave {
        0% { transform: rotate( 0.0deg) }
        10% { transform: rotate(14.0deg) }
        20% { transform: rotate(-8.0deg) }
        30% { transform: rotate(14.0deg) }
        40% { transform: rotate(-4.0deg) }
        50% { transform: rotate(10.0deg) }
        60%, 100% { transform: rotate( 0.0deg) }
    }

    @keyframes bounceIn {
        0% { opacity: 0; transform: translateX(-50%) translateY(-10px) scale(0.9); }
        100% { opacity: 1; transform: translateX(-50%) translateY(0) scale(1); }
    }

        /* --- ESTO FUERZA A QUE LA PRIMERA ZONA ESTÉ SIEMPRE VISIBLE --- */
        .insert-zone.force-visible {
            opacity: 1 !important;
            height: 35px; /* Le damos un poco más de espacio inicial */
            z-index: 25;
        }

            /* Hacemos que el botoncito "+" de esta zona destaque un poco más mientras el tooltip está abierto */
            .insert-zone.force-visible .insert-btn {
                transform: scale(1.15);
                box-shadow: 0 0 15px rgba(26, 115, 232, 0.6);
                background-color: #1557b0;
            }

            /* --- ORGANIZACIÓN DE BOTONES DE PLATAFORMA --- */
    .platform-buttons-wrapper {
        display: flex;
        flex-wrap: wrap; /* Permite que los botones bajen a la siguiente línea */
        gap: 16px;
        justify-content: center;
        max-width: 600px; /* Mantiene la agrupación compacta en PC */
        margin: 0 auto 1.5rem auto;
    }

    .platform-buttons-wrapper .btn-logo {
        background: none;
        border: none;
        outline: none;
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 6px;
        padding: 10px;
        border-radius: 8px;
        transition: background 0.2s;
        width: 80px; /* Ancho fijo para que todos ocupen lo mismo */
    }

    .platform-buttons-wrapper .btn-logo span {
        font-family: 'Poppins', sans-serif;
        font-size: 0.85rem;
        font-weight: 500;
        color: #333;
    }

    .platform-btn-icon {
        width: 64px;
        height: 64px;
        transition: transform 0.2s;
    }

    /* Ajustes para móviles */
    @media (max-width: 480px) {
        .platform-buttons-wrapper {
            gap: 10px;
        }

        .platform-buttons-wrapper .btn-logo {
            width: 70px; /* Un poco más estrechos en móvil */
            padding: 5px;
        }

        .platform-btn-icon {
            width: 52px; /* Reducimos la imagen en móvil para que quepan mejor */
            height: 52px;
        }

        .platform-buttons-wrapper .btn-logo span {
            font-size: 0.75rem; /* Letra un pelín más pequeña */
        }
    }

    /* ================= AJUSTES DE AYUDA / PLATAFORMAS (SOLO MÓVIL) ================= */
    @media (max-width: 768px) {
        /* En el flujo de subida (esta página) ocultamos el botón flotante de ayuda,
           porque tapa otros botones. En su lugar usamos el botón fijo inline. */
        .contact-widget-container .contact-trigger {
            display: none !important;
        }

        /* Distribución 3 arriba + 2 abajo centradas.
           Limitamos el ancho para que solo quepan 3 botones por fila. */
        .platform-buttons-wrapper {
            max-width: 280px;
        }

        /* Reordenamos en móvil: WhatsApp, Instagram, Telegram arriba;
           Messenger e iMessage centrados abajo (el orden del DOM no cambia). */
        .platform-buttons-wrapper .btn-logo:nth-child(1) { order: 1; } /* WhatsApp */
        .platform-buttons-wrapper .btn-logo:nth-child(2) { order: 3; } /* Telegram */
        .platform-buttons-wrapper .btn-logo:nth-child(3) { order: 2; } /* Instagram */
        .platform-buttons-wrapper .btn-logo:nth-child(4) { order: 4; } /* Messenger */
        .platform-buttons-wrapper .btn-logo:nth-child(5) { order: 5; } /* iMessage */
    }

    /* Botón fijo "No consigo subir mi archivo" dentro de los tutoriales */
    .mobile-inline-help {
        display: flex;
        justify-content: center;
        margin-top: 16px;
    }

    .mobile-help-btn {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        background-color: #1a73e8;
        color: #fff;
        border: none;
        border-radius: 30px;
        padding: 10px 20px;
        font-weight: 600;
        font-size: 0.9rem;
        box-shadow: 0 4px 12px rgba(26, 115, 232, 0.35);
        cursor: pointer;
        transition: background-color 0.2s ease;
        max-width: 90%;
    }

    .mobile-help-btn:hover {
        background-color: #155cb0;
    }

    /* Controles Anterior/Siguiente SIEMPRE en la misma posición (Instagram y Messenger).
       El contenido del paso vive en una zona de altura fija con scroll interno, de modo
       que los botones quedan anclados abajo y no se mueven aunque cambie el contenido. */
    .guide-step-fixed {
        display: flex;
        flex-direction: column;
        height: 82vh;
        height: 82dvh;   /* la altura se adapta al tamaño de la pantalla */
        min-height: 500px;
        max-height: 680px;
    }

    .guide-step-fixed .guide-step-scroll {
        flex: 1 1 auto;
        min-height: 0;
        display: flex;
        flex-direction: column;
        overflow-y: auto;
        overflow-x: hidden;
    }

    /* Zona donde se muestra el modal blanco directamente (sin la ventana externa
       de "Meta Accounts Center" / "facebook.com"). Se centra y rellena el espacio
       disponible, de modo que el modal escala con la pantalla y se ve siempre entero. */
    .guide-step-fixed .modal-stage {
        flex: 1 1 auto;
        min-height: 0;
        display: flex;
        align-items: center;
        justify-content: center;
        width: 100%;
        position: relative;
        padding: 6px 2px;
        overflow: visible;
    }

    /* Pantallas de intro y de subida también centran su contenido en el espacio. */
    .guide-step-fixed .guide-step-scroll > .install-clean-wrapper,
    .guide-step-fixed .guide-step-scroll > .qr-final-step {
        flex: 1 1 auto;
        min-height: 0 !important;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
    }

    .guide-step-fixed > .tutorial-controls {
        flex-shrink: 0;
        margin-top: 10px;
    }

    .guide-step-fixed > .mobile-inline-help {
        flex-shrink: 0;
    }

    /* Variante pequeña del botón de ayuda para la pantalla de elección de plataforma,
       para que no resalte más que los propios iconos de las plataformas. */
    .mobile-help-btn.mobile-help-btn-sm {
        padding: 6px 14px;
        font-size: 0.78rem;
        font-weight: 500;
        box-shadow: 0 2px 8px rgba(26, 115, 232, 0.25);
        background-color: #eef2ff;
        color: #1a73e8;
    }

    .mobile-help-btn.mobile-help-btn-sm:hover {
        background-color: #e0e8ff;
    }

/* ============================================================================================
   DISEÑO MÓVIL INSPIRADO EN APPLE HUMAN INTERFACE GUIDELINES (iOS HIG)
   Aplica exclusivamente a móvil (hasta 767px) y componentes .hig-* — cero impacto en escritorio.
   ============================================================================================ */
.hig-ios-screen {
    width: 100%; max-width: 460px; margin: 0 auto;
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", system-ui, sans-serif;
    text-align: left;
}
.hig-nav-bar {
    display: flex; align-items: center; justify-content: space-between;
    padding: calc(10px + env(safe-area-inset-top, 0px)) 2px 12px;
}
.hig-nav-bar.with-menu { padding-left: 58px; }
.hig-brand {
    display: inline-flex; align-items: center; gap: 8px;
    font-weight: 700; font-size: .92rem; letter-spacing: -.01em; color: #1C1C1E;
}
.hig-brand img { border-radius: 8px; }
.hig-lang-pill {
    display: inline-flex; align-items: center; gap: 5px;
    min-height: 36px; padding: 6px 12px; border-radius: 999px;
    background: #FFFFFF; border: .5px solid rgba(0,0,0,.1); color: #1C1C1E;
    font-size: .8rem; font-weight: 600;
}
.hig-lang-menu { border-radius: 14px; border: .5px solid rgba(0,0,0,.1); padding: 6px; }

.hig-hero { padding: 14px 4px 20px; }
.hig-large-title {
    margin: 0 0 6px; font-size: 1.95rem; line-height: 1.12; font-weight: 800;
    letter-spacing: -.03em; color: #000000; outline: none !important; border: 0 !important;
}
.hig-large-title:focus, .welcome-container h1:focus { outline: none !important; box-shadow: none !important; }
.hig-hero-sub {
    margin: 0; font-size: .96rem; line-height: 1.4; color: #6C6C70; font-weight: 400;
}

/* Apple iOS Inset Grouped List (UITableViewStyle.insetGrouped) */
.hig-inset-list {
    display: flex !important; flex-direction: column !important; gap: 0 !important;
    width: 100% !important; margin: 0 !important; padding: 0 !important;
    background: #FFFFFF; border-radius: 16px; overflow: hidden;
    box-shadow: 0 1px 2px rgba(0,0,0,.04);
}
.hig-list-row {
    position: relative; width: 100%; min-height: 64px;
    display: flex !important; align-items: center !important; justify-content: flex-start !important;
    flex-direction: row !important; gap: 14px;
    padding: 12px 16px !important; margin: 0 !important;
    background: #FFFFFF !important; border: 0 !important; border-radius: 0 !important;
    box-shadow: none !important; text-align: left; cursor: pointer;
    transition: background .12s;
}
.hig-list-row:active { background: #E5E5EA !important; }
.hig-list-row + .hig-list-row::before {
    content: ""; position: absolute; top: 0; left: 70px; right: 0;
    height: .5px; background: #E5E5EA;
}
.hig-app-ico {
    width: 40px !important; height: 40px !important; object-fit: contain;
    border-radius: 10px; flex: 0 0 auto;
}
.hig-row-text {
    display: flex; flex-direction: column; flex: 1; min-width: 0; line-height: 1.25;
}
.hig-row-text strong { font-size: 1.02rem; font-weight: 600; color: #000000; }
.hig-row-text small { font-size: .8rem; color: #6C6C70; font-weight: 400; margin-top: 2px; }
.hig-chevron { color: #C7C7CC; font-size: .95rem; flex: 0 0 auto; }

.hig-list-footnote {
    margin: 12px 14px 4px; font-size: .8rem; color: #6C6C70; line-height: 1.4;
    display: flex; align-items: center; gap: 6px;
}
.hig-list-footnote i { color: #007AFF; }

/* ---- Top bar dentro del tutorial WhatsApp móvil ---- */
.hig-tuto-topbar {
    display: flex; align-items: center; justify-content: space-between; gap: 8px;
    width: 100%; max-width: 360px; margin: 0 auto 6px;
}
.hig-skip-btn {
    background: #EAF3FF; border: 0; color: #007AFF; font-size: .8rem; font-weight: 700;
    padding: 7px 12px; border-radius: 999px; display: inline-flex; align-items: center; gap: 3px;
    min-height: 36px;
}
.hig-final-upload-wrap { width: 100%; max-width: 380px; margin: 4px auto 0; }

.hig-card {
    background: #FFFFFF; border: .5px solid rgba(0,0,0,.08); border-radius: 20px;
    padding: 22px 18px; text-align: center;
    box-shadow: 0 4px 18px rgba(0,0,0,.05);
}
.hig-card-icon {
    width: 54px; height: 54px; border-radius: 16px; margin: 0 auto 12px;
    background: #EAF3FF; color: #007AFF; font-size: 1.55rem;
    display: grid; place-items: center;
}
.hig-card-title {
    display: block !important; background: transparent !important; box-shadow: none !important;
    padding: 0 !important; border-radius: 0 !important; transform: none !important;
    margin: 0 0 8px !important; font-size: 1.2rem !important; line-height: 1.22 !important;
    font-weight: 700 !important; letter-spacing: -.02em; color: #000000 !important;
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", system-ui, sans-serif !important;
}
.hig-card-desc {
    margin: 0 0 16px; font-size: .9rem; line-height: 1.45; color: #3A3A3C;
}
.hig-primary-btn {
    display: flex; align-items: center; justify-content: center; gap: 8px;
    width: 100%; min-height: 50px; padding: 13px 18px; border: 0; border-radius: 14px;
    background: #007AFF; color: #fff !important; font-size: 1rem; font-weight: 600;
    cursor: pointer; text-decoration: none; transition: transform .12s, background .15s;
}
.hig-primary-btn:active { transform: scale(.98); background: #0062CC; }
.hig-upload-hint { margin: 12px 0 0; font-size: .8rem; color: #6C6C70; }

/* ---- Salto diferido a Chrome/Safari justo antes de subir ---- */
.hig-ext-browser {
    background: #FFFFFF; border: .5px solid rgba(0,0,0,.08); border-radius: 20px;
    padding: 20px 16px; text-align: center; box-shadow: 0 6px 24px rgba(0,0,0,.06);
}
.hig-ext-pointer {
    display: inline-flex; align-items: center; gap: 6px; margin-bottom: 10px;
    background: #007AFF; color: #fff; font-size: .8rem; font-weight: 700;
    padding: 6px 12px; border-radius: 999px;
}
.hig-ext-badge {
    display: inline-flex; align-items: center; gap: 6px; margin-bottom: 10px;
    background: #F2F2F7; color: #157A40; font-size: .78rem; font-weight: 700;
    padding: 5px 11px; border-radius: 999px;
}
.hig-ext-steps { display: grid; gap: 8px; text-align: left; margin-bottom: 14px; }
.hig-ext-step {
    display: flex; align-items: center; gap: 10px; background: #F2F2F7;
    border-radius: 12px; padding: 11px 12px; font-size: .88rem; font-weight: 600; color: #1C1C1E;
}
.hig-ext-step span {
    width: 24px; height: 24px; border-radius: 50%; background: #007AFF; color: #fff;
    display: grid; place-items: center; font-size: .78rem; font-weight: 800; flex: 0 0 auto;
}
.hig-ext-warn { margin: 10px 0 0; font-size: .82rem; color: #C62828; font-weight: 600; }
.hig-secondary-link {
    margin-top: 10px; background: none; border: 0; color: #6C6C70;
    font-size: .84rem; font-weight: 600; text-decoration: underline; padding: 8px; min-height: 44px;
}

/* ---- Reglas exclusivamente móviles (hasta 767px) ---- */
@media (max-width: 767.98px) {
    body { background: #F2F2F7; }
    .welcome-container.hig-welcome {
        background: #F2F2F7 !important;
        min-height: 100dvh; height: auto !important;
        margin: 0 !important; padding: 8px 16px 36px !important;
        justify-content: flex-start !important; align-items: stretch !important;
        box-sizing: border-box;
    }
    .mobile-inline-help { margin-top: 14px !important; }
    .mobile-help-btn {
        background: #FFFFFF !important; color: #007AFF !important;
        border: .5px solid rgba(0,0,0,.08) !important; box-shadow: none !important;
        font-size: .84rem !important; font-weight: 600 !important; padding: 9px 16px !important;
    }

    /* Guía de exportación móvil: limpia, tipo iOS y con phone-mockup a medida sin recortar controles */
    .guide-page-container {
        margin: 0 !important; padding: calc(12px + env(safe-area-inset-top, 0px)) 16px 32px !important;
        min-height: 100dvh !important; background: #F2F2F7 !important; border-radius: 0 !important;
        box-shadow: none !important; box-sizing: border-box;
        font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, sans-serif;
    }
    .guide-footer { display: none !important; }
    .guide-header {
        padding: 4px 2px 10px !important; margin-bottom: 8px !important;
        border-bottom: .5px solid #E5E5EA !important;
    }
    .guide-header h4 {
        font-family: inherit !important; font-size: 1.05rem !important; font-weight: 700 !important;
        color: #000 !important; display: flex; align-items: center; gap: 8px; margin: 0;
    }
    .guide-header .platform-btn-icon { width: 28px !important; height: 28px !important; margin-right: 0 !important; }
    .guide-header .btn-close {
        width: 32px; height: 32px; border-radius: 50%; background: #E5E5EA; color: #3A3A3C;
        font-size: .85rem; display: grid; place-items: center; padding: 0; border: 0; opacity: 1;
    }
    .guide-body { padding: 0 !important; }
    .guide-container { padding: 0 !important; max-width: 440px; margin: 0 auto; }
    .tutorial-wrapper h6 {
        font-size: .95rem !important; line-height: 1.32 !important; min-height: 2.4em !important;
        padding: 0 8px !important; margin: 0 auto 8px !important; max-width: 340px;
        color: #1C1C1E !important;
    }
    .hig-tuto-topbar .btn-link-custom {
        background: #FFFFFF; border: .5px solid rgba(0,0,0,.08); color: #1C1C1E !important;
        border-radius: 999px; padding: 6px 12px; font-size: .8rem; font-weight: 600;
        min-height: 36px; display: inline-flex; align-items: center; gap: 5px; margin: 0 !important;
    }
    .tuto-stage { flex-direction: column !important; align-items: center !important; gap: 10px !important; }
    .phone-mockup {
        width: 244px !important; height: 372px !important;
        border-width: 7px !important; border-radius: 30px !important;
    }
    .ios-heavy-tip.side { max-width: 340px !important; width: 100% !important; }
    .tutorial-controls { margin-top: 10px !important; gap: 6px !important; }

    /* ---- MODALES MÓVILES (#paginasModal, .date-modal, .customization-modal) COMO iOS BOTTOM SHEET ----
       Footer STICKY abajo: el botón «Continuar» SIEMPRE es visible y pulsable aunque el móvil sea pequeño. */
    .date-modal-overlay,
    .customization-modal-overlay {
        z-index: 10020 !important;
        align-items: flex-end !important;
        padding: 0 !important;
        background: rgba(0, 0, 0, .42) !important;
        -webkit-backdrop-filter: blur(3px);
        backdrop-filter: blur(3px);
    }
    .canva-overlay { z-index: 10020 !important; }

    .date-modal,
    .date-modal.paginas-modal,
    .customization-modal {
        width: 100% !important; max-width: 100% !important;
        max-height: 92dvh !important; margin: 0 !important;
        border-radius: 22px 22px 0 0 !important;
        display: flex !important; flex-direction: column !important;
        overflow: hidden !important; background: #FFFFFF !important;
        box-shadow: 0 -10px 36px rgba(0,0,0,.22) !important;
        font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, sans-serif;
    }
    .hig-sheet-handle-bar {
        display: flex; justify-content: center; align-items: center;
        padding: 10px 0 2px; flex: 0 0 auto; touch-action: none; cursor: grab;
        background: #FFFFFF;
    }
    .hig-sheet-handle-bar .hig-sheet-grabber { margin: 0 !important; }
    .date-modal .modal-header,
    .customization-modal .modal-header {
        flex: 0 0 auto; display: flex; align-items: center; justify-content: space-between;
        padding: 8px 16px 12px !important; border-bottom: .5px solid #E5E5EA !important;
        background: #FFFFFF; touch-action: none; cursor: grab;
    }
    .customization-modal .info-icon .info-tooltip {
        max-width: min(260px, calc(100vw - 48px)) !important;
        left: 50% !important; transform: translateX(-50%) !important;
    }
    .hig-login-gate-actions {
        display: flex; flex-direction: column; gap: 10px; width: 100%; margin-top: 4px;
    }
    .hig-secondary-btn {
        width: 100%; min-height: 48px; border-radius: 14px; border: 1.5px solid #D1D1D6;
        background: #F2F2F7; color: #1C1C1E; font-weight: 600; font-size: .95rem;
        display: inline-flex; align-items: center; justify-content: center; gap: 8px;
        padding: 10px 16px; cursor: pointer;
    }
    .hig-secondary-btn:active { background: #E5E5EA; }
    .date-modal .modal-header h4,
    .customization-modal .modal-header h4 {
        font-family: inherit !important; font-size: 1.05rem !important; font-weight: 700 !important;
        color: #000000 !important; margin: 0 !important;
    }
    .date-modal .modal-header .btn-close {
        width: 30px; height: 30px; border-radius: 50%; background: #F2F2F7; color: #3A3A3C;
        border: 0; display: grid; place-items: center; padding: 0; font-size: .8rem; opacity: 1;
    }
    .date-modal .modal-body,
    .customization-modal .modal-body {
        display: block !important; flex: 1 1 auto !important; overflow-y: auto !important;
        -webkit-overflow-scrolling: touch;
        padding: 12px 16px 14px !important; text-align: left;
    }
    .paginas-lead { font-size: .86rem !important; color: #6C6C70 !important; line-height: 1.35; margin: 0 0 10px !important; }
    .paginas-cards {
        display: grid !important; grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        width: 100% !important; max-width: 100% !important;
        gap: 10px !important; margin: 0 !important;
    }
    .paginas-card {
        width: 100% !important; max-width: none !important; min-width: 0 !important;
        padding: 10px 8px !important; border-radius: 14px !important;
        border: 1.5px solid #E5E5EA !important; background: #F2F2F7 !important; gap: 2px !important;
    }
    .paginas-card.sel { border-color: #007AFF !important; background: #EAF3FF !important; }
    .paginas-card.sel::after { background: #007AFF !important; top: 6px; right: 6px; width: 18px; height: 18px; }
    .paginas-libro { height: 42px !important; margin-bottom: 4px !important; }
    .paginas-libro .tapa { width: 32px !important; }
    .paginas-nombre { font-size: .64rem !important; }
    .paginas-num { font-size: .86rem !important; }
    .paginas-precio { font-size: 1.05rem !important; color: #007AFF !important; }
    .paginas-otro { margin-top: 10px !important; min-height: 28px !important; font-size: .85rem !important; }
    .paginas-otro-link { color: #007AFF !important; }
    .paginas-info {
        margin-top: 10px !important; padding: 8px 10px !important;
        font-size: .78rem !important; background: #F2F2F7 !important; color: #3A3A3C !important;
    }
    .paginas-info b { color: #007AFF !important; }

    /* Footer sticky del modal: botón Continuar grande, azul Apple y siempre visible */
    .date-modal .modal-footer,
    .customization-modal .modal-footer {
        flex: 0 0 auto !important;
        display: flex !important; flex-wrap: wrap !important; align-items: center !important;
        gap: 8px !important;
        padding: 10px 16px calc(12px + env(safe-area-inset-bottom, 0px)) !important;
        background: #FFFFFF !important; border-top: .5px solid #E5E5EA !important;
    }
    .paginas-nota-precio {
        width: 100% !important; text-align: center; font-size: .74rem !important;
        color: #6C6C70 !important; margin: 0 0 2px !important;
    }
    .date-modal .modal-footer .btn,
    .customization-modal .modal-footer .btn {
        font-family: inherit !important; border-radius: 14px !important;
        min-height: 48px !important; padding: 10px 16px !important;
        font-size: .96rem !important; font-weight: 600 !important;
    }
    .date-modal .modal-footer .btn-outline-secondary,
    .customization-modal .modal-footer .btn-secondary {
        flex: 0 0 auto; background: #F2F2F7 !important; color: #1C1C1E !important; border: 0 !important;
    }
    .date-modal .modal-footer .btn-primary,
    .customization-modal .modal-footer .btn-primary {
        flex: 1 1 auto !important; background: #007AFF !important; color: #FFFFFF !important; border: 0 !important;
    }

    /* ---- Editor móvil Apple HIG: barra superior translúcida, tab bar inferior y bottom sheet ---- */
    .app-layout {
        --mob-edge-top: calc(58px + env(safe-area-inset-top, 0px));
        --mob-edge-bottom: calc(74px + env(safe-area-inset-bottom, 0px));
        background: #F2F2F7;
    }
    .mobile-edge-bar {
        background: rgba(255, 255, 255, .88) !important;
        -webkit-backdrop-filter: saturate(180%) blur(20px);
        backdrop-filter: saturate(180%) blur(20px);
    }
    .mobile-edge-top { border-bottom: .5px solid rgba(0,0,0,.12) !important; }
    .mobile-edge-bottom { border-top: .5px solid rgba(0,0,0,.12) !important; }

    .hig-editor-topbar {
        left: 12px; right: 10px; height: 58px !important;
        justify-content: space-between; gap: 6px;
    }
    .hig-editor-topbar.with-menu { left: 62px !important; gap: 4px; }
    .hig-editor-topbar.with-menu .hig-icon-btn { width: 34px; height: 34px; font-size: 1.05rem; }
    .coach-mark-tooltip {
        left: 0 !important; transform: none !important;
        max-width: min(260px, calc(100vw - 40px)) !important;
    }
    .hig-undo-group { display: flex; align-items: center; gap: 2px; }
    .hig-icon-btn {
        width: 40px; height: 40px; border-radius: 50%; border: 0; background: transparent;
        color: #007AFF; font-size: 1.15rem; display: grid; place-items: center;
    }
    .hig-icon-btn:disabled { color: #C7C7CC; }
    .hig-book-status {
        display: flex; flex-direction: column; align-items: center; min-width: 0; flex: 1;
    }
    .hig-pages-pill {
        background: #F2F2F7; color: #1C1C1E; font-size: .78rem; font-weight: 700;
        padding: 5px 11px; border-radius: 999px; white-space: nowrap;
        max-width: 100%; overflow: hidden; text-overflow: ellipsis;
    }
    .mldm-bg-upload-pill {
        display: inline-flex; align-items: center; gap: 5px; margin-top: 2px;
        font-size: .68rem; font-weight: 600; color: #007AFF;
    }
    .mldm-up-dot {
        width: 6px; height: 6px; border-radius: 50%; background: #007AFF;
        animation: pulse-border 1.4s infinite;
    }
    .mldm-up-track {
        width: 38px; height: 4px; border-radius: 999px; background: #DBEAFE; overflow: hidden;
    }
    .mldm-up-bar {
        display: block; height: 100%; width: 0%; background: #007AFF; transition: width .25s ease;
    }

    /* Tab bar inferior nativa iOS */
    .hig-tabbar {
        position: fixed; left: 0; right: 0; bottom: 0; z-index: 1000;
        height: calc(74px + env(safe-area-inset-bottom, 0px));
        padding: 8px 12px calc(8px + env(safe-area-inset-bottom, 0px));
        display: grid; grid-template-columns: 1fr 1fr 1fr 1.35fr; align-items: center; gap: 6px;
        background: rgba(255,255,255,.92);
        -webkit-backdrop-filter: saturate(180%) blur(20px);
        backdrop-filter: saturate(180%) blur(20px);
        border-top: .5px solid rgba(0,0,0,.12);
    }
    .hig-tab {
        display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
        min-height: 48px; border: 0; background: transparent; color: #6C6C70;
        font-size: .7rem; font-weight: 600; padding: 4px 2px; border-radius: 12px;
    }
    .hig-tab.active, .hig-tab:active { color: #007AFF; background: #EAF3FF; }
    .hig-tab-ico { position: relative; font-size: 1.25rem; line-height: 1; }
    .hig-tab-badge {
        position: absolute; top: -2px; right: -5px; width: 8px; height: 8px;
        border-radius: 50%; background: #FF9500; border: 1.5px solid #fff;
    }
    .hig-tab-cta {
        display: flex; align-items: center; justify-content: center; gap: 2px;
        min-height: 48px; border: 0; border-radius: 14px;
        background: #007AFF; color: #fff; font-size: .95rem; font-weight: 700;
        padding: 0 12px; box-shadow: 0 4px 12px rgba(0,122,255,.28);
    }
    .hig-tab-cta:active { transform: scale(.97); background: #0062CC; }
    .hig-tab-cta i { font-size: 1.25rem; }

    /* Bottom Sheet iOS para Ajustes / Customize book (.customization-sidebar) */
    .hig-sheet-backdrop {
        position: fixed; inset: 0; z-index: 1090; background: rgba(0,0,0,.32);
        -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px);
    }
    .app-layout .customization-sidebar {
        position: fixed !important; left: 0 !important; right: 0 !important; bottom: 0 !important; top: auto !important;
        width: 100% !important; max-width: 100% !important; height: auto !important; max-height: 88dvh !important;
        display: block !important;
        border-radius: 22px 22px 0 0 !important; background: #F2F2F7 !important;
        box-shadow: 0 -12px 40px rgba(0,0,0,.18) !important;
        transform: translateY(105%);
        transition: transform .34s cubic-bezier(.32,.72,0,1);
        z-index: 1120 !important; overflow-y: auto !important; overflow-x: hidden !important;
        -webkit-overflow-scrolling: touch; overscroll-behavior: contain;
        padding: 0 14px calc(40px + env(safe-area-inset-bottom, 0px)) !important;
    }
    .app-layout .customization-sidebar.mobile-open { transform: translateY(0); }
    .customization-sidebar .sidebar-header {
        position: relative; z-index: 1 !important;
        flex: none !important; overflow: visible !important; border-bottom: none !important;
        border-radius: 16px !important; margin-bottom: 12px !important;
        padding: 12px 14px !important;
    }
    .customization-sidebar .sidebar-header > h5 { display: none !important; }
    .customization-sidebar .boton-portada {
        height: auto !important; min-height: 58px !important;
        flex-direction: row !important; gap: 10px !important;
        padding: 24px 14px 10px !important; margin-bottom: 10px !important;
        border-radius: 12px !important;
    }
    .customization-sidebar .boton-portada img { height: 30px !important; margin-bottom: 0 !important; }
    .customization-sidebar .accordion-content .btn { min-height: 40px !important; display: inline-flex; align-items: center; justify-content: center; }
    body:has(.guide-page-container) .navbar-toggler { display: none !important; }
    .customization-sidebar .clean-widget { margin-bottom: 10px !important; }
    .customization-sidebar .fechas-libro { gap: 8px !important; }
    .customization-sidebar .fechas-libro input[type="date"] { min-width: 0; font-size: .82rem !important; padding: 6px 8px !important; }
    .customization-sidebar .sidebar-accordion-scroll {
        flex: none !important; overflow: visible !important; height: auto !important; max-height: none !important;
        padding: 0 0 18px !important;
    }
    .hig-sheet-chrome {
        position: sticky; top: 0; z-index: 20 !important; background: #F2F2F7;
        padding: 10px 0 10px; border-bottom: .5px solid #E5E5EA; margin-bottom: 10px;
        touch-action: none; cursor: grab; user-select: none; -webkit-user-select: none;
    }
    .hig-sheet-grabber {
        width: 42px; height: 5px; border-radius: 999px; background: #C7C7CC; margin: 0 auto 10px;
        cursor: grab; touch-action: none;
    }
    .hig-sheet-head { display: flex; align-items: center; justify-content: space-between; }
    .hig-sheet-head strong { font-size: 1.05rem; font-weight: 700; color: #000; }
    .hig-sheet-done {
        border: 0; background: #EAF3FF; color: #007AFF; font-weight: 700; font-size: .9rem;
        padding: 7px 14px; border-radius: 999px; min-height: 36px;
    }

    /* Hojas del libro limpias sobre fondo agrupado iOS */
    .book-page {
        border-radius: 8px !important;
        box-shadow: 0 4px 16px rgba(0,0,0,.08) !important;
    }

    /* ---- Editor de Portada Móvil 10/10 estilo Apple HIG (sin cortes, sin zoom iOS, sin solapes) ---- */
    .canva-editor {
        z-index: 10025 !important;
        height: 100dvh;
        overscroll-behavior: none;
        touch-action: manipulation;
        font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, sans-serif;
    }
    .canva-save-overlay { z-index: 10035 !important; }
    .canva-editor textarea { font-size: 16px !important; } /* evita auto-zoom en iOS Safari al escribir */
    .canva-surface-box, .canva-canvas-host { touch-action: none !important; }

    /* Barra superior en 1 sola línea limpia (52px en vez de 95px apilados en 3 líneas) */
    .canva-topbar {
        min-height: 52px;
        padding: calc(6px + env(safe-area-inset-top, 0px)) 10px 6px !important;
        gap: 4px;
        border-bottom: .5px solid #E5E5EA;
    }
    .canva-back-btn {
        width: 36px; height: 36px; padding: 0 !important; border-radius: 50%;
        justify-content: center; color: #007AFF !important; font-size: 1.15rem !important;
        flex: 0 0 auto; background: #F2F2F7 !important;
    }
    .canva-back-txt { display: none !important; }
    .canva-topbar-history { gap: 2px; flex: 0 0 auto; }
    .canva-icon-btn2 { width: 34px !important; height: 34px !important; font-size: 1rem !important; color: #1C1C1E !important; }
    .canva-topbar-right { gap: 6px !important; margin-left: auto; flex: 0 0 auto; }
    .canva-later-btn {
        padding: 7px 11px !important; font-size: .78rem !important; border-radius: 999px !important;
        background: #F2F2F7 !important; color: #1C1C1E !important; white-space: nowrap !important;
    }
    .canva-save-btn {
        padding: 8px 14px !important; font-size: .84rem !important; border-radius: 999px !important;
        background: #007AFF !important; color: #FFFFFF !important; white-space: nowrap !important;
        line-height: 1.15 !important;
    }

    /* Pestañas Portada / Lateral / Contraportada más compactas y estilo Apple */
    .canva-surfaces { border-bottom: .5px solid #E5E5EA !important; }
    .canva-surface-btn { padding: 8px 4px !important; font-size: .8rem !important; }
    .canva-surface-btn.active { color: #007AFF !important; border-bottom-color: #007AFF !important; }

    /* Toggle márgenes compacto con verde iOS */
    .canva-margins-toggle { padding: 4px 12px 2px !important; gap: 6px !important; }
    .canva-margins-toggle .toggle-label { font-size: .68rem !important; }
    .canva-margins-toggle .modern-switch input:checked + .slider { background-color: #34C759 !important; }

    /* Hoja de herramientas compacta con grabber iOS -> la portada tiene casi el DOBLE de tamaño visible */
    .canva-sheet {
        max-height: 38dvh !important;
        border-top-left-radius: 20px !important; border-top-right-radius: 20px !important;
    }
    .canva-sheet-header {
        position: sticky; top: 0; justify-content: flex-end; padding: 6px 8px 0 !important;
        touch-action: none; cursor: grab; user-select: none; -webkit-user-select: none;
    }
    .canva-sheet-grabber {
        position: absolute; left: 50%; top: 8px; transform: translateX(-50%);
        width: 40px; height: 5px; border-radius: 999px; background: #C7C7CC;
        cursor: grab; touch-action: none;
    }
    .canva-sheet-body { padding: 4px 12px 10px !important; }
    .canva-add-text { padding: 9px 12px !important; margin-bottom: 8px !important; font-size: .9rem !important; border-radius: 12px !important; background: #007AFF !important; }
    .canva-text-presets { gap: 6px !important; margin-bottom: 8px !important; }
    .canva-text-presets button { padding: 8px 6px !important; border-radius: 10px !important; }
    .canva-tool-section-label { margin: 2px 2px 5px !important; }
    .canva-fonts-row { padding-bottom: 4px !important; margin-bottom: 6px !important; }
    .canva-font-chip { padding: 6px 12px !important; font-size: .85rem !important; }
    .canva-colors-row { gap: 8px !important; padding-bottom: 4px !important; margin-bottom: 8px !important; }
    .canva-color-chip { width: 28px !important; height: 28px !important; }

    /* Fila de formato en Texto: los 8 botones caben 100% sin cortar la papelera */
    .canva-format-row { gap: 5px !important; overflow-x: visible !important; justify-content: space-between; padding-bottom: 2px !important; }
    .canva-fmt-btn { flex: 1 1 0 !important; min-width: 34px !important; height: 36px !important; padding: 0 !important; }
    .canva-size-input { flex: 0 0 46px !important; width: 46px !important; height: 36px !important; font-size: .86rem !important; }

    /* Barra flotante del objeto: botón Editar texto azul destacado */
    .canva-obj-toolbar { z-index: 40 !important; padding: 4px !important; border-radius: 14px !important; }
    .canva-obj-toolbar button { width: 40px !important; height: 38px !important; }
    .canva-obj-toolbar .canva-obj-edit { background: #EAF3FF !important; color: #007AFF !important; }

    /* Barra sobre el teclado al escribir texto: zona deslizable + botón ✓ SIEMPRE FIJO a la derecha! */
    .canva-kbd-toolbar {
        display: flex !important; align-items: center !important; gap: 6px !important;
        overflow: visible !important; padding: 6px 8px calc(6px + env(safe-area-inset-bottom, 0px)) !important;
    }
    .canva-kbd-scroll {
        flex: 1 1 auto; min-width: 0; display: flex; align-items: center; gap: 4px;
        overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none;
    }
    .canva-kbd-scroll::-webkit-scrollbar { display: none; }
    .canva-kbd-toolbar .kbt-done {
        flex: 0 0 auto !important; margin-left: 0 !important;
        background: #007AFF !important; color: #FFFFFF !important;
        border-radius: 10px !important; min-width: 42px !important; height: 38px !important;
        box-shadow: 0 2px 8px rgba(0,122,255,.3);
    }

    /* Modal confirmar guardado estilo Apple HIG */
    .canva-save-modal { border-radius: 22px !important; }
    .csa-save { background: #007AFF !important; border-radius: 14px !important; }
    .csa-keep { background: #F2F2F7 !important; color: #1C1C1E !important; border-radius: 14px !important; }

    /* Barra de cookies en el editor del libro: se coloca justo ENCIMA de la barra fija de pago para no taparla */
    body:has(.hig-tabbar) .cookie-barra,
    body:has(.mls-sticky-paybar) .cookie-barra {
        bottom: calc(78px + env(safe-area-inset-bottom, 0px)) !important;
    }
    body:has(.canva-editor:not(.canva-editor-hidden)),
    body:has(.mls-cover-screen) { overflow: hidden !important; overscroll-behavior: none !important; }

    /* ---- FLUJO MÓVIL SIMPLIFICADO (.mls-*) estilo Apple HIG / Landing B ---- */
    .mls-landing { padding-bottom: 32px; }
    .mls-hero { padding: 6px 2px 12px; }
    .mls-preview-banner {
        margin-top: 12px; border-radius: 16px; overflow: hidden; background: #fff;
        box-shadow: 0 4px 18px rgba(0,0,0,.07); border: .5px solid rgba(0,0,0,.06);
    }
    .mls-preview-banner img { width: 100%; height: 152px; object-fit: cover; display: block; }
    .mls-trust-pills {
        display: flex; align-items: center; justify-content: space-between; gap: 8px;
        padding: 9px 12px; font-size: .78rem; font-weight: 600; color: #1C1C1E; background: #fff;
    }
    .mls-trust-pills span { display: inline-flex; align-items: center; gap: 5px; }

    .mls-faq { margin-top: 22px; }
    .mls-faq-title { font-size: 1.15rem; font-weight: 800; color: #1C1C1E; margin: 0 2px 10px; letter-spacing: -.01em; }
    .mls-faq-list { background: #fff; border-radius: 16px; overflow: hidden; box-shadow: 0 2px 12px rgba(0,0,0,.05); }
    .mls-faq-list details { border-bottom: .5px solid #E5E5EA; }
    .mls-faq-list details:last-child { border-bottom: 0; }
    .mls-faq-list summary { list-style: none; display: flex; align-items: center; justify-content: space-between; gap: 10px;
        padding: 14px 14px; min-height: 48px; font-size: .92rem; font-weight: 600; color: #1C1C1E; cursor: pointer; }
    .mls-faq-list summary::-webkit-details-marker { display: none; }
    .mls-faq-list summary i { color: #8E8E93; transition: transform .2s; flex: 0 0 auto; }
    .mls-faq-list details[open] summary i { transform: rotate(180deg); }
    .mls-faq-list details p { margin: 0; padding: 0 14px 14px; font-size: .88rem; line-height: 1.45; color: #3A3A3C; }
    .mls-landing .mlc { margin: 0 -16px; }
    .mls-config-card {
        background: #FFFFFF; border-radius: 18px; padding: 14px;
        box-shadow: 0 2px 12px rgba(0,0,0,.05); margin-bottom: 14px;
    }
    .mls-section-label { font-size: .88rem; font-weight: 700; color: #1C1C1E; margin-bottom: 10px; }
    .mls-size-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-bottom: 12px; }
    .mls-size-card {
        display: flex; flex-direction: column; align-items: flex-start; gap: 2px;
        padding: 10px 11px; border-radius: 13px; border: 1.5px solid #E5E5EA;
        background: #F2F2F7; text-align: left; cursor: pointer; min-width: 0;
    }
    .mls-size-card.sel { border-color: #007AFF; background: #EAF3FF; }
    .mls-size-name { font-size: .66rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: #6C6C70; }
    .mls-size-pages { font-size: .86rem; font-weight: 700; color: #1C1C1E; }
    .mls-size-price { font-size: 1rem; font-weight: 800; color: #007AFF; }

    .mls-toggles-row { display: flex; flex-direction: column; gap: 10px; }
    .mls-toggle-group { display: flex; flex-direction: column; gap: 4px; }
    .mls-mini-label { font-size: .74rem; font-weight: 700; color: #6C6C70; text-transform: uppercase; letter-spacing: .04em; }
    .mls-segmented {
        display: grid; grid-template-columns: 1fr 1fr; gap: 4px;
        background: #F2F2F7; padding: 3px; border-radius: 11px;
    }
    .mls-segmented button {
        border: 0; background: transparent; color: #3A3A3C; font-size: .8rem; font-weight: 600;
        padding: 8px 6px; border-radius: 9px; min-height: 36px; transition: all .15s ease;
    }
    .mls-segmented button.active {
        background: #FFFFFF; color: #007AFF; font-weight: 700;
        box-shadow: 0 1px 4px rgba(0,0,0,.1);
    }

    .mls-cta-block { display: flex; flex-direction: column; align-items: stretch; }
    .mls-main-cta { min-height: 54px !important; font-size: .98rem !important; border-radius: 15px !important; }
    .mls-other-platforms { margin-top: 14px; text-align: center; }
    .mls-other-title { margin: 0 0 8px; color: #6C6C70; font-size: .85rem; font-weight: 600; }
    .mls-other-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
    .mls-other-chip {
        display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px;
        border: 1.5px solid #E5E5EA; background: #fff; color: #1C1C1E; border-radius: 14px; padding: 10px 4px;
        font-size: .82rem; font-weight: 700; min-height: 68px; box-shadow: 0 2px 8px rgba(0,0,0,.06); cursor: pointer;
    }
    .mls-other-chip:active { transform: scale(.97); background: #F2F2F7; }
    .mls-other-chip img { width: 28px; height: 28px; }
    .mls-ext-card { margin-top: 8px; }

    /* Portada simple móvil (0 Fabric táctil) */
    .mls-cover-screen {
        position: fixed; inset: 0; z-index: 10025; background: #F2F2F7;
        display: flex; flex-direction: column; height: 100dvh;
        font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, sans-serif;
    }
    /* 3-dic-2026: las ventanas de confirmar (p. ej. «Atrás» con el libro sin guardar) van a 1200 y quedaban DEBAJO de la
       portada: la ventana estaba abierta pero no se veía. Con la portada en pantalla, por encima de todo. */
    body:has(.mls-cover-screen) .confirm-modal-overlay { z-index: 10060 !important; }
    .mls-cover-topbar {
        flex: 0 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 8px;
        padding: calc(8px + env(safe-area-inset-top, 0px)) 12px 8px;
        background: rgba(255,255,255,.94); border-bottom: .5px solid #E5E5EA;
    }
    .mls-cover-title-head { font-size: .96rem; font-weight: 700; color: #1C1C1E; }
    .mls-cover-stage {
        flex: 1 1 auto; min-height: 0; display: flex; align-items: center; justify-content: center;
        padding: 12px 16px;
    }
    .mls-cover-preview-card {
        position: relative;
        height: 100%; max-height: 360px; aspect-ratio: 740 / 1082; border-radius: 10px;
        overflow: hidden; box-shadow: 0 14px 36px rgba(0,0,0,.18);
        display: flex; align-items: center; justify-content: center;
    }
    .mls-cover-preview-card img { width: 100%; height: 100%; object-fit: contain; display: block; }
    .mls-cover-preview-card img.mls-img-pending { visibility: hidden; }
    .mls-cover-mini-spinner {
        position: absolute; top: 8px; right: 8px; z-index: 3; width: 30px; height: 30px; border-radius: 50%;
        background: rgba(255,255,255,.92); color: #007AFF; display: grid; place-items: center;
        box-shadow: 0 2px 8px rgba(0,0,0,.15);
    }
    /* Selector de fichero nativo: el <input> transparente cubre todo el botón, así el toque lo abre el sistema. */
    .mls-file-tap { position: relative; overflow: hidden; }
    .mls-file-tap input[type=file] {
        position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer;
        font-size: 100px; z-index: 2; -webkit-appearance: none; appearance: none;
    }
    .mls-file-tap.busy { opacity: .6; pointer-events: none; }
    .mls-cover-loading { display: grid; place-items: center; width: 100%; height: 100%; }
    .mls-cover-spinner-overlay {
        position: absolute; inset: 0; background: rgba(255,255,255,.78);
        -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px);
        display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
        font-size: .8rem; font-weight: 700; color: #1C1C1E; z-index: 3;
    }
    .mls-tpl-photo-card {
        position: relative; background: linear-gradient(145deg, #1C1C1E, #3A3A3C); color: #fff;
        flex-direction: column; gap: 4px;
    }
    .mls-tpl-photo-tag {
        position: absolute; left: 0; right: 0; bottom: 0; padding: 2px 4px;
        background: rgba(0,0,0,.62); color: #fff; font-size: .56rem; font-weight: 700; text-align: center;
    }
    .mls-envio-pill {
        background: #E8F7EE !important; color: #157A40 !important; font-weight: 700 !important;
    }

    /* Sub-barra de fechas en la preview móvil */
    /* Sin el botón redondo del menú (NavMenu .mobile-menu-btn) en el editor del móvil (1-dic-2026, el dueño): salía arriba a
       la izquierda a quien tiene cuenta y le quitaba sitio a la barra (antes «with-menu» la apartaba 62px). Como en el pedido
       (BookOptions, quick-mobile-checkout). */
    body:has(.mls-preview-topbar) .mobile-menu-btn { display: none !important; }
    /* Fija a la pantalla como la barra de arriba (1-dic-2026): ver el comentario en Editor.razor. Solo los botones reciben
       toques; el resto de la franja deja pasar el dedo al libro. */
    .mls-dates-subbar {
        position: fixed; top: calc(52px + env(safe-area-inset-top, 0px)); left: 0; right: 0; z-index: 950;
        display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 6px;
        padding: 4px 10px 8px; pointer-events: none;
    }
    .mls-dates-subbar > * { pointer-events: auto; }
    /* Su altura la copia app-parte-1.js de la franja del aviso (con el margen de debajo); sin aviso, 0. */
    .mls-dates-subbar-hueco { flex: 0 0 auto; height: 0; }
    .mls-dates-pill {
        display: inline-flex; align-items: center; gap: 6px;
        border: 1px solid #D1D1D6; background: rgba(255,255,255,.94); color: #1C1C1E;
        border-radius: 999px; padding: 5px 12px; font-size: .78rem; font-weight: 600;
        box-shadow: 0 2px 8px rgba(0,0,0,.05);
    }
    .mls-dates-edit-ico { font-size: .68rem; color: #007AFF; }
    /* Audios y vídeos con QR (30-nov-2026): icono en la pastilla de fechas (tachado si no van) y fila en su hoja */
    .mls-qr-ico { font-size: .78rem; color: #007AFF; position: relative; padding-left: 6px; border-left: 1px solid #E5E5EA; }
    .mls-qr-ico.off { color: #C7C7CC; }
    .mls-qr-ico.off::after { content: ""; position: absolute; left: 4px; right: -2px; top: 50%; border-top: 1.5px solid #8E8E93; transform: rotate(-40deg); }
    .mls-qr-row {
        display: flex; align-items: center; justify-content: space-between; gap: 12px;
        background: #F2F2F7; border-radius: 12px; padding: 10px 12px; margin: 4px 0 10px; cursor: pointer;
    }
    .mls-qr-txt { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
    .mls-qr-txt strong { font-size: .86rem; color: #1C1C1E; }
    .mls-qr-txt strong i { color: #007AFF; }
    .mls-qr-txt small { font-size: .72rem; color: #6C6C70; line-height: 1.3; }
    .mls-qr-switch { width: 2.6em !important; height: 1.45em !important; cursor: pointer; }
    .mls-savings-chip {
        display: inline-flex; align-items: center;
        background: #E8F7EE; color: #157A40; border-radius: 999px;
        padding: 4px 10px; font-size: .73rem; font-weight: 700;
    }

    .mls-cover-controls {
        flex: 0 0 auto; background: #FFFFFF; border-top-left-radius: 22px; border-top-right-radius: 22px;
        box-shadow: 0 -8px 28px rgba(0,0,0,.1);
        padding: 12px 14px calc(14px + env(safe-area-inset-bottom, 0px));
        display: flex; flex-direction: column; gap: 10px;
    }
    .mls-tpl-strip {
        display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px;
        -webkit-overflow-scrolling: touch; scrollbar-width: none;
    }
    .mls-tpl-strip::-webkit-scrollbar { display: none; }
    .mls-tpl-thumb {
        flex: 0 0 56px; width: 56px; height: 82px; border-radius: 9px; overflow: hidden;
        border: 2px solid transparent; padding: 0; cursor: pointer;
        display: flex; align-items: center; justify-content: center; font-size: .62rem; font-weight: 700;
        box-shadow: 0 2px 6px rgba(0,0,0,.08);
    }
    .mls-tpl-thumb.active { border-color: #007AFF; box-shadow: 0 0 0 2px rgba(0,122,255,.22); }
    .mls-tpl-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
    .mls-cover-title-row { display: flex; align-items: center; gap: 8px; }
    .mls-native-input {
        flex: 1 1 auto; min-width: 0; width: 100%; min-height: 44px; padding: 9px 12px;
        border-radius: 12px; border: 1.5px solid #D1D1D6; background: #F9F9FB;
        font-size: 16px !important; color: #1C1C1E; outline: none;
    }
    .mls-native-input:focus { border-color: #007AFF; background: #fff; }
    .mls-photo-btn {
        flex: 0 0 auto; display: inline-flex; align-items: center; gap: 5px;
        min-height: 44px; padding: 0 12px; border-radius: 12px;
        background: #EAF3FF; color: #007AFF; font-weight: 700; font-size: .82rem; cursor: pointer; margin: 0;
    }
    .mls-photo-clear {
        flex: 0 0 auto; width: 38px; height: 44px; border-radius: 12px; border: 0;
        background: #FFE5E5; color: #FF3B30; display: grid; place-items: center;
    }

    /* Preview FIJA 6 páginas + barra superior e inferior fija de pago */
    .mls-readonly-feed .message-actions,
    .mls-readonly-feed .insert-zone,
    .mls-readonly-feed .coach-mark-tooltip,
    .mls-readonly-feed .page-cut-mark { display: none !important; }
    .mls-preview-topbar { gap: 6px; }
    .mls-cols-pill {
        display: inline-flex; background: #F2F2F7; padding: 2px; border-radius: 10px; flex: 0 0 auto;
    }
    .mls-cols-pill button {
        border: 0; background: transparent; color: #6C6C70; font-size: .74rem; font-weight: 700;
        padding: 5px 8px; border-radius: 8px; min-height: 30px;
    }
    .mls-cols-pill button.active { background: #fff; color: #007AFF; box-shadow: 0 1px 3px rgba(0,0,0,.1); }
    .mls-cover-chip {
        flex: 0 0 auto; border: 0; background: #EAF3FF; color: #007AFF; border-radius: 999px;
        padding: 6px 10px; font-size: .76rem; font-weight: 700; min-height: 34px;
        display: inline-flex; align-items: center; gap: 4px;
    }
    .mls-pc-handoff-card {
        margin: 18px 8px 12px; padding: 20px 16px; border-radius: 18px;
        background: #FFFFFF; border: 1px solid #E5E5EA; text-align: center;
        box-shadow: 0 6px 20px rgba(0,0,0,.06);
    }
    .mls-pc-handoff-ico {
        width: 46px; height: 46px; border-radius: 14px; background: #EAF3FF; color: #007AFF;
        display: grid; place-items: center; font-size: 1.4rem; margin: 0 auto 10px;
    }
    .mls-pc-handoff-card h3 {
        font-size: 1.08rem !important; font-weight: 800 !important; color: #1C1C1E !important;
        margin: 0 0 6px !important; background: none !important; padding: 0 !important;
        border-radius: 0 !important; box-shadow: none !important; display: block !important;
    }
    .mls-pc-handoff-card p { font-size: .86rem; color: #6C6C70; line-height: 1.4; margin: 0 0 14px; }
    /* Se toca para abrir «Tamaño y fechas» (3-dic-2026): que se vea que es un botón. */
    .mls-pc-handoff-tocable { cursor: pointer; -webkit-tap-highlight-color: transparent; }
    .mls-pc-handoff-tocable:active { background: #F7F7FA; }
    .mls-pc-handoff-cambiar { width: auto; min-height: 40px; margin-top: 10px; }
    .mls-pc-btn { width: 100%; }

    .mls-mismatch-keep-btn { flex-direction: column !important; gap: 2px !important; min-height: 60px !important; padding: 10px 14px !important; }
    .mls-keep-title { font-size: 1rem; font-weight: 700; }
    .mls-keep-sub { font-size: .8rem; font-weight: 600; opacity: .9; }
    .mls-mismatch-other-label { margin: 14px 2px 6px; font-size: .78rem; font-weight: 700; color: #6C6C70; text-transform: uppercase; letter-spacing: .02em; }
    .mls-save-error {
        position: fixed; left: 12px; right: 12px; bottom: calc(84px + env(safe-area-inset-bottom, 0px)); z-index: 1001;
        display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-radius: 12px;
        background: #FFF1F0; color: #B42318; font-size: .82rem; font-weight: 600;
        box-shadow: 0 6px 18px rgba(0,0,0,.12);
    }
    .mls-save-error span { flex: 1 1 auto; }
    .mls-save-error button { border: 0; background: transparent; color: #B42318; font-size: 1rem; min-width: 32px; min-height: 32px; }
    .mls-sticky-paybar {
        position: fixed; left: 0; right: 0; bottom: 0; z-index: 1000;
        display: flex; align-items: center; justify-content: space-between; gap: 12px;
        padding: 10px 14px calc(10px + env(safe-area-inset-bottom, 0px));
        background: rgba(255,255,255,.94);
        -webkit-backdrop-filter: saturate(180%) blur(20px);
        backdrop-filter: saturate(180%) blur(20px);
        border-top: .5px solid rgba(0,0,0,.12);
        box-shadow: 0 -4px 16px rgba(0,0,0,.06);
    }
    .mls-paybar-info { display: flex; flex-direction: column; min-width: 0; }
    .mls-paybar-sub { font-size: .74rem; color: #6C6C70; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .mls-paybar-price { font-size: 1.12rem; font-weight: 800; color: #1C1C1E; line-height: 1.15; }
    .mls-paybar-price-row { display: flex; align-items: baseline; flex-wrap: wrap; column-gap: 6px; row-gap: 0; }
    .mls-paybar-envio { font-size: .7rem; font-weight: 700; color: #157A40; white-space: nowrap; }
    .mls-paybar-btn { flex: 0 0 auto; min-width: 156px; min-height: 48px !important; padding: 0 18px !important; }

    /* Bottom sheets inline (Correo+Contraseña, Fechas, Desajuste de páginas) por encima del banner de cookies */
    body:has(.mls-auth-sheet, .mls-sheet-panel) .cookie-barra,
    body:has(.mls-auth-sheet, .mls-sheet-panel) .cookie-modern-wrapper { display: none !important; }
    body:has(.mls-auth-sheet, .mls-sheet-panel) .hig-sheet-backdrop { z-index: 10035 !important; }
    .mls-auth-sheet,
    .mls-sheet-panel {
        position: fixed; left: 0; right: 0; bottom: 0; z-index: 10040 !important;
        background: #FFFFFF; border-radius: 22px 22px 0 0;
        box-shadow: 0 -12px 40px rgba(0,0,0,.22);
        max-height: 88dvh; overflow-y: auto; -webkit-overflow-scrolling: touch;
        padding: 0 16px calc(22px + env(safe-area-inset-bottom, 0px));
        font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, sans-serif;
    }
    .mls-auth-sheet .hig-sheet-chrome,
    .mls-sheet-panel .hig-sheet-chrome { background: #FFFFFF; }
    .mls-sheet-hint { font-size: .8rem; color: #6C6C70; margin: 0 0 10px; }
    /* «Más opciones» (30-nov-2026): secciones de la hoja y colores de las burbujas (LibroApp.Core.ColoresBurbujas) */
    .mls-sheet-section {
        display: flex; align-items: baseline; justify-content: space-between; gap: 8px;
        font-size: .74rem; font-weight: 700; letter-spacing: .02em; text-transform: uppercase; color: #8E8E93; margin: 6px 2px 8px;
    }
    .mls-sheet-section-val { text-transform: none; letter-spacing: 0; font-weight: 600; color: #3A3A3C; font-size: .8rem; }
    .mls-color-dots { display: inline-flex; gap: 2px; padding-left: 6px; border-left: 1px solid #E5E5EA; }
    .mls-color-dots i { width: 10px; height: 10px; border-radius: 50%; display: block; box-shadow: inset 0 0 0 1px rgba(0,0,0,.08); }
    .mls-colores { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 0 0 6px; }
    .mls-color-combo {
        display: flex; flex-direction: column; align-items: center; gap: 5px; padding: 8px 4px 6px;
        border: 2px solid #E5E5EA; border-radius: 14px; background: #fff; color: #3A3A3C; min-height: 44px;
    }
    .mls-color-combo.active { border-color: #007AFF; background: #F2F8FF; }
    .mls-color-combo small { font-size: .72rem; font-weight: 600; }
    .mls-cc-chat { display: flex; flex-direction: column; gap: 3px; width: 100%; padding: 0 4px; }
    .mls-cc-b { display: flex; align-items: center; height: 14px; border-radius: 7px; padding: 0 5px; width: 72%; }
    .mls-cc-b.mio { align-self: flex-end; }
    .mls-cc-b i { display: block; height: 2px; width: 70%; border-radius: 1px; opacity: .75; }
    .mls-colores-hint { font-size: .74rem; color: #8E8E93; margin: 0 2px 12px; }
    /* Botón con una segunda línea pequeña (precio o páginas) en la hoja de fechas (1-dic-2026) */
    .mls-btn-2lineas { flex-direction: column; gap: 1px; line-height: 1.2; height: auto !important; min-height: 50px; padding-top: 8px; padding-bottom: 8px; }
    .mls-btn-2lineas small { font-size: .74rem; font-weight: 600; opacity: .85; }
    /* Las dos fechas lado a lado SIN montarse (1-dic-2026, el dueño: «están el uno sobre el otro»). En el iPhone, Safari da
       al campo de fecha un ancho mínimo propio que no cabe en media pantalla: con «1fr» la columna crecía y el campo se salía
       encima del otro. minmax(0,1fr) + min-width:0 + sin el aspecto nativo los obliga a caber en su mitad. */
    .mls-date-inputs-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; margin-bottom: 10px; }
    .mls-date-inputs-grid .mls-auth-field { min-width: 0; margin-bottom: 0; }
    .mls-date-inputs-grid input[type="date"] {
        -webkit-appearance: none; appearance: none; display: block;
        width: 100%; min-width: 0; max-width: 100%; box-sizing: border-box; padding-left: 10px; padding-right: 8px; text-align: left;
    }
    .mls-date-inputs-grid input[type="date"]::-webkit-date-and-time-value { text-align: left; margin: 0; }
    .mls-date-feedback {
        border-radius: 12px; padding: 10px 12px; margin-bottom: 12px; font-size: .84rem;
        display: flex; flex-direction: column; gap: 3px;
    }
    .mls-date-feedback.ok { background: #E8F7EE; color: #155E34; }
    .mls-date-feedback.warn { background: #FFF4E5; color: #8A4B00; }
    .mls-date-mode-tag { font-size: .76rem; opacity: .8; }
    .mls-sheet-actions { display: flex; flex-direction: column; gap: 4px; }
    .mls-mismatch-lead { font-size: .86rem; color: #3A3A3C; line-height: 1.45; margin: 0 0 12px; }
    .mls-mismatch-options { display: flex; flex-direction: column; gap: 8px; }
    .mls-mismatch-card {
        display: flex; align-items: center; justify-content: space-between; gap: 10px;
        width: 100%; text-align: left; padding: 12px 14px; border-radius: 14px;
        border: 1.5px solid #E5E5EA; background: #F9F9FB; color: #1C1C1E;
    }
    .mls-mismatch-card.recommended {
        border-color: #007AFF; background: #EEF5FF;
    }
    .mls-mismatch-card-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
    .mls-mismatch-card-body strong { font-size: .92rem; font-weight: 700; color: #1C1C1E; }
    .mls-mismatch-card-body small { font-size: .78rem; color: #555; line-height: 1.3; }
    .mls-mismatch-badge {
        align-self: flex-start; font-size: .66rem; font-weight: 800; text-transform: uppercase;
        letter-spacing: .04em; background: #007AFF; color: #fff; border-radius: 999px;
        padding: 2px 7px; margin-bottom: 2px;
    }

    /* Arreglo móvil para la ventana .formato-ventana (nunca se corta en pantallas pequeñas) */
    .formato-fondo {
        align-items: flex-end !important;
        padding: 0 !important;
    }
    .formato-ventana {
        border-radius: 22px 22px 0 0 !important;
        max-height: 85dvh !important;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch;
        padding: 18px 14px calc(20px + env(safe-area-inset-bottom, 0px)) !important;
    }
    .formato-opciones { gap: 8px !important; }
    .formato-opcion { padding: 10px 8px !important; }
    .formato-mini { width: 64px !important; height: 84px !important; padding: 6px 5px !important; }
    .formato-dato { font-size: .8rem !important; }
    .mls-auth-summary {
        display: flex; align-items: center; justify-content: space-between; gap: 8px;
        background: #F2F2F7; border-radius: 12px; padding: 10px 12px; margin-bottom: 10px;
        font-size: .82rem; color: #3A3A3C;
    }
    .mls-auth-summary strong { color: #007AFF; font-size: .96rem; flex: 0 0 auto; }
    .mls-auth-lead { font-size: .85rem; color: #6C6C70; margin: 0 0 10px; }
    .mls-auth-switch { display: flex; justify-content: flex-end; margin: -2px 0 6px; }
    .mls-auth-switch-btn {
        border: 0; background: #EAF3FF; color: #007AFF; font-size: .78rem; font-weight: 600;
        padding: 5px 12px; border-radius: 999px;
    }
    .mls-auth-field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 10px; }
    .mls-auth-field label { font-size: .78rem; font-weight: 700; color: #3A3A3C; }
    .mls-auth-terms {
        display: flex; align-items: flex-start; gap: 8px; font-size: .78rem; color: #3A3A3C;
        margin: 4px 0 8px; cursor: pointer;
    }
    .mls-auth-terms input { width: 18px; height: 18px; margin-top: 2px; flex: 0 0 auto; }
    /* Hoja por pasos (2-dic-2026): privacidad sin casilla bajo el botón, enlaces pequeños y el código de 6 cifras */
    .mls-auth-terms-text { font-size: .74rem; color: #6C6C70; text-align: center; margin: 10px 4px 0; line-height: 1.4; }
    .mls-auth-terms-text a { color: #007AFF; }
    .mls-auth-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin: 12px 0 2px; }
    .mls-codigo-input { font: 700 1.6rem/1.2 ui-monospace, 'SF Mono', Menlo, monospace !important; letter-spacing: .45em;
        text-align: center; padding-left: .45em !important; }
}
@media (max-width: 767.98px) and (max-height: 700px) {
    .canva-sheet { max-height: 41dvh !important; }
    .canva-sheet-header { padding: 4px 8px 0 !important; }
    .canva-sheet-close { width: 28px !important; height: 28px !important; }
    .canva-add-text { padding: 7px 10px !important; margin-bottom: 6px !important; }
    .canva-text-presets { margin-bottom: 6px !important; }
    .canva-text-presets button { padding: 6px 4px !important; }
    .canva-fonts-row { margin-bottom: 4px !important; }
    .canva-colors-row { margin-bottom: 6px !important; }
    .canva-fmt-btn, .canva-size-input { height: 34px !important; }
    .phone-mockup { width: 204px !important; height: 292px !important; }
    .tutorial-wrapper h6 { min-height: 1.8em !important; margin-bottom: 4px !important; }
    .hig-tuto-topbar { margin-bottom: 4px !important; }
    .paginas-libro { height: 32px !important; margin-bottom: 2px !important; }
    .paginas-card { padding: 7px 6px !important; }
}

/* Móvil (28-nov-2026): sin el botón flotante de ayuda; el tutorial ya trae su propio "No consigo subir mi archivo"
   (InlineHelp), que abre el mismo panel. El flotante tapaba la barra de pago y la portada. */
@media (max-width: 767.98px) {
    .contact-widget-container .contact-trigger { display: none !important; }
}

/* Portada del móvil: la barra de arriba solo lleva el título (sin volver ni continuar), centrado. */
.mls-cover-topbar.mls-cover-topbar-solo { justify-content: center; }

/* Con el chat subido y sin guardar, sin "tirar hacia abajo para recargar" (Android; en iPhone según la versión). */
html.mldm-sin-recargar, html.mldm-sin-recargar body { overscroll-behavior-y: none; }

/* Móvil (29-nov-2026, el dueño): con la pantalla de carga o de guardado (al crear la cuenta y subir el libro) solo se ve esa
   pantalla. La barra de arriba y la de pagar son fijas y quedaban por encima (la pantalla va a z-index 990 para no tapar
   otras ventanas). Igual que ya se hacía en el ordenador con el menú lateral y el botón de ayuda. */
@media (max-width: 767.98px) {
    body:has(.progress-overlay) .mls-preview-topbar,
    body:has(.progress-overlay) .mls-sticky-paybar,
    body:has(.progress-overlay) .mobile-edge-bar,
    body:has(.progress-overlay) .mls-auth-sheet,
    body:has(.progress-overlay) .contact-widget-container { display: none !important; }
}

/* Libro a medias guardado en el móvil (30-nov-2026, Editor.razor «mob-recuperar»): por encima de todo, también de la
   portada (10025) y de la carga (2000000), que durante la recuperación siguen montadas debajo. */
.mls-rec-velo {
    position: fixed; inset: 0; z-index: 2000100; display: flex; align-items: flex-end; justify-content: center;
    background: rgba(28, 28, 30, .45); padding: 0 12px calc(12px + env(safe-area-inset-bottom));
}
.mls-rec-velo.mls-rec-cargando { align-items: center; background: #F2F2F7; }
.mls-rec-hoja {
    width: 100%; max-width: 440px; background: #fff; border-radius: 22px; padding: 22px 20px 16px; text-align: center;
    box-shadow: 0 12px 40px rgba(0, 0, 0, .18); font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", system-ui, sans-serif;
}
.mls-rec-cargando .mls-rec-hoja { box-shadow: none; background: transparent; }
.mls-rec-hoja h2 { font-size: 1.25rem; font-weight: 800; margin: 10px 0 6px; color: #1C1C1E; }
.mls-rec-hoja p { font-size: .95rem; color: #3A3A3C; margin: 0 0 16px; line-height: 1.4; }
.mls-rec-foto { width: 64px; height: 92px; object-fit: cover; border-radius: 8px; box-shadow: 0 4px 14px rgba(0, 0, 0, .15); }
.mls-rec-icono { font-size: 2.4rem; color: #007AFF; }
.mls-rec-si, .mls-rec-no { display: block; width: 100%; border: 0; border-radius: 14px; padding: 14px; font-size: 1.02rem; font-weight: 700; }
.mls-rec-si { background: #007AFF; color: #fff; margin-bottom: 8px; }
.mls-rec-no { background: transparent; color: #007AFF; font-weight: 600; }

/* Tramos de meses para un chat que no cabe ni en el libro más grande (30-nov-2026, Editor.razor «mob-tramos»). */
.mls-tramos { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin: 4px 0 14px; }
.mls-tramo { display: flex; align-items: center; gap: 6px; padding: 12px 10px; border-radius: 14px; border: 1.5px solid #007AFF;
    background: #fff; color: #007AFF; font-weight: 700; font-size: .9rem; text-align: left; text-transform: capitalize; }
.mls-tramo:active { background: #EAF3FF; }
/* «Preparando tu libro…» mientras se aplican fechas o formato sin la hoja de fechas delante (2-dic-2026) */
.mls-aplicando { position: fixed; inset: 0; z-index: 10050; display: flex; align-items: center; justify-content: center; gap: 10px;
                 background: rgb(0 0 0 / .28); color: #1c1c1e; font-weight: 700; font-size: .95rem; }
.mls-aplicando::before { content: ""; position: absolute; width: 230px; height: 56px; border-radius: 16px; background: #fff;
                         box-shadow: 0 10px 30px rgba(0,0,0,.2); z-index: -1; }
.mls-aplicando .spinner-border { color: #007AFF; }
/* El aviso «No cabe todo: tu libro acaba el…» se toca para ver las opciones. */
.mls-cortado-chip { border: 0; cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
/* «Portada» con más zona de toque (30-nov-2026: en una visita se tocó 14 veces el hueco de su izquierda, sin respuesta). */
.mls-cover-chip { position: relative; }
/* 1-dic-2026: a su izquierda está ahora «Más opciones»: la zona extra solo cubre el hueco entre los dos (antes 44px). */
.mls-cover-chip::before { content: ""; position: absolute; top: -10px; bottom: -10px; left: -6px; right: -6px; }
/* «Más opciones» dentro de la barra de arriba (1-dic-2026): compacta; si el idioma la alarga, el texto se corta con «…». */
.mls-preview-topbar .mls-dates-pill {
    flex: 0 1 auto; min-width: 0; min-height: 34px; padding: 6px 10px; gap: 5px; font-size: .76rem;
    white-space: nowrap; overflow: hidden; box-shadow: none; background: #F2F2F7; border-color: transparent;
}
.mls-preview-topbar .mls-dates-pill > span:not(.mls-color-dots) { overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.mls-preview-topbar .mls-dates-edit-ico { display: none; }

/* ===== Ventana «Tamaño y fechas» del ordenador (1-dic-2026; js/tamano-fechas.js, Editor.razor) =====
   Tras la portada: el tamaño del libro (tarjetas como las de «¿Cuántas páginas quieres?») y el tramo del chat con un
   deslizador sobre la línea del tiempo (barras = páginas de cada trozo del chat). */
.tf-fondo { position: fixed; inset: 0; background: rgb(0 0 0 / .6); display: flex; align-items: center; justify-content: center; z-index: 1000; padding: 16px; }
.tf-ventana { background: #fff; border-radius: 18px; width: 100%; max-width: 720px; max-height: calc(100vh - 32px); display: flex; flex-direction: column;
              box-shadow: 0 24px 60px rgba(15, 23, 42, .25); overflow: hidden; }
.tf-cabecera { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; padding: 18px 24px 12px; border-bottom: 1px solid #e5e5ea; }
.tf-cabecera h4 { margin: 0; font-size: 1.18rem; font-weight: 800; letter-spacing: -.01em; }
.tf-chip { font-size: .78rem; font-weight: 600; color: #6c6c70; background: #f2f2f7; padding: 5px 11px; border-radius: 999px; }
.tf-cuerpo { padding: 16px 24px 18px; overflow-y: auto; }
.tf-fila { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.tf-etiqueta { font-size: .8rem; font-weight: 700; color: #3a3a3c; text-transform: uppercase; letter-spacing: .03em; }
.tf-cols { display: inline-flex; background: #f2f2f7; padding: 3px; border-radius: 10px; gap: 3px; }
.tf-cols button { border: 0; background: transparent; color: #3a3a3c; font-size: .8rem; font-weight: 600; padding: 6px 12px; border-radius: 8px; cursor: pointer; }
.tf-cols button.on { background: #fff; color: #1a73e8; font-weight: 700; box-shadow: 0 1px 4px rgba(0,0,0,.1); }
.tf-niveles { display: grid; grid-template-columns: repeat(var(--tf-cols, 4), minmax(0, 1fr)); gap: 10px; margin-bottom: 18px; }
.tf-nivel { position: relative; border: 2px solid #e3e6ea; border-radius: 14px; background: #fff; padding: 14px 6px 11px; cursor: pointer;
            display: flex; flex-direction: column; align-items: center; gap: 2px; transition: border-color .15s, background .15s; }
.tf-nivel:hover { border-color: #b9d3fb; }
.tf-nivel.sel { border-color: #1a73e8; background: #f3f8ff; box-shadow: 0 6px 16px rgba(26,115,232,.12); }
.tf-cabe { position: absolute; top: -10px; background: #157a40; color: #fff; font-size: .64rem; font-weight: 800; padding: 2px 9px; border-radius: 999px;
           text-transform: uppercase; letter-spacing: .03em; white-space: nowrap; }
.tf-libro { display: flex; height: 40px; margin-bottom: 6px; filter: drop-shadow(0 3px 5px rgba(0,0,0,.16)); }
.tf-libro .lomo { width: var(--grosor, 6px); background: linear-gradient(90deg, #b85c4a, #d77d69); border-radius: 3px 0 0 3px; }
.tf-libro .tapa { width: 30px; background: linear-gradient(160deg, #fbe3d3, #f4b8a4 60%, #e99a86); border-radius: 0 4px 4px 0; }
.tf-nivel-nombre { font-size: .64rem; color: #8a8a90; font-weight: 700; text-transform: uppercase; letter-spacing: .4px; text-align: center; }
.tf-nivel-paginas { font-size: .9rem; font-weight: 700; color: #1a1a1a; }
.tf-nivel-precio { font-size: 1.08rem; font-weight: 800; color: #1a73e8; }
.tf-linea { background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 16px; padding: 16px 16px 14px; margin-bottom: 12px; }
.tf-linea-arriba { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.tf-rango { font-size: 1.04rem; font-weight: 800; color: #1c1c1e; letter-spacing: -.01em; }
.tf-sub { font-size: .82rem; color: #6c6c70; margin-top: 2px; }
.tf-duracion { padding: 5px 12px; border-radius: 999px; font-size: .8rem; font-weight: 700; background: #eaf3ff; color: #0f5bc4; white-space: nowrap; }
.tf-duracion.todo { background: #e8f7ee; color: #157a40; }
.tf-escenario { position: relative; height: 78px; margin: 6px 4px 4px; user-select: none; touch-action: none; cursor: pointer; }
.tf-histograma { position: absolute; left: 0; right: 0; top: 4px; bottom: 18px; display: flex; align-items: flex-end; gap: 2px; pointer-events: none; }
.tf-barra { flex: 1 1 0; background: #cbd5e1; border-radius: 2px 2px 0 0; transition: background .12s; }
.tf-barra.in { background: rgba(26, 115, 232, .55); }
.tf-pista { position: absolute; left: 0; right: 0; bottom: 5px; height: 8px; border-radius: 999px; background: #e2e8f0; pointer-events: none; }
.tf-tramo { position: absolute; top: 0; bottom: 0; background: rgba(26, 115, 232, .10); border: 2px solid #1a73e8; border-radius: 12px; cursor: grab;
            display: flex; align-items: center; justify-content: center; outline: none; }
.tf-tramo:focus-visible { box-shadow: 0 0 0 4px rgba(26,115,232,.25); }
.tf-arrastrando .tf-tramo { cursor: grabbing; box-shadow: 0 0 0 4px rgba(26,115,232,.16); }
.tf-arrastrando, .tf-arrastrando * { user-select: none; }
.tf-asa { background: #1a73e8; color: #fff; font-size: .68rem; font-weight: 700; padding: 2px 8px; border-radius: 999px; pointer-events: none;
          white-space: nowrap; box-shadow: 0 2px 6px rgba(26,115,232,.3); }
.tf-borde { position: absolute; top: 50%; width: 22px; height: 36px; border-radius: 9px; background: #fff; border: 2.5px solid #1a73e8;
            box-shadow: 0 3px 10px rgba(0,0,0,.16); cursor: ew-resize; display: flex; align-items: center; justify-content: center; z-index: 2; outline: none; }
.tf-borde::after { content: ""; width: 4px; height: 13px; border-left: 1.5px solid #1a73e8; border-right: 1.5px solid #1a73e8; }
.tf-borde-izq { left: 0; transform: translate(-50%, -50%); }
.tf-borde-der { left: 100%; transform: translate(-50%, -50%); }
.tf-borde:hover, .tf-borde:focus-visible { box-shadow: 0 0 0 4px rgba(26,115,232,.22), 0 3px 10px rgba(0,0,0,.16); }
.tf-ejes { display: flex; justify-content: space-between; font-size: .74rem; color: #6c6c70; margin: 2px 4px 0; }
.tf-aviso { display: none; align-items: center; justify-content: space-between; gap: 10px; margin-top: 10px; padding: 8px 12px; border-radius: 10px;
            background: #fef3c7; color: #92400e; font-size: .82rem; font-weight: 600; }
.tf-aviso.ver { display: flex; }
.tf-aviso button { border: 0; background: #b45309; color: #fff; font-size: .76rem; font-weight: 700; padding: 6px 11px; border-radius: 8px; cursor: pointer; white-space: nowrap; }
.tf-nota { display: flex; align-items: center; gap: 9px; font-size: .84rem; color: #4b5563; padding: 9px 12px; background: #f3f8ff; border-radius: 10px; }
.tf-nota b { flex: 0 0 18px; height: 18px; border-radius: 50%; background: #1a73e8; color: #fff; display: grid; place-items: center; font-size: .7rem; }
.tf-pie { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 14px 24px 18px; border-top: 1px solid #e5e5ea; background: #fafafc; }
.tf-resumen { display: flex; flex-direction: column; }
.tf-resumen strong { font-size: 1.05rem; color: #1c1c1e; }
.tf-resumen span { font-size: .78rem; color: #6c6c70; }
.tf-continuar { font-weight: 700; padding: 11px 22px; border-radius: 12px; }
@media (max-width: 600px) {
    .tf-niveles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .tf-cuerpo, .tf-cabecera, .tf-pie { padding-left: 16px; padding-right: 16px; }
}

/* ===== Ventana «Tamaño y fechas»: lupa, atajos, día exacto, «Cambiar fechas» y hoja del móvil (2-dic-2026) ===== */
.tf-cabecera { position: relative; }
/* Con la ventana abierta, ni la ayuda ni la barra de cookies (abajo a la derecha, z-index 9999) tapan «Ver mi libro». */
body:has(.tf-fondo) .fab-container { display: none !important; }
.tf-cerrar { border: 0; background: #f2f2f7; width: 32px; height: 32px; border-radius: 50%; color: #6c6c70; font-size: .95rem; flex: 0 0 32px;
             display: grid; place-items: center; cursor: pointer; margin-left: auto; }
.tf-textos { min-width: 0; }
button.tf-rango { border: 0; background: none; padding: 0; text-align: left; cursor: pointer; color: #1c1c1e; }
button.tf-rango:hover { color: #1a73e8; }
.tf-exacto { display: none; gap: 10px; margin: 4px 0 10px; }
.tf-exacto.ver { display: flex; }
.tf-exacto-campo { flex: 1 1 0; display: flex; flex-direction: column; gap: 3px; font-size: .72rem; font-weight: 700; color: #6c6c70;
                   text-transform: uppercase; letter-spacing: .03em; margin: 0; }
.tf-exacto-campo input { font-size: .9rem; padding: 6px 8px; border: 1px solid #d1d5db; border-radius: 9px; background: #fff; color: #1c1c1e; width: 100%; }
/* Tramo estrecho en la línea grande: sin bordes (los tiene la lupa) ni etiqueta, un poco más relleno para verlo. */
.tf-escenario.tf-estrecha .tf-borde, .tf-escenario.tf-estrecha .tf-asa { display: none; }
.tf-escenario.tf-estrecha .tf-tramo { background: rgba(26, 115, 232, .22); }
.tf-lupa { display: none; margin-top: 12px; padding-top: 10px; border-top: 1px dashed #d5dbe3; }
.tf-lupa.ver { display: block; }
.tf-lupa-cab { font-size: .76rem; font-weight: 700; color: #3a3a3c; margin-bottom: 2px; }
.tf-atajos { display: flex; gap: 8px; margin-top: 10px; }
.tf-atajos button { flex: 1 1 0; border: 1.5px solid #cfe0fb; background: #fff; color: #1a73e8; border-radius: 11px; padding: 7px 6px;
                    font-size: .8rem; font-weight: 700; cursor: pointer; }
.tf-atajos button:hover { background: #f3f8ff; }
.tf-pista-texto { font-size: .78rem; color: #6c6c70; text-align: center; margin: 0 0 10px; }

/* La hoja de abajo del móvil (Editor.razor, tf-fondo-movil). Encima de las otras hojas (10040) y debajo de «Preparando…» (10050). */
.tf-fondo.tf-fondo-movil { z-index: 10045; align-items: flex-end; padding: 0; background: rgb(0 0 0 / .38); }
.tf-ventana.tf-movil { max-width: none; max-height: 92dvh; border-radius: 22px 22px 0 0; box-shadow: 0 -12px 40px rgba(0,0,0,.22);
                       font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, sans-serif; }
.tf-movil .tf-asidero { position: absolute; top: 7px; left: 50%; transform: translateX(-50%); width: 38px; height: 5px; border-radius: 3px; background: #d1d1d6; }
.tf-movil .tf-cabecera { padding: 20px 16px 8px; flex-wrap: wrap; align-items: flex-start; gap: 6px 10px; }
.tf-movil .tf-cabecera h4 { font-size: 1.05rem; flex: 1 1 calc(100% - 44px); line-height: 1.25; }
.tf-movil .tf-chip { order: 3; }
.tf-movil .tf-cuerpo { padding: 12px 16px 6px; }
.tf-movil .tf-fila { margin-bottom: 8px; }
.tf-movil .tf-niveles { grid-template-columns: repeat(var(--tf-cols, 4), minmax(0, 1fr)); gap: 7px; margin-bottom: 10px; }
.tf-movil .tf-nivel { padding: 9px 2px 7px; border-radius: 13px; }
.tf-movil .tf-libro { height: 22px; margin-bottom: 3px; }
.tf-movil .tf-libro .tapa { width: 17px; }
.tf-movil .tf-nivel-nombre { display: none; }
.tf-movil .tf-nivel-paginas { font-size: .8rem; }
.tf-movil .tf-nivel-precio { font-size: .86rem; }
.tf-movil .tf-cabe { font-size: .55rem; padding: 2px 7px; top: -9px; }
.tf-movil .tf-linea { padding: 12px 12px 10px; }
.tf-movil .tf-rango { font-size: .98rem; }
.tf-movil .tf-escenario { height: 78px; margin: 10px 14px 2px; }
.tf-movil .tf-lupa { margin-top: 8px; padding-top: 8px; }
.tf-movil .tf-lupa .tf-escenario { height: 72px; }
.tf-movil .tf-borde { width: 24px; height: 44px; }
.tf-movil .tf-borde::before { content: ""; position: absolute; inset: -10px -14px; }   /* zona de toque más grande que el dibujo */
.tf-movil .tf-nota { display: none; }
.tf-movil .tf-pie { position: sticky; bottom: 0; flex-direction: column; align-items: stretch; gap: 6px;
                    padding: 10px 16px calc(14px + env(safe-area-inset-bottom, 0px)); }
.tf-movil .tf-resumen { flex-direction: row; justify-content: center; }
.tf-movil .tf-resumen strong { white-space: nowrap; }
.tf-movil .tf-resumen span { display: none; }   /* las fechas ya van arriba, en grande */
.tf-movil .tf-continuar { width: 100%; padding: 13px; border-radius: 14px; font-size: 1rem; background: #007AFF; border-color: #007AFF; }

/* Barra lateral del ordenador: resumen del libro + «Cambiar fechas» (sustituye al deslizador de páginas y a las dos fechas). */
.libro-resumen { background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 14px; padding: 12px 14px; margin-bottom: 14px; }
.libro-resumen-cifras { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.libro-resumen-cifras strong { font-size: 1rem; color: #1c1c1e; }
.libro-resumen-precio { font-size: 1.05rem; font-weight: 800; color: #1a73e8; }
.libro-resumen-fechas { font-size: .8rem; color: #4b5563; margin: 4px 0 10px; line-height: 1.35; }
.libro-resumen-boton { font-weight: 700; border-radius: 10px; }

/* Hoja «Más opciones» del móvil: el tamaño del libro y «Cambiar fechas» (en vez de los dos calendarios). */
.mls-fechas-resumen { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 4px 0 14px;
                      font-size: .88rem; font-weight: 600; color: #3a3a3c; }
.mls-cambiar-fechas { white-space: nowrap; padding: 9px 14px !important; }

/* «Ampliar con mi ZIP» (1-dic-2026): bajo las fechas de un libro guardado solo con su tramo (Editor.razor, PuedeAmpliarConSuZip). */
.zip-ampliar { margin-top: 8px; display: flex; flex-direction: column; gap: 6px; font-size: .78rem; line-height: 1.4; color: #4b5563; background: #f3f8ff; border-radius: 8px; padding: 8px 10px; }
.zip-ampliar label { align-self: flex-start; cursor: pointer; margin: 0; }
