#tw-chat-widget {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9999;
    font-family: 'Inter', 'Segoe UI', sans-serif;
}

#tw-chat-btn {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, #7c3aed, #a855f7);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    box-shadow: 0 4px 20px rgba(124, 58, 237, .45);
    transition: transform .2s, box-shadow .2s;
    margin-left: auto;
}

#tw-chat-btn:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 28px rgba(124, 58, 237, .6);
}

#tw-chat-box {
    display: none;
    flex-direction: column;
    width: 340px;
    max-width: calc(100vw - 48px);
    height: 460px;
    max-height: calc(100vh - 120px);
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 8px 40px rgba(0,0,0,.18);
    overflow: hidden;
    margin-bottom: 12px;
    animation: tw-slide-up .2s ease;
}

#tw-chat-box.tw-open {
    display: flex;
}

@keyframes tw-slide-up {
    from { opacity: 0; transform: translateY(16px); }
    to   { opacity: 1; transform: translateY(0); }
}

#tw-chat-header {
    background: linear-gradient(135deg, #7c3aed, #a855f7);
    color: #fff;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

#tw-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: #f8fafc;
}

.tw-msg {
    max-width: 82%;
    padding: 10px 14px;
    border-radius: 14px;
    font-size: 13.5px;
    line-height: 1.5;
    word-break: break-word;
}

.tw-msg p { margin: 0; }

.tw-msg-bot {
    background: #fff;
    color: #1e293b;
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 4px rgba(0,0,0,.07);
    align-self: flex-start;
}

.tw-msg-user {
    background: linear-gradient(135deg, #7c3aed, #a855f7);
    color: #fff;
    border-bottom-right-radius: 4px;
    align-self: flex-end;
}

.tw-msg-typing {
    background: #fff;
    color: #94a3b8;
    align-self: flex-start;
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 4px rgba(0,0,0,.07);
    font-size: 13px;
    font-style: italic;
}

#tw-chat-footer {
    display: flex;
    align-items: center;
    padding: 12px 14px;
    border-top: 1px solid #f1f5f9;
    gap: 8px;
    background: #fff;
    flex-shrink: 0;
}

#tw-chat-input {
    flex: 1;
    padding: 9px 14px;
    border: 1px solid #e2e8f0;
    border-radius: 20px;
    font-size: 13.5px;
    outline: none;
    transition: border-color .2s;
}

#tw-chat-input:focus {
    border-color: #a855f7;
}

#tw-chat-send {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: linear-gradient(135deg, #7c3aed, #a855f7);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    flex-shrink: 0;
    transition: opacity .2s;
}

#tw-chat-send:disabled {
    opacity: .5;
    cursor: not-allowed;
}

@media (max-width: 480px) {
    #tw-chat-widget {
        bottom: 16px;
        right: 16px;
    }
    #tw-chat-box {
        width: calc(100vw - 32px);
        height: 420px;
    }
}
