/* ═══════════════════════════════════════
   Виджет поддержки на сайте
   ═══════════════════════════════════════ */

.mbm-chat {
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 120;
    font-family: Manrope, system-ui, sans-serif;
}

.mbm-chat__bubble {
    position: relative;
    width: 60px;
    height: 60px;
    display: grid;
    place-items: center;
    border: 0;
    border-radius: 50%;
    background: #005b24;
    color: #fff;
    cursor: pointer;
    box-shadow: 0 10px 30px rgba(0, 91, 36, .32);
    transition: transform .18s ease, background .18s ease;
}
.mbm-chat__bubble:hover { transform: translateY(-2px); background: #004b18; }
.mbm-chat__bubble.is-open { background: #17362a; }

/* Точка о непрочитанном ответе, когда панель свёрнута. */
.mbm-chat__dot {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 13px;
    height: 13px;
    border: 2px solid #005b24;
    border-radius: 50%;
    background: #ff6b3d;
}

.mbm-chat__panel {
    position: absolute;
    right: 0;
    bottom: 74px;
    width: 360px;
    max-height: min(560px, calc(100vh - 130px));
    display: flex;
    flex-direction: column;
    border-radius: 18px;
    overflow: hidden;
    background: #fff;
    box-shadow: 0 24px 60px rgba(13, 43, 24, .22);
    animation: mbmChatIn .16s ease-out;
}
/* Браузерное [hidden] { display: none } живёт в user-agent-таблице, поэтому его
   перебивает ЛЮБОЙ авторский display. Без этих двух строк panel.hidden = true
   ничего не делал: переписка висела раскрытой и не закрывалась крестиком. */
.mbm-chat__panel[hidden] { display: none; }
@keyframes mbmChatIn {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: none; }
}

.mbm-chat__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 16px 18px;
    background: #005b24;
    color: #fff;
}
.mbm-chat__head strong { display: block; font-size: 15px; }
.mbm-chat__head span { font-size: 12px; opacity: .75; }
.mbm-chat__close {
    width: 28px;
    height: 28px;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, .15);
    color: #fff;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
}

.mbm-chat__thread {
    flex: 1;
    min-height: 200px;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: #fbfdfc;
}
.mbm-chat__msg {
    max-width: 85%;
    padding: 10px 13px;
    border-radius: 14px;
    background: #fff;
    border: 1px solid #e6ece8;
}
.mbm-chat__msg.is-mine { align-self: flex-end; background: #eef4ef; border-color: #d9e7de; }
.mbm-chat__msg--hint { max-width: 100%; background: transparent; border-style: dashed; }
.mbm-chat__msg p {
    margin: 0;
    font-size: 14px;
    line-height: 1.5;
    color: #17362a;
    white-space: pre-wrap;
    word-break: break-word;
}
.mbm-chat__msg time { display: block; margin-top: 4px; font-size: 10px; color: #9aa8a0; text-align: right; }

.mbm-chat__form { padding: 12px 14px 14px; border-top: 1px solid #eef2ef; background: #fff; }
.mbm-chat__guest { display: grid; gap: 8px; margin-bottom: 10px; }
/* Та же причина: без этого поля имени и телефона не исчезали после отправки. */
.mbm-chat__guest[hidden] { display: none; }
.mbm-chat__guest input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #d6ded8;
    border-radius: 10px;
    font: inherit;
    font-size: 13px;
}
.mbm-chat__row { display: flex; align-items: flex-end; gap: 8px; }
.mbm-chat__row textarea {
    flex: 1;
    padding: 11px 13px;
    border: 1px solid #d6ded8;
    border-radius: 12px;
    font: inherit;
    font-size: 14px;
    resize: none;
    max-height: 110px;
}
.mbm-chat__row textarea:focus { outline: none; border-color: #005b24; }
.mbm-chat__row button {
    width: 42px;
    height: 42px;
    flex-shrink: 0;
    display: grid;
    place-items: center;
    border: 0;
    border-radius: 12px;
    background: #005b24;
    color: #fff;
    cursor: pointer;
}
.mbm-chat__row button:hover { background: #004b18; }

@media (max-width: 480px) {
    .mbm-chat { right: 14px; bottom: 14px; }
    .mbm-chat__panel { width: calc(100vw - 28px); }
}
