/* Xera · Panel de automatismos. Oscuro, sin dependencias ni fuentes externas. */
:root {
  --fondo: #0b0f14;
  --fondo-2: #0f151c;
  --superficie: #141b23;
  --superficie-2: #1a232d;
  --borde: #253140;
  --borde-fuerte: #34445a;
  --texto: #e8edf2;
  --tenue: #93a1b1;
  --acento: #5eb6ff;
  --acento-2: #8c7dff;
  --acento-texto: #06111c;
  --trabajando: #5eb6ff;
  --aprobacion: #ffc35c;
  --hecho: #5fd39a;
  --pausa: #8a96a6;
  --mal: #ff8a8a;
  --radio: 14px;
  --sombra: 0 1px 0 rgb(255 255 255 / 3%) inset, 0 8px 30px rgb(0 0 0 / 35%);
  --chat-ancho: 380px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body.panel {
  min-height: 100vh;
  background:
    radial-gradient(1200px 600px at 15% -10%, rgb(94 182 255 / 10%), transparent 60%),
    radial-gradient(900px 500px at 100% 0%, rgb(140 125 255 / 9%), transparent 60%),
    var(--fondo);
  color: var(--texto);
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
button, input { font: inherit; color: inherit; }
.tenue { color: var(--tenue); }
.oculto { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
:focus-visible { outline: 2px solid var(--acento); outline-offset: 2px; }

/* ── aviso de honestidad ── */
.aviso {
  display: flex; gap: 10px; align-items: center; justify-content: center;
  padding: 8px 16px; font-size: 13px; text-align: center;
  background: rgb(255 195 92 / 10%); color: #ffd994; border-bottom: 1px solid rgb(255 195 92 / 25%);
}
.aviso strong { color: #ffe3ad; }
.aviso-punto { width: 8px; height: 8px; border-radius: 50%; background: var(--aprobacion); flex: none; }

/* ── cabecera ── */
.cabecera {
  display: flex; align-items: center; gap: 16px; padding: 12px 24px;
  border-bottom: 1px solid var(--borde); background: rgb(11 15 20 / 70%);
  position: sticky; top: 0; z-index: 5; backdrop-filter: blur(8px);
}
.marca { display: flex; align-items: center; gap: 12px; min-width: 0; }
.marca-texto { display: flex; flex-direction: column; min-width: 0; }
.marca-texto strong { font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.marca-texto span { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.logo, .avatar {
  display: grid; place-items: center; flex: none; width: 36px; height: 36px; border-radius: 10px;
  font-weight: 800; color: var(--acento-texto);
  background: linear-gradient(135deg, var(--acento), var(--acento-2));
  box-shadow: 0 0 24px rgb(94 182 255 / 30%);
}
.sectores {
  display: flex; gap: 4px; padding: 4px; margin-left: auto;
  background: var(--superficie); border: 1px solid var(--borde); border-radius: 999px;
}
.sectores button {
  min-height: 36px; padding: 6px 16px; border: 0; border-radius: 999px; background: transparent;
  color: var(--tenue); cursor: pointer; font-weight: 600;
}
.sectores button[aria-checked="true"] { background: var(--superficie-2); color: var(--texto); box-shadow: 0 0 0 1px var(--borde-fuerte) inset; }
.cabecera-der { display: flex; align-items: center; gap: 10px; }
.idiomas { display: flex; gap: 2px; font-size: 12px; font-weight: 600; }
.idiomas a { display: inline-flex; align-items: center; min-height: 32px; padding: 0 8px; border-radius: 999px; color: var(--tenue); text-decoration: none; }
.idiomas a[aria-current="true"] { background: var(--superficie-2); color: var(--texto); box-shadow: 0 0 0 1px var(--borde-fuerte) inset; }
.motor {
  font-size: 12px; padding: 4px 10px; border-radius: 999px; border: 1px solid var(--borde); color: var(--tenue);
  white-space: nowrap;
}

.boton {
  min-height: 40px; padding: 8px 16px; border-radius: 10px; border: 1px solid transparent; cursor: pointer;
  background: var(--acento); color: var(--acento-texto); font-weight: 650;
}
.boton:hover { filter: brightness(1.08); }
.boton:disabled { opacity: .5; cursor: default; }
.boton.fantasma { background: transparent; color: var(--texto); border-color: var(--borde); }
.boton.fantasma:hover { border-color: var(--borde-fuerte); background: var(--superficie); }
.boton.chico { min-height: 32px; padding: 4px 12px; font-size: 13px; }
.boton.ok { background: var(--hecho); color: #04140c; }
.boton.peligro { background: transparent; color: var(--mal); border-color: rgb(255 138 138 / 35%); }

/* ── disposición ── */
.disposicion {
  display: grid; grid-template-columns: minmax(0, 1fr) var(--chat-ancho); gap: 20px;
  padding: 20px 24px 24px; max-width: 1600px; margin: 0 auto;
}
.tablero { display: flex; flex-direction: column; gap: 18px; min-width: 0; }

/* ── contadores ── */
.contadores-titulo { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.contadores-titulo h1 { margin: 0; font-size: 22px; letter-spacing: -.01em; }
.kpis { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px; }
.kpi {
  padding: 10px 12px; border-radius: 12px; background: var(--superficie); border: 1px solid var(--borde);
  display: flex; flex-direction: column; gap: 2px;
}
.kpi b { font-size: 24px; font-variant-numeric: tabular-nums; line-height: 1.1; }
.kpi span { font-size: 12px; color: var(--tenue); }
.kpi.salta b { animation: salta .5s ease; }
.kpi.aprobacion b { color: var(--aprobacion); }
.kpi.trabajando b { color: var(--trabajando); }
.kpi.enviados b { color: var(--hecho); }
.kpis-nota { margin: 6px 0 0; font-size: 12px; }
.cartera { margin-top: 8px; font-size: 13px; border: 1px solid var(--borde); border-radius: 10px; background: var(--superficie); }
.cartera summary { cursor: pointer; padding: 7px 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cartera summary span { color: var(--tenue); }
.cartera ul { margin: 0; padding: 2px 14px 10px 30px; display: grid; gap: 4px; line-height: 1.45; }
@keyframes salta { 0% { transform: translateY(0); } 40% { transform: translateY(-3px); color: #fff; } 100% { transform: none; } }

/* ── cuando no queda nada en marcha ── */
.fin {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 14px;
  margin-bottom: 14px; padding: 10px 14px; border: 1px solid var(--acento); border-radius: 12px; background: var(--superficie);
}
.fin[hidden] { display: none; }
.fin p { margin: 0; font-size: 14px; }

/* ── tarjetas ── */
.grupo-titulo { grid-column: 1 / -1; margin: 6px 0 -4px; font-size: 13px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--tenue, #667); }
.tarjetas { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 14px; }
.tarjeta {
  position: relative; display: flex; flex-direction: column; gap: 10px; padding: 14px;
  background: linear-gradient(180deg, var(--superficie-2), var(--superficie)); border: 1px solid var(--borde);
  border-radius: var(--radio); box-shadow: var(--sombra); transition: border-color .3s, box-shadow .3s, transform .3s;
}
.tarjeta.foco { border-color: var(--acento); box-shadow: 0 0 0 1px var(--acento), 0 0 36px rgb(94 182 255 / 25%); transform: translateY(-2px); }
.tarjeta.e-trabajando { border-color: rgb(94 182 255 / 55%); }
.tarjeta.e-aprobacion { border-color: rgb(255 195 92 / 55%); }
.tarjeta.e-hecho { border-color: rgb(95 211 154 / 40%); }
.tarjeta.pausada { opacity: .72; }
.tarjeta-cab { display: flex; gap: 10px; align-items: flex-start; }
.icono {
  display: grid; place-items: center; width: 38px; height: 38px; border-radius: 10px; flex: none;
  background: rgb(94 182 255 / 12%); color: var(--acento);
}
.e-aprobacion .icono { background: rgb(255 195 92 / 14%); color: var(--aprobacion); }
.e-hecho .icono { background: rgb(95 211 154 / 13%); color: var(--hecho); }
.tarjeta h3 { margin: 0; font-size: 15px; line-height: 1.25; }
.disparador { margin: 2px 0 0; font-size: 12.5px; color: var(--tenue); }
.necesita { margin: 4px 0 0; font-size: 11.5px; color: var(--tenue); opacity: .85; font-style: italic; }
.pastilla {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px; border-radius: 999px; font-size: 12px; font-weight: 650;
  background: var(--superficie); border: 1px solid var(--borde); color: var(--tenue); white-space: nowrap;
}
.pastilla::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pastilla.trabajando { color: var(--trabajando); border-color: rgb(94 182 255 / 40%); }
.pastilla.trabajando::before { animation: late 1s ease-in-out infinite; }
.pastilla.aprobacion { color: var(--aprobacion); border-color: rgb(255 195 92 / 40%); }
.pastilla.hecho { color: var(--hecho); border-color: rgb(95 211 154 / 35%); }
.pastilla.pausa { color: var(--pausa); }
@keyframes late { 50% { opacity: .25; } }

.flujo { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 5px; }
.flujo li { display: flex; gap: 8px; align-items: flex-start; font-size: 13px; color: var(--tenue); }
.flujo li::before {
  content: ""; flex: none; width: 14px; height: 14px; margin-top: 2px; border-radius: 50%;
  border: 1.5px solid var(--borde-fuerte);
}
.flujo li.hecho { color: var(--texto); }
.flujo li.hecho::before { background: var(--hecho); border-color: var(--hecho); box-shadow: inset 0 0 0 3px var(--superficie); }
.flujo li.ahora { color: var(--texto); font-weight: 600; }
.flujo li.ahora::before { border-color: var(--trabajando); border-top-color: transparent; animation: gira .8s linear infinite; }
@keyframes gira { to { transform: rotate(360deg); } }

.barra { height: 4px; border-radius: 4px; background: var(--superficie); overflow: hidden; }
.barra i { display: block; height: 100%; width: 0; border-radius: 4px; transition: width .7s linear;
  background: linear-gradient(90deg, var(--acento), var(--acento-2)); }
.e-aprobacion .barra i { background: var(--aprobacion); }
.e-hecho .barra i { background: var(--hecho); }

.tarjeta-pie { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: auto; }
.tarjeta-pie .boton { min-height: 36px; padding: 6px 12px; font-size: 13px; }
.espacio { flex: 1; }
.interruptor {
  display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 4px; border: 0; background: none;
  cursor: pointer; font-size: 12.5px; color: var(--tenue);
}
.interruptor .riel { position: relative; width: 36px; height: 20px; border-radius: 999px; background: var(--borde-fuerte); transition: background .2s; }
.interruptor .riel::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .2s; }
.interruptor[aria-checked="true"] .riel { background: var(--hecho); }
.interruptor[aria-checked="true"] .riel::after { transform: translateX(16px); }
.ejec { font-size: 12px; color: var(--tenue); }
.espera-texto { margin: 0; font-size: 12.5px; color: var(--aprobacion); }
.espera-texto.reservado { visibility: hidden; }
.boton.llamada { border-color: var(--acento); color: var(--acento); box-shadow: 0 0 0 1px var(--acento); }

/* ── actividad ── */
.actividad h2 { display: flex; align-items: center; gap: 8px; margin: 0 0 8px; font-size: 15px; }
.vivo { width: 8px; height: 8px; border-radius: 50%; background: var(--hecho); box-shadow: 0 0 0 0 rgb(95 211 154 / 60%); animation: pulso 2s infinite; }
@keyframes pulso { 70% { box-shadow: 0 0 0 8px rgb(95 211 154 / 0%); } 100% { box-shadow: 0 0 0 0 rgb(95 211 154 / 0%); } }
.feed { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; max-height: 260px; overflow: auto;
  background: var(--superficie); border: 1px solid var(--borde); border-radius: var(--radio); padding: 6px; }
.feed:empty { display: none; }
.feed li { display: grid; grid-template-columns: 52px 10px 1fr; gap: 8px; align-items: baseline; padding: 5px 8px; border-radius: 8px; font-size: 13px; }
.feed li.nuevo { animation: entra .5s ease; }
.feed time { color: var(--tenue); font-variant-numeric: tabular-nums; font-size: 12px; }
.feed .punto { width: 8px; height: 8px; border-radius: 50%; background: var(--borde-fuerte); align-self: center; }
.feed .t-paso .punto, .feed .t-inicio .punto { background: var(--trabajando); }
.feed .t-aprobacion .punto { background: var(--aprobacion); }
.feed .t-hecho .punto, .feed .t-envio .punto { background: var(--hecho); }
.feed .t-envio { background: rgb(95 211 154 / 7%); }
.feed .t-pausa .punto, .feed .t-descartado .punto { background: var(--pausa); }
.vacio { margin: 0; font-size: 13px; }
@keyframes entra { from { opacity: 0; transform: translateY(-4px); background: rgb(94 182 255 / 12%); } }

/* ── chat ── */
.chat {
  position: sticky; top: 84px; align-self: start; height: calc(100vh - 140px); min-height: 420px;
  display: flex; flex-direction: column; background: var(--superficie); border: 1px solid var(--borde);
  border-radius: var(--radio); box-shadow: var(--sombra); overflow: hidden;
}
.chat-cabecera { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--borde); }
.chat-cabecera > div { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.chat-estado { font-size: 12px; }
.chat-plegar { display: none; }
.conversacion { list-style: none; margin: 0; padding: 14px; flex: 1; overflow: auto; display: flex; flex-direction: column; gap: 10px; }
.burbuja { max-width: 92%; padding: 9px 12px; border-radius: 14px; font-size: 14px; }
.burbuja p { margin: 0; }
.burbuja p + p { margin-top: 6px; }
.burbuja.xera { align-self: flex-start; background: var(--superficie-2); border: 1px solid var(--borde); border-top-left-radius: 4px; }
.burbuja.yo { align-self: flex-end; background: linear-gradient(135deg, var(--acento), #4a8fe0); color: var(--acento-texto); border-top-right-radius: 4px; }
.burbuja strong { color: #fff; }
.burbuja.yo strong { color: inherit; }
.burbuja.escribiendo::after { content: "▍"; color: var(--acento); animation: late 1s steps(2) infinite; margin-left: 1px; }
.accion { align-self: flex-start; font-size: 12.5px; color: var(--hecho); padding: 2px 4px; }
.accion::before { content: "✓ "; }
.accion.fallo { color: var(--aprobacion); }
.accion.fallo::before { content: "• "; }
.puntos { align-self: flex-start; display: flex; gap: 4px; padding: 12px; }
.puntos i { width: 7px; height: 7px; border-radius: 50%; background: var(--tenue); animation: late 1s infinite; }
.puntos i:nth-child(2) { animation-delay: .15s; } .puntos i:nth-child(3) { animation-delay: .3s; }
.sistema { align-self: center; font-size: 12.5px; color: var(--tenue); text-align: center; }
.chips { display: flex; gap: 6px; padding: 0 14px 10px; overflow-x: auto; scrollbar-width: none; }
.chips button {
  flex: none; min-height: 36px; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--borde-fuerte);
  background: transparent; color: var(--texto); font-size: 13px; cursor: pointer; white-space: nowrap;
}
.chips button:hover { border-color: var(--acento); color: var(--acento); }
.escribir { display: flex; gap: 8px; padding: 10px 14px; border-top: 1px solid var(--borde); }
.escribir input {
  flex: 1; min-width: 0; min-height: 44px; padding: 8px 12px; border-radius: 10px; border: 1px solid var(--borde-fuerte);
  background: var(--fondo-2);
}
.escribir input::placeholder { color: #6f7d8c; }
.escribir .trampa { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
.pie-chat { margin: 0; padding: 0 14px 10px; font-size: 11.5px; }

/* ── modal ── */
.modal {
  position: fixed; z-index: 15; top: 96px; left: 24px; right: calc(var(--chat-ancho) + 44px); margin: 0 auto;
  width: auto; max-width: 680px; max-height: calc(100vh - 120px); padding: 0; border-radius: 16px;
  border: 1px solid var(--borde-fuerte); background: var(--superficie); color: var(--texto); box-shadow: 0 30px 80px rgb(0 0 0 / 60%);
}
.modal[open] { display: flex; flex-direction: column; animation: aparece .25s ease; }
@keyframes aparece { from { opacity: 0; transform: translateY(8px) scale(.98); } }
.modal-cabecera { display: flex; gap: 12px; align-items: flex-start; justify-content: space-between; padding: 16px 18px 10px; }
.modal-cabecera h2 { margin: 2px 0 0; font-size: 18px; }
.modal-tipo { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; }
.cerrar { width: 44px; height: 44px; display: grid; place-items: center; border: 0; background: none; cursor: pointer; color: var(--tenue); border-radius: 10px; }
.cerrar:hover { background: var(--superficie-2); color: var(--texto); }
.modal-cuerpo { padding: 0 18px 12px; overflow: auto; }
.modal-pie { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; padding: 12px 18px 16px; border-top: 1px solid var(--borde); }
.modal-pie:empty { display: none; }
.sello { display: inline-block; padding: 2px 8px; border-radius: 6px; font-size: 11.5px; font-weight: 700; letter-spacing: .04em;
  color: var(--aprobacion); border: 1px solid rgb(255 195 92 / 40%); text-transform: uppercase; }
.sello.ok { color: var(--hecho); border-color: rgb(95 211 154 / 40%); }
.correo-cab { display: grid; grid-template-columns: max-content 1fr; gap: 4px 12px; margin: 0 0 12px; font-size: 13.5px; }
.correo-cab dt { color: var(--tenue); }
.correo-cab dd { margin: 0; overflow-wrap: anywhere; }
.correo-cuerpo { white-space: pre-wrap; font-family: inherit; line-height: 1.5; margin: 0; padding: 14px; border-radius: 10px; background: var(--fondo-2); border: 1px solid var(--borde); font-size: 14px; }
.ficha { display: grid; grid-template-columns: max-content 1fr; gap: 0; margin: 0; border: 1px solid var(--borde); border-radius: 10px; overflow: hidden; }
.ficha dt, .ficha dd { padding: 9px 12px; margin: 0; border-bottom: 1px solid var(--borde); font-size: 14px; }
.ficha dt { color: var(--tenue); background: var(--fondo-2); }
.ficha dd { overflow-wrap: anywhere; }
.ficha dt:nth-last-of-type(1), .ficha dd:last-of-type { border-bottom: 0; }
.cita { display: flex; gap: 16px; align-items: center; padding: 14px; border-radius: 12px; background: var(--fondo-2); border: 1px solid var(--borde); }
.cita-dia { display: grid; place-items: center; min-width: 96px; padding: 10px; border-radius: 10px; text-align: center;
  background: linear-gradient(135deg, rgb(94 182 255 / 20%), rgb(140 125 255 / 20%)); }
.cita-dia b { font-size: 22px; }
.cita-datos p { margin: 2px 0; font-size: 14px; }
.tabla-envoltura { overflow-x: auto; border: 1px solid var(--borde); border-radius: 10px; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--borde); vertical-align: top; }
th { color: var(--tenue); font-weight: 600; background: var(--fondo-2); }
tr:last-child td { border-bottom: 0; }
td.falta { color: var(--aprobacion); }
td.ok { color: var(--hecho); }
.pdf { display: grid; grid-template-columns: 200px 1fr; gap: 16px; align-items: start; }
.pdf img { width: 100%; border-radius: 6px; border: 1px solid var(--borde); background: #fff; min-height: 120px; }
.pdf .total { font-size: 22px; font-weight: 750; margin: 6px 0; }
.nota { margin: 12px 0 0; font-size: 12.5px; color: var(--tenue); }
.mensaje-titulo { margin-top: 14px; }
.titular-xera { margin: 0 0 14px; font-size: 24px; line-height: 1.25; font-weight: 700; }
.modal-cuerpo .para { margin: 0 0 10px; font-size: 13px; color: var(--tenue); }

.error-global {
  position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); z-index: 30; margin: 0;
  padding: 10px 16px; border-radius: 10px; background: #3a1717; color: #ffd2d2; border: 1px solid #6b2a2a;
}

/* ── pantallas medianas ── */
@media (max-width: 1180px) {
  .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  :root { --chat-ancho: 340px; }
}

/* con los enlaces de la web la cabecera va justa: la chapa del motor ya la repite el pie del chat */
@media (min-width: 821px) and (max-width: 1500px) {
  .enlaces:not([hidden]) ~ .cabecera-der .motor { display: none; }
  .cabecera { gap: 12px; padding-inline: 16px; }
}
@media (min-width: 821px) and (max-width: 1100px) {
  .cabecera { flex-wrap: wrap; }
}
@media (max-width: 420px) {
  .chat-cabecera:has(#btn-seguir:not([hidden])) > div { visibility: hidden; }
}

/* ── móvil: el chat es un panel inferior que se amplía ── */
@media (max-width: 820px) {
  .cabecera { flex-wrap: wrap; padding: 10px 14px; gap: 10px; position: static; }
  .sectores { order: 3; margin-left: 0; width: 100%; }
  /* cada pestaña crece según su texto: «Gestoría y asesoría» tiene que ir en una sola línea */
  .sectores button { flex: 1 1 auto; padding-inline: 8px; white-space: nowrap; }
  .cabecera-der { margin-left: auto; }
  .motor { display: none; }
  /* la cabecera no va fija en móvil: el botón fijo es el del chat */
  .enlaces { order: 4; width: 100%; justify-content: space-between; }
  .enlaces .lnk-contacto { display: none; }
  a.lnk-contacto-chat:not([hidden]) { display: inline-flex; }
  .chat-cabecera .chat-estado, .solo-ancho { display: none; }
  .chat-cabecera .boton { white-space: nowrap; padding: 4px 10px; font-size: 12.5px; }
  .disposicion { display: block; padding: 14px 14px 0; }
  .tablero { padding-bottom: 260px; }
  .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
  .kpi { padding: 8px; }
  .kpi b { font-size: 20px; }
  .tabla-envoltura.compacta table { font-size: 12px; }
  .tabla-envoltura.compacta :is(th, td) { padding: 7px 4px; }
  .tabla-envoltura.compacta :is(th, td.importe) { white-space: nowrap; }
  .tabla-envoltura.compacta :is(th, td):first-child { padding-left: 8px; }
  .tarjetas { grid-template-columns: 1fr; }
  /* sitio de dos filas desde el principio: «Ver resultado» aparece más tarde y, si no, empuja lo de debajo */
  .tarjeta-pie { min-height: 88px; align-content: flex-start; }
  .tarjeta.foco { transform: none; }
  .chat {
    position: fixed; left: 0; right: 0; bottom: 0; top: auto; z-index: 20; height: 232px; min-height: 0;
    border-radius: 16px 16px 0 0; border-bottom: 0; transition: height .3s ease;
    padding-bottom: env(safe-area-inset-bottom);
  }
  .chat.abierto { height: calc(100vh - 60px); height: calc(100dvh - 60px); }
  .chat-cabecera { padding: 8px 12px; }
  .chat-plegar {
    display: grid; place-items: center; width: 44px; height: 44px; border: 0; background: none; color: var(--tenue); cursor: pointer;
  }
  .chat-plegar svg { transition: transform .3s; }
  .chat.abierto .chat-plegar svg { transform: rotate(180deg); }
  .conversacion { padding: 8px 12px; }
  .chat:not(.abierto) .pie-chat, .chat:not(.abierto) .chips { display: none; }
  .chips { padding: 0 12px 6px; }
  .escribir { padding: 8px 12px; }
  .pdf { grid-template-columns: 1fr; }
  .pdf img { max-width: 220px; }
  .modal { top: 12px; left: 12px; right: 12px; max-height: calc(100dvh - 260px); }
}

/* ── contacto ── */
.enlaces { display: flex; align-items: center; gap: 14px; font-size: 13.5px; }
.enlaces[hidden], .lnk-contacto[hidden] { display: none; }
.enlaces a, #btn-reiniciar { white-space: nowrap; }
.enlaces a:not(.boton), .tarjeta-datos a { color: var(--tenue); }
.enlaces a:not(.boton):hover { color: var(--texto); }
a.boton { display: inline-flex; align-items: center; justify-content: center; text-decoration: none; }
a.lnk-contacto-chat { display: none; }
.oferta { align-self: stretch; flex: none; border: 1px solid var(--borde-fuerte); border-radius: 12px; padding: 10px 12px; font-size: 13.5px; }
.oferta p { margin: 0 0 8px; }
.oferta p:last-child { margin-bottom: 0; }
.oferta-botones { display: flex; flex-wrap: wrap; gap: 8px; }
.tarjeta-datos form { display: flex; flex-direction: column; gap: 8px; }
.tarjeta-datos label { display: flex; flex-direction: column; gap: 3px; font-size: 12.5px; color: var(--tenue); }
.tarjeta-datos input:not([type="checkbox"]) { width: 100%; min-height: 34px; padding: 5px 9px; font: inherit; font-size: 16px; color: var(--texto);
  background: var(--superficie); border: 1px solid var(--borde); border-radius: 8px; }
.tarjeta-datos .consentimiento { flex-direction: row; align-items: flex-start; gap: 8px; }
.tarjeta-datos .trampa { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
.tarjeta-datos .tarjeta-aviso:empty { display: none; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* ── Xera en movimiento (logo y avatar del chat): poster debajo, vídeo encima si arranca ── */
.xera-cara {
  position: relative; overflow: hidden; border-radius: 50%; padding: 0;
  background: var(--superficie-2); box-shadow: 0 0 0 1px var(--borde-fuerte), 0 0 24px rgb(94 182 255 / 30%);
}
.xera-cara img, .xera-cara video {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; border-radius: inherit;
}

/* ── WhatsApp de ejemplo ── */
.wa { max-width: 340px; margin: 10px auto; border-radius: 22px; border: 2px solid var(--borde); background: #ece5dd; overflow: hidden; }
.wa-cab { background: #1f7a72; color: #fff; padding: 10px 14px; font-weight: 650; font-size: 14px; }
.wa-ejemplo { background: #b02a2a; color: #fff; text-align: center; font-size: 12px; padding: 3px 8px; }
.wa-burbuja { margin: 12px; padding: 10px 12px; border-radius: 4px 14px 14px 14px; background: #fff; color: #1d2329; font-size: 14px; line-height: 1.45; }
.wa-texto { margin: 0 0 8px; white-space: pre-wrap; }
.wa-baja { margin: 6px 0 0; font-size: 12px; color: #5a636b; }
.wa-permiso { text-align: center; font-size: 13px; color: var(--tenue, #5a636b); margin: 6px 0 0; }
