/* GuiaMental — chat flotante (asistente). Todo bajo #gm. */
#gm .gm-chat{--chat-z:70}

/* Botón redondo */
#gm .gm-chat-fab{position:fixed;right:16px;bottom:calc(16px + env(safe-area-inset-bottom));z-index:var(--chat-z);
  width:60px;height:60px;border-radius:50%;border:0;padding:0;cursor:pointer;display:grid;place-items:center;
  background:var(--teal);box-shadow:0 14px 30px -12px rgba(15,68,72,.75),0 0 0 4px rgba(255,226,176,.55);
  transition:transform .25s,background .2s,bottom .4s;animation:gm-pop .5s .6s cubic-bezier(.2,.9,.3,1.2) both}
#gm .gm-chat-fab:hover{background:var(--teal-d);transform:scale(1.06)}
#gm .gm-chat-fab-dove{width:36px;height:26px;display:block}
#gm .gm-chat-fab svg,#gm .gm-chat-ava svg{width:100%;height:100%;display:block;overflow:visible}
#gm .gm-sticky.is-on ~ .gm-chat .gm-chat-fab,#gm .gm-sticky.is-on ~ .gm-chat .gm-chat-tease{bottom:calc(86px + env(safe-area-inset-bottom))}
#gm .gm-chat.is-open .gm-chat-fab{transform:scale(.9)}

/* Aviso "¿Te ayudo…?" */
#gm .gm-chat-tease{position:fixed;right:86px;bottom:calc(26px + env(safe-area-inset-bottom));z-index:var(--chat-z);
  display:flex;align-items:center;background:#fff;border:1px solid var(--line);border-radius:18px 18px 4px 18px;
  box-shadow:0 16px 34px -18px rgba(22,53,58,.5);animation:gm-pop .45s cubic-bezier(.2,.9,.3,1.2) both;transition:bottom .4s}
#gm .gm-chat-tease[hidden]{display:none}
#gm .gm-chat-tease-txt{border:0;background:none;padding:10px 4px 10px 14px;font:700 .9rem/1.3 var(--ff-b);color:var(--teal-deep);cursor:pointer;text-align:left}
#gm .gm-chat-tease-x{border:0;background:none;width:34px;height:38px;font:400 1.3rem/1 var(--ff-b);color:var(--muted);cursor:pointer}

/* Panel */
#gm .gm-chat-panel{position:fixed;left:0;right:0;bottom:0;z-index:calc(var(--chat-z) + 1);
  height:86vh;height:min(86dvh,640px);display:flex;flex-direction:column;
  background:var(--cream);border-radius:24px 24px 0 0;box-shadow:0 -20px 60px -20px rgba(22,53,58,.5);
  opacity:0;transform:translateY(24px);transition:opacity .22s ease,transform .22s ease}
#gm .gm-chat-panel[hidden]{display:none}
#gm .gm-chat.is-open .gm-chat-panel{opacity:1;transform:none}

#gm .gm-chat-head{display:flex;align-items:center;gap:12px;padding:14px 12px 14px 16px;background:#fff;border-bottom:1px solid var(--line);border-radius:24px 24px 0 0}
#gm .gm-chat-ava{flex:none;width:44px;height:44px;border-radius:50%;padding:10px 6px;background:radial-gradient(circle at 50% 45%,#fff3dc,var(--peach) 75%);box-shadow:0 0 18px rgba(255,226,176,.9)}
#gm .gm-chat-who{flex:1;display:flex;flex-direction:column;line-height:1.2}
#gm .gm-chat-who b{font:600 1.15rem var(--ff-d);color:var(--teal-deep)}
#gm .gm-chat-who small{font-size:.8rem;color:var(--muted);display:flex;align-items:center;gap:6px}
#gm .gm-chat-who small::before{content:"";width:8px;height:8px;border-radius:50%;background:#3fb1a8}
#gm .gm-chat-close{width:44px;height:44px;border-radius:50%;border:0;background:var(--sand);color:var(--teal-deep);font:400 1.6rem/1 var(--ff-b);cursor:pointer}
#gm .gm-chat-close:hover{background:var(--peach)}

/* Conversación */
#gm .gm-chat-log{flex:1;overflow-y:auto;overscroll-behavior:contain;padding:16px 14px 8px;display:flex;flex-direction:column;gap:8px}
#gm .gm-chat-msg{max-width:86%;padding:11px 14px;border-radius:18px;font-size:.95rem;line-height:1.5;animation:gm-rise .3s ease both;overflow-wrap:anywhere}
#gm .gm-chat-msg.is-bot{align-self:flex-start;background:#fff;border:1px solid var(--line);border-bottom-left-radius:6px;color:var(--ink)}
#gm .gm-chat-msg.is-user{align-self:flex-end;background:var(--teal);color:#fff;border-bottom-right-radius:6px}
#gm .gm-chat-msg b{color:var(--teal-deep)}
#gm .gm-chat-msg.has-card{max-width:94%;width:100%}
#gm .gm-chat-typing{display:flex;gap:5px;padding:14px 16px}
#gm .gm-chat-typing i{width:7px;height:7px;border-radius:50%;background:var(--teal);opacity:.35;animation:gm-chat-dot 1s ease-in-out infinite}
#gm .gm-chat-typing i:nth-child(2){animation-delay:.15s}
#gm .gm-chat-typing i:nth-child(3){animation-delay:.3s}

/* Botones dentro de un mensaje */
#gm .gm-chat-acts{display:flex;flex-wrap:wrap;gap:8px;margin-top:10px}
#gm .gm-chat-acts .gm-btn{flex:1 1 auto;min-height:40px}

/* Tarjeta de guía */
#gm .gm-chat-card{display:grid;grid-template-columns:72px 1fr;gap:6px 12px;align-items:center}
#gm .gm-chat-card img{width:72px;height:90px;object-fit:cover;border-radius:12px;grid-row:span 1}
#gm .gm-chat-card-body{display:flex;flex-direction:column;gap:3px;font-size:.86rem;color:var(--muted)}
#gm .gm-chat-card-body b{font:600 1.08rem/1.2 var(--ff-d)}
#gm .gm-chat-card-body strong{color:var(--teal-deep);font-size:.9rem}
#gm .gm-chat-card .gm-chat-acts{grid-column:1/-1;margin-top:4px}

/* Respuestas rápidas */
#gm .gm-chat-chips{display:flex;flex-wrap:wrap;justify-content:flex-end;gap:8px;margin:2px 0 4px;animation:gm-rise .35s ease both}
#gm .gm-chat-chip{min-height:40px;padding:8px 14px;border-radius:999px;border:1.5px solid var(--teal);background:#fff;color:var(--teal-d);
  font:700 .88rem/1.25 var(--ff-b);cursor:pointer;text-align:left;transition:background .2s,color .2s,transform .2s}
#gm .gm-chat-chip:hover{background:var(--teal);color:#fff;transform:translateY(-1px)}

/* Escribir */
#gm .gm-chat-form{display:flex;align-items:flex-end;gap:8px;padding:10px 12px 6px;background:#fff;border-top:1px solid var(--line)}
#gm .gm-chat-form textarea{flex:1;min-height:44px;max-height:110px;margin:0;padding:11px 14px;resize:none;border-radius:22px;font-size:16px;line-height:1.35}
#gm .gm-chat-send{flex:none;width:44px;height:44px;border-radius:50%;border:0;background:var(--teal);color:#fff;cursor:pointer;display:grid;place-items:center;transition:background .2s,transform .2s}
#gm .gm-chat-send:hover{background:var(--teal-d);transform:scale(1.06)}
#gm .gm-chat-send svg{width:20px;height:20px}
#gm .gm-chat-note{margin:0;padding:2px 12px calc(8px + env(safe-area-inset-bottom));background:#fff;text-align:center;font-size:.72rem;color:var(--muted)}

@keyframes gm-chat-dot{0%,100%{opacity:.3;transform:translateY(0)}50%{opacity:1;transform:translateY(-3px)}}

/* En celular, la página no se mueve detrás del chat abierto */
@media (max-width:699px){
  html.gm-chat-lock,html.gm-chat-lock body{overflow:hidden}
}
/* Tablet y escritorio: ventana flotante */
@media (min-width:700px){
  #gm .gm-chat-fab{right:24px;bottom:24px}
  #gm .gm-chat-tease{right:96px;bottom:34px}
  #gm .gm-chat-panel{left:auto;right:24px;bottom:96px;width:390px;height:min(620px,calc(100vh - 130px));border-radius:24px;
    border:1px solid var(--line);box-shadow:0 30px 70px -28px rgba(22,53,58,.55);transform-origin:bottom right;transform:translateY(12px) scale(.96)}
  #gm .gm-chat-note{border-radius:0 0 24px 24px}
}
