/* =============================================================
   1. Tokens
   ============================================================= */
:root {
  --fondo: #f6f5f1;
  --papel: #ffffff;
  --tinta: #14213d;
  --suave: #5b6478;
  --linea: #e2e0d9;
  --linea-fuerte: #c9c6bc;
  --acento: #2448d6;
  --acento-osc: #1a36a8;
  --acento-claro: #e8edff;
  --marca: #ffd43b;
  --marca-fondo: rgba(255, 212, 59, 0.28);
  --marca-borde: #e0a800;
  --ok: #18794e;
  --ok-fondo: #e7f6ee;
  --error: #b42318;
  --error-fondo: #fdecea;
  --aviso-fondo: #fff7dc;
  --radio: 14px;
  --sombra: 0 1px 2px rgba(20, 33, 61, .06), 0 8px 24px rgba(20, 33, 61, .06);
  --fuente: "Manrope", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --alto-cab: 60px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --fondo: #10141d; --papel: #182030; --tinta: #e8ebf3; --suave: #a3abbd; --linea: #2a3346; --linea-fuerte: #3a4560;
    --acento: #6d8bff; --acento-osc: #8ea5ff; --acento-claro: #1e2a4d; --aviso-fondo: #2d2714; --ok-fondo: #12301f;
    --error-fondo: #3a1714; --ok: #5fd39a; --error: #ff8a7a;
    --sombra: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .25);
  }
}

/* =============================================================
   2. Base
   ============================================================= */
*, *::before, *::after { box-sizing: border-box; margin: 0; }
html { -webkit-text-size-adjust: 100%; }
body { font-family: var(--fuente); font-size: 16px; line-height: 1.55; color: var(--tinta); background: var(--fondo); -webkit-font-smoothing: antialiased; overflow-x: clip; }
img, svg, canvas { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--acento); }
h1, h2, h3 { line-height: 1.12; letter-spacing: -0.02em; text-wrap: balance; }
p { text-wrap: pretty; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--acento); outline-offset: 2px; border-radius: 6px; }
.visualmente-oculto { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.saltar { position: fixed; top: -100px; left: 1rem; z-index: 99; padding: .6rem 1rem; background: var(--papel); border-radius: 8px; }
.saltar:focus { top: 1rem; }
.contenedor { width: 100%; max-width: 1080px; margin: 0 auto; padding: 0 16px; }

/* =============================================================
   3. Botones y enlaces
   ============================================================= */
.boton { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 40px; padding: 8px 16px; border-radius: 10px; border: 1px solid transparent; font-weight: 700; font-size: 15px; text-decoration: none; transition: background .15s, border-color .15s, transform .15s var(--ease-out); }
.boton:active { transform: translateY(1px); }
.boton:disabled { opacity: .55; cursor: not-allowed; }
.boton-primario { background: var(--acento); color: #fff; }
.boton-primario:hover:not(:disabled) { background: var(--acento-osc); }
.boton-suave { background: var(--papel); border-color: var(--linea-fuerte); color: var(--tinta); font-weight: 600; }
.boton-suave:hover { border-color: var(--acento); color: var(--acento); }
.boton-suave[aria-pressed="true"] { background: var(--acento); border-color: var(--acento); color: #fff; }
.boton-icono { min-width: 36px; min-height: 36px; padding: 4px 8px; background: transparent; border-color: var(--linea-fuerte); font-weight: 700; }
.boton-peligro { background: transparent; border-color: var(--linea-fuerte); color: var(--error); font-weight: 600; }
.boton-peligro:hover { background: var(--error-fondo); border-color: var(--error); }
.boton-grande { width: 100%; min-height: 54px; font-size: 17px; }
.enlace { background: none; border: 0; padding: 0; color: var(--acento); font-weight: 700; text-decoration: underline; text-underline-offset: 3px; }
.enlace-peligro { color: var(--error); font-weight: 600; font-size: 14px; }

/* =============================================================
   4. Cabecera e intro
   ============================================================= */
.cabecera { background: var(--papel); border-bottom: 1px solid var(--linea); }
.cabecera-in { display: flex; align-items: center; justify-content: space-between; height: var(--alto-cab); }
.logo { display: inline-flex; align-items: center; gap: 8px; font-weight: 800; font-size: 19px; color: var(--tinta); text-decoration: none; letter-spacing: -0.02em; }
.nav { display: flex; gap: 18px; }
.nav a { color: var(--suave); text-decoration: none; font-weight: 600; font-size: 15px; }
.nav a:hover { color: var(--acento); }
@media (hover: none) { .zona-nota { display: none; } }
.intro { padding-top: 22px; padding-bottom: 14px; text-align: center; }
.intro h1 { font-size: clamp(28px, 6.4vw, 44px); font-weight: 800; }
.subtitulo { margin: 8px auto 0; max-width: 640px; color: var(--suave); font-size: clamp(15px, 3.8vw, 18px); }
.subtitulo strong { color: var(--tinta); }

/* =============================================================
   5. Herramienta: estados
   ============================================================= */
.herramienta { padding-bottom: 8px; }
.herramienta .estado { display: none; }
.herramienta[data-state="inicio"] .estado-inicio,
.herramienta[data-state="cargando"] .estado-cargando,
.herramienta[data-state="error"] .estado-error,
.herramienta[data-state="trabajo"] .estado-trabajo { display: block; }
.sin-js { max-width: 640px; margin: 0 auto; padding: 18px; background: var(--aviso-fondo); border-radius: var(--radio); text-align: center; }

.zona-soltar { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; min-height: 230px; padding: 28px 16px; background: var(--papel); border: 2px dashed var(--linea-fuerte); border-radius: 18px; cursor: pointer; text-align: center; color: var(--acento); box-shadow: var(--sombra); transition: border-color .2s, background .2s; }
.zona-soltar:hover, .zona-soltar.encima { border-color: var(--acento); background: var(--acento-claro); }
.zona-soltar:focus-within { outline: 3px solid var(--acento); outline-offset: 3px; }
.zona-titulo { font-size: 21px; font-weight: 800; color: var(--tinta); }
.zona-nota { font-size: 13px; color: var(--suave); }
.zona-soltar .boton { min-height: 48px; padding: 10px 28px; font-size: 17px; }
.probar { margin-top: 12px; text-align: center; color: var(--suave); font-size: 15px; }
.sello-privacidad { display: flex; gap: 8px; align-items: flex-start; justify-content: center; max-width: 620px; margin: 12px auto 0; color: var(--ok); font-size: 14px; }
.sello-privacidad svg { flex: none; margin-top: 2px; }
.sello-privacidad span { color: var(--tinta); }
.sello-privacidad strong { color: var(--ok); }

.tarjeta-carga, .tarjeta-error { max-width: 560px; margin: 0 auto; padding: 28px 22px; background: var(--papel); border-radius: 18px; box-shadow: var(--sombra); text-align: center; }
.carga-titulo { font-weight: 800; font-size: 18px; }
.barra { height: 8px; margin: 16px 0 10px; background: var(--linea); border-radius: 99px; overflow: hidden; }
.barra span { display: block; height: 100%; width: 5%; background: var(--acento); border-radius: 99px; transition: width .25s var(--ease-out); }
.carga-nota { color: var(--suave); font-size: 14px; }
.error-titulo { font-weight: 800; font-size: 19px; color: var(--error); margin-bottom: 8px; }
#error-texto { margin-bottom: 18px; }

.limites { margin-top: 10px; color: var(--suave); font-size: 13.5px; text-align: center; }

/* =============================================================
   6. Zona de trabajo: visor + panel
   ============================================================= */
.herramienta[data-state="trabajo"] { padding: 0; }
.trabajo { display: block; max-width: 1440px; margin: 0 auto; }
.visor { position: sticky; top: 0; z-index: 4; background: #e9e8e3; border-bottom: 1px solid var(--linea-fuerte); }
@media (prefers-color-scheme: dark) { .visor { background: #0b0e15; } }
.visor-barra { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 8px 12px; background: var(--papel); border-bottom: 1px solid var(--linea); }
.grupo-botones { display: inline-flex; gap: 6px; align-items: center; }
.visor-barra .boton-suave { min-height: 36px; padding: 6px 11px; font-size: 14px; }
.zoom { margin-left: auto; font-size: 13px; color: var(--suave); }
#zoom-valor { min-width: 46px; text-align: center; font-variant-numeric: tabular-nums; }
.plegar { font-size: 13px; }
.aviso-modo { padding: 8px 12px; background: var(--acento); color: #fff; font-size: 14px; font-weight: 600; text-align: center; }
.aviso-modo .enlace { color: #fff; }
.hojas { height: 42vh; height: 42dvh; overflow: auto; padding: 12px; display: grid; gap: 14px; justify-content: center; align-content: start; overscroll-behavior: contain; }
.visor.plegado .hojas { display: none; }
.hoja { position: relative; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.18), 0 6px 18px rgba(0,0,0,.08); }
.hoja canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.hoja .fondo { background: #fff; }
.hoja .tinta { pointer-events: none; }
.capa-huecos { position: absolute; inset: 0; }
.num-pag { position: absolute; right: 6px; bottom: 6px; padding: 1px 7px; font-size: 11px; color: #555; background: rgba(255,255,255,.85); border-radius: 99px; pointer-events: none; }
.visor.modo-anadir .capa-huecos { cursor: crosshair; touch-action: none; }
.cargando-hoja::after { content: "Cargando página…"; position: absolute; inset: 0; display: grid; place-items: center; color: #999; font-size: 13px; }

/* huecos sobre el documento */
.hueco { position: absolute; padding: 0; border: 0; background: var(--marca-fondo); border-bottom: 2px solid var(--marca-borde); border-radius: 2px; cursor: pointer; touch-action: auto; transition: background .2s, box-shadow .2s; }
.hueco:hover { background: rgba(255, 212, 59, .45); }
.hueco.lleno { background: rgba(255, 212, 59, .12); border-bottom-color: rgba(224, 168, 0, .55); }
.hueco.t-casilla, .hueco.t-peine { border: 1.5px solid var(--marca-borde); }
.hueco.t-firma { background: rgba(36, 72, 214, .07); border: 1.5px dashed var(--acento); }
.hueco.t-firma:not(.lleno)::after { content: "Firma"; position: absolute; inset: 0; display: grid; place-items: center; color: var(--acento); font-size: 11px; font-weight: 700; opacity: .8; }
.hueco.activo { background: rgba(36, 72, 214, .16); box-shadow: 0 0 0 2px var(--acento); border-bottom-color: var(--acento); }
.hueco.desborda { box-shadow: 0 0 0 2px var(--error); }
.hueco.sel { box-shadow: 0 0 0 2px var(--acento), 0 0 0 5px rgba(36, 72, 214, .25); background: rgba(36, 72, 214, .12); touch-action: none; z-index: 2; }
.hueco .tirador { display: none; position: absolute; right: -9px; bottom: -9px; width: 18px; height: 18px; background: #fff; border: 2px solid var(--acento); border-radius: 50%; touch-action: none; cursor: nwse-resize; }
.hueco.sel .tirador { display: block; }
.hueco .etq { display: none; position: absolute; left: -2px; bottom: calc(100% + 3px); max-width: 260px; padding: 2px 7px; font-size: 11.5px; font-weight: 700; color: #fff; background: var(--acento); border-radius: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; pointer-events: none; }
.hueco.sel .etq, .hueco.activo .etq, .hueco:hover .etq { display: block; }
.hueco .mini { position: absolute; left: -2px; top: calc(100% + 6px); z-index: 3; display: inline-flex; gap: 4px; padding: 3px; background: var(--papel); border: 1px solid var(--linea-fuerte); border-radius: 10px; box-shadow: 0 6px 18px rgba(20, 33, 61, .2); white-space: nowrap; }
.hueco .mini button { min-height: 32px; padding: 3px 10px; border: 0; border-radius: 7px; background: transparent; color: var(--tinta); font-size: 13px; font-weight: 700; }
.hueco .mini button:hover { background: var(--acento-claro); color: var(--acento); }
.fantasma { position: absolute; border: 2px dashed var(--acento); background: rgba(36,72,214,.08); pointer-events: none; }

/* panel de preguntas */
.panel { background: var(--papel); }
.panel-cabecera { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--linea); }
.archivo-info { display: flex; gap: 8px; align-items: center; min-width: 0; color: var(--suave); }
.archivo-info div { min-width: 0; display: flex; flex-direction: column; }
.archivo-info strong { color: var(--tinta); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 15px; }
.archivo-info span { font-size: 13px; }
#avisos { padding: 0 16px; }
.aviso { margin-top: 12px; padding: 11px 13px; border-radius: 10px; font-size: 14px; background: var(--aviso-fondo); }
.aviso.info { background: var(--acento-claro); }
.aviso.ok { background: var(--ok-fondo); }
.aviso strong { display: block; margin-bottom: 2px; }
.formulario { padding: 4px 16px 8px; }
.grupo { border: 0; padding: 0; margin: 18px 0 0; }
.grupo legend { padding: 0; margin-bottom: 8px; font-size: 13px; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; color: var(--suave); }
.campo { padding: 10px 12px; margin: 0 -12px; border-radius: 12px; transition: background .25s; }
.campo.activo { background: var(--acento-claro); }
.campo.resaltado { animation: resaltar 1.4s var(--ease-out); }
@keyframes resaltar { 0% { background: rgba(255, 212, 59, .6); } 100% { background: transparent; } }
.campo > label, .campo > .etiqueta { display: flex; align-items: baseline; gap: 6px; font-weight: 700; font-size: 15px; margin-bottom: 5px; }
.veces { flex: none; padding: 0 7px; font-size: 11.5px; font-weight: 700; color: var(--acento); background: var(--acento-claro); border-radius: 99px; }
.campo input[type="text"], .campo input[type="email"], .campo input[type="tel"], .campo input[type="date"], .campo input:not([type]), .campo select, .campo textarea, .editor input, .editor select {
  width: 100%; min-height: 44px; padding: 9px 12px; background: var(--papel); border: 1.5px solid var(--linea-fuerte); border-radius: 10px; font-size: 16px; transition: border-color .15s, box-shadow .15s;
}
.campo textarea { min-height: 84px; resize: vertical; line-height: 1.45; }
.campo input:focus, .campo select:focus, .campo textarea:focus, .editor input:focus, .editor select:focus { outline: none; border-color: var(--acento); box-shadow: 0 0 0 3px rgba(36, 72, 214, .18); }
.campo .auto { color: var(--suave); border-style: dashed; }
.campo .mayus { text-transform: uppercase; }
.fila-campo { display: flex; gap: 8px; align-items: center; }
.fila-campo > :first-child { flex: 1; min-width: 0; }
.fila-campo .boton { flex: none; min-height: 44px; }
.ayuda { margin-top: 4px; font-size: 13px; color: var(--suave); }
.contexto { margin-top: 4px; font-size: 13px; color: var(--suave); font-style: italic; }
.contexto mark { background: var(--marca-fondo); border-bottom: 2px solid var(--marca-borde); color: inherit; padding: 0 1.2em; font-style: normal; }
.error-campo { margin-top: 5px; font-size: 13.5px; color: var(--error); font-weight: 600; }
.opciones { display: grid; gap: 6px; }
.opcion { display: flex; gap: 10px; align-items: center; min-height: 40px; padding: 6px 10px; border: 1.5px solid var(--linea-fuerte); border-radius: 10px; cursor: pointer; font-weight: 500; }
.opcion:has(input:checked) { border-color: var(--acento); background: var(--acento-claro); }
.opcion input { width: 20px; height: 20px; accent-color: var(--acento); flex: none; }
.quitar-opcion { margin-top: 4px; font-size: 13px; }
.firma-vista { display: grid; place-items: center; min-height: 84px; padding: 8px; background: #fff; border: 1.5px dashed var(--linea-fuerte); border-radius: 10px; color: var(--suave); font-size: 14px; }
.firma-vista img { max-height: 72px; width: auto; }
.firma-botones { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.panel-pie { position: static; padding: 12px 16px calc(14px + env(safe-area-inset-bottom)); background: var(--papel); border-top: 1px solid var(--linea); box-shadow: 0 -8px 20px rgba(20, 33, 61, .06); }
.recordar { display: flex; gap: 9px; align-items: flex-start; font-size: 14px; font-weight: 600; cursor: pointer; }
.recordar input { width: 18px; height: 18px; margin-top: 2px; accent-color: var(--acento); flex: none; }
.recordar small { display: block; font-weight: 500; color: var(--suave); font-size: 12.5px; }
#borrar-datos { margin: 6px 0 0 27px; }
.pendientes { margin: 8px 0 6px; font-size: 13.5px; color: var(--suave); min-height: 1em; }
.descarga-nota { margin-top: 6px; font-size: 12.5px; color: var(--suave); text-align: center; }
.descarga-nota.ok { color: var(--ok); font-weight: 700; }
.descarga-nota.mal { color: var(--error); font-weight: 600; }

/* editor de un hueco */
.editor { position: fixed; left: 8px; right: 8px; bottom: 8px; z-index: 30; padding: 14px; background: var(--papel); border: 1px solid var(--linea-fuerte); border-radius: 16px; box-shadow: 0 10px 40px rgba(20, 33, 61, .28); display: grid; gap: 10px; max-height: 70vh; overflow: auto; }
.editor-cab { display: flex; justify-content: space-between; align-items: center; }
.editor-campo { display: grid; gap: 4px; font-size: 13.5px; font-weight: 700; color: var(--suave); }
.editor-campo input, .editor-campo select { min-height: 40px; font-size: 15px; color: var(--tinta); font-weight: 500; }
.editor-nota { font-size: 12.5px; color: var(--suave); }
.editor-acciones { display: flex; justify-content: space-between; gap: 8px; }

/* modal firma */
.modal { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 12px; background: rgba(10, 16, 30, .55); }
.modal-caja { width: min(640px, 100%); padding: 18px; background: var(--papel); border-radius: 18px; box-shadow: 0 20px 60px rgba(0,0,0,.35); }
.modal-caja h2 { font-size: 20px; }
.modal-nota { margin: 4px 0 12px; color: var(--suave); font-size: 14px; }
.pad-marco { position: relative; height: 220px; background: #fff; border: 1.5px solid var(--linea-fuerte); border-radius: 12px; overflow: hidden; }
.pad-marco canvas { width: 100%; height: 100%; touch-action: none; cursor: crosshair; }
.pad-linea { position: absolute; left: 8%; right: 8%; bottom: 28%; border-bottom: 1.5px dashed #c9c6bc; pointer-events: none; }
.modal-acciones { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.hueco-flex { flex: 1; }

/* aviso flotante (deshacer, etc.) */
.aviso-flotante { position: fixed; left: 50%; bottom: 18px; z-index: 60; transform: translateX(-50%); display: flex; gap: 12px; align-items: center; max-width: calc(100% - 24px); padding: 10px 16px; background: #14213d; color: #fff; border-radius: 12px; box-shadow: 0 10px 30px rgba(0,0,0,.3); font-size: 14.5px; }
.aviso-flotante .enlace { color: var(--marca); }

/* publicidad (vacía hasta que pegues AdSense) */
.espacio-anuncio { display: grid; place-items: center; min-height: 110px; margin: 22px 0; border: 1.5px dashed var(--linea-fuerte); border-radius: 12px; color: var(--suave); font-size: 12px; letter-spacing: .08em; text-transform: uppercase; }

/* pie */
.pie { margin-top: 30px; padding: 22px 0 28px; background: var(--papel); border-top: 1px solid var(--linea); font-size: 14px; color: var(--suave); }
.pie-in { display: flex; flex-wrap: wrap; gap: 8px 20px; justify-content: space-between; }
.pie a { color: var(--suave); }


/* =============================================================
   7. Contenido (debajo de la herramienta)
   ============================================================= */
.seccion { margin-top: 44px; }
.seccion h2 { font-size: clamp(23px, 4.6vw, 30px); font-weight: 800; margin-bottom: 14px; }
.seccion h3 { font-size: 18px; font-weight: 800; margin: 18px 0 6px; }
.seccion p, .seccion li { color: var(--tinta); }
.pasos { list-style: none; padding: 0; display: grid; gap: 14px; }
.paso { padding: 18px; background: var(--papel); border: 1px solid var(--linea); border-radius: var(--radio); }
.paso h3 { margin: 10px 0 4px; }
.paso p { color: var(--suave); font-size: 15px; }
.destacado { padding: 22px 18px; background: var(--papel); border: 1px solid var(--linea); border-left: 5px solid var(--ok); border-radius: var(--radio); max-width: 1048px; }
.lista-ok { list-style: none; padding: 0; margin: 12px 0; display: grid; gap: 10px; }
.lista-ok li { position: relative; padding-left: 28px; }
.lista-ok li::before { content: "✓"; position: absolute; left: 4px; top: 0; color: var(--ok); font-weight: 800; }
.nota { color: var(--suave); font-size: 14.5px; }
.tabla-limites { display: grid; gap: 12px; }
.limite { padding: 14px 16px; background: var(--papel); border: 1px solid var(--linea); border-radius: 12px; border-top: 4px solid var(--linea-fuerte); }
.limite strong { display: block; margin-bottom: 4px; }
.limite p { font-size: 15px; color: var(--suave); }
.limite.bien { border-top-color: var(--ok); }
.limite.regular { border-top-color: var(--marca-borde); }
.limite.mal { border-top-color: var(--error); }
.texto { max-width: 760px; }
.texto p { margin-bottom: 12px; }
.texto ul { padding-left: 20px; display: grid; gap: 6px; }
.faq { display: grid; gap: 10px; max-width: 820px; }
.faq details { background: var(--papel); border: 1px solid var(--linea); border-radius: 12px; padding: 0 16px; }
.faq summary { cursor: pointer; padding: 14px 0; font-weight: 700; list-style: none; position: relative; padding-right: 28px; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; position: absolute; right: 2px; top: 11px; font-size: 22px; color: var(--acento); font-weight: 600; }
.faq details[open] summary::after { content: "−"; }
.faq details p { padding-bottom: 14px; color: var(--suave); }
.tarjetas { display: grid; gap: 10px; }
.tarjeta { display: block; padding: 14px 16px; background: var(--papel); border: 1px solid var(--linea); border-radius: 12px; text-decoration: none; color: var(--tinta); }
.tarjeta span { display: block; color: var(--suave); font-size: 14px; }
.tarjeta:hover { border-color: var(--acento); }
.mas-grupo { font-size: 17px; margin: 18px 0 10px; }
.migas { padding-top: 14px; font-size: 14px; color: var(--suave); }
.migas a { color: var(--suave); }
.migas + .intro { padding-top: 6px; }
.texto h2 { margin-top: 26px; }
.texto h3 { margin: 18px 0 6px; }
.texto ol { padding-left: 22px; display: grid; gap: 6px; margin-bottom: 12px; }
.legal { max-width: 760px; padding-top: 28px; }
.legal h1 { font-size: clamp(26px, 5vw, 36px); margin-bottom: 14px; }
.legal h2 { font-size: 20px; margin: 22px 0 6px; }
.legal p, .legal li { margin-bottom: 8px; }
.legal .todo { background: var(--aviso-fondo); padding: 1px 5px; border-radius: 4px; font-weight: 700; }

/* =============================================================
   8. Pantallas grandes
   ============================================================= */
@media (min-width: 720px) {
  .editor { left: auto; right: 16px; bottom: 16px; width: 340px; }
  .pasos { grid-template-columns: repeat(3, 1fr); }
  .tabla-limites { grid-template-columns: repeat(2, 1fr); }
  .tarjetas { grid-template-columns: repeat(3, 1fr); }
}
@media (min-width: 960px) {
  .intro { padding-top: 34px; }
  .herramienta[data-state="trabajo"] { padding: 0 16px; }
  .trabajo { display: grid; grid-template-columns: minmax(0, 1fr) 420px; height: calc(100vh - 24px); height: calc(100dvh - 24px); border: 1px solid var(--linea); border-radius: 16px; overflow: hidden; box-shadow: var(--sombra); background: var(--papel); }
  .visor { position: relative; display: flex; flex-direction: column; min-height: 0; border-bottom: 0; border-right: 1px solid var(--linea); }
  .hojas { height: auto; flex: 1; min-height: 0; padding: 20px; }
  .plegar { display: none; }
  .panel { display: flex; flex-direction: column; min-height: 0; overflow: auto; }
  .panel-pie { margin-top: auto; position: sticky; bottom: 0; z-index: 3; }
}
/* móvil estrecho (va al final para mandar sobre lo anterior) */
@media (max-width: 539px) {
  .nav { display: none; }
  .visor-barra { flex-wrap: nowrap; overflow-x: auto; gap: 5px; padding: 6px 8px; scrollbar-width: none; }
  .visor-barra .boton-suave { min-height: 34px; padding: 4px 9px; font-size: 13.5px; white-space: nowrap; }
  .visor-barra .boton-icono { min-width: 32px; min-height: 34px; padding: 2px 6px; }
  #zoom-valor { display: none; }
  .zoom { margin-left: 2px; }
  .plegar { margin-left: auto; white-space: nowrap; }
  .panel-cabecera { padding: 10px 14px; }
  .panel-cabecera .enlace { font-size: 14px; white-space: nowrap; }
}
@media (prefers-reduced-motion: reduce) {
  .campo.resaltado { animation: none; background: var(--acento-claro); }
}
