/* ScanFácil · diseño de app móvil. Azul profundo + turquesa, claro / oscuro / contraste alto. */
:root {
  --alto-boton: 72px;
  --base: 18px;
  --radio: 20px;
  --barra-inf: 76px;
}
body[data-letra='grande'] { --base: 21px; --alto-boton: 80px; }
body[data-letra='enorme'] { --base: 24px; --alto-boton: 88px; }
body[data-modo='oficina'] { --alto-boton: 56px; --barra-inf: 64px; }
body[data-modo='oficina'][data-letra='grande'] { --alto-boton: 64px; }
body[data-modo='oficina'][data-letra='enorme'] { --alto-boton: 72px; }

/* ---- Temas (data-t lo pone la app: claro | oscuro) ---- */
body, body[data-t='claro'] {
  --fondo: #eef3f8; --escritorio: #d5dfeb;
  --superficie: #ffffff; --superficie-2: #f3f7fb;
  --texto: #0b1f3a; --suave: #44566e;
  --borde: #c9d5e3; --borde-fuerte: #0b1f3a;
  --acento: #14b8a6; --acento-texto: #0b1f3a; --acento-suave: #d8f5f1;
  --barra: #0b1f3a; --barra-texto: #ffffff;
  --verde: #15803d; --verde-suave: #dcf5e4;
  --rojo: #b42318; --rojo-suave: #fde8e6;
  --info: #0b5fcf; --info-suave: #e1edfd;
  --foco: #0b66e4;
  --sombra: 0 1px 2px rgba(11, 31, 58, 0.08), 0 6px 18px rgba(11, 31, 58, 0.08);
  --hero: linear-gradient(145deg, #0b1f3a 0%, #0f3a5c 55%, #0e6b6b 100%);
  color-scheme: light;
}
body[data-t='oscuro'] {
  --fondo: #071326; --escritorio: #02070f;
  --superficie: #0f2342; --superficie-2: #14305a;
  --texto: #eaf2ff; --suave: #a9b9d0;
  --borde: #26446f; --borde-fuerte: #eaf2ff;
  --acento: #2dd4bf; --acento-texto: #04162b; --acento-suave: #0d4a4a;
  --barra: #040d1c; --barra-texto: #ffffff;
  --verde: #4ade80; --verde-suave: #11402a;
  --rojo: #ff8a80; --rojo-suave: #4a1a17;
  --info: #7db4ff; --info-suave: #14305a;
  --foco: #7db4ff;
  --sombra: 0 1px 2px rgba(0, 0, 0, 0.4), 0 6px 18px rgba(0, 0, 0, 0.35);
  --hero: linear-gradient(145deg, #0a2a4d 0%, #0b4a6a 55%, #0d7a76 100%);
  color-scheme: dark;
}
/* Contraste alto */
body[data-contraste='alto'][data-t='claro'] {
  --fondo: #ffffff; --superficie: #ffffff; --superficie-2: #ffffff;
  --texto: #000000; --suave: #000000; --borde: #000000; --borde-fuerte: #000000;
  --acento: #2dd4bf; --acento-texto: #000000; --acento-suave: #ffffff;
  --barra: #000000; --verde: #006b2c; --rojo: #a00000; --info: #003fa3;
  --hero: #000000;
}
body[data-contraste='alto'][data-t='oscuro'] {
  --fondo: #000000; --superficie: #000000; --superficie-2: #000000;
  --texto: #ffffff; --suave: #ffffff; --borde: #ffffff; --borde-fuerte: #ffffff;
  --acento: #3be8d0; --acento-texto: #000000; --acento-suave: #000000;
  --barra: #000000; --verde: #6dff9c; --rojo: #ff9b93; --info: #9cc8ff;
  --hero: #000000;
}
body[data-contraste='alto'] { --grosor: 3px; }

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--escritorio); color: var(--texto);
  font: 500 var(--base) / 1.45 system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  -webkit-text-size-adjust: 100%;
}
.vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); opacity: 0; pointer-events: none; }
h1, h2, h3, p { margin: 0; }
button { font-family: inherit; }

/* ---- Marco de la app ---- */
#app {
  position: relative; display: flex; flex-direction: column;
  width: 100%; height: 100vh; height: 100dvh; max-width: 460px; margin: 0 auto;
  background: var(--fondo); overflow: hidden;
}
@media (min-width: 560px) and (min-height: 640px) {
  #app { height: min(100dvh - 48px, 880px); margin-top: 24px; border-radius: 34px; box-shadow: 0 30px 80px rgba(0, 0, 0, 0.35); border: 1px solid var(--borde); }
}

/* ---- Barra superior ---- */
.barra-sup {
  flex: none; display: grid; grid-template-columns: 56px 1fr 56px; align-items: center;
  min-height: 60px; padding: env(safe-area-inset-top) 8px 0; background: var(--barra); color: var(--barra-texto);
}
.barra-sup h1 { grid-column: 2; text-align: center; font-size: 1.05rem; font-weight: 800; letter-spacing: 0.01em; outline: none; }
.barra-sup .izq { grid-column: 1; }
.barra-sup .der { grid-column: 3; text-align: center; font-weight: 800; font-size: 0.85rem; opacity: 0.9; }
.marca { grid-column: 1 / 4; display: flex; align-items: center; gap: 10px; padding: 0 8px; font-weight: 800; font-size: 1.15rem; }
.marca img { width: 36px; height: 36px; border-radius: 10px; }
.btn-icono {
  display: inline-flex; align-items: center; justify-content: center; width: 52px; height: 52px; border: 0; border-radius: 50%;
  background: transparent; color: inherit; cursor: pointer;
}
.btn-icono:active { background: rgba(255, 255, 255, 0.16); }
.btn-icono svg { width: 28px; height: 28px; }
.progreso { flex: none; display: flex; gap: 6px; padding: 10px 16px 0; background: var(--fondo); }
.progreso span { flex: 1; height: 6px; border-radius: 4px; background: var(--borde); }
.progreso span.hecho { background: var(--verde); }
.progreso span.ahora { background: var(--acento); }

/* ---- Contenido ---- */
.contenido { flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: 16px 16px 24px; -webkit-overflow-scrolling: touch; }
.contenido > * + * { margin-top: 14px; }
.titulo { font-size: 1.5rem; line-height: 1.2; font-weight: 800; outline: none; }
.suave { color: var(--suave); }
.chico-texto { font-size: 0.85rem; }
.etiqueta { font-size: 0.8rem; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; color: var(--suave); }

.tarjeta { background: var(--superficie); border: var(--grosor, 1px) solid var(--borde); border-radius: var(--radio); box-shadow: var(--sombra); padding: 16px; }
.tarjeta > * + * { margin-top: 10px; }

/* ---- Botones ---- */
.btn {
  display: flex; align-items: center; justify-content: center; gap: 12px; width: 100%; min-height: var(--alto-boton);
  padding: 10px 18px; border-radius: 18px; cursor: pointer; text-decoration: none; text-align: center; user-select: none;
  font-family: inherit; font-size: 1.05rem; font-weight: 800; line-height: 1.2;
  color: var(--texto); background: var(--superficie); border: 2px solid var(--borde);
}
.btn:active { transform: scale(0.98); }
.btn svg { width: 1.5em; height: 1.5em; flex: none; }
.btn.principal { background: var(--acento); color: var(--acento-texto); border-color: transparent; }
body[data-contraste='alto'] .btn { border-width: 3px; border-color: var(--borde-fuerte); }
.btn.verde { background: var(--verde); color: #fff; border-color: transparent; }
body[data-t='oscuro'] .btn.verde { color: #04200f; }
.btn.peligro { color: var(--rojo); }
.btn.chico { width: auto; min-height: 56px; padding: 8px 16px; font-size: 1rem; border-radius: 16px; }
body[data-modo='oficina'] .btn.chico { min-height: 48px; }
.btn[disabled] { opacity: 0.4; pointer-events: none; }
.btn:focus-visible, .btn-icono:focus-visible, input:focus-visible, textarea:focus-visible, .asa:focus-visible, .tab:focus-visible {
  outline: 4px solid var(--foco); outline-offset: 2px;
}
.fila { display: flex; gap: 10px; flex-wrap: wrap; }
.fila > .btn { flex: 1 1 130px; width: auto; }
.btn-gigante { min-height: calc(var(--alto-boton) + 12px); font-size: 1.2rem; }

/* ---- Barra de acción inferior y navegación ---- */
.accionbar {
  flex: none; display: flex; gap: 10px; padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  background: var(--superficie); border-top: var(--grosor, 1px) solid var(--borde);
}
.accionbar .btn { margin: 0; }
.accionbar .btn.principal, .accionbar .btn.verde { flex: 2; }
.accionbar .btn:not(.principal):not(.verde) { flex: 1; }
.tabbar {
  flex: none; display: grid; grid-template-columns: repeat(3, 1fr);
  padding-bottom: env(safe-area-inset-bottom); background: var(--superficie); border-top: var(--grosor, 1px) solid var(--borde);
}
.tab {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; min-height: var(--barra-inf);
  border: 0; background: none; color: var(--suave); font-size: 0.8rem; font-weight: 800; cursor: pointer;
}
.tab svg { width: 28px; height: 28px; }
.tab[aria-current='page'] { color: var(--texto); }
.tab[aria-current='page'] svg { color: var(--acento); }
.tab[aria-current='page'] span { box-shadow: inset 0 -3px 0 var(--acento); }
body[data-t='oscuro'] .tab[aria-current='page'] span { box-shadow: inset 0 -3px 0 var(--acento); }

/* ---- Inicio ---- */
.hero { background: var(--hero); color: #fff; border-radius: 26px; padding: 20px; box-shadow: var(--sombra); }
body[data-contraste='alto'] .hero { border: 3px solid var(--borde-fuerte); }
.hero h2 { font-size: 1.45rem; line-height: 1.2; font-weight: 800; }
.hero p { margin-top: 6px; opacity: 0.92; }
.hero .btn { margin-top: 16px; border: 0; }
.hero .btn.sec { background: rgba(255, 255, 255, 0.14); color: #fff; margin-top: 10px; border: 2px solid rgba(255, 255, 255, 0.45); }
.formatos { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.fmt {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; min-height: 84px; padding: 8px 2px;
  border-radius: 18px; background: var(--superficie); color: var(--texto); border: 2px solid var(--borde); font-size: 0.8rem; font-weight: 800; cursor: pointer;
}
.fmt svg { width: 28px; height: 28px; color: var(--acento); }
body[data-t='claro'] .fmt svg { color: #0b8f82; }
.fmt[aria-pressed='true'] { border-color: var(--acento); background: var(--acento-suave); }
body[data-contraste='alto'] .fmt { border-width: 3px; border-color: var(--borde-fuerte); }
.recientes { list-style: none; margin: 0; padding: 0; }
.recientes li + li { margin-top: 10px; }

/* ---- Listas ---- */
.lista { list-style: none; margin: 0; padding: 0; }
.lista > li + li { margin-top: 12px; }
.pagina { display: flex; gap: 14px; align-items: center; }
.pagina img { width: 76px; height: 100px; object-fit: cover; border: 1px solid var(--borde); border-radius: 10px; background: #fff; flex: none; }
.pagina .acc { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.doc { display: flex; align-items: center; gap: 10px; }
.doc .asa { flex: 1; min-width: 0; text-align: left; background: none; border: 0; padding: 6px 0; font: inherit; color: inherit; cursor: pointer; }
.doc b { display: block; overflow-wrap: anywhere; }
.doc .ico { flex: none; width: 48px; height: 48px; border-radius: 14px; background: var(--acento-suave); color: var(--texto); display: grid; place-items: center; }
.doc .ico svg { width: 26px; height: 26px; }

/* ---- Formularios ---- */
label.campo { display: block; font-weight: 800; margin-bottom: 6px; }
input[type='text'], textarea {
  width: 100%; font: inherit; color: var(--texto); background: var(--superficie); min-height: 60px; padding: 12px 14px;
  border: 2px solid var(--borde); border-radius: 16px;
}
body[data-contraste='alto'] input[type='text'] { border-width: 3px; border-color: var(--borde-fuerte); }
.opciones { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.opciones.tres { grid-template-columns: repeat(3, 1fr); }
.opcion { flex-direction: column; gap: 4px; min-height: calc(var(--alto-boton) + 8px); padding: 10px 8px; }
.opciones.filtros > .opcion:last-child:nth-child(odd) { grid-column: 1 / -1; }
.opcion small { font-weight: 600; font-size: 0.78rem; color: var(--suave); }
.opcion[aria-pressed='true'], .opcion[aria-checked='true'] { border-color: var(--acento); background: var(--acento-suave); outline: 2px solid var(--acento); outline-offset: -1px; }
.opcion[aria-pressed='true'] small, .opcion[aria-checked='true'] small { color: var(--texto); }
body[data-contraste='alto'] .opcion[aria-checked='true'], body[data-contraste='alto'] .opcion[aria-pressed='true'] { background: var(--acento); color: var(--acento-texto); }
body[data-contraste='alto'] .opcion[aria-checked='true'] small, body[data-contraste='alto'] .opcion[aria-pressed='true'] small { color: var(--acento-texto); }
.opcion .ico { width: 30px; height: 30px; color: var(--acento); }
body[data-t='claro'] .opcion .ico { color: #0b8f82; }
.opcion .ico svg { width: 100%; height: 100%; }

/* ---- Visor y vista previa ---- */
.visor { position: relative; border-radius: 18px; background: #1b2635; overflow: hidden; touch-action: none; box-shadow: var(--sombra); }
.visor canvas { display: block; width: 100%; height: auto; }
[data-foco]:focus { outline: none; }
.fila > .btn.chico { flex: 1 1 140px; }
.preview { width: auto; max-width: 100%; max-height: 44vh; max-height: 44dvh; object-fit: contain; margin-left: auto; margin-right: auto; border-radius: 18px; background: #fff; display: block; border: 1px solid var(--borde); box-shadow: var(--sombra); }

/* ---- Avisos ---- */
.aviso { display: flex; gap: 12px; align-items: flex-start; border-radius: 16px; padding: 12px 14px; background: var(--info-suave); color: var(--texto); border: 1px solid transparent; }
.aviso svg { width: 24px; height: 24px; flex: none; margin-top: 1px; }
.aviso.mal { background: var(--rojo-suave); } .aviso.mal svg { color: var(--rojo); }
.aviso.bien { background: var(--verde-suave); } .aviso.bien svg { color: var(--verde); }
.aviso.info svg { color: var(--info); }
body[data-contraste='alto'] .aviso { border: 3px solid var(--borde-fuerte); background: var(--superficie); }
.aviso ol { margin: 6px 0 0; padding-left: 20px; } .aviso li + li { margin-top: 2px; }

/* ---- Listo ---- */
.exito { text-align: center; padding: 22px 16px; }
.exito .sello { width: 68px; height: 68px; border-radius: 50%; margin: 0 auto 10px; display: grid; place-items: center; background: var(--verde); color: #fff; }
body[data-t='oscuro'] .exito .sello { color: #04200f; }
.exito .sello svg { width: 38px; height: 38px; }
.exito h2 { font-size: 1.3rem; font-weight: 800; }
.exito .nombre { margin-top: 6px; font-weight: 800; overflow-wrap: anywhere; }
.acciones-listo { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.acciones-listo .btn { flex-direction: column; justify-content: center; min-width: 0; min-height: 88px; gap: 6px; padding: 12px 8px; }
.acciones-listo .btn small { font-size: 0.75rem; font-weight: 600; color: var(--suave); }
.acciones-listo .btn.principal small { color: var(--acento-texto); opacity: 0.85; }

/* ---- Espera ---- */
.velo { position: fixed; inset: 0; background: rgba(4, 13, 28, 0.72); display: flex; align-items: center; justify-content: center; z-index: 50; padding: 20px; }
.velo[hidden] { display: none; }
.velo-caja { background: var(--superficie); color: var(--texto); border-radius: 24px; padding: 26px; text-align: center; max-width: 380px; width: 100%; box-shadow: var(--sombra); }
.rueda { width: 52px; height: 52px; border-radius: 50%; border: 7px solid var(--borde); border-top-color: var(--acento); margin: 0 auto 14px; animation: gira 1s linear infinite; }
@keyframes gira { to { transform: rotate(360deg); } }
.barra { height: 14px; border-radius: 10px; background: var(--borde); overflow: hidden; margin-top: 10px; }
.barra span { display: block; height: 100%; width: 0; background: var(--acento); transition: width 0.2s; }
@media (prefers-reduced-motion: reduce) {
  .rueda { animation-duration: 3s; }
  .btn:active { transform: none; }
  .web-tarjeta-movil, .web-tarjeta-cara, .web-tarjeta-cara--qr { transition: none; }
  .web-tarjeta-movil:hover { transform: none; }
}
@media (max-width: 360px) { .opciones.tres { grid-template-columns: 1fr; } .formatos { grid-template-columns: repeat(2, 1fr); } }

/* Enlaces y pasos de envío */
.enlace { color: var(--info); font: inherit; font-weight: 800; text-decoration: underline; background: none; border: 0; padding: 4px 2px; cursor: pointer; }
.pasos-envio { list-style: none; margin: 12px 0 0; padding: 0; }
.pasos-envio li + li { margin-top: 10px; }
.pasos-envio .btn { justify-content: flex-start; text-align: left; }
#nota > * + * { margin-top: 10px; }
textarea[readonly] { font-size: 0.8rem; min-height: 120px; margin-top: 10px; }

/* ---- Capa web de escritorio: se activa solo en pantallas anchas ----
   En móvil estos elementos no existen visualmente: #app sigue siendo la app original. */
.web-cabecera, .web-portada, .web-info, .web-faq, .web-movil, .web-anuncios, .web-pie, .web-app-etiqueta { display: none; }

@media (min-width: 960px) {
  body { background: var(--fondo); }
  .web { max-width: 1240px; margin: 0 auto; padding: 0 28px 48px; }
  .web-portada, .web-info, .web-faq, .web-movil, .web-anuncios, .web-pie { display: block; }

  .web-cabecera {
    position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; gap: 24px;
    min-height: 80px; padding: 10px 0; background: var(--fondo); border-bottom: 1px solid var(--borde);
  }
  .web-marca { display: flex; align-items: center; gap: 12px; color: var(--texto); text-decoration: none; }
  .web-marca img { border-radius: 12px; }
  .web-marca span { display: flex; flex-direction: column; line-height: 1.2; }
  .web-marca b { font-size: 1.2rem; font-weight: 800; }
  .web-marca small { color: var(--suave); font-size: 0.78rem; font-weight: 700; }
  .web-nav { display: flex; gap: 28px; }
  .web-nav a { color: var(--suave); font-size: 0.95rem; font-weight: 700; text-decoration: none; }
  .web-nav a:hover { color: var(--texto); text-decoration: underline; }
  .web-cabecera-btn {
    padding: 12px 18px; border-radius: 14px; background: var(--barra); color: var(--barra-texto);
    font-weight: 800; text-decoration: none; white-space: nowrap;
  }

  .web-layout {
    display: grid; grid-template-columns: minmax(0, 1fr) minmax(400px, 460px);
    gap: clamp(32px, 5vw, 80px); align-items: start; padding: 48px 0 24px;
  }
  .web-portada { padding-top: 28px; }
  .web-kicker { color: var(--info); font-size: 0.85rem; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; }
  .web-portada h1 { max-width: 620px; margin-top: 14px; font-size: clamp(2.1rem, 3.6vw, 3.4rem); line-height: 1.08; letter-spacing: -0.02em; }
  .web-bajada { max-width: 620px; margin-top: 20px; color: var(--suave); font-size: 1.15rem; line-height: 1.6; }
  .web-acciones { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 28px; }
  .web-btn {
    display: inline-flex; align-items: center; justify-content: center; min-height: 56px; padding: 12px 22px;
    border: 2px solid var(--borde); border-radius: 16px; background: var(--superficie); color: var(--texto);
    font: inherit; font-weight: 800; text-align: center; text-decoration: none; cursor: pointer;
  }
  .web-btn--principal { background: var(--acento); border-color: transparent; color: var(--acento-texto); }
  .web-btn--texto { background: transparent; border-color: transparent; color: var(--info); text-decoration: underline; }
  .web-btn:focus-visible, .web-nav a:focus-visible, .web-cabecera-btn:focus-visible, .web-pie-nav a:focus-visible { outline: 4px solid var(--foco); outline-offset: 2px; }
  .web-sellos { display: flex; flex-wrap: wrap; gap: 10px 22px; margin: 30px 0 0; padding: 0; list-style: none; color: var(--suave); font-size: 0.92rem; font-weight: 700; }
  .web-sellos li::before { content: '✓'; margin-right: 8px; color: var(--verde); font-weight: 900; }

  .web-app-columna { position: sticky; top: 104px; }
  .web-app-etiqueta { display: block; margin: 0 0 12px; color: var(--suave); font-size: 0.8rem; font-weight: 800; letter-spacing: 0.08em; text-align: center; text-transform: uppercase; }
  .web-app-columna #app {
    height: min(calc(100vh - 150px), 780px); height: min(calc(100dvh - 150px), 780px);
    min-height: 560px; max-width: 460px; margin: 0 auto;
    border: 1px solid var(--borde); border-radius: 30px; box-shadow: 0 24px 60px rgba(4, 13, 28, 0.22);
  }

  .web-info, .web-movil, .web-anuncios { margin-top: 64px; padding-top: 36px; border-top: 1px solid var(--borde); }
  .web-seccion-cabecera { max-width: 760px; }
  .web-seccion-cabecera h2 { margin-top: 10px; font-size: clamp(1.7rem, 2.6vw, 2.4rem); line-height: 1.15; }
  .web-seccion-cabecera .chico-texto { margin-top: 10px; }
  .web-pasos { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; margin: 30px 0 0; padding: 0; list-style: none; }
  .web-pasos li { display: flex; gap: 16px; padding: 24px; background: var(--superficie); border: 1px solid var(--borde); border-radius: 20px; box-shadow: var(--sombra); }
  .web-num { flex: none; display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; background: var(--acento-suave); color: var(--texto); font-weight: 900; }
  .web-pasos h3, .web-tarjeta-movil h3 { font-size: 1.2rem; }
  .web-pasos p { margin-top: 8px; color: var(--suave); line-height: 1.6; }

  .web-tarjetas-movil { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; margin-top: 30px; }
  .web-tarjeta-movil {
    position: relative; display: flex; flex-direction: column; min-height: 300px; overflow: hidden;
    padding: 28px; background: var(--superficie); border: 1px solid var(--borde); border-radius: 22px; box-shadow: var(--sombra);
    transition: transform 220ms ease, box-shadow 220ms ease, border-color 220ms ease;
  }
  .web-tarjeta-movil:hover, .web-tarjeta-movil:focus-visible { transform: translateY(-4px); border-color: var(--acento); box-shadow: 0 18px 40px rgba(11, 31, 58, 0.18); }
  .web-tarjeta-movil:focus-visible { outline: 4px solid var(--foco); outline-offset: 2px; }
  .web-tarjeta-icono { display: grid; place-items: center; width: 56px; height: 56px; border-radius: 16px; background: var(--acento-suave); color: var(--barra); }
  .web-tarjeta-icono svg { width: 30px; height: 30px; }
  .web-tarjeta-movil h3 { margin-top: 18px; color: var(--info); font-size: 1.25rem; }
  .web-tarjeta-movil p { margin-top: 8px; color: var(--suave); line-height: 1.6; }
  .web-tarjeta-escritorio .web-btn { margin-top: auto; align-self: flex-start; }
  .web-tarjeta-esquina {
    position: absolute; top: 0; right: 0; display: grid; place-items: center;
    width: 64px; height: 64px; padding: 18px 0 0 18px;
    background: #10b981; color: #ffffff; border-bottom-left-radius: 22px;
  }
  .web-tarjeta-esquina svg { width: 24px; height: 24px; }
  .web-tarjeta-cara--normal { transition: opacity 200ms ease, visibility 200ms ease; }
  .web-tarjeta-cara--qr {
    position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
    padding: 24px; background: var(--superficie); text-align: center;
    opacity: 0; visibility: hidden; transform: scale(0.97);
    transition: opacity 220ms ease, transform 220ms ease, visibility 220ms ease;
  }
  .web-tarjeta-qr:hover .web-tarjeta-cara--normal,
  .web-tarjeta-qr:focus-visible .web-tarjeta-cara--normal,
  .web-tarjeta-qr.activa .web-tarjeta-cara--normal { opacity: 0; visibility: hidden; }
  .web-tarjeta-qr:hover .web-tarjeta-cara--qr,
  .web-tarjeta-qr:focus-visible .web-tarjeta-cara--qr,
  .web-tarjeta-qr.activa .web-tarjeta-cara--qr { opacity: 1; visibility: visible; transform: scale(1); }
  .web-qr { width: min(190px, 70%); aspect-ratio: 1; padding: 8px; background: #ffffff; border: 1px solid var(--borde); border-radius: 14px; }
  .web-qr svg { display: block; width: 100%; height: 100%; }
  .web-tarjeta-cara--qr p { margin-top: 12px; color: var(--texto); font-weight: 700; }
  .web-tarjeta-cara--qr .web-btn { margin-top: 10px; }
  .web-aviso-instalar {
    position: fixed; left: 50%; bottom: 24px; z-index: 60; transform: translateX(-50%);
    max-width: min(560px, calc(100vw - 32px)); padding: 14px 20px; border-radius: 14px;
    background: var(--barra); color: var(--barra-texto); box-shadow: var(--sombra);
    font-size: 0.95rem; font-weight: 700; text-align: center;
  }

  /* Anuncios: sin cajas visibles hasta que AdSense esté configurado por HTTPS (js/anuncios-config.js).
     Solo en una banda propia al final de la página, lejos del escáner; altura reservada = sin saltos al cargar. */
  body:not([data-anuncios='on']) .web-anuncios { display: none; }
  .web-anuncios { margin-top: 64px; }
  .ad-rotulo { margin: 0; color: var(--suave); font-size: 0.7rem; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase; }
  .ad-fila { max-width: 1000px; margin-top: 12px; }
  .ad-fila--dos { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; }

  .web-faq { margin-top: 64px; padding-top: 36px; border-top: 1px solid var(--borde); }
  .web-faq-lista { max-width: 860px; margin-top: 24px; display: grid; gap: 12px; }
  .web-faq details { background: var(--superficie); border: 1px solid var(--borde); border-radius: 16px; padding: 4px 20px; }
  .web-faq summary { cursor: pointer; padding: 14px 0; font-weight: 800; }
  .web-faq summary:focus-visible { outline: 4px solid var(--foco); outline-offset: 2px; border-radius: 8px; }
  .web-faq details p { padding: 0 0 16px; color: var(--suave); line-height: 1.6; }

  .web-pie { margin-top: 64px; padding-top: 32px; border-top: 1px solid var(--borde); color: var(--suave); }
  .web-pie-marca { display: flex; align-items: center; gap: 10px; color: var(--texto); font-size: 1.15rem; }
  .web-pie p { max-width: 760px; margin-top: 12px; line-height: 1.6; }
  .web-pie-nav { display: flex; flex-wrap: wrap; gap: 20px; margin-top: 18px; }
  .web-pie-nav a, .web-pie p a { color: var(--info); font-weight: 800; text-decoration: none; }
  .web-pie-aviso { font-size: 0.85rem; }
}

/* ---- Páginas legales: se sirven por separado, sin la app ---- */
body.pagina-legal { background: var(--fondo); }
.legal-contenedor { max-width: 860px; margin: 0 auto; padding: 24px 20px 56px; }
.legal-cabecera { display: flex; align-items: center; gap: 12px; padding-bottom: 20px; border-bottom: 1px solid var(--borde); }
.legal-cabecera img { width: 40px; height: 40px; border-radius: 12px; }
.legal-cabecera span { display: flex; flex-direction: column; line-height: 1.2; }
.legal-cabecera b { font-size: 1.15rem; }
.legal-cabecera small { color: var(--suave); font-size: 0.8rem; }
.legal-contenedor h1 { margin: 32px 0 8px; font-size: clamp(1.8rem, 4vw, 2.5rem); line-height: 1.15; }
.legal-actualizacion { color: var(--suave); font-size: 0.9rem; }
.legal-tarjeta { margin-top: 24px; padding: 24px; background: var(--superficie); border: 1px solid var(--borde); border-radius: 20px; box-shadow: var(--sombra); }
.legal-tarjeta h2 { margin-top: 24px; font-size: 1.2rem; }
.legal-tarjeta h2:first-child { margin-top: 0; }
.legal-tarjeta p, .legal-tarjeta li { color: var(--suave); line-height: 1.7; }
.legal-tarjeta p + p, .legal-tarjeta ul { margin-top: 14px; }
.legal-tarjeta ul { padding-left: 22px; }
.legal-tarjeta a { color: var(--info); }
.legal-tarjeta a:focus-visible, .legal-pie a:focus-visible, .legal-volver:focus-visible { outline: 4px solid var(--foco); outline-offset: 2px; }
.legal-volver { display: inline-block; margin-top: 24px; padding: 12px 18px; border-radius: 14px; background: var(--acento); color: var(--acento-texto); font-weight: 800; text-decoration: none; }
.legal-pie { margin-top: 32px; padding-top: 20px; border-top: 1px solid var(--borde); }
.legal-pie nav { display: flex; flex-wrap: wrap; gap: 16px; }
.legal-pie a { color: var(--info); font-weight: 700; text-decoration: none; }
.legal-pie a[aria-current='page'] { text-decoration: underline; }
.legal-pie p { margin-top: 14px; color: var(--suave); font-size: 0.85rem; }
@media (max-width: 600px) {
  .legal-contenedor { padding: 16px 16px 40px; }
  .legal-tarjeta { padding: 18px; border-radius: 16px; }
}

/* ---- Huecos de anuncio (comunes a la web y a la app). Fuera del encuadre, de la cámara y de los botones de guardar/compartir ---- */
.ad-slot { position: relative; display: block; width: 100%; overflow: hidden; }
.ad-slot[hidden] { display: none; }
.ad-slot:has(ins[data-ad-status='unfilled']) { display: none; }
.ad-slot-banner { min-height: 140px; }
.ad-slot-cuadro { min-height: 260px; }
.ad-slot ins.adsbygoogle { min-height: inherit; }
.ad-app { margin-top: 28px; padding-top: 12px; border-top: 1px solid var(--borde); }
.ad-app::before { content: 'Publicidad'; display: block; margin-bottom: 6px; color: var(--suave); font-size: 0.7rem; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase; }
.ad-slot-app { min-height: 100px; max-height: 280px; border-radius: 12px; }
.sin-js { padding: 24px; font: 20px sans-serif; }

/* App instalada (PWA): solo el escáner, nunca la portada web ni sus anuncios, aunque la ventana sea ancha. */
@media (display-mode: standalone) and (min-width: 960px) {
  .web-cabecera, .web-portada, .web-info, .web-movil, .web-anuncios, .web-pie, .web-app-etiqueta, .web-faq { display: none !important; }
  .web { padding: 0; max-width: none; }
  .web-layout { display: block; padding: 0; }
  .web-app-columna { position: static; }
  .web-app-columna #app { height: min(100dvh - 48px, 880px); min-height: 0; margin-top: 24px; border-radius: 34px; }
}
