.chat-widget {
    position: fixed;
    right: 30px;
    bottom: 96px;
    z-index: 12000;
}

.chat-toggle-btn {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: #2f63ff;
    color: #fff;
    box-shadow: 0 8px 24px rgba(47, 99, 255, 0.35);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
}

.chat-toggle-btn:hover {
    background: #1f53f0;
}

.chat-box {
    position: fixed;
    right: 30px;
    bottom: 164px;
    width: 360px;
    max-width: calc(100vw - 24px);
    height: min(520px, calc(100vh - 184px));
    max-height: calc(100vh - 184px);
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 14px 40px rgba(28, 37, 60, 0.25);
    display: none;
    flex-direction: column;
    overflow: hidden;
}

.chat-box.open {
    display: flex;
}

.chat-header {
    background: #2f63ff;
    color: #fff;
    padding: 12px 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.chat-header h4 {
    margin: 0;
    font-size: 15px;
    font-weight: 600;
    color: #fff;
}

.chat-header button {
    border: none;
    background: transparent;
    color: #fff;
    font-size: 18px;
    cursor: pointer;
    line-height: 1;
    padding: 0;
}

.chat-body {
    flex: 1;
    overflow-y: auto;
    background: #f7f9ff;
    padding: 12px;
}

.chat-message {
    display: flex;
    margin-bottom: 10px;
}

.chat-message p {
    margin: 0;
    max-width: 86%;
    padding: 8px 10px;
    border-radius: 8px;
    line-height: 1.45;
    word-break: break-word;
    white-space: pre-wrap;
    font-size: 13px;
}

.chat-message.system p {
    background: #fff;
    border: 1px solid #e4e9f8;
    color: #1f2b4d;
}

.chat-message.user {
    justify-content: flex-end;
}

.chat-message.user p {
    background: #2f63ff;
    color: #fff;
}

.chat-footer {
    border-top: 1px solid #e8edf8;
    background: #fff;
    padding: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.chat-footer input {
    flex: 1;
    border: 1px solid #d7dff4;
    border-radius: 8px;
    height: 40px;
    padding: 0 12px;
    font-size: 13px;
    outline: none;
}

.chat-footer button {
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 8px;
    background: #2f63ff;
    color: #fff;
    font-size: 14px;
    cursor: pointer;
}

.chat-footer button:hover {
    background: #1f53f0;
}

.chat-footer button[disabled] {
    opacity: 0.6;
    cursor: not-allowed;
}

@media (max-width: 768px) {
    .chat-widget {
        right: 12px;
        bottom: 82px;
    }

    .chat-box {
        right: 8px;
        left: 8px;
        width: auto;
        bottom: 146px;
        height: min(520px, calc(100vh - 166px));
        max-height: calc(100vh - 166px);
    }
}
