:root {
    --ba-forest: #3e4156;
    --ba-forest-deep: #323442;
    --ba-sage: #7d8091;
    --ba-cream: #f6f6f8;
    --ba-paper: #ffffff;
    --ba-copper: #3e4156;
    --ba-ink: #3e4156;
    --ba-muted: #747787;
    --ba-line: rgba(62, 65, 86, .15);
}

.ba-widget,
.ba-widget * { box-sizing: border-box; }

.ba-widget {
    position: fixed;
    right: 24px;
    bottom: 22px;
    z-index: 999999;
    color: var(--ba-ink);
    font-family: "Lexend Deca", Poppins, sans-serif;
    -webkit-font-smoothing: antialiased;
}

.ba-launcher {
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 62px;
    padding: 7px 7px 7px 17px;
    border: 1px solid rgba(255, 255, 255, .14);
    border-radius: 10px;
    background: var(--ba-forest);
    box-shadow: 0 14px 34px rgba(62, 65, 86, .2), 0 3px 10px rgba(62, 65, 86, .12);
    color: #fff;
    font-family: "Lexend Deca", Poppins, sans-serif;
    cursor: pointer;
    transition: transform .25s ease, background .25s ease, box-shadow .25s ease;
}

.ba-launcher:hover { transform: translateY(-2px); background: var(--ba-forest-deep); box-shadow: 0 18px 42px rgba(62, 65, 86, .25); }
.ba-launcher:focus-visible, .ba-icon-button:focus-visible, .ba-send:focus-visible, .ba-quick button:focus-visible, .ba-composer textarea:focus-visible { outline: 3px solid rgba(62, 65, 86, .28); outline-offset: 3px; }

.ba-launcher__label { display: flex; flex-direction: column; align-items: flex-start; line-height: 1.15; }
.ba-launcher__label strong { font-family: "Lexend Deca", Poppins, sans-serif; font-size: 14px; font-weight: 500; letter-spacing: 0; }
.ba-launcher__label small { margin-top: 4px; color: rgba(255, 255, 255, .68); font-size: 8px; font-weight: 500; letter-spacing: .13em; text-transform: uppercase; }

.ba-launcher__icon {
    display: grid;
    width: 48px;
    height: 48px;
    place-items: center;
    border-radius: 7px;
    background: #fff;
    color: var(--ba-forest);
    transition: transform .35s cubic-bezier(.2, .8, .2, 1);
}

.ba-launcher svg { width: 25px; height: 25px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.6; }
.ba-launcher .ba-x-icon { display: none; }
.ba-widget[data-state="open"] .ba-launcher__icon { transform: rotate(90deg); }
.ba-widget[data-state="open"] .ba-chat-icon { display: none; }
.ba-widget[data-state="open"] .ba-x-icon { display: block; }
.ba-widget[data-state="open"] .ba-launcher__label { display: none; }
.ba-widget[data-state="open"] .ba-launcher { min-height: 56px; padding: 4px; }
.ba-widget[data-state="open"] .ba-launcher__icon { width: 48px; height: 48px; }

.ba-pulse {
    position: absolute;
    right: 5px;
    top: 5px;
    width: 10px;
    height: 10px;
    border: 2px solid var(--ba-forest);
    border-radius: 50%;
    background: #dfe1e8;
}

.ba-panel {
    position: absolute;
    right: 0;
    bottom: 76px;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
    width: min(400px, calc(100vw - 32px));
    height: min(660px, calc(100vh - 118px));
    min-height: 470px;
    overflow: hidden;
    border: 1px solid rgba(25, 61, 51, .12);
    border-radius: 14px;
    background: var(--ba-paper);
    box-shadow: 0 28px 75px rgba(44, 46, 61, .2), 0 8px 22px rgba(44, 46, 61, .1);
    opacity: 0;
    pointer-events: none;
    transform: translateY(16px) scale(.97);
    transform-origin: right bottom;
    transition: opacity .25s ease, transform .35s cubic-bezier(.2, .75, .2, 1);
}

.ba-widget[data-state="open"] .ba-panel { opacity: 1; pointer-events: auto; transform: translateY(0) scale(1); }

.ba-header {
    position: relative;
    display: flex;
    align-items: center;
    min-height: 82px;
    padding: 15px 16px;
    overflow: hidden;
    background: var(--ba-forest);
    color: #fff;
}

.ba-header::after { content: none; }

.ba-avatar {
    position: relative;
    display: grid;
    flex: 0 0 49px;
    width: 49px;
    height: 49px;
    margin-right: 12px;
    place-items: center;
    border: 1px solid rgba(255, 255, 255, .23);
    border-radius: 7px;
    background: rgba(255, 255, 255, .09);
}

.ba-avatar::before { content: none; }
.ba-avatar span { font-family: "Lexend Deca", Poppins, sans-serif; font-size: 20px; font-style: normal; font-weight: 600; }

.ba-header__copy { display: flex; flex: 1; flex-direction: column; position: relative; z-index: 1; }
.ba-header__copy strong { font-family: "Lexend Deca", Poppins, sans-serif; font-size: 17px; font-weight: 500; letter-spacing: 0; }
.ba-header__copy span { display: flex; align-items: center; gap: 6px; margin-top: 5px; color: rgba(255,255,255,.68); font-size: 10px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; }
.ba-header__copy i { width: 6px; height: 6px; border-radius: 50%; background: #dfe1e8; box-shadow: 0 0 0 4px rgba(255,255,255,.06); }

.ba-icon-button {
    position: relative;
    z-index: 1;
    display: grid;
    flex: 0 0 34px;
    width: 34px;
    height: 34px;
    padding: 0;
    place-items: center;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: rgba(255,255,255,.78);
    cursor: pointer;
    transition: background .2s ease, color .2s ease;
}

.ba-icon-button:hover { background: rgba(255,255,255,.1); color: #fff; }
.ba-icon-button svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.7; }

.ba-body { overflow-x: hidden; overflow-y: auto; padding: 22px 18px 20px; background: #f8f8f9; scroll-behavior: smooth; }
.ba-body::-webkit-scrollbar { width: 5px; }
.ba-body::-webkit-scrollbar-thumb { border-radius: 9px; background: rgba(25,61,51,.18); }

.ba-intro { margin: 0 5px 22px; text-align: center; }
.ba-intro__eyebrow { margin: 0 0 7px !important; color: var(--ba-copper); font-size: 9px !important; font-weight: 700; letter-spacing: .18em; }
.ba-widget .ba-intro h2 { margin: 0 0 8px; color: var(--ba-forest); font-family: "Lexend Deca", Poppins, sans-serif; font-size: 24px; font-weight: 600; line-height: 1.25; }
.ba-intro > p:last-child { max-width: 315px; margin: 0 auto; color: var(--ba-muted); font-size: 12px; line-height: 1.6; }

.ba-message { display: flex; align-items: flex-end; gap: 8px; margin: 0 0 14px; animation: ba-message-in .32s ease both; }
.ba-message--user { justify-content: flex-end; padding-left: 46px; }
.ba-message--assistant { padding-right: 26px; }
.ba-message__avatar { display: grid; flex: 0 0 26px; width: 26px; height: 26px; margin-bottom: 2px; place-items: center; border-radius: 5px; background: var(--ba-forest); color: #fff; font-family: "Lexend Deca", Poppins, sans-serif; font-size: 11px; font-style: normal; font-weight: 600; }
.ba-message__bubble { max-width: 100%; padding: 12px 14px; border: 1px solid var(--ba-line); border-radius: 5px 12px 12px 12px; background: #fff; box-shadow: 0 3px 12px rgba(62,65,86,.05); color: #4a4d60; font-size: 13px; line-height: 1.58; overflow-wrap: anywhere; white-space: normal; }
.ba-message--user .ba-message__bubble { border: 0; border-radius: 12px 12px 5px 12px; background: var(--ba-forest); box-shadow: 0 5px 15px rgba(62,65,86,.12); color: #fff; }
.ba-message__bubble a { color: var(--ba-copper); font-weight: 600; text-decoration: underline; text-underline-offset: 2px; }
.ba-message--user .ba-message__bubble a { color: #fff; }

.ba-quick { display: grid; gap: 7px; margin: 18px 0 4px 34px; }
.ba-quick[hidden] { display: none; }
.ba-quick button { display: flex; align-items: center; justify-content: space-between; width: 100%; min-height: 43px; padding: 10px 13px; border: 1px solid var(--ba-line); border-radius: 5px; background: #fff; color: var(--ba-forest); font: inherit; font-size: 11px; font-weight: 500; text-align: left; cursor: pointer; transition: border-color .2s ease, background .2s ease, transform .2s ease; }
.ba-quick button:hover { border-color: rgba(62,65,86,.42); background: #fff; transform: translateX(2px); }
.ba-quick button span { color: var(--ba-copper); font-size: 17px; font-weight: 400; }

.ba-message--typing .ba-message__bubble { display: flex; align-items: center; gap: 4px; min-width: 54px; min-height: 41px; }
.ba-message--typing i { width: 5px; height: 5px; border-radius: 50%; background: var(--ba-sage); animation: ba-dot 1.15s infinite ease-in-out; }
.ba-message--typing i:nth-child(2) { animation-delay: .15s; }
.ba-message--typing i:nth-child(3) { animation-delay: .3s; }

.ba-composer { position: relative; display: grid; grid-template-columns: 1fr auto; gap: 8px; padding: 13px 14px 10px; border-top: 1px solid var(--ba-line); background: var(--ba-paper); }
.ba-composer textarea { width: 100%; min-height: 46px; max-height: 112px; margin: 0; padding: 13px 12px; resize: none; border: 1px solid var(--ba-line); border-radius: 5px; outline: none; background: #f8f8f9; box-shadow: none; color: var(--ba-ink); font: inherit; font-size: 13px; line-height: 1.45; transition: border-color .2s ease, background .2s ease; }
.ba-composer textarea:focus { border-color: rgba(62,65,86,.58); background: #fff; }
.ba-composer textarea::placeholder { color: #8b8d99; }
.ba-composer > p { grid-column: 1 / -1; margin: 0 4px !important; color: #929995; font-size: 8.5px !important; line-height: 1.4; text-align: center; }
.ba-honeypot { position: absolute !important; left: -10000px !important; width: 1px !important; height: 1px !important; opacity: 0 !important; }

.ba-send { display: grid; width: 46px; height: 46px; padding: 0; place-items: center; border: 0; border-radius: 5px; background: var(--ba-forest); color: #fff; cursor: pointer; transition: transform .2s ease, background .2s ease, opacity .2s ease; }
.ba-send:hover { transform: translateY(-1px); background: var(--ba-forest-deep); }
.ba-send:disabled { opacity: .5; cursor: wait; transform: none; }
.ba-send svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.7; }

.screen-reader-text { position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; margin: -1px !important; overflow: hidden !important; clip: rect(0,0,0,0) !important; white-space: nowrap !important; border: 0 !important; }

@keyframes ba-message-in { from { opacity: 0; transform: translateY(7px); } to { opacity: 1; transform: translateY(0); } }
@keyframes ba-dot { 0%, 65%, 100% { transform: translateY(0); opacity: .45; } 32% { transform: translateY(-4px); opacity: 1; } }

@media (max-width: 600px) {
    .ba-widget { right: 12px; bottom: 12px; }
    .ba-panel { position: fixed; right: 10px; bottom: 78px; left: 10px; width: auto; height: min(680px, calc(100dvh - 96px)); min-height: 420px; border-radius: 12px; transform-origin: center bottom; }
    .ba-launcher__label { display: none; }
    .ba-launcher { min-height: 56px; padding: 4px; }
    .ba-launcher__icon { width: 48px; height: 48px; }
    .ba-header { min-height: 74px; padding: 12px 13px; }
    .ba-avatar { flex-basis: 44px; width: 44px; height: 44px; }
    .ba-body { padding: 18px 15px; }
    .ba-intro { margin-bottom: 18px; }
    .ba-widget .ba-intro h2 { font-size: 23px; }
}

@media (max-height: 560px) and (min-width: 601px) {
    .ba-panel { height: calc(100vh - 94px); min-height: 360px; bottom: 68px; }
    .ba-header { min-height: 68px; padding-block: 10px; }
    .ba-intro { display: none; }
}

@media (prefers-reduced-motion: reduce) {
    .ba-widget *, .ba-widget *::before, .ba-widget *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
