/* ───────────────────────── Colores ─────────────────────────
   Claro (institucional): Pantone 330 C #00524C · 338 C #62CDB4
     tintes #30726D #65948F #97B6B2 #91DAC7 #BAE7DB #E1F4EF · neutros #000000 #96968C #E6E6DC #FFFFFF
   Oscuro: la misma paleta sobre fondo casi negro con tinte verde (sin dorado):
     franjas #003F3A · acento menta #62CDB4 / #91DAC7 · superficie #0F1A18
   Guindas #621333 #9C2348 solo para errores y avisos.
   (Los nombres --verde / --oro se conservan por historia: en oscuro valen menta.)       */
:root {
  --verde-hondo: #00524C;       /* franjas: cabecera, barras, visor */
  --sombra-franja: 0 10px 24px -12px rgba(0, 82, 76, .55);
  --verde: #30726D;             /* botones marcados, ícono de la pastilla */
  --sobre-verde: #FFFFFF;
  --guinda-honda: #621333;
  --guinda: #9C2348;
  --oro: #62CDB4;               /* acento: filetes, progreso */
  --oro-claro: #91DAC7;
  --sobre-oro: #00524C;
  --foco: #30726D;
  --gris: #96968C;

  --fondo: #F3F3EE;
  --superficie: #FFFFFF;
  --superficie-2: rgba(0, 82, 76, .06);
  --campo: #FFFFFF;
  --tinta: #111111;
  --tinta-2: rgba(17, 17, 17, .8);
  --tinta-3: rgba(17, 17, 17, .66);
  --etiqueta: #00524C;          /* texto de acento: etiquetas, códigos, enlaces */
  --borde: rgba(150, 150, 140, .45);
  --borde-campo: #96968C;
  --raya: rgba(150, 150, 140, .26);
  --primario: #00524C;
  --sobre-primario: #FFFFFF;
  --info-fondo: #E1F4EF;
  --info-tinta: #00524C;
  --info-borde: #91DAC7;
  --error-fondo: rgba(156, 35, 72, .07);
  --error-tinta: #621333;
  --resalte: rgba(98, 205, 180, .42);
  --grafico: #30726D;           /* barras de avance y puntos de estado: el menta no llega a 3:1 sobre blanco */
  --estrella: #30726D;          /* favoritos (5.6:1 sobre blanco) */
  --marca-busqueda: rgba(255, 196, 0, .45);   /* mismo amarillo que el resaltado del visor */
  --pista: rgba(0, 82, 76, .12);
  --piso: rgba(0, 82, 76, .16);
  --punto: rgba(17, 17, 17, .28);
  --visor-fondo: #96968C;
  --sombra: 0 1px 2px rgba(0, 82, 76, .05), 0 18px 40px -30px rgba(0, 82, 76, .45);

  --sans: "Montserrat", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", "Roboto Mono", Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --verde-hondo: #003F3A;       /* franjas: cabecera, barras, visor (verde 330 C oscurecido, distinto del fondo) */
    --sombra-franja: 0 10px 26px -12px rgba(0, 0, 0, .75);
    --verde: #62CDB4;       /* botones marcados, ícono de la pastilla (menta 338 C) */
    --sobre-verde: #00332F;
    --oro: #62CDB4;
    --oro-claro: #91DAC7;
    --sobre-oro: #00332F;
    --foco: #91DAC7;

    --fondo: #050B0A;
    --superficie: #0F1A18;
    --superficie-2: rgba(98, 205, 180, .08);
    --campo: #0A1412;
    --tinta: #EEF6F3;
    --tinta-2: rgba(238, 246, 243, .84);
    --tinta-3: rgba(238, 246, 243, .7);
    --etiqueta: #91DAC7;
    --borde: rgba(255, 255, 255, .12);
    --borde-campo: rgba(255, 255, 255, .26);
    --raya: rgba(255, 255, 255, .07);
    --primario: #62CDB4;
    --sobre-primario: #00332F;
    --info-fondo: rgba(98, 205, 180, .1);
    --info-tinta: #EEF6F3;
    --info-borde: rgba(98, 205, 180, .45);
    --error-fondo: rgba(156, 35, 72, .3);
    --error-tinta: #FFFFFF;
    --resalte: rgba(98, 205, 180, .3);
    --grafico: #62CDB4;
    --estrella: #91DAC7;
    --marca-busqueda: rgba(98, 205, 180, .38);
    --pista: rgba(255, 255, 255, .14);
    --piso: rgba(98, 205, 180, .12);
    --punto: rgba(238, 246, 243, .35);
    --visor-fondo: #050B0A;
    --sombra: 0 1px 2px rgba(0, 0, 0, .4), 0 24px 48px -28px rgba(0, 0, 0, .9);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --verde-hondo: #003F3A;       /* franjas: cabecera, barras, visor (verde 330 C oscurecido, distinto del fondo) */
  --sombra-franja: 0 10px 26px -12px rgba(0, 0, 0, .75);
  --verde: #62CDB4;       /* botones marcados, ícono de la pastilla (menta 338 C) */
  --sobre-verde: #00332F;
  --oro: #62CDB4;
  --oro-claro: #91DAC7;
  --sobre-oro: #00332F;
  --foco: #91DAC7;

  --fondo: #050B0A;
  --superficie: #0F1A18;
  --superficie-2: rgba(98, 205, 180, .08);
  --campo: #0A1412;
  --tinta: #EEF6F3;
  --tinta-2: rgba(238, 246, 243, .84);
  --tinta-3: rgba(238, 246, 243, .7);
  --etiqueta: #91DAC7;
  --borde: rgba(255, 255, 255, .12);
  --borde-campo: rgba(255, 255, 255, .26);
  --raya: rgba(255, 255, 255, .07);
  --primario: #62CDB4;
  --sobre-primario: #00332F;
  --info-fondo: rgba(98, 205, 180, .1);
  --info-tinta: #EEF6F3;
  --info-borde: rgba(98, 205, 180, .45);
  --error-fondo: rgba(156, 35, 72, .3);
  --error-tinta: #FFFFFF;
  --resalte: rgba(98, 205, 180, .3);
  --grafico: #62CDB4;
  --estrella: #91DAC7;
  --marca-busqueda: rgba(98, 205, 180, .38);
  --pista: rgba(255, 255, 255, .14);
  --piso: rgba(98, 205, 180, .12);
  --punto: rgba(238, 246, 243, .35);
  --visor-fondo: #050B0A;
  --sombra: 0 1px 2px rgba(0, 0, 0, .4), 0 24px 48px -28px rgba(0, 0, 0, .9);
  color-scheme: dark;
}

/* ───────────────────────── Base ───────────────────────── */
* { box-sizing: border-box; }
/* Sin zoom de la página (doble toque o pellizco): solo desplazar. El PDF tiene su propio
   zoom en el visor (pellizco, Ctrl + rueda y botones), que no usa el del navegador. */
*, *::before, *::after { touch-action: pan-x pan-y; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--fondo);
  color: var(--tinta);
  font: 16px/1.45 var(--sans);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
body.con-visor { overflow: hidden; }
h1, h2, h3 { margin: 0; line-height: 1.2; }
a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--foco); outline-offset: 2px; }
svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.mono { font-family: var(--mono); }

#vista {
  min-height: 100vh;
  min-height: 100dvh;
  padding: 0 env(safe-area-inset-right) calc(24px + env(safe-area-inset-bottom)) env(safe-area-inset-left);
  outline: none;
}
.contenido { max-width: 920px; margin: 0 auto; padding: 0 16px; }

.eyebrow {
  font-size: 13px; font-weight: 700; letter-spacing: .16em; text-transform: uppercase;
  color: var(--etiqueta);
}
.filete-oro { height: 1px; background: var(--oro); opacity: .55; border: 0; margin: 0; }

/* ───────────────────────── Botones ───────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 48px; padding: 10px 18px;
  border-radius: 12px; border: 1px solid var(--borde);
  background: transparent; color: var(--tinta); font-weight: 600; font-size: 15px;
}
.btn svg { width: 19px; height: 19px; }
.btn.primario { background: var(--primario); border-color: var(--oro-claro); color: var(--sobre-primario); font-weight: 700; }
.btn.peligro { color: var(--error-tinta); border-color: var(--guinda); background: transparent; }
.btn.aviso-guinda { color: var(--error-tinta); border-color: var(--guinda); }
.btn.grande { min-height: 56px; font-size: 17px; width: 100%; }
.btn:disabled { cursor: not-allowed; }
.btn.primario:disabled { background: var(--superficie-2); border-color: var(--borde); color: var(--tinta-3); }
.btn.primario.ocupado:disabled { background: var(--primario); border-color: var(--oro-claro); color: var(--sobre-primario); cursor: progress; }
.icono {
  display: inline-grid; place-items: center;
  width: 48px; height: 48px; border-radius: 12px; border: 0;
  background: transparent; color: inherit;
}
.icono-redondo {
  display: inline-grid; place-items: center; flex: none;
  width: 44px; height: 44px; border-radius: 22px;
  border: 1px solid var(--oro-claro); background: transparent; color: #FFFFFF;
}
.icono-redondo svg { width: 20px; height: 20px; stroke-width: 1.8; }

/* ───────────────────────── Cabecera institucional ───────────────────────── */
.cabecera {
  display: flex; flex-wrap: wrap; align-items: center; gap: 12px 24px;
  padding: calc(12px + env(safe-area-inset-top)) max(24px, calc((100% - 1392px) / 2)) 12px;
  margin: 0 calc(-1 * env(safe-area-inset-right)) 0 calc(-1 * env(safe-area-inset-left));
  background: var(--verde-hondo); color: #FFFFFF;
  border-bottom: 2px solid var(--oro);
  box-shadow: var(--sombra-franja);   /* la cabecera se despega del cuerpo */
  position: relative; z-index: 2;
}
/* iPad y computadora: cabecera fija arriba. Safari (iPadOS 26) pinta su barra superior
   translúcida con el color de un encabezado fijo; si no lo hay, la difumina sobre la página. */
@media (min-width: 700px) {
  .cabecera { position: sticky; top: 0; z-index: 30; }
}
.marca-app { display: flex; align-items: center; gap: 12px; flex: none; }
.marca-app .logo { width: 48px; height: 48px; flex: none; display: block; }
.marca-app .logo-oscuro { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .marca-app .logo-claro { display: none; }
  :root:not([data-theme="light"]) .marca-app .logo-oscuro { display: block; }
}
:root[data-theme="dark"] .marca-app .logo-claro { display: none; }
:root[data-theme="dark"] .marca-app .logo-oscuro { display: block; }
.marca-app b { display: block; font-size: 17px; font-weight: 700; }
.marca-app small { display: block; font-size: 12px; color: rgba(255, 255, 255, .78); }
.cab-der { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.cab-der .icono-redondo { text-decoration: none; }

.cab-buscar {
  flex: 1 1 300px; max-width: 680px;
  display: flex; align-items: center; gap: 10px;
  height: 44px; padding: 0 14px; border-radius: 10px;
  background: #FFFFFF; color: #171717;
}
.cab-buscar svg { width: 18px; height: 18px; color: var(--verde); }
.cab-buscar input {
  flex: 1; min-width: 0; border: 0; outline: none; background: transparent;
  font-size: 15px; font-weight: 500; color: #171717;
}
.cab-buscar input::placeholder { color: rgba(23, 23, 23, .62); }
.cab-buscar:focus-within { outline: 3px solid var(--oro); outline-offset: 2px; }

.filtros { display: flex; flex-wrap: wrap; gap: 6px; }
.filtros button {
  height: 44px; padding: 0 16px; border-radius: 22px;
  border: 1px solid rgba(255, 255, 255, .32); background: transparent; color: #FFFFFF;
  font-size: 14px; font-weight: 600;
}
.filtros button[aria-pressed="true"] { background: var(--verde); border-color: var(--oro-claro); }

.pastilla {
  height: 44px; display: inline-flex; align-items: center; gap: 10px;
  padding: 0 16px 0 11px; border-radius: 22px; border: 0;
  background: #FFFFFF; color: #171717; font-size: 13px; font-weight: 600; text-align: left;
}
.pastilla .pt-ico {
  width: 22px; height: 22px; border-radius: 11px; flex: none;
  display: grid; place-items: center; background: var(--verde); color: var(--sobre-verde);
}
.pastilla .pt-ico svg { width: 13px; height: 13px; stroke-width: 2.6; }
.pastilla b { display: block; line-height: 1.15; }
.pastilla small { display: block; font-size: 11px; font-weight: 500; color: rgba(23, 23, 23, .72); line-height: 1.2; }
.pastilla.alerta .pt-ico { background: var(--guinda); }
.pastilla.alerta small { color: var(--guinda-honda); }

/* Barra de las vistas internas (manual, buscar, ajustes): misma franja verde */
.barra {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; gap: 8px;
  padding: calc(8px + env(safe-area-inset-top)) 8px 8px;
  margin: 0 calc(-1 * env(safe-area-inset-right)) 0 calc(-1 * env(safe-area-inset-left));
  background: var(--verde-hondo); color: #FFFFFF;
  border-bottom: 2px solid var(--oro);
  box-shadow: var(--sombra-franja);
}
.barra .t { flex: 1; min-width: 0; padding: 0 4px; }
.barra h1 { font-size: 20px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.barra p { margin: 2px 0 0; font-size: 13px; color: rgba(255, 255, 255, .78); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.barra .contenido { display: flex; align-items: center; gap: 8px; width: 100%; padding: 0; }
.barra .icono { color: #FFFFFF; }

/* ───────────────────────── Activación ───────────────────────── */
.act {
  display: flex; flex-direction: column; align-items: center; gap: 22px;
  padding: 48px 20px 40px;
}
.act > * { width: 100%; max-width: 480px; }
.act-intro { display: flex; flex-direction: column; gap: 6px; }
.act-intro h1 { font-size: 30px; font-weight: 700; line-height: 1.15; letter-spacing: -.01em; }
.act-intro p { margin: 0; font-size: 15px; color: var(--tinta-3); }

/* Encabezado institucional (arriba de la activación) */
.act > .institucion {
  max-width: 620px; text-align: center;
  padding-bottom: 16px; border-bottom: 1px solid var(--oro);
}
.institucion b { display: block; font-size: 17px; line-height: 1.3; font-weight: 700; color: var(--tinta); }
.institucion span { display: block; margin-top: 6px; font-size: 14px; line-height: 1.35; color: var(--tinta-3); }

.act-tarjeta {
  border-radius: 16px; overflow: hidden;
  background: var(--superficie); border: 1px solid var(--borde); box-shadow: var(--sombra);
}
.act-tapa {
  display: flex; flex-direction: column; gap: 6px;
  padding: 14px 24px 12px; background: var(--verde-hondo); color: var(--oro-claro);
}
.act-tapa .folio-fila {
  display: flex; justify-content: space-between;
  font: 600 10px/1 var(--mono); letter-spacing: .16em; text-transform: uppercase;
}
.act-tapa .greca { width: 100%; height: 14px; }
.greca { stroke-width: 1.2; }

.act-form { margin: 0; padding: 26px 24px 24px; display: flex; flex-direction: column; gap: 22px; }
.campo { display: flex; flex-direction: column; gap: 8px; }
.campo label { font-size: 15px; font-weight: 700; }
.campo label span { font-weight: 500; color: var(--tinta-3); }
.campo .ayuda { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; line-height: 1.4; color: var(--tinta-3); }
.campo input {
  width: 100%; height: 52px; padding: 0 16px; border-radius: 12px;
  background: var(--campo); color: var(--tinta); border: 1px solid var(--borde-campo);
  font-size: 16px; font-weight: 500;
}
.campo input::placeholder { color: var(--tinta-3); }
.campo input.codigo {
  height: 68px; text-align: center; text-transform: uppercase;
  font: 600 30px var(--mono); letter-spacing: .22em; border-width: 2px;
}
.campo input.codigo::placeholder { letter-spacing: .22em; opacity: .55; }
.campo input.codigo.completo { border-color: var(--verde); }
.campo input.codigo[aria-invalid="true"] { border-color: var(--guinda); }
.contador { font: 600 13px var(--mono); }
.contador.completo { color: var(--etiqueta); }

.nota-caja {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 14px; border-radius: 10px; font-size: 13px; line-height: 1.5;
  background: var(--info-fondo); color: var(--info-tinta); border: 1px solid var(--info-borde);
}
.nota-caja svg, .error-caja svg { width: 18px; height: 18px; margin-top: 1px; }
.error-caja {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 14px; border-radius: 10px; font-size: 14px; line-height: 1.5;
  background: var(--error-fondo); color: var(--error-tinta); border: 1px solid var(--guinda);
}
.error-caja b { display: block; }
.act-pie { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px 20px; font-size: 14px; color: var(--tinta-3); }

/* Descarga inicial (misma tarjeta) */
.descarga-cuerpo { padding: 26px 24px 24px; display: flex; flex-direction: column; gap: 14px; }
.descarga-cuerpo h2 { font-size: 22px; font-weight: 700; }
.descarga-cuerpo p { margin: 0; font-size: 14px; color: var(--tinta-3); }
.progreso { height: 8px; border-radius: 4px; background: var(--pista); overflow: hidden; }
.progreso i { display: block; height: 100%; width: 0; background: var(--grafico); }
.progreso-datos { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; font-variant-numeric: tabular-nums; color: var(--tinta-3); }

/* ───────────────────────── Biblioteca: estante 3D ───────────────────────── */
/* En monitores grandes el contenido no se estira de lado a lado: máximo 1440 px, centrado */
.biblio { padding: 0 max(24px, calc((100% - 1392px) / 2)); }
.estante { max-width: 1280px; margin: 0 auto; padding-top: 24px; }
.estante-cab { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; }
.estante-cab h2 { font-size: 12px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--etiqueta); }
.folio { font: 600 13px var(--sans); font-variant-numeric: tabular-nums; color: var(--tinta-3); }
.estante .filete-oro { margin-top: 10px; }

.carrusel {
  --lw: 210px; --lh: 300px; --ld: 38px;
  position: relative; height: calc(var(--lh) + 130px);
  perspective: 1500px; perspective-origin: 50% 38%;
  overflow: hidden; border-radius: 12px; outline-offset: -3px;
  touch-action: pan-y;
}
.carrusel .repisa { position: absolute; left: 8%; right: 8%; top: calc(var(--lh) + 66px); height: 1px; background: var(--oro-claro); opacity: .7; }
.carrusel .piso { position: absolute; left: 50%; top: calc(var(--lh) + 76px); width: 360px; height: 26px; margin-left: -180px; border-radius: 50%; background: var(--piso); filter: blur(6px); }
.pista { position: absolute; left: 50%; top: 46px; width: 0; height: var(--lh); transform-style: preserve-3d; }

.libro {
  position: absolute; left: calc(var(--lw) / -2); top: 0;
  width: var(--lw); height: var(--lh); padding: 0; margin: 0; border: 0; background: none;
  transform-style: preserve-3d; will-change: transform;
  transition: transform 640ms cubic-bezier(.22, .7, .18, 1);
  color: var(--c-tinta);
  --c-fondo: #00524C; --c-lomo: #0B6B63; --c-tinta: #FFFFFF; --c-linea: #62CDB4;
}
.carrusel.sin-transicion .libro, .carrusel.sin-transicion .portada, .carrusel.sin-transicion .lomo { transition: none; }
/* Un color por manual (igual en tema claro y oscuro; todos se distinguen sobre negro y sobre claro).
   --c-lomo es el color que se ve en el lomo; --c-fondo, el de la portada dibujada.
   Sirven para el libro del estante y para la etiqueta .m-chip (panel, visor, resultados). */
.color-verde   { --c-fondo: #00524C; --c-lomo: #0B6B63; --c-tinta: #FFFFFF; --c-linea: #62CDB4; }  /* verde 330 C */
.color-verde2  { --c-fondo: #62CDB4; --c-lomo: #62CDB4; --c-tinta: #00332F; --c-linea: #00524C; }  /* menta 338 C */
.color-guinda  { --c-fondo: #9C2348; --c-lomo: #9C2348; --c-tinta: #FFFFFF; --c-linea: #E1F4EF; }  /* guinda */
.color-guinda2 { --c-fondo: #97B6B2; --c-lomo: #97B6B2; --c-tinta: #00332F; --c-linea: #00524C; }  /* tinte verde (antes dorado; el nombre se conserva por compatibilidad con el catálogo) */
.color-ocre    { --c-fondo: #65948F; --c-lomo: #65948F; --c-tinta: #FFFFFF; --c-linea: #E1F4EF; }  /* verde gris */

/* Etiqueta del manual en su color: un lomo en miniatura con la clave */
.m-chip {
  display: inline-flex; align-items: center; flex: none; vertical-align: 1px;
  min-height: 22px; padding: 1px 8px 1px 10px; border-radius: 3px 5px 5px 3px;
  background: var(--c-fondo, var(--superficie-2)); color: var(--c-tinta, var(--etiqueta));
  border: 1px solid var(--c-linea, var(--borde));
  box-shadow: inset 3px 0 0 var(--c-linea, transparent);
  font: 700 11px/1.2 var(--mono); letter-spacing: .08em; text-transform: uppercase; white-space: nowrap;
}
.barra .m-chip, .v-barra .m-chip { min-height: 28px; font-size: 13px; padding: 2px 10px 2px 12px; }

.portada, .lomo {
  position: absolute; top: 0; height: var(--lh);
  backface-visibility: hidden; -webkit-backface-visibility: hidden;
  opacity: var(--op, 1); transition: opacity 420ms ease;
}
.portada {
  left: 0; width: var(--lw); padding: 18px 18px 16px 24px;
  display: flex; flex-direction: column; text-align: left; overflow: hidden;
  border-radius: 2px 6px 6px 2px; background: var(--c-fondo); color: var(--c-tinta);
  box-shadow: 0 16px 26px -16px rgba(0, 0, 0, .5);
}
.libro.activo .portada { box-shadow: 0 34px 46px -22px rgba(0, 0, 0, .55), 0 2px 6px rgba(0, 0, 0, .18); }
.portada::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 9px; background: var(--c-lomo); border-right: 1px solid var(--c-linea); }
.portada-cab { display: flex; justify-content: flex-end; font: 600 10px/1 var(--mono); letter-spacing: .16em; text-transform: uppercase; }
.portada.con-imagen { padding: 0; background: var(--c-lomo); }
.portada.con-imagen img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; pointer-events: none; -webkit-user-drag: none; }
.portada.con-imagen::before { z-index: 1; opacity: .85; }   /* el filete del lomo queda sobre la imagen */
.portada .greca { width: 100%; height: 14px; margin-top: 12px; color: var(--c-linea); }
.portada-raya { height: 1px; margin-top: 6px; background: var(--c-linea); }
.portada-titulo { margin-top: auto; display: flex; flex-direction: column; gap: 8px; }
.portada-clave { font: 600 40px/1 var(--mono); letter-spacing: .04em; overflow-wrap: anywhere; }
.portada-nombre { font-size: 15px; font-weight: 700; line-height: 1.25; }
.portada-pie {
  margin-top: 16px; padding-top: 10px; border-top: 1px solid var(--c-linea);
  display: flex; justify-content: space-between; gap: 8px;
  font: 500 10px/1.2 var(--mono); letter-spacing: .06em; text-transform: uppercase;
}

.lomo {
  width: var(--ld); padding: 12px 0;
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  background: var(--c-lomo); color: var(--c-tinta);
}
.lomo-izq { left: calc(var(--ld) * -1); transform-origin: right center; transform: rotateY(-90deg); border-radius: 3px 0 0 3px; }
.lomo-der { left: var(--lw); transform-origin: left center; transform: rotateY(90deg); border-radius: 0 3px 3px 0; }
.lomo .filete { display: block; width: 24px; height: 2px; background: var(--c-linea); flex: none; }
.lomo .filete + .filete { margin-top: -6px; }
.lomo-clave { writing-mode: vertical-rl; font: 600 14px var(--mono); letter-spacing: .14em; }
.lomo-hueco { flex: 1; }
.lomo-estado { width: 12px; height: 12px; border-radius: 6px; border: 2px solid var(--c-tinta); flex: none; }
.lomo-estado.estado-local { background: var(--c-tinta); }
.lomo-estado.estado-pendiente { background: var(--oro-claro); }

.flecha {
  position: absolute; top: calc(46px + var(--lh) / 2 - 26px); z-index: 200;
  width: 52px; height: 52px; border-radius: 26px;
  display: grid; place-items: center;
  background: var(--superficie); color: var(--tinta); border: 1px solid var(--borde);
}
.flecha.ant { left: 12px; }
.flecha.sig { right: 12px; }
@media (min-width: 1280px) and (min-height: 760px) {
  .carrusel { --lw: 250px; --lh: 357px; --ld: 44px; }
  .flecha.ant { left: max(12px, calc(50% - 480px)); }
  .flecha.sig { right: max(12px, calc(50% - 480px)); }
}
.flecha:disabled { opacity: .4; cursor: default; }

.puntos { display: flex; justify-content: center; gap: 0; margin-top: -10px; min-height: 44px; }
.puntos button { width: 44px; height: 44px; padding: 0; border: 0; background: transparent; display: grid; place-items: center; }
.puntos i { display: block; width: 6px; height: 6px; border-radius: 3px; background: var(--punto); }
.puntos [aria-current="true"] i { width: 22px; background: var(--verde); }

.sin-resultados { padding: 56px 16px; display: flex; flex-direction: column; align-items: center; gap: 14px; text-align: center; }
.sin-resultados b { font-size: 18px; }
.sin-resultados p { margin: 0; font-size: 14px; color: var(--tinta-3); }

@media (max-width: 699px) {
  /* Teléfono: estante más bajo (unos 100 px menos) para que "Continuar" y "Abrir visor"
     aparezcan sin desplazar */
  .carrusel { --lw: 140px; --lh: 200px; --ld: 26px; height: calc(var(--lh) + 74px); }
  .carrusel .pista { top: 20px; }
  .carrusel .repisa { top: calc(var(--lh) + 38px); }
  .carrusel .piso { top: calc(var(--lh) + 44px); width: 260px; margin-left: -130px; }
  .flecha { top: calc(20px + var(--lh) / 2 - 22px); }
  .estante { padding-top: 14px; }
  .portada { padding: 12px 12px 10px 18px; }
  .portada-clave { font-size: 26px; }
  .portada-nombre { font-size: 12px; }
  .portada .greca { margin-top: 8px; }
  .flecha { width: 44px; height: 44px; }
  .flecha.ant { left: 4px; }
  .flecha.sig { right: 4px; }
  .biblio { padding: 0 14px; }
  .cabecera { padding-left: 14px; padding-right: 14px; }
  .cabecera .cab-der { width: 100%; margin-left: 0; justify-content: flex-end; }   /* sin pastilla, los botones quedan a la derecha */
  .cabecera .marca-app + .cab-der { width: auto; margin-left: auto; }   /* activación: solo el botón de tema */
  .pastilla { flex: 0 1 auto; min-width: 0; margin-right: auto; white-space: nowrap; overflow: hidden; }
  .pastilla > span:last-child { min-width: 0; }
  .pastilla b, .pastilla small { overflow: hidden; text-overflow: ellipsis; }
}

.det-indice-cab { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: -6px; }
.det-indice-cab span:first-child { font-size: 12px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--etiqueta); }
.det-indice-cab span:last-child { font-size: 12px; font-variant-numeric: tabular-nums; color: var(--tinta-3); }
.det-indice { display: flex; flex-direction: column; gap: 0; }
.det-fila {
  min-height: 48px; display: flex; align-items: center; gap: 14px;
  padding: 8px 10px; border-radius: 8px; border-bottom: 1px solid var(--raya);
}
.det-fila:hover { background: var(--superficie-2); }
.det-fila .c { flex: 0 0 64px; font: 600 13px var(--mono); color: var(--etiqueta); }
.det-fila .t { flex: 1; min-width: 0; font-size: 14px; font-weight: 600; line-height: 1.3; }
.det-fila .p { font-size: 12px; font-variant-numeric: tabular-nums; color: var(--tinta-3); white-space: nowrap; }
.det-mas { font-size: 14px; font-weight: 600; color: var(--etiqueta); padding: 10px; min-height: 44px; display: flex; align-items: center; gap: 6px; }
.det-mas svg { width: 18px; height: 18px; }

/* Columna lateral: buscar dentro del manual + contenido (debajo del estante en pantallas angostas) */
.lateral {
  max-width: 1280px; margin: 18px auto 0; padding: 20px;
  display: flex; flex-direction: column; gap: 14px;
  background: var(--superficie); border: 1px solid var(--borde); border-radius: 12px;
}
.lat-buscar {
  display: flex; align-items: center; gap: 8px; min-height: 48px; padding: 0 12px;
  border: 1px solid var(--borde-campo); border-radius: 12px; background: var(--campo);
}
.lat-buscar:focus-within { border-color: var(--oro); box-shadow: 0 0 0 3px var(--resalte); }
.lat-buscar > svg { width: 18px; height: 18px; color: var(--tinta-3); }
.lat-buscar input { flex: 1; min-width: 0; height: 46px; border: 0; outline: none; background: transparent; font-size: 15px; }
.lat-indice { display: flex; flex-direction: column; gap: 14px; }
/* Filas del contenido en columna angosta: clave a la izquierda; título y página uno sobre otro */
.lateral .det-fila { display: grid; grid-template-columns: 52px minmax(0, 1fr); column-gap: 10px; row-gap: 2px; align-items: baseline; }
.lateral .det-fila .c { grid-row: 1 / span 2; }
.lateral .det-fila .t { grid-column: 2; }
.lateral .det-fila .p { grid-column: 2; }
/* Resultados compactos para una columna angosta */
.lat-res .seccion { margin-top: 4px; }
.lat-res .seccion + .seccion { margin-top: 18px; }
.lat-res .seccion > h2 { font-size: 11px; }
.lat-res .fila { flex-direction: column; align-items: flex-start; gap: 4px; min-height: 0; padding: 10px 12px; }
.lat-res .fila .cod { min-width: 0; padding: 2px 6px; font-size: 12px; }
.lat-res .fila .txt b { font-size: 14px; }
.lat-res .fila .txt small { font-size: 12px; }
.lat-res .fila > svg { display: none; }
.lat-res .nota, .lat-res .aviso-parcial { font-size: 12px; }

/* iPad horizontal y computadora: 3/4 estante · 1/4 buscar y contenido */
@media (min-width: 1000px) {
  .biblio {
    display: grid; grid-template-columns: minmax(0, 3fr) minmax(280px, 1fr);
    column-gap: 24px; align-items: start;
  }
  .biblio > #bRes { grid-column: 1 / -1; grid-row: 1; }
  /* Sin márgenes automáticos: en la rejilla encogerían las piezas a su contenido */
  .biblio > .estante, .biblio > #eFavoritos { max-width: none; margin-left: 0; margin-right: 0; }
  .biblio > .estante { grid-column: 1; grid-row: 1; }
  .biblio > #eFavoritos { grid-column: 1 / -1; grid-row: 2; }
  /* Mide lo mismo que el estante; si el contenido es más largo, se desplaza por dentro
     (contain: size evita que su largo estire la rejilla) */
  .biblio > .lateral {
    grid-column: 2; grid-row: 1; margin: 24px 0 0;
    align-self: stretch; contain: size; overflow: auto;
  }
}


/* Pantalla ancha (iPad horizontal, computadora): la biblioteca cabe completa en la pantalla,
   sin desplazar. Los libros crecen o se encogen con el alto disponible (unidades cqh del
   estante); los favoritos van en una sola fila que se desliza de lado. */
@media (min-width: 1000px) and (min-height: 560px) {
  #vista:has(> .biblio) {
    height: 100vh; height: 100dvh; min-height: 0; padding-bottom: 0;
    display: flex; flex-direction: column; overflow: hidden;
  }
  #vista:has(> .biblio) > .cabecera { flex: none; }
  #vista > .biblio {
    flex: 1; min-height: 0;
    grid-template-rows: minmax(0, 1fr) auto; align-items: stretch;
    padding-bottom: calc(14px + env(safe-area-inset-bottom));
  }
  .biblio > #bRes { grid-row: 1 / -1; min-height: 0; overflow: auto; }
  .biblio > .estante { container-type: size; min-height: 0; padding-top: 14px; }
  /* Menos aire arriba y abajo de los libros: ese espacio pasa a hacerlos más grandes */
  .estante .carrusel {
    --lh: clamp(140px, calc(100cqh - 150px), 470px);
    --lw: calc(var(--lh) * .7); --ld: calc(var(--lh) * .127);
    height: calc(var(--lh) + 70px);
  }
  .estante .pista { top: 18px; }
  .estante .carrusel .repisa { top: calc(var(--lh) + 34px); }
  .estante .carrusel .piso { top: calc(var(--lh) + 40px); }
  .estante .flecha { top: calc(18px + var(--lh) / 2 - 26px); }
  .biblio > .lateral { margin-top: 14px; }
  .biblio > #eFavoritos { margin-top: 12px; }
  #eFavoritos .lista { display: flex; gap: 8px; overflow-x: auto; background: none; border: 0; border-radius: 0; padding-bottom: 2px; }
  #eFavoritos .fila {
    flex: 0 0 auto; max-width: 340px; min-height: 0; padding: 8px 12px;
    border: 1px solid var(--borde); border-radius: 10px; background: var(--superficie);
  }
  #eFavoritos .fila .cod { min-width: 0; }
  #eFavoritos .fila .txt b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  #eFavoritos .fila .txt small { display: none; }
}

.biblio .seccion { max-width: 1280px; margin: 26px auto 0; }
.busqueda-biblio { padding: 8px 0 40px; }
.busqueda-biblio .fila > svg { width: 18px; height: 18px; flex: none; color: var(--tinta-3); }
button.fila { width: 100%; font: inherit; color: inherit; text-align: left; cursor: pointer; background: none; border: 0; border-top: 1px solid var(--raya); }
button.fila:first-child { border-top: 0; }

/* ───────────────────────── Secciones y listas (vistas internas) ───────────────────────── */
.centro {
  min-height: 70vh;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 20px; padding: 24px 16px;
}
.tarjeta {
  width: 100%; max-width: 480px;
  background: var(--superficie); border: 1px solid var(--borde); border-radius: 16px;
  padding: 24px; box-shadow: var(--sombra);
}
.error { margin: 14px 0 0; padding: 12px 14px; border-radius: 10px; background: var(--error-fondo); color: var(--error-tinta); border: 1px solid var(--guinda); font-size: 14px; }
.nota { margin: 14px 0 0; font-size: 14px; color: var(--tinta-3); text-align: center; }
.sub { color: var(--tinta-3); }
.demo {
  display: inline-block; padding: 3px 10px; border-radius: 99px;
  background: var(--oro-claro); color: #171717; font-size: 12px; font-weight: 700; letter-spacing: .04em;
}

.seccion { margin-top: 22px; }
.seccion > h2 {
  font-size: 12px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase;
  color: var(--etiqueta); margin: 0 0 10px 4px;
}
.lista { background: var(--superficie); border: 1px solid var(--borde); border-radius: 14px; overflow: hidden; }
.fila {
  display: flex; align-items: center; gap: 12px; min-height: 64px;
  padding: 12px 14px; border-top: 1px solid var(--raya);
}
.fila:first-child { border-top: 0; }
.fila:hover, .fila:active { background: var(--superficie-2); }
.fila .cod {
  flex: none; min-width: 78px; padding: 4px 8px; border-radius: 6px; text-align: center;
  background: var(--superficie-2); color: var(--etiqueta); font: 600 13px var(--mono);
}
.fila .txt { flex: 1; min-width: 0; }
.fila .txt b { display: block; font-weight: 600; }
.fila .txt small { display: block; margin-top: 2px; color: var(--tinta-3); font-size: 13px; }
.fila .marcas { display: flex; gap: 4px; color: var(--tinta-3); }
.fila .marcas svg { width: 18px; height: 18px; }
.fila .marcas .fav { color: var(--estrella); fill: currentColor; }
.fila .marcas .leido { color: var(--etiqueta); }
.fila > svg { color: var(--tinta-3); }
.fila mark, .res mark { background: var(--marca-busqueda); color: inherit; border-radius: 3px; padding: 0 1px; }

.migas { display: flex; flex-wrap: wrap; gap: 4px 6px; margin: 14px 4px 0; font-size: 14px; color: var(--tinta-3); }
.migas a { color: var(--etiqueta); font-weight: 600; }

.filtro { position: relative; margin-top: 14px; display: block; }
.filtro svg { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--tinta-3); }
.filtro input {
  width: 100%; min-height: 52px; padding: 12px 14px 12px 46px;
  border: 1px solid var(--borde-campo); border-radius: 12px; background: var(--campo);
  font-size: 16px;
}
.acciones { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }
.vacio { padding: 26px 16px; text-align: center; color: var(--tinta-3); }

/* Buscador */
.ambito { margin-top: 12px; max-width: 100%; overflow-x: auto; }
.res { align-items: flex-start; }
.res .cod { margin-top: 2px; }
.res .txt .frag { color: var(--tinta-2); font-size: 15px; line-height: 1.45; margin-top: 4px; }
.res .txt .frag mark { font-weight: 600; }
.mas-texto { display: flex; align-items: center; gap: 10px; color: var(--etiqueta); font-weight: 600; }
.mas-texto svg { flex: none; }
.aviso-parcial { margin: 0 4px 10px; font-size: 14px; color: var(--tinta-3); }

/* Ajustes */
.ajuste { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px; border-top: 1px solid var(--raya); min-height: 58px; }
.ajuste:first-child { border-top: 0; }
.ajuste span { color: var(--tinta-3); text-align: right; font-size: 15px; }
.segmento { display: inline-flex; padding: 3px; border-radius: 12px; background: var(--superficie-2); }
.segmento button { border: 0; background: transparent; min-height: 40px; padding: 6px 12px; border-radius: 9px; font-size: 15px; font-weight: 600; color: var(--tinta-2); }
.segmento button[aria-pressed="true"] { background: var(--verde); color: var(--sobre-verde); }
.medidor { height: 8px; border-radius: 4px; background: var(--pista); overflow: hidden; margin-top: 8px; }
.medidor i { display: block; height: 100%; background: var(--grafico); }

/* ───────────────────────── Visor ───────────────────────── */
.visor {
  position: fixed; inset: 0; z-index: 60;   /* encima de la cabecera fija de la biblioteca */
  display: flex; flex-direction: column;
  background: var(--visor-fondo);
}
.v-cuerpo { flex: 1; min-height: 0; display: flex; position: relative; }
.v-cuerpo > .v-scroll { flex: 1; min-width: 0; }

/* Cajón de contenido del visor */
.v-indice {
  flex: none; width: 340px; min-height: 0; display: flex; flex-direction: column;
  background: var(--superficie); color: var(--tinta); border-right: 1px solid var(--borde);
}
.v-indice[hidden] { display: none; }
.v-indice-cab { display: flex; align-items: center; justify-content: space-between; padding: 4px 4px 4px 16px; border-bottom: 1px solid var(--raya); }
.v-indice-cab b { font-size: 12px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--etiqueta); }
.v-arbol { flex: 1; overflow: auto; padding: 6px 8px 24px; overscroll-behavior: contain; }
.v-arbol summary, .v-hoja {
  display: flex; align-items: baseline; gap: 10px; width: 100%; min-height: 40px; padding: 9px 10px;
  border: 0; border-radius: 8px; background: none; color: inherit; font: inherit; text-align: left; cursor: pointer;
}
.v-arbol summary { list-style: none; font-weight: 600; }
.v-arbol summary::-webkit-details-marker { display: none; }
.v-arbol summary::before { content: "▸"; flex: none; width: 10px; color: var(--tinta-3); transition: transform .15s; }
.v-arbol details[open] > summary::before { transform: rotate(90deg); }
.v-ramas { margin-left: 14px; padding-left: 8px; border-left: 1px solid var(--raya); }
.v-arbol .c { flex: none; font: 600 12px var(--mono); color: var(--etiqueta); }
.v-arbol .t { flex: 1; min-width: 0; font-size: 14px; line-height: 1.3; }
.v-hoja .p { flex: none; font-size: 12px; color: var(--tinta-3); font-variant-numeric: tabular-nums; }
/* Niveles del árbol: tomo > capítulo > sección se distinguen por tamaño, peso y separación */
.v-arbol .n0 { border-top: 1px solid var(--raya); }
.v-arbol .n0:first-child { border-top: 0; }
.v-arbol .n0 > summary { padding-top: 12px; padding-bottom: 12px; }
.v-arbol .n0 > summary .t { font-size: 15px; font-weight: 700; }
.v-arbol .n0 > summary .c { font-size: 13px; }
.v-arbol .n1 > summary .t { font-weight: 600; }
.v-arbol .n2 > summary .t, .v-arbol .n3 > summary .t { font-weight: 500; color: var(--tinta-2); }
.v-arbol summary:hover, .v-hoja:hover { background: var(--superficie-2); }
.v-hoja[aria-current] { background: var(--resalte); }
.v-hoja[aria-current] .t { font-weight: 700; }
#vIndiceBtn[aria-expanded="true"] { background: rgba(255, 255, 255, .14); }
/* Salir del visor: flecha + "Biblioteca" (en teléfono solo la flecha) */
.v-salir {
  flex: none; display: inline-flex; align-items: center; gap: 4px; height: 44px; padding: 0 12px 0 6px;
  border: 1px solid rgba(255, 255, 255, .22); border-radius: 12px; background: transparent;
  color: #FFFFFF; font-size: 14px; font-weight: 600;
}
.v-salir:hover, .v-salir:active { background: rgba(255, 255, 255, .1); }
@media (max-width: 720px) { .v-salir { width: 44px; padding: 0; justify-content: center; } .v-salir span { display: none; } }
@media (max-width: 1099px) {
  /* Pantalla angosta: el cajón se abre encima del PDF */
  .v-indice { position: absolute; inset: 0 auto 0 0; z-index: 10; width: min(360px, 88vw); box-shadow: 0 0 40px rgba(0, 0, 0, .45); }
}
.v-barra {
  display: flex; align-items: center; gap: 6px;
  padding: calc(6px + env(safe-area-inset-top)) calc(6px + env(safe-area-inset-right)) 6px calc(6px + env(safe-area-inset-left));
  background: var(--verde-hondo); color: #FFFFFF; border-bottom: 2px solid var(--oro);
}
.v-titulo { flex: 1; min-width: 0; }
.v-titulo small { display: block; font-size: 12px; color: rgba(255, 255, 255, .78); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.v-titulo b { display: block; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* Buscar dentro del manual (barra de arriba del visor) */
.v-buscar {
  flex: 0 1 440px; min-width: 0; height: 48px; display: flex; align-items: center; gap: 0;
  padding: 0 2px 0 12px; border-radius: 12px; background: #FFFFFF; color: #111111;
}
.v-buscar:focus-within { box-shadow: 0 0 0 3px var(--oro); }
.v-buscar > svg { width: 18px; height: 18px; color: rgba(17, 17, 17, .55); }
.v-buscar input {
  flex: 1; min-width: 0; height: 100%; padding: 0 8px; border: 0; outline: none;
  background: transparent; color: #111111; font-size: 15px;
}
.v-buscar input::placeholder { color: rgba(17, 17, 17, .55); }
.v-bcuenta { flex: none; padding: 0 4px; font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; color: rgba(17, 17, 17, .65); white-space: nowrap; }
.v-bnav {
  flex: none; width: 44px; height: 44px; display: grid; place-items: center;
  border: 0; border-radius: 8px; background: transparent; color: #111111;
}
.v-bnav svg { width: 20px; height: 20px; }
.v-bnav:disabled { opacity: .3; }
.v-bnav:not(:disabled):active { background: rgba(0, 0, 0, .08); }
#vFav[aria-pressed="true"] { color: var(--oro-claro); }
#vFav[aria-pressed="true"] svg { fill: currentColor; }
.v-scroll {
  flex: 1; overflow: auto; position: relative;
  -webkit-overflow-scrolling: touch; overscroll-behavior: contain;
  touch-action: pan-x pan-y;
}
.paginas { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 12px; min-width: 100%; width: max-content; margin: 0 auto; }
.pag { position: relative; background: #fff; box-shadow: 0 2px 10px rgba(0,0,0,.35); flex: none; }
.pag::after { content: attr(data-n); position: absolute; inset: 0; display: grid; place-items: center; color: #98989A; font-size: 28px; font-weight: 700; }
.pag.lista::after { display: none; }
.pag canvas { display: block; width: 100%; height: 100%; }
.pag .marca {
  position: absolute; display: block; pointer-events: none; border-radius: 2px;
  background: rgba(255, 196, 0, .42); box-shadow: 0 0 0 2px rgba(166, 128, 34, .7);
  mix-blend-mode: multiply;
}
/* Páginas en modo nocturno: el PDF se invierte (blanco → casi negro) y el giro de tono
   conserva los colores de diagramas y logotipos lo más parecidos posible */
.visor.noche .pag { background: #161616; box-shadow: 0 0 0 1px rgba(255, 255, 255, .08); }
.visor.noche .pag::after { color: #4A4A4A; }
.visor.noche .pag canvas { filter: invert(.9) hue-rotate(180deg); }
.visor.noche .pag .marca { mix-blend-mode: screen; background: rgba(98, 205, 180, .5); box-shadow: 0 0 0 2px rgba(145, 218, 199, .85); }
#vNoche[aria-pressed="true"] { color: var(--oro-claro); background: rgba(255, 255, 255, .12); }
#vNoche[aria-pressed="true"] svg { fill: currentColor; }

.v-cargando { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 16px; padding: 24px; text-align: center; color: #fff; font-size: 17px; }
.v-cargando.girando::before {
  content: ""; width: 40px; height: 40px; border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, .25); border-top-color: var(--oro-claro);
  animation: girar .9s linear infinite;
}
@keyframes girar { to { transform: rotate(360deg); } }

.v-pie { position: relative; border-bottom: 0; border-top: 2px solid var(--oro); justify-content: space-between; padding-bottom: calc(6px + env(safe-area-inset-bottom)); }
/* Avance dentro del tema: barra fina encima del filete del pie */
.v-avance { position: absolute; left: 0; right: 0; top: -2px; height: 4px; pointer-events: none; }
.v-avance i { display: block; height: 100%; width: 0; background: var(--oro-claro); transition: width .2s; }
.v-pie .etq { display: flex; flex-direction: column; align-items: flex-start; min-width: 0; max-width: 220px; line-height: 1.15; }
#vSig .etq { align-items: flex-end; text-align: right; }
.v-pie .etq small { font-size: 11px; font-weight: 600; letter-spacing: .04em; color: rgba(255, 255, 255, .7); }
.v-pie .etq b { max-width: 100%; font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.v-pag { flex-direction: column; gap: 0; line-height: 1.2; }
.v-pag small { font-size: 11px; color: rgba(255, 255, 255, .7); white-space: nowrap; }
.v-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-width: 52px; min-height: 52px; padding: 6px 12px; border-radius: 12px;
  border: 0; background: transparent; font-size: 15px; font-weight: 600; color: #FFFFFF;
}
.v-btn:disabled { opacity: .35; }
.v-btn:active { background: rgba(255, 255, 255, .1); }
.v-pag { font-weight: 500; color: rgba(255, 255, 255, .8); font-size: 14px; font-variant-numeric: tabular-nums; }
.v-pag b { color: #FFFFFF; }
.v-zoom { display: flex; gap: 2px; padding: 2px; border-radius: 14px; background: rgba(255, 255, 255, .1); }
.v-zoom .v-btn { font-size: 22px; min-width: 46px; }

@media (max-width: 720px) {
  .fila .cod { min-width: 60px; padding: 4px 6px; font-size: 12px; }
  .v-btn .etq { display: none; }
  header.v-barra { flex-wrap: wrap; }
  .v-buscar { order: 10; flex: 1 1 100%; }            /* en teléfono, renglón propio debajo del título */
  .v-barra .m-chip, .barra .m-chip { min-height: 24px; padding: 1px 6px 1px 9px; font-size: 11px; }
  .v-pie { gap: 2px; }
  .v-pag { padding: 6px 4px; }
}

/* ───────────────────────── Diálogo y aviso ───────────────────────── */
.dialogo {
  border: 1px solid var(--borde); border-radius: 16px; padding: 20px;
  background: var(--superficie); color: var(--tinta); width: min(340px, calc(100vw - 32px));
  box-shadow: var(--sombra);
}
.dialogo::backdrop { background: rgba(0, 0, 0, .5); }
.dialogo label { display: block; font-weight: 700; margin-bottom: 8px; }
.dialogo input { width: 100%; min-height: 52px; padding: 10px 14px; font: 600 22px var(--mono); border: 1px solid var(--borde-campo); border-radius: 12px; background: var(--campo); }
.dialogo-botones { display: flex; gap: 10px; justify-content: flex-end; margin-top: 16px; }
.dialogo-abrir { width: min(420px, calc(100vw - 32px)); }
.dialogo-abrir form { display: flex; flex-direction: column; gap: 10px; }
.d-titulo { margin: 0 0 6px; font-size: 18px; font-weight: 700; }
.d-opcion { flex-direction: column; align-items: flex-start; gap: 2px; padding: 12px 16px; text-align: left; }
.d-opcion small { max-width: 100%; font-size: 13px; font-weight: 500; opacity: .85; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.d-cancelar { align-self: flex-end; }

.aviso {
  position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom)); z-index: 40;
  transform: translateX(-50%); opacity: 0; pointer-events: none;
  max-width: calc(100vw - 32px); padding: 12px 18px; border-radius: 12px;
  background: var(--verde-hondo); color: #FFFFFF; border: 1px solid var(--oro-claro);
  font-size: 15px; font-weight: 500; box-shadow: var(--sombra);
}
.aviso.visible { opacity: 1; }
.aviso.error { background: var(--guinda-honda); border-color: var(--guinda); }
body.con-visor .aviso { bottom: calc(76px + env(safe-area-inset-bottom)); }

/* La única animación de la app es el giro del estante; se apaga si el sistema lo pide */
@media (prefers-reduced-motion: reduce) {
  *, .libro { transition: none !important; animation: none !important; }
  .v-cargando.girando::before { display: none; }
}

.fav-vacio { margin: 8px 4px 0; display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--tinta-3); }
.fav-vacio svg { width: 18px; height: 18px; flex: none; color: var(--etiqueta); }

/* Pastilla de estado dentro de la cabecera: solo aparece con avisos; un renglón compacto.
   El área táctil sigue siendo de 44 px (borde transparente alrededor del fondo visible). */
.cabecera .pastilla {
  height: 44px; padding: 0 14px 0 9px; gap: 8px; font-size: 13px;
  background: rgba(255, 255, 255, .08) padding-box; color: #FFFFFF;
  border: 5px solid transparent; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .22);
}
.cabecera .pastilla b { font-weight: 600; white-space: nowrap; }
.cabecera .pastilla .pt-ico { width: 20px; height: 20px; }
.cabecera .pastilla:hover { background-color: rgba(255, 255, 255, .14); }
.cabecera .pastilla small { color: rgba(255, 255, 255, .7); }
.cabecera .pastilla .pt-ico { background: var(--oro); color: var(--sobre-oro); }
.cabecera .pastilla.alerta { box-shadow: inset 0 0 0 1px rgba(255, 160, 180, .55); }
.cabecera .pastilla.alerta .pt-ico { background: var(--guinda); color: #FFFFFF; }
.cabecera .pastilla.alerta small { color: #F6C9D4; }
