[data-aichat-float] {
    --aichat-float-ink: #162021;
    --aichat-float-accent: #d1f65d;
    --aichat-float-on-accent: var(--aichat-float-ink);
    --aichat-float-launcher-border: 0;
    --aichat-float-paper: #f8faf6;
    --aichat-float-edge: 24px;
    --aichat-float-inline: max(var(--aichat-float-edge), env(safe-area-inset-right));
    --aichat-float-bottom: max(var(--aichat-float-edge), env(safe-area-inset-bottom));
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

[data-aichat-float] [hidden],
[data-aichat-float-panel]:not([open]) {
    display: none !important;
}

[data-aichat-float-open],
[data-aichat-float-close] {
    appearance: none;
    box-sizing: border-box;
    border: 0;
    cursor: pointer;
    font: inherit;
    text-transform: none;
    letter-spacing: normal;
    min-width: 44px;
    min-height: 44px;
}

[data-aichat-float-open] {
    position: fixed;
    right: var(--aichat-float-inline);
    bottom: var(--aichat-float-bottom);
    z-index: 2147483000;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 0 21px;
    min-height: 56px;
    border-radius: 999px;
    color: var(--aichat-float-ink);
    background: var(--aichat-float-accent);
    box-shadow: 0 10px 32px #111e2740, 0 1px 3px #111e2738;
    font-size: 15px;
    font-weight: 750;
}

[data-aichat-float-open]:hover {
    background: #e0fa9b;
}

[data-aichat-float-custom-accent] { --aichat-float-launcher-border: 1px solid var(--aichat-float-on-accent); }

[data-aichat-float-open]:focus-visible,
[data-aichat-float-close]:focus-visible {
    outline: 2px solid currentColor;
    outline-offset: 3px;
    box-shadow: 0 0 0 6px #3e712a80;
}

[data-aichat-float-open] svg,
[data-aichat-float-close] svg {
    display: block;
    width: 22px;
    height: 22px;
    flex: none;
}

[data-aichat-float-panel][open] {
    position: fixed;
    inset: auto var(--aichat-float-inline) var(--aichat-float-bottom) auto;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    width: min(420px, calc(100% - 2 * var(--aichat-float-inline)));
    height: min(670px, calc(100vh - 2 * var(--aichat-float-bottom)));
    height: min(670px, calc(100dvh - 2 * var(--aichat-float-bottom)));
    max-width: none;
    max-height: none;
    border: 0;
    border-radius: 24px;
    color: var(--aichat-float-ink);
    background: var(--aichat-float-paper);
    overflow: hidden;
    box-shadow: 0 22px 76px #14202159, 0 4px 16px #14202129;
    animation: aichat-float-enter 170ms ease-out;
    isolation: isolate;
}

[data-aichat-float-panel]::backdrop {
    background: rgb(17 28 28 / 35%);
}

[data-aichat-float-head] {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px 12px 18px;
    color: #fff;
    background: var(--aichat-float-ink);
}

[data-aichat-float-mark] {
    display: grid;
    place-items: center;
    flex: none;
    width: 34px;
    height: 34px;
    border-radius: 11px;
    color: var(--aichat-float-on-accent);
    background: var(--aichat-float-accent);
}

[data-aichat-float-mark] svg {
    width: 17px;
    height: 17px;
}

[data-aichat-float-copy] {
    display: grid;
    flex: 1;
    gap: 2px;
    min-width: 0;
    line-height: 1.25;
}

[data-aichat-float-title] {
    display: block;
    margin: 0;
    color: inherit;
    font: 750 17px/1.2 system-ui, sans-serif;
}

[data-aichat-float-subtitle] {
    display: block;
    margin: 0;
    color: #d6e2de;
    font: 400 13px/1.25 system-ui, sans-serif;
}

[data-aichat-float-close] {
    display: grid;
    place-items: center;
    flex: none;
    padding: 0;
    border-radius: 12px;
    color: #fff;
    background: #ffffff12;
}

[data-aichat-float-close]:hover {
    background: #ffffff29;
}

[data-aichat-float-body] {
    min-width: 0;
    min-height: 0;
    overflow: auto;
    overscroll-behavior: contain;
}

[data-aichat-float-frame] {
    display: block;
    width: 100%;
    height: 100%;
    min-height: 0;
    border: 0;
}

[data-aichat-float-chat] {
    display: grid;
    grid-template-rows: minmax(0, 1fr) auto;
    height: 100%;
    min-height: 0;
    font: 400 15px/1.5 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

[data-aichat-float-scroll] {
    padding: 18px;
    overflow: auto;
    overscroll-behavior: contain;
}

[data-aichat-float-greeting],
[data-aichat-float-message] {
    box-sizing: border-box;
    width: fit-content;
    max-width: 91%;
    margin: 0;
    padding: 11px 14px;
    border: 1px solid #e4eae3;
    border-radius: 3px 16px 16px 16px;
    color: var(--aichat-float-ink);
    background: #fff;
    overflow-wrap: anywhere;
}

[data-aichat-float-prompts] {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 7px;
    margin-top: 11px;
}

[data-aichat-float-prompt] {
    max-width: 100%;
    min-height: 44px;
    padding: 7px 12px;
    border: 1px solid #dce6d8;
    border-radius: 999px;
    cursor: pointer;
    color: #293a30;
    background: #fff;
    font: 550 13px/1.35 system-ui, sans-serif;
    text-transform: none;
    letter-spacing: normal;
    text-align: left;
    white-space: normal;
}

[data-aichat-float-prompt]:hover {
    border-color: #839e6a;
    background: #f2f9e8;
}

[data-aichat-float-log] {
    display: grid;
    gap: 9px;
    margin-top: 17px;
}

[data-aichat-float-message="visitor"] {
    justify-self: end;
    border-color: #e1edc8;
    border-radius: 16px 3px 16px 16px;
    background: #edf7d9;
}

[data-aichat-float-message="operator"] {
    border-color: #d8e6ec;
    background: #eff6f8;
}

[data-aichat-float-message="system"] {
    justify-self: center;
    padding: 5px 10px;
    border-radius: 12px;
    color: #465a4c;
    background: #edf3ec;
    font-size: 13px;
    text-align: center;
}

[data-aichat-float-typing] {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    justify-self: start;
    padding: 9px 13px;
    border: 1px solid #dce9d8;
    border-radius: 3px 16px 16px 16px;
    color: #39533f;
    background: #f0f6eb;
    font-size: 13px;
    font-weight: 650;
}

[data-aichat-float-dots] {
    display: flex;
    gap: 3px;
    padding-inline: 1px;
}

[data-aichat-float-dots] span {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: currentColor;
    animation: aichat-float-dot 1.2s ease-in-out infinite;
}

[data-aichat-float-dots] span:nth-child(2) { animation-delay: .13s; }
[data-aichat-float-dots] span:nth-child(3) { animation-delay: .26s; }

@keyframes aichat-float-dot {
    0%, 65%, 100% { opacity: .45; transform: translateY(0); }
    32% { opacity: 1; transform: translateY(-2px); }
}

[data-aichat-float-status][data-aichat-float-announcement] {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
}

[data-aichat-float-speaker] {
    display: block;
    margin-bottom: 2px;
    color: #455c4a;
    font-size: 12px;
    font-weight: 720;
}

[data-aichat-float-message] p {
    margin: 0;
    white-space: pre-wrap;
}

[data-aichat-float-sources] {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 10px;
    margin: 9px 0 0;
    padding: 0;
    list-style: none;
}

[data-aichat-float-sources] a {
    display: inline-block;
    padding: 3px 7px;
    border-radius: 6px;
    color: #2b5426;
    background: #f0f5eb;
    font-size: 12px;
    text-decoration: underline;
    text-underline-offset: 2px;
}

[data-aichat-float-composer] {
    padding: 10px 15px 14px;
    border-top: 1px solid #e4eae3;
    background: var(--aichat-float-paper);
}

[data-aichat-float-status] {
    margin: 0 0 6px;
    color: #465a4c;
    font-size: 13px;
}

[data-aichat-float-mode] {
    width: fit-content;
    margin: 0 0 7px;
    padding: 3px 8px;
    border-radius: 999px;
    color: #36512f;
    background: #eaf1e5;
    font-size: 12px;
    font-weight: 650;
}

[data-aichat-float-mode="human"] {
    color: #254654;
    background: #e2eef2;
}

[data-aichat-float-status]:empty {
    margin: 0;
}

[data-aichat-float-form] {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 48px;
    align-items: end;
    gap: 8px;
    margin: 0;
}

[data-aichat-float-label] {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
}

[data-aichat-float-form] textarea {
    display: block;
    box-sizing: border-box;
    width: 100%;
    min-height: 48px;
    max-height: 120px;
    margin: 0;
    padding: 12px 14px;
    resize: vertical;
    border: 1px solid #d9e3d8;
    border-radius: 16px;
    color: var(--aichat-float-ink);
    background: #fff;
    font: 400 16px/1.35 system-ui, sans-serif;
}

[data-aichat-float-send] {
    display: grid;
    place-items: center;
    width: 48px;
    height: 48px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    cursor: pointer;
    color: var(--aichat-float-ink);
    background: var(--aichat-float-accent);
}

[data-aichat-float-send]:disabled {
    cursor: default;
    color: #526455;
    background: #e4ebe0;
}

[data-aichat-float-send] svg {
    width: 22px;
    height: 22px;
}

[data-aichat-float-prompt]:focus-visible,
[data-aichat-float-sources] a:focus-visible,
[data-aichat-float-form] textarea:focus-visible,
[data-aichat-float-send]:focus-visible {
    outline: 2px solid #456937;
    outline-offset: 2px;
}

[data-aichat-float-note] {
    margin: 8px 2px 0;
    color: #526456;
    font-size: 12px;
    line-height: 1.35;
}

@keyframes aichat-float-enter {
    from { opacity: 0; transform: translateY(8px) scale(.99); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

@media (max-width: 540px) {
    [data-aichat-float] { --aichat-float-edge: 10px; }
    [data-aichat-float-panel][open] { border-radius: 19px; }
    [data-aichat-float-scroll] { padding: 14px; }
}

@media (prefers-reduced-motion: reduce) {
    [data-aichat-float-panel][open] { animation: none; }
    [data-aichat-float-dots] span { animation: none; }
}

/* Theme-wide button/input styles must not change the launcher placement or the hit targets. */
[data-aichat-float] button[data-aichat-float-open] {
    position: fixed !important;
    inset: auto var(--aichat-float-inline) var(--aichat-float-bottom) auto !important;
    min-height: 56px !important;
    padding: 0 21px !important;
    border: var(--aichat-float-launcher-border) !important;
    border-radius: 999px !important;
    color: var(--aichat-float-on-accent) !important;
    background: var(--aichat-float-accent) !important;
    font: 750 15px/1.2 system-ui, sans-serif !important;
    text-transform: none !important;
}

[data-aichat-float] button[data-aichat-float-close],
[data-aichat-float] button[data-aichat-float-send] {
    padding: 0 !important;
    border: 0 !important;
    min-width: 44px !important;
    min-height: 44px !important;
}

[data-aichat-float] button[data-aichat-float-close] {
    border-radius: 12px !important;
    color: #fff !important;
    background: #ffffff12 !important;
}

[data-aichat-float] button[data-aichat-float-prompt] {
    min-height: 44px !important;
    padding: 7px 12px !important;
    border: 1px solid #dce6d8 !important;
    border-radius: 999px !important;
    color: #293a30 !important;
    background: #fff !important;
    font: 550 13px/1.35 system-ui, sans-serif !important;
    text-transform: none !important;
}

[data-aichat-float] [data-aichat-float-form] textarea {
    min-height: 48px !important;
    height: 48px;
    max-height: 120px !important;
    padding: 12px 14px !important;
    border: 1px solid #d9e3d8 !important;
    border-radius: 16px !important;
    color: var(--aichat-float-ink) !important;
    background: #fff !important;
    font: 400 16px/1.35 system-ui, sans-serif !important;
}

[data-aichat-float] button[data-aichat-float-send] {
    width: 48px !important;
    height: 48px !important;
    border-radius: 50% !important;
    color: var(--aichat-float-ink) !important;
    background: var(--aichat-float-accent) !important;
}

[data-aichat-float] button[data-aichat-float-send]:disabled {
    color: #526455 !important;
    background: #e4ebe0 !important;
}
