/* =====================================================================
   Website chat assistant (FAQ engine, no AI). Launcher + panel.
   ===================================================================== */
.chat-launcher {
  position: fixed; right: clamp(16px, 2.2vw, 28px); bottom: clamp(16px, 2.2vw, 28px); z-index: 43;
  display: inline-flex; align-items: center; gap: 10px; height: 52px; padding: 0 18px 0 14px; border-radius: 999px;
  background: var(--accent); color: #fff; font: 600 .95rem/1 var(--font-body);
  box-shadow: 0 12px 30px -10px color-mix(in srgb, var(--accent) 70%, transparent);
  transition: transform .6s var(--ease-out), opacity .3s, background-color .3s;
}
.chat-launcher:hover { background: color-mix(in srgb, var(--accent) 85%, #000); }
.chat-launcher svg { width: 22px; height: 22px; flex: none; }
/* Sit above the floating WhatsApp button once that appears */
.wa-float.is-visible ~ .chat-launcher { transform: translateY(-70px); }
.chat-launcher[aria-expanded="true"] { opacity: 0; pointer-events: none; }
@media (max-width: 599px) {
  .chat-launcher { width: 52px; padding: 0; justify-content: center; }
  .chat-launcher__label { display: none; }
}

.chat {
  position: fixed; right: clamp(16px, 2.2vw, 28px); bottom: clamp(16px, 2.2vw, 28px); z-index: 1100;
  width: min(400px, calc(100vw - 32px)); height: min(620px, calc(100svh - 120px));
  display: flex; flex-direction: column; overflow: hidden;
  border-radius: var(--r-lg); background: var(--surface); color: var(--text);
  border: 1px solid var(--line-strong); box-shadow: 0 30px 80px -24px rgba(0,0,0,.55);
  transform-origin: 100% 100%;
}
.chat[hidden] { display: none; }
.chat.is-entering { animation: chat-in .45s var(--ease-out); }
@keyframes chat-in { from { opacity: 0; transform: translateY(16px) scale(.96); } }
@media (max-width: 599px) {
  .chat { inset: 0; width: 100%; height: 100%; height: 100dvh; border-radius: 0; border: 0; }
  html.chat-open, html.chat-open body { overflow: hidden; }
}

.chat__head { display: flex; align-items: center; gap: 10px; padding: 16px 16px 14px 18px; border-bottom: 1px solid var(--line); }
.chat__brand { flex: 1; min-width: 0; }
.chat__title { margin: 0; font: 500 .72rem/1.3 var(--font-mono); letter-spacing: .08em; text-transform: uppercase; color: var(--text); display: flex; align-items: center; gap: 8px; }
.chat__note { margin: 4px 0 0; font-size: .8rem; line-height: 1.35; color: var(--muted); }
.chat__wa { flex: none; display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 12px; border-radius: 999px; background: #15803D; color: #fff; font-size: .82rem; font-weight: 600; }
.chat__wa svg { width: 16px; height: 16px; }
.chat__close { flex: none; width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; border: 1px solid var(--line-strong); color: var(--text); }
.chat__close svg { width: 16px; height: 16px; }

.chat__log { flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: 18px 16px 8px; display: flex; flex-direction: column; gap: 10px; scroll-behavior: smooth; }
.chat__msg { max-width: 88%; padding: 10px 14px; border-radius: 16px; font-size: .94rem; line-height: 1.5; overflow-wrap: anywhere; }
.chat__msg p { margin: 0; }
.chat__msg p + p, .chat__msg ul + p, .chat__msg p + ul { margin-top: 6px; }
.chat__msg ul { margin: 4px 0 0; padding-left: 18px; list-style: disc; }
.chat__msg li + li { margin-top: 2px; }
.chat__msg a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
.chat__msg--bot { align-self: flex-start; background: var(--surface-2); border-bottom-left-radius: 5px; }
.chat__msg--me { align-self: flex-end; background: var(--accent); color: #fff; border-bottom-right-radius: 5px; }
.chat__msg--bot .chat__waBtn { margin-top: 10px; }
.chat__waBtn { display: inline-flex; align-items: center; gap: 8px; padding: 9px 14px; border-radius: 999px; background: #15803D; color: #fff !important; text-decoration: none !important; font-weight: 600; font-size: .88rem; }
.chat__waBtn svg { width: 16px; height: 16px; }
.chat__typing { align-self: flex-start; display: flex; gap: 4px; padding: 13px 14px; border-radius: 16px; background: var(--surface-2); }
.chat__typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--muted); animation: chat-dot 1s ease-in-out infinite; }
.chat__typing i:nth-child(2) { animation-delay: .15s; } .chat__typing i:nth-child(3) { animation-delay: .3s; }
@keyframes chat-dot { 50% { transform: translateY(-4px); opacity: .5; } }

.chat__chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 4px 16px 10px; }
.chat__chips:empty { display: none; }
.chat__chip { padding: 8px 12px; border-radius: 999px; border: 1px solid var(--line-strong); background: transparent; color: var(--text); font-size: .84rem; font-weight: 500; text-align: left; transition: border-color .2s, background-color .2s; }
.chat__chip:hover { border-color: var(--accent-text); background: color-mix(in srgb, var(--accent) 10%, transparent); }

.chat__form { display: flex; gap: 8px; padding: 12px; border-top: 1px solid var(--line); background: var(--surface); }
.chat__input { flex: 1; min-width: 0; height: 46px; padding: 0 16px; border-radius: 999px; border: 1px solid var(--line-strong); background: var(--bg); color: var(--text); font: 400 16px var(--font-body); }
.chat__input:focus { outline: none; border-color: var(--accent-text); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }
.chat__send { flex: none; width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; background: var(--ignition); color: var(--on-ignition); }
.chat__send svg { width: 18px; height: 18px; }
.chat__foot { margin: 0; padding: 0 16px 10px; font-size: .7rem; color: var(--muted); text-align: center; }

@media (prefers-reduced-motion: reduce) {
  .chat.is-entering, .chat__typing i { animation: none; }
  .chat__log { scroll-behavior: auto; }
}
