/* ================================================================
   Chat widget — same instrument language as the rest of the site.
   ================================================================ */
.visually-hidden{position:absolute;width:1px;height:1px;padding:0;margin:-1px;
  overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap;border:0}

.chat-fab{
  position:fixed;right:22px;bottom:22px;z-index:170;
  width:56px;height:56px;border-radius:50%;cursor:pointer;
  background:var(--surface-2);border:1px solid var(--steel);
  display:grid;place-items:center;padding:0;
  box-shadow:0 10px 30px rgba(0,0,0,.45);
  transition:transform .28s cubic-bezier(.34,1.4,.5,1),border-color .25s;
}
.chat-fab:hover{transform:translateY(-3px) scale(1.04);border-color:var(--cyan)}
.chat-fab:focus-visible{outline:2px solid var(--cyan);outline-offset:3px}
.chat-fab svg{width:32px;height:32px;transition:opacity .22s,transform .3s}
.chat-fab-x{position:absolute;font-size:26px;line-height:1;color:var(--cyan);
  opacity:0;transform:scale(.5);transition:opacity .22s,transform .3s}
.chat-fab[aria-expanded="true"] svg{opacity:0;transform:scale(.5) rotate(-90deg)}
.chat-fab[aria-expanded="true"] .chat-fab-x{opacity:1;transform:none}

.chat-panel{
  position:fixed;right:22px;bottom:90px;z-index:169;
  width:min(400px,calc(100vw - 32px));max-height:min(620px,calc(100vh - 130px));
  display:flex;flex-direction:column;
  background:rgba(11,18,38,.98);border:1px solid var(--steel);border-radius:10px;
  backdrop-filter:blur(18px);-webkit-backdrop-filter:blur(18px);
  box-shadow:0 24px 60px rgba(0,0,0,.55);overflow:hidden;
}
@media (prefers-reduced-motion:no-preference){
  .chat-panel{animation:chatIn .34s cubic-bezier(.2,.9,.3,1)}
}
@keyframes chatIn{from{opacity:0;transform:translateY(16px) scale(.98)}to{opacity:1;transform:none}}

.chat-head{display:flex;align-items:flex-start;justify-content:space-between;gap:14px;
  padding:18px 20px;border-bottom:1px solid var(--line-soft);flex:none}
.chat-title{font-size:15px;font-weight:700;letter-spacing:-.015em}
.chat-sub{font-family:var(--mono);font-size:10px;letter-spacing:.12em;
  text-transform:uppercase;color:var(--dimmer);margin-top:4px}
.chat-reset{font-family:var(--mono);font-size:9.5px;letter-spacing:.13em;text-transform:uppercase;
  background:transparent;border:1px solid var(--line);color:var(--dim);
  padding:7px 11px;border-radius:3px;cursor:pointer;transition:all .2s;flex:none}
.chat-reset:hover{border-color:var(--steel);color:var(--white)}
.chat-reset:focus-visible{outline:2px solid var(--cyan);outline-offset:2px}

.chat-log{flex:1;overflow-y:auto;padding:20px;display:flex;flex-direction:column;gap:14px;
  scrollbar-width:thin;scrollbar-color:var(--steel) transparent}
.chat-log::-webkit-scrollbar{width:8px}
.chat-log::-webkit-scrollbar-thumb{background:var(--steel);border-radius:4px}

.msg{max-width:88%;font-size:14px;line-height:1.62;border-radius:9px;padding:12px 15px;white-space:pre-wrap;word-wrap:break-word}
.msg.user{align-self:flex-end;background:var(--surface-3);border:1px solid var(--line);color:#DDE4F3}
.msg.bot{align-self:flex-start;background:var(--surface);border:1px solid var(--line-soft);color:#B7C3DC}
.msg.err{align-self:stretch;background:rgba(244,81,92,.08);border:1px solid rgba(244,81,92,.3);color:#E9B9BE;font-size:13.2px}

.dots{display:inline-flex;gap:4px;align-items:center;height:18px}
.dots i{width:5px;height:5px;border-radius:50%;background:var(--dim);opacity:.4}
@media (prefers-reduced-motion:no-preference){
  .dots i{animation:blink 1.3s ease-in-out infinite}
  .dots i:nth-child(2){animation-delay:.18s}
  .dots i:nth-child(3){animation-delay:.36s}
}
@keyframes blink{0%,100%{opacity:.25;transform:translateY(0)}50%{opacity:1;transform:translateY(-2px)}}

.chat-chips{display:flex;gap:6px;flex-wrap:wrap;padding:0 20px 14px;flex:none}
.chat-chips button{font-size:12px;padding:8px 12px;border-radius:99px;cursor:pointer;
  border:1px solid var(--line);background:var(--surface);color:var(--dim);
  text-align:left;transition:all .2s}
.chat-chips button:hover{border-color:var(--steel);color:var(--white)}
.chat-chips button:focus-visible{outline:2px solid var(--cyan);outline-offset:2px}
.chat-chips.gone{display:none}

.chat-form{display:flex;gap:8px;align-items:flex-end;padding:14px 16px;
  border-top:1px solid var(--line-soft);flex:none}
.chat-form textarea{flex:1;resize:none;max-height:120px;padding:11px 13px;border-radius:6px;
  font-family:var(--sans);font-size:14px;line-height:1.5;
  background:var(--surface);border:1px solid var(--line);color:var(--white)}
.chat-form textarea::placeholder{color:var(--dimmer)}
.chat-form textarea:focus{outline:none;border-color:var(--cyan)}
.chat-form button{flex:none;width:40px;height:40px;border-radius:6px;border:0;cursor:pointer;
  background:var(--grad);color:#04060D;display:grid;place-items:center;transition:filter .2s,opacity .2s}
.chat-form button:hover{filter:brightness(1.12)}
.chat-form button:disabled{opacity:.4;cursor:not-allowed}
.chat-form button:focus-visible{outline:2px solid var(--cyan);outline-offset:2px}

.chat-foot{padding:0 18px 15px;font-size:10.5px;line-height:1.5;color:var(--dimmer);flex:none}

@media (max-width:520px){
  .chat-panel{right:8px;left:8px;bottom:82px;width:auto;max-height:calc(100vh - 110px)}
  .chat-fab{right:14px;bottom:14px}
}
