#ha-da-chat-wrapper {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 999999;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* ── Conversation messages ── */
#ha-da-conversation {
    padding: 20px 16px 8px;
}

.ha-da-msg {
    margin-bottom: 14px;
    animation: ha-da-msg-in 0.3s ease-out;
}

@keyframes ha-da-msg-in {
    0% { opacity: 0; transform: translateY(8px); }
    100% { opacity: 1; transform: translateY(0); }
}

.ha-da-msg-agent {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding-right: 30px;
}

.ha-da-msg-avatar {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    background: #232f3e;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    padding: 5px;
    margin-top: 2px;
}

.ha-da-msg-avatar svg {
    width: 14px;
    height: 14px;
}

.ha-da-msg-avatar-img {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    object-fit: cover;
    margin-top: 2px;
}

.ha-da-msg-bubble {
    background: #f0f2f5;
    color: #1a1a2e;
    padding: 10px 14px;
    border-radius: 12px;
    font-size: 0.88em;
    line-height: 1.55;
}

.ha-da-msg-user {
    display: flex;
    justify-content: flex-end;
    padding-left: 50px;
}

.ha-da-msg-user .ha-da-msg-bubble {
    background: #232f3e;
    color: #fff;
    border-radius: 12px;
}

/* ── Typing indicator ── */
.ha-da-typing .ha-da-msg-bubble {
    background: #f0f2f5;
    padding: 14px 14px;
    min-width: 50px;
}

.ha-da-typing-dots {
    display: inline-flex;
    gap: 4px;
    align-items: center;
}

.ha-da-typing-dots span {
    width: 7px;
    height: 7px;
    background: #94a3b8;
    border-radius: 50%;
    animation: ha-da-bounce 1.2s ease-in-out infinite;
}

.ha-da-typing-dots span:nth-child(1) { animation-delay: 0s; }
.ha-da-typing-dots span:nth-child(2) { animation-delay: 0.15s; }
.ha-da-typing-dots span:nth-child(3) { animation-delay: 0.3s; }

@keyframes ha-da-bounce {
    0%, 80%, 100% { transform: scale(0.5); opacity: 0.3; }
    40% { transform: scale(1); opacity: 1; }
}

/* ── Restart link ── */
.ha-da-restart-link,
.ha-da-back-link {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 0.75em;
    font-weight: 500;
    padding: 8px 0 4px;
    display: block;
    color: #6b7280;
    transition: color 0.2s ease;
}

.ha-da-back-link:hover {
    color: #2563eb;
}

.ha-da-restart-link:hover {
    color: #4b5563;
}

/* ── Waving hand indicator ── */
#ha-da-toggle-hand {
    position: absolute;
    right: 8px;
    bottom: 68px;
    font-size: 28px;
    line-height: 1;
    pointer-events: none;
    z-index: 1;
    animation: ha-da-wave 1.8s ease-in-out infinite;
    transform-origin: 70% 70%;
    opacity: 0.9;
    transition: opacity 0.3s ease;
}
#ha-da-chat-wrapper:hover #ha-da-toggle-hand {
    opacity: 0;
}
#ha-da-chat-wrapper.open #ha-da-toggle-hand {
    display: none;
}

@keyframes ha-da-wave {
    0%, 100% { transform: rotate(0deg); }
    15% { transform: rotate(14deg); }
    30% { transform: rotate(-8deg); }
    45% { transform: rotate(14deg); }
    60% { transform: rotate(-4deg); }
    75% { transform: rotate(10deg); }
}

/* ── Toggle button ── */
#ha-da-chat-toggle {
    width: 66px;
    height: 66px;
    border-radius: 50%;
    background: #2563eb;
    color: #fff;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 24px rgba(37, 99, 235, 0.4);
    transition: transform 0.25s cubic-bezier(.34,1.56,.64,1), box-shadow 0.25s ease;
    position: relative;
    float: right;
    animation: ha-da-pulse 2.5s ease-in-out infinite;
}

#ha-da-chat-toggle:hover {
    transform: scale(1.12);
    box-shadow: 0 8px 32px rgba(37, 99, 235, 0.55);
    animation: none;
}

#ha-da-chat-toggle svg {
    width: 28px;
    height: 28px;
}

@keyframes ha-da-pulse {
    0%, 100% { box-shadow: 0 4px 24px rgba(37, 99, 235, 0.4); }
    50% { box-shadow: 0 4px 40px rgba(37, 99, 235, 0.7); }
}

#ha-da-chat-toggle .ha-da-toggle-label {
    position: absolute;
    right: 68px;
    top: 50%;
    transform: translateY(-50%);
    background: #232f3e;
    color: #fff;
    padding: 7px 14px;
    border-radius: 8px;
    font-size: 0.85em;
    font-weight: 600;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}
#ha-da-chat-toggle .ha-da-toggle-label::after {
    content: '';
    position: absolute;
    right: -6px;
    top: 50%;
    transform: translateY(-50%);
    border: 6px solid transparent;
    border-left-color: #232f3e;
}
#ha-da-chat-wrapper:hover .ha-da-toggle-label {
    opacity: 1;
}
#ha-da-chat-wrapper.open .ha-da-toggle-label {
    display: none;
}

/* ── Popup ── */
#ha-da-chat-popup {
    display: none;
    position: absolute;
    bottom: 72px;
    right: 0;
    width: 400px;
    max-height: 580px;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 12px 48px rgba(0,0,0,0.15);
    overflow: hidden;
    flex-direction: column;
    transform-origin: bottom right;
}

#ha-da-chat-wrapper.open #ha-da-chat-popup {
    display: flex;
    animation: ha-da-slide-up 0.3s ease-out;
}

@keyframes ha-da-slide-up {
    0% { opacity: 0; transform: translateY(12px) scale(0.97); }
    100% { opacity: 1; transform: translateY(0) scale(1); }
}

/* ── Header ── */
#ha-da-chat-header {
    background: #232f3e;
    color: #fff;
    padding: 16px 18px;
    font-weight: 600;
    font-size: 0.93em;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

#ha-da-header-content {
    display: flex;
    align-items: center;
    gap: 10px;
}

.ha-da-header-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    background: rgba(255,255,255,0.15);
    border-radius: 50%;
    padding: 5px;
    flex-shrink: 0;
}

.ha-da-header-avatar svg {
    width: 16px;
    height: 16px;
    display: block;
}

.ha-da-header-avatar-img {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

#ha-da-chat-header .ha-da-header-name::before {
    content: '';
    display: inline-block;
    width: 7px;
    height: 7px;
    background: #4ade80;
    border-radius: 50%;
    margin-right: 7px;
    vertical-align: middle;
}

#ha-da-chat-header .ha-da-header-actions {
    display: flex;
    align-items: center;
    gap: 4px;
}

#ha-da-voice-toggle,
#ha-da-chat-minimize {
    background: rgba(255,255,255,0.1);
    border: none;
    color: #fff;
    width: 28px;
    height: 28px;
    border-radius: 6px;
    font-size: 1.2em;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease;
    line-height: 1;
    padding: 5px;
}

#ha-da-voice-toggle svg,
#ha-da-chat-minimize svg {
    width: 15px;
    height: 15px;
}

#ha-da-voice-toggle:hover,
#ha-da-chat-minimize:hover {
    background: rgba(255,255,255,0.25);
}

#ha-da-voice-toggle.ha-da-voice-off {
    opacity: 0.4;
}

#ha-da-voice-toggle.ha-da-voice-off svg {
    transform: scaleX(-1);
}

/* ── Speak button on agent bubbles ── */
.ha-da-speak-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 2px;
    margin-left: 6px;
    vertical-align: middle;
    opacity: 0.3;
    transition: opacity 0.2s ease;
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
}

.ha-da-speak-btn svg {
    width: 14px;
    height: 14px;
    display: block;
}

.ha-da-msg-agent .ha-da-msg-bubble:hover .ha-da-speak-btn {
    opacity: 0.6;
}

.ha-da-speak-btn:hover {
    opacity: 1 !important;
}

.ha-da-speak-btn.ha-da-speaking {
    opacity: 1;
}

/* ── Body ── */
#ha-da-chat-body {
    padding: 0;
    overflow-y: auto;
    flex: 1;
    max-height: 480px;
    scrollbar-width: thin;
    scrollbar-color: #e2e8f0 transparent;
}

#ha-da-chat-body::-webkit-scrollbar { width: 4px; }
#ha-da-chat-body::-webkit-scrollbar-track { background: transparent; }
#ha-da-chat-body::-webkit-scrollbar-thumb { background: #e2e8f0; border-radius: 4px; }

#ha-digital-agent.ha-da-popup-mode h2 {
    display: none;
}

/* ── Staggered button entrance ── */
.ha-da-options .ha-da-option-btn {
    animation: ha-da-pop-in 0.3s ease-out backwards;
}
.ha-da-options .ha-da-option-btn:nth-child(1)  { animation-delay: 0.02s; }
.ha-da-options .ha-da-option-btn:nth-child(2)  { animation-delay: 0.05s; }
.ha-da-options .ha-da-option-btn:nth-child(3)  { animation-delay: 0.08s; }
.ha-da-options .ha-da-option-btn:nth-child(4)  { animation-delay: 0.11s; }
.ha-da-options .ha-da-option-btn:nth-child(5)  { animation-delay: 0.14s; }
.ha-da-options .ha-da-option-btn:nth-child(6)  { animation-delay: 0.17s; }
.ha-da-options .ha-da-option-btn:nth-child(7)  { animation-delay: 0.20s; }
.ha-da-options .ha-da-option-btn:nth-child(8)  { animation-delay: 0.23s; }
.ha-da-options .ha-da-option-btn:nth-child(9)  { animation-delay: 0.26s; }
.ha-da-options .ha-da-option-btn:nth-child(10) { animation-delay: 0.29s; }

@keyframes ha-da-pop-in {
    0% { opacity: 0; transform: scale(0.9); }
    100% { opacity: 1; transform: scale(1); }
}

/* ── Staggered project card entrance ── */
.ha-da-project-card {
    animation: ha-da-card-in 0.35s ease-out backwards;
}
.ha-da-project-card:nth-child(1)  { animation-delay: 0.03s; }
.ha-da-project-card:nth-child(2)  { animation-delay: 0.08s; }
.ha-da-project-card:nth-child(3)  { animation-delay: 0.13s; }
.ha-da-project-card:nth-child(4)  { animation-delay: 0.18s; }
.ha-da-project-card:nth-child(5)  { animation-delay: 0.23s; }
.ha-da-project-card:nth-child(6)  { animation-delay: 0.28s; }
.ha-da-project-card:nth-child(7)  { animation-delay: 0.33s; }
.ha-da-project-card:nth-child(8)  { animation-delay: 0.38s; }
.ha-da-project-card:nth-child(9)  { animation-delay: 0.43s; }
.ha-da-project-card:nth-child(10) { animation-delay: 0.48s; }

@keyframes ha-da-card-in {
    0% { opacity: 0; transform: translateY(8px); }
    100% { opacity: 1; transform: translateY(0); }
}

/* ── Agent selection buttons ── */
.ha-da-agent-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 18px;
    border: 1.5px solid #e5e7eb;
    border-radius: 12px;
    background: #fff;
    cursor: pointer;
    font-size: 0.88em;
    font-weight: 600;
    color: #1a1a2e;
    transition: all 0.2s ease;
    width: 100%;
}

.ha-da-agent-btn:hover {
    border-color: var(--agent-color, #232f3e);
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.ha-da-agent-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    flex-shrink: 0;
}

/* ── Option buttons (categories / countries) ── */
.ha-da-options {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 4px 0 6px 36px;
}

.ha-da-flag {
    display: inline-block;
    width: 18px;
    height: 13.5px;
    border-radius: 2px;
    vertical-align: middle;
    margin-right: 4px;
}

.ha-da-country-price {
    font-size: 0.8em;
    font-weight: 400;
    color: #6b7280;
    margin-left: 4px;
}

.ha-da-option-btn {
    padding: 7px 12px;
    border: 1.5px solid #e5e7eb;
    border-radius: 8px;
    background: #fff;
    cursor: pointer;
    font-size: 0.8em;
    font-weight: 500;
    transition: all 0.15s ease;
    color: #374151;
    white-space: nowrap;
}

.ha-da-option-btn:hover {
    border-color: #2563eb;
    color: #2563eb;
    background: #f8faff;
}

.ha-da-option-btn.selected {
    border-color: #2563eb;
    background: #2563eb;
    color: #fff;
}

.ha-da-restart-link {
    margin-left: 36px;
}

.ha-da-sub-icon {
    width: 20px;
    height: 20px;
    border-radius: 4px;
    object-fit: cover;
    vertical-align: middle;
    margin-right: 6px;
}

/* ── Welcome banner ── */
.ha-da-welcome-banner {
    display: flex;
    align-items: center;
    gap: 12px;
    background: #2563eb;
    color: #fff;
    margin: 0 0 16px 0;
    padding: 16px 18px;
    border-radius: 12px;
    box-shadow: 0 4px 16px rgba(37, 99, 235, 0.3);
}
.ha-da-welcome-icon {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    background: rgba(255,255,255,0.15);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}
.ha-da-welcome-icon svg {
    width: 20px;
    height: 20px;
}
.ha-da-welcome-text {
    font-size: 0.95em;
    line-height: 1.4;
}
.ha-da-welcome-text strong {
    font-weight: 700;
}

/* ── Start buttons ── */
.ha-da-start-btn {
    display: block;
    margin: 20px auto 4px;
    padding: 12px 40px;
    background: #232f3e;
    color: #fff;
    border: none;
    border-radius: 10px;
    font-size: 0.93em;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s ease;
}

.ha-da-start-btn:hover {
    background: #1a2533;
}

/* ── Project cards ── */
.ha-da-projects {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin: 4px 0 6px 36px;
}

.ha-da-project-card {
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 14px;
    background: #fff;
    transition: box-shadow 0.2s ease;
}

.ha-da-project-card:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.ha-da-project-top {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    margin-bottom: 10px;
}

.ha-da-project-icon {
    width: 44px;
    height: 44px;
    border-radius: 8px;
    object-fit: cover;
    flex-shrink: 0;
    background: #f8fafc;
}

.ha-da-project-info {
    flex: 1;
    min-width: 0;
}

.ha-da-project-name {
    font-size: 0.9em;
    font-weight: 600;
    color: #1a1a2e;
    margin-bottom: 3px;
    line-height: 1.4;
}

.ha-da-project-notes {
    font-size: 0.78em;
    color: #9ca3af;
    line-height: 1.45;
}

.ha-da-project-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    border-top: 1px solid #f3f4f6;
    padding-top: 10px;
}

.ha-da-price-label {
    font-weight: 700;
    color: #232f3e;
    font-size: 0.93em;
    background: #f3f4f6;
    padding: 3px 10px;
    border-radius: 6px;
}

.ha-da-qty-input {
    width: 52px;
    padding: 6px 8px;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    font-size: 0.85em;
    text-align: center;
    transition: border-color 0.2s ease;
}

.ha-da-qty-input:focus {
    border-color: #2563eb;
    outline: none;
}

.ha-da-amount-options {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.ha-da-amount-btn {
    padding: 5px 12px;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    background: #fff;
    cursor: pointer;
    font-size: 0.8em;
    font-weight: 500;
    transition: all 0.15s ease;
    color: #4b5563;
}

.ha-da-amount-btn:hover {
    border-color: #2563eb;
    color: #2563eb;
    background: #f8faff;
}

.ha-da-amount-btn.selected {
    border-color: #2563eb;
    background: #2563eb;
    color: #fff;
}

.ha-da-custom-input {
    width: 76px;
    padding: 5px 8px;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    font-size: 0.8em;
    transition: border-color 0.2s ease;
}

.ha-da-custom-input:focus {
    border-color: #2563eb;
    outline: none;
}

/* ── Donate button ── */
.ha-da-donate-btn {
    padding: 7px 18px;
    background: #232f3e;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 0.85em;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s ease;
    text-decoration: none;
    display: inline-block;
}

.ha-da-donate-btn:hover {
    background: #1a2533;
}

.ha-da-donate-btn:disabled {
    background: #e5e7eb;
    cursor: not-allowed;
}

/* ── Request form ── */
#ha-da-input-area {
    padding: 0 16px 16px;
}

.ha-da-request-field {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid #e5e7eb;
    border-radius: 8px;
    font-size: 0.88em;
    font-family: inherit;
    transition: border-color 0.2s ease;
    box-sizing: border-box;
}

.ha-da-request-field:focus {
    border-color: #2563eb;
    outline: none;
}

.ha-da-request-textarea {
    resize: vertical;
    min-height: 60px;
}

#ha-da-request-form p {
    margin: 0 0 10px 0;
}

#ha-da-request-btn {
    background: #2563eb;
}
#ha-da-request-btn:hover {
    background: #1d4ed8;
}

#ha-da-request-result {
    margin-top: 10px;
}
