        :root {
            --app-header-h: 64px;
            --editor-toolbar-h: 56px;
            --editor-ui-top: 120px;
        }
        body {
            background-color: #0f172a;
            background-image: radial-gradient(ellipse 80% 80% at 50% -20%,
                rgba(239,68,68,.10), rgba(15,23,42,1));
        }
        .pdf-page-wrapper {
            position: relative;
            display: inline-block;
            background: #fff;
            margin-bottom: 3.5rem;
            box-shadow: 0 25px 50px -12px rgba(0,0,0,.70);
        }
        .interactive-layer {
            position: absolute;
            inset: 0;
            z-index: 10;
            pointer-events: none;
        }

        .text-wrapper {
            position: absolute;
            pointer-events: auto;
            box-sizing: border-box;
            border: 1px solid transparent;
            transition: border-color .12s, background-color .12s;
            background-color: transparent;
            overflow: visible;
        }
        .text-wrapper:hover { border-color: rgba(59,130,246,.45); background-color: rgba(59,130,246,.04); }
        .text-wrapper.selected { border-color: rgba(59,130,246,.7); }
        .text-wrapper.editing {
            border-color: transparent !important;
            outline: 2px dashed #3b82f6;
            outline-offset: 0;
            z-index: 50;
        }

        .text-bg {
            position: absolute;
            inset: 0;
            background: transparent;
            pointer-events: none;
            z-index: 0;
        }
        .text-wrapper.has-custom-bg .text-bg {
            background: var(--bg-color, rgba(255,255,255,1));
        }
        .text-wrapper.editing .text-bg {
            background: var(--edit-bg-color, var(--bg-color, rgba(255,255,255,1)));
        }

        .text-content {
            position: absolute;
            left: var(--pad-x, 2px);
            top: var(--pad-y, 1px);
            right: var(--pad-x, 2px);
            bottom: var(--pad-y, 1px);
            outline: none;
            white-space: pre-wrap;
            word-break: break-word;
            color: transparent; 
            box-sizing: border-box;
            overflow: hidden;
            cursor: move;
            z-index: 1;
            line-height: var(--text-line-height, 1.05);
            background: transparent;
        }
        .text-wrapper.has-custom-bg .text-content,
        .text-wrapper.editing .text-content {
            color: var(--txt-color, #000) !important;
        }
        .text-wrapper.editing .text-content { cursor: text; }

        .img-block, .mask-block {
            position: absolute;
            pointer-events: auto;
            cursor: move;
            box-sizing: border-box;
            z-index: 5;
        }
        .img-block { border: 2px solid transparent; }
        .img-block:hover, .img-block.selected { border-color: #10b981; z-index: 55; }
        .img-block img {
            width: 100%; height: 100%;
            display: block; pointer-events: none;
            object-fit: fill;
        }
        .mask-block { border: 1.5px dashed transparent; }
        .mask-block:hover, .mask-block.selected { border-color: #ef4444; }

        .rh {
            position: absolute;
            width: 10px; height: 10px;
            background: #3b82f6;
            border: 2px solid #fff;
            border-radius: 2px;
            pointer-events: auto;
            z-index: 60;
            display: none;
        }
        .selected .rh { display: block; }
        .rh.nw { top:-5px; left:-5px;  cursor:nw-resize; }
        .rh.ne { top:-5px; right:-5px; cursor:ne-resize; }
        .rh.sw { bottom:-5px; left:-5px;  cursor:sw-resize; }
        .rh.se { bottom:-5px; right:-5px; cursor:se-resize; }
        /* Barra de edición fija moderna autoadaptable */
        #ftoolbar {
            position: fixed !important;
            top: var(--app-header-h, 64px) !important;
            left: 0 !important;
            right: 0 !important;
            width: 100% !important;
            z-index: 9999;
            min-height: 52px;
            max-height: min(36vh, 210px);
            display: flex;
            flex-wrap: wrap;
            align-items: center;
            align-content: flex-start;
            justify-content: flex-start;
            gap: 8px;
            row-gap: 8px;
            padding: 8px 14px;
            overflow-x: hidden;
            overflow-y: auto;
            pointer-events: auto;
            background: rgba(248,250,252,.94);
            border: 0;
            border-bottom: 1px solid rgba(148,163,184,.42);
            box-shadow: 0 10px 28px rgba(15,23,42,.12);
            backdrop-filter: blur(18px);
            -webkit-backdrop-filter: blur(18px);
            scrollbar-width: thin;
        }
        #ftoolbar::-webkit-scrollbar { height: 6px; width: 6px; }
        #ftoolbar::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 999px; }
        #ftoolbar.hidden { display: none !important; }
        #ftoolbar.toolbar-disabled {
            opacity: .92;
            filter: none;
        }
        #ftoolbar.toolbar-disabled button:not(.history-btn):not(.mobile-tools-action):not(.mobile-edit-toggle),
        #ftoolbar.toolbar-disabled select,
        #ftoolbar.toolbar-disabled input,
        #ftoolbar.toolbar-disabled .text-ctrl,
        #ftoolbar.toolbar-disabled .bg-color-ctrl,
        #ftoolbar.toolbar-disabled .opac-ctrl,
        #ftoolbar.toolbar-disabled .box-ctrl {
            opacity: .42;
            pointer-events: none;
        }
        #ftoolbar > * {
            flex: 0 0 auto;
        }
        #ftoolbar button,
        #ftoolbar select {
            min-height: 34px;
            padding: 7px 11px;
            border-radius: 12px;
            font-size: 12px;
            font-weight: 850;
            color: #334155;
            border: 1px solid rgba(203,213,225,.95);
            background: linear-gradient(180deg,#ffffff,#f8fafc);
            cursor: pointer;
            white-space: nowrap;
            transition: transform .12s ease, background .12s ease, border-color .12s ease, color .12s ease, box-shadow .12s ease;
            box-shadow: 0 1px 2px rgba(15,23,42,.05);
        }
        #ftoolbar button:hover:not(:disabled),
        #ftoolbar select:hover {
            transform: translateY(-1px);
            background: #ffffff;
            border-color: #818cf8;
            color: #3730a3;
            box-shadow: 0 6px 14px rgba(79,70,229,.14);
        }
        #ftoolbar button.active {
            background: linear-gradient(135deg,#4f46e5,#2563eb);
            color: #ffffff;
            border-color: transparent;
            box-shadow: 0 8px 18px rgba(79,70,229,.25);
        }
        #ftoolbar .history-btn {
            min-width: 96px;
        }
        #ftoolbar .history-btn:disabled {
            opacity: .35 !important;
            cursor: not-allowed;
            transform: none !important;
            box-shadow: none !important;
        }
        #ftoolbar .tsep {
            width: 1px;
            height: 28px;
            background: linear-gradient(180deg, transparent, #cbd5e1, transparent);
            margin: 0 4px;
            flex-shrink: 0;
        }
        #ftoolbar input[type=color] {
            width: 32px;
            height: 32px;
            border: 1px solid #cbd5e1;
            border-radius: 10px;
            cursor: pointer;
            padding: 2px;
            background: #fff;
        }
        #ftoolbar input[type=range] {
            accent-color: #4f46e5;
            cursor: pointer;
            max-width: 120px;
        }
        #ftoolbar .fs-display {
            font-size: 12px;
            color: #475569;
            min-width: 30px;
            text-align: center;
            font-weight: 800;
        }
        #ftoolbar select {
            max-width: 150px;
            outline: none;
        }
        #tb-drag-handle { display: none !important; }

        @media (max-width: 1280px) {
            #ftoolbar {
                gap: 6px;
                row-gap: 7px;
                padding: 7px 10px;
            }
            #ftoolbar button,
            #ftoolbar select {
                font-size: 11px;
                padding: 6px 9px;
                min-height: 32px;
            }
            #ftoolbar .history-btn {
                min-width: auto;
            }
        }
        @media (max-width: 900px) {
            #ftoolbar {
                max-height: min(42vh, 260px);
                gap: 5px;
                row-gap: 6px;
            }
            #ftoolbar .tsep {
                display: none;
            }
            #ftoolbar button,
            #ftoolbar select {
                border-radius: 10px;
                font-size: 11px;
                padding: 6px 8px;
            }
            #ftoolbar input[type=range] {
                max-width: 86px;
            }
        }
        @media (max-width: 560px) {
            #ftoolbar {
                padding: 6px;
                gap: 4px;
                row-gap: 5px;
            }
            #ftoolbar button {
                min-width: 34px;
                padding-left: 7px;
                padding-right: 7px;
            }
            #ftoolbar select {
                max-width: 118px;
            }
            #ftoolbar .opac-ctrl span:first-child,
            #ftoolbar .bg-color-ctrl span {
                display: none;
            }
        }


        /* Panel lateral izquierdo con conteo y miniaturas de hojas */
        #pdf-sidebar {
            position: fixed;
            left: 0;
            top: var(--editor-ui-top, 120px);
            bottom: 0;
            width: 230px;
            z-index: 45;
            background: #f8fafc;
            color: #0f172a;
            border-right: 1px solid #cbd5e1;
            overflow-y: auto;
            padding: 12px;
            box-shadow: inset -1px 0 0 rgba(148,163,184,.35);
        }
        #pdf-sidebar.hidden { display: none !important; }
        #pdf-sidebar .side-title {
            font-size: 12px;
            font-weight: 900;
            letter-spacing: .04em;
            text-transform: uppercase;
            color: #475569;
            margin-bottom: 6px;
        }
        #pdf-sidebar .side-count {
            font-size: 13px;
            font-weight: 800;
            color: #1d4ed8;
            background: #eff6ff;
            border: 1px solid #bfdbfe;
            border-radius: 10px;
            padding: 8px 10px;
            margin-bottom: 12px;
        }
        #pdf-page-list {
            display: flex;
            flex-direction: column;
            gap: 12px;
        }
        .pdf-thumb {
            background: #ffffff;
            border: 2px solid #e2e8f0;
            border-radius: 10px;
            padding: 7px;
            cursor: pointer;
            transition: border-color .12s, box-shadow .12s, transform .12s;
        }
        .pdf-thumb:hover,
        .pdf-thumb.active {
            border-color: #4f46e5;
            box-shadow: 0 8px 18px rgba(79,70,229,.18);
            transform: translateY(-1px);
        }
        .pdf-thumb canvas {
            width: 100%;
            height: auto;
            display: block;
            border-radius: 5px;
            border: 1px solid #e2e8f0;
            background: #fff;
        }
        .pdf-thumb-label {
            display: block;
            margin-top: 6px;
            text-align: center;
            font-size: 11px;
            font-weight: 900;
            color: #475569;
        }
        body.pdf-loaded main#app-main {
            margin-left: 230px;
            margin-right: 0;
            width: calc(100vw - 230px);
            max-width: calc(100vw - 230px);
            padding-top: calc(var(--editor-toolbar-h, 56px) + 28px);
        }
        @media (max-width: 900px) {
            #pdf-sidebar {
                width: 155px;
                top: var(--editor-ui-top, 120px);
            }
            body.pdf-loaded main#app-main {
                margin-left: 155px;
                margin-right: 0;
                width: calc(100vw - 155px);
                max-width: calc(100vw - 155px);
            }
            #ftoolbar {
                top: var(--app-header-h, 58px) !important;
                padding: 6px 8px;
            }
        }


        /* Modal marca de agua */
        #watermark-modal {
            position: fixed;
            inset: 0;
            z-index: 10060;
            display: none;
            align-items: center;
            justify-content: center;
            padding: 18px;
            background: rgba(15,23,42,.72);
        }
        #watermark-modal.open { display: flex; }
        .watermark-box {
            width: min(760px, 96vw);
            background: #f8fafc;
            color: #0f172a;
            border-radius: 18px;
            overflow: hidden;
            border: 1px solid rgba(203,213,225,.9);
            box-shadow: 0 30px 90px rgba(0,0,0,.38);
        }
        .watermark-head {
            padding: 17px 20px;
            background: #ffffff;
            border-bottom: 1px solid #e2e8f0;
            font-size: 16px;
            font-weight: 950;
        }
        .watermark-body {
            padding: 18px;
            background: #ffffff;
            display: grid;
            gap: 14px;
        }
        .watermark-grid {
            display: grid;
            grid-template-columns: repeat(2, minmax(0, 1fr));
            gap: 12px;
        }
        .watermark-field label {
            display: block;
            font-size: 11px;
            font-weight: 950;
            color: #64748b;
            text-transform: uppercase;
            letter-spacing: .04em;
            margin-bottom: 6px;
        }
        .watermark-field input,
        .watermark-field select {
            width: 100%;
            border: 1px solid #cbd5e1;
            border-radius: 11px;
            padding: 11px 12px;
            outline: none;
            color: #0f172a;
            background: #f8fafc;
            font-weight: 750;
        }
        .watermark-field input:focus,
        .watermark-field select:focus {
            border-color: #6366f1;
            box-shadow: 0 0 0 3px rgba(99,102,241,.15);
            background: #ffffff;
        }
        #watermark-preview {
            min-height: 180px;
            border: 1px dashed #94a3b8;
            border-radius: 14px;
            background:
                linear-gradient(45deg, #f8fafc 25%, transparent 25%),
                linear-gradient(-45deg, #f8fafc 25%, transparent 25%),
                linear-gradient(45deg, transparent 75%, #f8fafc 75%),
                linear-gradient(-45deg, transparent 75%, #f8fafc 75%);
            background-size: 24px 24px;
            background-position: 0 0, 0 12px, 12px -12px, -12px 0px;
            display: flex;
            align-items: center;
            justify-content: center;
            overflow: hidden;
            color: var(--wm-color, #64748b);
        }
        #watermark-preview span {
            font-family: Arial Black, Impact, sans-serif;
            font-size: 48px;
            font-weight: 950;
            opacity: var(--wm-opacity, .18);
            transform: rotate(var(--wm-rotation, -35deg));
            white-space: nowrap;
            letter-spacing: .05em;
        }
        .watermark-footer {
            display: flex;
            justify-content: flex-end;
            gap: 10px;
            padding: 14px 18px;
            background: #f1f5f9;
            border-top: 1px solid #e2e8f0;
        }
        .watermark-btn {
            padding: 10px 15px;
            border-radius: 10px;
            font-size: 13px;
            font-weight: 950;
            border: 1px solid #cbd5e1;
            background: #ffffff;
            color: #334155;
            cursor: pointer;
        }
        .watermark-btn.primary {
            color: #ffffff;
            border-color: transparent;
            background: linear-gradient(135deg,#0ea5e9,#6366f1);
            box-shadow: 0 8px 18px rgba(79,70,229,.22);
        }
        @media (max-width: 640px) {
            .watermark-grid { grid-template-columns: 1fr; }
        }

        /* Modal para agregar firma */
        #signature-modal {
            position: fixed;
            inset: 0;
            z-index: 10050;
            background: rgba(15,23,42,.72);
            display: none;
            align-items: center;
            justify-content: center;
            padding: 18px;
        }
        #signature-modal.open { display: flex; }
        .signature-box {
            width: min(760px, 96vw);
            background: #f8fafc;
            color: #0f172a;
            border-radius: 14px;
            box-shadow: 0 25px 80px rgba(0,0,0,.35);
            overflow: hidden;
            border: 1px solid #cbd5e1;
        }
        .signature-head {
            padding: 16px 20px;
            background: #ffffff;
            border-bottom: 1px solid #e2e8f0;
            font-weight: 900;
        }
        .signature-tabs {
            display: flex;
            gap: 8px;
            padding: 10px 18px 0;
            background: #f1f5f9;
            border-bottom: 1px solid #e2e8f0;
        }
        .signature-tab {
            padding: 10px 14px;
            font-size: 13px;
            font-weight: 800;
            color: #475569;
            border: 1px solid transparent;
            border-bottom: 0;
            background: transparent;
            cursor: pointer;
        }
        .signature-tab.active {
            background: #ffffff;
            color: #4f46e5;
            border-color: #c7d2fe;
            border-radius: 8px 8px 0 0;
        }
        .signature-body {
            background: #ffffff;
            padding: 18px;
        }
        .signature-panel { display: none; }
        .signature-panel.active { display: block; }
        #signature-draw-canvas {
            width: 100%;
            height: 230px;
            border: 1px dashed #94a3b8;
            border-radius: 8px;
            background:
                linear-gradient(45deg, #f8fafc 25%, transparent 25%),
                linear-gradient(-45deg, #f8fafc 25%, transparent 25%),
                linear-gradient(45deg, transparent 75%, #f8fafc 75%),
                linear-gradient(-45deg, transparent 75%, #f8fafc 75%);
            background-size: 22px 22px;
            background-position: 0 0, 0 11px, 11px -11px, -11px 0px;
            cursor: crosshair;
            touch-action: none;
        }
        .signature-type-preview {
            height: 92px;
            border: 1px solid #cbd5e1;
            border-radius: 8px;
            background: #fff;
            display: flex;
            align-items: center;
            justify-content: center;
            margin-bottom: 14px;
            font-size: 42px;
            color: var(--sig-color, #000);
            font-family: "Great Vibes", "Brush Script MT", "Segoe Script", cursive;
            font-style: italic;
        }
        .signature-options {
            display: flex;
            flex-wrap: wrap;
            gap: 12px;
            align-items: center;
            margin-bottom: 14px;
        }
        .signature-color {
            width: 24px;
            height: 24px;
            border-radius: 999px;
            border: 2px solid #cbd5e1;
            cursor: pointer;
        }
        .signature-color.active {
            outline: 3px solid #6366f1;
            outline-offset: 2px;
        }
        .signature-footer {
            display: flex;
            justify-content: flex-end;
            gap: 10px;
            padding: 14px 18px;
            background: #f1f5f9;
            border-top: 1px solid #e2e8f0;
        }
        .signature-btn {
            padding: 10px 15px;
            border-radius: 8px;
            font-size: 13px;
            font-weight: 900;
            border: 1px solid #cbd5e1;
            background: #fff;
            color: #334155;
            cursor: pointer;
        }
        .signature-btn.primary {
            background: #4f46e5;
            color: #fff;
            border-color: #4f46e5;
        }
        .signature-btn:disabled {
            opacity: .45;
            cursor: not-allowed;
        }

        .signature-font-grid {
            display: grid;
            grid-template-columns: repeat(2, minmax(0, 1fr));
            gap: 10px;
        }
        .signature-font-card {
            display: flex;
            align-items: center;
            gap: 10px;
            border: 1px solid #e2e8f0;
            border-radius: 10px;
            padding: 12px 14px;
            cursor: pointer;
            background: #fff;
            transition: border-color .12s, background .12s, box-shadow .12s;
        }
        .signature-font-card:hover {
            border-color: #818cf8;
            background: #f8fafc;
        }
        .signature-font-card:has(input:checked) {
            border-color: #6366f1;
            box-shadow: 0 0 0 2px rgba(99,102,241,.14);
            background: #eef2ff;
        }
        .signature-font-card span {
            font-size: 30px;
            line-height: 1;
        }
        @media (max-width: 640px) {
            .signature-font-grid { grid-template-columns: 1fr; }
        }

        #signature-image-preview {
            max-width: 100%;
            max-height: 210px;
            display: none;
            margin: 12px auto 0;
            border: 1px solid #cbd5e1;
            border-radius: 8px;
            background: #fff;
        }


        /* Pantalla de carga PDF */
        #loading-overlay {
            position: fixed;
            inset: 0;
            z-index: 12000;
            background: rgba(15,23,42,.82);
            backdrop-filter: blur(14px);
            -webkit-backdrop-filter: blur(14px);
            display: none;
            align-items: center;
            justify-content: center;
            padding: 18px;
        }
        #loading-overlay.show { display: flex; }
        .loading-card {
            width: min(430px, 92vw);
            background: rgba(15,23,42,.96);
            border: 1px solid rgba(148,163,184,.28);
            border-radius: 22px;
            box-shadow: 0 30px 90px rgba(0,0,0,.42);
            padding: 26px;
            color: #e2e8f0;
            text-align: center;
        }
        .loading-spinner {
            width: 54px;
            height: 54px;
            border-radius: 999px;
            border: 5px solid rgba(148,163,184,.22);
            border-top-color: #ef4444;
            margin: 0 auto 16px;
            animation: spinLoader .85s linear infinite;
        }
        @keyframes spinLoader {
            to { transform: rotate(360deg); }
        }
        .loading-title {
            font-weight: 950;
            font-size: 18px;
            margin-bottom: 6px;
        }
        .loading-subtitle {
            font-size: 13px;
            color: #94a3b8;
            margin-bottom: 16px;
        }
        .loading-progress {
            height: 10px;
            background: rgba(51,65,85,.85);
            border-radius: 999px;
            overflow: hidden;
            border: 1px solid rgba(148,163,184,.18);
        }
        #loader-bar {
            height: 100%;
            width: 0%;
            background: linear-gradient(90deg,#ef4444,#f59e0b);
            border-radius: 999px;
            transition: width .22s ease;
        }
        #loader-percent {
            margin-top: 10px;
            font-size: 12px;
            font-weight: 900;
            color: #cbd5e1;
        }

        /* Evita que al escribir se vea letra por letra o se encoja el cuadro */
        .text-wrapper.editing {
            min-width: var(--edit-min-w, 0px);
            min-height: var(--edit-min-h, 0px);
        }
        .text-wrapper.editing .text-content {
            overflow: visible !important;
            white-space: pre;
            word-break: normal;
            overflow-wrap: normal;
            caret-color: var(--txt-color, #000);
        }

        .page-label { position: absolute; top: -28px; left: 0; color: #64748b; font-size: 11px; font-weight: 700; pointer-events: none; }

        /* ===== TEMA CLARO + AUTO RESPONSIVO ===== */
        html, body {
            background: #f8fafc !important;
            color: #0f172a !important;
            overflow-x: hidden;
        }

        body {
            background-image:
                radial-gradient(circle at top left, rgba(239,68,68,.08), transparent 34rem),
                linear-gradient(180deg, #ffffff 0%, #f8fafc 42%, #eef2f7 100%) !important;
        }

        .app-header {
            min-height: 64px;
        }

        .app-header img {
            max-height: 48px;
            max-width: min(280px, 48vw);
            object-fit: contain;
        }

        #editor-controls {
            max-width: 100%;
        }

        #editor-controls button {
            white-space: nowrap;
        }

        main#app-main {
            width: 100%;
            max-width: 100%;
        }

        #workspace {
            overflow-x: auto;
            align-items: center;
        }

        .pdf-page-wrapper {
            max-width: min(100%, calc(100vw - 2rem));
            overflow: visible;
            box-shadow: 0 18px 42px rgba(15,23,42,.14);
        }

        .pdf-page-wrapper canvas {
            max-width: 100%;
            height: auto !important;
            display: block;
        }

        #dropzone {
            max-width: min(620px, calc(100vw - 2rem));
        }

        #status {
            max-width: min(860px, calc(100vw - 2rem));
        }

        #pdf-sidebar {
            background: #ffffff !important;
            border-right: 1px solid #e2e8f0 !important;
            box-shadow: 6px 0 18px rgba(15,23,42,.04) !important;
        }

        #ftoolbar {
            background: rgba(255,255,255,.96) !important;
            border-bottom: 1px solid #e2e8f0 !important;
            box-shadow: 0 8px 22px rgba(15,23,42,.08) !important;
        }

        .loading-card {
            background: #ffffff !important;
            color: #0f172a !important;
        }
        .loading-subtitle,
        #loader-percent {
            color: #64748b !important;
        }
        .loading-progress {
            background: #e2e8f0 !important;
        }

        @media (max-width: 1100px) {
            .app-header {
                align-items: flex-start;
            }

            #editor-controls {
                flex: 1 1 100%;
                width: 100%;
                overflow-x: auto;
                flex-wrap: nowrap;
                justify-content: flex-start;
                padding-bottom: .45rem;
                scrollbar-width: thin;
            }

            #editor-controls::-webkit-scrollbar {
                height: 6px;
            }

            #editor-controls::-webkit-scrollbar-thumb {
                background: #cbd5e1;
                border-radius: 999px;
            }
        }

        @media (max-width: 760px) {
            :root {
                --mobile-sidebar-h: 142px;
            }

            .app-header {
                padding-left: .75rem !important;
                padding-right: .75rem !important;
            }

            .app-header img {
                max-width: 72vw;
                max-height: 42px;
            }

            #editor-controls {
                gap: .4rem;
                border-radius: 14px;
            }

            #editor-controls button {
                padding: .55rem .75rem;
                font-size: 11px;
            }

            #pdf-sidebar {
                left: 0;
                right: 0;
                width: 100% !important;
                height: var(--mobile-sidebar-h);
                bottom: auto;
                top: var(--editor-ui-top, 120px);
                border-right: 0 !important;
                border-bottom: 1px solid #e2e8f0 !important;
                display: block;
                overflow-x: auto;
                overflow-y: hidden;
                padding: 10px;
                z-index: 46;
            }

            #pdf-sidebar.hidden {
                display: none !important;
            }

            #pdf-sidebar .side-title {
                display: none;
            }

            #pdf-sidebar .side-count {
                display: inline-flex;
                align-items: center;
                height: 38px;
                margin: 0 10px 0 0;
                vertical-align: top;
                white-space: nowrap;
            }

            #pdf-page-list {
                display: inline-flex;
                flex-direction: row;
                gap: 10px;
                vertical-align: top;
                width: auto;
            }

            .pdf-thumb {
                width: 92px;
                min-width: 92px;
                padding: 5px;
            }

            .pdf-thumb-label {
                font-size: 10px;
                margin-top: 4px;
            }

            body.pdf-loaded main#app-main {
                margin-left: 0 !important;
                width: 100% !important;
                max-width: 100% !important;
                padding-top: calc(var(--editor-toolbar-h, 56px) + var(--mobile-sidebar-h) + 26px) !important;
            }

            .pdf-page-wrapper {
                transform-origin: top center;
                max-width: calc(100vw - 1rem);
            }

            #ftoolbar {
                max-height: 38vh;
                padding: 6px;
                gap: 5px;
            }

            #ftoolbar button,
            #ftoolbar select {
                font-size: 11px;
                min-height: 31px;
                padding: 5px 8px;
            }
        }

        @media (max-width: 480px) {
            .app-header img {
                max-width: 68vw;
                max-height: 38px;
            }

            #dropzone {
                padding: 2rem 1.1rem !important;
                border-radius: 20px !important;
            }

            #dropzone .w-16 {
                width: 3.25rem !important;
                height: 3.25rem !important;
            }

            #editor-controls button {
                padding: .5rem .65rem;
                font-size: 10.5px;
            }

            .watermark-box,
            .signature-box {
                width: calc(100vw - 1rem) !important;
                max-height: calc(100vh - 1rem);
                overflow-y: auto;
            }
        }

        /* ===== SECCIONES INFORMATIVAS ANTES DE SUBIR PDF ===== */
        #landing-content {
            width: 100%;
            max-width: 1120px;
            margin: 4rem auto 0;
            padding: 0 1rem 4rem;
        }

        .landing-section {
            margin-top: 3.5rem;
        }

        .landing-title {
            font-size: clamp(1.65rem, 3vw, 2.45rem);
            line-height: 1.12;
            font-weight: 950;
            color: #0f172a;
            text-align: center;
            letter-spacing: -.035em;
            margin-bottom: .9rem;
        }

        .landing-subtitle {
            max-width: 760px;
            margin: 0 auto 2.2rem;
            text-align: center;
            color: #475569;
            font-size: clamp(.98rem, 1.45vw, 1.08rem);
            line-height: 1.75;
        }

        .feature-grid {
            display: grid;
            grid-template-columns: repeat(3, minmax(0, 1fr));
            gap: 1rem;
        }

        .feature-card,
        .info-card,
        .faq-item {
            background: rgba(255,255,255,.92);
            border: 1px solid #e2e8f0;
            border-radius: 24px;
            padding: 1.35rem;
            box-shadow: 0 18px 45px rgba(15,23,42,.06);
        }

        .feature-icon {
            width: 46px;
            height: 46px;
            border-radius: 16px;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            background: linear-gradient(135deg,#ef4444,#f97316);
            color: #fff;
            font-size: 1.25rem;
            box-shadow: 0 10px 22px rgba(239,68,68,.22);
            margin-bottom: 1rem;
        }

        .feature-card h3,
        .info-card h3 {
            font-size: 1.04rem;
            font-weight: 900;
            color: #0f172a;
            margin-bottom: .55rem;
        }

        .feature-card p,
        .info-card p,
        .faq-item p,
        .step-list p {
            color: #475569;
            line-height: 1.65;
            font-size: .95rem;
        }

        .split-section {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 1.4rem;
            align-items: center;
        }

        .info-card.highlight {
            background:
                radial-gradient(circle at top right, rgba(239,68,68,.09), transparent 15rem),
                #ffffff;
        }

        .step-list {
            display: grid;
            gap: .85rem;
            counter-reset: pasos;
        }

        .step-item {
            position: relative;
            padding: 1rem 1rem 1rem 3.7rem;
            border: 1px solid #e2e8f0;
            border-radius: 18px;
            background: #fff;
            box-shadow: 0 12px 28px rgba(15,23,42,.04);
        }

        .step-item::before {
            counter-increment: pasos;
            content: counter(pasos);
            position: absolute;
            left: 1rem;
            top: 1rem;
            width: 32px;
            height: 32px;
            border-radius: 12px;
            background: #0f172a;
            color: #fff;
            display: grid;
            place-items: center;
            font-weight: 950;
            font-size: .85rem;
        }

        .step-item strong {
            display: block;
            color: #0f172a;
            font-weight: 900;
            margin-bottom: .2rem;
        }

        .faq-grid {
            display: grid;
            grid-template-columns: repeat(2, minmax(0, 1fr));
            gap: 1rem;
        }

        .faq-item h3 {
            font-size: 1rem;
            font-weight: 900;
            color: #0f172a;
            margin-bottom: .45rem;
        }

        .seo-keywords {
            display: flex;
            flex-wrap: wrap;
            justify-content: center;
            gap: .65rem;
            margin-top: 1.35rem;
        }

        .seo-keywords span {
            border: 1px solid #fecaca;
            background: #fff1f2;
            color: #b91c1c;
            border-radius: 999px;
            padding: .48rem .85rem;
            font-size: .82rem;
            font-weight: 850;
        }

        .landing-footer {
            margin-top: 3.5rem;
            text-align: center;
            color: #64748b;
            font-size: .9rem;
            padding: 2rem 1rem;
            border-top: 1px solid #e2e8f0;
        }

        body.pdf-loaded #landing-content {
            display: none !important;
        }

        @media (max-width: 900px) {
            #landing-content {
                margin-top: 3rem;
                padding-bottom: 3rem;
            }

            .feature-grid,
            .split-section,
            .faq-grid {
                grid-template-columns: 1fr;
            }

            .landing-section {
                margin-top: 2.6rem;
            }
        }

        @media (max-width: 520px) {
            #landing-content {
                padding-left: .75rem;
                padding-right: .75rem;
            }

            .feature-card,
            .info-card,
            .faq-item {
                border-radius: 18px;
                padding: 1.05rem;
            }

            .step-item {
                padding: .95rem .95rem .95rem 3.35rem;
            }
        }
        /* ===== FIN SECCIONES INFORMATIVAS ===== */


        /* ===== MÓVIL LIMPIO: SIN MINIATURAS + MENÚS DESPLEGABLES ===== */
        .mobile-tools-toggle,
        .mobile-edit-toggle {
            display: none;
        }

        .mobile-menu-backdrop {
            display: none;
        }

        @media (max-width: 760px) {
            html, body {
                width: 100%;
                max-width: 100%;
                overflow-x: hidden !important;
                background: #f8fafc !important;
            }

            .app-header {
                position: sticky !important;
                top: 0 !important;
                min-height: 58px !important;
                display: grid !important;
                grid-template-columns: 1fr auto;
                align-items: center !important;
                gap: .65rem !important;
                padding: .58rem .75rem !important;
                background: rgba(255,255,255,.96) !important;
                z-index: 10020 !important;
            }

            .app-header a[aria-label] {
                min-width: 0;
                overflow: hidden;
            }

            .app-header img {
                max-width: min(58vw, 230px) !important;
                max-height: 40px !important;
                object-fit: contain !important;
            }

            .mobile-tools-toggle {
                display: none;
                align-items: center;
                justify-content: center;
                border: 0;
                background: linear-gradient(135deg,#ef4444,#f97316);
                color: #ffffff;
                font-size: 12px;
                font-weight: 950;
                border-radius: 999px;
                padding: .72rem .88rem;
                box-shadow: 0 10px 22px rgba(239,68,68,.22);
                white-space: nowrap;
                min-height: 40px;
            }

            body.pdf-loaded .mobile-tools-toggle {
                display: inline-flex;
            }

            /* El menú superior ya no aparece regado: se vuelve bottom-sheet */
            #editor-controls {
                position: fixed !important;
                left: .75rem !important;
                right: .75rem !important;
                bottom: calc(74px + env(safe-area-inset-bottom)) !important;
                top: auto !important;
                width: auto !important;
                max-width: none !important;
                max-height: min(68vh, 460px) !important;
                overflow-y: auto !important;
                display: none !important;
                grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
                gap: .6rem !important;
                padding: .85rem !important;
                background: rgba(255,255,255,.98) !important;
                border: 1px solid #e2e8f0 !important;
                border-radius: 24px !important;
                box-shadow: 0 28px 80px rgba(15,23,42,.22) !important;
                z-index: 12050 !important;
            }

            body.mobile-tools-open #editor-controls:not(.hidden) {
                display: grid !important;
            }

            #editor-controls button {
                width: 100% !important;
                min-height: 48px !important;
                display: inline-flex !important;
                align-items: center !important;
                justify-content: center !important;
                padding: .78rem .68rem !important;
                font-size: 12px !important;
                line-height: 1.1 !important;
                border-radius: 16px !important;
                white-space: normal !important;
                text-align: center !important;
            }

            #editor-controls .h-6.w-px {
                display: none !important;
            }

            #editor-controls button[onclick="saveAndDownload()"] {
                grid-column: 1 / -1 !important;
                min-height: 52px !important;
                font-size: 13px !important;
            }

            /* NO mostrar visualización/miniaturas de páginas en móvil */
            #pdf-sidebar {
                display: none !important;
            }

            body.pdf-loaded main#app-main {
                margin-left: 0 !important;
                margin-right: 0 !important;
                width: 100% !important;
                max-width: 100% !important;
                padding: .9rem .55rem calc(92px + env(safe-area-inset-bottom)) !important;
            }

            #status {
                max-width: calc(100vw - 1.1rem) !important;
                margin: .55rem auto .75rem !important;
                padding: .75rem .9rem !important;
                border-radius: 16px !important;
                font-size: 13px !important;
                line-height: 1.45 !important;
            }

            #workspace {
                width: 100% !important;
                max-width: 100% !important;
                padding: 0 0 1.5rem !important;
                overflow-x: auto !important;
                overflow-y: visible !important;
                align-items: flex-start !important;
                -webkit-overflow-scrolling: touch;
            }

            .pdf-page-wrapper {
                margin: .4rem auto 1.25rem !important;
                box-shadow: 0 12px 28px rgba(15,23,42,.12) !important;
                transform-origin: top left !important;
            }

            .page-label {
                display: none !important;
            }

            /* Barra de edición: abajo, compacta, como app móvil */
            #ftoolbar {
                position: fixed !important;
                top: auto !important;
                left: .65rem !important;
                right: .65rem !important;
                bottom: calc(.55rem + env(safe-area-inset-bottom)) !important;
                width: auto !important;
                min-height: 58px !important;
                max-height: none !important;
                display: grid !important;
                grid-template-columns: 1.15fr .85fr .85fr !important;
                gap: .5rem !important;
                padding: .55rem !important;
                overflow: visible !important;
                background: rgba(255,255,255,.98) !important;
                border: 1px solid #e2e8f0 !important;
                border-radius: 22px !important;
                box-shadow: 0 18px 50px rgba(15,23,42,.20) !important;
                z-index: 12040 !important;
                backdrop-filter: blur(16px);
                -webkit-backdrop-filter: blur(16px);
            }

            #ftoolbar.hidden {
                display: none !important;
            }

            .mobile-edit-toggle {
                display: inline-flex !important;
                align-items: center !important;
                justify-content: center !important;
                min-height: 44px !important;
                border-radius: 16px !important;
                border: 0 !important;
                background: linear-gradient(135deg,#0f172a,#334155) !important;
                color: #ffffff !important;
                font-size: 12px !important;
                font-weight: 950 !important;
                padding: .72rem .55rem !important;
                white-space: nowrap !important;
                box-shadow: none !important;
            }

            #ftoolbar:not(.mobile-edit-open) > *:not(#mobile-edit-toggle):not(.history-btn) {
                display: none !important;
            }

            #ftoolbar:not(.mobile-edit-open) .history-btn {
                width: 100% !important;
                min-width: 0 !important;
                min-height: 44px !important;
                border-radius: 16px !important;
                font-size: 11px !important;
                padding: .55rem .4rem !important;
            }

            #ftoolbar.mobile-edit-open {
                grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
                align-content: start !important;
                max-height: min(62vh, 520px) !important;
                overflow-y: auto !important;
                border-radius: 24px !important;
                padding: .7rem !important;
            }

            #ftoolbar.mobile-edit-open #mobile-edit-toggle {
                grid-column: 1 / -1 !important;
                background: linear-gradient(135deg,#ef4444,#f97316) !important;
            }

            #ftoolbar.mobile-edit-open #tb-drag-handle,
            #ftoolbar.mobile-edit-open .tsep {
                display: none !important;
            }

            #ftoolbar.mobile-edit-open button,
            #ftoolbar.mobile-edit-open select {
                width: 100% !important;
                min-width: 0 !important;
                min-height: 42px !important;
                border-radius: 14px !important;
                font-size: 11.5px !important;
                padding: .58rem .45rem !important;
                white-space: normal !important;
                line-height: 1.1 !important;
            }

            #ftoolbar.mobile-edit-open select {
                grid-column: span 2 !important;
                max-width: none !important;
            }

            #ftoolbar.mobile-edit-open .flex.items-center {
                width: 100% !important;
                min-height: 42px !important;
                justify-content: center !important;
                background: #ffffff !important;
                border: 1px solid #e2e8f0 !important;
                border-radius: 14px !important;
                padding: .35rem !important;
            }

            #ftoolbar.mobile-edit-open .opac-ctrl {
                grid-column: 1 / -1 !important;
                justify-content: flex-start !important;
                padding: .55rem .7rem !important;
            }

            #ftoolbar.mobile-edit-open .opac-ctrl input[type=range] {
                flex: 1 !important;
                width: 100% !important;
                max-width: none !important;
            }

            #ftoolbar.mobile-edit-open .opac-ctrl span:first-child,
            #ftoolbar.mobile-edit-open .bg-color-ctrl span {
                display: inline !important;
            }

            #ftoolbar input[type=color] {
                width: 36px !important;
                height: 36px !important;
            }

            .rh {
                width: 18px !important;
                height: 18px !important;
                border-radius: 6px !important;
            }

            .rh.nw { top:-9px !important; left:-9px !important; }
            .rh.ne { top:-9px !important; right:-9px !important; }
            .rh.sw { bottom:-9px !important; left:-9px !important; }
            .rh.se { bottom:-9px !important; right:-9px !important; }

            .mobile-menu-scrim {
                position: fixed;
                inset: 0;
                display: none;
                background: rgba(15,23,42,.24);
                z-index: 12030;
            }

            body.mobile-tools-open .mobile-menu-scrim,
            body.mobile-edit-open .mobile-menu-scrim {
                display: block;
            }
        }

        @media (max-width: 420px) {
            #editor-controls {
                grid-template-columns: 1fr !important;
            }

            #ftoolbar.mobile-edit-open {
                grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
            }

            #ftoolbar.mobile-edit-open select,
            #ftoolbar.mobile-edit-open .opac-ctrl,
            #ftoolbar.mobile-edit-open #mobile-edit-toggle {
                grid-column: 1 / -1 !important;
            }
        }
        /* ===== FIN MÓVIL LIMPIO ===== */


        /* ===== FIX FINAL MÓVIL FUNCIONAL ===== */
        .mobile-tools-action {
            display: none;
        }

        @media (max-width: 760px) {
            /* El header queda limpio; el usuario usa la barra inferior */
            body.pdf-loaded .mobile-tools-toggle {
                display: none !important;
            }

            /* Menú de herramientas siempre usable aunque la barra esté en modo disabled */
            #ftoolbar.toolbar-disabled .mobile-tools-action,
            #ftoolbar.toolbar-disabled .mobile-edit-toggle {
                opacity: 1 !important;
                pointer-events: auto !important;
            }

            #ftoolbar.toolbar-disabled .mobile-edit-toggle {
                filter: grayscale(.15);
            }

            /* Barra inferior principal: Agregar / Editar / Deshacer / Rehacer */
            #ftoolbar {
                grid-template-columns: 1.05fr 1.05fr .82fr .82fr !important;
            }

            .mobile-tools-action {
                display: inline-flex !important;
                align-items: center !important;
                justify-content: center !important;
                min-height: 44px !important;
                border-radius: 16px !important;
                border: 0 !important;
                background: linear-gradient(135deg,#ef4444,#f97316) !important;
                color: #ffffff !important;
                font-size: 12px !important;
                font-weight: 950 !important;
                padding: .72rem .5rem !important;
                white-space: nowrap !important;
                box-shadow: none !important;
            }

            #ftoolbar:not(.mobile-edit-open) > *:not(#mobile-tools-bottom):not(#mobile-edit-toggle):not(.history-btn) {
                display: none !important;
            }

            #ftoolbar:not(.mobile-edit-open) .history-btn {
                display: inline-flex !important;
                align-items: center !important;
                justify-content: center !important;
                width: 100% !important;
                min-width: 0 !important;
                min-height: 44px !important;
                border-radius: 16px !important;
                font-size: 10.5px !important;
                padding: .55rem .3rem !important;
            }

            /* El panel de herramientas aparece como bottom sheet ordenado */
            #editor-controls {
                bottom: calc(74px + env(safe-area-inset-bottom)) !important;
                display: none !important;
                grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
            }

            body.mobile-tools-open #editor-controls {
                display: grid !important;
            }

            body.mobile-tools-open #mobile-tools-bottom {
                background: linear-gradient(135deg,#0f172a,#334155) !important;
            }

            /* En modo edición abierto, no ocultar opciones importantes por CSS */
            #ftoolbar.mobile-edit-open {
                grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
            }

            #ftoolbar.mobile-edit-open #mobile-tools-bottom {
                display: none !important;
            }

            #ftoolbar.mobile-edit-open #mobile-edit-toggle {
                display: inline-flex !important;
                grid-column: 1 / -1 !important;
            }

            #ftoolbar.mobile-edit-open .history-btn,
            #ftoolbar.mobile-edit-open .text-ctrl,
            #ftoolbar.mobile-edit-open .bg-color-ctrl,
            #ftoolbar.mobile-edit-open .opac-ctrl,
            #ftoolbar.mobile-edit-open .box-ctrl,
            #ftoolbar.mobile-edit-open button:not(#tb-drag-handle),
            #ftoolbar.mobile-edit-open select {
                display: inline-flex;
            }

            #ftoolbar.mobile-edit-open select.text-ctrl {
                display: block !important;
            }

            #ftoolbar.mobile-edit-open span.text-ctrl,
            #ftoolbar.mobile-edit-open span.fs-display {
                display: inline-flex !important;
                align-items: center !important;
                justify-content: center !important;
            }

            #ftoolbar.mobile-edit-open .flex.text-ctrl,
            #ftoolbar.mobile-edit-open .flex.bg-color-ctrl,
            #ftoolbar.mobile-edit-open .flex.opac-ctrl {
                display: flex !important;
            }

            /* Si no hay elemento seleccionado, el panel de edición muestra ayuda, pero no rompe herramientas */
            #ftoolbar.toolbar-disabled.mobile-edit-open .text-ctrl,
            #ftoolbar.toolbar-disabled.mobile-edit-open .bg-color-ctrl,
            #ftoolbar.toolbar-disabled.mobile-edit-open .opac-ctrl,
            #ftoolbar.toolbar-disabled.mobile-edit-open .box-ctrl,
            #ftoolbar.toolbar-disabled.mobile-edit-open button:not(#mobile-edit-toggle):not(.history-btn),
            #ftoolbar.toolbar-disabled.mobile-edit-open select,
            #ftoolbar.toolbar-disabled.mobile-edit-open input {
                opacity: .35 !important;
                pointer-events: none !important;
            }

            #workspace {
                padding-bottom: 7rem !important;
            }
        }

        @media (max-width: 420px) {
            #ftoolbar {
                grid-template-columns: 1fr 1fr 1fr 1fr !important;
                gap: .35rem !important;
                left: .45rem !important;
                right: .45rem !important;
                padding: .45rem !important;
            }

            .mobile-tools-action,
            .mobile-edit-toggle,
            #ftoolbar:not(.mobile-edit-open) .history-btn {
                font-size: 10px !important;
                min-height: 42px !important;
                border-radius: 14px !important;
                padding-left: .2rem !important;
                padding-right: .2rem !important;
            }

            #ftoolbar.mobile-edit-open {
                grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
            }
        }
        /* ===== FIN FIX FINAL MÓVIL FUNCIONAL ===== */

        /* ===== FIN TEMA CLARO RESPONSIVO ===== */

    
        /* ===== ONLYEDITPDF MOBILE STUDIO FINAL - BANNER + FORMATO VISIBLE ===== */
        #spdf-mobile-ui { display:none; }

        @media (max-width:760px) {
            body.pdf-loaded {
                background:#eef3f8 !important;
                overflow-x:hidden !important;
            }

            body.pdf-loaded #spdf-mobile-ui { display:block; }

            body.pdf-loaded header.app-header,
            body.pdf-loaded #editor-controls,
            body.pdf-loaded #ftoolbar,
            body.pdf-loaded #pdf-sidebar,
            body.pdf-loaded #mobile-ui,
            body.pdf-loaded .mobile-menu-scrim,
            body.pdf-loaded .mobile-tools-toggle,
            body.pdf-loaded #mobile-tools-toggle {
                display:none !important;
            }

            body.pdf-loaded main#app-main {
                margin:0 !important;
                width:100% !important;
                max-width:100% !important;
                padding:190px 0 112px !important;
            }

            body.pdf-loaded #status { display:none !important; }

            body.pdf-loaded #workspace {
                width:100% !important;
                max-width:100% !important;
                overflow:auto !important;
                align-items:center !important;
                padding:18px 0 170px !important;
                background:
                    radial-gradient(circle at top left, rgba(239,68,68,.08), transparent 170px),
                    linear-gradient(180deg,#f8fbff 0%, #eaf0f7 100%) !important;
                -webkit-overflow-scrolling:touch;
            }

            body.pdf-loaded .pdf-page-wrapper {
                max-width:none !important;
                margin:0 auto 18px !important;
                box-shadow:0 8px 24px rgba(15,23,42,.13) !important;
                transform-origin:top center !important;
                border-radius:2px;
            }

            body.pdf-loaded .page-label { display:none !important; }

            .text-wrapper, .img-block, .mask-block, .signature-block {
                touch-action:none !important;
            }

            #spdf-topbar {
                position:fixed;
                top:0;
                left:0;
                right:0;
                height:58px;
                z-index:30000;
                display:grid;
                grid-template-columns:minmax(132px,1fr) 42px 42px 42px 46px;
                align-items:center;
                gap:6px;
                padding:0 8px;
                background:linear-gradient(135deg,#111827 0%,#172554 58%,#991b1b 160%);
                color:white;
                box-shadow:0 8px 24px rgba(15,23,42,.20);
            }

            #spdf-topbar button {
                height:40px;
                border:0;
                border-radius:14px;
                color:white;
                background:rgba(255,255,255,.12);
                font-size:17px;
                font-weight:900;
                touch-action:manipulation;
            }

            #spdf-topbar .spdf-logo-btn {
                background:#ffffff;
                color:#172554;
                padding:5px 8px;
                display:flex;
                align-items:center;
                justify-content:flex-start;
                overflow:hidden;
            }

            #spdf-topbar .spdf-logo-btn img {
                display:block;
                max-width:100%;
                max-height:30px;
                width:auto;
                height:auto;
                object-fit:contain;
            }

            #spdf-topbar .spdf-save-top {
                background:#ffffff;
                color:#172554;
            }

            #spdf-filebar {
                position:fixed;
                top:58px;
                left:0;
                right:0;
                height:40px;
                z-index:30000;
                display:flex;
                align-items:center;
                gap:10px;
                padding:0 12px;
                background:#ffffff;
                color:#1f2937;
                border-bottom:1px solid #e5e7eb;
            }

            #spdf-file-name {
                flex:1;
                min-width:0;
                overflow:hidden;
                text-overflow:ellipsis;
                white-space:nowrap;
                font-size:13px;
                font-weight:850;
            }

            #spdf-filebar button {
                border:1px solid #dbeafe;
                background:#eff6ff;
                color:#1d4ed8;
                border-radius:999px;
                padding:7px 11px;
                font-size:12px;
                font-weight:950;
                white-space:nowrap;
            }

            #spdf-tools {
                position:fixed;
                top:98px;
                left:0;
                right:0;
                height:52px;
                z-index:30000;
                display:flex;
                gap:7px;
                overflow-x:auto;
                padding:6px 9px;
                background:#ffffff;
                border-bottom:1px solid #dbe2ea;
                scrollbar-width:none;
                -webkit-overflow-scrolling:touch;
            }

            #spdf-tools::-webkit-scrollbar,
            #spdf-formatbar::-webkit-scrollbar { display:none; }

            #spdf-tools button {
                flex:0 0 66px;
                height:40px;
                border:1px solid #e2e8f0;
                background:#ffffff;
                color:#172554;
                border-radius:14px;
                font-size:16px;
                font-weight:950;
                display:flex;
                flex-direction:column;
                align-items:center;
                justify-content:center;
                gap:1px;
                touch-action:manipulation;
                box-shadow:0 3px 10px rgba(15,23,42,.05);
            }

            #spdf-tools button small {
                font-size:8.8px;
                font-weight:900;
                color:#64748b;
                line-height:1;
            }

            #spdf-tools button.active {
                background:linear-gradient(135deg,#eff6ff,#fff1f2);
                color:#dc2626;
                border-color:#fecaca;
                box-shadow:inset 0 -3px 0 #ef4444, 0 3px 10px rgba(239,68,68,.10);
            }

            #spdf-formatbar {
                position:fixed;
                top:150px;
                left:0;
                right:0;
                height:46px;
                z-index:30000;
                display:flex;
                gap:7px;
                overflow-x:auto;
                padding:6px 9px;
                background:#f8fafc;
                border-bottom:1px solid #dbe2ea;
                scrollbar-width:none;
                -webkit-overflow-scrolling:touch;
            }

            #spdf-formatbar button,
            #spdf-formatbar label {
                flex:0 0 auto;
                min-width:44px;
                height:34px;
                border:1px solid #cbd5e1;
                background:#ffffff;
                color:#0f172a;
                border-radius:12px;
                padding:0 10px;
                font-size:13px;
                font-weight:950;
                display:flex;
                align-items:center;
                justify-content:center;
                gap:6px;
                box-shadow:0 2px 8px rgba(15,23,42,.05);
            }

            #spdf-formatbar button.active {
                background:#eff6ff;
                color:#1d4ed8;
                border-color:#93c5fd;
                box-shadow:inset 0 -3px 0 #2563eb;
            }

            #spdf-formatbar button.wide { min-width:92px; }

            #spdf-formatbar input[type=color] {
                width:26px;
                height:26px;
                border:0;
                background:transparent;
                padding:0;
            }

            #spdf-floating-controls {
                position:fixed;
                left:50%;
                bottom:92px;
                transform:translateX(-50%);
                z-index:30000;
                height:48px;
                display:flex;
                align-items:center;
                gap:7px;
                padding:6px 10px;
                background:rgba(17,24,39,.94);
                color:white;
                border:1px solid rgba(255,255,255,.14);
                border-radius:999px;
                box-shadow:0 14px 34px rgba(15,23,42,.30);
                backdrop-filter:blur(14px);
                -webkit-backdrop-filter:blur(14px);
            }

            #spdf-floating-controls button {
                width:34px;
                height:34px;
                border:0;
                border-radius:999px;
                color:white;
                background:rgba(255,255,255,.10);
                font-size:20px;
                line-height:1;
                font-weight:900;
                touch-action:manipulation;
            }

            #spdf-floating-controls span {
                min-width:66px;
                height:34px;
                display:flex;
                align-items:center;
                justify-content:center;
                border-radius:999px;
                background:rgba(255,255,255,.12);
                font-size:16px;
                font-weight:900;
            }

            #spdf-exportbar {
                position:fixed;
                left:0;
                right:0;
                bottom:0;
                z-index:30000;
                height:82px;
                display:grid;
                grid-template-columns:56px 1fr 56px;
                align-items:center;
                gap:10px;
                padding:10px 14px calc(10px + env(safe-area-inset-bottom));
                background:#ffffff;
                border-top:1px solid #e5e7eb;
                box-shadow:0 -10px 28px rgba(15,23,42,.10);
            }

            #spdf-exportbar button {
                height:52px;
                border:1px solid #cbd5e1;
                background:#ffffff;
                color:#172554;
                border-radius:16px;
                font-size:22px;
                font-weight:950;
                touch-action:manipulation;
            }

            #spdf-exportbar button.primary {
                background:linear-gradient(135deg,#2563eb,#ef4444);
                color:white;
                font-size:18px;
                border-color:transparent;
                box-shadow:0 12px 24px rgba(37,99,235,.22);
            }

            #spdf-panel-scrim {
                position:fixed;
                inset:0;
                z-index:30010;
                display:none;
                background:rgba(15,23,42,.28);
                backdrop-filter:blur(2px);
            }

            body.spdf-panel-open #spdf-panel-scrim { display:block; }

            #spdf-panel {
                position:fixed;
                left:10px;
                right:10px;
                bottom:92px;
                z-index:30020;
                display:none;
                max-height:min(74vh,580px);
                overflow-y:auto;
                background:#ffffff;
                border-radius:26px;
                border:1px solid #e2e8f0;
                box-shadow:0 28px 80px rgba(0,0,0,.24);
                padding:13px;
                -webkit-overflow-scrolling:touch;
            }

            #spdf-panel.open { display:block; }

            .spdf-handle {
                width:46px;
                height:5px;
                background:#cbd5e1;
                border-radius:999px;
                margin:0 auto 10px;
            }

            .spdf-panel-head {
                display:flex;
                align-items:center;
                justify-content:space-between;
                border-bottom:1px solid #e5e7eb;
                padding-bottom:10px;
                margin-bottom:10px;
            }

            .spdf-panel-head strong {
                font-size:16px;
                font-weight:950;
                color:#0f172a;
            }

            .spdf-panel-head button {
                width:34px;
                height:34px;
                border:1px solid #e2e8f0;
                border-radius:999px;
                background:#f8fafc;
                color:#334155;
                font-weight:950;
            }

            .spdf-panel-body,
            .spdf-format-grid {
                display:grid;
                grid-template-columns:repeat(2,minmax(0,1fr));
                gap:8px;
            }

            .spdf-panel-body.hidden,
            .spdf-format-body.hidden { display:none !important; }

            .spdf-panel-body button,
            .spdf-format-grid button {
                min-height:50px;
                border:1px solid #e2e8f0;
                border-radius:16px;
                background:#ffffff;
                color:#0f172a;
                font-size:13px;
                font-weight:950;
                padding:8px;
                text-align:center;
                display:flex;
                flex-direction:column;
                align-items:center;
                justify-content:center;
                gap:2px;
            }

            .spdf-panel-body button.wide,
            .spdf-format-grid button.wide { grid-column:1 / -1; }

            .spdf-format-grid button span {
                font-size:10px;
                color:#64748b;
                font-weight:900;
            }

            .spdf-format-grid button.active {
                background:#eff6ff;
                border-color:#93c5fd;
                color:#1d4ed8;
                box-shadow:inset 0 -3px 0 #2563eb;
            }

            .spdf-format-grid button.danger {
                background:#fef2f2;
                border-color:#fecaca;
                color:#dc2626;
            }

            #spdf-format-empty {
                color:#64748b;
                font-size:13px;
                line-height:1.45;
                background:#f8fafc;
                border:1px dashed #cbd5e1;
                border-radius:18px;
                padding:14px;
                margin-bottom:10px;
            }

            #spdf-format-options {
                display:grid;
                gap:10px;
            }

            .spdf-field {
                display:grid;
                gap:6px;
                color:#334155;
                font-size:12px;
                font-weight:950;
            }

            .spdf-field select,
            .spdf-field input[type=range] { width:100%; }

            .spdf-field select {
                min-height:44px;
                border:1px solid #e2e8f0;
                background:#ffffff;
                color:#0f172a;
                border-radius:14px;
                padding:8px 10px;
                font-size:13px;
                font-weight:850;
            }

            .spdf-size-row {
                display:grid;
                grid-template-columns:1fr 64px 1fr;
                align-items:center;
                gap:8px;
            }

            .spdf-size-row button,
            .spdf-color-row label {
                min-height:44px;
                border:1px solid #e2e8f0;
                background:#fff;
                border-radius:14px;
                font-size:13px;
                font-weight:950;
                display:flex;
                align-items:center;
                justify-content:center;
                gap:8px;
            }

            .spdf-size-row strong {
                height:44px;
                border-radius:14px;
                background:#f8fafc;
                border:1px solid #e2e8f0;
                display:flex;
                align-items:center;
                justify-content:center;
                font-weight:950;
            }

            .spdf-color-row {
                display:grid;
                grid-template-columns:1fr 1fr;
                gap:8px;
            }

            .spdf-color-row input[type=color] {
                width:34px;
                height:34px;
                border:0;
                background:transparent;
                padding:0;
            }

            .spdf-field input[type=range] { accent-color:#2563eb; }
            #spdf-opacity-value { font-weight:950; color:#0f172a; }

            .rh {
                width:18px !important;
                height:18px !important;
                border-radius:5px !important;
            }
            .rh.nw { top:-9px !important; left:-9px !important; }
            .rh.ne { top:-9px !important; right:-9px !important; }
            .rh.sw { bottom:-9px !important; left:-9px !important; }
            .rh.se { bottom:-9px !important; right:-9px !important; }
        }
        /* ===== END ONLYEDITPDF MOBILE STUDIO FINAL ===== */

    
        /* ===== OPTIMIZACIÓN LIGERA SIN QUITAR FUNCIONES ===== */
        @supports (content-visibility: auto) {
            #landing-content .landing-section {
                content-visibility: auto;
                contain-intrinsic-size: 1px 560px;
            }
        }
        img {
            max-width: 100%;
        }
        /* ===== FIN OPTIMIZACIÓN LIGERA ===== */

    
        /* ===== LANGUAGE SWITCHER ES/EN ===== */
        .language-switcher {
            position: fixed;
            right: 18px;
            bottom: 18px;
            z-index: 60000;
            display: inline-flex;
            gap: 4px;
            padding: 5px;
            border-radius: 999px;
            background: rgba(255,255,255,.96);
            border: 1px solid #e2e8f0;
            box-shadow: 0 10px 26px rgba(15,23,42,.16);
            backdrop-filter: blur(14px);
            -webkit-backdrop-filter: blur(14px);
        }
        .language-switcher button,
        .language-switcher a {
            min-width: 42px;
            height: 32px;
            border: 0;
            border-radius: 999px;
            background: transparent;
            color: #334155;
            font-size: 12px;
            font-weight: 950;
            cursor: pointer;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            text-decoration: none;
            transition: background .15s ease, color .15s ease, transform .15s ease;
        }
        .language-switcher button:hover,
        .language-switcher a:hover {
            transform: translateY(-1px);
            background: #f1f5f9;
        }
        .language-switcher button.active,
        .language-switcher a.active {
            background: linear-gradient(135deg,#ef4444,#2563eb);
            color: #ffffff;
            box-shadow: 0 6px 14px rgba(37,99,235,.20);
        }
        @media (max-width:760px) {
            body:not(.pdf-loaded) .language-switcher {
                top: 12px;
                right: 10px;
                bottom: auto;
                transform: scale(.92);
                transform-origin: top right;
            }
            body.pdf-loaded .language-switcher {
                right: 10px;
                bottom: calc(92px + env(safe-area-inset-bottom));
                transform: scale(.88);
                transform-origin: bottom right;
            }
        }
        /* ===== END LANGUAGE SWITCHER ===== */
