/* Чат-асистент: кружечок унизу праворуч і віконце як у месенджері (мої повідомлення праворуч, асистента ліворуч) */
.chat { position: fixed; right: 20px; bottom: 20px; z-index: 60; font-family: var(--font-text); }
.chat__launcher { position: relative; width: 60px; height: 60px; border-radius: 50%; border: 0; cursor: pointer;
  background: var(--p-accent); color: #0a0606; display: grid; place-items: center;
  box-shadow: 0 0 0 1px rgba(255, 140, 120, .35), 0 10px 34px -6px rgba(232, 53, 43, .75);
  transition: transform .2s ease, box-shadow .25s ease; }
.chat__launcher:hover { transform: translateY(-2px); box-shadow: 0 0 0 1px rgba(255, 160, 140, .5), 0 14px 44px -6px rgba(232, 53, 43, .95); }
.chat__launcher:active { transform: scale(.96); }
.chat__launcher:focus-visible { outline: 2px solid #fff; outline-offset: 3px; }
.chat__launcher::after { content: ""; position: absolute; inset: 0; border-radius: 50%; border: 2px solid var(--p-accent); animation: chat-ping 2.6s ease-out 2; opacity: 0; }
@keyframes chat-ping { 0% { transform: scale(1); opacity: .7; } 100% { transform: scale(1.6); opacity: 0; } }
.chat__ic { width: 26px; height: 26px; transition: transform .25s ease, opacity .2s ease; }
.chat__ic--close { position: absolute; opacity: 0; transform: rotate(-45deg); width: 22px; height: 22px; }
.chat.is-open .chat__ic--open { opacity: 0; transform: rotate(45deg); }
.chat.is-open .chat__ic--close { opacity: 1; transform: none; }
.chat__badge { position: absolute; top: -2px; right: -2px; min-width: 20px; height: 20px; border-radius: 10px; background: #fff; color: #0a0606;
  font: 600 12px/20px var(--font-text); text-align: center; box-shadow: 0 2px 8px rgba(0, 0, 0, .4); }
.chat__badge[hidden] { display: none; }

.chat__panel { position: absolute; right: 0; bottom: 76px; width: 380px; height: min(580px, calc(100svh - 120px));
  display: flex; flex-direction: column; overflow: hidden; border-radius: 18px;
  background: #120a0a; color: var(--p-ink); border: 1px solid rgba(232, 53, 43, .28);
  box-shadow: 0 24px 70px -18px rgba(0, 0, 0, .8), 0 0 60px -24px rgba(232, 53, 43, .7);
  transform-origin: bottom right; animation: chat-in .22s cubic-bezier(.2, .8, .2, 1); }
.chat__panel[hidden] { display: none; }
@keyframes chat-in { from { opacity: 0; transform: translateY(10px) scale(.97); } to { opacity: 1; transform: none; } }

.chat__head { display: flex; align-items: center; gap: 12px; padding: 14px 14px 14px 16px; border-bottom: 1px solid rgba(255, 255, 255, .08);
  background: linear-gradient(180deg, rgba(232, 53, 43, .14), rgba(232, 53, 43, 0)); }
.chat__avatar { width: 38px; height: 38px; flex: 0 0 38px; border-radius: 50%; display: grid; place-items: center;
  background: var(--p-accent); color: #0a0606; font: 600 16px/1 var(--font-text); box-shadow: 0 0 16px -2px rgba(232, 53, 43, .8); }
.chat__who { flex: 1; min-width: 0; }
.chat__title { font: 600 15px/1.25 var(--font-text); letter-spacing: 0; margin: 0; }
.chat__sub { margin: 2px 0 0; font-size: 12px; color: var(--p-muted); display: flex; align-items: center; gap: 6px; }
.chat__sub i { width: 7px; height: 7px; border-radius: 50%; background: #3ddc84; box-shadow: 0 0 8px #3ddc84; }
.chat__x { width: 44px; height: 44px; border: 0; border-radius: 10px; background: none; color: var(--p-muted); cursor: pointer; display: grid; place-items: center; }
.chat__x:hover { color: #fff; background: rgba(255, 255, 255, .06); }

.chat__log { flex: 1; overflow-y: auto; padding: 16px 14px 8px; display: flex; flex-direction: column; gap: 8px; scroll-behavior: smooth; overscroll-behavior: contain; }
.chat__row { display: flex; flex-direction: column; max-width: 86%; }
.chat__row--bot { align-self: flex-start; align-items: flex-start; }
.chat__row--user { align-self: flex-end; align-items: flex-end; }
.chat__msg { padding: 10px 13px; border-radius: 16px; font-size: 14.5px; line-height: 1.45; white-space: normal; overflow-wrap: anywhere; }
.chat__row--bot .chat__msg { background: #22151400; background: #221514; border: 1px solid rgba(255, 255, 255, .06); border-bottom-left-radius: 5px; }
.chat__row--user .chat__msg { background: var(--p-accent); color: #140808; border-bottom-right-radius: 5px; box-shadow: 0 6px 20px -10px rgba(232, 53, 43, .9); }
.chat__link { display: inline-block; margin-top: 8px; color: #ffb3a8; font-weight: 500; text-decoration: none; }
.chat__link:hover { color: #fff; text-shadow: 0 0 12px rgba(232, 53, 43, .8); }
.chat__dots { display: inline-flex; gap: 4px; padding: 3px 0; }
.chat__dots i { width: 7px; height: 7px; border-radius: 50%; background: var(--p-muted); animation: chat-dot 1.1s infinite ease-in-out; }
.chat__dots i:nth-child(2) { animation-delay: .15s; } .chat__dots i:nth-child(3) { animation-delay: .3s; }
@keyframes chat-dot { 0%, 80%, 100% { transform: translateY(0); opacity: .5; } 40% { transform: translateY(-4px); opacity: 1; } }

.chat__handoff { margin-top: 8px; padding: 12px; border-radius: 14px; width: 100%; min-width: 260px; display: grid; gap: 8px;
  background: rgba(232, 53, 43, .08); border: 1px solid rgba(232, 53, 43, .35); }
.chat__hl { font-size: 12.5px; color: var(--p-muted); }
.chat__hrow { display: grid; gap: 8px; }
.chat__hin { height: 44px; padding: 0 12px; border-radius: 10px; border: 1px solid rgba(255, 255, 255, .14); background: #0d0707; color: var(--p-ink); font: 400 15px var(--font-text); }
.chat__hin:focus { outline: none; border-color: var(--p-accent); box-shadow: 0 0 0 3px rgba(232, 53, 43, .25); }
.chat__hin[aria-invalid="true"] { border-color: #ff6b5e; }
.chat__hbtn { height: 44px; border-radius: 10px; border: 0; background: var(--p-accent); color: #0a0606; font: 600 14px var(--font-text); cursor: pointer; transition: box-shadow .25s ease; }
.chat__hbtn:hover { box-shadow: 0 8px 24px -8px rgba(232, 53, 43, .9); }
.chat__hbtn:disabled { opacity: .6; cursor: progress; }
.chat__herr { margin: 0; font-size: 12.5px; color: #ff8a80; }

.chat__quick { display: flex; flex-wrap: wrap; gap: 6px; padding: 4px 14px 10px; }
.chat__quick[hidden] { display: none; }
.chat__chip { min-height: 36px; padding: 0 12px; border-radius: 999px; border: 1px solid rgba(232, 53, 43, .4); background: rgba(232, 53, 43, .06);
  color: var(--p-ink); font: 500 13px var(--font-text); cursor: pointer; transition: border-color .2s ease, box-shadow .25s ease, background-color .2s ease; }
.chat__chip:hover { border-color: var(--p-accent); background: rgba(232, 53, 43, .14); box-shadow: 0 0 18px -6px rgba(232, 53, 43, .8); }

.chat__form { display: flex; align-items: flex-end; gap: 8px; padding: 10px 12px 12px; border-top: 1px solid rgba(255, 255, 255, .08); background: #0f0808; }
.chat__input { flex: 1; min-height: 44px; max-height: 120px; resize: none; padding: 11px 14px; border-radius: 14px; border: 1px solid rgba(255, 255, 255, .12);
  background: #1a100f; color: var(--p-ink); font: 400 15px/1.4 var(--font-text); }
.chat__input:focus { outline: none; border-color: rgba(232, 53, 43, .7); box-shadow: 0 0 0 3px rgba(232, 53, 43, .18); }
.chat__input::placeholder { color: #7d6d68; }
.chat__send { width: 44px; height: 44px; flex: 0 0 44px; border-radius: 50%; border: 0; background: var(--p-accent); color: #0a0606; cursor: pointer; display: grid; place-items: center; transition: box-shadow .25s ease, transform .15s ease; }
.chat__send:hover { box-shadow: 0 0 20px -2px rgba(232, 53, 43, .9); }
.chat__send:active { transform: scale(.94); }
.chat__sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

@media (max-width: 639px) {
  .chat { right: 14px; bottom: 14px; }
  .chat__launcher { width: 52px; height: 52px; }
  .chat__ic { width: 23px; height: 23px; }
  .chat__panel { position: fixed; left: 8px; right: 8px; bottom: 76px; width: auto; height: min(76svh, 620px); }
}
@media (prefers-reduced-motion: reduce) {
  .chat__launcher::after, .chat__dots i { animation: none; }
  .chat__panel { animation: none; }
}
