:root {
    --primary-gradient: linear-gradient(135deg, #2D3EAF 0%, #7B3FE4 100%);
    --brand-purple: #7B3FE4;
    --brand-blue: #2D3EAF;
    --brand-gradient: linear-gradient(135deg, #2D3EAF, #7B3FE4);
    --accent-color: #7B3FE4;
    --text-main: #1A1A2E;
    --text-light: #64748B;
    --bg-page: #FFFFFF;
    --bg-app: #FFFFFF;
    /* Fondo totalmente blanco y limpio */
    --border-color: #E2E8F0;
    --page-width: 800px;
    --page-height: 1131px;
    --logo-size: 240px;
    --logo-small-size: 60px;
}

/* Animaciones Globales de Transición Premium */
@keyframes viewFadeIn {
    from {
        opacity: 0;
        transform: scale(0.985);
        filter: blur(10px);
    }

    to {
        opacity: 1;
        transform: scale(1);
        filter: blur(0);
    }
}

#dashboard-view,
#editor-view,
.view-transition {
    animation: viewFadeIn 0.7s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

#editor-view {
    transition: opacity 0.8s cubic-bezier(0.16, 1, 0.3, 1) !important;
}

html {
    scroll-behavior: smooth;
}

/* Efectos de Hover Premium - Fluidez Total */
.btn-premium,
.contract-card,
.stat-pill,
.catalog-item,
.main-header,
.design-side-panel,
.s2-client-card {
    transition: all 0.5s cubic-bezier(0.16, 1, 0.3, 1) !important;
}

.btn-premium:hover,
.btn-modal-primary:hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 10px 25px rgba(123, 63, 228, 0.25);
}

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

.gradient-text {
    color: var(--brand-purple);
    font-weight: 800;
    transition: all 0.3s ease;
}

.theme-3 .gradient-text {
    background: linear-gradient(90deg, #ffffff 0%, #60a5fa 50%, #c084fc 100%) !important;
    -webkit-background-clip: text !important;
    -webkit-text-fill-color: transparent !important;
    background-clip: text !important;
    display: inline-block;
}

.theme-3 {
    --bg-page: linear-gradient(135deg, #0f172a 0%, #1e1b4b 100%);
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --brand-purple: #c084fc;
    /* Morado mucho más brillante para modo oscuro */
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Outfit', sans-serif;
}

/* Forzar que NADA en la plataforma use colores fuera de marca */
input[type="range"] {
    accent-color: #7B3FE4;
    /* Official Purple */
    cursor: pointer;
}

/* Estilo avanzado para Sliders (Chrome/Safari/Edge) */
input[type="range"]::-webkit-slider-runnable-track {
    background: #E2E8F0;
    height: 6px;
    border-radius: 10px;
}

input[type="range"]::-webkit-slider-thumb {
    appearance: none;
    width: 18px;
    height: 18px;
    background: #7B3FE4;
    border-radius: 50%;
    margin-top: -6px;
    box-shadow: 0 2px 8px rgba(123, 63, 228, 0.3);
    border: 2px solid white;
}

body {
    background-color: #FFFFFF;
    color: var(--text-main);
    margin: 0;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    min-height: 100vh;
}

/* --- BRAND SCROLLBARS --- */
/* Firefox */
* {
    scrollbar-width: thin;
    scrollbar-color: var(--accent-color) #f1f5f9;
}

/* Chrome, Edge, Safari */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: #f8fafc;
    border-radius: 10px;
}

::-webkit-scrollbar-thumb {
    background: var(--primary-gradient);
    border-radius: 10px;
    border: 2px solid #f8fafc;
    /* Crea un efecto de separación */
}

::-webkit-scrollbar-thumb:hover {
    filter: brightness(1.2);
    border: 1px solid #f8fafc;
}

/* Header Premium - Glassmorphism */
.main-header {
    background: rgba(255, 255, 255, 0.75);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    height: 80px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.3);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 15px;
    position: fixed;
    top: 0;
    width: 100%;
    z-index: 999999;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.04);
}

.brand-area {
    display: flex;
    align-items: center;
    gap: 15px;
    /* Reducido */
}

.template-selector {
    display: flex;
    gap: 5px;
    /* Reducido */
}

.history-controls {
    display: flex;
    gap: 5px;
    margin-right: 5px;
    /* Reducido */
}

.logo-main {
    height: 32px;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    /* Reducido drásticamente para evitar overflow */
}

.client-name-input-wrapper {
    display: flex;
    align-items: center;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 6px 10px;
    /* Reducido */
    height: 48px;
    box-sizing: border-box;
    transition: all 0.2s;
    margin-right: 5px;
    /* Reducido */
}

.client-name-input-wrapper:focus-within {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(123, 63, 228, 0.1);
    background: white;
}

.client-icon {
    font-size: 1.1rem;
    margin-right: 6px;
    opacity: 0.6;
}

.global-client-name {
    border: none;
    background: transparent;
    font-family: 'Montserrat', sans-serif;
    font-weight: 600;
    font-size: 0.95rem;
    color: #1A1A2E;
    width: 140px;
    /* Reducido para que quepa todo */
    outline: none;
}

.global-client-name::placeholder {
    color: #94a3b8;
    font-weight: 500;
}

/* --- DROPDOWN MENUS --- */
.dropdown {
    position: relative;
    display: inline-block;
}

.dropdown-content {
    display: none;
    position: absolute;
    background-color: #ffffff;
    min-width: 180px;
    box-shadow: 0px 8px 25px 0px rgba(0, 0, 0, 0.1);
    z-index: 1000000;
    border-radius: 12px;
    overflow: hidden;
    top: 100%;
    right: 0;
    border: 1px solid #e2e8f0;
    padding: 8px 0;
}

.template-selector.dropdown .dropdown-content {
    left: 0;
    right: auto;
}

.dropdown-content a {
    color: #1e293b;
    padding: 10px 16px;
    text-decoration: none;
    display: block;
    font-size: 0.9rem;
    font-weight: 500;
    transition: background 0.2s;
}

.dropdown-content a:hover {
    background-color: #f1f5f9;
    color: var(--accent-color);
}

.dropdown-divider {
    height: 1px;
    background-color: #e2e8f0;
    margin: 4px 0;
}

.dropdown:hover .dropdown-content {
    display: block;
    animation: fadeIn 0.15s ease-out;
}

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

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

.logo-area {
    display: flex;
    align-items: center;
}

.brand-logo-nav {
    height: 45px;
    width: auto;
    object-fit: contain;
}

/* Document Container */
#document-container {
    margin-top: 75px;
    /* Altura del header */
    margin-left: 300px;
    /* Ancho del panel lateral */
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 60px 20px 200px;
    background: #FFFFFF;
    transition: margin 0.3s ease;
}

/* Empty State Placeholder (Light Mode) */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 80px 40px;
    text-align: center;
    max-width: 600px;
    margin: 40px auto;
    background: rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 2px dashed rgba(123, 63, 228, 0.1);
    border-radius: 40px;
    color: #64748B;
    animation: fadeIn 0.5s ease-out;
    position: relative;
    z-index: 10;
}

.empty-state span {
    font-size: 4rem;
    margin-bottom: 20px;
    filter: drop-shadow(0 0 20px rgba(123, 63, 228, 0.1));
}

.empty-state h3 {
    font-size: 1.8rem;
    color: #1A1A2E;
    margin-bottom: 12px;
}

.empty-state p {
    font-size: 1.1rem;
    line-height: 1.6;
    color: #94A3B8;
}

#zoom-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 60px;
    /* Páginas separadas (despegadas) siempre */
    width: 100%;
    transform-origin: top center;
}

/* QUITAR BORDES LUMINOSOS EN MODO CLIENTE */
body.client-mode .page::before {
    display: none !important;
}

body.client-mode .page {
    will-change: transform, opacity;
    transform: translateZ(0);
    contain: layout paint style;
    position: relative;
    overflow: hidden;
    will-change: transform, opacity;
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
    backface-visibility: hidden;
    box-shadow: 0 5px 25px rgba(0, 0, 0, 0.05) !important;
    /* Sombra sutil de papel, sin marco */
    border: none !important;

    /* FIX DE MEMORIA GPU: Forzar a que la página no se "descargue" al hacer scroll */
    will-change: transform, opacity;
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
}

body.client-mode #document-container {
    margin-left: 0;
    flex: initial;
    min-height: auto;
    padding-bottom: 80px;
    /* Reducido de 200px para evitar espacio infinito */
}

body.client-mode #design-panel {
    display: none !important;
}

body.client-mode .page-controls {
    display: none !important;
}

body.client-mode .editable {
    border: none !important;
    background: transparent !important;
    pointer-events: none !important;
    /* Evitar edición accidental del cliente */
}

/* OCULTAR TODOS LOS CONTROLES DEL DOCK DE DISEÑO EN MODO CLIENTE */
body.client-mode .header-actions>*:not(#btn-client-save):not(#toggle-client-mode) {
    display: none !important;
}

/* MOSTRAR SOLO EL BOTÓN DE ENVIAR DEL CLIENTE */
#btn-client-save {
    display: none;
    background: #10B981;
    color: white;
    font-weight: 800;
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3);
}

body.client-mode #btn-client-save {
    display: block !important;
}

#btn-client-save:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(16, 185, 129, 0.4);
}

/* Permitir clics SOLO en las firmas (porque arriba desactivamos el pointer para .editable) */
body.client-mode .sig-canvas {
    pointer-events: all !important;
}

body.client-mode .btn-clear-sig {
    pointer-events: all !important;
}

/* GLOBAL FIX: Prevent horizontal scroll on all devices */
html,
body {
    max-width: 100% !important;
    overflow-x: hidden !important;
    margin: 0;
    padding: 0;
    position: relative;
}

#document-container {
    overflow-x: hidden !important;
}

/* Fondo decorativo de marca */
#document-container::before {
    content: '';
    position: fixed;
    top: 50%;
    left: 50%;
    width: 600px;
    height: 600px;
    background: linear-gradient(135deg, rgba(45, 62, 175, 0.05) 0%, rgba(123, 63, 228, 0.05) 100%);
    filter: blur(100px);
    transform: translate(-50%, -50%);
    z-index: -1;
}

.page {
    will-change: transform, opacity;
    transform: translateZ(0);
    contain: layout paint style;
    position: relative;
    overflow: hidden;
    will-change: transform, opacity;
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
    backface-visibility: hidden;
    position: relative;
    width: var(--page-width);
    height: var(--page-height);
    background: white;
    flex-shrink: 0;
    transition: transform 0.3s cubic-bezier(0.165, 0.84, 0.44, 1);
    z-index: 1;
}

/* EL BORDE LUMINOSO COMO CAPA SEPARADA */
.page::before {
    content: '';
    position: absolute;
    top: -4px;
    left: -4px;
    right: -4px;
    bottom: -4px;
    background: linear-gradient(135deg, #2D3EAF, #7B3FE4, #2D3EAF);
    background-size: 200% 200%;
    animation: flowGradient 5s linear infinite;
    border-radius: 8px;
    z-index: -1;
    opacity: 1;
    box-shadow: 0 0 30px rgba(45, 62, 175, 0.2);
}

/* Fix de Viñetas para exportación - Máxima Paridad */
.export-bullet-dot {
    display: inline-block;
    width: 7px;
    height: 7px;
    background-color: var(--accent-color);
    border-radius: 50%;
    margin-right: 15px;
    vertical-align: middle;
    flex-shrink: 0;
}

@keyframes flowGradient {
    0% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }

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

/* El contenido blanco puro encima del brillo */
.page::after {
    display: none;
    /* Ya no es necesario con el nuevo sistema */
}

.page-controls {
    position: absolute;
    right: -45px;
    top: 0;
    display: flex;
    flex-direction: column;
    gap: 15px;
    z-index: 999999;
}

.btn-delete.page {
    will-change: transform, opacity;
    transform: translateZ(0);
    contain: layout paint style;
    position: relative;
    overflow: hidden;
    will-change: transform, opacity;
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
    backface-visibility: hidden;
    background: white;
    color: #ef4444;
    border: 1px solid #fee2e2;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    transition: all 0.2s ease;
}

.btn-delete-page:hover {
    background: #fee2e2;
    transform: scale(1.1);
}

/* Page Area */
.page-content {
    width: 100%;
    height: 100%;
    background: var(--bg-page);
    position: relative;
    overflow: hidden;
    padding: var(--page-padding-top, 60px) 60px 150px;
    /* Aumentado de 110px a 150px para evitar solapamientos con textos grandes */
    display: flex;
    flex-direction: column;
    z-index: 1;
    /* Por encima del fondo blanco del borde */
}

.bg-blobs {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    z-index: 0;
    pointer-events: none;
}

.blob {
    position: absolute;
    filter: blur(80px);
    opacity: 0.15;
    border-radius: 50%;
}

.blob-1 {
    width: 500px;
    height: 500px;
    background: #2D3EAF;
    top: -100px;
    right: -100px;
}

.blob-2 {
    width: 400px;
    height: 400px;
    background: #7B3FE4;
    bottom: -50px;
    left: -50px;
}

/* Components */
.cover-layout {
    position: relative;
    z-index: 1;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.brand-logo-main {
    width: var(--logo-size);
    height: auto;
    margin-top: 80px;
    /* Bajado para centrar mejor la portada */
    margin-bottom: 60px;
    /* Más espacio con el título */
}

.brand-logo-small {
    height: 35px;
    width: auto;
}

/* PANEL DE DISEÑO GLOBAL - GLASSMORPHISM */
.design-side-panel {
    position: fixed;
    left: 20px;
    top: 95px;
    width: 260px;
    max-height: calc(100vh - 120px);
    overflow-y: auto;
    background: rgba(255, 255, 255, 0.75);
    backdrop-filter: blur(25px) saturate(180%);
    -webkit-backdrop-filter: blur(25px) saturate(180%);
    padding: 30px;
    border-radius: 28px;
    border: 1px solid rgba(255, 255, 255, 0.4);
    z-index: 9000;
    display: flex;
    flex-direction: column;
    gap: 25px;
    transition: all 0.5s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.05);
}

/* Scrollbar elegante para el panel */
.design-side-panel::-webkit-scrollbar {
    width: 4px;
}

.design-side-panel::-webkit-scrollbar-thumb {
    background: rgba(123, 63, 228, 0.2);
    border-radius: 10px;
}

body.client-mode .design-side-panel {
    transform: translateX(-300px);
    opacity: 0;
    pointer-events: none;
}

.panel-header h3 {
    font-size: 1rem;
    color: #1A1A2E;
    margin-bottom: 5px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.panel-header h3::before {
    content: '✨';
}

/* Cambiamos el icono de paleta por brillo de marca */
.panel-header p {
    font-size: 0.75rem;
    color: #64748B;
}

.panel-section {
    border-bottom: 1px solid #F1F5F9;
    padding-bottom: 20px;
}

.panel-section label {
    display: block;
    font-size: 0.7rem;
    font-weight: 800;
    color: #94A3B8;
    margin-bottom: 12px;
    letter-spacing: 1px;
}

.control-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.control-row span {
    font-size: 0.7rem;
    color: #64748B;
}

.control-row input {
    flex: 1;
}

.panel-hint {
    font-size: 0.65rem;
    color: #94A3B8;
    margin-top: 10px;
    font-style: italic;
}

.resize-sidebar {
    display: none !important;
}

/* Adiós a los anteriores */

/* Eliminamos el hover ya que ahora es permanente */

.resize-sidebar label {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-light);
    text-transform: uppercase;
}

.cover-title {
    margin-top: 60px;
}

.cover-title h2 {
    font-size: 4rem;
    line-height: 1;
    font-weight: 800;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.cover-title h2:focus {
    background: none;
    -webkit-text-fill-color: var(--text-main);
    color: var(--text-main);
}

.divider {
    width: 80px;
    height: 8px;
    background: var(--primary-gradient);
    margin: 25px 0;
    border-radius: 4px;
}

.subtitle {
    font-size: 1.1rem;
    color: var(--accent-color);
    letter-spacing: 2px;
    font-weight: 600;
}

.cover-footer {
    border-left: 4px solid var(--accent-color);
    padding-left: 20px;
    margin-top: auto;
}

.client-info {
    font-size: 1.5rem;
    font-weight: 600;
}

.date-info {
    color: var(--text-light);
    margin-top: 5px;
}

.content-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid #F1F5F9;
    padding-bottom: 15px;
    /* Reducido */
    margin-bottom: 15px;
    /* Reducido */
}

.header-tag {
    font-size: 0.65rem;
    /* Más minimalista */
    letter-spacing: 2px;
    /* Más aireado y elegante */
    color: var(--text-light);
    text-transform: uppercase;
    font-weight: 600;
}

.content-body h3 {
    color: var(--accent-color);
    margin-top: 10px;
    /* Reducido */
    margin-bottom: 15px;
    /* Reducido */
    font-size: 1.4rem;
    font-weight: 700;
}

.content-body p {
    line-height: 1.6;
    color: #334155;
    font-size: 1.25rem;
    margin-bottom: 1rem;
    /* Reducido para subir contenido */
}

.content-body ul {
    list-style: none;
    padding-left: 5px;
}

.content-body ul li {
    font-size: 1.2rem;
    line-height: 1.6;
    color: #475569;
    margin-bottom: 15px;
    position: relative;
    padding-left: 35px;
}

.content-body ul li::before {
    content: "•";
    position: absolute;
    left: 0;
    color: var(--accent-color);
    font-weight: 900;
    font-size: 1.8rem;
    line-height: 1;
    top: -2px;
}

.content-footer {
    margin-top: 30px;
    /* Más espacio arriba */
    text-align: right;
    font-size: 0.85rem;
    color: var(--text-light);
    opacity: 0.8;
    padding-bottom: 5px;
    /* Pequeño respiro abajo */
}

/* Signatures */
.signature-layout {
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
}

.signature-top h3 {
    font-family: 'Outfit', sans-serif !important;
    font-size: 2.5rem;
    /* Ajustado para balance */
    font-weight: 800;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 5px;
    padding: 10px;
    display: block !important;
}

.signature-top p {
    font-size: 0.8rem;
    color: var(--text-light);
    white-space: normal;
    /* Permitir saltos de línea en móvil */
    line-height: 1.5;
    opacity: 0.9;
    margin-bottom: 30px;
    letter-spacing: 0.5px;
    width: 100%;
    padding: 0 15px;
    /* Evitar que choque con los bordes */
    text-align: center;
}

body.client-mode .signature-top h3 {
    opacity: 1 !important;
    visibility: visible !important;
    display: block !important;
}

.signature-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 60px;
    margin-top: 40px;
    width: 100%;
}

.sig-box {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.sig-line-container {
    width: 100%;
    position: relative;
    border-bottom: 2px solid rgba(255, 255, 255, 0.2);
    margin-bottom: 10px;
}

.sig-canvas {
    width: 100%;
    height: 100px;
    cursor: crosshair;
    background: rgba(0, 0, 0, 0.02);
}

/* Bloqueo dinámico de firma SomosDos en modo cliente */
/* Bloqueo de firmas del dueño en modo cliente (Nuevos IDs) */
body.is-client-mode [id^="sig-canvas-owner-"],
body.client-mode [id^="sig-canvas-owner-"],
body.is-client-mode #sig-canvas-owner,
body.client-mode #sig-canvas-owner {
    cursor: not-allowed !important;
    opacity: 0.8 !important;
    pointer-events: none !important;
}

.btn-clear-sig {
    font-size: 10px;
    text-transform: uppercase;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    padding: 3px 10px;
    border-radius: 4px;
    cursor: pointer;
    color: var(--text-light);
    opacity: 0;
    transition: opacity 0.2s ease;
    margin-top: 5px;
}

.sig-box:hover .btn-clear-sig {
    opacity: 1;
}

.sig-name {
    font-weight: 600;
    font-size: 1.1rem;
}

.sig-detail {
    font-size: 0.8rem;
    color: var(--text-light);
}

/* Styles Dots - SIEMPRE VISIBLES */
.style-selector {
    display: flex !important;
    gap: 12px;
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid rgba(123, 63, 228, 0.1);
    justify-content: center;
    visibility: visible !important;
}

/* Botones de Movimiento */
.move-controls {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 8px;
}

.btn-move {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 1px solid #e2e8f0;
    background: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    color: var(--accent-color);
    transition: 0.2s;
}

.btn-move:hover {
    background: #f8fafc;
    border-color: var(--accent-color);
    transform: scale(1.1);
}

.style-selector.mini {
    flex-direction: column;
    gap: 8px;
    margin-top: 0;
    padding-top: 0;
    border-top: none;
    background: white;
    padding: 8px;
    border-radius: 50px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    border: 1px solid #E2E8F0;
}

.style-selector.mini .style-dot {
    width: 20px;
    height: 20px;
    border-width: 2px;
}

.style-selector.mini .style-dot.active::after {
    font-size: 10px;
}

.style-dot {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    border: 3px solid white;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
}

.style-dot:hover {
    transform: scale(1.3);
    rotate: 10deg;
}

.style-dot.active {
    box-shadow: 0 0 0 3px var(--accent-color);
    transform: scale(1.1);
}

.style-dot.active::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 14px;
    font-weight: 800;
}

.dot-1 {
    background: #f8fafc;
    border-color: #e2e8f0;
}

.dot-1.active::after {
    color: #7B3FE4;
}

.dot-2 {
    background: var(--primary-gradient);
}

.dot-3 {
    background: #1A1A2E;
}

/* Themes */
/* Themes: ESTILO 2 - CREATIVO SOMOSDOS */
.page.theme-2 .page-content {
    background: #FFFFFF !important;
    background-image:
        radial-gradient(ellipse at 80% 20%, rgba(45, 62, 175, 0.06) 0%, rgba(45, 62, 175, 0.02) 40%, transparent 100%),
        radial-gradient(ellipse at 20% 80%, rgba(123, 63, 228, 0.06) 0%, rgba(123, 63, 228, 0.02) 40%, transparent 100%) !important;
    position: relative;
    overflow: hidden;
}

.page.theme-2 .content-header {
    background: var(--primary-gradient);
    padding: 60px 40px 80px 40px;
    margin: -80px -60px 40px -60px;
    border-bottom: none;
    min-height: 180px;
    display: flex;
    align-items: center;
    clip-path: polygon(0 0, 100% 0, 100% 85%, 0% 100%);
    /* Diagonal creative cut */
}

.page.theme-2 .header-tag {
    color: white;
    font-weight: 800;
    letter-spacing: 2px;
    text-transform: uppercase;
    opacity: 1;
}

.page.theme-2 .brand-logo-small {
    filter: brightness(0) invert(1);
    margin-right: 20px;
}

/* Headings in Theme 2 */
.page.theme-2 h3 {
    color: #2D3EAF;
    border-left: 4px solid #7B3FE4;
    padding-left: 15px;
    margin-bottom: 40px !important;
}

/* Specific Creative Cover */
.page.theme-2[data-page-type="cover"] .page-content {
    background: #FFFFFF !important;
    background-image:
        radial-gradient(ellipse at 100% 0%, rgba(45, 62, 175, 0.08) 0%, rgba(45, 62, 175, 0.03) 50%, transparent 120%),
        radial-gradient(ellipse at 0% 100%, rgba(123, 63, 228, 0.08) 0%, rgba(123, 63, 228, 0.03) 50%, transparent 120%) !important;
}

.page.theme-2 .cover-layout {
    position: relative;
    z-index: 2;
}

.page.theme-2[data-page-type="cover"] .divider {
    width: 150px;
    height: 8px;
    background: var(--primary-gradient);
    border-radius: 50px;
    margin: 30px 0;
}

/* --- THEME 3: BRAND PREMIUM (SOMOSDOS BLACK) --- */
.page.theme-3 .page-content {
    background: #080812 !important;
    background-image:
        radial-gradient(at 0% 0%, rgba(99, 102, 241, 0.15) 0px, transparent 50%),
        radial-gradient(at 100% 100%, rgba(121, 40, 202, 0.15) 0px, transparent 50%) !important;
    color: white !important;
}

.page.theme-3::before {
    background: linear-gradient(135deg, #6366F1, #7928CA);
    /* Brand Identity */
    box-shadow: 0 0 40px rgba(99, 102, 241, 0.3);
}

.page.theme-3 .content-header {
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    background: transparent !important;
}

.page.theme-3 .header-tag,
.page.theme-3 .content-footer,
.page.theme-3 .sig-detail,
.page.theme-3 .page-number,
.page.theme-3 .content-body p,
.page.theme-3 .content-body li,
.page.theme-3 .feature-card p {
    color: #FFFFFF !important;
    /* Blanco puro para máxima legibilidad */
    opacity: 1 !important;
}

.page.theme-3 .header-tag {
    font-size: 0.85rem;
    /* Más grande en móvil */
    font-weight: 700 !important;
}

.page.theme-3 .content-body p,
.page.theme-3 .content-body ul li {
    color: #FFFFFF !important;
}

.page.theme-3 .content-body h3 {
    background: linear-gradient(135deg, #FFFFFF 0%, #818CF8 50%, #6366F1 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 0 15px rgba(129, 140, 248, 0.2);
    margin-bottom: 40px !important;
    /* Forzado para que respire */
}

.page.theme-3 .signature-top h3 {
    background: linear-gradient(135deg, #FFFFFF 0%, #A5B4FC 50%, #818CF8 100%) !important;
    -webkit-background-clip: text !important;
    -webkit-text-fill-color: transparent !important;
    text-shadow: 0 4px 20px rgba(129, 140, 248, 0.3);
    opacity: 1 !important;
    font-size: 2.5rem;
    /* Ajuste balance */
}

.page.theme-3 .signature-top p {
    color: #FFFFFF !important;
    opacity: 1 !important;
    font-size: 0.8rem;
    white-space: normal !important;
    /* Permitir saltos de línea */
    line-height: 1.5 !important;
    padding: 0 15px !important;
}

.page.theme-3 .cover-title h2 {
    background: linear-gradient(135deg, #FFFFFF 0%, #818CF8 50%, #6366F1 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.page.theme-3 .brand-logo-small,
.page.theme-3 .brand-logo-main {
    filter: brightness(0) invert(1);
}

/* Feature cards specifically in Theme 3 - Premium Restored */
.page.theme-3 .feature-card {
    background: rgba(255, 255, 255, 0.05) !important;
    /* Cristal claro sutil en lugar de tintes oscuros */
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3) !important;
    backdrop-filter: blur(20px) !important;
    -webkit-backdrop-filter: blur(20px) !important;
}

.page.theme-3 .feature-card:hover {
    background: rgba(255, 255, 255, 0.1) !important;
    border-color: rgba(255, 255, 255, 0.25) !important;
    transform: translateY(-5px);
}

.page.theme-3 .feature-card h4 {
    color: #FFFFFF !important;
    font-weight: 700;
}

.page.theme-3 .feature-card p {
    color: rgba(255, 255, 255, 0.95) !important;
    font-size: 1.2rem;
    line-height: 1.5;
}

/* Pure Arrows for Exchange List layout */
.page.theme-3 .exchange-list li::before {
    content: none !important;
    display: none !important;
}

/* Split layout list in Theme 3 */
.page.theme-3[data-layout="split"] .content-body ul {
    background: rgba(255, 255, 255, 0.03) !important;
    border-color: rgba(255, 255, 255, 0.08) !important;
    backdrop-filter: blur(12px);
}

/* Selector de Plantillas Superior */
.template-selector {
    display: flex;
    gap: 8px;
    background: #f1f5f9;
    padding: 4px;
    border-radius: 12px;
}

.template-selector .btn {
    padding: 6px 12px;
    font-size: 0.85rem;
    border-radius: 8px;
}

/* 2. CENTERED LAYOUT (Premium Impact) */
.page[data-layout="centered"] .content-body {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    min-height: 700px;
}

.page[data-layout="centered"] .content-body h3 {
    font-size: 2.8rem;
    margin-bottom: 40px;
    letter-spacing: -1px;
}

.page[data-layout="centered"] .content-body p {
    font-size: 1.5rem;
    max-width: 85%;
    line-height: 1.5;
    color: #1e293b;
}

/* 3. SPLIT LAYOUT (Modern Apple Grid) */
.page[data-layout="split"] .content-body {
    display: grid;
    grid-template-columns: 1fr 1.2fr;
    gap: 30px;
    align-items: flex-start;
    margin-top: 30px;
}

.page[data-layout="split"] .content-body h3 {
    grid-column: 1 / -1;
    text-align: left;
    font-size: 2.4rem;
    margin-bottom: 40px;
    border-left: 6px solid var(--accent-color);
    padding-left: 20px;
}

.page[data-layout="split"] .content-body ul {
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    padding: 30px 40px;
    border-radius: 28px;
    border: 1px solid rgba(123, 63, 228, 0.1);
    list-style-type: none;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.03);
}

.page.theme-3[data-layout="split"] .content-body ul {
    background: rgba(15, 15, 25, 0.6);
    border-color: rgba(255, 255, 255, 0.1);
}

.page[data-layout="split"] .content-body ul li {
    margin-bottom: 10px;
    padding-left: 35px;
    position: relative;
    font-size: 1.02rem;
}

.page[data-layout="split"] .content-body ul li::before {
    content: '→';
    position: absolute;
    left: 0;
    color: var(--accent-color);
    font-weight: 800;
}

/* 4. MODERN GLASS LAYOUT (Apple Glassmorphism) */
.page[data-layout="glass"]:not(.theme-3) .page-content {
    background: #FFFFFF !important;
}

.page.theme-3[data-layout="glass"] .page-content {
    background-color: #080812 !important;
    /* Mantiene la imagen de fondo (blobs/auroras) heredada */
}

.page[data-layout="glass"] .content-body {
    background: rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(25px) saturate(180%);
    -webkit-backdrop-filter: blur(25px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.4);
    padding: 60px;
    border-radius: 40px;
    box-shadow: 0 30px 60px rgba(45, 62, 175, 0.08);
    margin: 40px 0;
    transition: transform 0.3s ease;
}

.page.theme-3[data-layout="glass"] .content-body {
    background: rgba(255, 255, 255, 0.02);
    /* Evita que el contenedor principal parezca negro */
    border-color: rgba(255, 255, 255, 0.08);
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.5);
}

/* 5. LANDING GRID (Phase 3 Exclusive) */
.landing-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    margin-top: 30px;
}

.feature-card {
    background: rgba(255, 255, 255, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(10px);
    padding: 25px;
    border-radius: 24px;
    text-align: center;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.02);
    transition: transform 0.3s ease;
}

.feature-card:hover {
    transform: translateY(-5px);
    background: white;
}

.feature-icon {
    font-size: 2rem;
    margin-bottom: 15px;
}

.feature-card h4 {
    color: var(--accent-color);
    font-size: 1.1rem;
    margin-bottom: 10px;
    font-weight: 700;
}

.feature-card p {
    font-size: 0.9rem;
    line-height: 1.4 !important;
    color: #64748B !important;
    margin-bottom: 0 !important;
}

.spacer-sm {
    height: 20px;
}

/* UI Utilities */
.editable:focus {
    outline: none;
    border-radius: 8px;
    box-shadow: 0 0 0 3px rgba(123, 63, 228, 0.3);
    background: white !important;
    color: #1A1A2E !important;
}

.editable:focus * {
    color: #1A1A2E !important;
}

.page.theme-3 .editable:focus {
    background: white !important;
    color: #1A1A2E !important;
    box-shadow: 0 0 0 4px rgba(255, 255, 255, 1);
}

.page.theme-3 .editable:focus * {
    color: #1A1A2E !important;
}

.hidden {
    display: none !important;
}

.loader {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    background: rgba(10, 10, 25, 0.85);
    -webkit-backdrop-filter: blur(25px);
    backdrop-filter: blur(25px);
    z-index: 999999 !important;
    display: flex;
    /* Sin !important para que .hidden pueda ocultarlo */
    flex-direction: column !important;
    justify-content: center !important;
    align-items: center !important;
    transition: opacity 0.5s ease;
    margin: 0 !important;
    padding: 0 !important;
    opacity: 0;
    pointer-events: none;
}

.loader-content {
    text-align: center;
    color: white;
    max-width: 400px;
    width: 90%;
}

.loader-brand {
    position: relative;
    width: 120px;
    height: 60px;
    margin: 0 auto 30px;
}

.loader-logo {
    height: 100%;
    width: auto;
    object-fit: contain;
    position: relative;
    z-index: 2;
}

.loader-pulse {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100px;
    height: 100px;
    background: radial-gradient(circle, rgba(123, 63, 228, 0.4) 0%, transparent 70%);
    border-radius: 50%;
    animation: loaderPulse 2s infinite ease-in-out;
}

@keyframes loaderPulse {
    0% {
        transform: translate(-50%, -50%) scale(0.8);
        opacity: 0.3;
    }

    50% {
        transform: translate(-50%, -50%) scale(1.5);
        opacity: 0.6;
    }

    100% {
        transform: translate(-50%, -50%) scale(0.8);
        opacity: 0.3;
    }
}

.loader-content h2 {
    font-size: 1.8rem;
    font-weight: 800;
    margin-bottom: 10px;
    letter-spacing: -0.5px;
    background: linear-gradient(135deg, #FFFFFF, #A855F7);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.loader-content p {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.6);
    margin-bottom: 30px;
}

.loader-progress-container {
    width: 100%;
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    overflow: hidden;
}

.loader-progress-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(45deg,
            rgba(168, 85, 247, 0.8) 25%,
            #6366F1 25%,
            #6366F1 50%,
            rgba(168, 85, 247, 0.8) 50%,
            rgba(168, 85, 247, 0.8) 75%,
            #6366F1 75%,
            #6366F1 100%);
    background-size: 40px 40px;
    box-shadow: 0 0 15px rgba(168, 85, 247, 0.6);
    transition: width 0.3s ease;
    animation: barStripe 1s linear infinite;
}

@keyframes barStripe {
    0% {
        background-position: 40px 0;
    }

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

.signature-section-label {
    font-size: 0.65rem;
    letter-spacing: 2px;
    font-weight: 800;
    color: var(--brand-purple);
    margin: 30px 0 15px 0;
    text-transform: uppercase;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    padding-bottom: 5px;
    opacity: 0.7;
}

.theme-3 .signature-section-label {
    color: #a78bfa;
    border-color: rgba(255, 255, 255, 0.1);
}

.signature-grid {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 40px;
    margin-bottom: 30px;
    width: 100% !important;
}

/* Grillas específicas para 1 o 2 personas */
.owner-grid-1,
.client-grid-1 {
    grid-template-columns: 1fr !important;
    max-width: 400px;
    margin-left: auto;
    margin-right: auto;
}

.owner-grid-2,
.client-grid-2 {
    grid-template-columns: 1fr 1fr !important;
    display: grid !important;
}

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

/* Restaurar filtro para firmas en modo oscuro */
.page.theme-3 .sig-canvas {
    filter: invert(1) brightness(2) !important;
}

.actions {
    display: flex;
    gap: 10px;
}

.zoom-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #f1f5f9;
    padding: 5px 12px;
    border-radius: 50px;
}

.zoom-controls input {
    width: 60px;
}

.zoom-controls span {
    font-size: 0.8rem;
    font-weight: 600;
    width: 40px;
}

.btn-icon {
    background: none;
    border: none;
    font-size: 1rem;
    cursor: pointer;
    color: var(--accent-color);
}

.btn {
    padding: 8px 16px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: 0.3s;
}

.btn-save {
    background: #10b981;
    color: white;
}

.btn-primary {
    background: var(--primary-gradient);
    color: white;
}

.btn-secondary {
    background: white;
    color: var(--accent-color);
    border: 1px solid var(--accent-color);
}

/* Client Mode Logic */
body.client-mode .resize-sidebar,
body.client-mode .zoom-controls,
body.client-mode .page-controls,
body.client-mode #save-doc,
body.client-mode #add.page {
    will-change: transform, opacity;
    transform: translateZ(0);
    contain: layout paint style;
    position: relative;
    overflow: hidden;
    will-change: transform, opacity;
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
    backface-visibility: hidden;
    display: none !important;
}

body.client-mode .logo-area h1 {
    display: none;
}

body.client-mode #toggle-client-mode {
    background: #10B981 !important;
    color: white;
}

/* Print */
.header-actions {
    display: flex;
    gap: 12px;
    align-items: center;
}

.history-controls {
    display: flex;
    gap: 5px;
    background: #f1f5f9;
    padding: 4px;
    border-radius: 10px;
    margin-right: 5px;
}

.btn-history {
    background: transparent;
    color: #64748b;
    padding: 4px 8px;
    font-size: 1.1rem;
    border: none;
    cursor: pointer;
    transition: 0.2s;
    border-radius: 6px;
}

.btn-history:hover {
    background: white;
    color: #7B3FE4;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.btn-history:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.divider-v {
    width: 1px;
    height: 24px;
    background: #E2E8F0;
    margin: 0 4px;
}

.btn-active {
    background: #7B3FE4;
    color: white;
    border: none;
    font-weight: 700;
}

.btn-active:hover {
    background: #6b34cc;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(123, 63, 228, 0.3);
}

.btn-pdf {
    background: #F59E0B;
    color: white;
    border: none;
    font-weight: 600;
}

.btn-pdf:hover {
    background: #d97706;
    transform: translateY(-2px);
}

.btn-client {
    background: #F1F5F9;
    color: #475569;
    border: 1px solid #E2E8F0;
    font-weight: 500;
}

.btn-client:hover {
    background: #E2E8F0;
    color: #1e293b;
}

.btn-publish {
    background: var(--primary-gradient);
    color: white !important;
    border: none;
    font-weight: 700;
    box-shadow: 0 4px 12px rgba(123, 63, 228, 0.2);
}

.btn-publish:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(123, 63, 228, 0.4);
    filter: brightness(1.1);
}

.btn-settings {
    background: transparent;
    border: 1px solid transparent;
    color: #64748b;
    font-size: 1.1rem;
    padding: 8px;
    cursor: pointer;
}

.btn-settings:hover {
    background: #f8fafc;
    border-radius: 8px;
    color: #1e293b;
}

/* DROPDOWN */
.dropdown {
    position: relative;
    display: inline-block;
}

.dropdown-content {
    display: none;
    position: absolute;
    right: 0;
    top: 35px;
    /* Ajustado al botón */
    background-color: white;
    min-width: 220px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    border-radius: 12px;
    padding: 8px 0;
    z-index: 1000000;
    border: 1px solid #E2E8F0;
    animation: slideUpDropdown 0.2s ease-out;
}

/* Puente invisible para que no se cierre al mover el ratón */
.dropdown-content::before {
    content: '';
    position: absolute;
    top: -20px;
    left: 0;
    width: 100%;
    height: 20px;
    background: transparent;
}

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

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

.dropdown-content a {
    color: #475569;
    padding: 10px 16px;
    text-decoration: none;
    display: block;
    font-size: 0.9rem;
    font-weight: 500;
    transition: 0.2s;
}

.dropdown-content a:hover {
    background-color: #f8fafc;
    color: #1e293b;
}

.dropdown:hover .dropdown-content {
    display: block;
}

.dropdown-divider {
    height: 1px;
    background: #E2E8F0;
    margin: 4px 0;
}

/* --- TUTORIAL CLIENTE --- */
.tutorial-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(13, 13, 26, 0.7);
    /* Fondo azul profundo translúcido */
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    z-index: 1000000;
    display: flex;
    justify-content: center;
    align-items: center;
    animation: fadeIn 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

.tutorial-card {
    background: white;
    width: 90%;
    max-width: 400px;
    padding: 40px;
    border-radius: 24px;
    text-align: center;
    position: relative;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
}

.tutorial-icon {
    font-size: 3rem;
    margin-bottom: 20px;
}

.tutorial-card h2 {
    color: #1A1A2E;
    margin-bottom: 15px;
    font-weight: 800;
}

.tutorial-card p {
    color: #475569;
    line-height: 1.6;
    margin-bottom: 30px;
}

.tutorial-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.tutorial-actions .btn {
    flex: 1;
}

.btn-secondary {
    background: transparent !important;
    color: #475569 !important;
    border: 1px solid #E2E8F0 !important;
}

.btn-secondary:hover {
    background: #F8FAFC !important;
    border-color: #CBD5E1 !important;
}

.tutorial-progress {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-bottom: 25px;
}

.progress-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #E2E8F0;
}

.progress-dot.active {
    background: #7B3FE4;
    width: 24px;
    border-radius: 10px;
    transition: 0.3s;
}

.info-alert {
    background: #f5f3ff;
    /* Very soft brand purple */
    padding: 15px;
    border-radius: 12px;
    border-left: 4px solid #7B3FE4;
    text-align: left;
    margin-bottom: 30px;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* Toast Mejorado */
.save-toast {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background: #10B981;
    color: white;
    padding: 12px 24px;
    border-radius: 50px;
    font-weight: 600;
    box-shadow: 0 10px 25px rgba(16, 185, 129, 0.3);
    z-index: 100000;
    animation: slideUp 0.3s ease-out;
}

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

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

/* --- MODAL PREMIUM SOMOSDOS --- */
.s2-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(26, 26, 46, 0.75);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    z-index: 500000;
    display: flex;
    justify-content: center;
    align-items: center;
    animation: s2ModalFadeIn 0.25s ease-out;
}

@keyframes s2ModalFadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes s2ModalSlideUp {
    from {
        transform: translateY(30px) scale(0.96);
        opacity: 0;
    }

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

.s2-modal-card {
    background: white;
    width: 90%;
    max-width: 440px;
    border-radius: 28px;
    padding: 40px;
    text-align: center;
    box-shadow:
        0 25px 60px rgba(0, 0, 0, 0.25),
        0 0 0 1px rgba(255, 255, 255, 0.1);
    animation: s2ModalSlideUp 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
    overflow: hidden;
}

/* Gradient accent bar at top */
.s2-modal-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--primary-gradient);
}

.s2-modal-icon {
    font-size: 3rem;
    margin-bottom: 16px;
    line-height: 1;
}

.s2-modal-card h2 {
    color: #1A1A2E;
    font-size: 1.4rem;
    font-weight: 800;
    margin-bottom: 12px;
    letter-spacing: -0.3px;
}

.s2-modal-card p {
    color: #475569;
    font-size: 0.95rem;
    line-height: 1.6;
    margin-bottom: 8px;
}

.s2-modal-body {
    margin-bottom: 28px;
}

/* Copyable link box */
.s2-modal-link-box {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 12px 16px;
    margin-top: 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    transition: 0.2s;
    word-break: break-all;
}

.s2-modal-link-box:hover {
    background: #f1f5f9;
    border-color: var(--accent-color);
}

.s2-modal-link-box code {
    flex: 1;
    font-size: 0.8rem;
    color: #2D3EAF;
    font-family: 'Outfit', monospace;
    text-align: left;
}

.s2-modal-link-box .copy-icon {
    font-size: 1.1rem;
    color: #94a3b8;
    transition: 0.2s;
    flex-shrink: 0;
}

.s2-modal-link-box:hover .copy-icon {
    color: var(--accent-color);
}

.s2-modal-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.s2-modal-actions .btn {
    flex: 1;
    padding: 12px 20px;
    font-size: 0.95rem;
    border-radius: 14px;
    font-weight: 700;
    cursor: pointer;
    border: none;
    transition: all 0.2s ease;
}

.s2-modal-actions .btn-modal-primary {
    background: var(--primary-gradient);
    color: white;
    box-shadow: 0 4px 15px rgba(123, 63, 228, 0.25);
}

.s2-modal-actions .btn-modal-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(123, 63, 228, 0.4);
}

.s2-modal-actions .btn-modal-secondary {
    background: #f1f5f9;
    color: #475569;
    border: 1px solid #e2e8f0;
}

.s2-modal-actions .btn-modal-secondary:hover {
    background: #e2e8f0;
    color: #1e293b;
}

.s2-modal-actions .btn-modal-primary {
    background: linear-gradient(135deg, #2D3EAF, #7B3FE4);
    color: white;
    box-shadow: 0 4px 15px rgba(123, 63, 228, 0.25);
}

.s2-modal-actions .btn-modal-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(123, 63, 228, 0.4);
}

.s2-modal-actions .btn-modal-danger {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: white;
    box-shadow: 0 4px 15px rgba(239, 68, 68, 0.25);
}

.s2-modal-actions .btn-modal-danger:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(239, 68, 68, 0.4);
}

/* Copied tooltip */
.s2-modal-copied {
    position: absolute;
    bottom: -30px;
    left: 50%;
    transform: translateX(-50%);
    background: #10B981;
    color: white;
    padding: 4px 14px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    animation: s2ModalFadeIn 0.2s ease-out;
}

/* --- DASHBOARD CLIENTES (BIBLIOTECA) --- */
.s2-dashboard-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(26, 26, 46, 0.85);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    z-index: 600000;
    display: flex;
    justify-content: center;
    align-items: center;
    animation: s2ModalFadeIn 0.3s ease-out;
}

.s2-dashboard-card {
    background: #FFFFFF;
    width: 90%;
    max-width: 900px;
    height: 85vh;
    border-radius: 24px;
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: s2ModalSlideUp 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
}

.s2-dashboard-header {
    background: var(--primary-gradient);
    padding: 30px 40px;
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.s2-dashboard-header-info h2 {
    font-size: 1.8rem;
    font-weight: 800;
    margin-bottom: 5px;
}

.s2-dashboard-header-info p {
    opacity: 0.9;
    font-size: 0.95rem;
}

.s2-dashboard-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 1.5rem;
    cursor: pointer;
    transition: 0.3s;
    display: flex;
    justify-content: center;
    align-items: center;
}

.s2-dashboard-close:hover {
    background: rgba(255, 255, 255, 0.4);
    transform: rotate(90deg);
}

.s2-dashboard-content {
    flex: 1;
    overflow-y: auto;
    padding: 30px 40px;
    background: #f8fafc;
}

.s2-dashboard-empty {
    text-align: center;
    padding: 60px 20px;
    color: #64748b;
    font-size: 1.1rem;
}

.s2-client-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 20px;
}

.s2-client-card {
    background: rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(10px);
    border-radius: 16px;
    padding: 24px;
    border: 1px solid rgba(255, 255, 255, 0.4);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.03);
    transition: all 0.5s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
}

.s2-client-card:hover {
    transform: translateY(-8px) scale(1.02);
    background: rgba(255, 255, 255, 0.95);
    border-color: var(--accent-color);
    box-shadow: 0 20px 40px rgba(123, 63, 228, 0.1);
}

.s2-client-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    width: 4px;
    background: #e2e8f0;
    transition: 0.3s;
}

.s2-client-card.status-signed::before {
    background: #10B981;
}

.s2-client-card.status-pending::before {
    background: #F59E0B;
}

.s2-client-name {
    font-size: 1.25rem;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 6px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.s2-client-meta {
    font-size: 0.85rem;
    color: #64748b;
    margin-bottom: 20px;
    display: flex;
    gap: 15px;
}

.s2-status-badge {
    padding: 6px 12px;
    border-radius: 50px;
    font-size: 0.75rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    align-self: flex-start;
    margin-bottom: 15px;
}

.s2-status-badge.signed {
    background: #d1fae5;
    color: #059669;
}

.s2-status-badge.pending {
    background: #fef3c7;
    color: #d97706;
}

.s2-client-actions {
    margin-top: auto;
    display: flex;
    gap: 10px;
}

.s2-client-actions .btn {
    flex: 1;
    padding: 10px;
    font-size: 0.85rem;
    border-radius: 10px;
    font-weight: 600;
}

/* Scrollbar styling for dashboard */
.s2-dashboard-content::-webkit-scrollbar {
    width: 8px;
}

.s2-dashboard-content::-webkit-scrollbar-track {
    background: #f1f5f9;
}

.s2-dashboard-content::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 10px;
}

.s2-dashboard-content::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* ============================================================
   RESPONSIVE DESIGN SYSTEM
   ============================================================ */

/* LAPTOPS & SMALL SCREENS (1024px - 1440px) */
@media (max-width: 1440px) {
    #document-container {
        margin-left: 280px;
        padding-top: 40px;
    }
}

/* TABLETS (769px - 1023px) */
@media (max-width: 1023px) {
    #document-container {
        margin-left: 0 !important;
        margin-top: 80px;
    }

    .design-side-panel {
        width: 300px;
        left: -300px;
        z-index: 1000000;
        box-shadow: 10px 0 30px rgba(0, 0, 0, 0.1);
    }

    .design-side-panel.active {
        left: 0;
    }
}

/* COMPACT DEVICES (Up to 900px) - FOOLPROOF FIX */
@media (max-width: 900px) {
    .main-header {
        height: 70px !important;
        padding: 0 15px !important;
        flex-direction: row !important;
        justify-content: space-between !important;
        align-items: center !important;
        position: fixed !important;
        top: 0;
        left: 0;
        right: 0;
        z-index: 100000;
        background: white;
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08) !important;
        display: flex !important;
    }

    .logo-area {
        width: auto !important;
        justify-content: flex-start !important;
        margin-right: 0 !important;
    }

    #mobile-toggle-design {
        display: block !important;
        background: transparent;
        font-size: 1.8rem;
        padding: 5px;
        border: none;
        margin-right: 15px;
    }

    /* DESTRUIR ZOOM EN ESTAS PANTALLAS POR ID - GANA ESPECIFICIDAD SIEMPRE */
    .zoom-controls,
    #zoom-fit,
    #zoom-range,
    #zoom-label {
        display: none !important;
    }

    .actions {
        display: none !important;
        /* Ocultamos el contenedor original derecho */
    }

    /* ESTILOS PARA LOS BOTONES CUANDO PASAN AL PANEL LATERAL VIA JS */
    .design-side-panel .header-actions {
        width: 100% !important;
        display: flex !important;
        flex-direction: column !important;
        gap: 15px !important;
        padding: 20px 0 25px 0 !important;
        border-bottom: 1px solid rgba(0, 0, 0, 0.1);
        margin-bottom: 20px !important;
    }

    .design-side-panel .header-actions .btn {
        width: 100% !important;
        justify-content: center !important;
        padding: 16px !important;
        text-align: center !important;
        font-size: 1.1rem;
    }

    .design-side-panel .btn span {
        display: inline-block !important;
    }

    .client-name-input-wrapper {
        width: 100% !important;
        max-width: none !important;
        margin: 0 !important;
        order: -1 !important;
        background: #f8fafc !important;
    }

    .design-side-panel {
        width: 100% !important;
        left: -100%;
        height: 100vh !important;
        top: 0;
        z-index: 999999;
        padding: 20px 20px 40px !important;
        box-shadow: none !important;
        overflow-y: auto !important;
        /* Permitir scroll si son muchas acciones */
    }

    .design-side-panel.active {
        left: 0 !important;
    }

    .mobile-panel-close {
        display: block !important;
    }

    #document-container {
        margin-top: 90px !important;
        margin-left: 0 !important;
        padding: 20px 0 40px !important;
        /* Reducido de 150px a 40px para evitar scroll infinito */
        width: 100vw !important;
        box-sizing: border-box !important;
        overflow-x: hidden !important;
    }

    /* Tamaño de texto del número de página específico para móvil */
    .page.theme-3 .page-number {
        font-size: 0.122rem;
    }
}

/* FIX PARA MODO CLIENTE EN MOVIL */
body.client-mode {
    background-color: #1A1A24 !important;
    /* Gris oscuro neutro para que las páginas no se vean pegadas */
    -webkit-font-smoothing: antialiased;
    overscroll-behavior: none !important;
    /* Evitar rebotes que disparan resize en iOS */
}

body.client-mode #document-container {
    margin-top: 0 !important;
    padding-bottom: 20px !important;
    padding-top: 10px !important;
    background-color: transparent !important;
}

body.client-mode .main-header {
    flex-direction: row !important;
    justify-content: space-between !important;
    height: 75px !important;
    padding: 0 15px !important;
}

body.client-mode .logo-area {
    width: auto !important;
}

body.client-mode .header-actions {
    width: auto !important;
}

/* Botón flotante para el cliente en móvil y ocultar el resto */
@media (max-width: 900px) {
    body.client-mode .actions {
        display: flex !important;
    }

    body.client-mode .header-actions {
        display: flex !important;
    }

    body.client-mode #btn-client-save {
        display: block !important;
        position: fixed;
        bottom: 30px;
        left: 50%;
        transform: translateX(-50%);
        z-index: 100000;
        width: 90%;
        padding: 18px;
        font-size: 1.2rem;
        box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3) !important;
        border-radius: 12px;
    }

    body.client-mode .template-selector,
    body.client-mode .history-controls,
    body.client-mode .btn-save,
    body.client-mode .btn-publish,
    body.client-mode .btn-library,
    body.client-mode .btn-client,
    body.client-mode .btn-settings,
    body.client-mode .client-name-input-wrapper,
    body.client-mode #btn-client-save {
        display: none !important;
    }

    /* FIXES DE ESPACIADO Y TAMAÑO PARA MOVIL */
    .signature-grid {
        gap: 20px !important;
    }

    .content-body h3 {
        margin-bottom: 35px !important;
        font-size: 1.8rem;
    }

    .feature-card {
        margin-top: 10px !important;
    }
}

/* Fix para firmas en Modo Oscuro (el lienzo transparente ocultaba la tinta negra) */
.theme-3 [id^="sig-canvas"] {
    background: #ffffff !important;
    border-radius: 8px;
}

/* Botón flotante PREMIUM (Arrechísimo) para el cliente */
.client-fab-save {
    position: fixed;
    bottom: 25px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 999999;
    width: auto;
    min-width: 280px;
    max-width: 92vw;
    padding: 14px 28px;
    font-size: 1rem;
    line-height: 1;
    font-weight: 800;
    text-align: center;
    white-space: nowrap !important;
    color: white;
    background: linear-gradient(135deg, #6366f1, #a855f7);
    border: none;
    border-radius: 100px;
    cursor: pointer;
    box-shadow: 0 15px 35px rgba(99, 102, 241, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.client-fab-save.visible {
    display: flex !important;
    opacity: 1 !important;
    pointer-events: auto !important;
    animation: fabEntrance 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards, magicPulse 2s infinite, gradientMove 3s linear infinite;
}

@keyframes fabEntrance {
    0% {
        transform: translate(-50%, 40px) scale(0.7);
        opacity: 0;
        filter: blur(15px);
    }

    100% {
        transform: translate(-50%, 0) scale(1);
        opacity: 1;
        filter: blur(0);
    }
}

@keyframes magicPulse {
    0% {
        box-shadow: 0 10px 40px rgba(123, 63, 228, 0.4), 0 0 0 0px rgba(123, 63, 228, 0.2);
    }

    70% {
        box-shadow: 0 10px 40px rgba(123, 63, 228, 0.6), 0 0 0 20px rgba(123, 63, 228, 0);
    }

    100% {
        box-shadow: 0 10px 40px rgba(123, 63, 228, 0.4), 0 0 0 0px rgba(123, 63, 228, 0);
    }
}

@keyframes gradientMove {
    0% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }

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

.client-fab-save:hover {
    transform: translateX(-50%) scale(1.05) translateY(-5px);
    box-shadow: 0 20px 60px rgba(123, 63, 228, 0.6);
    filter: brightness(1.2);
}

.client-fab-save:active {
    transform: translateX(-50%) scale(0.95);
}

.client-fab-save i {
    font-size: 1.4rem;
    animation: bounceIcon 1s infinite alternate;
}

@keyframes bounceIcon {
    from {
        transform: translateY(0);
    }

    to {
        transform: translateY(-3px);
    }
}

/* Botón de eliminar en tarjetas de la biblioteca */
.s2-card-delete {
    position: absolute;
    top: 10px;
    right: 10px;
    background: none;
    border: none;
    font-size: 1.1rem;
    cursor: pointer;
    opacity: 0.4;
    transition: opacity 0.2s, transform 0.2s;
    padding: 4px 6px;
    border-radius: 6px;
    line-height: 1;
}

.s2-card-delete:hover {
    opacity: 1;
    transform: scale(1.15);
    background: rgba(239, 68, 68, 0.1);
}

/* FIX PARA MODAL DE CONFIRMACIÓN DE ELIMINAR */
.s2-modal-overlay {
    z-index: 1000000 !important;
}

@media print {
    body {
        padding: 0;
    }

    .main-header,
    .resize-sidebar,
    .page-controls,
    #loader,
    .s2-dashboard-overlay {
        display: none !important;
    }

    .page {
    will-change: transform, opacity;
    transform: translateZ(0);
    contain: layout paint style;
    position: relative;
    overflow: hidden;
    will-change: transform, opacity;
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
    backface-visibility: hidden;
        margin: 0 !important;
        box-shadow: none !important;
        page-break-after: always;
        width: 210mm !important;
        height: 297mm !important;
    }
}

/* Dropdown Menu Styles */
.menu-header {
    font-size: 10px;
    font-weight: 800;
    color: var(--accent-color);
    padding: 12px 16px 4px 16px;
    letter-spacing: 1px;
    opacity: 0.6;
    text-transform: uppercase;
}

.menu-sep {
    height: 1px;
    background: rgba(0, 0, 0, 0.05);
    margin: 8px 12px;
}

/* IA COPILOT PANEL STYLES */
.ia-side-panel {
    position: fixed;
    right: -400px;
    top: 0;
    width: 380px;
    height: 100vh;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    box-shadow: -10px 0 30px rgba(0, 0, 0, 0.1);
    z-index: 1000000;
    transition: right 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
}

.ia-side-panel.active {
    right: 0;
}

.ia-panel-header {
    padding: 30px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.ia-badge {
    background: linear-gradient(135deg, #2D3EAF, #7B3FE4) !important;
    color: white !important;
    font-size: 10px;
    font-weight: 800;
    padding: 4px 12px;
    border-radius: 6px;
    display: inline-block;
    margin-bottom: 10px;
    letter-spacing: 0.8px;
    box-shadow: 0 4px 10px rgba(123, 63, 228, 0.2);
}

.ia-title-group h3 {
    font-size: 1.5rem;
    color: #1A1A2E;
    margin-bottom: 4px;
}

.ia-title-group p {
    font-size: 0.9rem;
    color: #64748b;
}

.ia-panel-content {
    padding: 30px;
    flex: 1;
    overflow-y: auto;
}

.ia-input-zone textarea {
    width: 100%;
    height: 180px;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    padding: 20px;
    font-family: inherit;
    font-size: 0.95rem;
    resize: none;
    transition: border-color 0.3s;
    background: #f8fafc;
    margin-bottom: 15px;
}

.ia-input-zone textarea:focus {
    outline: none;
    border-color: var(--accent-color);
    background: white;
}

.ia-input-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.btn-ia-action {
    background: white;
    border: 1px solid #e2e8f0;
    padding: 12px;
    border-radius: 12px;
    cursor: pointer;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s;
}

.btn-ia-action:hover {
    background: #f1f5f9;
    transform: translateY(-2px);
}

.btn-ia-action.recording {
    background: #fee2e2;
    border-color: #ef4444;
    color: #ef4444;
    animation: pulseRed 1.5s infinite;
}

@keyframes pulseRed {
    0% {
        opacity: 1;
    }

    50% {
        opacity: 0.6;
    }

    100% {
        opacity: 1;
    }
}

.ia-results-area>label {
    display: block;
    font-size: 11px;
    font-weight: 800;
    color: #64748b;
    letter-spacing: 1.5px;
    margin: 35px 0 15px 5px;
    text-transform: uppercase;
}

.ia-info-card {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    padding: 16px;
    margin-bottom: 20px;
}

.ia-info-item {
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px dashed #e2e8f0;
}

.ia-info-item:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.ia-info-item label {
    font-size: 9px;
    font-weight: 800;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 1px;
    display: block;
    margin-bottom: 4px;
}

.ia-info-item span {
    font-weight: 700;
    color: #1e293b;
    font-size: 0.95rem;
}

.ia-overrides {
    margin-top: 25px;
    padding-top: 20px;
    border-top: 2px solid #f1f5f9;
}

.ia-type-chips {
    display: flex;
    gap: 12px;
    margin: 15px 0 25px;
}

.ia-chip {
    flex: 1;
    padding: 14px 10px;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    text-align: center;
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    color: #64748b;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.ia-chip.active {
    background: var(--brand-gradient);
    color: white;
    border-color: transparent;
    box-shadow: 0 10px 20px rgba(123, 63, 228, 0.2);
    transform: translateY(-2px);
}

.ia-manual-input-box {
    margin-bottom: 25px;
    animation: fadeIn 0.4s ease;
}

.ia-manual-input-box label {
    font-size: 10px;
    font-weight: 800;
    color: #475569;
    margin-bottom: 8px;
    display: block;
}

.ia-manual-input-box input {
    width: 100%;
    padding: 16px;
    border-radius: 14px;
    border: 2px solid #f1f5f9;
    font-family: inherit;
    font-weight: 800;
    font-size: 1.1rem;
    background: #fff;
    transition: all 0.2s;
}

.ia-manual-input-box input:focus {
    outline: none;
    border-color: var(--brand-purple);
    box-shadow: 0 0 0 4px rgba(123, 63, 228, 0.1);
}

.btn-ai-generate {
    width: 100%;
    background: var(--brand-gradient) !important;
    color: white !important;
    padding: 18px !important;
    border-radius: 16px !important;
    font-weight: 800 !important;
    font-size: 1rem;
    box-shadow: 0 12px 24px rgba(45, 62, 175, 0.3) !important;
    margin-top: 10px;
    border: none !important;
}

.btn-ai-generate:hover {
    transform: translateY(-3px);
    box-shadow: 0 15px 30px rgba(45, 62, 175, 0.4) !important;
}

.btn-ia-main-process {
    width: 100%;
    background: #1e293b;
    color: white;
    padding: 14px;
    border-radius: 12px;
    border: none;
    font-weight: 700;
    margin-top: 15px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-ia-main-process:hover {
    background: #0f172a;
    transform: translateY(-2px);
}

.ia-status {
    text-align: center;
    padding: 40px 0;
}

.ia-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(123, 63, 228, 0.1);
    border-top-color: var(--accent-color);
    border-radius: 50%;
    margin: 0 auto 15px;
    animation: spin 1s linear infinite;
}

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

.ia-info-card {
    background: #f1f5f9;
    border-radius: 16px;
    padding: 20px;
    margin: 15px 0 25px;
}

.ia-info-item {
    margin-bottom: 12px;
}

.ia-info-item label {
    font-size: 10px;
    color: #64748b;
    display: block;
    margin-bottom: 4px;
}

.ia-info-item span {
    font-weight: 600;
    color: #1e293b;
}

.btn-ai-generate {
    width: 100%;
    background: var(--brand-gradient);
    color: white;
    padding: 16px;
    border-radius: 14px;
    border: none;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 10px 20px rgba(123, 63, 228, 0.2);
    transition: all 0.3s;
}

.btn-ai-generate:hover {
    transform: translateY(-3px);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.2);
}

.ia-panel-footer {
    padding: 25px 30px;
    background: #f8fafc;
    font-size: 0.8rem;
    color: #64748b;
    line-height: 1.5;
}

/* --- BLOQUES ADAPTATIVOS DE ALTO VALOR --- */
.info-block-premium {
    padding: 25px;
    background: #f8fafc;
    border-radius: 20px;
    border: 1px solid #e2e8f0;
    transition: all 0.3s ease;
    margin-bottom: 20px;
}

.theme-3 .info-block-premium {
    background: rgba(255, 255, 255, 0.05) !important;
    border-color: rgba(255, 255, 255, 0.1) !important;
    backdrop-filter: blur(10px);
}

.theme-3 .info-block-premium strong,
.theme-3 .info-block-premium h2,
.theme-3 .info-block-premium h3 {
    color: #fff !important;
}

.theme-3 .info-block-premium p {
    color: rgba(255, 255, 255, 0.7) !important;
}

.scope-card-main {
    background: white;
    border: 2px solid #f1f5f9;
    border-radius: 24px;
    padding: 35px;
    margin-bottom: 30px;
    transition: all 0.3s ease;
}

.theme-3 .scope-card-main {
    background: rgba(255, 255, 255, 0.05) !important;
    border-color: rgba(255, 255, 255, 0.1) !important;
}

.is-intrigue #editor-view {
    opacity: 0.4 !important;
    filter: blur(35px) !important;
    visibility: visible !important;
    pointer-events: none !important;
    transition: none !important;
}

.value-tag-green,
.value-tag-blue {
    padding: 20px;
    border-radius: 15px;
    margin-bottom: 5px;
}

.value-tag-green {
    background: #f0fdf4;
    color: #166534;
}

.value-tag-blue {
    background: #eff6ff;
    color: #1e40af;
}

.value-tag-green p,
.value-tag-blue p {
    font-size: 0.95rem;
    line-height: 1.5 !important;
    margin: 0;
}

.theme-3 .value-tag-green {
    background: rgba(34, 197, 94, 0.1) !important;
    color: #4ade80 !important;
    border-left: 3px solid #4ade80 !important;
}

.theme-3 .value-tag-blue {
    background: rgba(59, 130, 246, 0.1) !important;
    color: #60a5fa !important;
    border-left: 3px solid #60a5fa !important;
}

.support-dashed-box {
    padding: 30px;
    background: rgba(123, 63, 228, 0.03);
    border-radius: 24px;
    border: 2px dashed #7B3FE4;
    margin-top: 35px;
}

.theme-3 .support-dashed-box {
    background: rgba(123, 63, 228, 0.08) !important;
    border-color: #a78bfa !important;
}

/* --- MEJORAS DE CONTRASTE MODO OSCURO --- */
.theme-3 .scope-card-main h4 {
    color: #60a5fa !important;
    /* Azul cielo brillante */
    text-shadow: 0 0 10px rgba(96, 165, 250, 0.2);
}

.theme-3 .professional-list li::before {
    color: #60a5fa !important;
    /* Puntos de lista brillantes */
}

.theme-3 .professional-list li {
    color: rgba(255, 255, 255, 0.9) !important;
}

/* --- UNIFICACIÓN DE DISEÑO - PÁGINA DE PAGOS --- */
.theme-3 .payment-card {
    background: rgba(255, 255, 255, 0.05) !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    backdrop-filter: blur(10px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2) !important;
}

.theme-3 .payment-card h2 {
    color: #ffffff !important;
    text-shadow: none !important;
}

.theme-3 .feature-card {
    background: rgba(255, 255, 255, 0.03) !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    border-left: 4px solid var(--brand-purple) !important;
}

.theme-3 .feature-card h5,
.theme-3 .feature-card strong,
.theme-3 .feature-card b {
    color: var(--brand-purple) !important;
    background: none !important;
    -webkit-text-fill-color: initial !important;
    font-size: 1.3rem;
}

.theme-3 .feature-card p {
    color: #FFFFFF !important;
    /* Blanco puro para máxima nitidez */
    font-size: 1.25rem;
    line-height: 1.6 !important;
    font-weight: 400 !important;
}

.theme-3 .feature-card p:last-child {
    font-size: 1.4rem;
    color: #ffffff !important;
    font-weight: 800 !important;
    margin-top: 10px !important;
    text-shadow: none !important;
}

.signature-subtitle {
    font-size: 0.85rem;
    color: #FFFFFF !important;
    opacity: 0.8;
    letter-spacing: 0.5px;
    margin: 0 auto 25px !important;
    max-width: 320px !important;
    white-space: normal !important;
    line-height: 1.5 !important;
    text-align: center !important;
    overflow-wrap: break-word !important;
    word-break: break-word !important;
}

.signature-subtitle p {
    white-space: normal !important;
    display: block !important;
    width: 100% !important;
}

.theme-3 p[style*="color: #64748b"] {
    color: #cbd5e1 !important;
    /* Gris claro para notas de pie */
}

/* --- AJUSTES PORTADA MODO OSCURO --- */
.theme-3 .subtitle {
    color: #a78bfa !important;
    /* Lila luminoso */
    letter-spacing: 2px;
}

.theme-3 .date-info {
    color: rgba(255, 255, 255, 0.6) !important;
    font-weight: 500;
}

.theme-3 .client-info {
    color: #ffffff !important;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

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

/* PARCHE DE COMPATIBILIDAD PARA CONTRATOS EXISTENTES */
.content-body div[style*="margin-top: 40px"] {
    margin-top: 10px !important;
    padding-top: 10px !important;
}

.content-body div[style*="margin-top: 30px"] {
    margin-top: 5px !important;
}

.content-footer {
    position: absolute !important;
    bottom: 45px !important;
    /* Un poco más abajo para dar aire al contenido */
    right: 60px !important;
    z-index: 100 !important;
}

.page.theme-3 .page-number {
    color: #FFFFFF !important;
    font-weight: 800 !important;
    opacity: 1 !important;
    font-size: 0.9rem;
}

/* COMPACTACIÓN DE BLOQUES INFORMATIVOS */
.info-block-premium {
    gap: 15px !important;
    margin-bottom: 10px !important;
    align-items: center !important;
}

.info-block-premium div:first-child {
    font-size: 1.8rem;
    min-width: 40px;
}

.info-block-premium p {
    margin-bottom: 0 !important;
    line-height: 1.5 !important;
    font-size: 0.85rem;
    /* Aumentado de 0.85rem */
    color: #FFFFFF !important;
}

.info-block-premium strong {
    font-size: 1.15rem;
    /* Aumentado de 1rem */
    margin-bottom: 4px !important;
}

/* FRASE FINAL EN UNA SOLA LÍNEA */
.content-body div[style*="border-top"] p {
    white-space: nowrap !important;
    text-align: center !important;
    width: 100% !important;
    display: block !important;
    font-size: 0.92rem;
    letter-spacing: 0.5px;
}

/* FRASE FINAL DE SOPORTE */
.content-body p[style*="Este marco de trabajo"] {
    font-size: 1.3rem;
    white-space: nowrap !important;
    color: #FFFFFF !important;
    opacity: 1 !important;
}

/* BLOQUEO DE EDICIÓN EN MODO CLIENTE */
body.client-mode [contenteditable="true"],
body.is-client-mode [contenteditable="true"],
body.client-mode .editable,
body.is-client-mode .editable {
    pointer-events: none !important;
    user-select: text !important;
    cursor: default !important;
    -webkit-user-modify: read-only !important;
}

/* --- AJUSTES ESPECÍFICOS PARA MÓVIL (SOBREESCRITURAS DE ÚLTIMA LÍNEA) --- */
@media screen and (max-width: 1100px) {
    body.is-client-mode .info-block-premium p,
    body.client-mode .info-block-premium p {
        font-size: 0.75rem;
        line-height: 1.4 !important;
    }
    body.is-client-mode .info-block-premium strong,
    body.client-mode .info-block-premium strong {
        font-size: 0.85rem;
    }
    body.is-client-mode .info-block-premium div:first-child,
    body.client-mode .info-block-premium div:first-child {
        font-size: 1.2rem;
        min-width: 30px !important;
    }
    body.is-client-mode .content-body p[style*="Este marco de trabajo"],
    body.client-mode .content-body p[style*="Este marco de trabajo"] {
        font-size: 1rem;
        white-space: normal !important;
        text-align: center !important;
        line-height: 1.4 !important;
    }
    body.is-client-mode .content-body div[style*="border-top"] p,
    body.client-mode .content-body div[style*="border-top"] p {
        white-space: normal !important;
        font-size: 0.85rem;
        line-height: 1.4 !important;
    }
}

/* FIX DOUBLE SCROLLBAR */
body { overflow-y: visible !important; }
body.dashboard-open { overflow: hidden !important; }

/* AGGRESSIVE DOUBLE SCROLL FIX */
html, body { min-height: 100vh; height: auto !important; }
#editor-view, .editor-layout, #document-container, #zoom-wrapper { overflow-y: visible !important; height: auto !important; max-height: none !important; }

/* =====================================================
   NORMALIZACIN TIPOGRFICA UNIVERSAL
   Garantiza jerarqua visual consistente en TODAS las pginas.
   Estas reglas son la fuente de verdad para todos los tamaos.
   ===================================================== */

/* NIVEL 1  TTULO PRINCIPAL DE PORTADA (el gigante) */
.cover-title h2,
.cover-title h1 {
    font-size: 4rem;
    line-height: 1.1 !important;
}

/* NIVEL 2  TTULO DE SECCIN (h3 dentro de content-body) */
.content-body h3,
.page[data-layout='centered'] .content-body h3,
.page[data-layout='split'] .content-body h3,
.page.theme-3 .content-body h3 {
    font-size: 1.4rem;
    font-weight: 700 !important;
    line-height: 1.3 !important;
}

/* NIVEL 3  CUERPO DE TEXTO PRINCIPAL */
.content-body p,
.page.theme-3 .content-body p,
.page[data-layout='centered'] .content-body p,
.page[data-layout='split'] .content-body p {
    font-size: 1rem;
    line-height: 1.6 !important;
}

/* NIVEL 4  TEMS DE LISTA / BULLET POINTS */
.content-body ul li,
.page.theme-3 .content-body ul li,
.page[data-layout='split'] .content-body ul li {
    font-size: 0.95rem;
    line-height: 1.6 !important;
}

/* NIVEL 5  ETIQUETA DE ENCABEZADO (el texto pequeo de esquina superior) */
.header-tag {
    font-size: 0.62rem;
    letter-spacing: 2px !important;
}

/* NIVEL 6  SUBTTULO DE PORTADA */
.subtitle {
    font-size: 1rem;
}

/* NIVEL 7  TTULOS DE TARJETAS (h4 genrico dentro de pginas) */
.page-content h4 {
    font-size: 1rem;
    font-weight: 700 !important;
}

/* NIVEL 8  TEXTOS DE TARJETAS PREMIUM / INFO BLOCKS */
.info-block-premium strong,
.feature-card strong {
    font-size: 0.95rem;
}

.info-block-premium p,
.feature-card p {
    font-size: 0.9rem;
}

/* =====================================================
   FIX: Tamaos de tarjetas oscuras (feature-card, scope-card)
   Los textos dentro de estas tarjetas eran demasiado grandes,
   causando que el contenido se cortara en la parte inferior.
   ===================================================== */

/* Tarjetas oscuras en Tema 3 - ttulo */
.page.theme-3 .feature-card h4,
.theme-3 .feature-card h4 {
    font-size: 0.9rem;
    font-weight: 700 !important;
}

/* Tarjetas oscuras en Tema 3 - cuerpo (era 1.2rem, causaba overflow) */
.page.theme-3 .feature-card p,
.theme-3 .feature-card p {
    font-size: 0.85rem;
    line-height: 1.5 !important;
}

/* Tarjeta COMPONENTE TCNICO (scope-card-main) */
.scope-card-main h4,
.theme-3 .scope-card-main h4 {
    font-size: 0.85rem;
    font-weight: 800 !important;
    letter-spacing: 1px !important;
}

.scope-card-main li,
.scope-card-main p {
    font-size: 0.9rem;
    line-height: 1.55 !important;
}

/* Lista profesional dentro de tarjetas oscuras */
.professional-list li,
.theme-3 .professional-list li {
    font-size: 0.9rem;
    line-height: 1.55 !important;
}

/* Tarjetas de valor (VALOR AGREGADO / GARANTA) */
.value-tag-green p,
.value-tag-blue p,
.theme-3 .value-tag-green p,
.theme-3 .value-tag-blue p {
    font-size: 0.85rem;
    line-height: 1.5 !important;
}

/* Corregir alineacin de mens en el centro para que no choquen con la barra lateral */
.header-center-actions .dropdown-content {
    left: 0 !important;
    right: auto !important;
    transform: translateX(0) !important;
}

/* Asegurar que la cabecera est por encima de la barra lateral siempre */
.main-header {
    z-index: 999999 !important;
}

.design-side-panel {
    z-index: 9000 !important;
}

/* BOTON DE FIRMA PREMIUM */
.btn-sign-here {
    background: linear-gradient(135deg, #2D3EAF, #7B3FE4) !important;
    color: white !important;
    padding: 18px 30px !important;
    border-radius: 12px !important;
    font-weight: 700 !important;
    border: none !important;
    cursor: pointer !important;
    box-shadow: 0 10px 20px rgba(123, 63, 228, 0.4) !important;
    transition: all 0.3s ease !important;
    text-transform: uppercase !important;
    letter-spacing: 1px !important;
    display: block !important;
    margin: 20px auto !important;
}
.btn-sign-here:active { transform: scale(0.95); box-shadow: 0 5px 10px rgba(123, 63, 228, 0.2); }

body.is-client-mode button[onclick*="owner-"],
body.client-mode button[onclick*="owner-"] {
    display: none !important;
}
