        @font-face {
            font-family: 'Meow Script';
            src: url('/fonts/MeowScript-Regular.ttf') format('truetype');
            font-weight: normal; font-style: normal;
        }
        @font-face {
            font-family: 'Mynerve';
            src: url('/fonts/Mynerve-Regular.ttf') format('truetype');
            font-weight: normal; font-style: normal;
        }
        @font-face {
            font-family: 'Playwrite AU QLD';
            src: url('/fonts/PlaywriteAUQLD-Regular.ttf') format('truetype');
            font-weight: normal; font-style: normal;
        }
        @font-face {
            font-family: 'Spicy Rice';
            src: url('/fonts/SpicyRice-Regular.ttf') format('truetype');
            font-weight: normal; font-style: normal;
        }
        @font-face {
            font-family: 'Passion One';
            src: url('/fonts/PassionOne-Regular.ttf') format('truetype');
            font-weight: normal; font-style: normal;
        }
        @font-face {
            font-family: 'Doto';
            src: url('/fonts/Doto-Regular.ttf') format('truetype');
            font-weight: normal; font-style: normal;
        }
        @font-face {
            font-family: 'Henny Penny';
            src: url('/fonts/HennyPenny-Regular.ttf') format('truetype');
            font-weight: normal; font-style: normal;
        }
        @font-face {
            font-family: 'Rock Salt';
            src: url('/fonts/RockSalt-Regular.ttf') format('truetype');
            font-weight: normal; font-style: normal;
        }

        /* ── Biblia Fonts ─────────────────────────────────────────────────────── */
        @font-face {
            font-family: 'Aquiline Two';
            src: url('/fonts/AquilineTwo-Regular.ttf') format('truetype');
            font-weight: normal; font-style: normal;
        }
        @font-face {
            font-family: 'Tropical';
            src: url('/fonts/Tropical-Regular.ttf') format('truetype');
            font-weight: normal; font-style: normal;
        }
        @font-face {
            font-family: 'Jane Aust';
            src: url('/fonts/JaneAust-Regular.ttf') format('truetype');
            font-weight: normal; font-style: normal;
        }
        @font-face {
            font-family: 'Monterlo';
            src: url('/fonts/Monterlo-Regular.ttf') format('truetype');
            font-weight: normal; font-style: normal;
        }
        @font-face {
            font-family: 'Two Prot';
            src: url('/fonts/2Prot-Regular.ttf') format('truetype');
            font-weight: normal; font-style: normal;
        }

        /* ── CSS Variables — Dark Studio ─────────────────────────────────────── */
        :root {
            --bg-base:      #111111;
            --bg-surface-1: #1a1a1a;
            --bg-surface-2: #222222;
            --bg-surface-3: #2a2a2a;
            --border:       #333333;
            --border-light: #3d3d3d;
            --text-primary: #e8e8e8;
            --text-secondary: #a0a0a0;
            --text-muted:   #606060;
            --accent:       #7c6eff;
            --accent-glow:  rgba(124,110,255,0.15);
            --accent-border:rgba(124,110,255,0.4);
        /* ── Tokens extendidos — Sistema de diseño TextOnFlow ────────────────
           Actualizar solo aquí para cambiar toda la UI del editor.           */

        /* Espaciado */
        --space-1:  4px;
        --space-2:  6px;
        --space-3:  8px;
        --space-4:  12px;
        --space-5:  16px;
        --space-6:  20px;
        --space-7:  24px;
        --space-8:  28px;

        /* Radio */
        --radius-xs:   3px;
        --radius-sm:   4px;
        --radius-md:   8px;
        --radius-lg:   12px;
        --radius-xl:   16px;
        --radius-pill: 20px;

        /* Tipografía */
        --font-xs:    9px;
        --font-sm:   10px;
        --font-base: 12px;
        --font-md:   13px;
        --font-lg:   15px;

        /* Colores de acento adicionales */
        --accent-2:         #9ca3ff;   /* azul-lavanda más suave */
        --accent-3:         #a5b4fc;   /* indigo claro */
        --accent-green:     #34d399;
        --accent-green-dim: rgba(52,211,153,.15);
        --accent-red:       #f87171;
        --accent-red-dim:   rgba(248,113,113,.12);
        --accent-amber:     #fbbf24;

        /* Superficies */
        --surface-overlay:  rgba(0,0,0,.7);
        --surface-code:     #2a2a2a;
        --surface-code-border: #444444;

        /* Sombras */
        --shadow-sm:    0 2px 8px rgba(0,0,0,.3);
        --shadow-md:    0 4px 20px rgba(0,0,0,.4);
        --shadow-panel: 0 8px 40px rgba(0,0,0,.55);
        }


/* ══════════════════════════════════════════════════════════════════════════════
   UTILIDADES DE DISEÑO — TextOnFlow Design System v1.0
   Usar estas clases en index.html en lugar de estilos inline repetidos.
   ══════════════════════════════════════════════════════════════════════════════ */

/* ── Tipografía de panel ──────────────────────────────────────────────────── */
.tof-label {
    font-weight: 700;
    color: var(--accent-3);
    margin-bottom: var(--space-2);
    font-size: var(--font-sm);
    letter-spacing: 0.5px;
    text-transform: uppercase;
    display: block;
}

.tof-section-title {
    color: var(--accent-2);
    font-weight: 700;
    margin-top: var(--space-5);
    margin-bottom: var(--space-1);
}

.tof-field-label {
    font-size: var(--font-base);
    font-weight: 700;
    color: var(--text-primary);
    display: block;
    margin-bottom: 3px;
}

/* ── Badge de código / teclado ───────────────────────────────────────────── */
.tof-code {
    font-family: monospace;
    background: var(--surface-code);
    border: 1px solid var(--surface-code-border);
    border-radius: var(--radius-sm);
    padding: 1px 6px;
    font-size: var(--font-sm);
    color: var(--text-primary);
    white-space: nowrap;
}

/* ── Botón mini (icono de acción pequeña) ────────────────────────────────── */
.tof-btn-mini {
    font-size: var(--font-xs);
    border-radius: var(--radius-xs);
    border: 1px solid var(--surface-code-border);
    background: var(--surface-code);
    color: var(--text-muted);
    cursor: pointer;
    padding: 0;
    line-height: 1;
    transition: background 0.15s, color 0.15s;
}
.tof-btn-mini:hover { background: var(--bg-surface-3); color: var(--text-secondary); }

/* ── Input de color ──────────────────────────────────────────────────────── */
.tof-color-input {
    width: 100%;
    height: 30px;
    border: 1px solid var(--border-light);
    padding: 0;
    cursor: pointer;
    border-radius: 5px;
    background: none;
}

/* ── Layout helpers ──────────────────────────────────────────────────────── */
.tof-row            { display: flex; align-items: center; gap: var(--space-2); }
.tof-row-gap-sm     { display: flex; align-items: center; gap: var(--space-1); }
.tof-kv-grid        { display: grid; grid-template-columns: auto 1fr; gap: 3px 12px; margin-bottom: 11px; }
.tof-grow           { flex: 1; }
.tof-shrink-0       { flex-shrink: 0; }
.tof-w-full         { width: 100%; }

/* ── Espaciado ───────────────────────────────────────────────────────────── */
.tof-mt-1  { margin-top: var(--space-1); }
.tof-mt-2  { margin-top: var(--space-2); }
.tof-mt-3  { margin-top: var(--space-3); }
.tof-mt-4  { margin-top: var(--space-4); }
.tof-mt-5  { margin-top: var(--space-5); }
.tof-mt-7  { margin-top: var(--space-8); }
.tof-mb-2  { margin-bottom: var(--space-2); }
.tof-mb-3  { margin-bottom: var(--space-4); }
.tof-mb-4  { margin-bottom: var(--space-5); }

/* ── Iconos SVG inline ───────────────────────────────────────────────────── */
.tof-icon  { vertical-align: -1px; margin-right: 5px; flex-shrink: 0; }
.tof-icon2 { vertical-align: -2px; margin-right: 5px; flex-shrink: 0; }

/* ── Colores de texto ────────────────────────────────────────────────────── */
.tof-accent   { color: var(--accent); }
.tof-accent-2 { color: var(--accent-2); }
.tof-accent-3 { color: var(--accent-3); }
.tof-muted    { color: var(--text-muted); }
.tof-secondary{ color: var(--text-secondary); }

/* ── Toolbar del editor (barra superior) ─────────────────────────────────── */
.tof-toolbar-btn {
    display: flex;
    align-items: center;
    gap: var(--space-1);
    padding: 3px 10px;
    border-radius: var(--radius-pill);
    cursor: pointer;
    border: 1px solid var(--accent-border);
    background: rgba(20,20,36,0.8);
    font-size: var(--font-sm);
    font-weight: 700;
    color: var(--accent-3);
    letter-spacing: 0.3px;
    white-space: nowrap;
    backdrop-filter: blur(6px);
    transition: background 0.2s, border-color 0.2s;
    text-decoration: none;
}
.tof-toolbar-btn:hover {
    background: rgba(124,110,255,0.15);
    border-color: var(--accent);
}
.tof-toolbar-btn.green {
    color: #6ee7b7;
    border-color: rgba(52,211,153,.3);
}
.tof-toolbar-btn.green:hover {
    background: rgba(52,211,153,.12);
    border-color: var(--accent-green);
}

        * { margin: 0; padding: 0; box-sizing: border-box; }
        
        body {
            font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
            background: var(--bg-base);
            min-height: 100vh;
            color: var(--text-primary);
        }
        
        .container { max-width: 100%; height: 100vh; display: flex; flex-direction: column; background: var(--bg-base); }
        
        .main-content { display: grid; grid-template-columns: 1fr 5px var(--panel-w, 320px); gap: 0; flex: 1; overflow: hidden; min-height: 0; }
        .panel-resizer {
            width: 5px;
            background: transparent;
            cursor: col-resize;
            position: relative;
            z-index: 3000;
            flex-shrink: 0;
            transition: background 0.15s;
        }
        .panel-resizer::after {
            content: '';
            position: absolute;
            top: 0;
            left: 2px;
            width: 1px;
            height: 100%;
            background: var(--border);
            opacity: 0;
            transition: opacity 0.2s;
        }
        .panel-resizer:hover::after, .panel-resizer.dragging::after, .panel-resizer.autofit::after { opacity: 1; background: #667eea; }
        .panel-resizer.autofit::after { width: 2px; transition: width 0.1s; }
        .panel-resizer:hover, .panel-resizer.dragging { background: rgba(102,126,234,0.12); }
        
        .canvas-area { 
            background: #141414;
            background-image: radial-gradient(circle, #2a2a2a 1px, transparent 1px);
            background-size: 22px 22px;
            padding: 52px 20px 160px 20px; /* top 52px: espacio para barra fija de formatos */
            overflow: auto;
            display: flex;
            flex-direction: column;
            align-items: center;
            position: relative;
        }
        #canvas-center-wrap {
            flex: 1;
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            width: 100%;
            box-sizing: border-box;
            padding: 40px 0 20px 0;
        }
        
        details > summary::-webkit-details-marker { display: none; }
        details > summary::marker { display: none; }
        
        .upload-zone {
            background: transparent;
            border: 2px dashed transparent;
            border-radius: 10px;
            padding: 20px 25px;
            text-align: center;
            cursor: default;
            transition: all 0.3s;
            width: 100%;
            max-width: 600px;
            min-height: 40px;
        }
        .upload-zone.dragover { border-color: #667eea; background: rgba(102,126,234,0.05); }
        .upload-zone.has-image { display: none; }
        .upload-zone.has-image ~ .canvas-placeholder { display: none; }

        .canvas-placeholder {
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            padding: 48px 24px 32px;
            text-align: center;
            pointer-events: none;
            user-select: none;
        }
        .canvas-wrapper {
            position: relative;
            display: none;
            background: #111111;
            box-shadow: 0 4px 24px rgba(0,0,0,0.5);
            border-radius: 8px;
            overflow: hidden;
            clip-path: inset(0 round 8px);
            max-width: 95%;
            transition: opacity 0.2s ease;
            touch-action: none;          /* permite drag de texto/stickers sin interferencia del scroll */
        }
        
        .canvas-wrapper.active { display: inline-block; }
        
        #preview-canvas {
            display: block;
            max-width: 100%;
            max-height: calc(100vh - 200px);
            width: auto;
            height: auto;
        }
        
        .text-layer {
            position: absolute;
            cursor: move;
            padding: 0;
            border: none;
            outline: 2px dashed transparent;
            outline-offset: 4px;
            transition: outline-color 0.15s;
            user-select: none;
            -webkit-user-select: none;
            touch-action: none;          /* evita que el browser intercepte scroll/zoom al tocar texto */
            pointer-events: auto;
            white-space: pre;
            max-width: none;
        }
        
        .text-layer:hover { outline-color: rgba(100,100,100,0.45); }
        .text-layer.active { outline-color: transparent; }
        .text-layer.selected { outline: 2px solid #667eea; outline-offset: 4px; background: rgba(102,126,234,0.07); }
        /* El texto activo ya tiene bounding box con handles; ocultar el outline redundante */
        .text-layer.active.selected { outline-color: transparent; background: transparent; }
        .text-layer.grouped { outline: 2px solid #10b981; outline-offset: 4px; background: rgba(16,185,129,0.04); }
        
        /* ── Context Menu ─────────────────────────────────────────── */
        #ctx-menu {
            position: fixed;
            z-index: 99999;
            background: var(--bg-surface-2);
            border: 1px solid var(--border-light);
            border-radius: 10px;
            box-shadow: 0 8px 32px rgba(0,0,0,0.6);
            padding: 4px 0;
            min-width: 210px;
            font-size: 13px;
        }
        .ctx-item {
            padding: 8px 16px;
            cursor: pointer;
            display: flex;
            align-items: center;
            gap: 8px;
            color: var(--text-primary);
            white-space: nowrap;
        }
        .ctx-item:hover { background: var(--accent-glow); color: #fff; }
        .ctx-item.danger { color: #f87171; }
        .ctx-item.danger:hover { background: rgba(239,68,68,0.15); }
        .ctx-divider { height: 1px; background: var(--border); margin: 3px 0; }
        
        .controls-panel {
            background: var(--bg-surface-1);
            padding: 0 20px 70px 20px;
            overflow-y: auto;
            overflow-x: hidden;
            border-left: 1px solid var(--border);
            display: flex;
            flex-direction: column;
            height: 100%;
            position: relative;
            z-index: 2000;
        }

        .tof-toolbar-row {
            position: sticky;
            top: 0;
            z-index: 100;
            background: var(--bg-surface-1);
            padding: 12px 0 8px 0;
            margin-bottom: 6px !important;
        }
        
        .upload-section { margin-bottom: 15px; }
        
        .upload-btn {
            width: 100%;
            padding: 10px;
            background: var(--bg-surface-3);
            color: var(--text-secondary);
            border: 1px solid var(--border-light);
            border-radius: 7px;
            font-size: 13px;
            cursor: pointer;
            transition: border-color 0.2s, color 0.2s;
            font-weight: 600;
        }
        
        .upload-btn:hover { border-color: var(--accent); color: var(--text-primary); }
        .url-load-btn, .url-load-btn:hover { background: var(--bg-surface-2) !important; border-color: var(--border-light) !important; }
        #image-url-input::placeholder { color: var(--text-muted); font-style: italic; }
        
        .texts-section { display: flex; flex-direction: column; }

        /* ── Pestañas estilo Chrome ── */
        .texts-tabs-outer { display: flex; flex-direction: column; margin-bottom: 12px; }
        #texts-tabs-bar {
            display: flex;
            overflow-x: auto;
            gap: 0;
            border-bottom: 2px solid var(--border-light);
            flex-shrink: 0;
            scrollbar-width: none;
            align-items: flex-end;
        }
        #texts-tabs-bar::-webkit-scrollbar { display: none; }
        .text-tab {
            display: flex;
            align-items: center;
            gap: 5px;
            padding: 5px 9px 5px 8px;
            cursor: pointer;
            font-size: 13px;
            font-weight: 600;
            white-space: nowrap;
            border: 1.5px solid var(--border-light);
            border-bottom: none;
            border-radius: 7px 7px 0 0;
            margin-right: 2px;
            background: var(--bg-surface-2);
            color: var(--text-primary);
            transition: background 0.12s, color 0.12s;
            max-width: 130px;
            position: relative;
            bottom: -2px;
            user-select: none;
        }
        .text-tab:hover { background: var(--bg-surface-3); color: #fff; }
        .text-tab.active {
            background: var(--bg-surface-1);
            color: #fff;
            border-color: var(--accent-border);
            border-bottom: 2px solid var(--bg-surface-1);
            z-index: 2;
            padding-bottom: 7px;
            box-shadow: 0 -2px 8px rgba(99,102,241,0.18);
        }
        .tab-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; display: inline-block; }
        .tab-label { overflow: hidden; text-overflow: ellipsis; flex: 1; min-width: 0; max-width: 72px; text-align: left; }
        .tab-close {
            flex-shrink: 0; color: var(--text-muted); font-size: 13px; line-height: 1;
            padding: 1px 3px; border-radius: 50%; background: none;
            border: none; cursor: pointer; font-weight: 700;
        }
        .tab-close:hover { color: #f87171; background: rgba(239,68,68,0.15); }
        .tab-eye {
            flex-shrink: 0; color: var(--text-muted); font-size: 12px; line-height: 1;
            padding: 2px 3px; border-radius: 4px; background: none;
            border: none; cursor: pointer; display: flex; align-items: center; justify-content: center;
            transition: opacity .15s, background .12s;
        }
        .tab-eye:hover { background: rgba(99,102,241,0.18); opacity: 1 !important; }
        body.fp-active .text-tab:not(.active) {
            border-color: rgba(245,158,11,0.6) !important;
            box-shadow: 0 0 5px rgba(245,158,11,0.2);
        }
        .tab-lock { margin-left: -1px; }


        /* ── BATCH VARIATIONS ───────────────────────────────── */
        .bv-swatch-label {
            display: flex; flex-direction: column; align-items: center;
            gap: 4px; cursor: pointer; position: relative;
        }
        .bv-color-check { width: 12px; height: 12px; cursor: pointer; accent-color: #7c6eff; }
        .bv-color-pick {
            width: 34px; height: 34px; border: none; border-radius: 6px;
            cursor: pointer; padding: 0; background: none;
        }
        .bv-color-preview {
            width: 34px; height: 10px; border-radius: 3px;
            display: block; border: 1px solid #333;
        }
        .bv-results-grid { display: flex; flex-wrap: wrap; gap: 10px; }
        .bv-result-card {
            display: flex; flex-direction: column; gap: 5px;
            border: 1px solid #2a2a4a; border-radius: 8px; overflow: hidden;
            background: #141422; width: 140px; flex-shrink: 0;
        }
        .bv-result-img {
            width: 140px; height: 90px; object-fit: cover; display: block;
        }
        .bv-result-footer {
            display: flex; align-items: center; justify-content: space-between;
            padding: 4px 6px;
        }
        .bv-result-color {
            width: 16px; height: 16px; border-radius: 4px;
            border: 1px solid #333; flex-shrink: 0; display: inline-block;
        }
        .bv-dl-btn {
            font-size: 10px; color: #7c6eff; text-decoration: none;
            font-weight: 600; white-space: nowrap;
        }
        .bv-dl-btn:hover { color: #9c8fff; }
        .bv-result-err {
            padding: 8px; font-size: 10px; color: #f87171;
        }
        .bv-loading {
            padding: 20px; text-align: center; color: #666; font-size: 12px;
        }
        #bv-results { display: flex; flex-wrap: wrap; gap: 10px; }

        /* ── HISTORIAL VISUAL ───────────────────────────────── */
        #tof-hist-panel {
            position: fixed;
            bottom: 0;
            left: 0;
            width: 100%;
            max-height: 190px;
            background: #0f0f1c;
            border-top: 1px solid #2a2a4a;
            z-index: 10000;
            flex-direction: column;
            box-shadow: 0 -4px 20px rgba(0,0,0,.6);
            font-family: inherit;
        }
        .hp-header {
            display: flex;
            align-items: center;
            justify-content: space-between;
            padding: 5px 12px 4px;
            border-bottom: 1px solid #1e1e30;
            flex-shrink: 0;
        }
        .hp-header span { font-size: 10px; font-weight: 700; color: #7c6eff; text-transform: uppercase; letter-spacing: .5px; }
        .hp-close {
            background: none; border: none; color: #555; cursor: pointer;
            font-size: 16px; padding: 0 4px; line-height: 1;
        }
        .hp-close:hover { color: #f87171; }
        .hp-grid {
            display: flex;
            gap: 6px;
            padding: 8px 10px;
            overflow-x: auto;
            flex: 1;
            align-items: flex-start;
        }
        .hp-grid::-webkit-scrollbar { height: 4px; }
        .hp-grid::-webkit-scrollbar-thumb { background: #2a2a4a; border-radius: 2px; }
        .hp-item {
            display: flex;
            flex-direction: column;
            align-items: center;
            gap: 3px;
            cursor: pointer;
            border-radius: 6px;
            padding: 4px;
            border: 1.5px solid #1e1e30;
            background: #141422;
            transition: border-color .15s, background .15s;
            flex-shrink: 0;
            min-width: 70px;
        }
        .hp-item:hover { border-color: #5555cc; background: #1a1a38; }
        .hp-item.hp-active { border-color: #7c6eff; background: #1a1a38; box-shadow: 0 0 0 2px rgba(124,110,255,.25); }
        .hp-thumb {
            width: 70px;
            height: 44px;
            object-fit: cover;
            border-radius: 4px;
            display: block;
        }
        .hp-no-thumb {
            width: 70px; height: 44px;
            background: #1e1e30;
            border-radius: 4px;
            display: flex; align-items: center; justify-content: center;
            color: #333; font-size: 18px;
        }
        .hp-lbl { font-size: 9px; color: #888; white-space: nowrap; }
        .hp-item.hp-active .hp-lbl { color: #9c8fff; font-weight: 700; }
        .hp-meta { font-size: 8px; color: #444; }
        .hp-item.hp-active .hp-meta { color: #666; }

        /* ── CONTRAST CHECKER ──────────────────────────── */
        #tof-contrast-badge {
            align-items: center;
            gap: 5px;
            padding: 5px 10px 6px;
            font-size: 10px;
            background: rgba(0,0,0,0.25);
            border-top: 1px solid #1e1e30;
            border-bottom: 1px solid #1e1e30;
            flex-wrap: wrap;
        }
        .cc-label { color: #555; font-weight: 600; letter-spacing: .3px; text-transform: uppercase; flex-shrink: 0; }
        .cc-ratio { color: #9ca3ff; font-weight: 700; font-size: 11px; flex-shrink: 0; }
        .cc-badge { font-weight: 700; padding: 1px 6px; border-radius: 4px; font-size: 10px; flex-shrink: 0; }
        .cc-pass  { background: rgba(74,222,128,.15); color: #4ade80; border: 1px solid rgba(74,222,128,.25); }
        .cc-fail  { background: rgba(248,113,113,.15); color: #f87171; border: 1px solid rgba(248,113,113,.25); }
        .cc-dim   { background: rgba(156,163,175,.1); color: #6b7280; border: 1px solid rgba(156,163,175,.15); }
        .cc-tip   { font-size: 9px; color: #f59e0b; font-style: italic; flex-basis: 100%; padding-top: 1px; }
        /* ── BRAND KIT ─────────────────────────────── */
        .acc-brand-kit-hdr { border-left: 3px solid rgba(251,191,36,0.5) !important; }
        #brand-swatches .brand-swatch { width:22px; height:22px; border-radius:5px; }
        #brand-fonts { }
        body.fp-active .text-tab:not(.active):hover {
            background: rgba(245,158,11,0.12) !important;
        }
        .tab-add-btn {
            padding: 5px 11px; cursor: pointer;
            border: 1.5px dashed var(--border-light); border-bottom: none;
            border-radius: 7px 7px 0 0;
            background: var(--bg-surface-2); color: var(--text-muted); font-size: 16px; font-weight: 700;
            display: flex; align-items: center;
            position: relative; bottom: -2px;
            transition: background 0.12s, color 0.12s, border-color 0.12s;
        }
        .tab-add-btn:hover { background: var(--bg-surface-3); color: var(--accent); border-color: var(--accent); }
        #texts-active-content {
            border: 1.5px solid var(--border-light); border-top: none;
            background: var(--bg-surface-2); border-radius: 0 6px 6px 6px;
            padding: 10px; overflow-y: auto;
        }

        /* ── STICKER TABS ──────────────────────────────────────────── */
        .stickers-tabs-outer { display: flex; flex-direction: column; margin-bottom: 12px; }
        #stickers-tabs-bar {
            display: flex;
            overflow-x: auto;
            gap: 0;
            border-bottom: 2px solid var(--border-light);
            flex-shrink: 0;
            scrollbar-width: none;
            align-items: flex-end;
        }
        #stickers-tabs-bar::-webkit-scrollbar { display: none; }
        .sticker-tab {
            display: flex;
            align-items: center;
            gap: 5px;
            padding: 5px 9px 5px 8px;
            cursor: pointer;
            font-size: 13px;
            font-weight: 600;
            white-space: nowrap;
            border: 1.5px solid var(--border-light);
            border-bottom: none;
            border-radius: 7px 7px 0 0;
            margin-right: 2px;
            background: var(--bg-surface-2);
            color: var(--text-primary);
            transition: background 0.12s, color 0.12s;
            max-width: 140px;
            position: relative;
            bottom: -2px;
            user-select: none;
        }
        .sticker-tab:hover { background: var(--bg-surface-3); color: #fff; }
        .sticker-tab.active {
            background: var(--bg-surface-1);
            color: var(--text-primary);
            border-color: var(--accent-border);
            border-bottom: 2px solid var(--bg-surface-1);
            z-index: 2;
            padding-bottom: 7px;
        }
        .sticker-tab-thumb {
            width: 22px;
            height: 22px;
            border-radius: 4px;
            object-fit: cover;
            flex-shrink: 0;
            border: 1px solid rgba(255,255,255,0.1);
        }
        .sticker-tab-add {
            padding: 5px 9px;
            cursor: pointer;
            border: 1.5px dashed var(--border-light);
            border-bottom: none;
            border-radius: 7px 7px 0 0;
            background: var(--bg-surface-2);
            color: var(--text-muted);
            font-size: 13px;
            font-weight: 700;
            white-space: nowrap;
            display: flex;
            align-items: center;
            position: relative;
            bottom: -2px;
            transition: background 0.12s, color 0.12s, border-color 0.12s;
            flex-shrink: 0;
        }
        .sticker-tab-add:hover { background: var(--bg-surface-3); color: var(--accent); border-color: var(--accent); }
        #stickers-active-content {
            border: 1.5px solid var(--border-light); border-top: none;
            background: var(--bg-surface-2); border-radius: 0 6px 6px 6px;
            padding: 10px; overflow-y: auto; max-height: 360px;
        }

        /* ── FORMAS TABS ──────────────────────────────────────────── */
        .formas-tabs-outer { display: flex; flex-direction: column; margin-bottom: 12px; }
        #formas-tabs-bar {
            display: flex; overflow-x: auto; gap: 0;
            border-bottom: 2px solid var(--border-light); flex-shrink: 0;
            scrollbar-width: none; align-items: flex-end;
        }
        #formas-tabs-bar::-webkit-scrollbar { display: none; }
        .forma-tab {
            display: flex; align-items: center; gap: 5px;
            padding: 5px 9px 5px 8px; cursor: pointer;
            font-size: 13px; font-weight: 600; white-space: nowrap;
            border: 1.5px solid var(--border-light); border-bottom: none;
            border-radius: 7px 7px 0 0; margin-right: 2px;
            background: var(--bg-surface-2); color: var(--text-primary);
            transition: background 0.12s, color 0.12s; max-width: 140px;
            position: relative; bottom: -2px; user-select: none;
        }
        .forma-tab:hover { background: var(--bg-surface-3); color: #fff; }
        .forma-tab.active {
            background: var(--bg-surface-1); color: #fff;
            border-color: var(--accent-border); border-bottom: 2px solid var(--bg-surface-1);
            z-index: 2; padding-bottom: 7px;
        }
        .forma-tab-add {
            padding: 5px 10px; cursor: pointer;
            border: 1.5px dashed var(--border-light); border-bottom: none;
            border-radius: 7px 7px 0 0;
            background: var(--bg-surface-2); color: var(--text-primary);
            font-size: 13px; font-weight: 700; white-space: nowrap;
            display: flex; align-items: center;
            position: relative; bottom: -2px;
            transition: background 0.12s, color 0.12s, border-color 0.12s; flex-shrink: 0;
        }
        .forma-tab-add:hover { background: var(--bg-surface-3); color: var(--accent); border-color: var(--accent); }
        #formas-active-content {
            border: 1.5px solid var(--border-light); border-top: none;
            background: var(--bg-surface-2); border-radius: 0 6px 6px 6px;
            padding: 10px; overflow-y: auto; max-height: 360px;
        }

        /* ══ ACORDEONES DE SECCIÓN — Dark Studio ═══════════════════════════ */
        .acc-section {
            border-radius: 10px;
            margin-bottom: 6px;
            overflow: hidden;
            border: 1px solid var(--border);
            transition: border-color 0.18s, box-shadow 0.18s;
        }
        .acc-section:hover { border-color: var(--border-light); box-shadow: 0 2px 12px rgba(0,0,0,0.35); }

        .acc-header {
            display: flex;
            align-items: center;
            justify-content: space-between;
            padding: 9px 13px;
            cursor: pointer;
            user-select: none;
            background: var(--bg-surface-2);
            transition: background 0.12s;
        }
        .acc-header:hover { background: var(--bg-surface-3); }

        .acc-title {
            display: flex;
            align-items: center;
            gap: 7px;
            font-size: 12px;
            font-weight: 600;
            color: var(--text-secondary);
            flex: 1;
        }
        .acc-icon { font-size: 14px; line-height: 1; color: var(--text-primary); display: flex; align-items: center; }
        .acc-icon svg { width: 15px; height: 15px; stroke: var(--text-primary); flex-shrink: 0; }
        .acc-name { letter-spacing: 0.2px; color: var(--text-primary); font-weight: 600; }
        .acc-badge {
            font-size: 10px; font-weight: 800;
            min-width: 18px; height: 18px;
            border-radius: 9px;
            display: flex; align-items: center; justify-content: center;
            padding: 0 5px;
            background: var(--bg-surface-3);
            color: var(--text-secondary);
            border: 1px solid var(--border-light);
        }
        .acc-actions { display: flex; align-items: center; gap: 5px; }
        .acc-add-btn {
            font-size: 14px; font-weight: 700;
            min-width: 22px; height: 22px;
            border-radius: 50%;
            display: flex; align-items: center; justify-content: center;
            cursor: pointer; border: 1px solid rgba(255,255,255,0.25);
            background: rgba(255,255,255,0.08); color: #ffffff;
            transition: background 0.12s, transform 0.1s;
            flex-shrink: 0;
        }
        .acc-add-btn-label { border-radius: 11px; padding: 0 8px; font-size: 10px; font-weight: 700; min-width: auto; }
        .acc-add-btn:hover { background: rgba(255,255,255,0.18); transform: scale(1.08); }
        .acc-chevron {
            font-size: 12px;
            transition: transform 0.2s;
            flex-shrink: 0;
            opacity: 0.4;
            color: var(--text-secondary);
        }
        .acc-chevron.open { transform: rotate(180deg); opacity: 0.7; }
        .acc-body {
            display: none;
            padding: 8px 10px 6px;
            background: var(--bg-surface-2);
            border-top: 1px solid var(--border);
        }
        .acc-body.open { display: block; }

        /* ── Acordeones: un solo tema oscuro (sin arcoíris) ── */
        #acc-textos, #acc-stickers, #acc-marcos, #acc-contador, #acc-qr { border-color: var(--border); }

        .acc-textos-hdr, .acc-stickers-hdr, .acc-marcos-hdr,
        .acc-contador-hdr, .acc-qr-hdr { background: var(--bg-surface-2); color: var(--text-secondary); }

        .acc-badge-textos, .acc-badge-stickers, .acc-badge-marcos,
        .acc-badge-contador, .acc-badge-qr { background: var(--bg-surface-3); color: var(--accent); border-color: var(--accent-border); }

        /* ── Panel "en uso" (cerrado, con contenido): borde + badge verde ── */
        .acc-section.acc-in-use {
            border-color: rgba(34, 197, 94, 0.45);
            box-shadow: inset 3px 0 0 rgba(34, 197, 94, 0.55);
        }
        .acc-section.acc-in-use .acc-header {
            background: rgba(34, 197, 94, 0.045);
        }
        .acc-section.acc-in-use .acc-badge {
            background: rgba(34, 197, 94, 0.18) !important;
            color: #22c55e !important;
            border-color: rgba(34, 197, 94, 0.45) !important;
        }
        /* Cuando está abierto, el azul de apertura prevalece sobre el verde */
        .acc-section:has(.acc-body.open) {
            border-color: var(--accent-border);
            box-shadow: none;
        }
        .acc-section:has(.acc-body.open) .acc-header { background: var(--bg-surface-2); }
        .acc-section:has(.acc-body.open) .acc-badge {
            background: var(--accent) !important;
            color: #fff !important;
            border-color: var(--accent) !important;
        }

        .acc-add-textos, .acc-add-stickers { background: var(--bg-surface-3); color: var(--accent); border-color: var(--accent-border); }

        /* Todos los cuerpos del acordeón: fondo oscuro unificado */
        #acc-templates .acc-body, #acc-textos .acc-body, #acc-stickers .acc-body,
        #acc-marcos .acc-body, #acc-contador .acc-body, #acc-qr .acc-body { background: var(--bg-surface-2); }

        /* ── Drag handles de paneles ── */
        .panel-dh {
            font-size: 14px;
            color: var(--text-muted);
            cursor: grab;
            line-height: 1;
            flex-shrink: 0;
            padding: 0 2px;
            border-radius: 3px;
            transition: color 0.15s;
            user-select: none;
        }
        .panel-dh:hover { color: var(--text-secondary); }
        .panel-dh:active { cursor: grabbing; }

        /* Panel siendo arrastrado */
        .sortable-panel.dragging {
            opacity: 0.45;
            outline: 2px dashed var(--accent);
            outline-offset: 2px;
        }
        /* Panel resaltado como destino de drop */
        .sortable-panel.drag-over {
            outline: 2px solid var(--accent);
            outline-offset: 2px;
        }

        /* Botón "Agregar contador" en body vacío */
        .acc-add-cd-btn {
            width: 100%; padding: 12px; margin-bottom: 4px;
            background: var(--bg-surface-3);
            color: var(--text-primary); border: 1px solid var(--accent-border); border-radius: 9px;
            font-size: 13px; font-weight: 700; cursor: pointer;
            letter-spacing: 0.3px;
            transition: background 0.15s, border-color 0.15s;
        }
        .acc-add-cd-btn:hover { background: var(--accent-glow); border-color: var(--accent); }
        