/* Чат с посетителем (inc/chat.php, js/chat.js). Макет согласован 13.10.2026: кнопка Б — золотая «Задать вопрос». */
.wgc-launch { position: fixed; z-index: 16; right: 24px; bottom: calc(24px + var(--wgc-cookie, 0px)); display: inline-flex; align-items: center; gap: 10px; height: 52px; padding: 0 22px 0 18px; color: #463411; background: #cc9933; border: 1px solid #cc9933; border-radius: 0.8125rem; box-shadow: 0 8px 24px rgba(35, 35, 35, 0.22); font-family: "Golos-SemiBold", sans-serif; font-size: 1rem; line-height: 1; white-space: nowrap; cursor: pointer; transition: background-color 0.16s ease, color 0.16s ease; }
.wgc-launch svg { width: 22px; height: 22px; flex: none; }
/* Наведение заливных кнопок — контур (docs/design/css-baseline.md). */
@media (hover: hover) { .wgc-launch:hover { color: #896722; background: #fff; border-color: #896722; } }
.wgc-launch:focus-visible { outline: 2px solid #896722; outline-offset: 3px; }
.wgc-launch[hidden] { display: none; }
.wgc-launch__dot { position: absolute; top: -4px; right: -4px; width: 14px; height: 14px; background: #232323; border: 2px solid #fff; border-radius: 50%; }
.wgc-launch__dot[hidden] { display: none; }

.wgc { position: fixed; z-index: 16; right: 24px; bottom: 24px; display: flex; flex-direction: column; width: 376px; height: min(600px, calc(100dvh - 48px)); overflow: hidden; color: #232323; background: #fff; border-radius: 1.5rem; box-shadow: 0 18px 50px rgba(35, 35, 35, 0.24), 0 0 0 1px rgba(35, 35, 35, 0.06); font-family: "Golos-Regular", sans-serif; }
.wgc[hidden] { display: none; }
/* Появление: 180 мс из угла кнопки; исчезание быстрее — 120 мс (js/chat.js, showPanel/hidePanel). */
.wgc { transform-origin: 100% 100%; transition: opacity 0.18s ease-out, transform 0.18s cubic-bezier(0.2, 0.8, 0.2, 1); }
.wgc.wgc--off { opacity: 0; transform: translateY(12px) scale(0.97); }
.wgc.wgc--leaving { transition-duration: 0.12s; transition-timing-function: ease-in; }
.wgc-launch:not([hidden]) { animation: wgc-pop 0.18s ease-out; }
@keyframes wgc-pop { from { opacity: 0; transform: scale(0.94); } }
.wgc__sr { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.wgc__head { display: flex; align-items: flex-start; gap: 12px; padding: 18px 14px 16px 20px; color: #fff; background: #232323; --focus-ring: #cc9933; }
.wgc__title { margin: 0; font-family: "Golos-SemiBold", sans-serif; font-size: 1.0625rem; line-height: 1.25; }
.wgc__sub { display: flex; align-items: center; gap: 7px; margin: 5px 0 0; color: rgba(255, 255, 255, 0.65); font-size: 0.84375rem; line-height: 1.35; }
.wgc__sub::before { content: ""; width: 8px; height: 8px; flex: none; background: #cc9933; border-radius: 50%; }
.wgc__sub--off::before { background: rgba(255, 255, 255, 0.4); }
.wgc__close { display: grid; place-items: center; width: 36px; height: 36px; flex: none; margin-left: auto; padding: 0; color: rgba(255, 255, 255, 0.75); background: transparent; border: 0; border-radius: 0.5rem; cursor: pointer; }
@media (hover: hover) { .wgc__close:hover { color: #fff; } }
.wgc__close:focus-visible { outline: 2px solid #cc9933; outline-offset: 0; }
.wgc__close svg { width: 18px; height: 18px; }

.wgc__log { display: flex; flex: 1; flex-direction: column; gap: 10px; min-height: 0; padding: 18px 16px 10px; overflow-y: auto; overscroll-behavior: contain; }
.wgc__log > :first-child { margin-top: auto; }
.wgc__msg { max-width: 82%; margin: 0; padding: 10px 14px; border-radius: 1.125rem; font-size: 0.9375rem; line-height: 1.42; overflow-wrap: anywhere; white-space: pre-line; }
.wgc__msg--staff { align-self: flex-start; background: #f5f5f5; border-bottom-left-radius: 0.5rem; }
.wgc__msg--visitor { align-self: flex-end; background: #f7f0de; border-bottom-right-radius: 0.5rem; }
.wgc__msg--pending, .wgc__msg--failed { opacity: 0.6; }
.wgc__who { display: block; margin-bottom: 3px; color: #896722; font-family: "Golos-SemiBold", sans-serif; font-size: 0.75rem; }
.wgc__time { display: block; margin-top: 4px; color: #6b6b6b; font-size: 0.71875rem; text-align: right; }
.wgc__note-line { align-self: flex-start; margin: 0; color: #555; font-size: 0.8125rem; }
.wgc__note-line b { color: #896722; font-weight: normal; font-family: "Golos-SemiBold", sans-serif; }
.wgc__error { align-self: stretch; margin: 0; color: #a12f2f; font-size: 0.8125rem; }

.wgc__card { align-self: stretch; padding: 14px; border: 1px solid #e4e4e4; border-radius: 1.125rem; font-size: 0.90625rem; line-height: 1.4; }
.wgc__card p { margin: 0 0 10px; }
.wgc__row { display: flex; flex-wrap: wrap; gap: 8px; }
.wgc__name { display: block; width: 100%; margin-bottom: 8px; }
.wgc__phone { flex: 1 1 150px; min-width: 0; height: 44px; padding: 0 12px; color: #232323; background: #fff; border: 1px solid #d6d6d6; border-radius: 0.8125rem; font: inherit; font-size: 0.9375rem; }
.wgc__btn { flex: 1 0 auto; height: 44px; padding: 0 16px; color: #463411; background: #cc9933; border: 1px solid #cc9933; border-radius: 0.8125rem; font-family: "Golos-SemiBold", sans-serif; font-size: 0.9375rem; white-space: nowrap; cursor: pointer; }
@media (hover: hover) { .wgc__btn:hover { color: #896722; background: #fff; border-color: #896722; } }
.wgc__btn:disabled { opacity: 0.6; cursor: default; }
.wgc__consent { display: flex; align-items: flex-start; gap: 8px; margin-top: 10px; color: #555; font-size: 0.78125rem; line-height: 1.35; cursor: pointer; }
/* style.css снимает у input внешний вид (appearance: none) — галочку рисуем сами. */
.wgc__consent input { width: 18px; height: 18px; flex: none; margin: 0; padding: 0; background: #fff center / 12px no-repeat; border: 1.5px solid #232323; border-radius: 4px; cursor: pointer; }
.wgc__consent input:checked { background-color: #896722; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M2.5 6.2 5 8.6l4.5-5' fill='none' stroke='%23fff' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); border-color: #896722; }
.wgc a { color: inherit; text-decoration: underline; text-decoration-color: #cc9933; text-decoration-thickness: 2px; text-underline-offset: 3px; }
.wgc a:hover { text-decoration-color: currentColor; }

.wgc__foot { padding: 10px 12px 12px; border-top: 1px solid #ededed; }
.wgc__form { display: flex; align-items: flex-end; gap: 8px; }
.wgc__input { flex: 1; min-width: 0; height: 44px; max-height: 120px; padding: 11px 12px; color: #232323; background: #fff; border: 1px solid #d6d6d6; border-radius: 0.8125rem; font: inherit; font-size: 0.9375rem; line-height: 1.4; resize: none; overflow-y: hidden; scrollbar-width: thin; }
.wgc__input::placeholder, .wgc__phone::placeholder { color: #767676; }
/* Поле ввода в фокусе без обводки — решение владельца 13.10.2026: фокус показывает курсор. */
.wgc__input:focus, .wgc__phone:focus { outline: none; }
.wgc__send { display: grid; place-items: center; width: 44px; height: 44px; flex: none; padding: 0; color: #463411; background: #cc9933; border: 1px solid #cc9933; border-radius: 0.8125rem; cursor: pointer; }
@media (hover: hover) { .wgc__send:hover { color: #896722; background: #fff; border-color: #896722; } }
.wgc__send svg { width: 20px; height: 20px; }
.wgc__btn:focus-visible, .wgc__send:focus-visible, .wgc__consent input:focus-visible { outline: 2px solid #896722; outline-offset: 2px; }
.wgc__legal { margin: 7px 0 0; color: #6b6b6b; font-size: 0.71875rem; line-height: 1.35; text-align: center; }

/* На планшете и телефоне баннер cookie во всю ширину снизу (z-index 10000): окно чата — поверх него, иначе он закрывает поле ввода. */
@media (max-width: 1023px) { .wgc { z-index: 10001; } }
@media (max-width: 767px) {
  .wgc-launch { right: 16px; bottom: max(16px, env(safe-area-inset-bottom)); justify-content: center; width: 44px; height: 44px; padding: 0; }
  .wgc-launch > span:not(.wgc-launch__dot) { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  body:has(.wg-cookie:not([hidden]), .form:focus-within) .wgc-launch { display: none; }
  .wgc { inset: 0; width: auto; height: auto; border-radius: 0; box-shadow: none; }
  .wgc.wgc--off { transform: translateY(24px); }
  .wgc__head { padding-top: max(18px, env(safe-area-inset-top)); }
  .wgc__foot { padding-bottom: max(12px, env(safe-area-inset-bottom)); }
  /* 16 px — iOS не увеличивает страницу при вводе. */
  .wgc__input, .wgc__phone { font-size: 1rem; }
}
@media (prefers-reduced-motion: reduce) { .wgc, .wgc-launch, .wgc__btn, .wgc__send { transition: none; animation: none; } }

/* Выпуск CRM 62: файлы, «печатает», «прочитано», оценка (13.10.2026). */
.wgc__text { margin: 0; white-space: pre-line; }
.wgc__attach { display: grid; place-items: center; width: 44px; height: 44px; flex: none; padding: 0; color: #5f6764; background: transparent; border: 1px solid #d6d6d6; border-radius: 0.8125rem; cursor: pointer; }
.wgc__attach[hidden] { display: none; }
.wgc__attach svg { width: 20px; height: 20px; }
.wgc__img { display: block; max-width: 100%; padding: 0; background: none; border: 0; border-radius: 0.8125rem; overflow: hidden; cursor: zoom-in; }
.wgc__img img { display: block; max-width: 100%; max-height: 220px; border-radius: 0.8125rem; }
.wgc__img--broken { padding: 8px 10px; color: #555; font-size: 0.8125rem; cursor: default; }
.wgc__doc { display: grid; grid-template-columns: 22px minmax(0, 1fr); column-gap: 8px; align-items: center; max-width: 240px; padding: 8px 12px 8px 10px; color: #232323; text-align: left; background: rgba(255, 255, 255, 0.7); border: 1px solid rgba(35, 35, 35, 0.12); border-radius: 0.8125rem; font: inherit; cursor: pointer; }
.wgc__doc svg { width: 22px; height: 22px; grid-row: span 2; color: #896722; }
.wgc__doc-name { overflow: hidden; font-size: 0.875rem; text-overflow: ellipsis; white-space: nowrap; }
.wgc__doc-size { color: #6b6b6b; font-size: 0.75rem; }
.wgc__read { color: #6b6b6b; }
.wgc__typing { margin: 0 0 8px; color: #6b6b6b; font-size: 0.8125rem; }
.wgc__typing[hidden] { display: none; }
.wgc__rate { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 10px; }
.wgc__rate[hidden] { display: none; }
.wgc__rate-q { margin-right: 4px; font-size: 0.875rem; }
.wgc__rate-btn { display: grid; place-items: center; width: 36px; height: 36px; padding: 0; color: #232323; background: #fff; border: 1px solid #d6d6d6; border-radius: 0.5rem; cursor: pointer; }
.wgc__rate-btn svg { width: 20px; height: 20px; }
.wgc__rate-text { flex: 1 1 100%; height: auto; min-height: 64px; overflow-y: auto; }
.wgc__attach:focus-visible, .wgc__rate-btn:focus-visible, .wgc__img:focus-visible, .wgc__doc:focus-visible { outline: 2px solid #896722; outline-offset: 2px; }
@media (hover: hover) {
  .wgc__attach:hover, .wgc__rate-btn:hover { color: #896722; border-color: #896722; }
  .wgc__doc:hover { border-color: #896722; }
}
