/* Website chat assistant (public/chat.js). Uses the site's design tokens from global.css. */
.bi-chat-launch {
  position: fixed; inset-inline-end: 20px; bottom: 20px; z-index: 60;
  display: inline-flex; align-items: center; gap: 8px;
  padding: 12px 18px; border: 0; border-radius: 999px; cursor: pointer;
  background: var(--brand, #4053ff); color: var(--brand-ink, #fff);
  font: 600 0.95rem/1 var(--font, system-ui, sans-serif);
  box-shadow: 0 10px 30px -8px rgb(64 83 255 / 0.55);
}
.bi-chat-launch:hover { filter: brightness(1.08); }
.bi-chat-launch:focus-visible, .bi-chat button:focus-visible, .bi-chat textarea:focus-visible, .bi-chat a:focus-visible {
  outline: 3px solid var(--focus, #f59e0b); outline-offset: 2px;
}
.bi-chat-launch svg { width: 18px; height: 18px; }
.bi-chat-launch[hidden] { display: none; }

.bi-chat {
  position: fixed; inset-inline-end: 20px; bottom: 20px; z-index: 61;
  width: min(390px, calc(100vw - 32px)); height: min(600px, calc(100vh - 40px));
  display: flex; flex-direction: column; overflow: hidden;
  background: var(--surface, #fff); color: var(--text, #0a0f1f);
  border: 1px solid var(--border, #e4e7ef); border-radius: var(--radius, 16px);
  box-shadow: 0 24px 60px -16px rgb(10 15 31 / 0.35);
  font: 400 0.95rem/1.5 var(--font, system-ui, sans-serif);
}
.bi-chat[hidden] { display: none; }
.bi-chat-head { display: flex; align-items: center; gap: 10px; padding: 14px 16px; background: var(--ink, #070b18); color: var(--ink-text, #e9edf7); }
.bi-chat-head .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--accent, #10b981); flex: none; }
.bi-chat-head .title { font-weight: 650; }
.bi-chat-head .sub { font-size: 0.8rem; color: var(--ink-muted, #a4afc7); }
.bi-chat-head .close { margin-inline-start: auto; background: none; border: 0; color: inherit; font-size: 1.5rem; line-height: 1; cursor: pointer; padding: 4px 8px; border-radius: 8px; }
.bi-chat-log { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 10px; background: var(--bg-soft, #f6f7fb); }
.bi-msg { max-width: 85%; padding: 9px 13px; border-radius: 14px; white-space: pre-wrap; overflow-wrap: anywhere; }
.bi-msg.bot { align-self: flex-start; background: var(--surface, #fff); border: 1px solid var(--border, #e4e7ef); border-end-start-radius: 4px; }
.bi-msg.me { align-self: flex-end; background: var(--brand, #4053ff); color: var(--brand-ink, #fff); border-end-end-radius: 4px; }
.bi-msg a { color: var(--brand, #4053ff); text-decoration: underline; }
.bi-msg.me a { color: inherit; }
.bi-msg.agent { align-self: flex-start; background: var(--brand-soft, #eef0ff); border: 1px solid var(--brand, #4053ff); border-end-start-radius: 4px; }
.bi-msg .who { display: block; font-size: 0.75rem; font-weight: 650; color: var(--brand, #4053ff); margin-bottom: 2px; }
.bi-chat-launch.unread::after { content: ""; width: 10px; height: 10px; border-radius: 50%; background: #ef4444; box-shadow: 0 0 0 2px #fff; }
.bi-msg.note { align-self: center; max-width: 100%; background: none; color: var(--muted, #4b5568); font-size: 0.8rem; text-align: center; padding: 0 6px; }
.bi-typing { align-self: flex-start; display: inline-flex; gap: 4px; padding: 12px 14px; }
.bi-typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--muted, #4b5568); animation: bi-blink 1.2s infinite; }
.bi-typing i:nth-child(2) { animation-delay: 0.2s; } .bi-typing i:nth-child(3) { animation-delay: 0.4s; }
@keyframes bi-blink { 0%, 80%, 100% { opacity: 0.25; } 40% { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .bi-typing i { animation: none; opacity: 0.6; } }
.bi-chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 16px 10px; background: var(--bg-soft, #f6f7fb); }
.bi-chips[hidden] { display: none; }
.bi-chips button { border: 1px solid var(--border, #e4e7ef); background: var(--surface, #fff); color: var(--text, #0a0f1f); border-radius: 999px; padding: 6px 11px; font: inherit; font-size: 0.82rem; cursor: pointer; }
.bi-chips button:hover { border-color: var(--brand, #4053ff); color: var(--brand, #4053ff); }
.bi-chat-form { display: flex; gap: 8px; align-items: flex-end; padding: 10px 12px; border-top: 1px solid var(--border, #e4e7ef); background: var(--surface, #fff); }
.bi-chat-form textarea { flex: 1; resize: none; max-height: 120px; min-height: 42px; padding: 10px 12px; border: 1px solid var(--border, #e4e7ef); border-radius: 12px; font: inherit; color: inherit; background: var(--bg, #fff); }
.bi-chat-form button { flex: none; height: 42px; padding: 0 16px; border: 0; border-radius: 12px; background: var(--brand, #4053ff); color: var(--brand-ink, #fff); font: 600 0.9rem var(--font, system-ui, sans-serif); cursor: pointer; }
.bi-chat-form button:disabled { opacity: 0.55; cursor: default; }
.bi-chat-foot { padding: 0 14px 10px; font-size: 0.72rem; color: var(--muted, #4b5568); background: var(--surface, #fff); }
.bi-chat-foot a { color: inherit; }
.bi-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
@media (max-width: 480px) {
  .bi-chat { inset-inline-end: 0; bottom: 0; width: 100vw; height: 100dvh; border-radius: 0; border: 0; }
  .bi-chat-launch { inset-inline-end: 16px; bottom: 16px; padding: 12px 14px; }
}
@media print { .bi-chat, .bi-chat-launch { display: none !important; } }
