:root {
    --chat-bg: #1c1a19;
    --chat-bot: #2b2826;
    --chat-user: #e9dfd3;
    --chat-accent: #d9cbb8;
    --chat-text: #f3efe9;
    --chat-muted: #9a938b;
}

#chat-launcher {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 52px;
    height: 52px;
    border: none;
    border-radius: 16px;
    background: var(--chat-accent);
    color: #2d2926;
    cursor: pointer;
    display: grid;
    place-items: center;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
    z-index: 9999;
}
#chat-launcher:focus-visible { outline: 3px solid #fff; outline-offset: 2px; }
#chat-launcher .icon-down { display: none; }
#chat-launcher[aria-expanded="true"] .icon-chat { display: none; }
#chat-launcher[aria-expanded="true"] .icon-down { display: block; }

#chat-panel {
    position: fixed;
    bottom: 92px;
    right: 24px;
    width: 360px;
    max-width: calc(100vw - 48px);
    height: 520px;
    max-height: calc(100vh - 116px);
    background: var(--chat-bg);
    color: var(--chat-text);
    border-radius: 20px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 9999;
    font-family: system-ui, sans-serif;
    font-size: 15px;

    opacity: 0;
    transform: translateY(12px);
    pointer-events: none;
    transition: opacity 0.2s, transform 0.2s;
}
#chat-panel.open { opacity: 1; transform: translateY(0); pointer-events: auto; }
@media (prefers-reduced-motion: reduce) { #chat-panel { transition: none; } }

.chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 18px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.chat-title { display: flex; flex-direction: column; }
.chat-title span { font-size: 12px; color: var(--chat-muted); }
#chat-close {
    background: none;
    border: none;
    color: var(--chat-muted);
    font-size: 18px;
    cursor: pointer;
}
#chat-close:hover { color: var(--chat-text); }

.chat-body {
    flex: 1;
    padding: 18px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.chat-msg {
    max-width: 82%;
    padding: 12px 14px;
    border-radius: 16px;
    line-height: 1.4;
    /* Wrap long, unbroken strings (e.g. an email address) inside the bubble
       instead of overflowing into the panel. min-width:0 lets the flex item
       shrink below its content's intrinsic width so the wrap can take effect. */
    min-width: 0;
    overflow-wrap: anywhere;
}
.chat-msg.bot  { background: var(--chat-bot); align-self: flex-start; }
.chat-msg.user { background: var(--chat-user); color: #2d2926; align-self: flex-end; }
.chat-meta { font-size: 12px; color: var(--chat-muted); margin-bottom: 8px; }

.chat-footer {
    display: flex;
    gap: 8px;
    padding: 12px;
    margin: 0;
}
.chat-footer input {
    flex: 1;
    margin: 0;
    height: 44px;
    padding: 0 14px;
    background: var(--chat-bot);
    color: var(--chat-text);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 22px;
    box-sizing: border-box;
}
.chat-footer input::placeholder { color: var(--chat-muted); }
.chat-footer button {
    width: 44px;
    height: 44px;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: var(--chat-accent);
    color: #2d2926;
    font-size: 18px;
    cursor: pointer;
}

.chat-suggestions {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 8px;
    padding: 0 18px 12px;
}
.chat-suggestion {
    margin: 0;
    padding: 10px 14px;
    background: var(--chat-bot);
    color: var(--chat-text);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    font-size: 14px;
    text-align: left;
    cursor: pointer;
}
.chat-suggestion:hover { background: #3a3633; }
.chat-suggestion:focus-visible { outline: 2px solid var(--chat-accent); }

#chat-launcher { font-size: 22px; }

.chat-msg {
    max-width: 82%;
    padding: 12px 14px;
    border-radius: 16px;
    line-height: 1.4;
    white-space: pre-line;
}

.chat-suggestions {
    gap: 6px;
    padding: 0 18px 10px;
    max-height: 45%;
    overflow-y: auto;
}
.chat-suggestion {
    padding: 8px 12px;
}
