:root {
    --primary-gradient: linear-gradient(135deg, #2D3EAF 0%, #7B3FE4 100%);
    --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: 350px;
    --logo-small-size: 60px;
}

* {
    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;
}

/* Header */
.main-header {
    background: #FFFFFF;
    height: 80px;
    border-bottom: 1px solid #E5E7EB;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 15px;
    /* Reducido para laptops */
    position: fixed;
    top: 0;
    width: 100%;
    z-index: 1000;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.03);
}

.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: 10000;
    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;
}

#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 {
    box-shadow: 0 5px 25px rgba(0, 0, 0, 0.05) !important;
    /* Sombra sutil de papel, sin marco */
    border: none !important;
}

body.client-mode #document-container {
    margin-left: 0;
}

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;
}

/* 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 {
    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: 1000;
}

.btn-delete-page {
    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 60px;
    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-bottom: var(--header-margin, 100px);
}

.brand-logo-small {
    height: var(--logo-small-size);
    width: auto;
}

/* PANEL DE DISEÑO GLOBAL */
.design-side-panel {
    position: fixed;
    left: 20px;
    top: 95px;
    /* Bajamos un poco para que no choque con la barra superior */
    width: 260px;
    background: white;
    padding: 30px;
    border-radius: 24px;
    border: 1px solid #E2E8F0;
    z-index: 9000;
    /* Justo debajo del header */
    display: flex;
    flex-direction: column;
    gap: 25px;
    transition: all 0.3s ease;
}

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: 30px;
    margin-bottom: var(--header-margin, 30px);
}

.header-tag {
    font-size: 0.75rem;
    letter-spacing: 1px;
    color: var(--text-light);
    text-transform: uppercase;
}

.content-body h3 {
    color: var(--accent-color);
    margin-top: var(--text-spacing, 20px);
    margin-bottom: 10px;
    font-size: 1.4rem;
    font-weight: 700;
}

.content-body p {
    line-height: 1.6;
    color: #334155;
    font-size: 1.12rem;
    margin-bottom: 1.2rem;
}

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

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

.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: auto;
    text-align: right;
    font-size: 0.85rem;
    color: var(--text-light);
    opacity: 0.8;
}

/* 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.8rem;
    font-weight: 800;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 10px;
    padding: 10px;
}

.signature-top h3:focus {
    background: white !important;
    -webkit-background-clip: initial;
    -webkit-text-fill-color: #1A1A2E !important;
    color: #1A1A2E !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 var(--text-main);
    margin-bottom: 10px;
}

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

.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: 20px;
}

/* 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(ellipse at 15% 15%, rgba(99, 102, 241, 0.4) 0%, rgba(99, 102, 241, 0.15) 35%, rgba(99, 102, 241, 0.05) 60%, transparent 100%),
        radial-gradient(ellipse at 85% 85%, rgba(121, 40, 202, 0.4) 0%, rgba(121, 40, 202, 0.15) 35%, rgba(121, 40, 202, 0.05) 60%, transparent 100%) !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 {
    color: rgba(255, 255, 255, 0.8) !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);
    /* Sutil resplandor texturizado */
}

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

.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.7) !important;
    font-size: 0.95rem;
}

/* 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 !important;
    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;
    }
}

.page.theme-3 .sig-canvas {
    filter: invert(1) brightness(2) !important;
}

/* Header Actions */
.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 {
    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: 10000;
    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(26, 26, 46, 0.9);
    backdrop-filter: blur(10px);
    z-index: 100000;
    display: flex;
    justify-content: center;
    align-items: center;
    animation: fadeIn 0.3s ease-out;
}

.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-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-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: white;
    border-radius: 16px;
    padding: 24px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.02);
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
}

.s2-client-card:hover {
    border-color: var(--accent-color);
    box-shadow: 0 8px 25px rgba(123, 63, 228, 0.08);
    transform: translateY(-2px);
}

.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: 10000;
        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 !important;
    }

    .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 15px 150px !important;
        /* 15px padding izquierdo y derecho para que respire */
        width: 100vw !important;
        box-sizing: border-box !important;
        overflow-x: hidden !important;
        align-items: flex-start !important;
    }

    #zoom-wrapper {
        width: 800px !important;
        max-width: 800px !important;
        padding: 0 !important;
        gap: 40px !important;
        transform-origin: top left !important;
        margin: 0 !important;
    }

    .page {
        margin: 0 auto !important;
        box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1) !important;
    }
}

/* FIX PARA MODO CLIENTE EN MOVIL */
body.client-mode #document-container {
    margin-top: 100px !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;
    }
}

/* 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 inyectado dinámicamente para cliente en móvil */
.client-fab-save {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 999999;
    width: auto;
    padding: 12px 32px;
    font-size: 0.95rem;
    font-weight: 600;
    font-family: 'Outfit', sans-serif;
    color: white;
    background: linear-gradient(135deg, #2D3EAF, #7B3FE4);
    border: none;
    border-radius: 50px;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(123, 63, 228, 0.35);
    letter-spacing: 0.3px;
}

.client-fab-save:active {
    transform: translateX(-50%) scale(0.96);
    box-shadow: 0 2px 12px rgba(123, 63, 228, 0.5);
}

/* 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 {
        margin: 0 !important;
        box-shadow: none !important;
        page-break-after: always;
        width: 210mm !important;
        height: 297mm !important;
    }
}