/* Asistente virtual (widget). Tokens del sitio: tinta, arena y camel; Fraunces / Inter. Se carga solo si el chatbot está activo. */
.csm-chat{--chat-c:#2b5a78;--chat-ink:#0e1c2a;--chat-sand:#f5efe4;--chat-line:#e3d9c7;--chat-text:#2c3a47;--chat-muted:#5f6e7b;--chat-alert:#b42a3e;--chat-off:16px;
  position:fixed;z-index:9990;bottom:0;right:0;left:auto;width:0;height:0;font:15px/1.5 var(--font-body,system-ui,sans-serif);color:var(--chat-text)}
.csm-chat *,.csm-chat *:before,.csm-chat *:after{box-sizing:border-box}
.csm-chat[hidden]{display:none}
.csm-chat-launch{position:fixed;bottom:var(--chat-off);right:max(16px,env(safe-area-inset-right));display:inline-flex;align-items:center;gap:10px;background:var(--chat-c);color:#fff;border:0;border-radius:999px;
  padding:12px 18px 12px 14px;min-height:48px;font:600 15px/1.1 var(--font-body,system-ui);cursor:pointer;box-shadow:0 12px 30px rgba(14,28,42,.3);transition:bottom .3s,transform .2s,filter .2s,opacity .2s}
.csm-chat[data-pos=left] .csm-chat-launch{right:auto;left:max(16px,env(safe-area-inset-left))}
.csm-chat-launch:hover{transform:translateY(-2px);filter:brightness(1.1)}
.csm-chat-launch:focus-visible,.csm-chat button:focus-visible,.csm-chat a:focus-visible,.csm-chat textarea:focus-visible,.csm-chat input:focus-visible{outline:3px solid var(--chat-ink);outline-offset:2px;box-shadow:0 0 0 6px #fff}
.csm-chat-launch svg{flex:none}
.csm-chat-badge{position:absolute;top:-2px;right:-2px;width:14px;height:14px;border-radius:50%;background:var(--chat-alert);border:2px solid #fff}
.csm-chat-badge[hidden]{display:none}
.csm-chat.is-open .csm-chat-launch{opacity:0;pointer-events:none}

.csm-chat-dialog{position:fixed;bottom:16px;right:max(16px,env(safe-area-inset-right));width:min(392px,calc(100vw - 32px));height:min(640px,calc(100dvh - 32px));display:flex;flex-direction:column;
  background:#fff;border:1px solid var(--chat-line);border-radius:20px;box-shadow:0 30px 70px rgba(14,28,42,.28);overflow:hidden;z-index:100}
.csm-chat[data-pos=left] .csm-chat-dialog{right:auto;left:max(16px,env(safe-area-inset-left))}
.csm-chat-dialog[hidden]{display:none}
.csm-chat-head{display:flex;align-items:center;gap:12px;padding:14px 14px 14px 16px;background:var(--chat-c);color:#fff}
.csm-chat-av{flex:none;width:40px;height:40px;border-radius:50%;background:rgba(255,255,255,.16);display:grid;place-items:center;overflow:hidden}
.csm-chat-av img{width:100%;height:100%;object-fit:cover}
.csm-chat-ttl{flex:1;min-width:0}
.csm-chat-ttl h2{margin:0;font:500 1.15rem/1.2 var(--font-display,Georgia,serif);color:#fff;letter-spacing:-.01em}
.csm-chat-ttl p{margin:2px 0 0;font-size:12.5px;color:#fff;opacity:.92}
.csm-chat-close{flex:none;width:44px;height:44px;border:0;border-radius:50%;background:transparent;color:#fff;cursor:pointer;display:grid;place-items:center}
.csm-chat-close:hover{background:rgba(255,255,255,.18)}
.csm-chat-close:focus-visible{outline-color:#fff;box-shadow:none}
.csm-chat-warn{margin:0;padding:8px 16px;background:#fff3d6;color:#5c3d00;font-size:13px;border-bottom:1px solid #e8d29b}
.csm-chat-warn a{color:#5c3d00;font-weight:600}
.csm-chat-warn[hidden]{display:none}
.csm-chat-body{flex:1;overflow-y:auto;padding:16px;background:var(--chat-sand);display:flex;flex-direction:column;gap:10px;overscroll-behavior:contain;scroll-behavior:smooth}
.csm-chat-body:focus-visible{outline-offset:-3px}
.csm-chat-m{max-width:88%;padding:10px 13px;border-radius:16px;overflow-wrap:anywhere;word-break:break-word}
.csm-chat-m p{margin:0 0 6px}.csm-chat-m p:last-child{margin:0}
.csm-chat-m ul{margin:4px 0 6px;padding-left:20px}
.csm-chat-m a{color:var(--chat-c);font-weight:600;text-decoration:underline}
.csm-chat-m.bot{align-self:flex-start;background:#fff;border:1px solid var(--chat-line);border-bottom-left-radius:5px;color:var(--chat-text)}
.csm-chat-m.me{align-self:flex-end;background:var(--chat-c);color:#fff;border-bottom-right-radius:5px}
.csm-chat-m.me a{color:#fff}
.csm-chat-m.staff{align-self:flex-start;background:#e6eef3;border:1px solid #c6d7e2;border-bottom-left-radius:5px}
.csm-chat-m.staff:before{content:"Equipo del centro";display:block;font-size:12px;font-weight:700;color:var(--chat-c);margin-bottom:2px}
.csm-chat-m.sys{align-self:center;background:transparent;border:0;color:var(--chat-muted);font-size:13px;text-align:center;padding:2px 8px}
.csm-chat-m.crisis{background:#fff;border:1px solid var(--chat-alert);border-left:6px solid var(--chat-alert);max-width:96%}
.csm-chat-m.crisis strong{color:#7d1424}
.csm-chat-typing{display:inline-flex;gap:4px;align-items:center;padding:4px 2px}
.csm-chat-typing i{width:7px;height:7px;border-radius:50%;background:var(--chat-muted);animation:csmchatdot 1.2s infinite ease-in-out}
.csm-chat-typing i:nth-child(2){animation-delay:.18s}.csm-chat-typing i:nth-child(3){animation-delay:.36s}
@keyframes csmchatdot{0%,70%,100%{opacity:.3;transform:translateY(0)}35%{opacity:1;transform:translateY(-3px)}}
.csm-chat-sr{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}
.csm-chat-chips{display:flex;flex-wrap:wrap;gap:8px;margin-top:2px}
.csm-chat-chip{border:1.5px solid var(--chat-c);background:#fff;color:var(--chat-c);border-radius:999px;padding:8px 14px;min-height:40px;font:600 14px/1.2 var(--font-body,system-ui);cursor:pointer;text-align:left}
.csm-chat-chip:hover{background:var(--chat-c);color:#fff}
.csm-chat-card{align-self:stretch;background:#fff;border:1px solid var(--chat-line);border-radius:16px;padding:14px}
.csm-chat-card h3{margin:0 0 6px;font:600 1.02rem/1.25 var(--font-display,Georgia,serif);color:var(--chat-ink)}
.csm-chat-card p{margin:0 0 10px;font-size:14px}
.csm-chat-card .small{font-size:13px;color:var(--chat-muted)}
.csm-chat-card a:not(.csm-chat-btn){color:var(--chat-c);font-weight:600}
.csm-chat-row{display:flex;flex-wrap:wrap;gap:8px;margin-top:8px}
.csm-chat-btn{display:inline-flex;align-items:center;justify-content:center;gap:6px;min-height:44px;padding:10px 16px;border-radius:999px;border:2px solid var(--chat-c);background:var(--chat-c);color:#fff;font:600 14px/1.1 var(--font-body,system-ui);cursor:pointer;text-decoration:none}
.csm-chat-btn:hover{filter:brightness(1.12)}
.csm-chat-btn.ghost{background:#fff;color:var(--chat-c)}
.csm-chat-btn.ghost:hover{background:var(--chat-c);color:#fff;filter:none}
.csm-chat-btn.danger{background:var(--chat-alert);border-color:var(--chat-alert)}
.csm-chat-btn[disabled]{opacity:.55;cursor:not-allowed}
.csm-chat-fld{display:block;margin:0 0 10px}
.csm-chat-fld span{display:block;font-weight:600;font-size:13.5px;margin-bottom:3px;color:var(--chat-ink)}
.csm-chat-fld input,.csm-chat-fld textarea{width:100%;border:1.5px solid #b9ad97;border-radius:12px;padding:10px 12px;font:15px/1.4 var(--font-body,system-ui);color:var(--chat-ink);background:#fff}
.csm-chat-chk{display:flex;gap:8px;align-items:flex-start;font-size:13.5px;margin:4px 0 10px}
.csm-chat-chk input{margin-top:3px;width:18px;height:18px;flex:none}
.csm-chat-err{color:#7d1424;font-size:13.5px;margin:0 0 8px;font-weight:600}
.csm-chat-form{display:flex;gap:8px;align-items:flex-end;padding:10px 12px 6px;background:#fff;border-top:1px solid var(--chat-line)}
.csm-chat-form textarea{flex:1;resize:none;min-height:44px;max-height:120px;border:1.5px solid #b9ad97;border-radius:14px;padding:10px 12px;font:16px/1.35 var(--font-body,system-ui);color:var(--chat-ink);background:#fff}
.csm-chat-form textarea::placeholder{color:var(--chat-muted);opacity:1}
.csm-chat-form textarea:disabled{background:#f1ede4}
.csm-chat-send{flex:none;width:46px;height:46px;border-radius:50%;border:0;background:var(--chat-c);color:#fff;cursor:pointer;display:grid;place-items:center}
.csm-chat-send[disabled]{opacity:.45;cursor:not-allowed}
.csm-chat-foot{display:flex;flex-wrap:wrap;align-items:center;gap:2px 12px;padding:2px 14px 10px;background:#fff;font-size:12.5px;color:var(--chat-muted)}
.csm-chat-foot button,.csm-chat-foot a{background:none;border:0;padding:6px 0;min-height:32px;color:var(--chat-c);font:600 12.5px/1.2 var(--font-body,system-ui);text-decoration:underline;cursor:pointer}
.csm-chat-foot .cnt{margin-left:auto}
.csm-chat-foot [hidden]{display:none}

@media(max-width:760px){
  .csm-chat-dialog,.csm-chat[data-pos=left] .csm-chat-dialog{left:0;right:0;top:0;bottom:0;width:auto;height:auto;border-radius:0;border:0}
  .csm-chat-launch{padding:12px;width:52px;height:52px;justify-content:center}.csm-chat-launch .lbl{display:none}
}
@media(prefers-reduced-motion:reduce){.csm-chat-launch,.csm-chat-body{transition:none;scroll-behavior:auto}.csm-chat-typing i{animation:none;opacity:.7}.csm-chat-launch:hover{transform:none}}
@media print{.csm-chat{display:none}}

.csm-chat a.csm-chat-btn{color:#fff;text-decoration:none}.csm-chat a.csm-chat-btn.ghost{color:var(--chat-c)}.csm-chat a.csm-chat-btn.ghost:hover{color:#fff}

/* Versión compacta, captación de teléfono y estados de memoria */
.csm-chat-dialog{width:min(372px,calc(100vw - 32px));height:min(580px,calc(100dvh - 32px))}
.csm-chat-launch{min-height:46px;padding:10px 16px 10px 12px;font-size:14.5px}
.csm-chat-body{padding:14px;gap:8px}
.csm-chat-offer{align-self:flex-start;max-width:100%}
.csm-chat-offer .csm-chat-row{margin-top:0}
.csm-chat-offer .csm-chat-btn{min-height:40px;padding:8px 14px;font-size:13.5px}
.csm-chat-fs{border:0;margin:0 0 10px;padding:0;min-width:0}
.csm-chat-fs legend{font-weight:600;font-size:13.5px;color:var(--chat-ink);padding:0;margin-bottom:5px}
.csm-chat-pill{display:inline-flex;align-items:center;margin:0 6px 6px 0;cursor:pointer}
.csm-chat-pill input{position:absolute;opacity:0;width:1px;height:1px}
.csm-chat-pill span{display:inline-block;border:1.5px solid var(--chat-c);color:var(--chat-c);border-radius:999px;padding:7px 13px;min-height:38px;font:600 13.5px/1.2 var(--font-body,system-ui);background:#fff}
.csm-chat-pill input:checked+span{background:var(--chat-c);color:#fff}
.csm-chat-pill input:focus-visible+span{outline:3px solid var(--chat-ink);outline-offset:2px}
.csm-chat-hp{position:absolute!important;left:-9999px;width:1px;height:1px;opacity:0}
.csm-chat-card .csm-chat-fld input,.csm-chat-card .csm-chat-fld textarea{padding:9px 11px}
.csm-chat-m.sys{font-size:12.5px}
@media(max-width:760px){.csm-chat-dialog,.csm-chat[data-pos=left] .csm-chat-dialog{width:auto;height:auto}}
