/*
 * chat.css — новое окно чата (v2.19, statica/js/chat.js). Тема «Глубокий космос».
 * Два вида одной разметки: .sp-chat--drawer — окно поверх страницы (справа, на телефоне — на весь экран),
 * .sp-chat--page — страница /ajaxchat (на всю ширину, справа колонка «Кто в чате»).
 */

.sp-chat { --ch-bg: #0d1230; --ch-line: rgba(140, 170, 255, .18); --ch-mut: #8a98c4; --ch-in: rgba(255, 255, 255, .055);
  --ch-me: linear-gradient(135deg, #3b6cf6 0%, #6d4bf5 55%, #a43fe6 100%);
  position: relative; display: flex; flex-direction: column; min-height: 0; color: #dfe6ff; font-size: 14px; line-height: 1.45;
  background: radial-gradient(120% 60% at 100% 0%, rgba(109, 75, 245, .2), transparent 60%), linear-gradient(180deg, #131a44 0%, var(--ch-bg) 100%); }
.sp-chat *, .sp-chat *::before, .sp-chat *::after { box-sizing: border-box; }
.sp-chat button { font: inherit; color: inherit; cursor: pointer; }
.sp-chat [hidden] { display: none !important; }

/* ---------- Окно поверх страницы ---------- */
.sp-chat--drawer { position: fixed; top: 0; right: 0; bottom: 0; z-index: 99990; width: 420px; max-width: 100vw;
  border-left: 1px solid rgba(140, 170, 255, .3); box-shadow: -24px 0 70px rgba(2, 4, 16, .65);
  transform: translateX(104%); transition: transform .26s cubic-bezier(.22, .8, .3, 1); }
.sp-chat--drawer.is-open { transform: none; }
@media (max-width: 700px) {
  .sp-chat--drawer { width: 100vw; border-left: 0; }
  html.sp-chat-open, html.sp-chat-open body { overflow: hidden; }
}

/* ---------- Страница чата ---------- */
.sp-chat--page { height: min(74vh, 760px); min-height: 460px; border-radius: 18px; border: 1px solid var(--ch-line); overflow: hidden;
  box-shadow: 0 18px 50px rgba(2, 4, 16, .45), inset 0 1px 0 rgba(255, 255, 255, .06); }
.sp-chat--page .sp-chat__body { flex-direction: row; }
.sp-chat--page .sp-chat__people { position: static; width: 250px; flex: 0 0 250px; border-left: 1px solid var(--ch-line); box-shadow: none; animation: none; }
.sp-chat--page .sp-chat__people .sp-chat__ptitle button { display: none; }
@media (max-width: 900px) {
  .sp-chat--page { height: calc(100vh - 170px); min-height: 420px; border-radius: 14px; }
  .sp-chat--page .sp-chat__body { flex-direction: column; }
  .sp-chat--page .sp-chat__people { position: absolute; width: auto; flex: none; border-left: 0; }
  .sp-chat--page .sp-chat__people .sp-chat__ptitle button { display: grid; }
}

/* ---------- Шапка ---------- */
.sp-chat__head { flex: 0 0 auto; display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-bottom: 1px solid var(--ch-line);
  background: linear-gradient(180deg, rgba(255, 255, 255, .06), rgba(255, 255, 255, 0)); }
.sp-chat__title { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 16px; color: #fff; margin-right: auto; min-width: 0; }
.sp-chat__title > i { width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; font-size: 14px; background: var(--ch-me); box-shadow: 0 6px 16px rgba(109, 75, 245, .45); flex: 0 0 auto; }
.sp-chat__online { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px; border-radius: 999px; border: 1px solid var(--ch-line);
  background: var(--ch-in); font-size: 12.5px; transition: background .15s, border-color .15s; }
.sp-chat__online:hover { background: rgba(255, 255, 255, .12); border-color: rgba(160, 190, 255, .4); }
.sp-chat__online i { width: 8px; height: 8px; border-radius: 50%; background: #34d399; box-shadow: 0 0 0 0 rgba(52, 211, 153, .6); animation: sp-chat-pulse 2.2s ease-out infinite; }
.sp-chat__online b { font-weight: 600; color: #fff; }
.sp-chat__tabs { display: flex; gap: 2px; padding: 3px; border-radius: 10px; background: rgba(0, 0, 0, .25); }
.sp-chat__tabs button { position: relative; border: 0; background: none; padding: 5px 10px; border-radius: 8px; font-size: 12.5px; color: var(--ch-mut); }
.sp-chat__tabs button.is-on { background: rgba(255, 255, 255, .12); color: #fff; }
/* v2.21: в окне поверх страницы у модератора шапка не помещалась — вкладки наезжали на счётчик «в сети».
   Счётчик и кнопки не сжимаются; в окне слово «Чат» при вкладках скрыто (остаётся значок), а на телефоне вкладки уходят на вторую строку. */
.sp-chat__title { flex: 0 0 auto; }
.sp-chat__online, .sp-chat__tools { flex: 0 0 auto; }
.sp-chat__tabs { flex: 0 1 auto; min-width: 0; }
.sp-chat__tabs button { white-space: nowrap; }
.sp-chat--drawer .sp-chat__head--tabs .sp-chat__title > span { display: none; }
@media (max-width: 700px) {
  .sp-chat--drawer .sp-chat__head--tabs { flex-wrap: wrap; }
  .sp-chat--drawer .sp-chat__head--tabs .sp-chat__title > span { display: inline; }
  .sp-chat--drawer .sp-chat__head--tabs .sp-chat__tabs { order: 3; flex: 1 0 100%; }
  .sp-chat--drawer .sp-chat__head--tabs .sp-chat__tabs button { flex: 1 1 0; }
}
.sp-chat__dot { position: absolute; top: 3px; right: 3px; width: 7px; height: 7px; border-radius: 50%; background: #f43f5e; }
.sp-chat__tools { display: flex; align-items: center; gap: 2px; }
.sp-chat__tools > * { width: 32px; height: 32px; border: 0; border-radius: 9px; background: none; display: grid; place-items: center; color: var(--ch-mut) !important; font-size: 14px; text-decoration: none;
  transition: background .15s, color .15s; }
.sp-chat__tools > *:hover { background: rgba(255, 255, 255, .1); color: #fff !important; }
.sp-chat__tools [data-act="close"] { font-size: 22px; line-height: 1; }
.sp-chat__tools .is-off { color: #f87171 !important; }

/* ---------- Рекламная строка ---------- */
.sp-chat__ad { flex: 0 0 auto; display: flex; align-items: center; gap: 8px; padding: 7px 12px; border-bottom: 1px solid var(--ch-line); font-size: 12.5px; background: rgba(0, 0, 0, .18); }
.sp-chat__ad > i { color: #fbbf24; flex: 0 0 auto; }
.sp-chat__ad a, .sp-chat__ad span { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #c9d5f3; text-decoration: none; }
.sp-chat__ad a:hover { color: #fff; text-decoration: underline; }
.sp-chat__ad.is-hot a { color: #fde68a; font-weight: 600; }
.sp-chat__ad button { flex: 0 0 auto; width: 24px; height: 24px; border-radius: 7px; border: 1px solid var(--ch-line); background: var(--ch-in); display: grid; place-items: center; font-size: 11px; color: var(--ch-mut); }
.sp-chat__ad button:hover { color: #fff; border-color: rgba(160, 190, 255, .45); }

/* ---------- Лента ---------- */
.sp-chat__body { position: relative; flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
.sp-chat__list { flex: 1 1 auto; min-height: 0; min-width: 0; overflow-y: auto; overscroll-behavior: contain; padding: 10px 12px 14px; scrollbar-width: thin; scrollbar-color: rgba(140, 170, 255, .3) transparent; }
.sp-chat__list::-webkit-scrollbar { width: 6px; }
.sp-chat__list::-webkit-scrollbar-thumb { background: rgba(140, 170, 255, .28); border-radius: 6px; }
.sp-chat__hello { height: 100%; min-height: 160px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; text-align: center; color: var(--ch-mut); padding: 20px; }
.sp-chat__hello > i { font-size: 34px; color: #7c8fd6; margin-bottom: 4px; }
.sp-chat__hello b { color: #fff; font-size: 15px; }
.sp-chat__hello--ban > i { color: #f87171; }
.sp-chat__day { display: flex; justify-content: center; margin: 14px 0 8px; position: sticky; top: 0; z-index: 2; pointer-events: none; }
.sp-chat__day span { padding: 3px 12px; border-radius: 999px; font-size: 11.5px; color: #c9d5f3; background: rgba(20, 27, 68, .92); border: 1px solid var(--ch-line); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }

.sp-msg { position: relative; display: flex; align-items: flex-end; gap: 8px; margin-top: 10px; padding-right: 30px; animation: sp-chat-in .22s ease both; }
.sp-msg.is-cont { margin-top: 3px; }
.sp-msg__ava { flex: 0 0 36px; width: 36px; height: 36px; align-self: flex-start; margin-top: 18px; }
.sp-msg.is-cont .sp-msg__ava { visibility: hidden; height: 0; margin-top: 0; }
.sp-msg__ava img { width: 36px; height: 36px; border-radius: 12px; object-fit: cover; display: block; background: #1b2356; border: 1px solid var(--ch-line); }
.sp-msg__col { min-width: 0; max-width: 100%; display: flex; flex-direction: column; align-items: flex-start; }
.sp-msg__meta { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 6px; margin: 0 0 3px 4px; font-size: 12.5px; }
.sp-msg__name { color: #9db8ff; font-weight: 700; cursor: pointer; }
.sp-msg__name:hover { text-decoration: underline; }
.sp-msg__st { font-size: 10.5px; padding: 0 6px; border-radius: 999px; color: var(--ch-mut); background: rgba(255, 255, 255, .06); border: 1px solid rgba(160, 190, 255, .14); line-height: 16px; }
.sp-msg__mod { font-size: 10.5px; padding: 0 7px; border-radius: 999px; line-height: 16px; color: #062a18; background: #34d399; font-weight: 700; }
.sp-msg__bub { position: relative; max-width: 100%; padding: 8px 12px 7px; border-radius: 4px 16px 16px 16px; background: rgba(255, 255, 255, .075); border: 1px solid rgba(160, 190, 255, .13);
  color: #e6ebff; word-break: break-word; overflow-wrap: anywhere; }
.sp-msg.is-cont .sp-msg__bub { border-radius: 16px; }
.sp-msg__bub time { float: right; margin: 5px 0 -2px 10px; font-size: 10.5px; color: var(--ch-mut); line-height: 1; }
.sp-msg__text a { color: #8fd3ff; }
.sp-msg__text img.sp-smile { width: 24px; height: 24px; vertical-align: -6px; }
.sp-msg__to { color: #fbbf24; font-weight: 600; }
.sp-chat__at { color: #fbbf24; font-weight: 600; cursor: pointer; }
.sp-msg__re { margin: 0 0 5px; padding: 4px 9px; border-left: 3px solid #7c8fff; border-radius: 0 8px 8px 0; background: rgba(0, 0, 0, .22); font-size: 12.5px; color: #b9c6e8; cursor: pointer;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.sp-msg__re b { display: block; color: #9db8ff; font-size: 12px; }
/* свои сообщения — справа */
.sp-msg.is-me { justify-content: flex-end; padding-right: 0; padding-left: 30px; }
.sp-msg.is-me .sp-msg__col { align-items: flex-end; }
.sp-msg.is-me .sp-msg__bub { background: var(--ch-me); border-color: transparent; color: #fff; border-radius: 16px 4px 16px 16px; box-shadow: 0 6px 18px rgba(80, 70, 230, .3); }
.sp-msg.is-me.is-cont .sp-msg__bub { border-radius: 16px; }
.sp-msg.is-me .sp-msg__bub time { color: rgba(255, 255, 255, .72); }
.sp-msg.is-me .sp-msg__re { background: rgba(0, 0, 0, .2); border-left-color: rgba(255, 255, 255, .7); color: rgba(255, 255, 255, .85); }
.sp-msg.is-me .sp-msg__re b, .sp-msg.is-me .sp-msg__to, .sp-msg.is-me .sp-chat__at, .sp-msg.is-me .sp-msg__text a { color: #fff; }
.sp-msg.is-me .sp-msg__more { right: auto; left: 0; }
/* обратились ко мне */
.sp-msg.is-tome .sp-msg__bub { border-color: rgba(251, 191, 36, .6); background: rgba(251, 191, 36, .1); box-shadow: 0 0 0 1px rgba(251, 191, 36, .15), 0 0 22px rgba(251, 191, 36, .14); }
.sp-msg.is-flash .sp-msg__bub { animation: sp-chat-flash 1.2s ease; }
/* системные */
.sp-msg.is-sys { justify-content: center; padding: 0; margin-top: 12px; }
.sp-msg__sys { max-width: 92%; padding: 6px 12px; border-radius: 12px; font-size: 12.5px; text-align: center; color: #fecaca; background: rgba(244, 63, 94, .12); border: 1px solid rgba(244, 63, 94, .3); }
.sp-msg__sys time { margin-left: 8px; font-size: 10.5px; color: var(--ch-mut); }
/* кнопка действий */
.sp-msg__more { position: absolute; right: 0; top: 50%; width: 26px; height: 26px; margin-top: -13px; border: 0; border-radius: 8px; background: none; color: var(--ch-mut); display: grid; place-items: center; font-size: 13px;
  opacity: 0; transition: opacity .15s, background .15s; }
.sp-msg:hover .sp-msg__more, .sp-msg__more:focus-visible, .sp-chat__p .sp-msg__more { opacity: 1; }
.sp-msg__more:hover { background: rgba(255, 255, 255, .1); color: #fff; }
@media (hover: none) { .sp-msg__more { opacity: .55; } }

.sp-chat__down { position: absolute; left: 50%; bottom: 10px; transform: translateX(-50%); z-index: 3; display: inline-flex; align-items: center; gap: 7px; height: 32px; padding: 0 14px; border-radius: 999px;
  border: 1px solid rgba(160, 190, 255, .35); background: rgba(20, 27, 68, .95); color: #dfe6ff; font-size: 12.5px; box-shadow: 0 8px 22px rgba(2, 4, 16, .55); animation: sp-chat-in .2s ease both; }
.sp-chat__down span { display: none; }
.sp-chat__down.has-new { background: var(--ch-me); border-color: transparent; color: #fff; }
.sp-chat__down.has-new span { display: inline; }
.sp-chat__down b:empty { display: none; }
.sp-chat__down b { min-width: 18px; padding: 0 5px; border-radius: 999px; background: rgba(0, 0, 0, .3); font-size: 11.5px; line-height: 18px; text-align: center; }
.sp-chat__toast { position: absolute; left: 12px; right: 12px; bottom: 12px; z-index: 6; padding: 9px 12px; border-radius: 12px; font-size: 13px; text-align: center; color: #fff;
  background: rgba(190, 40, 70, .95); box-shadow: 0 10px 26px rgba(2, 4, 16, .6); animation: sp-chat-in .2s ease both; transition: opacity .3s; }
.sp-chat__toast.is-out { opacity: 0; }

/* ---------- Кто в чате ---------- */
.sp-chat__people { position: absolute; inset: 0 0 0 auto; z-index: 4; width: min(280px, 86%); display: flex; flex-direction: column; background: #10163a; border-left: 1px solid var(--ch-line);
  box-shadow: -14px 0 34px rgba(2, 4, 16, .5); animation: sp-chat-side .2s ease both; }
.sp-chat__ptitle { flex: 0 0 auto; display: flex; align-items: center; gap: 8px; padding: 10px 12px; font-weight: 700; color: #fff; border-bottom: 1px solid var(--ch-line); }
.sp-chat__ptitle b { padding: 0 8px; border-radius: 999px; background: rgba(52, 211, 153, .16); color: #6ee7b7; font-size: 12px; line-height: 20px; }
.sp-chat__ptitle button { margin-left: auto; width: 28px; height: 28px; border: 0; border-radius: 8px; background: var(--ch-in); display: grid; place-items: center; font-size: 18px; color: var(--ch-mut); }
.sp-chat__plist { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 6px; scrollbar-width: thin; }
.sp-chat__p { position: relative; display: flex; align-items: center; gap: 9px; padding: 6px 32px 6px 6px; border-radius: 10px; }
.sp-chat__p:hover { background: rgba(255, 255, 255, .06); }
.sp-chat__p img { width: 34px; height: 34px; border-radius: 11px; object-fit: cover; background: #1b2356; flex: 0 0 auto; }
.sp-chat__p > div { min-width: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 2px 6px; }
.sp-chat__pname { color: #dfe6ff; cursor: pointer; overflow: hidden; text-overflow: ellipsis; }
.sp-chat__pname.s2 { color: #f9a8d4; }
.sp-chat__pname.s1 { color: #93c5fd; }
.sp-chat__p small { flex-basis: 100%; color: var(--ch-mut); font-size: 11.5px; }
.sp-chat__p.is-ban .sp-chat__pname { text-decoration: line-through; color: #f87171; }
.sp-chat__p .sp-msg__more { right: 4px; }
.sp-chat__pempty { padding: 24px 10px; text-align: center; color: var(--ch-mut); font-size: 13px; }

/* ---------- Правила, листы (бан, цвет ника) ---------- */
.sp-chat__tos, .sp-chat__sheet { position: absolute; inset: 0; z-index: 7; display: flex; flex-direction: column; background: rgba(9, 13, 34, .96); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.sp-chat__tos { padding: 14px; gap: 12px; }
.sp-chat__tostext { flex: 1 1 auto; min-height: 0; overflow-y: auto; font-size: 13px; line-height: 1.55; color: #c9d5f3; padding-right: 4px; scrollbar-width: thin; }
.sp-chat__tos > .sp-b { flex: 0 0 auto; align-self: center; }
.sp-chat__sheet { justify-content: flex-end; background: rgba(4, 6, 20, .7); }
.sp-chat__sheetbox { padding: 16px 14px; border-radius: 18px 18px 0 0; background: #161d49; border-top: 1px solid rgba(160, 190, 255, .3); display: flex; flex-direction: column; gap: 12px; animation: sp-chat-up .22s ease both; }
.sp-chat__sheettitle { font-size: 15px; color: #fff; }
.sp-chat__sheetnote { margin: 0; font-size: 12.5px; color: var(--ch-mut); }
.sp-chat__chips { display: flex; flex-wrap: wrap; gap: 6px; }
.sp-chat__chips button { padding: 6px 12px; border-radius: 999px; border: 1px solid var(--ch-line); background: var(--ch-in); font-size: 12.5px; }
.sp-chat__chips button.is-on { background: var(--ch-me); border-color: transparent; color: #fff; }
.sp-chat .sp-chat__field { width: 100%; height: 38px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--ch-line); background: rgba(0, 0, 0, .3); color: #fff; font-size: 14px; outline: 0; }
.sp-chat .sp-chat__field:focus { border-color: #7c9bff; }
.sp-chat__sheetacts { display: flex; justify-content: flex-end; gap: 8px; }
.sp-chat__colors { display: grid; grid-template-columns: repeat(auto-fill, minmax(30px, 1fr)); gap: 6px; max-height: 190px; overflow-y: auto; }
.sp-chat__colors button { aspect-ratio: 1; border-radius: 9px; border: 2px solid rgba(255, 255, 255, .18); transition: transform .12s, border-color .12s; }
.sp-chat__colors button:hover { transform: scale(1.12); border-color: #fff; }

/* ---------- Всплывающее меню ---------- */
.sp-chat__menu { position: absolute; z-index: 9; min-width: 210px; max-width: calc(100% - 16px); padding: 6px; border-radius: 14px; background: #1a2256; border: 1px solid rgba(160, 190, 255, .3);
  box-shadow: 0 18px 44px rgba(2, 4, 16, .7); animation: sp-chat-pop .14s ease both; }
.sp-chat__menu button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border: 0; border-radius: 9px; background: none; text-align: left; font-size: 13.5px; color: #dfe6ff; }
.sp-chat__menu button:hover { background: rgba(255, 255, 255, .09); }
/* пояснение в меню (не кнопка): почему у модератора нет пункта «Забанить» (v2.22) */
.sp-chat__note { display: flex; align-items: flex-start; gap: 10px; max-width: 250px; padding: 7px 10px; font-size: 12px; line-height: 1.35; color: var(--ch-mut); }
.sp-chat__note > i { width: 16px; margin-top: 2px; text-align: center; flex: 0 0 auto; }
.sp-chat__menu button > i { width: 16px; text-align: center; color: var(--ch-mut); flex: 0 0 auto; }
.sp-chat__menu button.is-danger, .sp-chat__menu button.is-danger > i { color: #fca5a5; }
.sp-chat__menu button.is-on > i { color: #34d399; }
.sp-chat__menu button.is-on::after { content: "вкл"; margin-left: auto; font-size: 11px; color: #34d399; }
.sp-chat__sep { display: block; height: 1px; margin: 5px 6px; background: var(--ch-line); }

/* ---------- Ввод ---------- */
.sp-chat__foot { flex: 0 0 auto; border-top: 1px solid var(--ch-line); background: rgba(0, 0, 0, .22); padding-bottom: env(safe-area-inset-bottom, 0); }
.sp-chat__reply { display: flex; align-items: center; gap: 9px; padding: 7px 12px; border-bottom: 1px solid var(--ch-line); font-size: 12.5px; color: #b9c6e8; }
.sp-chat__reply > i { color: #7c8fff; }
.sp-chat__reply > div { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sp-chat__reply b { color: #9db8ff; margin-right: 6px; }
.sp-chat__reply button { flex: 0 0 auto; width: 24px; height: 24px; border: 0; border-radius: 7px; background: var(--ch-in); font-size: 16px; line-height: 1; color: var(--ch-mut); }
.sp-chat__state { padding: 14px 16px; text-align: center; font-size: 13px; color: #c9d5f3; }
.sp-chat__state a { color: #8fb4ff; }
.sp-chat__input { display: flex; align-items: flex-end; gap: 6px; padding: 9px 10px; }
.sp-chat__input > button { flex: 0 0 auto; width: 38px; height: 38px; border: 0; border-radius: 12px; background: var(--ch-in); display: grid; place-items: center; font-size: 17px; color: #b9c6e8; transition: background .15s, transform .15s, color .15s; }
.sp-chat__input > button:hover { background: rgba(255, 255, 255, .12); color: #fff; }
.sp-chat .sp-chat__input textarea { flex: 1 1 auto; min-width: 0; min-height: 38px; max-height: 120px; resize: none; padding: 9px 12px; border-radius: 14px; border: 1px solid var(--ch-line);
  background: rgba(0, 0, 0, .28); color: #fff; font: inherit; line-height: 1.4; outline: 0; box-shadow: none; overflow-y: auto; scrollbar-width: thin; }
.sp-chat .sp-chat__input textarea:focus { border-color: #7c9bff; box-shadow: 0 0 0 3px rgba(109, 120, 255, .18); }
.sp-chat .sp-chat__input textarea::placeholder { color: #6f7ca6; }
.sp-chat__len { flex: 0 0 auto; align-self: center; min-width: 0; font-size: 11.5px; color: var(--ch-mut); font-variant-numeric: tabular-nums; }
.sp-chat__len.is-low { color: #fca5a5; }
.sp-chat__input > .sp-chat__send { background: var(--ch-me); color: #fff; box-shadow: 0 6px 18px rgba(109, 75, 245, .45); }
.sp-chat__input > .sp-chat__send:hover { background: var(--ch-me); filter: brightness(1.12); transform: translateY(-1px); }
.sp-chat.is-sending .sp-chat__send { opacity: .6; pointer-events: none; }
.sp-chat__smiles { border-bottom: 1px solid var(--ch-line); padding: 8px 10px; animation: sp-chat-up .18s ease both; }
.sp-chat__fmt { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 8px; }
.sp-chat__fmt button { min-width: 32px; height: 28px; padding: 0 9px; border-radius: 8px; border: 1px solid var(--ch-line); background: var(--ch-in); font-size: 12.5px; }
.sp-chat__fmt button:hover { border-color: rgba(160, 190, 255, .45); }
.sp-chat__smgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(38px, 1fr)); gap: 2px; max-height: 164px; overflow-y: auto; scrollbar-width: thin; }
.sp-chat__sm { height: 38px; border: 0; border-radius: 9px; background: none; display: grid; place-items: center; transition: background .12s, transform .12s; }
.sp-chat__sm:hover { background: rgba(255, 255, 255, .1); transform: scale(1.15); }
.sp-chat__sm img { width: 28px; height: 28px; display: block; }

/* ---------- Кнопка «ЧАТ»: счётчик непрочитанных ---------- */
.sp-chat-badge { display: inline-block; min-width: 18px; height: 18px; margin-left: 6px; padding: 0 5px; border-radius: 999px; background: #f43f5e; color: #fff; font: 700 11px/18px Arial, sans-serif;
  text-align: center; letter-spacing: 0; box-shadow: 0 0 0 2px rgba(10, 14, 36, .9); animation: sp-chat-pop .2s ease both; }
.sp-chat-badge.is-me { background: #f59e0b; box-shadow: 0 0 0 2px rgba(10, 14, 36, .9), 0 0 12px rgba(245, 158, 11, .8); }
.sp-chat-badge[hidden] { display: none; }
html.sp-chat-open .go2_ajaxchat { opacity: .35; }

/* Страница чата: вводная строка */
.sp-chatpage__lead { margin: 4px 0 12px; font-size: 13px; line-height: 1.5; color: #a9b8dc; text-align: center; }
.sp-chatpage__lead span { color: #8fb4ff; border-bottom: 1px dotted #8fb4ff; cursor: pointer; }

@keyframes sp-chat-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes sp-chat-up { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes sp-chat-pop { from { opacity: 0; transform: scale(.94); } to { opacity: 1; transform: none; } }
@keyframes sp-chat-side { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: none; } }
@keyframes sp-chat-pulse { 0% { box-shadow: 0 0 0 0 rgba(52, 211, 153, .55); } 70%, 100% { box-shadow: 0 0 0 7px rgba(52, 211, 153, 0); } }
@keyframes sp-chat-flash { 0%, 100% { box-shadow: none; } 30% { box-shadow: 0 0 0 3px rgba(124, 155, 255, .7), 0 0 26px rgba(124, 155, 255, .6); } }
@media (prefers-reduced-motion: reduce) {
  .sp-chat--drawer { transition: none; }
  .sp-msg, .sp-chat__down, .sp-chat__menu, .sp-chat__sheetbox, .sp-chat__smiles, .sp-chat__people, .sp-chat__toast, .sp-chat-badge { animation: none; }
  .sp-chat__online i { animation: none; }
}
