#chat-widget {
    --chat-primary: #190945;
    --chat-green: #5fb69b;
    --chat-blue: #57a6ed;
    --chat-purple: #b873ed;
    --chat-coral: #ea6d60;
    --chat-bg: #f8f7fc;
    --chat-border: #e8e4f0;
    --chat-muted: #69657a;
    --chat-gradient: linear-gradient(135deg, #b873ed 0%, #57a6ed 55%, #5fb69b 100%);
    font-family: inherit;
}

#chat-circle {
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 9998;
    width: 62px;
    height: 62px;
    border: 0;
    border-radius: 50%;
    background: var(--chat-gradient);
    color: #fff;
    font-size: 26px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 10px 28px rgba(87, 166, 237, 0.45);
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}
#chat-circle:hover {
    transform: scale(1.08) rotate(-4deg);
    box-shadow: 0 14px 34px rgba(184, 115, 237, 0.5);
}
#chat-circle:focus-visible,
.chat-choice:focus-visible,
.chat-submit:focus-visible {
    outline: 3px solid var(--chat-primary);
    outline-offset: 2px;
}

.chat-widget-label {
    position: fixed;
    right: 98px;
    bottom: 38px;
    z-index: 9998;
    background: #fff;
    color: var(--chat-primary);
    font-weight: 600;
    font-size: 14px;
    padding: 9px 16px;
    border-radius: 24px;
    box-shadow: 0 6px 20px rgba(25, 9, 69, 0.15);
}

.chat-box {
    display: none;
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 9999;
    width: 400px;
    max-width: calc(100vw - 32px);
    height: 640px;
    max-height: calc(100vh - 48px);
    background: #fff;
    border-radius: 22px;
    overflow: hidden;
    box-shadow: 0 24px 60px rgba(25, 9, 69, 0.28);
    flex-direction: column;
}
.chat-box[style*="display: block"] {
    display: flex !important;
}

.chat-box-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    background: #fff;
    border-bottom: 4px solid transparent;
    border-image: var(--chat-gradient) 1;
}
.chat-box-heading {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.chat-box-brand img {
    height: 42px;
    width: auto;
    display: block;
}
.chat-box-heading small {
    color: var(--chat-muted);
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 6px;
}
.chat-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--chat-green);
    box-shadow: 0 0 0 3px rgba(95, 182, 155, 0.25);
}
.chat-box-toggle {
    border: 0;
    background: var(--chat-bg);
    color: var(--chat-primary);
    width: 34px;
    height: 34px;
    border-radius: 50%;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease;
}
.chat-box-toggle:hover {
    background: var(--chat-primary);
    color: #fff;
}

.chat-box-body {
    flex: 1;
    min-height: 0;
    background: var(--chat-bg);
}
.chat-logs {
    height: 100%;
    overflow-y: auto;
    padding: 18px 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    scrollbar-width: thin;
}

.chat-msg {
    display: flex;
    max-width: 100%;
}
.chat-msg-bot {
    justify-content: flex-start;
}
.chat-msg.self {
    justify-content: flex-end;
}
.cm-msg-bot {
    background: #fff;
    color: var(--chat-primary);
    border: 1px solid var(--chat-border);
    border-radius: 4px 18px 18px 18px;
    padding: 14px 16px;
    max-width: 92%;
    font-size: 14.5px;
    line-height: 1.55;
    box-shadow: 0 4px 14px rgba(25, 9, 69, 0.05);
}
.cm-msg-bot p {
    margin: 0 0 8px;
}
.cm-msg-bot p:last-child {
    margin-bottom: 0;
}
.cm-msg-bot ul {
    margin: 0 0 8px;
    padding-left: 18px;
}
.cm-msg-bot strong {
    color: var(--chat-primary);
}
.cm-msg-text {
    background: linear-gradient(135deg, #190945 0%, #3a1b8f 100%);
    color: #fff;
    border-radius: 18px 18px 4px 18px;
    padding: 11px 16px;
    max-width: 85%;
    font-size: 14.5px;
    line-height: 1.5;
    word-break: break-word;
}

.chat-choice-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.chat-choice-label {
    width: 100%;
    margin: 0;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--chat-muted);
}
.chat-choice {
    border: 1.5px solid var(--chat-purple);
    background: #fff;
    color: var(--chat-primary);
    border-radius: 20px;
    padding: 7px 14px;
    font-size: 13px;
    line-height: 1.3;
    text-align: left;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease;
}
.chat-choice:hover:not(:disabled) {
    background: var(--chat-purple);
    color: #fff;
    transform: translateY(-1px);
}
.chat-choice:disabled {
    opacity: 0.5;
    cursor: default;
}

.chat-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}
.chat-action {
    display: inline-block;
    padding: 9px 16px;
    border-radius: 22px;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    background: var(--chat-gradient);
    color: #fff;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.chat-action:hover {
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(87, 166, 237, 0.4);
}
.chat-action.alt {
    background: #fff;
    color: var(--chat-primary);
    border: 1.5px solid var(--chat-primary);
}
.chat-action.alt:hover {
    background: var(--chat-primary);
    color: #fff;
}

.chat-typing {
    display: inline-flex;
    gap: 5px;
    padding: 14px 16px;
    background: #fff;
    border: 1px solid var(--chat-border);
    border-radius: 4px 18px 18px 18px;
}
.chat-typing span {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--chat-purple);
    animation: chat-bounce 1s infinite ease-in-out;
}
.chat-typing span:nth-child(2) {
    animation-delay: 0.15s;
    background: var(--chat-blue);
}
.chat-typing span:nth-child(3) {
    animation-delay: 0.3s;
    background: var(--chat-green);
}
@keyframes chat-bounce {
    0%, 80%, 100% { transform: translateY(0); opacity: 0.5; }
    40% { transform: translateY(-5px); opacity: 1; }
}

.chat-input {
    background: #fff;
    border-top: 1px solid var(--chat-border);
    padding: 12px 14px 10px;
}
.chat-input form {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
}
#chat-input {
    flex: 1;
    height: 44px;
    border: 1.5px solid var(--chat-border);
    background: var(--chat-bg);
    border-radius: 24px;
    padding: 0 18px;
    font-size: 14.5px;
    color: var(--chat-primary);
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
#chat-input:focus {
    border-color: var(--chat-purple);
    box-shadow: 0 0 0 3px rgba(184, 115, 237, 0.18);
}
.chat-submit {
    width: 44px;
    height: 44px;
    flex: 0 0 44px;
    border: 0;
    border-radius: 50%;
    background: var(--chat-gradient);
    color: #fff;
    font-size: 16px;
    cursor: pointer;
    transition: transform 0.2s ease;
}
.chat-submit:hover {
    transform: scale(1.08);
}
.chat-note {
    margin: 8px 0 0;
    font-size: 11px;
    line-height: 1.4;
    color: var(--chat-muted);
    text-align: center;
}

@media (max-width: 575px) {
    .chat-box {
        right: 8px;
        bottom: 8px;
        width: calc(100vw - 16px);
        height: calc(100vh - 16px);
        max-height: none;
        border-radius: 18px;
    }
    #chat-circle {
        right: 16px;
        bottom: 16px;
    }
    .chat-widget-label {
        display: none !important;
    }
}
