/* Окно чата с поддержкой на страницах сайта сервиса (templates/_site_chat.html, assets/js/site-chat.js).
   Самодостаточно: страница правового документа живёт без темы и без landing.css, поэтому цвета и
   шрифт заданы здесь, а классы — со своим префиксом sc-, чтобы ни с чем на странице не спорить.
   Цвета — те же, что у сайта (landing.css: --ld-blue, --ld-ink) */

.sc {
  --sc-blue: #2c7be5;
  --sc-blue-dark: #1a68d1;
  --sc-ink: #0e1b2c;
  --sc-mute: #6b7a8e;
  --sc-line: #e3e8ef;
  --sc-soft: #f4f7fb;
  --sc-green: #12a36d;
  --sc-red: #e14b4b;
  font-family: inherit;
  color: var(--sc-ink);
}
.sc *, .sc *::before, .sc *::after { box-sizing: border-box; }
.sc [hidden], .sc .d-none { display: none !important; }
.sc svg { width: 1.25rem; height: 1.25rem; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* Кнопка в углу. Ниже плашки о cookie (z-index 2000): та нужна один раз и закрывается */
.sc-launch {
  position: fixed; right: 20px; bottom: calc(20px + var(--sc-lift, 0px)); z-index: 1990;
  width: 60px; height: 60px; border: 0; border-radius: 50%; cursor: pointer;
  display: flex; align-items: center; justify-content: center; color: #fff;
  background: linear-gradient(135deg, #3d8bf2, var(--sc-blue-dark));
  box-shadow: 0 10px 28px rgba(44, 123, 229, .42), 0 2px 6px rgba(14, 27, 44, .18);
  transition: transform .18s ease, box-shadow .18s ease;
}
.sc-launch:hover { transform: translateY(-2px) scale(1.04); box-shadow: 0 14px 32px rgba(44, 123, 229, .5), 0 2px 6px rgba(14, 27, 44, .18); }
.sc-launch:focus-visible { outline: 3px solid rgba(44, 123, 229, .45); outline-offset: 3px; }
.sc-launch svg { width: 28px; height: 28px; }
.sc-launch__chat { fill: currentColor !important; stroke: none !important; }
.sc-launch__chat circle { fill: var(--sc-blue); }
.sc-launch__close { display: none; }
.sc--open .sc-launch__chat { display: none; }
.sc--open .sc-launch__close { display: block; }
/* Точка «на связи» — зелёная, пока поддержка работает */
.sc-launch__dot { position: absolute; right: 3px; bottom: 3px; width: 14px; height: 14px; border-radius: 50%;
  background: #b8c2d0; border: 3px solid #fff; }
.sc--online .sc-launch__dot { background: var(--sc-green); }
.sc-launch__badge { position: absolute; top: -4px; right: -4px; min-width: 22px; height: 22px; padding: 0 6px;
  border-radius: 11px; background: var(--sc-red); color: #fff; font-size: 12px; font-weight: 600; line-height: 22px;
  text-align: center; box-shadow: 0 0 0 2px #fff; }

/* Окно */
.sc-panel {
  position: fixed; right: 20px; bottom: 92px; z-index: 2001; /* открытое окно — над плашкой о cookie */
  margin: 0; padding: 0;
  width: 380px; height: min(600px, calc(100vh - 116px)); height: min(600px, calc(100dvh - 116px));
  display: flex; flex-direction: column; overflow: hidden;
  background: #fff; border-radius: 20px;
  box-shadow: 0 24px 64px rgba(14, 27, 44, .22), 0 0 0 1px rgba(14, 27, 44, .06);
  animation: sc-in .2s ease;
}
@keyframes sc-in { from { opacity: 0; transform: translateY(12px) scale(.98); } to { opacity: 1; transform: none; } }

.sc-head { display: flex; align-items: center; gap: 12px; padding: 16px 16px 16px 18px; color: #fff;
  background: linear-gradient(135deg, #0f2a4d, #1d4f8f 60%, var(--sc-blue)); }
.sc-head__logo { width: 40px; height: 40px; border-radius: 12px; display: flex; align-items: center; justify-content: center;
  background: rgba(255, 255, 255, .14); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .22); font-weight: 700; font-size: 18px; }
.sc-head__text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.sc-head__text b { font-size: 16px; font-weight: 600; }
.sc-status { display: flex; align-items: baseline; gap: 6px; font-size: 12.5px; line-height: 1.35; color: rgba(255, 255, 255, .8); }
.sc-status i { width: 8px; height: 8px; border-radius: 50%; background: #b8c2d0; flex: none; align-self: flex-start; margin-top: .3em; }
.sc--online .sc-status i { background: #3ee08f; box-shadow: 0 0 0 3px rgba(62, 224, 143, .25); }
.sc-head__close { border: 0; background: rgba(255, 255, 255, .12); color: #fff; width: 34px; height: 34px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center; cursor: pointer; }
.sc-head__close:hover { background: rgba(255, 255, 255, .22); }

/* Лента */
.sc-scroll { flex: 1; overflow-y: auto; padding: 16px 14px 8px; background: var(--sc-soft); overscroll-behavior: contain; }
.sc-day { text-align: center; margin: 10px 0 6px; }
.sc-day span { display: inline-block; padding: 2px 10px; border-radius: 10px; background: #e7edf5; color: var(--sc-mute); font-size: 11.5px; }
.sc-sys { text-align: center; color: var(--sc-mute); font-size: 12px; padding: 6px 12px; }
.sc-msg { display: flex; flex-direction: column; align-items: flex-start; margin: 4px 0 8px; max-width: 86%; }
.sc-msg--mine { align-items: flex-end; margin-left: auto; }
.sc-author { font-size: 11.5px; color: var(--sc-mute); margin: 0 0 3px 4px; }
.sc-bubble { padding: 9px 13px; border-radius: 16px 16px 16px 6px; background: #fff; color: var(--sc-ink);
  font-size: 14.5px; line-height: 1.45; overflow-wrap: anywhere; box-shadow: 0 1px 2px rgba(14, 27, 44, .06); }
.sc-msg--mine .sc-bubble { border-radius: 16px 16px 6px 16px; background: var(--sc-blue); color: #fff; box-shadow: none; }
.sc-emoji-only { font-size: 28px; line-height: 1.2; }
.sc-emoji-only--big { font-size: 40px; }
.sc-time { display: flex; align-items: center; gap: 4px; font-size: 11px; color: #9aa6b6; margin: 3px 4px 0; }
.sc-tick svg { width: 15px; height: 13px; stroke-width: 2.2; }
.sc-tick--read { color: var(--sc-blue); }
.sc-img img { display: block; max-width: 230px; max-height: 220px; border-radius: 14px; background: #e7edf5; }
.sc-file, .sc-gone { display: flex; flex-direction: column; padding: 9px 12px; border-radius: 12px; background: #fff;
  border: 1px solid var(--sc-line); font-size: 13px; color: var(--sc-ink); text-decoration: none; margin-bottom: 4px; }
.sc-file small { color: var(--sc-mute); }
.sc-gone { color: var(--sc-mute); }

/* Низ окна */
.sc-foot { padding: 10px 12px 8px; border-top: 1px solid var(--sc-line); background: #fff; }
.sc-error { margin: 0 2px 8px; padding: 7px 10px; border-radius: 10px; background: #fdecec; color: #b42323; font-size: 12.5px; }
.sc-contact { margin: 0 0 8px; padding: 10px; border-radius: 12px; background: var(--sc-soft); }
.sc-contact p { margin: 0 0 8px; font-size: 12.5px; line-height: 1.45; color: #46566b; }
.sc-input { display: block; width: 100%; margin-top: 6px; padding: 8px 11px; border: 1px solid var(--sc-line); border-radius: 10px;
  font: inherit; font-size: 14px; background: #fff; color: var(--sc-ink); }
.sc-input:focus, .sc-textarea:focus { outline: none; border-color: var(--sc-blue); box-shadow: 0 0 0 3px rgba(44, 123, 229, .15); }
.sc-pending { display: flex; align-items: center; gap: 8px; margin: 0 2px 8px; font-size: 13px; color: #46566b; }
.sc-pending span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sc-pending button { border: 0; background: none; color: var(--sc-mute); cursor: pointer; padding: 2px; display: flex; }
.sc-pending button svg { width: 16px; height: 16px; }
.sc-form { position: relative; display: flex; align-items: flex-end; gap: 6px; }
.sc-hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
.sc-btn { flex: none; width: 38px; height: 40px; border: 0; border-radius: 10px; background: transparent; color: var(--sc-mute);
  display: flex; align-items: center; justify-content: center; cursor: pointer; margin: 0; }
.sc-btn:hover, .sc-btn[aria-expanded="true"] { background: var(--sc-soft); color: var(--sc-blue); }
.sc-btn input { display: none; }
.sc-textarea { flex: 1; min-width: 0; min-height: 40px; max-height: 120px; resize: none; padding: 9px 12px;
  border: 1px solid var(--sc-line); border-radius: 12px; font: inherit; font-size: 14.5px; line-height: 1.4; color: var(--sc-ink); background: #fff; }
.sc-send { flex: none; width: 42px; height: 40px; border: 0; border-radius: 12px; cursor: pointer; color: #fff; background: var(--sc-blue);
  display: flex; align-items: center; justify-content: center; transition: background .15s; }
.sc-send:hover { background: var(--sc-blue-dark); }
.sc-send:disabled { opacity: .55; cursor: default; }
.sc-send svg { width: 19px; height: 19px; fill: currentColor; stroke-width: 1.5; }
.sc-legal { margin-top: 6px; text-align: center; font-size: 11px; color: #9aa6b6; }
.sc-legal a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }

/* Смайлики — панель над полем, её строит support-chat.js (классы те же, что у панели заведения) */
.sc .support-emoji { position: absolute; bottom: calc(100% + 8px); left: 0; z-index: 5; width: 100%; max-height: 230px;
  overflow-y: auto; padding: 8px; background: #fff; border: 1px solid var(--sc-line); border-radius: 14px;
  box-shadow: 0 12px 32px rgba(14, 27, 44, .16); }
.sc .support-emoji__title { font-size: 11px; color: var(--sc-mute); margin: 4px 4px 2px; }
.sc .support-emoji__grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(36px, 1fr)); }
.sc .support-emoji__item { border: 0; background: transparent; font-size: 22px; line-height: 1; padding: 6px 0; cursor: pointer;
  transition: transform .1s ease; }
.sc .support-emoji__item:hover { transform: scale(1.25); }

/* Файл, который держат над окном */
.sc-panel.support-chat--drop { outline: 2px dashed var(--sc-blue); outline-offset: -6px; }

/* Телефон — окно на весь экран: на узком экране плавающий прямоугольник закрывал бы всё равно,
   а лента получает всю высоту */
@media (max-width: 520px) {
  .sc-launch { right: 16px; bottom: calc(16px + var(--sc-lift, 0px)); width: 56px; height: 56px; }
  .sc-panel { inset: 0; width: auto; height: auto; border-radius: 0; animation: none; }
  .sc--open .sc-launch { display: none; }
  .sc-textarea { font-size: 16px; } /* меньше 16 px — iPhone приближает страницу при вводе */
}

@media (prefers-reduced-motion: reduce) {
  .sc-panel { animation: none; }
  .sc-launch { transition: none; }
}
