#chat-widget {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9999;
    display: none;
    font-family: inherit;
}
#chat-toggle {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    font-size: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 18px rgba(0,0,0,.25);
    transition: transform .2s;
    background-color: var(--chat-color, #3b82f6);
    color: #fff;
    margin-left: auto;
    position: relative;
}
#chat-toggle:hover { transform: scale(1.1); }
#chat-badge {
    display: none;
    position: absolute;
    top: -4px;
    right: -4px;
    width: 20px;
    height: 20px;
    background: #ef4444;
    color: #fff;
    border-radius: 50%;
    font-size: 11px;
    font-weight: 700;
    align-items: center;
    justify-content: center;
    border: 2px solid #fff;
    animation: badge-pulse 2s ease-in-out infinite;
}
#chat-badge.visible { display: flex; }
@keyframes badge-pulse {
    0%, 100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(239,68,68,.7); }
    50%       { transform: scale(1.15); box-shadow: 0 0 0 7px rgba(239,68,68,0); }
}
#chat-teaser {
    display: none;
    position: absolute;
    bottom: 68px;
    right: 0;
    background: #fff;
    border-radius: 16px 16px 4px 16px;
    box-shadow: 0 4px 24px rgba(0,0,0,.16);
    padding: 12px 36px 12px 14px;
    max-width: 230px;
    min-width: 160px;
    cursor: pointer;
    animation: teaser-in .35s cubic-bezier(.22,1,.36,1);
}
#chat-teaser.visible { display: block; }
#chat-teaser::after {
    content: '';
    position: absolute;
    bottom: -8px;
    right: 18px;
    border-left: 8px solid transparent;
    border-top: 8px solid #fff;
}
#chat-teaser-text {
    margin: 0;
    font-size: 13.5px;
    line-height: 1.45;
    color: #333;
}
#chat-teaser-close {
    position: absolute;
    top: 7px;
    right: 8px;
    background: none;
    border: none;
    color: #aaa;
    font-size: 13px;
    cursor: pointer;
    line-height: 1;
    padding: 2px 4px;
}
#chat-teaser-close:hover { color: #555; }
@keyframes teaser-in {
    from { opacity: 0; transform: translateY(10px) scale(.95); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}
#chat-panel {
    display: none;
    position: absolute;
    bottom: 68px;
    right: 0;
    width: 320px;
    height: min(600px, 75vh);
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 8px 40px rgba(0,0,0,.18);
    flex-direction: column;
    overflow: hidden;
}
#chat-panel.open { display: flex; }
@media (max-width: 480px) {
    #chat-widget { right: 12px; bottom: 12px; }
    #chat-panel {
        width: calc(100vw - 24px);
        height: min(85vh, 720px);
    }
    #chat-teaser { max-width: calc(100vw - 100px); }
}
#chat-panel-header {
    padding: 12px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background-color: var(--chat-color, #3b82f6);
    color: #fff;
    flex-shrink: 0;
}
#chat-name { font-weight: 600; font-size: 14px; }
#chat-close {
    background: none;
    border: none;
    color: rgba(255,255,255,.8);
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    padding: 0;
}
#chat-close:hover { color: #fff; }
#chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
    background: #f8f8fb;
    display: flex;
    flex-direction: column;
    gap: 8px;
    font-size: 14px;
}
.chat-msg { display: flex; }
.chat-msg--user { justify-content: flex-end; }
.chat-msg--assistant { justify-content: flex-start; }
.chat-bubble {
    max-width: 82%;
    padding: 10px 14px;
    border-radius: 16px;
    line-height: 1.5;
    font-size: 13.5px;
    box-shadow: 0 1px 4px rgba(0,0,0,.04);
}
.chat-msg--user .chat-bubble {
    background-color: var(--chat-color, #3b82f6);
    color: #fff;
    border-bottom-right-radius: 4px;
}
.chat-msg--assistant .chat-bubble {
    background: #fff;
    color: #333;
    border: 1px solid #e5e7eb;
    border-bottom-left-radius: 4px;
}
.chat-bubble p { margin: 0 0 8px; }
.chat-bubble p:last-child { margin-bottom: 0; }
.chat-link {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 6px 0;
    padding: 8px 12px;
    background: color-mix(in srgb, var(--chat-color, #3b82f6) 10%, #fff);
    border: 1px solid color-mix(in srgb, var(--chat-color, #3b82f6) 30%, #fff);
    border-radius: 12px;
    text-decoration: none;
    color: var(--chat-color, #3b82f6);
    font-weight: 600;
    font-size: 12.5px;
    line-height: 1.3;
    transition: background .15s, transform .15s;
}
.chat-link:hover { background: color-mix(in srgb, var(--chat-color, #3b82f6) 18%, #fff); transform: translateX(2px); }
.chat-link__icon { font-size: 15px; flex-shrink: 0; }
.chat-link__arrow { margin-left: auto; opacity: .6; flex-shrink: 0; }
.chat-bubble a:not(.chat-link) { color: var(--chat-color, #3b82f6); text-decoration: underline; }
#quick-responses {
    display: none;
    padding: 8px 12px;
    gap: 6px;
    flex-wrap: wrap;
    border-top: 1px solid #f0f0f0;
    background: #fff;
    flex-shrink: 0;
}
#quick-responses.open { display: flex; }
.quick-btn {
    padding: 4px 10px;
    font-size: 12px;
    border: 1px solid #ddd;
    border-radius: 50px;
    background: #fff;
    color: #555;
    cursor: pointer;
    font-family: inherit;
}
.quick-btn:hover { background: #f5f5f5; }
#chat-input-area {
    padding: 10px 12px;
    border-top: 1px solid #f0f0f0;
    background: #fff;
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}
#chat-input {
    flex: 1;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 13px;
    outline: none;
    font-family: inherit;
}
#chat-input:focus { border-color: var(--chat-color, #3b82f6); }
#send-btn {
    padding: 8px 12px;
    border: none;
    border-radius: 8px;
    background-color: var(--chat-color, #3b82f6);
    color: #fff;
    cursor: pointer;
    font-size: 14px;
    transition: opacity .2s;
    flex-shrink: 0;
}
#send-btn:hover { opacity: .85; }
#send-btn:disabled { opacity: .5; cursor: default; }
#typing-indicator .chat-bubble { color: #aaa; letter-spacing: 2px; }
