#yandex-chat-wrapper,
#yandex-chat-wrapper * {
    box-sizing: border-box;
}
#yandex-chat-wrapper {
    position: fixed;
    z-index: 99999;
    width: fit-content;
    font-family: 'Segoe UI', Tahoma, sans-serif;
    --main-color: #28a745;
    --bg-color: #ffffff;
    --radius: 14px;
    --font-size: 11px;
}
#yandex-chat-btn {
    min-width: 102px;
    min-height: 38px;
    padding: 0 18px;
    background: var(--main-color);
    border: none !important;
    border-radius: 999px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white !important;
    cursor: pointer;
    box-shadow: 0 6px 18px rgba(0,0,0,.22);
    transition: .2s;
    font-size: 13px;
    font-weight: 700;
    line-height: 1;
    text-decoration: none;
}
#yandex-chat-btn:hover { opacity: 0.92; }
.yandex-dark #yandex-chat-btn { background: var(--main-color) !important; color: white !important; border: none !important; }
#yandex-chat-win {
    position: absolute;
    bottom: 53px;
    right: 0;
    width: 288px;
    max-width: calc(100vw - 40px);
    height: 416px;
    max-height: calc(100vh - 77px);
    max-height: calc(100dvh - 77px);
    box-sizing: border-box;
    background: var(--bg-color);
    border-radius: 19px;
    box-shadow: 0 10px 26px rgba(0,0,0,.24);
    display: none;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid rgba(255,255,255,.75);
}
#yandex-chat-header {
    min-height: 51px;
    background: var(--main-color);
    color: white;
    padding: 0 16px;
    font-weight: 700;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 14px;
    line-height: 1.2;
}
#yandex-chat-header-left { display: flex; align-items: center; gap: 10px; }
#yandex-chat-icon { width: 26px; height: 26px; border-radius: 3px; object-fit: cover; }
#y-close {
    color: #fff;
    font-size: 30px;
    font-weight: 300;
    line-height: 1;
}
#yandex-chat-msgs {
    flex: 1 1 auto;
    min-height: 0;
    padding: 13px 12px;
    overflow-y: auto;
    background: inherit;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    font-size: var(--font-size);
    overscroll-behavior: contain;
}
.yandex-msg {
    padding: 8px 11px;
    border-radius: 14px;
    max-width: 85%;
    line-height: 1.45;
    word-wrap: break-word;
    margin-bottom: 8px;
}
.y-msg-u { background: var(--main-color); color: white; align-self: flex-end; border-bottom-right-radius: 6px; }
.y-msg-a { background: #f0f0f0; color: #111827; align-self: flex-start; border-bottom-left-radius: 6px; }
.y-msg-a a { color: var(--main-color); text-decoration: underline; }
#yandex-chat-input-box {
    display: flex;
    align-items: center;
    padding: 12px;
    flex-shrink: 0;
    background: #fff;
    border-top: 1px solid #eee;
    gap: 8px;
}
#yandex-chat-wrapper input#yandex-chat-input {
    all: unset;
    box-sizing: border-box;
    flex: 1 1 auto;
    min-width: 0;
    min-height: 32px;
    padding: 0 12px;
    border: 1px solid #ddd;
    border-radius: 999px;
    background: #fff;
    color: #111;
    font-size: 11px;
    line-height: 1.4;
    font-family: inherit;
    -webkit-appearance: none;
    appearance: none;
    box-shadow: none;
    outline: none;
}
#yandex-chat-wrapper input#yandex-chat-input::placeholder { color: #666; opacity: 1; }
#yandex-chat-wrapper input#yandex-chat-input:focus { border-color: rgba(0,0,0,0.25); box-shadow: 0 0 0 2px rgba(40,167,69,0.12); }
#yandex-chat-send {
    all: unset;
    width: 32px;
    height: 32px;
    flex: 0 0 32px;
    background: var(--main-color);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    line-height: 1;
    text-align: center;
}
.yandex-dark #yandex-chat-win { background: #000 !important; border: 1px solid #333 !important; }
.yandex-dark #yandex-chat-input-box { background: #000 !important; border-top: 1px solid #333 !important; }
.yandex-dark #yandex-chat-wrapper input#yandex-chat-input { background: #000 !important; border: 1px solid #444 !important; color: #eee !important; }
.yandex-dark #yandex-chat-btn { background: var(--main-color) !important; color: white !important; border: none !important; }
.yandex-dark .y-msg-a { background: #222; color: #eee; }
#yandex-copy { font-size: 8px; text-align: center; padding: 4px; opacity: 0.6; flex-shrink: 0; }
.ygt-captcha-container { position: absolute; right: 0; bottom: 0; width: 0; height: 0; overflow: hidden; opacity: 0; pointer-events: none; }
@media (max-width: 560px) {
    #yandex-chat-win {
        width: calc(100vw - 22px);
        height: 416px;
        max-height: calc(100dvh - 83px);
        right: 0;
        border-radius: 19px;
    }
    #yandex-chat-header {
        min-height: 50px;
        padding: 0 14px;
        font-size: 14px;
    }
    #yandex-chat-input-box {
        padding: 11px;
        gap: 8px;
    }
    #yandex-chat-wrapper input#yandex-chat-input {
        min-height: 32px;
        font-size: 11px;
    }
    #yandex-chat-send {
        width: 32px;
        height: 32px;
        flex-basis: 32px;
    }
}
