/* ---------- виджет чата ---------- */
.chat { --chat-w: 392px; position: fixed; right: 16px; bottom: 16px; z-index: 190; font-family: var(--font-sans); hyphens: none; }
.chat [hidden] { display: none !important; }
.chat__fab {
  position: relative; display: inline-flex; align-items: center; gap: .6em; min-height: 52px; padding: 0 1.3em 0 1em; border-radius: 999px;
  border: 2px solid var(--lime-hi); background: var(--lime); color: #0a1005; font-weight: 700; font-size: .98rem; cursor: pointer;
  box-shadow: 0 12px 32px -8px rgba(0, 0, 0, .7); transition: transform .3s var(--ease), background-color .3s var(--ease), box-shadow .3s;
}
.chat__fab:hover { background: var(--lime-hi); transform: translateY(-2px); box-shadow: 0 14px 34px -8px rgba(101, 163, 13, .6); }
.chat__fab-pi { font-family: var(--font-mono); font-size: 1.3em; line-height: 1; }
.chat__dot { position: absolute; top: -4px; right: -2px; width: 14px; height: 14px; border-radius: 50%; background: #F08A8A; border: 2px solid var(--bg); }

.chat__panel {
  width: min(var(--chat-w), calc(100vw - 32px)); height: min(600px, calc(100dvh - 32px)); display: flex; flex-direction: column;
  background: var(--panel); border: 1px solid var(--line-2); border-radius: 18px; overflow: hidden;
  box-shadow: 0 28px 80px -12px rgba(0, 0, 0, .8); animation: chat-in .28s var(--ease);
}
@keyframes chat-in { from { opacity: 0; transform: translateY(14px) scale(.98); } to { opacity: 1; transform: none; } }

.chat__head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 14px; background: var(--bg-deep); border-bottom: 1px solid var(--line); }
.chat__who { display: flex; align-items: center; gap: 10px; min-width: 0; }
.chat__who strong { display: block; font-size: .98rem; line-height: 1.2; }
.chat__logo { flex: none; width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: var(--lime); color: #0a1005; font-family: var(--font-mono); font-weight: 700; font-size: 1.2rem; }
.chat__sub { display: block; font-size: .76rem; color: var(--sym-text); line-height: 1.3; }
.chat__tools { display: flex; gap: 4px; flex: none; }
.chat__ic { width: 36px; height: 36px; border-radius: 10px; border: 0; background: transparent; color: var(--text-2, var(--sym-text)); font-size: 1.25rem; line-height: 1; cursor: pointer; transition: background-color .2s, color .2s; }
.chat__ic:hover { background: var(--panel-2); color: var(--text); }

.chat__log { flex: 1; overflow-y: auto; padding: 16px 14px 8px; display: flex; flex-direction: column; gap: 10px; scroll-behavior: smooth; overscroll-behavior: contain; }
.chat__m { max-width: 86%; display: flex; flex-direction: column; gap: 8px; }
.chat__m--b { align-self: flex-start; }
.chat__m--u { align-self: flex-end; }
.chat__t { padding: 10px 13px; border-radius: 14px; font-size: .94rem; line-height: 1.5; white-space: pre-wrap; overflow-wrap: break-word; word-break: normal; }
.chat__m--b .chat__t { background: var(--panel-2); border-bottom-left-radius: 4px; }
.chat__m--u .chat__t { background: var(--lime); color: #0a1005; border-bottom-right-radius: 4px; font-weight: 600; }
.chat__kb { display: flex; flex-wrap: wrap; gap: 6px; }
.chat__chip { padding: 8px 13px; border-radius: 999px; border: 1.5px solid var(--lime-hi); background: transparent; color: var(--lime-hi); font-size: .86rem; font-weight: 600; cursor: pointer; transition: background-color .2s, color .2s; text-align: left; }
.chat__chip:hover { background: var(--lime); color: #0a1005; }
.chat__typing { flex-direction: row; gap: 5px; padding: 12px 14px; background: var(--panel-2); border-radius: 14px; border-bottom-left-radius: 4px; width: 62px; }
.chat__typing span { width: 7px; height: 7px; border-radius: 50%; background: var(--sym-text); animation: chat-dot 1.2s infinite ease-in-out; }
.chat__typing span:nth-child(2) { animation-delay: .15s; }
.chat__typing span:nth-child(3) { animation-delay: .3s; }
@keyframes chat-dot { 0%, 60%, 100% { opacity: .3; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-3px); } }

.chat__form { display: flex; align-items: flex-end; gap: 8px; padding: 10px 12px 12px; border-top: 1px solid var(--line); background: var(--panel); }
.chat__in { flex: 1; resize: none; max-height: 120px; padding: 11px 14px; border-radius: 12px; border: 1.5px solid var(--line-2); background: #10161d; color: var(--text); font: inherit; font-size: .96rem; line-height: 1.4; }
.chat__in:focus { outline: none; border-color: var(--lime-hi); box-shadow: 0 0 0 3px rgba(101, 163, 13, .25); }
.chat__send { flex: none; width: 46px; height: 46px; border-radius: 12px; border: 0; background: var(--lime); color: #0a1005; font-size: 1.1rem; cursor: pointer; transition: background-color .2s, transform .2s; }
.chat__send:hover:not(:disabled) { background: var(--lime-hi); }
.chat__send:disabled { opacity: .5; cursor: not-allowed; }
.chat__pol { margin: 0; padding: 0 14px 12px; font-size: .74rem; color: var(--sym-text); }
.chat__pol a { color: var(--lime-hi); }

@media (max-width: 600px) {
  .chat { right: 10px; bottom: 10px; }
  .chat__fab { width: 52px; padding: 0; justify-content: center; }
  .chat__fab-t { display: none; }
  .chat__panel { position: fixed; inset: 0; width: 100%; height: 100dvh; border-radius: 0; border: 0; animation: none; }
}
@media (prefers-reduced-motion: reduce) {
  .chat__panel { animation: none; }
  .chat__log { scroll-behavior: auto; }
  .chat__typing span { animation: none; opacity: .7; }
}
