/* Estilos de la app, sacados de la página a su archivo para que el navegador los guarde en caché
   (auditoría ARQSEO 1205, R042/R043). Origen: templates/tools/firma.php. */
  /* ════════════════════════════════════════════════════════════
     FIT-TO-SCREEN · hero full-width: la tool llena el alto del
     .sw-tool-shell__body, reparte la UI en 3 columnas a lo ancho y
     el scroll vive DENTRO de cada panel, nunca en la página.
     ════════════════════════════════════════════════════════════ */
  .sw-tool-shell__body > .tool-firma-root { height: 100%; display: flex; flex-direction: column; min-height: 0; }
  .tool-firma-root.sw-section--dense { padding-top: 0; padding-bottom: 0; }
  .tool-firma-wrap {
    flex: 1 1 auto;
    height: 100%;
    display: flex;
    flex-direction: column;
    min-height: 0;
    width: 100%;
    max-width: var(--sw-tool-max, 1840px);
    margin: 0 auto;
    padding: 12px 32px;
    gap: 12px;
  }
  @media (max-width: 1280px) { .tool-firma-wrap { padding: 10px 24px; } }
  @media (max-width: 640px)  { .tool-firma-wrap { padding: 10px 16px; } }

  /* Barra superior única: fija, no scrollea */
  .tool-firma-wrap > .firma-bar { flex: 0 0 auto; }
  /* El grid ocupa el hueco restante y delega el scroll a sus columnas */
  .tool-firma-wrap > .firma-grid { flex: 1 1 auto; min-height: 0; }

  /* ── Barra superior única (3 tramos) ── */
  .firma-bar {
    display: flex; align-items: center; gap: 14px;
    flex-wrap: wrap;
    padding: 7px 14px;
    background: var(--sw-bg);
    border: 1px solid var(--sw-border);
    border-radius: var(--sw-radius-lg);
  }
  .firma-bar__left  { flex: 0 0 auto; }
  .firma-bar__center { flex: 1 1 320px; min-width: 0; }
  .firma-bar__right {
    flex: 0 0 auto; margin-left: auto;
    display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  }

  /* ── Grid de 3 columnas (editor | preview | salida) ── */
  .firma-grid {
    display: grid;
    grid-template-columns: minmax(440px, 520px) minmax(0, 1fr) minmax(400px, 440px);
    gap: 18px;
    align-items: stretch;
    height: 100%;
    min-height: 0;
  }
  /* Columnas con scroll interno propio (izq y dcha) */
  .firma-grid > .firma-side {
    height: 100%; min-height: 0;
    overflow-y: auto; overscroll-behavior: contain;
  }
  /* Centro y derecha: flex column, gestionan el scroll en sus paneles */
  .firma-grid > .firma-center,
  .firma-grid > .firma-output {
    height: 100%; min-height: 0;
    display: flex; flex-direction: column;
  }

  /* ════════════════════════════════════════════════════════════
     TABLET LANDSCAPE (~1024×768 · 981–1180px): 3 → 2 columnas.
       · Columna 1 = editor (ocupa las 2 filas, scroll interno propio).
       · Columna 2 = Preview (fila 1, alto acotado) sobre Salida (fila 2:
         Copiar + código + guías), que ocupa el resto y scrollea por dentro.
     La página NO scrollea dentro del fold; cada panel gestiona su scroll.
     Las guías de instalación se colapsan en su <details> para no alargar.
     ════════════════════════════════════════════════════════════ */
  @media (min-width: 981px) and (max-width: 1180px) {
    .firma-grid {
      grid-template-columns: minmax(320px, 400px) minmax(0, 1fr);
      grid-template-rows: auto minmax(0, 1fr);
      gap: 14px;
      align-items: stretch;
    }
    /* Editor ocupa la columna izquierda completa, ambas filas */
    .firma-grid > .firma-side   { grid-column: 1; grid-row: 1 / span 2; }
    /* Preview arriba a la derecha, con alto acotado (no se come la pantalla) */
    .firma-grid > .firma-center {
      grid-column: 2; grid-row: 1;
      height: auto; max-height: 50vh; min-height: 0;
    }
    /* Salida ocupa el resto de la columna derecha y scrollea por dentro */
    .firma-grid > .firma-output {
      grid-column: 2; grid-row: 2;
      height: 100%; min-height: 0;
      overflow-y: auto; overscroll-behavior: contain;
    }

    /* El preview se ancla arriba (no centra vertical) para no dejar huecos */
    .firma-center__stage { justify-content: flex-start; }
    /* Marco de email algo más compacto en tablet */
    .firma-preview__email-body { padding: 16px 18px 20px; min-height: 180px; }
    /* El código limita su alto; las guías colapsan para ganar aire */
    .firma-code { max-height: 170px; }

    /* Guías colapsables: el summary pasa a interactivo (cursor + chevron) */
    .firma-guides__summary { cursor: pointer; }
    .firma-guides__summary:hover .firma-block__title { color: var(--sw-brand-600); }
    .firma-guides__chev { display: inline-flex; }
    .firma-block--guides:not([open]) { flex: 0 0 auto; }
    .firma-block--guides[open] .firma-guide { max-height: 240px; overflow-y: auto; }
  }
  /* ════════════════════════════════════════════════════════════
     TABLET PORTRAIT / móvil (≤980px): 1 columna; la página scrollea.
     Orden vertical: barra → Preview (feedback inmediato) → Editor →
     Salida (Copiar + código + guías). Las guías van colapsables.
     ════════════════════════════════════════════════════════════ */
  @media (max-width: 980px) {
    .sw-tool-shell__body > .tool-firma-root { height: auto; }
    .tool-firma-wrap { height: auto; }
    .firma-grid {
      grid-template-columns: 1fr;
      height: auto; min-height: 0;
      gap: 14px;
    }
    .firma-grid > .firma-side,
    .firma-grid > .firma-center,
    .firma-grid > .firma-output {
      height: auto; min-height: 0;
      overflow: visible;
      display: block;
    }
    /* Preview primero para feedback inmediato, luego editor, luego salida */
    .firma-grid > .firma-center { order: 1; }
    .firma-grid > .firma-side   { order: 2; }
    .firma-grid > .firma-output { order: 3; }

    /* Guías colapsables también en portrait (interactivas) */
    .firma-guides__summary { cursor: pointer; padding-bottom: 10px; }
    .firma-guides__summary:hover .firma-block__title { color: var(--sw-brand-600); }
    .firma-guides__chev { display: inline-flex; }
  }

  /* Afinado SOLO tablet portrait (~768px): densidad cómoda sin alargar de más */
  @media (min-width: 641px) and (max-width: 980px) {
    /* El editor no necesita acotar alto: deja que cada acordeón respire.
       La sección de redes (16 inputs) sí mantiene scroll interno acotado. */
    .firma-grid > .firma-side { padding: 14px; }
    .firma-section__body .firma-socials { max-height: 320px; overflow-y: auto; }
    /* Preview cómodo pero acotado para que el editor quede a un scroll corto */
    .firma-center__stage { max-height: none; }
    .firma-preview__email-body { padding: 18px 20px 22px; min-height: 200px; }
    /* Código y guías acotados: la página scrollea, pero sin tiras kilométricas */
    .firma-code { max-height: 300px; }
    .firma-block--guides[open] .firma-guide { max-height: 360px; overflow-y: auto; }
    /* Salida con algo más de aire entre bloques en portrait */
    .firma-output { gap: 16px; }
  }

  /* ── Topbar (firmas guardadas) dentro de la barra ── */
  .firma-topbar {
    display: flex; align-items: center; gap: 12px;
    flex-wrap: wrap;
  }
  .firma-topbar__group { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
  .firma-topbar__label { font-size: 13px; font-weight: 600; color: var(--sw-text-muted); }
  .firma-topbar__sel,
  .firma-topbar__name {
    padding: 6px 10px; border: 1px solid var(--sw-border);
    border-radius: var(--sw-radius-md); background: var(--sw-bg);
    font: 14px var(--sw-font-sans); color: var(--sw-text);
    min-width: 150px;
  }
  .firma-topbar__sel:focus, .firma-topbar__name:focus {
    outline: none; border-color: var(--sw-brand-500); box-shadow: var(--sw-shadow-focus);
  }

  /* ── Sidebar (editor) ── */
  .firma-side {
    background: var(--sw-bg-subtle);
    border: 1px solid var(--sw-border);
    border-radius: var(--sw-radius-lg);
    padding: 12px;
    /* overflow/altura los aporta la regla fit-to-screen .firma-grid > .firma-side */
  }
  .firma-section {
    border: 1px solid var(--sw-border);
    border-radius: var(--sw-radius-md);
    background: var(--sw-bg);
    margin-bottom: 8px;
    overflow: hidden;
  }
  .firma-section[open] { border-color: var(--sw-brand-300, #fda4af); }
  .firma-section__head {
    list-style: none;
    cursor: pointer; user-select: none;
    padding: 10px 12px;
    display: flex; align-items: center; gap: 8px;
    font-size: 14px; font-weight: 600;
    color: var(--sw-text);
    transition: background var(--sw-dur-fast);
  }
  .firma-section__head::-webkit-details-marker { display: none; }
  .firma-section__head:hover { background: var(--sw-bg-muted); }
  .firma-section__num {
    width: 22px; height: 22px;
    background: var(--sw-bg-muted);
    border-radius: 50%;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 11.5px; font-weight: 700;
    color: var(--sw-text-muted);
    flex-shrink: 0;
  }
  .firma-section[open] .firma-section__num {
    background: var(--sw-brand-500); color: #fff;
  }
  .firma-section__title { flex: 1; display: flex; align-items: center; gap: 6px; }
  .firma-section__chev {
    color: var(--sw-text-muted);
    transition: transform var(--sw-dur-fast);
  }
  .firma-section[open] .firma-section__chev { transform: rotate(180deg); }
  .firma-section__body { padding: 0 12px 12px; }

  /* Form fields */
  .firma-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
  .firma-field { margin-bottom: 10px; display: flex; flex-direction: column; gap: 4px; }
  .firma-field label {
    font-size: 12.5px; font-weight: 600;
    color: var(--sw-text-muted);
  }
  .firma-field input,
  .firma-field select,
  .firma-field textarea {
    width: 100%;
    padding: 7px 10px;
    border: 1px solid var(--sw-border);
    border-radius: var(--sw-radius-md);
    background: var(--sw-bg);
    font: 14px var(--sw-font-sans);
    color: var(--sw-text);
    transition: border-color var(--sw-dur-fast), box-shadow var(--sw-dur-fast);
  }
  .firma-field input[type="color"] { height: 36px; padding: 3px; cursor: pointer; }
  .firma-field input:focus, .firma-field select:focus, .firma-field textarea:focus {
    outline: none; border-color: var(--sw-brand-500); box-shadow: var(--sw-shadow-focus);
  }
  .firma-field small { font-size: 12px; color: var(--sw-text-subtle); }
  .firma-toggle {
    display: flex; align-items: center; gap: 8px;
    padding: 6px 0; font-size: 14px;
    color: var(--sw-text); cursor: pointer;
    margin-bottom: 8px;
  }
  .firma-toggle input { width: auto; }

  /* Plantilla cards grid (12) — 3 col en FHD (columna izq más ancha) */
  .firma-tpl-grid {
    display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px;
  }
  /* Editor más estrecho en tablet (≤1180px) → plantillas a 2 columnas */
  @media (max-width: 1180px) { .firma-tpl-grid { grid-template-columns: repeat(2, 1fr); } }
  .firma-tpl-card {
    border: 2px solid var(--sw-border);
    border-radius: var(--sw-radius-md);
    background: var(--sw-bg);
    padding: 9px 8px;
    cursor: pointer;
    text-align: center;
    transition: border-color var(--sw-dur-fast), background var(--sw-dur-fast);
    font-size: 12.5px;
    color: var(--sw-text);
    display: flex; flex-direction: column; align-items: center; gap: 4px;
  }
  .firma-tpl-card:hover { border-color: var(--sw-brand-500); }
  .firma-tpl-card:focus-visible {
    outline: none; border-color: var(--sw-brand-500);
    box-shadow: var(--sw-shadow-focus);
  }
  .firma-tpl-card.is-active {
    border-color: var(--sw-brand-500);
    background: rgba(244,63,94,.08);
    color: var(--sw-text);
    font-weight: 600;
  }
  .firma-tpl-card__thumb {
    width: 100%; height: 28px;
    background: var(--sw-bg-muted);
    border-radius: 4px;
    position: relative; overflow: hidden;
    margin-bottom: 2px;
  }
  .firma-tpl-card__thumb::before,
  .firma-tpl-card__thumb::after {
    content: ''; position: absolute;
    background: var(--sw-text-subtle);
    border-radius: 1px;
  }
  .firma-tpl-card__thumb--minimal::before { left: 8px; top: 6px; width: 30%; height: 4px; }
  .firma-tpl-card__thumb--minimal::after { left: 8px; top: 14px; width: 50%; height: 2px; }
  .firma-tpl-card__thumb--corporate::before { left: 8px; top: 6px; width: 18px; height: 18px; border-radius: 50%; }
  .firma-tpl-card__thumb--corporate::after { left: 32px; top: 8px; width: 50%; height: 3px; box-shadow: 0 6px 0 var(--sw-text-subtle); }
  .firma-tpl-card__thumb--creative::before { left: 6px; top: 6px; width: 4px; height: 16px; background: var(--sw-brand-500); }
  .firma-tpl-card__thumb--creative::after { left: 14px; top: 8px; width: 60%; height: 3px; box-shadow: 0 6px 0 var(--sw-text-subtle); }
  .firma-tpl-card__thumb--agency::before { left: 8px; top: 4px; right: 8px; width: auto; height: 4px; }
  .firma-tpl-card__thumb--agency::after { left: 8px; top: 14px; width: 50%; height: 3px; box-shadow: 0 6px 0 var(--sw-text-subtle); }
  .firma-tpl-card__thumb--freelance::before { left: 8px; top: 6px; width: 50%; height: 4px; }
  .firma-tpl-card__thumb--freelance::after { left: 8px; bottom: 4px; width: 40%; height: 2px; box-shadow: 0 -3px 0 var(--sw-text-subtle); }
  .firma-tpl-card__thumb--sales::before { left: 8px; top: 6px; width: 35%; height: 5px; background: var(--sw-brand-500); }
  .firma-tpl-card__thumb--sales::after { left: 8px; top: 16px; width: 60%; height: 2px; box-shadow: 0 4px 0 var(--sw-text-subtle); }
  .firma-tpl-card__thumb--executive::before { left: 8px; top: 5px; width: 50%; height: 4px; background: #1a1a1a; }
  .firma-tpl-card__thumb--executive::after { left: 8px; top: 15px; width: 40%; height: 2px; box-shadow: 0 4px 0 var(--sw-text-subtle); }
  .firma-tpl-card__thumb--banner::before { left: 4px; top: 4px; right: 4px; width: auto; height: 8px; background: var(--sw-brand-500); border-radius: 2px; }
  .firma-tpl-card__thumb--banner::after { left: 8px; bottom: 4px; width: 50%; height: 2px; box-shadow: 0 4px 0 var(--sw-text-subtle); }
  .firma-tpl-card__thumb--photo::before { left: 6px; top: 5px; width: 18px; height: 18px; border-radius: 50%; background: var(--sw-brand-500); }
  .firma-tpl-card__thumb--photo::after { left: 30px; top: 7px; width: 50%; height: 3px; box-shadow: 0 5px 0 var(--sw-text-subtle); }
  .firma-tpl-card__thumb--two-col::before { left: 6px; top: 6px; width: 35%; height: 16px; background: var(--sw-text-subtle); }
  .firma-tpl-card__thumb--two-col::after { right: 6px; top: 6px; width: 35%; height: 16px; background: var(--sw-bg); border: 1px solid var(--sw-text-subtle); }
  .firma-tpl-card__thumb--vertical::before { left: 8px; top: 4px; right: 8px; width: auto; height: 3px; background: var(--sw-text-subtle); }
  .firma-tpl-card__thumb--vertical::after { left: 8px; top: 11px; right: 8px; width: auto; height: 2px; box-shadow: 0 4px 0 var(--sw-text-subtle), 0 8px 0 var(--sw-text-subtle); }
  .firma-tpl-card__thumb--modern::before { left: 8px; top: 6px; width: 40%; height: 4px; background: var(--sw-brand-500); border-radius: 2px; }
  .firma-tpl-card__thumb--modern::after { left: 8px; top: 16px; width: 60%; height: 2px; box-shadow: 0 4px 0 var(--sw-text-subtle); }
  .firma-tpl-card__name { font-size: 11.5px; line-height: 1.1; }

  /* Color presets — 10 swatches en una fila (con la columna izq más ancha) */
  .firma-color-presets {
    display: grid; grid-template-columns: repeat(10, 1fr); gap: 6px;
    margin-bottom: 10px;
  }
  @media (max-width: 1180px) { .firma-color-presets { grid-template-columns: repeat(5, 1fr); } }
  .firma-color-swatch {
    width: 100%; aspect-ratio: 1;
    border-radius: var(--sw-radius-md);
    border: 2px solid transparent;
    cursor: pointer;
    transition: transform var(--sw-dur-fast), border-color var(--sw-dur-fast);
  }
  .firma-color-swatch:hover { transform: scale(1.05); }
  .firma-color-swatch.is-active {
    border-color: var(--sw-text);
    transform: scale(1.05);
  }

  /* Socials list */
  .firma-socials { display: flex; flex-direction: column; gap: 6px; }
  .firma-social-item {
    display: grid;
    grid-template-columns: 26px 1fr 32px;
    gap: 8px;
    align-items: center;
  }
  .firma-social-icon {
    width: 26px; height: 26px;
    border-radius: 6px;
    background: var(--sw-bg-muted);
    display: inline-flex; align-items: center; justify-content: center;
    color: var(--sw-text);
    flex-shrink: 0;
  }
  .firma-social-icon svg { display: block; }
  .firma-social-item input[type="url"] {
    padding: 6px 9px;
    border: 1px solid var(--sw-border);
    border-radius: 6px;
    background: var(--sw-bg);
    font: 13px var(--sw-font-sans);
    width: 100%;
  }
  .firma-social-item input[type="url"]:focus {
    outline: none; border-color: var(--sw-brand-500);
  }

  .firma-actions-row { display: flex; flex-direction: column; gap: 6px; }
  .firma-actions-row .sw-btn { width: 100%; justify-content: center; }

  /* ════════════════════════════════════════════════════════════
     COL CENTRO · PREVIEW (no scrollea la columna; el marco se
     centra y escala al hueco. Solo el "stage" scrollea si excede).
     ════════════════════════════════════════════════════════════ */
  .firma-center__head {
    flex: 0 0 auto;
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 10px; gap: 12px; flex-wrap: wrap;
  }
  .firma-center__head h2 {
    font-size: 15px; font-weight: 600; margin: 0;
    display: flex; align-items: center; gap: 8px;
  }
  .firma-center__stage {
    flex: 1 1 auto; min-height: 0;
    display: flex; flex-direction: column; justify-content: center;
  }
  /* Barrido 06-11-2026: con una plantilla alta (Diagonal, Curva) la vista previa se encogía para caber y
     cortaba la firma por abajo (el banner y «Hecha con» no se veían). Ahora mantiene su alto y lo que se
     desplaza es el escenario. */
  .firma-center__stage > * { flex-shrink: 0; }
  @media (max-width: 980px) {
    .firma-center__stage { display: block; }
  }

  /* ── Output area / cabeceras de bloque ── */
  .firma-output__head {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 10px; gap: 10px; flex-wrap: wrap;
  }
  .firma-output__head h2 {
    font-size: 15px; font-weight: 600; margin: 0;
    display: flex; align-items: center; gap: 8px;
  }
  .firma-block__title {
    font-size: 15px; margin: 0; font-weight: 600;
    display: flex; align-items: center; gap: 8px;
  }
  /* Guías como <details>: en desktop FHD el summary es una cabecera estática
     (no colapsa, sin marcador ni chevron). En tablet pasa a ser interactivo. */
  .firma-guides__summary { list-style: none; cursor: default; }
  .firma-guides__summary::-webkit-details-marker { display: none; }
  .firma-guides__chev {
    display: none; margin-left: auto; color: var(--sw-text-muted);
    transition: transform var(--sw-dur-fast);
  }
  .firma-block--guides[open] > .firma-guides__summary .firma-guides__chev { transform: rotate(180deg); }
  .firma-preview-tabs, .firma-output-tabs {
    display: flex; gap: 4px;
    padding: 3px; background: var(--sw-bg-muted);
    border-radius: var(--sw-radius-md);
  }
  .firma-preview-tab, .firma-output-tab {
    background: transparent; border: 0;
    padding: 5px 10px;
    border-radius: var(--sw-radius-md);
    font: 13px var(--sw-font-sans); font-weight: 500;
    color: var(--sw-text-muted);
    cursor: pointer;
    display: inline-flex; align-items: center; gap: 4px;
  }
  .firma-preview-tab:hover, .firma-output-tab:hover { color: var(--sw-text); }
  .firma-preview-tab.is-active, .firma-output-tab.is-active {
    background: var(--sw-bg);
    color: var(--sw-text);
    box-shadow: 0 1px 3px rgba(0,0,0,.05);
  }

  .firma-preview {
    border: 1px solid var(--sw-border);
    border-radius: var(--sw-radius-lg);
    overflow: hidden;
    transition: background var(--sw-dur-base);
    width: 100%;
  }
  .firma-preview--light { background: #fff; }
  .firma-preview--dark .firma-preview__email-header { background: #2a2a2e; color: #c9c9c0; border-color: #3a3a3e; }
  .firma-preview--dark .firma-preview__email-body { background: #1f1f23; color: #d8d8d2; }
  .firma-preview--mobile { max-width: 380px; margin: 0 auto; }

  .firma-preview__email-header {
    background: var(--sw-bg-muted);
    padding: 12px 18px;
    font-size: 13.5px;
    color: var(--sw-text-muted);
    border-bottom: 1px solid var(--sw-border);
  }
  .firma-preview__email-body {
    padding: 22px 24px 28px;
    font: 14.5px / 1.6 'Helvetica Neue', Helvetica, Arial, sans-serif;
    color: #1a1a1a;
    background: #fff;
    min-height: 280px;
  }
  #firmaPreviewSlot { min-height: 100px; }

  /* ════════════════════════════════════════════════════════════
     COL DCHA · SALIDA + AYUDA en 3 bloques con pesos fijos.
     A (copiar, auto) destacado · B (código, max-height + scroll) ·
     C (guías, absorbe el resto con scroll interno de los pasos).
     ════════════════════════════════════════════════════════════ */
  .firma-output { gap: 14px; }
  .firma-block { display: flex; flex-direction: column; min-height: 0; }
  .firma-block--copy   { flex: 0 0 auto; }
  .firma-block--code   { flex: 0 1 auto; }
  .firma-block--guides { flex: 1 1 auto; }

  .firma-code {
    background: var(--sw-ink-900);
    color: #e6e6e3;
    border-radius: var(--sw-radius-lg);
    padding: 14px 16px;
    overflow-x: auto;
    font: 13px / 1.55 var(--sw-font-mono);
    white-space: pre-wrap;
    word-break: break-word;
    max-height: 220px;
    overflow-y: auto;
    margin: 0;
  }
  @media (max-width: 1180px) { .firma-code { max-height: 280px; } }
  .firma-code code { color: inherit; background: transparent; }

  /* Install guides */
  .firma-guides {
    border: 1px solid var(--sw-border);
    border-radius: var(--sw-radius-lg);
    background: var(--sw-bg-subtle);
    overflow: hidden;
    display: flex; flex-direction: column;
    min-height: 0;
    flex: 1 1 auto;
  }
  .firma-guides__tabs {
    flex: 0 0 auto;
    display: flex; flex-wrap: wrap;
    border-bottom: 1px solid var(--sw-border);
    background: var(--sw-bg);
  }
  .firma-guide-tab {
    background: transparent; border: 0;
    padding: 9px 14px;
    font: 13.5px var(--sw-font-sans); font-weight: 500;
    color: var(--sw-text-muted);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
  }
  .firma-guide-tab:hover { color: var(--sw-text); }
  .firma-guide-tab.is-active {
    color: var(--sw-text);
    border-bottom-color: var(--sw-brand-500);
  }
  .firma-guide {
    flex: 1 1 auto; min-height: 0;
    padding: 14px 18px;
    font: 14px / 1.55 var(--sw-font-sans);
    color: var(--sw-text);
  }
  @media (max-width: 980px) { .firma-guide { max-height: 320px; } }
  /* Repaso 23-10-2026 · escritorio: las guías no deben empujar la columna fuera
     de la pantalla. El contenido de <details> va en un hueco propio
     (::details-content) que hay que convertir en flex para que .firma-guide
     reciba alto acotado y haga scroll por dentro. La columna de salida, por si
     acaso, también scrollea en vez de salirse. */
  @media (min-width: 1181px) {
    .firma-grid > .firma-output { overflow-y: auto; overscroll-behavior: contain; }
    .firma-block--guides[open] { min-height: 160px; overflow: hidden; }
    .firma-block--guides::details-content { display: flex; flex-direction: column; flex: 1 1 auto; min-height: 0; }
    .firma-guides { flex: 1 1 auto; min-height: 0; }
    .firma-guide { overflow-y: auto; }
  }
  .firma-guide ol { margin: 8px 0 0 18px; padding: 0; }
  .firma-guide ol li { margin-bottom: 5px; }
  .firma-guide strong { color: var(--sw-text); }
  .firma-guide code {
    background: var(--sw-bg-muted);
    padding: 1px 6px; border-radius: 4px;
    font: 12.5px var(--sw-font-mono);
  }

  .firma-status { font-size: 13px; color: var(--sw-text-subtle); }
  .firma-status.is-ok { color: #15803d; }
  .firma-status.is-error { color: #b91c5c; }

  /* ── Barra de completitud ── */
  /* Progreso = tramo central de la barra (sin caja propia, la aporta .firma-bar) */
  .firma-progress {
    display: grid;
    grid-template-columns: minmax(120px, 1fr) auto;
    align-items: center;
    gap: 14px;
  }
  .firma-progress__bar {
    height: 8px; border-radius: var(--sw-radius-full);
    background: var(--sw-bg-strong); overflow: hidden;
  }
  .firma-progress__fill {
    display: block; height: 100%;
    background: linear-gradient(90deg, var(--sw-brand-500), var(--sw-spot-500));
    border-radius: var(--sw-radius-full);
    transition: width var(--sw-dur-base) var(--sw-ease-out);
  }
  .firma-progress__meta { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
  .firma-progress__pct { font: 600 14px var(--sw-font-mono); color: var(--sw-text); }
  .firma-progress__hint { font-size: 13px; color: var(--sw-text-subtle); }
  .firma-autosave {
    display: inline-flex; align-items: center; gap: 5px;
    font-size: 12.5px; font-weight: 600; color: var(--sw-text-subtle);
    white-space: nowrap;
    transition: opacity var(--sw-dur-base);
  }
  .firma-autosave svg { color: var(--sw-success-500); }
  .firma-autosave.is-saving { color: var(--sw-text-muted); }
  .firma-autosave.is-saving svg { color: var(--sw-text-muted); }
  @media (max-width: 640px) {
    .firma-progress { grid-template-columns: 1fr; gap: 8px; }
    /* En móvil el progreso encabeza la barra compacta (ver bloque móvil 2-pasos) */
    .firma-bar__center { order: -1; flex-basis: 100%; }
    .firma-bar__right { width: 100%; }
  }

  /* Punto verde en secciones con contenido */
  .firma-section.is-filled .firma-section__num::after {
    content: ''; position: absolute;
    top: -2px; right: -2px; width: 8px; height: 8px;
    background: var(--sw-success-500); border: 2px solid var(--sw-bg);
    border-radius: 50%;
  }
  .firma-section__num { position: relative; }

  /* ── Dropzone de logo ── */
  .firma-dropzone {
    display: flex; flex-direction: column; align-items: center; gap: 4px;
    text-align: center;
    padding: 16px 12px; margin-bottom: 12px;
    border: 1.5px dashed var(--sw-border-strong);
    border-radius: var(--sw-radius-md);
    background: var(--sw-bg-subtle);
    color: var(--sw-text-muted);
    cursor: pointer;
    transition: border-color var(--sw-dur-fast), background var(--sw-dur-fast);
  }
  .firma-dropzone:hover, .firma-dropzone:focus-visible {
    border-color: var(--sw-brand-500); background: var(--sw-brand-50);
    outline: none;
  }
  .firma-dropzone.is-drag {
    border-color: var(--sw-brand-500); background: var(--sw-brand-50);
    border-style: solid;
  }
  .firma-dropzone__ico { color: var(--sw-brand-500); }
  .firma-dropzone__txt { font-size: 13.5px; }
  .firma-dropzone__txt strong { color: var(--sw-brand-600); }
  .firma-dropzone__hint { font-size: 11.5px; color: var(--sw-text-subtle); }
  .firma-logo-warn {
    display: block; margin-top: 4px;
    color: var(--sw-warning-500); font-weight: 600;
  }
  .firma-logo-warn.is-blocked { color: var(--sw-danger-500, #ef4444); }

  /* Enlace de reseñas: etiqueta con «?» y aviso amable debajo del campo */
  .firma-label-tip { display: flex; align-items: center; gap: 6px; }
  .firma-tip-btn {
    flex: none; width: 18px; height: 18px; padding: 0; border-radius: 50%;
    border: 1px solid var(--sw-border-strong, var(--sw-border)); background: var(--sw-bg-subtle, transparent);
    color: var(--sw-text-muted); font: 700 11px/1 var(--sw-font-sans); cursor: help;
    display: inline-flex; align-items: center; justify-content: center;
  }
  .firma-tip-btn:hover, .firma-tip-btn[data-open] { border-color: var(--sw-brand-500); color: var(--sw-brand-600, var(--sw-brand-500)); }
  .firma-tip-btn:focus-visible { outline: 2px solid var(--sw-brand-500); outline-offset: 2px; }
  @media (pointer: coarse) { .firma-tip-btn { width: 26px; height: 26px; font-size: 13px; } }
  .firma-resena-aviso { display: block; font-weight: 600; color: var(--sw-warning-600, #b45309) !important; }
  .firma-resena-aviso.is-ok { color: var(--sw-success-600, #047857) !important; font-weight: 500; }
  .firma-resena-aviso.is-blocked { color: var(--sw-danger-500, #ef4444) !important; }
  /* Tooltip: va colgado del <body> y con position:fixed para que no lo corte el scroll del panel */
  .firma-tip {
    position: fixed; z-index: 2147483000; left: 12px; top: 12px;
    width: min(340px, calc(100vw - 24px)); max-height: calc(100vh - 24px); overflow-y: auto;
    padding: 12px 14px; border-radius: 10px;
    background: #111827; color: #f3f4f6; border: 1px solid #374151;
    box-shadow: 0 12px 32px rgba(0, 0, 0, .28);
    font: 13px/1.5 var(--sw-font-sans, system-ui, sans-serif); text-align: left;
  }
  .firma-tip[hidden] { display: none; }
  .firma-tip__title { display: block; margin: 0 0 6px; font-size: 13.5px; color: #ffffff; }
  .firma-tip__pasos { margin: 0; padding: 0 0 0 18px; }
  .firma-tip__pasos li { margin: 0 0 5px; }
  .firma-tip__pasos b { color: #ffffff; font-weight: 700; word-break: break-word; }
  .firma-tip__nota { margin: 8px 0 0; padding: 8px 0 0; border-top: 1px solid #374151; color: #d1d5db; font-size: 12.5px; }

  .firma-divider {
    border: 0; border-top: 1px solid var(--sw-border);
    margin: 12px 0 10px;
  }
  /* Reset "armado" (esperando 2ª pulsación de confirmación) */
  #firmaResetBtn.is-confirm {
    border-color: var(--sw-warning-500, #f59e0b);
    color: var(--sw-warning-600, #d97706);
    font-weight: 600;
  }
  .firma-utm-note {
    display: block; font-size: 12px; color: var(--sw-text-subtle); margin-top: 4px;
  }
  .firma-utm-note code {
    background: var(--sw-bg-muted); padding: 0 4px; border-radius: 3px;
    font: 11.5px var(--sw-font-mono);
  }

  /* Aviso de contraste de color */
  .firma-color-contrast {
    display: flex; align-items: center; gap: 6px;
    font-size: 12px; margin-top: 6px;
    color: var(--sw-text-subtle);
  }
  .firma-color-contrast.is-warn { color: var(--sw-warning-500); font-weight: 600; }
  .firma-color-contrast.is-ok { color: var(--sw-success-500); }

  /* ── Copiar firma renderizada (bloque A, acción principal destacada) ── */
  .firma-copyrich__hint {
    display: block; margin-top: 6px; text-align: center;
    font-size: 12.5px; color: var(--sw-text-subtle);
  }
  .firma-copyrich__hint kbd {
    background: var(--sw-bg-muted); border: 1px solid var(--sw-border);
    border-bottom-width: 2px; border-radius: 4px;
    padding: 0 5px; font: 11.5px var(--sw-font-mono); color: var(--sw-text);
  }

  /* Preview Outlook (look "tablas", fondo neutro) */
  .firma-preview--outlook .firma-preview__email-header { background: #f3f2f1; color: #444; }
  .firma-preview--outlook .firma-preview__email-body { background: #faf9f8; }

  /* Estado vacío del preview */
  .firma-preview-empty {
    display: flex; flex-direction: column; align-items: center; gap: 8px;
    text-align: center; padding: 18px 8px;
    color: var(--sw-text-subtle);
  }
  .firma-preview-empty svg { color: var(--sw-border-strong); }
  .firma-preview-empty strong { color: var(--sw-text-muted); font-weight: 600; }
  .firma-preview-empty span { font-size: 13.5px; }
  /* Estado vacío sobre el preview OSCURO: los tokens grises se pierden
     contra el fondo casi negro (#1f1f23) y el mensaje queda ilegible.
     Forzamos tonos claros para que el "Tu firma aparecerá aquí" se lea. */
  .firma-preview--dark .firma-preview-empty { color: #9a9a93; }
  .firma-preview--dark .firma-preview-empty svg { color: #5a5a5e; }
  .firma-preview--dark .firma-preview-empty strong { color: #e4e4dd; }

  /* ── Modal "Cómo usar" ── */
  .firma-help-card { max-width: 620px; }
  .firma-help-body { font: 14.5px / 1.6 var(--sw-font-sans); color: var(--sw-text); }
  .firma-help-intro {
    margin: 0 0 14px; color: var(--sw-text-muted);
  }
  .firma-help-h {
    display: flex; align-items: center; gap: 7px;
    font: 600 14px var(--sw-font-sans);
    color: var(--sw-text);
    margin: 16px 0 8px;
  }
  .firma-help-h svg { color: var(--sw-brand-500); }
  .firma-help-steps { margin: 0; padding-left: 20px; }
  .firma-help-steps li { margin-bottom: 8px; }
  .firma-help-tips { margin: 0; padding-left: 20px; list-style: none; }
  .firma-help-tips li { position: relative; margin-bottom: 7px; padding-left: 4px; }
  .firma-help-tips li::before {
    content: ''; position: absolute; left: -14px; top: 8px;
    width: 5px; height: 5px; border-radius: 50%;
    background: var(--sw-brand-500);
  }
  .firma-help-body strong { color: var(--sw-text); font-weight: 600; }
  .firma-help-body em { color: var(--sw-text-muted); font-style: normal; font-weight: 600; }
  .firma-help-body kbd {
    background: var(--sw-bg-muted); border: 1px solid var(--sw-border);
    border-bottom-width: 2px; border-radius: 4px;
    padding: 0 5px; font: 11.5px var(--sw-font-mono); color: var(--sw-text);
  }

  /* ════════════════════════════════════════════════════════════
     CONMUTADOR DE PASOS · oculto por defecto (desktop FHD + tablet).
     Solo se materializa dentro del @media móvil de abajo. Así estos
     elementos nuevos no afectan a >640px (display:none global aquí).
     ════════════════════════════════════════════════════════════ */
  .firma-msteps,
  .firma-mstep-radio,
  .firma-mfab { display: none; }

  /* ════════════════════════════════════════════════════════════
     ░░ MÓVIL (≤640px · ~360/390/430) — 2 VISTAS EN PASOS ░░
     Objetivo: usar la herramienta con el mínimo scroll. Se reparte en
     2 pasos con conmutador sticky arriba (radios CSS, sin tocar el JS):
       · Paso 1 «Crear»   → Preview compacto (arriba) + Editor (acordeones).
       · Paso 2 «Exportar» → Copiar firma + Código + Guías de instalación.
     Todo a 1 columna, controles táctiles ≥40px, sin overflow horizontal.
     El conmutador (radios + :has) gobierna qué columnas del grid se ven;
     el resto de la lógica (render, single-open, copiar…) queda intacta.
     ════════════════════════════════════════════════════════════ */
  @media (max-width: 640px) {
    /* La herramienta vuelve a fluir con la página (scroll de página normal) */
    .sw-tool-shell__body > .tool-firma-root { height: auto; }
    .tool-firma-wrap { height: auto; padding: 8px 12px 80px; gap: 10px; }

    /* ── Conmutador de pasos: sticky bajo el header del sitio ── */
    .firma-msteps {
      display: grid; grid-template-columns: 1fr 1fr; gap: 6px;
      position: sticky; top: var(--sw-header-h); z-index: 6;  /* bajo la cabecera fija (06-11-2026) */
      padding: 6px; margin: 0 -2px;
      background: var(--sw-bg);
      border: 1px solid var(--sw-border);
      border-radius: var(--sw-radius-lg);
      box-shadow: var(--sw-shadow-sm);
    }
    .firma-mstep {
      display: flex; align-items: center; justify-content: center; gap: 7px;
      min-height: 44px; padding: 8px 10px;
      border-radius: var(--sw-radius-md);
      font: 600 14.5px var(--sw-font-sans); color: var(--sw-text-muted);
      cursor: pointer; user-select: none;
      transition: background var(--sw-dur-fast), color var(--sw-dur-fast);
    }
    .firma-mstep__n {
      width: 20px; height: 20px; flex-shrink: 0;
      display: inline-flex; align-items: center; justify-content: center;
      border-radius: 50%; background: var(--sw-bg-strong);
      font: 700 12px var(--sw-font-mono); color: var(--sw-text-muted);
    }
    /* Marca la pestaña activa según el radio correspondiente */
    .firma-msteps:has(#firmaMStepCreate:checked) label[for="firmaMStepCreate"],
    .firma-msteps:has(#firmaMStepExport:checked) label[for="firmaMStepExport"] {
      background: var(--sw-brand-500); color: #fff;
    }
    .firma-msteps:has(#firmaMStepCreate:checked) label[for="firmaMStepCreate"] .firma-mstep__n,
    .firma-msteps:has(#firmaMStepExport:checked) label[for="firmaMStepExport"] .firma-mstep__n {
      background: rgba(255,255,255,.28); color: #fff;
    }
    .firma-mstep:focus-within { box-shadow: var(--sw-shadow-focus); }

    /* ── Grid → 1 columna, sin alturas fijas (la página scrollea) ── */
    .firma-grid {
      grid-template-columns: 1fr;
      grid-template-rows: none;
      height: auto; min-height: 0; gap: 12px;
    }
    .firma-grid > .firma-side,
    .firma-grid > .firma-center,
    .firma-grid > .firma-output {
      grid-column: 1; grid-row: auto;
      height: auto; max-height: none; min-height: 0;
      overflow: visible; display: block;
    }

    /* ── Reparto por paso (radios + :has en el wrap) ──
       Paso 1 «Crear»: Preview (1º) + Editor (2º); oculta Salida.
       Paso 2 «Exportar»: solo Salida. */
    .tool-firma-wrap:has(#firmaMStepCreate:checked) .firma-output { display: none; }
    .tool-firma-wrap:has(#firmaMStepExport:checked) .firma-center,
    .tool-firma-wrap:has(#firmaMStepExport:checked) .firma-side { display: none; }

    .firma-grid > .firma-center { order: 1; }
    .firma-grid > .firma-side   { order: 2; }
    .firma-grid > .firma-output { order: 3; }

    /* ── Barra superior compacta: tramos a ancho completo, táctil ── */
    .firma-bar { gap: 8px; padding: 8px 10px; }
    .firma-bar__left,
    .firma-bar__right { width: 100%; }
    .firma-bar__right { justify-content: flex-start; gap: 6px; flex-wrap: wrap; }
    .firma-bar__right .sw-btn { min-height: 44px; }
    .firma-bar__center { order: -1; flex-basis: 100%; }
    .firma-topbar { width: 100%; gap: 8px; }
    .firma-topbar__group { width: 100%; }
    .firma-topbar__sel,
    .firma-topbar__name { flex: 1 1 auto; min-width: 0; min-height: 44px; }
    .firma-topbar__group .sw-btn { min-height: 44px; }
    .firma-autosave { order: 99; }

    /* ── Preview compacto y sticky (feedback inmediato sin perder sitio) ── */
    .firma-center__head { margin-bottom: 8px; gap: 8px; }
    .firma-center__head h2 { font-size: 15px; }
    /* Tabs de preview: scroll horizontal si no caben los 4 chips */
    .firma-preview-tabs {
      flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch;
      max-width: 100%; scrollbar-width: none;
    }
    .firma-preview-tabs::-webkit-scrollbar { display: none; }
    .firma-preview-tab { flex: 0 0 auto; min-height: 44px; }
    .firma-preview__email-header { padding: 9px 12px; font-size: 12.5px; }
    .firma-preview__email-body { padding: 14px 14px 18px; min-height: 150px; font-size: 14px; }
    #firmaPreviewSlot { min-height: 72px; }

    /* ── Editor a 1 columna, inputs táctiles ── */
    .firma-grid > .firma-side { padding: 10px; }
    .firma-row { grid-template-columns: 1fr; gap: 0; }
    .firma-field input,
    .firma-field select,
    .firma-field textarea { min-height: 44px; font-size: 16px; }
    .firma-field input[type="color"] { min-height: 44px; height: 44px; }
    .firma-section__head { padding: 12px; min-height: 46px; }
    .firma-section__body { padding: 0 12px 12px; }
    /* Plantillas a 2 columnas; redes con scroll interno acotado */
    .firma-tpl-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
    .firma-tpl-card { min-height: 64px; }
    .firma-color-presets { grid-template-columns: repeat(5, 1fr); gap: 8px; }
    .firma-color-swatch { min-height: 36px; }
    .firma-section__body .firma-socials { max-height: 300px; overflow-y: auto; }
    .firma-social-item { grid-template-columns: 24px 1fr; }
    .firma-social-item input[type="url"] { min-height: 44px; font-size: 16px; }
    /* La etiqueta de red (3ª col) sobra en móvil: el icono ya identifica */
    .firma-social-item > span:last-child { display: none; }

    /* ── Salida (paso 2): copiar grande arriba, código y guías ── */
    .firma-output { gap: 14px; }
    .firma-block--copy .sw-btn { min-height: 50px; font-size: 15px; }
    .firma-code { max-height: 260px; font-size: 13px; }
    .firma-output__head { gap: 8px; }
    .firma-output-tabs { flex: 1 1 auto; }
    .firma-output-tab { min-height: 44px; }
    .firma-output__head .sw-btn { min-height: 44px; }
    /* Guías: tabs con scroll horizontal y pasos legibles */
    .firma-guides__tabs {
      flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch;
      scrollbar-width: none;
    }
    .firma-guides__tabs::-webkit-scrollbar { display: none; }
    .firma-guide-tab { flex: 0 0 auto; min-height: 44px; }
    .firma-guide { max-height: none; }
    /* En móvil las guías se ven abiertas dentro del paso 2 (sin colapsar) */
    .firma-guides__summary { cursor: default; }
    .firma-guides__chev { display: none; }

    /* ── Botón flotante para saltar entre pasos (sticky abajo) ── */
    .firma-mfab {
      display: block;
      position: sticky; bottom: 0; z-index: 5;
      margin: 4px -12px 0; padding: 8px 12px;
      background: linear-gradient(to top, var(--sw-bg) 70%, transparent);
    }
    .firma-mfab__btn {
      width: 100%; justify-content: center;
      min-height: 48px; font-size: 15px;
      box-shadow: var(--sw-shadow-md);
    }
    /* Muestra «siguiente» en Crear y «volver» en Exportar */
    .firma-mfab__btn--back { display: none; }
    .tool-firma-wrap:has(#firmaMStepExport:checked) .firma-mfab__btn--next { display: none; }
    .tool-firma-wrap:has(#firmaMStepExport:checked) .firma-mfab__btn--back {
      display: inline-flex;
    }
  }

  /* Pantallas muy estrechas (~360 y menos): apura densidad sin romper */
  @media (max-width: 380px) {
    .firma-tpl-grid { grid-template-columns: repeat(2, 1fr); }
    .firma-mstep { font-size: 14px; padding: 8px 6px; }
    .firma-bar__right .sw-btn { font-size: 13.5px; }
  }

  /* ══════════ 23-10-2026 · ejemplo, firma a mano, galería, plantillas nuevas ══════════ */
  .tool-firma-wrap > .firma-ejemplo { flex: 0 0 auto; }
  .firma-ejemplo {
    display: flex; align-items: center; gap: 12px;
    padding: 8px 10px 8px 14px; margin: 0 0 10px;
    border: 1px solid color-mix(in srgb, var(--sw-brand-500) 35%, transparent);
    background: color-mix(in srgb, var(--sw-brand-500) 8%, var(--sw-bg));
    border-radius: var(--sw-radius-lg);
  }
  .firma-ejemplo[hidden] { display: none; }
  .firma-ejemplo__ico { color: var(--sw-brand-600); display: inline-flex; }
  .firma-ejemplo__txt { margin: 0; flex: 1 1 auto; font-size: 14px; line-height: 1.4; color: var(--sw-text); }
  .firma-ejemplo__btn { flex: 0 0 auto; font-weight: 700; }
  @media (max-width: 640px) {
    .firma-ejemplo { flex-wrap: wrap; }
    .firma-ejemplo__btn { width: 100%; justify-content: center; min-height: 44px; }
  }
  input.is-ejemplo, textarea.is-ejemplo { color: var(--sw-text-subtle); font-style: italic; }

  .firma-subhead { margin: 2px 0 8px; font-size: 12.5px; font-weight: 700; letter-spacing: .4px; text-transform: uppercase; color: var(--sw-text-muted); }
  .firma-inline { display: flex; gap: 6px; align-items: stretch; }
  .firma-inline input { flex: 1 1 auto; min-width: 0; }
  .firma-linkbtn {
    background: none; border: 0; padding: 0; font: inherit; color: var(--sw-brand-600);
    text-decoration: underline; text-underline-offset: 2px; cursor: pointer;
  }
  .firma-linkbtn:hover { color: var(--sw-brand-500); }
  .firma-preview-empty .firma-linkbtn { margin-top: 6px; font-size: 13.5px; }

  /* Tarjetas de plantilla: distintivo de «firma a mano» o «imagen» */
  .firma-tpl-card { position: relative; }
  .firma-tpl-card__badge {
    display: inline-block; margin-top: 3px; padding: 1px 6px; border-radius: 99px;
    font-size: 10.5px; font-weight: 700; line-height: 1.5; letter-spacing: .2px;
    color: var(--sw-brand-600); background: var(--sw-brand-50);
  }
  .firma-tpl-card__thumb--elegante::before { left: 8px; top: 5px; width: 16px; height: 16px; border-radius: 50%; background: var(--sw-brand-500); }
  .firma-tpl-card__thumb--elegante::after { left: 30px; top: 8px; width: 45%; height: 4px; background: var(--sw-text); box-shadow: 0 7px 0 var(--sw-text-subtle), -22px 13px 0 -1px var(--sw-brand-500); }
  .firma-tpl-card__thumb--moderna::before { left: 6px; top: 4px; width: 18px; height: 18px; border-radius: 50%; background: var(--sw-text-subtle); box-shadow: 22px 0 0 -7px var(--sw-brand-500); }
  .firma-tpl-card__thumb--moderna::after { left: 34px; top: 6px; width: 45%; height: 4px; background: var(--sw-text); box-shadow: 0 6px 0 var(--sw-brand-500), 0 11px 0 var(--sw-text-subtle); }
  .firma-tpl-card__thumb--esencial::before { left: 8px; top: 4px; width: 2px; height: 20px; background: var(--sw-brand-500); }
  .firma-tpl-card__thumb--esencial::after { left: 14px; top: 7px; width: 50%; height: 4px; background: var(--sw-text); box-shadow: 0 7px 0 var(--sw-text-subtle); }
  .firma-tpl-card__thumb--promo::before { left: 8px; top: 4px; width: 40%; height: 4px; background: var(--sw-text); box-shadow: 0 5px 0 var(--sw-text-subtle); }
  .firma-tpl-card__thumb--promo::after { left: 6px; right: 6px; bottom: 3px; width: auto; height: 9px; border-radius: 3px; background: linear-gradient(90deg, var(--sw-brand-500), #a855f7); }
  .firma-tpl-card__thumb--carta::before { left: 8px; top: 4px; width: 46%; height: 9px; border-radius: 50% 40% 60% 30%; background: none; border-bottom: 2px solid #1d3a8a; transform: rotate(-4deg); }
  .firma-tpl-card__thumb--carta::after { left: 8px; top: 17px; width: 40%; height: 3px; background: var(--sw-text); box-shadow: 0 5px 0 var(--sw-text-subtle); }
  .firma-tpl-card__thumb--firmada-foto::before { left: 6px; top: 5px; width: 17px; height: 17px; border-radius: 50%; background: var(--sw-brand-500); }
  .firma-tpl-card__thumb--firmada-foto::after { left: 29px; top: 4px; width: 40%; height: 8px; border-radius: 50% 40% 60% 30%; background: none; border-bottom: 2px solid #1d3a8a; box-shadow: 0 9px 0 -2px var(--sw-text); transform: rotate(-3deg); }
  .firma-tpl-card__thumb--firmada-moderna::before { left: 6px; top: 4px; width: 32%; height: 8px; border-radius: 50% 40% 60% 30%; background: none; border-bottom: 2px solid #1d3a8a; box-shadow: 0 9px 0 -2px var(--sw-text); }
  .firma-tpl-card__thumb--firmada-moderna::after { left: 52%; top: 4px; width: 2px; height: 20px; background: var(--sw-brand-500); box-shadow: 6px 4px 0 0 var(--sw-text-subtle), 14px 4px 0 0 var(--sw-text-subtle), 22px 4px 0 0 var(--sw-text-subtle); }

  /* ── Firma a mano ── */
  .firma-rub-intro { margin: 0 0 10px; font-size: 13.5px; line-height: 1.5; color: var(--sw-text-muted); }
  .firma-rub-tabs { display: flex; gap: 4px; padding: 3px; margin-bottom: 10px; border-radius: var(--sw-radius-md); background: var(--sw-bg-muted); }
  .firma-rub-tab {
    flex: 1 1 0; display: inline-flex; align-items: center; justify-content: center; gap: 5px;
    padding: 6px 4px; border: 0; border-radius: calc(var(--sw-radius-md) - 2px); background: transparent;
    font: 600 13px/1.2 var(--sw-font-sans); color: var(--sw-text-muted); cursor: pointer;
  }
  .firma-rub-tab.is-active { background: var(--sw-bg); color: var(--sw-text); box-shadow: 0 1px 2px rgba(0,0,0,.08); }
  .firma-rub-panel[hidden] { display: none; }
  .firma-pad {
    position: relative; height: 150px; border-radius: var(--sw-radius-md);
    border: 1.5px dashed var(--sw-border-strong); background:
      linear-gradient(transparent calc(100% - 38px), var(--sw-border) calc(100% - 38px), var(--sw-border) calc(100% - 37px), transparent calc(100% - 37px)),
      #ffffff;
    overflow: hidden;
  }
  .firma-pad canvas { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; cursor: crosshair; }
  .firma-pad__prev { position: absolute; left: 50%; top: 46%; transform: translate(-50%, -50%); max-width: 82%; max-height: 74%; pointer-events: none; }
  .firma-pad__tag {
    position: absolute; left: 8px; bottom: 6px; padding: 1px 7px; border-radius: 99px; pointer-events: none;
    font-size: 11.5px; font-weight: 600; color: #4b5563; background: rgba(243,244,246,.92);
  }
  .firma-pad__hint { position: absolute; left: 0; right: 0; bottom: 12px; text-align: center; font-size: 13px; color: #9ca3af; pointer-events: none; }
  .firma-pad__tag[hidden], .firma-pad__hint[hidden], .firma-pad__prev[hidden] { display: none; }
  .firma-pad__tools { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin: 8px 0 10px; }
  .firma-pad__grosor { display: inline-flex; align-items: center; gap: 6px; margin-left: auto; font-size: 13px; color: var(--sw-text-muted); }
  .firma-pad__grosor input { width: 90px; }
  .firma-pad__grosor[hidden] { display: none; }
  .firma-rub-fonts { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px; margin-bottom: 10px; }
  .firma-rub-font {
    display: flex; flex-direction: column; align-items: center; gap: 0; padding: 6px 6px 5px;
    border: 2px solid var(--sw-border); border-radius: var(--sw-radius-md); background: #fff; cursor: pointer; overflow: hidden;
  }
  .firma-rub-font.is-active { border-color: var(--sw-brand-500); box-shadow: var(--sw-shadow-focus); }
  .firma-rub-font__demo { font-size: 27px; line-height: 1.25; color: #1d3a8a; white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
  .firma-rub-font__name { font-size: 11.5px; color: var(--sw-text-muted); }
  .firma-rub-note { display: block; margin: 6px 0 0; font-size: 12.5px; line-height: 1.45; color: var(--sw-text-muted); }
  .firma-rub-aviso {
    display: flex; gap: 7px; align-items: flex-start; margin: 10px 0 4px; padding: 8px 10px; border-radius: var(--sw-radius-md);
    font-size: 13px; line-height: 1.45; color: var(--sw-text); background: color-mix(in srgb, var(--sw-warning-500) 12%, var(--sw-bg));
    border: 1px solid color-mix(in srgb, var(--sw-warning-500) 35%, transparent);
  }
  .firma-rub-aviso svg { flex: 0 0 auto; margin-top: 2px; color: var(--sw-warning-600); }
  .firma-rub-colors { display: flex; gap: 6px; flex-wrap: wrap; }
  .firma-rub-color {
    display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px 4px 6px; border-radius: 99px;
    border: 1.5px solid var(--sw-border); background: var(--sw-bg); font: 600 13px/1.3 var(--sw-font-sans); color: var(--sw-text); cursor: pointer;
  }
  .firma-rub-color::before { content: ''; width: 14px; height: 14px; border-radius: 50%; background: var(--c); }
  .firma-rub-color.is-active { border-color: var(--sw-brand-500); box-shadow: var(--sw-shadow-focus); }
  .firma-rub-out { margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--sw-border); }
  .firma-rub-mas { display: inline-flex; align-items: center; gap: 4px; margin-top: 4px; font-size: 13px; color: var(--sw-text-muted); text-decoration: none; }
  .firma-rub-mas:hover { color: var(--sw-brand-600); text-decoration: underline; }

  /* ── Galería de banners: miniaturas grandes, por temas y sin barra propia (el panel ya baja por dentro) ── */
  .firma-gal { display: flex; flex-direction: column; gap: 12px; margin: 2px 0 4px; }
  .firma-gal__tema { margin: 0 0 6px; font: 700 11.5px/1.3 var(--sw-font-sans); letter-spacing: .5px; text-transform: uppercase; color: var(--sw-text-muted); }
  .firma-gal__tema small { margin-left: 4px; font-size: 11.5px; font-weight: 500; letter-spacing: 0; text-transform: none; }
  .firma-gal__grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 8px; }
  .firma-gal__item {
    position: relative; display: flex; flex-direction: column; gap: 4px; min-width: 0;
    padding: 0; border: 0; background: none; cursor: pointer; text-align: left;
    font: 600 12.5px/1.3 var(--sw-font-sans); color: var(--sw-text-muted);
  }
  .firma-gal__pic {
    display: block; aspect-ratio: 5 / 1; overflow: hidden; border-radius: 8px;
    border: 2px solid var(--sw-border); background: var(--sw-bg-muted);
    transition: border-color var(--sw-dur-fast), box-shadow var(--sw-dur-fast);
  }
  .firma-gal__pic img { display: block; width: 100%; height: 100%; object-fit: cover; }
  .firma-gal__name { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
  .firma-gal__item:hover .firma-gal__pic { border-color: var(--sw-brand-500); }
  .firma-gal__item:hover { color: var(--sw-text); }
  .firma-gal__item:focus-visible { outline: none; }
  .firma-gal__item:focus-visible .firma-gal__pic { box-shadow: var(--sw-shadow-focus); }
  .firma-gal__item.is-active .firma-gal__pic { border-color: var(--sw-brand-500); box-shadow: 0 0 0 3px rgba(244,63,94,.25); }
  .firma-gal__item.is-active .firma-gal__name { color: var(--sw-brand-600); }
  .firma-gal__item.is-active::after {
    content: '✓'; position: absolute; top: 6px; right: 6px; width: 20px; height: 20px; border-radius: 50%;
    background: var(--sw-brand-500); color: #fff; font: 700 12px/20px var(--sw-font-sans); text-align: center;
    box-shadow: 0 1px 3px rgba(0,0,0,.3);
  }
  .firma-gal__none {
    align-self: flex-start; display: inline-flex; align-items: center; gap: 6px;
    padding: 5px 12px; border: 2px solid var(--sw-border); border-radius: 99px; background: var(--sw-bg);
    font: 600 12.5px/1.3 var(--sw-font-sans); color: var(--sw-text-muted); cursor: pointer;
  }
  .firma-gal__none:hover { border-color: var(--sw-brand-500); color: var(--sw-text); }
  .firma-gal__none.is-active { border-color: var(--sw-brand-500); background: var(--sw-brand-50); color: var(--sw-brand-600); }
  .firma-gal__nota { display: block; margin-top: 6px; font-size: 12.5px; line-height: 1.45; color: var(--sw-text-muted); }

  /* ── Franja de plantillas encima de la vista previa ── */
  .firma-tplbar {
    flex: 0 0 auto; display: flex; align-items: center; gap: 6px; min-width: 0;
    margin: 0 0 10px; padding: 6px; background: var(--sw-bg-subtle);
    border: 1px solid var(--sw-border); border-radius: var(--sw-radius-lg);
  }
  .firma-tplbar__label {
    flex: 0 0 auto; display: inline-flex; align-items: center; gap: 5px; padding: 0 2px 0 6px;
    font: 700 12.5px/1 var(--sw-font-sans); color: var(--sw-text-muted);
  }
  .firma-tplbar__scroller {
    /* width:0 + flex-grow: su ancho «mínimo» es 0 y no ensancha la columna (en móvil la rejilla es de 1fr) */
    position: relative; flex: 1 1 0; width: 0; min-width: 0; display: flex; gap: 6px; padding: 2px;
    overflow-x: auto; overscroll-behavior-x: contain; scroll-behavior: smooth; scroll-snap-type: x proximity;
    scrollbar-width: none;
    -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 var(--fl, 0px), #000 calc(100% - var(--fr, 0px)), transparent 100%);
            mask-image: linear-gradient(90deg, transparent 0, #000 var(--fl, 0px), #000 calc(100% - var(--fr, 0px)), transparent 100%);
  }
  .firma-tplbar__scroller::-webkit-scrollbar { display: none; }
  .firma-tplchip {
    flex: 0 0 auto; min-width: 84px; scroll-snap-align: start;
    display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 5px 8px 4px;
    border: 2px solid var(--sw-border); border-radius: var(--sw-radius-md); background: var(--sw-bg);
    font: 600 11.5px/1.2 var(--sw-font-sans); white-space: nowrap; color: var(--sw-text-muted); cursor: pointer;
    transition: border-color var(--sw-dur-fast), background var(--sw-dur-fast), color var(--sw-dur-fast);
  }
  .firma-tplchip .firma-tpl-card__thumb { width: 72px; height: 24px; margin: 0; pointer-events: none; }
  .firma-tplchip__name { white-space: nowrap; }
  .firma-tplchip:hover { border-color: var(--sw-brand-500); color: var(--sw-text); }
  .firma-tplchip:focus-visible { outline: none; border-color: var(--sw-brand-500); box-shadow: var(--sw-shadow-focus); }
  .firma-tplchip.is-active { border-color: var(--sw-brand-500); background: rgba(244,63,94,.08); color: var(--sw-text); font-weight: 700; }
  .firma-tplbar__arrow {
    flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center;
    width: 30px; height: 30px; padding: 0; border: 1px solid var(--sw-border); border-radius: 50%;
    background: var(--sw-bg); color: var(--sw-text); cursor: pointer;
  }
  .firma-tplbar__arrow--prev svg { transform: rotate(180deg); }
  .firma-tplbar__arrow:hover:not(:disabled) { border-color: var(--sw-brand-500); color: var(--sw-brand-600); }
  .firma-tplbar__arrow:disabled { opacity: .35; cursor: default; }
  .firma-tplbar.is-fits .firma-tplbar__arrow { display: none; }
  .firma-tplbar__otra { flex: 0 0 auto; }
  @media (max-width: 1180px) { .firma-tplbar__label { display: none; } }
  @media (max-width: 640px) {
    .firma-tplbar { margin-bottom: 8px; }
    .firma-tplbar__arrow { display: none; }
    .firma-tplbar__otra span { display: none; }
    .firma-tplchip { min-height: 52px; }
  }

  /* Miniaturas de plantilla con la imagen de banner de verdad (la elige el JS) */
  .firma-tpl-card__thumb--promo::after { height: 11px; background: var(--firma-banner-thumb, linear-gradient(90deg, var(--sw-brand-500), #a855f7)) center / cover no-repeat; }
  .firma-tpl-card__thumb--banner::before { height: 11px; background: var(--firma-cab-thumb, var(--sw-brand-500)) center / cover no-repeat; }

  /* Vista «Oscuro»: imita a Gmail y Outlook en modo oscuro, que invierten el texto
     pero NO las imágenes. Así se ve de verdad si la tinta o el logo se pierden. */
  .firma-preview--dark #firmaPreviewSlot > table { filter: invert(1) hue-rotate(180deg); }
  .firma-preview--dark #firmaPreviewSlot > table img,
  .firma-preview--dark #firmaPreviewSlot > table [background],
  .firma-preview--dark #firmaPreviewSlot > table [style*="url("] { filter: invert(1) hue-rotate(180deg); }
  /* Vista «Outlook»: Outlook de escritorio no pinta imágenes de fondo ni degradados;
     se queda con el color de respaldo (bgcolor). Así se ve qué le llega. */
  .firma-preview--outlook #firmaPreviewSlot [style*="background-image"] { background-image: none !important; }
  /* Tarjetas con forma de fondo: la celda ya se re-invierte entera; la foto de dentro, no otra vez. */
  .firma-preview--dark #firmaPreviewSlot > table [style*="url("] img { filter: none; }
  /* «Bloques» lleva las esquinas en transparente: se comporta como el resto del texto. */
  .firma-preview--dark #firmaPreviewSlot > table [style*="forma=bloques"] { filter: none; }
  .firma-preview--dark #firmaPreviewSlot > table [style*="forma=bloques"] img { filter: invert(1) hue-rotate(180deg); }
  /* ── Pack de idiomas ── */
  .firma-lang-tabs { display: inline-flex; gap: 2px; padding: 3px; border-radius: var(--sw-radius-md); background: var(--sw-bg-muted); }
  .firma-lang-tab { border: 0; background: transparent; padding: 4px 8px; border-radius: calc(var(--sw-radius-md) - 2px); font: 700 12.5px/1.2 var(--sw-font-sans); letter-spacing: .4px; color: var(--sw-text-muted); cursor: pointer; }
  .firma-lang-tab.is-active { background: var(--sw-bg); color: var(--sw-text); box-shadow: 0 1px 2px rgba(0,0,0,.08); }
  .firma-credito { display: flex; align-items: flex-start; gap: 8px; margin: 8px 0 0; font-size: 13px; line-height: 1.4; color: var(--sw-text-muted); cursor: pointer; }
  .firma-credito input { flex: 0 0 auto; width: 16px; height: 16px; margin: 1px 0 0; accent-color: var(--sw-brand-500); cursor: pointer; }
  .firma-credito small { color: var(--sw-text-subtle); font-size: 12px; }
  @media (pointer: coarse) { .firma-credito { min-height: 44px; align-items: center; } .firma-credito input { width: 20px; height: 20px; margin: 0; } }
  .firma-pack { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; margin-top: 10px; }
  .firma-pack__label { width: 100%; font-size: 12px; font-weight: 700; letter-spacing: .3px; text-transform: uppercase; color: var(--sw-text-muted); }
  .firma-pack__btn { flex: 1 1 0; padding: 5px 6px; border: 1px solid var(--sw-border); border-radius: var(--sw-radius-md); background: var(--sw-bg); font: 600 13px/1.2 var(--sw-font-sans); color: var(--sw-text); cursor: pointer; white-space: nowrap; }
  .firma-pack__btn:hover { border-color: var(--sw-brand-500); color: var(--sw-brand-600); }
  .firma-pack__nota { width: 100%; font-size: 12px; line-height: 1.4; color: var(--sw-text-subtle); }
  .firma-mini { margin: 2px 0 10px; border: 1px solid var(--sw-border); border-radius: var(--sw-radius-md); }
  .firma-mini > summary { display: flex; align-items: center; gap: 6px; padding: 7px 10px; cursor: pointer; list-style: none; font-size: 13.5px; font-weight: 600; color: var(--sw-text-muted); }
  .firma-mini > summary::-webkit-details-marker { display: none; }
  .firma-mini[open] > summary { color: var(--sw-text); border-bottom: 1px solid var(--sw-border); }
  .firma-mini__body { padding: 10px; }
  .firma-mini__body small { display: block; margin: 0 0 8px; font-size: 12.5px; color: var(--sw-text-muted); }
  .firma-row3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
  @media (max-width: 640px) { .firma-row3 { grid-template-columns: 1fr; } }
  .firma-center__head { flex-wrap: wrap; gap: 8px; }

  /* ══════════ 23-10-2026 · vista previa sin correo simulado y plantillas de tarjeta ══════════ */
  /* La firma empieza arriba: sin saludo de ejemplo y con una cabecera de una línea, discreta. */
  .firma-preview .firma-preview__email-header { padding: 6px 14px; font-size: 12px; line-height: 1.4; }
  .firma-preview .firma-preview__email-header strong { font-weight: 600; }
  .firma-preview .firma-preview__email-body { padding: 18px 20px 20px; min-height: 0; }
  .firma-center__stage { justify-content: flex-start; }
  @media (max-width: 640px) { .firma-preview .firma-preview__email-body { padding: 12px 12px 14px; } }
  /* Las tarjetas anchas se encogen para caber (como hacen Gmail y Apple Mail en el móvil). */
  #firmaPreviewSlot { overflow: hidden; }
  .firma-grid > .firma-center { min-width: 0; }   /* si no, la tarjeta de 560 px ensancha la columna en el móvil */
  /* Plantillas retiradas de la colección: fuera de la franja y la rejilla (salvo la elegida). */
  .firma-tpl-card[hidden], .firma-tplchip[hidden] { display: none !important; }

  /* Miniaturas de las plantillas de tarjeta (--firma-marca = color de marca elegido) */
  .tool-firma-root { --fm: var(--firma-marca, #4338ca); --fn: color-mix(in srgb, var(--fm) 16%, #0a0f1c); --ft: color-mix(in srgb, var(--fm) 20%, #0b0f17); }
  .firma-tpl-card__thumb--diagonal { background: linear-gradient(108deg, var(--ft) 0 30%, #fff 30% 32%, var(--fm) 32% 38%, #fff 38%); }
  .firma-tpl-card__thumb--diagonal::before { left: 7%; top: 50%; width: 14px; height: 14px; margin-top: -9px; border-radius: 50%; background: #cbd5e1; border: 2px solid #fff; }
  .firma-tpl-card__thumb--diagonal::after { left: 46%; top: 6px; width: 34%; height: 4px; background: #111827; box-shadow: 0 6px 0 -1px var(--fm), 0 11px 0 -1px #9ca3af, 0 15px 0 -1px #9ca3af; }
  .firma-tpl-card__thumb--noche { background: var(--fn); }
  .firma-tpl-card__thumb--noche::before { left: 7%; top: 50%; width: 13px; height: 13px; margin-top: -9px; border-radius: 50%; background: #94a3b8; border: 2px solid var(--fm); border-left-color: transparent; }
  .firma-tpl-card__thumb--noche::after { left: 34%; top: 6px; width: 38%; height: 4px; background: #fff; box-shadow: 0 6px 0 -1px var(--fm), 0 11px 0 -1px #64748b, 40px -3px 0 -1px var(--fm); }
  .firma-tpl-card__thumb--curva { background: radial-gradient(ellipse 58% 120% at 100% 50%, var(--fm) 0 74%, var(--ft) 74% 86%, #fff 86%); }
  .firma-tpl-card__thumb--curva::before { right: 9%; top: 50%; width: 13px; height: 13px; margin-top: -8px; border-radius: 50%; background: #cbd5e1; border: 2px solid #fff; }
  .firma-tpl-card__thumb--curva::after { left: 8px; top: 6px; width: 36%; height: 4px; background: #111827; box-shadow: 0 6px 0 -1px var(--ft), 0 11px 0 -1px #9ca3af, 0 15px 0 -1px #9ca3af; }
  .firma-tpl-card__thumb--saliente { background: linear-gradient(var(--fm) 0 45%, #fff 45%); }
  .firma-tpl-card__thumb--saliente::before { left: 8%; top: 50%; width: 14px; height: 14px; margin-top: -9px; border-radius: 50%; background: #cbd5e1; border: 2px solid #fff; }
  .firma-tpl-card__thumb--saliente::after { left: 36%; top: 15px; width: 36%; height: 3px; background: #111827; box-shadow: 0 5px 0 -1px #9ca3af, 30px -10px 0 -1px rgba(255,255,255,.8); }
  .firma-tpl-card__thumb--marco::before { left: 8px; top: 50%; width: 14px; height: 14px; margin-top: -10px; border-radius: 50%; background: #cbd5e1; border: 3px solid var(--fm); }
  .firma-tpl-card__thumb--marco::after { left: 34px; top: 5px; width: 2px; height: 18px; background: var(--fm); box-shadow: 8px 1px 0 0 #111827, 30px 1px 0 0 #111827, 8px 7px 0 0 var(--fm), 20px 12px 0 0 #9ca3af; }
  .firma-tpl-card__thumb--pastel { background: radial-gradient(circle at 92% 0%, color-mix(in srgb, var(--fm) 45%, #fff) 0 35%, transparent 60%), radial-gradient(circle at 60% 110%, color-mix(in srgb, var(--fm) 25%, #fbcfe8) 0 30%, transparent 55%), color-mix(in srgb, var(--fm) 10%, #fff); }
  .firma-tpl-card__thumb--pastel::before { left: 8%; top: 50%; width: 14px; height: 14px; margin-top: -9px; border-radius: 50%; background: #cbd5e1; border: 2px solid #fff; }
  .firma-tpl-card__thumb--pastel::after { left: 36%; top: 7px; width: 36%; height: 4px; background: #111827; box-shadow: 0 6px 0 -1px var(--fm), 0 11px 0 -1px #9ca3af; }
  .firma-tpl-card__thumb--antracita { background: color-mix(in srgb, var(--fm) 7%, #1b1e23); border-top: 2px solid var(--fm); }
  .firma-tpl-card__thumb--antracita::before { left: 7%; top: 50%; width: 15px; height: 17px; margin-top: -10px; border-radius: 0; background: var(--fm); clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%); }
  .firma-tpl-card__thumb--antracita::after { left: 34%; top: 5px; width: 34%; height: 4px; background: #fff; box-shadow: 0 6px 0 -1px #64748b, 0 11px 0 -1px var(--fm); }
  .firma-tpl-card__thumb--bloques { background: linear-gradient(135deg, var(--fm) 0 9%, transparent 9% 12%, var(--ft) 12% 15%, transparent 15%), linear-gradient(315deg, var(--ft) 0 9%, transparent 9% 12%, var(--fm) 12% 15%, transparent 15%), #fff; }
  .firma-tpl-card__thumb--bloques::before { left: 16%; top: 50%; width: 13px; height: 13px; margin-top: -9px; border-radius: 50%; background: #cbd5e1; border: 2px solid var(--fm); }
  .firma-tpl-card__thumb--bloques::after { left: 40%; top: 7px; width: 34%; height: 4px; background: #111827; box-shadow: 0 6px 0 -1px var(--fm), 0 11px 0 -1px #9ca3af; }
  .firma-tpl-card__thumb--botones::before { left: 8px; top: 4px; width: 40%; height: 4px; background: #111827; box-shadow: 0 6px 0 -1px #9ca3af; }
  .firma-tpl-card__thumb--botones::after { left: 8px; bottom: 4px; width: 46%; height: 8px; border-radius: 6px; background: linear-gradient(90deg, var(--fm) 0 48%, transparent 48% 54%, color-mix(in srgb, var(--fm) 30%, transparent) 54%); }
  .firma-tpl-card__thumb--confianza::before { content: "★★★★★"; left: 8px; bottom: 3px; width: auto; height: auto; background: none; color: #f5a524; font: 8px/1 sans-serif; letter-spacing: 1px; }
  .firma-tpl-card__thumb--confianza::after { left: 8px; top: 5px; width: 40%; height: 4px; background: #111827; box-shadow: 0 6px 0 -1px var(--fm), 62px 9px 0 1px color-mix(in srgb, var(--fm) 40%, transparent); }
  .firma-tpl-card__thumb--manuscrita::before { left: 8px; top: 2px; width: 56%; height: 12px; border-radius: 50% 40% 60% 30%; background: none; border-bottom: 2px solid #1d3a8a; transform: rotate(-5deg); }
  .firma-tpl-card__thumb--manuscrita::after { left: 8px; top: 18px; width: 34%; height: 2px; background: var(--fm); box-shadow: 0 4px 0 0 #9ca3af; }

  /* ══════════ 06-11-2026 · PORTÁTIL: de 981 a 1599 px de ancho, o escritorio bajo (≤ 820 px de alto) ══════════
     Joan lo probó en un portátil y no se podía usar. Causa: las 3 columnas fijas (520 + 440 px) y el alto
     de una pantalla exacta. Entre 1181 y 1599 px la vista previa se quedaba en 170-460 px y la firma salía
     encogida al 23-75 %; entre 981 y 1180 la columna de salida medía 0 px (el botón «Copiar» no se veía);
     y con poco alto el bloque de código se aplastaba a 28 px y «Cómo instalarla» se montaba encima.
     Arreglo: aquí la página vuelve a correr. El editor (y la vista previa con 3 columnas) se quedan
     pegados arriba con su propio scroll; la salida va con la página y nada tiene alto fijo.
     Por encima de 1600 px de ancho y 820 de alto todo sigue exactamente igual que antes. */
  @media (min-width: 981px) and (max-width: 1599px), (min-width: 981px) and (max-height: 820px) {
    /* Con overflow-x:hidden en html y body (app.css) nada se queda pegado a la ventana; «clip» recorta
       igual sin crear un contenedor de scroll. Solo en esta página y en este tramo de tamaños. */
    html:has(.tool-firma-root), body:has(.tool-firma-root) { overflow-x: clip; }
    .sw-tool-shell:has(.tool-firma-root) { height: auto; min-height: calc(100dvh - var(--sw-header-h)); }
    .sw-tool-shell:has(.tool-firma-root) > .sw-tool-shell__body { flex: 1 0 auto; }
    .sw-tool-shell__body > .tool-firma-root,
    .tool-firma-wrap { height: auto; }
    .tool-firma-wrap > .firma-grid { flex: 0 0 auto; }
    .firma-grid { height: auto; align-items: start; }
    .firma-grid > .firma-side,
    .firma-grid > .firma-center {
      position: sticky; top: calc(var(--sw-header-h) + 12px);
      height: auto; max-height: calc(100dvh - var(--sw-header-h) - 24px);
    }
    .firma-grid > .firma-side { overflow-y: auto; overscroll-behavior: auto; }
    .firma-grid > .firma-center .firma-center__stage { overflow-y: auto; }
    .firma-grid > .firma-output { height: auto; max-height: none; overflow: visible; }
    .firma-block--guides[open] { min-height: 0; overflow: visible; }
    .firma-block--guides::details-content { display: block; }
    .firma-code { max-height: 240px; }
    .firma-guide { max-height: 340px; overflow-y: auto; }
    .firma-block--code .firma-output__head { flex-wrap: wrap; gap: 8px; }
    /* Con la página corriendo, «Cómo instalarla» se puede plegar (como en tableta). */
    .firma-guides__summary { cursor: pointer; }
    .firma-guides__summary:hover .firma-block__title { color: var(--sw-brand-600); }
    .firma-guides__chev { display: inline-flex; }
  }
  /* Barrido 06-11-2026 · que la vista previa se vea al entrar en el portátil. La barra de arriba ocupaba
     dos filas (la pista del progreso repetía el aviso rosa del ejemplo y empujaba los botones abajo): ahora
     es una sola fila, y el aviso del ejemplo, más bajo. Se ganan ~70 px para la firma. */
  @media (min-width: 981px) and (max-width: 1599px), (min-width: 981px) and (max-height: 900px) {
    .firma-bar { flex-wrap: nowrap; gap: 12px; padding: 6px 12px; }
    .firma-bar__center { flex: 1 1 140px; }
    .firma-progress { grid-template-columns: minmax(60px, 140px) minmax(0, 1fr); gap: 10px; }
    .firma-progress__hint { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .tool-firma-wrap:has(.firma-ejemplo:not([hidden])) .firma-progress__hint { display: none; }
    .firma-bar__right { flex-wrap: nowrap; gap: 6px; }
    .firma-topbar { flex-wrap: nowrap; gap: 8px; }
    .firma-topbar__group { flex-wrap: nowrap; }
    .firma-topbar__name { width: 170px; }
    .firma-ejemplo { padding: 4px 6px 4px 12px; margin-bottom: 8px; }
    .firma-ejemplo__txt { font-size: 13.5px; }
    .firma-progress__pct { white-space: nowrap; }
    /* Título, modos y idiomas de la vista previa en una sola fila (antes los idiomas bajaban a otra). */
    .firma-center__head { flex-wrap: nowrap; gap: 8px; }
    .firma-center__head h2 { white-space: nowrap; }
    .firma-preview-tab svg { display: none; }
    .firma-preview-tab { padding: 5px 8px; white-space: nowrap; }
  }
  /* Tableta y portátil con zoom (641-980 px): la pista del progreso repite el aviso del ejemplo; fuera. */
  @media (min-width: 641px) and (max-width: 980px) {
    .tool-firma-wrap:has(.firma-ejemplo:not([hidden])) .firma-progress__hint { display: none; }
    .firma-progress__pct { white-space: nowrap; }
    .firma-bar { padding: 6px 12px; gap: 10px; }
    .firma-ejemplo { padding: 4px 6px 4px 12px; margin-bottom: 8px; }
    .firma-ejemplo__txt { font-size: 13.5px; }
  }
  @media (min-width: 981px) and (max-width: 1440px) {
    /* «Borrador guardado» queda en el icono (el texto sale al pasar el ratón y lo lee el lector de pantalla). */
    .firma-autosave { font-size: 0; gap: 0; }
    .firma-autosave svg { width: 16px; height: 16px; }
    .firma-topbar__label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; }
  }
  @media (min-width: 981px) and (max-width: 1199px) {
    .firma-topbar__name { width: 130px; }
    .firma-bar__right .sw-btn { padding-left: 10px; padding-right: 10px; }
  }
  /* 1200-1599 px: 3 columnas proporcionadas. La vista previa se queda con unos 540-720 px, lo justo
     para que la firma (560 px) salga a su tamaño o casi. */
  @media (min-width: 1200px) and (max-width: 1599px) {
    .tool-firma-wrap { padding: 10px 20px; }
    .firma-grid {
      grid-template-columns: minmax(320px, 28%) minmax(0, 1fr) minmax(280px, 24%);
      gap: 14px;
    }
    .firma-tplbar__label { display: none; }
    .firma-pack__btn { flex: 1 1 calc(50% - 5px); }
  }
  /* 981-1199 px (portátil con zoom al 125 %, tableta apaisada): 2 columnas. Editor a la izquierda,
     pegado arriba; a la derecha la vista previa y, debajo, copiar, código e instrucciones. */
  @media (min-width: 981px) and (max-width: 1199px) {
    .tool-firma-wrap { padding: 10px 20px; }
    .firma-grid {
      grid-template-columns: minmax(320px, 380px) minmax(0, 1fr);
      grid-template-rows: auto auto;
      gap: 14px;
    }
    .firma-grid > .firma-side   { grid-column: 1; grid-row: 1 / span 2; }
    .firma-grid > .firma-center { grid-column: 2; grid-row: 1; position: static; max-height: none; }
    .firma-grid > .firma-output { grid-column: 2; grid-row: 2; }
  }

  /* Barrido 06-11-2026 · tocables de 44 px en el móvil y en pantallas táctiles: modos e idiomas de la
     vista previa, colores de la firma a mano, plegables, la ayuda «?» y las casillas. */
  @media (pointer: coarse), (max-width: 768px) {
    .firma-preview-tab, .firma-lang-tab, .firma-output-tab { min-height: 44px; }
    .firma-lang-tab { min-width: 44px; }
    .firma-rub-color { min-height: 44px; }
    .firma-mini > summary { min-height: 44px; }
    .firma-tip-btn { width: 44px; height: 44px; }
    .firma-rub-mas { min-height: 44px; }
    .firma-toggle { min-height: 44px; align-items: center; }
    .firma-section__head, .firma-guides__summary, .firma-pack__btn, .firma-gal__none { min-height: 44px; }
    .firma-tplbar__arrow { min-width: 44px; min-height: 44px; }
    .firma-rub-tab { min-height: 44px; }
    /* Enlaces dentro de una frase («Carta firmada», «Firmada con foto»…): zona de toque más alta sin mover el texto. */
    .firma-linkbtn { padding-top: 12px; padding-bottom: 12px; margin-top: -12px; margin-bottom: -12px; }
  }
  /* ══════════ Pantalla 06-11-2026 (grupo A) ══════════
     · 981-1199 px (tableta apaisada, portátil con zoom): «0% completada» se montaba encima de «vCard».
       vCard y Vaciar se quedan en su icono (el nombre sale al pasar el ratón y lo lee el lector de pantalla).
     · Móvil: la barra de arriba y el aviso del ejemplo ocupaban toda la primera pantalla y la firma no se
       veía al entrar. Ahora: progreso en una línea (sin la pista, que repite el aviso), «Mis firmas» con
       vCard, Vaciar y Cómo usar en iconos en la misma fila, y el aviso del ejemplo en dos líneas con su botón. */
  @media (min-width: 981px) and (max-width: 1199px) {
    #firmaVcardBtn, #firmaResetBtn { font-size: 0; gap: 0; padding-left: 9px; padding-right: 9px; }
    #firmaVcardBtn svg, #firmaResetBtn svg { width: 16px; height: 16px; }
    .firma-bar__center { flex: 1 1 180px; min-width: 150px; }
    .firma-progress { grid-template-columns: minmax(30px, 1fr) auto; }
  }
  @media (max-width: 640px) {
    .firma-bar { row-gap: 6px; }
    .firma-progress { grid-template-columns: minmax(40px, 1fr) auto; align-items: center; gap: 10px; }
    .firma-progress__pct { font-size: 13px; white-space: nowrap; }
    .tool-firma-wrap:has(.firma-ejemplo:not([hidden])) .firma-progress__hint { display: none; }
    .firma-topbar__label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; }
    /* «Mis firmas» y los tres botones en una fila; nombre y Guardar en la siguiente. */
    .firma-bar__left.firma-topbar { display: contents; }
    .firma-topbar__group:first-child { flex: 1 1 0; min-width: 0; order: 1; }
    .firma-bar__right { order: 2; width: auto; flex: 0 0 auto; flex-wrap: nowrap; gap: 4px; }
    .firma-topbar__group:nth-child(2) { order: 3; flex: 1 1 100%; flex-wrap: nowrap; }
    .firma-bar__right .sw-btn { font-size: 0; gap: 0; min-width: 44px; padding: 0 10px; justify-content: center; }
    .firma-bar__right .sw-btn svg { width: 18px; height: 18px; }
    .firma-bar__right .firma-autosave { display: none; }
    .firma-ejemplo { padding: 6px 8px 6px 10px; gap: 6px 8px; margin-bottom: 6px; }
    .firma-ejemplo__ico { display: none; }
    .firma-ejemplo__txt { font-size: 13px; line-height: 1.35; }
    .firma-ejemplo__btn { width: auto; flex: 1 1 auto; min-height: 44px; }
  }
  @media (max-width: 640px) {
    /* La firma, lo primero: debajo, la tira de plantillas y luego modos e idiomas (en una fila que se
       desliza de lado). El título «Vista previa» sobra: la firma se ve. */
    .tool-firma-wrap:has(#firmaMStepCreate:checked) .firma-grid > .firma-center { display: flex; flex-direction: column; gap: 8px; }
    .firma-center__stage { order: 1; }
    .firma-tplbar { order: 2; margin: 0; }
    .firma-center__head { order: 3; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: 0; }
    .firma-center__head::-webkit-scrollbar { display: none; }
    .firma-center__head h2 { display: none; }
    .firma-center__head .firma-preview-tabs, .firma-center__head .firma-lang-tabs { flex: 0 0 auto; overflow: visible; }
  }
  /* Móvil en horizontal (641-980 de ancho y poco alto): la barra de arriba en una sola fila. */
  @media (min-width: 641px) and (max-width: 980px) and (max-height: 500px) {
    .firma-bar { flex-wrap: nowrap; gap: 8px; padding: 6px 8px; }
    .firma-topbar__label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; }
    .firma-topbar, .firma-topbar__group { flex-wrap: nowrap; }
    .firma-topbar__sel { max-width: 160px; }
    .firma-topbar__name { width: 130px; min-width: 0; }
    .firma-bar__center { flex: 1 1 90px; min-width: 70px; }
    .firma-progress { grid-template-columns: 1fr; gap: 2px; }
    .firma-progress__hint { display: none; }
    .firma-progress__pct { font-size: 12.5px; white-space: nowrap; }
    .firma-bar__right { flex-wrap: nowrap; gap: 4px; margin-left: 0; }
    .firma-bar__right .sw-btn { font-size: 0; gap: 0; min-width: 44px; padding: 0 10px; justify-content: center; }
    .firma-bar__right .sw-btn svg { width: 18px; height: 18px; }
    .firma-bar__right .firma-autosave { display: none; }
    .firma-ejemplo__ico { display: none; }
    .firma-ejemplo__txt { font-size: 12.5px; line-height: 1.3; }
    /* También aquí la firma va primero; plantillas, modos e idiomas debajo. */
    .firma-grid > .firma-center { display: flex; flex-direction: column; gap: 8px; }
    .firma-center__stage { order: 1; }
    .firma-tplbar { order: 2; margin: 0; }
    .firma-center__head { order: 3; margin: 0; }
    .firma-center__head h2 { display: none; }
  }
  @media (max-width: 640px) {
    /* Sin sesión no hay «Mis firmas»: los tres botones van a lo ancho. */
    .firma-bar:not(:has(.firma-bar__left)) .firma-bar__right { flex: 1 1 100%; justify-content: flex-end; }
  }

  /* En el móvil hay dos barras fijas arriba (cabecera y «Crear / Exportar»): lo que se busca con el
     teclado o con un enlace no queda debajo de ellas. */
  @media (max-width: 640px) {
    html:has(.tool-firma-root) { scroll-padding-top: calc(var(--sw-header-h) + 72px); }
  }
