/* Asistente con IA: botón robot + panel. Solo tokens del sistema. Objetivos táctiles >= 44 px. */
.bot-solo-lectores{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}
.bot-fab{position:fixed;right:20px;bottom:calc(16px + var(--bot-off,0px));z-index:66;width:60px;height:60px;display:grid;place-items:center;padding:0;border-radius:50%;
  background:var(--accion,#85452B);color:var(--accion-t,#fff);border:3px solid var(--papel,#fff);box-shadow:0 6px 20px rgba(1,16,39,.35);cursor:pointer;transition:transform .15s ease,box-shadow .15s ease}
.bot-fab:hover{background:var(--accion-h,#6B3722);transform:translateY(-2px);box-shadow:0 10px 26px rgba(1,16,39,.4)}
.bot-fab::before{content:"";position:absolute;inset:-3px;border-radius:50%;border:2px solid var(--accion,#85452B);opacity:0;pointer-events:none}
.bot-fab:not(.bot-fab--abierto)::before{opacity:.55;animation:bot-fab-halo 2.6s ease-out infinite}
@media (prefers-reduced-motion:reduce){.bot-fab:not(.bot-fab--abierto)::before{animation:none;opacity:0}}
@keyframes bot-fab-halo{0%{transform:scale(1);opacity:.55}100%{transform:scale(1.55);opacity:0}}
.bot-fab:focus-visible,.bot :focus-visible{outline:3px solid var(--tinta,#011027);outline-offset:3px;box-shadow:0 0 0 6px var(--papel,#fff)}
.bot-fab__ia{position:absolute;top:-6px;right:-6px;min-width:24px;height:24px;padding:0 5px;display:grid;place-items:center;border-radius:12px;background:var(--tinta-az,#033F63);color:var(--papel,#fff);font:800 .72rem/1 var(--f-ui,system-ui,sans-serif);border:2px solid var(--papel,#fff)}
body.con-bot .subir{bottom:calc(16px + 72px + var(--bot-off,0px)) !important}
.bot{position:fixed;right:20px;bottom:calc(16px + 72px + var(--bot-off,0px));z-index:67;width:min(410px,calc(100vw - 24px));height:min(640px,calc(100dvh - 120px - var(--bot-off,0px)));display:flex;flex-direction:column;
  background:var(--fondo,#F7F2E6);color:var(--tinta,#011027);border:2px solid var(--tinta-az,#033F63);border-top:6px solid var(--accion,#85452B);border-radius:18px;box-shadow:0 14px 44px rgba(1,16,39,.38);overflow:hidden;font:400 var(--t-1,1.0625rem)/1.45 var(--f-ui,system-ui,sans-serif)}
.bot[hidden]{display:none}
.bot__cab{display:flex;align-items:center;justify-content:space-between;gap:var(--s1,8px);padding:var(--s1,8px) var(--s2,16px);background:var(--papel,#fff);border-bottom:1px solid var(--linea,#C9C0AA)}
.bot__id{display:flex;align-items:center;gap:var(--s1,8px);min-width:0}
.bot__avatar{flex:none;width:44px;height:44px;display:grid;place-items:center;border-radius:50%;background:var(--tinta-az,#033F63);color:var(--papel,#fff)}
.bot h2{margin:0;font:600 var(--t-2,1.2rem)/1.15 var(--f-titulo,Georgia,serif);color:var(--tinta-az,#033F63)}
.bot__cab p{margin:0;font-size:var(--t-0,.875rem);color:var(--tinta-2,#4A4A55)}
.bot__x{flex:none;width:48px;height:48px;border:2px solid var(--tinta-az,#033F63);border-radius:50%;background:transparent;color:var(--tinta-az,#033F63);font:400 1.8rem/1 var(--f-ui,system-ui,sans-serif);cursor:pointer}
.bot__x:hover{background:var(--tinta-az,#033F63);color:var(--papel,#fff)}
.bot__log{flex:1 1 auto;min-height:120px;overflow:auto;padding:var(--s2,16px);display:flex;flex-direction:column;gap:var(--s1,8px);overscroll-behavior:contain}
.bot__msg{max-width:92%;padding:var(--s1,8px) var(--s2,16px);border-radius:14px;background:var(--papel,#fff);border:1px solid var(--linea,#C9C0AA)}
.bot__msg--usuario{align-self:flex-end;background:var(--tinta-az,#033F63);color:var(--papel,#fff);border-color:var(--tinta-az,#033F63)}
.bot__msg p{margin:0 0 6px}
.bot__msg p:last-child{margin-bottom:0}
.bot__quien{font-size:var(--t-0,.8125rem);font-weight:800;letter-spacing:.02em}
.bot__etq{font-size:var(--t-0,.8125rem);color:var(--tinta-2,#4A4A55)}
.bot__sub{font-weight:700;font-size:var(--t-0,.875rem)}
.bot__fuentes{margin:0 0 6px;padding-left:1.1em}
.bot__fuentes li{margin-bottom:6px}
.bot__fuentes a{display:inline;color:var(--tinta-az,#033F63);text-decoration:underline;text-underline-offset:3px;overflow-wrap:anywhere}
.bot__fuentes a:hover{color:var(--accion,#85452B)}
.bot__aviso{padding:6px 10px;background:var(--fondo,#F7F2E6);border-radius:8px;font-size:var(--t-0,.875rem)}
.bot__sug{display:flex;flex-wrap:wrap;gap:var(--s1,8px);padding:0 var(--s2,16px) var(--s1,8px)}
.bot__sug[hidden]{display:none}
.bot__chip{min-height:44px;padding:6px 14px;border:2px solid var(--tinta-az,#033F63);border-radius:999px;background:var(--papel,#fff);color:var(--tinta-az,#033F63);font:600 var(--t-0,.9375rem)/1.2 var(--f-ui,system-ui,sans-serif);text-align:left;cursor:pointer}
.bot__chip:hover{background:var(--tinta-az,#033F63);color:var(--papel,#fff)}
.bot__consent{display:flex;gap:var(--s1,8px);align-items:flex-start;padding:var(--s1,8px) var(--s2,16px);background:var(--papel,#fff);border-top:1px solid var(--linea,#C9C0AA);font-size:var(--t-0,.875rem);line-height:1.35}
.bot__consent input{flex:none;width:24px;height:24px;margin:2px 0 0;accent-color:var(--tinta-az,#033F63)}
.bot__consent label{display:block;min-height:44px;cursor:pointer}
.bot__form{display:flex;gap:var(--s1,8px);padding:var(--s1,8px) var(--s2,16px);background:var(--papel,#fff)}
.bot__form input{flex:1;min-width:0;min-height:48px;padding:0 var(--s2,16px);font:inherit;color:var(--tinta,#011027);background:var(--papel,#fff);border:2px solid var(--tinta-az,#033F63);border-radius:999px}
.bot__enviar{flex:none;min-height:48px;padding:0 var(--s2,16px);border:2px solid var(--accion,#85452B);border-radius:999px;background:var(--accion,#85452B);color:var(--accion-t,#fff);font:700 var(--t-1,1rem)/1 var(--f-ui,system-ui,sans-serif);cursor:pointer}
.bot__enviar:hover:not(:disabled){background:var(--accion-h,#6B3722);border-color:var(--accion-h,#6B3722)}
.bot__enviar:disabled{background:var(--papel-2,#E8E1D0);border-color:var(--tinta-2,#4A4A55);color:var(--tinta,#011027);cursor:progress}
.bot__pie{display:flex;align-items:center;justify-content:space-between;gap:var(--s1,8px);padding:0 var(--s2,16px) var(--s1,8px);background:var(--papel,#fff);font-size:var(--t-0,.875rem)}
.bot__modo{margin:0;color:var(--tinta-2,#4A4A55)}
.bot__nueva{min-height:44px;padding:0 6px;border:0;background:transparent;color:var(--tinta-az,#033F63);font:700 var(--t-0,.875rem) var(--f-ui,system-ui,sans-serif);text-decoration:underline;text-underline-offset:3px;cursor:pointer}
html:is(.a11y-contraste,.a11y-contraste-noche) .bot-fab,html:is(.a11y-contraste,.a11y-contraste-noche) .bot{border-color:var(--tinta)}
@media (max-width:600px){.bot{right:8px;left:8px;width:auto;bottom:calc(8px + var(--bot-off,0px));height:min(86dvh,calc(100dvh - 16px - var(--bot-off,0px)));border-radius:16px}
  .bot-fab--abierto{display:none}}
@media (prefers-reduced-motion:no-preference){.bot:not([hidden]){animation:bot-in .18s ease-out}@keyframes bot-in{from{opacity:0;transform:translateY(8px)}to{opacity:1;transform:none}}}
@media print{.bot,.bot-fab{display:none}}

/* Voz: micrófono, opción de lectura y botón «Escuchar» */
.bot__mic{flex:none;width:48px;height:48px;display:grid;place-items:center;padding:0;border:2px solid var(--tinta-az,#033F63);border-radius:50%;background:var(--papel,#fff);color:var(--tinta-az,#033F63);cursor:pointer}
.bot__mic:hover{background:var(--fondo,#F7F2E6)}
.bot__mic[aria-pressed=true]{background:var(--accion,#85452B);border-color:var(--accion,#85452B);color:var(--accion-t,#fff)}
.bot__voz{padding:0 var(--s2,16px) var(--s1,8px);background:var(--papel,#fff);font-size:var(--t-0,.875rem)}
.bot__auto{display:flex;align-items:flex-start;gap:var(--s1,8px)}
.bot__auto input{flex:none;width:24px;height:24px;margin:2px 0 0;accent-color:var(--tinta-az,#033F63)}
.bot__auto label{display:block;min-height:36px;padding-top:2px;cursor:pointer}
.bot__estado{margin:0;min-height:1.3em;font-weight:700;color:var(--tinta-az,#033F63)}
.bot__nota{margin:2px 0 0;color:var(--tinta-2,#4A4A55);font-size:.8125rem;line-height:1.35}
.bot__oir{min-height:44px;margin-top:6px;padding:0 var(--s2,16px);border:2px solid var(--tinta-az,#033F63);border-radius:999px;background:var(--papel,#fff);color:var(--tinta-az,#033F63);font:700 var(--t-0,.9375rem)/1 var(--f-ui,system-ui,sans-serif);cursor:pointer}
.bot__oir:hover{background:var(--tinta-az,#033F63);color:var(--papel,#fff)}
.bot__oir[aria-pressed=true]{background:var(--accion,#85452B);border-color:var(--accion,#85452B);color:var(--accion-t,#fff)}

/* Llamada al asistente */
.bot__acciones{display:flex;align-items:center;gap:var(--s1,8px);flex:none}
.bot__llamar{min-height:48px;display:inline-flex;align-items:center;gap:6px;padding:0 var(--s2,16px);border:2px solid var(--tinta-az,#033F63);border-radius:999px;background:var(--papel,#fff);color:var(--tinta-az,#033F63);font:700 var(--t-0,.9375rem)/1 var(--f-ui,system-ui,sans-serif);cursor:pointer}
.bot__llamar:hover{background:var(--tinta-az,#033F63);color:var(--papel,#fff)}
.bot__chip--llamar{display:inline-flex;align-items:center;gap:8px;flex:1 1 100%;justify-content:center;background:var(--tinta-az,#033F63);color:var(--papel,#fff)}
.bot__chip--llamar:hover{background:var(--tinta,#011027);border-color:var(--tinta,#011027)}
.bot__call{padding:var(--s2,16px);background:var(--papel,#fff);border-top:1px solid var(--linea,#C9C0AA);display:flex;flex-direction:column;gap:var(--s1,8px)}
.bot__call[hidden]{display:none}
.bot--llamada .bot__sug,.bot--llamada .bot__consent,.bot--llamada .bot__form,.bot--llamada .bot__voz,.bot--llamada .bot__pie{display:none}
.bot--llamada .bot__llamar{display:none}
.bot__call-cab{display:flex;align-items:center;gap:var(--s2,16px)}
.bot__call-t{margin:0;font:600 var(--t-1,1.0625rem)/1.2 var(--f-titulo,Georgia,serif);color:var(--tinta-az,#033F63)}
.bot__call-e{margin:2px 0 0;font-weight:700}
.bot__call-tiempo{margin:0;font-size:var(--t-0,.875rem);color:var(--tinta-2,#4A4A55);font-variant-numeric:tabular-nums}
.bot__call-sub{margin:0;min-height:1.4em;font-style:italic;color:var(--tinta-2,#4A4A55);overflow-wrap:anywhere}
.bot__orbe{flex:none;position:relative;width:64px;height:64px;display:grid;place-items:center;border-radius:50%;background:var(--tinta-az,#033F63);color:var(--papel,#fff)}
.bot__orbe::after{content:"";position:absolute;inset:-6px;border-radius:50%;border:3px solid var(--tinta-az,#033F63);opacity:.35}
[data-estado=habla] .bot__orbe{background:var(--accion,#85452B)}
[data-estado=habla] .bot__orbe::after{border-color:var(--accion,#85452B);opacity:.6}
[data-estado=escucha] .bot__orbe::after{opacity:.9}
[data-estado=silencio] .bot__orbe{background:var(--tinta-2,#4A4A55)}
[data-estado=piensa] .bot__orbe::after{border-style:dashed}
@media (prefers-reduced-motion:no-preference){
  [data-estado=escucha] .bot__orbe::after{animation:bot-pulso 1.6s ease-in-out infinite}
  [data-estado=habla] .bot__orbe::after{animation:bot-pulso .8s ease-in-out infinite}
  [data-estado=piensa] .bot__orbe::after{animation:bot-gira 2.4s linear infinite}
  [data-estado=conectando] .bot__orbe::after{animation:bot-pulso 1.2s ease-in-out infinite}
  @keyframes bot-pulso{0%,100%{transform:scale(1)}50%{transform:scale(1.14)}}
  @keyframes bot-gira{to{transform:rotate(360deg)}}
}
.bot__call-bt{display:flex;flex-wrap:wrap;gap:var(--s1,8px)}
.bot__call-b{min-height:48px;padding:0 var(--s2,16px);border:2px solid var(--tinta-az,#033F63);border-radius:999px;background:var(--papel,#fff);color:var(--tinta-az,#033F63);font:700 var(--t-0,.9375rem)/1 var(--f-ui,system-ui,sans-serif);cursor:pointer}
.bot__call-b:hover{background:var(--fondo,#F7F2E6)}
.bot__call-b[aria-pressed=true]{background:var(--tinta-az,#033F63);color:var(--papel,#fff)}
.bot__call-b[hidden]{display:none}
.bot__call-colgar{margin-left:auto;min-height:48px;display:inline-flex;align-items:center;gap:8px;padding:0 var(--s3,24px);border:2px solid #8E1B12;border-radius:999px;background:#8E1B12;color:#fff;font:800 var(--t-1,1rem)/1 var(--f-ui,system-ui,sans-serif);cursor:pointer}
.bot__call-colgar:hover{background:#6E130C;border-color:#6E130C}
.bot__call-colgar svg{transform:rotate(135deg)}
.bot__call-form{display:flex;gap:var(--s1,8px)}
.bot__call-form input{flex:1;min-width:0;min-height:48px;padding:0 var(--s2,16px);font:inherit;color:var(--tinta,#011027);background:var(--papel,#fff);border:2px solid var(--tinta-az,#033F63);border-radius:999px}

.bot--llamada .bot__log{min-height:170px}
.bot__call{gap:6px;padding:var(--s1,8px) var(--s2,16px) var(--s1,8px)}
.bot__orbe{width:52px;height:52px}
.bot__call-cab{gap:var(--s1,12px)}
.bot__call-bt{flex-wrap:nowrap;gap:6px}
.bot__call-b{min-height:48px;padding:0 12px;white-space:nowrap}
.bot__call-colgar{margin-left:auto;padding:0 var(--s2,16px)}
.bot__call-opc summary{min-height:44px;display:flex;align-items:center;cursor:pointer;font-weight:700;color:var(--tinta-az,#033F63)}
@media (max-width:420px){.bot__call-bt{flex-wrap:wrap}}
.bot__call-cab{gap:20px;padding-left:6px}

/* ======================================================================================
   Rediseño del panel: el historial es lo único que crece; el resto tiene altura fija y pequeña.
   (Antes la suma de bloques fijos superaba la altura del panel y el navegador lo desplazaba,
   tapando la cabecera o la fila de escribir.)
   ====================================================================================== */
.bot{height:min(680px,calc(100dvh - 104px - var(--bot-off,0px)));min-height:340px;font-size:1rem;line-height:1.5;border-radius:20px}
.bot>*{margin-inline:0}
/* cabecera */
.bot__cab{flex:none;min-height:64px;padding:10px 12px 10px 14px;gap:8px;margin:0;border-bottom:1px solid var(--linea,#C9C0AA)}
.bot__id{flex:1;min-width:0;gap:10px}
.bot__id>div{min-width:0}
.bot__avatar{width:40px;height:40px}
.bot h2{font-size:1.125rem;line-height:1.2;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.bot__cab p{font-size:.8125rem;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.bot__x{width:44px;height:44px;font-size:1.6rem}
.bot__llamar{min-height:44px;padding:0 14px}
/* historial */
.bot__log{flex:1 1 0;min-height:0;padding:16px 14px;gap:12px;scroll-padding:12px;background:var(--fondo,#F7F2E6)}
.bot__msg{max-width:94%;padding:12px 14px;border-radius:16px 16px 16px 4px;font-size:1rem;line-height:1.5}
.bot__msg--usuario{border-radius:16px 16px 4px 16px}
.bot__msg p{margin:0 0 8px}
.bot__msg p:last-child{margin-bottom:0}
.bot__quien{font-size:.75rem;letter-spacing:.04em;text-transform:uppercase;opacity:.8}
.bot__etq{font-size:.8125rem}
.bot__fuentes li{margin-bottom:4px}
.bot__fuentes a{overflow-wrap:anywhere}
.bot__aviso{margin-top:8px;font-size:.8125rem}
/* sugerencias: ahora van dentro del historial y se van con él */
.bot__sug{display:flex;flex-direction:column;align-items:flex-start;gap:8px;padding:0;margin:4px 0 0}
.bot__chip{min-height:44px;padding:8px 14px;border-radius:999px;font-size:.9375rem;line-height:1.25;width:auto;max-width:100%}
.bot__chip--llamar{width:100%;min-height:48px;justify-content:center;border-radius:14px}
/* consentimiento: completo hasta aceptarlo; después, dos líneas con «Ver completo» */
.bot__consent{flex:none;gap:10px;align-items:flex-start;padding:10px 14px;font-size:.8125rem;line-height:1.4;border-top:1px solid var(--linea,#C9C0AA)}
.bot__consent input{margin-top:0}
.bot__consent-t{flex:1;min-width:0}
.bot__consent label{min-height:0;display:block}
.bot__consent--min:not(.bot__consent--abierto) label{display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}
.bot__ver{min-height:28px;padding:0 2px;border:0;background:transparent;color:var(--tinta-az,#033F63);font:700 .8125rem/1 var(--f-ui,system-ui,sans-serif);text-decoration:underline;text-underline-offset:3px;cursor:pointer}
.bot__ver[hidden]{display:none}
/* fila de escribir */
.bot__form{flex:none;align-items:center;padding:10px 14px;gap:8px;border-top:1px solid var(--linea,#C9C0AA)}
.bot__form input{min-height:48px;font-size:1rem}
.bot__estado{flex:none;margin:0;padding:0 14px 6px;background:var(--papel,#fff);font-size:.875rem}
.bot__estado:empty{display:none}
/* pie: «Opciones» abre una tarjeta sobre el historial, sin empujar nada */
.bot__pie{flex:none;position:relative;display:flex;align-items:center;justify-content:space-between;gap:8px;margin:0;padding:0 14px 6px;min-height:44px}
.bot__opc summary{min-height:44px;display:flex;align-items:center;gap:6px;cursor:pointer;list-style:none;font:700 .875rem var(--f-ui,system-ui,sans-serif);color:var(--tinta-az,#033F63)}
.bot__opc summary::-webkit-details-marker{display:none}
.bot__opc summary::after{content:"";width:8px;height:8px;border:solid currentColor;border-width:0 2px 2px 0;transform:rotate(45deg) translateY(-2px)}
.bot__opc[open] summary::after{transform:rotate(-135deg) translateY(-2px)}
.bot__opc-c{position:absolute;left:10px;right:10px;bottom:calc(100% + 2px);z-index:3;max-height:55%;overflow:auto;padding:12px 14px;display:flex;flex-direction:column;gap:8px;background:var(--papel,#fff);border:1px solid var(--linea-fuerte,#8A8168);border-radius:14px;box-shadow:0 10px 28px rgba(1,16,39,.25)}
.bot__opc-c .bot__modo{margin:0;font-size:.875rem}
.bot__opc-c .bot__nota{margin:0}
.bot__nueva{min-height:44px;font-size:.875rem}
/* «Redactando…» con puntos */
.bot__msg--espera p:last-child::after{content:"…"}
@media (prefers-reduced-motion:no-preference){
  .bot__msg--espera p:last-child::after{content:"...";display:inline-block;width:0;overflow:hidden;vertical-align:bottom;animation:bot-puntos 1.2s steps(4,end) infinite}
  @keyframes bot-puntos{to{width:1.1em}}
}
/* llamada: bloque más bajo y el resto de controles fuera */
.bot--llamada .bot__consent,.bot--llamada .bot__form,.bot--llamada .bot__estado,.bot--llamada .bot__pie{display:none}
.bot--llamada .bot__log{min-height:0}
.bot__call{flex:none;margin:0;padding:12px 14px;gap:8px}
.bot__call-t{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}
.bot__orbe{width:44px;height:44px}
.bot__orbe::after{inset:-5px;border-width:2px}
.bot__call-cab{gap:16px;padding-left:5px}
.bot__call-e{margin:0}
.bot__call-sub{min-height:1.3em;font-size:.9375rem}
.bot__call-b,.bot__call-colgar{min-height:48px}
.bot__call-opc summary{min-height:44px}

/* teléfonos: hoja a pantalla completa que sigue al teclado */
@media (max-width:600px){
  .bot{left:0;right:0;width:auto;top:var(--bot-vt,0px);bottom:auto;height:var(--bot-vh,100dvh);max-height:none;min-height:0;border:0;border-top:5px solid var(--accion,#85452B);border-radius:0;z-index:200}
  .bot__pie{padding-bottom:calc(6px + env(safe-area-inset-bottom))}
  .bot__call{padding-bottom:calc(12px + env(safe-area-inset-bottom))}
  .bot__msg{max-width:100%}
  .bot__id>div p{display:none}
  .bot__llamar span{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}
  .bot__llamar{width:48px;padding:0;justify-content:center}
  html.bot-abierto,html.bot-abierto body{overflow:hidden}
}
@media (max-width:360px){.bot__consent{font-size:.75rem}}

/* correcciones tras la primera revisión */
.bot__sug{flex-wrap:nowrap;align-items:stretch}
.bot__sug .bot__chip{align-self:flex-start}
.bot__sug .bot__chip--llamar{flex:none;align-self:stretch}
.bot__log{overflow-x:hidden}
/* «Llamar» solo con el icono: así el título cabe entero (el botón grande de la bienvenida lleva el texto) */
.bot__llamar{width:48px;min-height:48px;padding:0;justify-content:center}
.bot__llamar span{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}
.bot h2{font-size:1.0625rem}
.bot__acciones{gap:6px}
.bot__consent{padding:8px 14px}

.bot__opc-c{max-height:min(320px,48dvh)}
