/**
 * Виджет онлайн-чата (клиент): кнопка-лаунчер + панель чата.
 * Чистый минималистичный стиль в палитре сайта (зелёный #0a8f2a, фон #f6f7f9).
 * Разметка и поведение (toggle через .site-chat--open) не менялись.
 */

.site-chat {
    --chat-green:       #0a8f2a;
    --chat-green-dark:  #087a24;
    --chat-green-soft:  rgba(10, 143, 42, 0.10);
    --chat-header-grad: linear-gradient(135deg, #0a8f2a 0%, #12a63a 55%, #087a24 100%);
    --chat-send-grad:   linear-gradient(344deg, #0a8f2a 0%, #087a24 100%);

    --chat-bg:          #f6f7f9;
    --chat-surface:     #ffffff;
    --chat-text:        #0b0f14;
    --chat-muted:       rgba(11, 15, 20, 0.62);
    --chat-muted-soft:  rgba(11, 15, 20, 0.45);
    --chat-border:      rgba(15, 23, 42, 0.08);
    --chat-border-soft: rgba(15, 23, 42, 0.05);

    --chat-bubble-in:   #ffffff;
    --chat-bubble-out:  var(--chat-send-grad);

    --chat-shadow:      0 18px 50px rgba(16, 24, 40, 0.12), 0 2px 6px rgba(16, 24, 40, 0.06);
    --chat-shadow-fab:  0 12px 30px rgba(10, 143, 42, 0.35), 0 4px 12px rgba(10, 143, 42, 0.18);

    --chat-radius-panel: 24px;
    --chat-radius-bubble: 18px;
    --chat-radius-pill:  999px;

    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 99999;
    font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
    font-size: 14px;
    line-height: 1.4;
    color: var(--chat-text);
}

/* ───────────────────────── Кнопка-лаунчер ───────────────────────── */

.site-chat__launcher {
    position: relative;
    width: 60px;
    height: 60px;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    background: var(--chat-header-grad);
    color: #fff;
    box-shadow: var(--chat-shadow-fab);
    display: flex;
    align-items: center;
    justify-content: center;
    transform: scale(1);
    transition: transform 0.18s ease, filter 0.18s ease, box-shadow 0.18s ease;
}

.site-chat__launcher:hover {
    transform: scale(1.05);
    filter: brightness(1.04);
    box-shadow: 0 16px 36px rgba(10, 143, 42, 0.42), 0 6px 14px rgba(10, 143, 42, 0.22);
}

.site-chat__launcher:active {
    transform: scale(0.98);
    filter: brightness(1);
}

.site-chat__launcher-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    transform-origin: center center;
    transition: transform 0.18s ease;
}

.site-chat__launcher:hover .site-chat__launcher-icon {
    transform: scale(1.08);
}

.site-chat__launcher svg {
    width: 28px;
    height: 28px;
}

.site-chat__launcher:focus-visible {
    outline: 2px solid var(--chat-green);
    outline-offset: 4px;
}

/* ───────────────────────── Панель чата ───────────────────────── */
/* Открытый чат занимает правый нижний угол, кнопка в этот момент скрыта. */

.site-chat__panel {
    position: absolute;
    right: 0;
    bottom: 0;
    width: min(100vw - 32px, 384px);
    height: min(72vh, 560px);
    max-height: calc(100vh - 40px);
    background: var(--chat-surface);
    border: 1px solid var(--chat-border);
    border-radius: var(--chat-radius-panel);
    box-shadow: var(--chat-shadow);
    overflow: hidden;
    display: none;
    flex-direction: column;
    transform-origin: bottom right;
}

.site-chat--open .site-chat__panel {
    display: flex;
    animation: site-chat-pop 0.22s ease-out both;
}

.site-chat--open .site-chat__launcher {
    display: none;
}

@keyframes site-chat-pop {
    from {
        opacity: 0;
        transform: translateY(10px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* ───────────────────────── Шапка ───────────────────────── */

.site-chat__header {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 16px 16px 18px;
    background: var(--chat-header-grad);
    color: #fff;
}

.site-chat__avatar-wrap {
    position: relative;
    width: 44px;
    height: 44px;
    flex-shrink: 0;
}

.site-chat__avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(255, 255, 255, 0.55);
    background: rgba(255, 255, 255, 0.18);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

.site-chat__avatar--fallback {
    display: none;
    position: absolute;
    inset: 0;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 18px;
    color: #fff;
    background: rgba(255, 255, 255, 0.22);
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.55);
}

.site-chat__header-text {
    flex: 1;
    min-width: 0;
}

.site-chat__title {
    margin: 0;
    font-size: 15.5px;
    font-weight: 700;
    letter-spacing: -0.01em;
    display: flex;
    align-items: center;
    gap: 8px;
    color: #fff;
}

.site-chat__name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.site-chat__online-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: #7ef29a;
    box-shadow: 0 0 0 3px rgba(126, 242, 154, 0.25);
    flex-shrink: 0;
    animation: site-chat-pulse 2.4s ease-in-out infinite;
}

@keyframes site-chat-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(126, 242, 154, 0.55); }
    60%      { box-shadow: 0 0 0 6px rgba(126, 242, 154, 0); }
}

/* Должность оператора. Раньше в этой строке был статус «в сети» — его роль
   теперь целиком у зелёной точки рядом с именем. */
.site-chat__position {
    margin: 2px 0 0;
    font-size: 12px;
    font-weight: 500;
    color: rgba(235, 255, 240, 0.92);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.site-chat__close {
    width: 34px;
    height: 34px;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.16);
    color: #fff;
    font-size: 20px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s ease, transform 0.15s ease;
}

.site-chat__close:hover {
    background: rgba(255, 255, 255, 0.28);
    transform: rotate(90deg);
}

.site-chat__close:focus-visible {
    outline: 2px solid #fff;
    outline-offset: 2px;
}

/* ──────────────────── Плашка заказа под шапкой ──────────────────── */

.site-chat__orders {
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 10px 16px;
    background: var(--chat-bg);
    border-bottom: 1px solid rgba(11, 15, 20, 0.08);
}

.site-chat__orders[hidden] {
    display: none;
}

.site-chat__order {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 8px 12px;
    border-radius: 10px;
    background: #fff;
    border: 1px solid rgba(11, 15, 20, 0.1);
    font-size: 13px;
    animation: site-chat-order-in 0.2s ease-out both;
}

.site-chat__order-num {
    font-weight: 600;
    white-space: nowrap;
}

a.site-chat__order-num {
    color: var(--chat-green-dark);
    text-decoration: none;
}

a.site-chat__order-num:hover,
a.site-chat__order-num:focus-visible {
    text-decoration: underline;
}

a.site-chat__order-num:focus-visible {
    outline: 2px solid var(--chat-green);
    outline-offset: 2px;
    border-radius: 4px;
}

.site-chat__order-status {
    color: rgba(11, 15, 20, 0.62);
    font-size: 12px;
    text-align: right;
}

@keyframes site-chat-order-in {
    from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
    .site-chat__order { animation: none; }
}

/* ───────────────────────── Лента сообщений ───────────────────────── */

.site-chat__messages {
    flex: 1;
    overflow-y: auto;
    padding: 18px 16px;
    background: var(--chat-bg);
    scrollbar-width: thin;
    scrollbar-color: rgba(11, 15, 20, 0.18) transparent;
}

.site-chat__messages::-webkit-scrollbar {
    width: 6px;
}
.site-chat__messages::-webkit-scrollbar-track {
    background: transparent;
}
.site-chat__messages::-webkit-scrollbar-thumb {
    background: rgba(11, 15, 20, 0.16);
    border-radius: 999px;
}
.site-chat__messages::-webkit-scrollbar-thumb:hover {
    background: rgba(11, 15, 20, 0.28);
}

.site-chat__hint {
    text-align: center;
    font-size: 13px;
    color: var(--chat-muted);
    padding: 28px 16px;
    line-height: 1.5;
}

/* «Оператор печатает вам сообщение»: строка живёт последней в ленте те
   несколько секунд (интервал задаётся в админке), пока ответ уже получен, но
   ещё не показан. */
.site-chat__typing {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
    padding: 8px 12px;
    border-radius: var(--chat-radius-bubble);
    background: var(--chat-bubble-in);
    border: 1px solid var(--chat-border-soft);
    font-size: 12.5px;
    color: var(--chat-muted);
    width: fit-content;
    max-width: 84%;
    animation: site-chat-typing-in 0.22s ease-out both;
}

.site-chat__typing-text {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.site-chat__typing-dots {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}

/* Волна по трём точкам: сдвиг вверх плюс рост и насыщенность цвета. Одной
   прозрачности на 5px-точке почти не видно, а заметное движение и есть весь
   смысл индикатора. Точки в брендовом зелёном: серые на белом пузыре теряются. */
.site-chat__typing-dots i {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--chat-green);
    opacity: 0.35;
    transform: translateY(0) scale(0.8);
    animation: site-chat-typing 1.3s cubic-bezier(0.4, 0, 0.2, 1) infinite;
    will-change: transform, opacity;
}

.site-chat__typing-dots i:nth-child(2) { animation-delay: 0.16s; }
.site-chat__typing-dots i:nth-child(3) { animation-delay: 0.32s; }

@keyframes site-chat-typing {
    0%, 65%, 100% { opacity: 0.3;  transform: translateY(0) scale(0.8); }
    30%           { opacity: 0.95; transform: translateY(-5px) scale(1.15); }
}

@keyframes site-chat-typing-in {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* Пульсация прозрачностью без сдвигов: движение убираем, но полностью
   замерший индикатор читается как зависший виджет, а не как набор текста. */
@keyframes site-chat-typing-soft {
    0%, 100% { opacity: 0.2; }
    50%      { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
    .site-chat__typing {
        animation: none;
    }

    .site-chat__typing-dots i {
        animation: site-chat-typing-soft 1.6s ease-in-out infinite;
        transform: none;
    }
}

.site-chat__error-msg {
    font-size: 12.5px;
    color: #b91c1c;
    text-align: center;
    padding: 10px 14px;
    margin-bottom: 10px;
    background: rgba(185, 28, 28, 0.08);
    border: 1px solid rgba(185, 28, 28, 0.18);
    border-radius: 12px;
}

/* ───────────────────────── Пузыри ───────────────────────── */

.site-chat__bubble-row {
    display: flex;
    margin-bottom: 10px;
}

.site-chat__bubble-row:last-child {
    margin-bottom: 0;
}

.site-chat__bubble-row--in  { justify-content: flex-start; }
.site-chat__bubble-row--out { justify-content: flex-end; }

.site-chat__bubble {
    max-width: 84%;
    padding: 10px 14px;
    border-radius: var(--chat-radius-bubble);
    position: relative;
    word-break: break-word;
    /* Переносы строк из шаблонов/сообщений должны сохраняться, длинные строки
       при этом переносятся сами (pre-wrap, а не pre). */
    white-space: pre-wrap;
    font-size: 14px;
    line-height: 1.45;
}

.site-chat__bubble--in {
    background: var(--chat-bubble-in);
    color: var(--chat-text);
    border: 1px solid var(--chat-border-soft);
    border-bottom-left-radius: 6px;
    box-shadow: 0 2px 10px rgba(15, 23, 42, 0.05);
}

.site-chat__bubble--out {
    background: var(--chat-bubble-out);
    color: #fff;
    border-bottom-right-radius: 6px;
    box-shadow: 0 4px 14px rgba(10, 143, 42, 0.22);
}

/* ───────── Цитата (reply) внутри пузыря ───────── */
.site-chat__quote {
    margin-bottom: 6px;
    padding: 4px 8px;
    border-left: 3px solid rgba(100, 116, 139, 0.6);
    border-radius: 6px;
    background: rgba(100, 116, 139, 0.12);
    line-height: 1.3;
}

.site-chat__bubble--out .site-chat__quote {
    border-left-color: rgba(255, 255, 255, 0.75);
    background: rgba(255, 255, 255, 0.18);
}

.site-chat__quote-author {
    display: block;
    font-size: 12px;
    font-weight: 600;
    opacity: 0.9;
}

.site-chat__quote-text {
    display: block;
    font-size: 12.5px;
    opacity: 0.85;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 240px;
}

.site-chat__quote--deleted .site-chat__quote-text {
    font-style: italic;
}

.site-chat__bubble .chat-msg-link,
.site-chat__media-caption .chat-msg-link {
    color: inherit;
    text-decoration: underline;
    word-break: break-all;
}

.site-chat__bubble-meta {
    display: block;
    margin-top: 4px;
    font-size: 11px;
    color: var(--chat-muted-soft);
}

.site-chat__bubble--out .site-chat__bubble-meta {
    color: rgba(255, 255, 255, 0.82);
    text-align: right;
}

.site-chat__bubble--out .site-chat__checks {
    margin-left: 4px;
    display: inline-flex;
    vertical-align: -2px;
}

.chat-ticks {
    display: inline-flex;
    color: inherit;
    opacity: 0.78;
}

.chat-ticks--read {
    opacity: 1;
}

.site-chat__bubble--out .chat-ticks--read {
    color: #c8f7d4;
}

/* ───────── Вложения в ленте (image/video/audio/file) ───────── */
.site-chat__bubble--media {
    padding: 6px;
}
.site-chat__media-link {
    display: block;
}
.site-chat__img {
    display: block;
    max-width: 240px;
    max-height: 240px;
    width: auto;
    height: auto;
    border-radius: 10px;
    cursor: pointer;
}
.site-chat__video {
    display: block;
    max-width: 240px;
    max-height: 240px;
    border-radius: 10px;
}
.site-chat__audio {
    display: block;
    width: 230px;
    max-width: 100%;
}
.site-chat__media-caption {
    margin-top: 6px;
    padding: 0 6px;
    font-size: 14px;
    line-height: 1.4;
    word-break: break-word;
    white-space: pre-wrap;
}
.site-chat__file-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 10px;
    text-decoration: none;
    color: inherit;
    min-width: 190px;
}
.site-chat__file-ic {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    border-radius: 8px;
    background: var(--chat-green-soft);
    color: var(--chat-green-dark);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.5px;
}
.site-chat__bubble--out .site-chat__file-ic {
    background: rgba(255, 255, 255, 0.22);
    color: #fff;
}
.site-chat__file-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
}
.site-chat__file-name {
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 180px;
}
.site-chat__file-size {
    font-size: 11px;
    opacity: 0.75;
}

/* ── Галерея (>1 вложения в одном сообщении) ── */
.site-chat__gallery {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 4px;
    max-width: 240px;
}
.site-chat__gallery .site-chat__media-link,
.site-chat__gallery .site-chat__img {
    width: 100%;
    height: 100%;
}
.site-chat__gallery .site-chat__img {
    max-width: none;
    max-height: 160px;
    aspect-ratio: 1 / 1;
    object-fit: cover;
}
.site-chat__bubble--media .site-chat__file-card + .site-chat__file-card {
    margin-top: 4px;
}

/* ── Черновик вложений в композере (preview strip) ── */
.site-chat__drafts {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 8px 10px 0;
}
.site-chat__drafts[aria-busy="true"] {
    opacity: 0.6;
    pointer-events: none;
}
.site-chat__draft {
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
    max-width: 200px;
    padding: 6px 26px 6px 8px;
    border: 1px solid var(--chat-border-soft, #e2e8f0);
    border-radius: 10px;
    background: #fff;
}
.site-chat__draft--img {
    padding: 0;
    border: none;
    width: 60px;
    height: 60px;
}
.site-chat__draft-thumb {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 10px;
    display: block;
}
.site-chat__draft-ic {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    flex-shrink: 0;
    border-radius: 8px;
    background: var(--chat-green-soft);
    color: var(--chat-green-dark);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.5px;
}
.site-chat__draft-name {
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.site-chat__draft-remove {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 18px;
    height: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 50%;
    background: rgba(15, 23, 42, 0.6);
    color: #fff;
    font-size: 14px;
    line-height: 1;
    cursor: pointer;
    padding: 0;
}
.site-chat__draft-remove:hover {
    background: rgba(15, 23, 42, 0.85);
}

/* ── Overlay при drag-and-drop ── */
.site-chat__drop-overlay {
    position: absolute;
    inset: 0;
    z-index: 5;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(16, 185, 129, 0.12);
    border: 2px dashed var(--chat-green, #10b981);
    border-radius: var(--chat-radius-panel, 16px);
    pointer-events: none;
}
.site-chat__drop-overlay span {
    padding: 10px 16px;
    border-radius: 10px;
    background: var(--chat-green, #10b981);
    color: #fff;
    font-size: 14px;
    font-weight: 600;
}
.site-chat--dragover .site-chat__drop-overlay {
    display: flex;
}

/* Карточка вложения (на случай рендера) */
.site-chat__attach-card {
    max-width: 84%;
    align-self: flex-start;
    background: #fff;
    border: 1px solid var(--chat-border-soft);
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(15, 23, 42, 0.06);
    margin-bottom: 10px;
}

.site-chat__attach-preview {
    height: 120px;
    background: linear-gradient(145deg, #eef2ee 0%, #d8e2dc 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 36px;
}

.site-chat__attach-caption {
    padding: 8px 12px 4px;
    font-size: 13px;
    color: var(--chat-text);
}

.site-chat__attach-time {
    padding: 0 12px 10px;
    font-size: 11px;
    color: var(--chat-muted-soft);
}

.site-chat__online-dot--away {
    background: #9aa3ad;
    box-shadow: 0 0 0 3px rgba(154, 163, 173, 0.25);
    animation: none;
}

/* ───────────────────────── Композер ───────────────────────── */
/* Многострочное поле как в Jivo: textarea во всю ширину, под ней справа иконки. */

.site-chat__composer-wrap {
    position: relative;
    flex-shrink: 0;
}

.site-chat__away {
    position: absolute;
    inset: 0;
    z-index: 4;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 8px;
    padding: 16px 40px 16px 16px;
    background: var(--chat-surface);
    border-top: 1px solid var(--chat-border);
    color: var(--chat-text);
}

.site-chat__away[hidden] {
    display: none;
}

.site-chat__away-close {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 28px;
    height: 28px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--chat-muted-soft);
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
}

.site-chat__away-close:hover {
    background: rgba(11, 15, 20, 0.06);
    color: var(--chat-text);
}

.site-chat__away-title {
    font-size: 15px;
    font-weight: 700;
}

.site-chat__away-body {
    font-size: 13.5px;
    line-height: 1.45;
    color: var(--chat-muted);
    white-space: pre-wrap;
}

.site-chat__bubble-row--system {
    align-self: stretch;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    margin: 4px 8px;
}

.site-chat__sys-from {
    font-size: 11px;
    color: var(--chat-muted-soft);
}

.site-chat__bubble--system {
    max-width: 92%;
    background: rgba(11, 15, 20, 0.06);
    color: var(--chat-text);
    border-radius: 12px;
    padding: 8px 12px;
    font-size: 13px;
    line-height: 1.4;
    text-align: center;
}

.site-chat__composer {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 10px 10px;
    background: var(--chat-surface);
    border-top: 1px solid var(--chat-border);
}

.site-chat__input {
    width: 100%;
    min-height: 96px;
    max-height: 160px;
    padding: 12px 14px;
    border: 1px solid var(--chat-border);
    border-radius: 14px;
    font: inherit;
    font-size: 14px;
    line-height: 1.45;
    color: var(--chat-text);
    background: var(--chat-surface);
    outline: none;
    resize: none;
    overflow-y: auto;
    box-sizing: border-box;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
    scrollbar-width: thin;
    scrollbar-color: rgba(11, 15, 20, 0.18) transparent;
}

.site-chat__input::placeholder {
    color: var(--chat-muted-soft);
}

.site-chat__input:focus {
    border-color: rgba(10, 143, 42, 0.45);
    box-shadow: 0 0 0 3px rgba(10, 143, 42, 0.14);
}

.site-chat__input::-webkit-scrollbar {
    width: 6px;
}
.site-chat__input::-webkit-scrollbar-track {
    background: transparent;
}
.site-chat__input::-webkit-scrollbar-thumb {
    background: rgba(11, 15, 20, 0.16);
    border-radius: 999px;
}
.site-chat__input::-webkit-scrollbar-thumb:hover {
    background: rgba(11, 15, 20, 0.28);
}

.site-chat__composer-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 16px;
    padding: 0 4px;
}

.site-chat__attach-btn {
    width: 32px;
    height: 32px;
    margin: 0;
    border: none;
    background: transparent;
    color: var(--chat-muted);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    border-radius: 8px;
    transition: color 0.15s ease, background 0.15s ease, transform 0.15s ease;
}

.site-chat__attach-btn:hover {
    color: var(--chat-green-dark);
    background: var(--chat-green-soft);
    transform: translateY(-1px);
}

.site-chat__attach-btn:focus-visible,
.site-chat__send:focus-visible {
    outline: 2px solid var(--chat-green);
    outline-offset: 2px;
}

.site-chat__send {
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    color: var(--chat-muted);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    border-radius: 8px;
    transition: color 0.15s ease, background 0.15s ease, transform 0.15s ease, opacity 0.15s ease;
}

.site-chat__send:hover {
    color: var(--chat-green-dark);
    background: var(--chat-green-soft);
    transform: translateY(-1px);
}

.site-chat__send:active {
    transform: translateY(0);
}

.site-chat__send:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    transform: none;
    background: transparent;
    color: var(--chat-muted-soft);
}

.site-chat__file {
    position: absolute;
    width: 0;
    height: 0;
    opacity: 0;
    pointer-events: none;
}

/* ───────────────────────── Форма профиля ───────────────────────── */

.site-chat__profile {
    flex-shrink: 0;
    padding: 14px 16px 16px;
    background: var(--chat-surface);
    border-top: 1px solid var(--chat-border);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.site-chat__profile[hidden] {
    display: none !important;
}

.site-chat__profile-hint {
    margin: 0;
    font-size: 12.5px;
    line-height: 1.4;
    color: var(--chat-muted);
}

.site-chat__profile-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.site-chat__profile-label {
    font-size: 11px;
    font-weight: 700;
    color: var(--chat-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.site-chat__profile-input {
    width: 100%;
    height: 42px;
    padding: 0 14px;
    border: 1px solid var(--chat-border);
    border-radius: 12px;
    font: inherit;
    font-size: 14px;
    color: var(--chat-text);
    background: var(--chat-bg);
    outline: none;
    box-sizing: border-box;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.site-chat__profile-input:focus {
    border-color: rgba(10, 143, 42, 0.45);
    background: #fff;
    box-shadow: 0 0 0 3px rgba(10, 143, 42, 0.12);
}

.site-chat__profile-save {
    align-self: flex-start;
    margin-top: 4px;
    padding: 10px 22px;
    border: none;
    border-radius: 12px;
    font: inherit;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    color: #fff;
    background: var(--chat-send-grad);
    box-shadow: 0 8px 18px rgba(10, 143, 42, 0.25);
    transition: transform 0.15s ease, filter 0.15s ease;
}

.site-chat__profile-save:hover {
    transform: translateY(-1px);
    filter: brightness(1.04);
}

.site-chat__profile-save:active {
    transform: translateY(0);
}

.site-chat__profile-save:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    transform: none;
}

.site-chat--profile-pending .site-chat__composer {
    opacity: 0.5;
    pointer-events: none;
}

/* ───────────────────────── Адаптив ───────────────────────── */

@media (max-width: 480px) {
    .site-chat {
        right: 14px;
        bottom: 14px;
    }

    .site-chat__panel {
        width: calc(100vw - 28px);
        height: min(78vh, 560px);
        max-height: calc(100vh - 28px);
        border-radius: 20px;
    }

    /* Открытый чат на мобильном — на весь viewport, скролл страницы блокирует JS. */
    .site-chat.site-chat--open {
        inset: 0;
        right: 0;
        bottom: 0;
    }

    .site-chat--open .site-chat__panel {
        position: fixed;
        inset: 0;
        width: 100vw;
        width: 100dvw;
        height: 100vh;
        height: 100dvh;
        max-width: none;
        max-height: none;
        border-radius: 0;
        border: none;
        box-shadow: none;
        animation: site-chat-slide-up 0.24s ease-out both;
    }

    .site-chat__header {
        padding: 14px 14px 14px 16px;
    }

    .site-chat__messages {
        padding: 14px 12px;
    }

    .site-chat__composer {
        padding: 10px 10px;
        gap: 10px;
    }

    .site-chat__input {
        min-height: 84px;
        max-height: 140px;
        padding: 10px 12px;
    }
}

@keyframes site-chat-slide-up {
    from {
        opacity: 0;
        transform: translateY(24px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Когда чат блокирует страницу на мобильном — фиксируем body, чтобы фон не скроллился. */
body.site-chat--body-locked {
    position: fixed;
    left: 0;
    right: 0;
    width: 100%;
    overflow: hidden;
    overscroll-behavior: contain;
    touch-action: none;
}

/* ───────────────────────── Уважение к настройкам пользователя ───────────────────────── */

@media (prefers-reduced-motion: reduce) {
    .site-chat__launcher,
    .site-chat__launcher-icon,
    .site-chat__close,
    .site-chat__send,
    .site-chat__attach-btn,
    .site-chat__input,
    .site-chat__profile-input,
    .site-chat__profile-save {
        transition: none;
    }

    .site-chat--open .site-chat__panel {
        animation: none;
    }

    @media (max-width: 480px) {
        .site-chat--open .site-chat__panel {
            animation: none;
        }
    }

    .site-chat__online-dot {
        animation: none;
    }
}
