.gd-aimfs-chatbot {
    --gd-aimfs-accent: #0f4567;
    --gd-aimfs-button-text: #ffffff;
    --gd-aimfs-launcher-bg: #0f4567;
    --gd-aimfs-text: #1f2937;
    --gd-aimfs-muted: #6b7280;
    --gd-aimfs-border: #e8d8ff;
    --gd-aimfs-bg: #f8f5fc;
    --gd-aimfs-header-bg: #123f5e;
    --gd-aimfs-soft: #ffffff;
    --gd-aimfs-user-bg: #0f4567;
    --gd-aimfs-user-text: #ffffff;
    --gd-aimfs-sources-link: #0f4567;
    --gd-aimfs-header-text: #ffffff;
    --gd-aimfs-online: #26c56f;
    --gd-aimfs-shadow: 0 22px 60px rgba(15, 23, 42, 0.22);
    color: var(--gd-aimfs-text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    font-size: 14px;
    line-height: 1.45;
}

.gd-aimfs-chatbot * { box-sizing: border-box; }

.gd-aimfs-chatbot[data-mode="inline"] .gd-aimfs-chatbot__panel {
    border: 1px solid var(--gd-aimfs-border);
    border-radius: 24px;
    overflow: hidden;
    max-width: 760px;
    background: var(--gd-aimfs-bg);
    box-shadow: 0 18px 50px rgba(15, 23, 42, 0.12);
}

.gd-aimfs-chatbot[data-mode="floating"] {
    position: fixed;
    bottom: 22px;
    z-index: 99999;
}

.gd-aimfs-chatbot[data-mode="floating"][data-position="right"] { right: 22px; }
.gd-aimfs-chatbot[data-mode="floating"][data-position="left"] { left: 22px; }

.gd-aimfs-floating__launcher {
    min-width: 64px;
    height: 58px;
    border-radius: 999px;
    border: 0;
    background: var(--gd-aimfs-launcher-bg);
    color: #fff;
    box-shadow: var(--gd-aimfs-shadow);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 0 18px;
    gap: 10px;
    transition: transform .18s ease, box-shadow .18s ease, opacity .18s ease;
}

.gd-aimfs-floating__launcher:hover {
    transform: translateY(-2px);
    box-shadow: 0 26px 66px rgba(15, 23, 42, 0.28);
}

.gd-aimfs-floating__launcher-logo {
    width: 31px;
    height: 31px;
    object-fit: cover;
    border-radius: 999px;
    flex: 0 0 auto;
    background: rgba(255,255,255,.18);
}

.gd-aimfs-floating__launcher-icon {
    width: 28px;
    height: 28px;
    display: inline-flex;
}

.gd-aimfs-floating__launcher-icon svg { width: 100%; height: 100%; }

.gd-aimfs-floating__launcher-text {
    font-weight: 800;
    line-height: 1;
    white-space: nowrap;
    letter-spacing: .01em;
}

.gd-aimfs-chatbot[data-mode="floating"] .gd-aimfs-chatbot__panel {
    position: absolute;
    bottom: 78px;
    width: min(390px, calc(100vw - 24px));
    height: min(610px, calc(100vh - 112px));
    background: var(--gd-aimfs-bg);
    border: 1px solid rgba(15, 69, 103, .08);
    border-radius: 0 22px 22px 22px;
    overflow: hidden;
    box-shadow: var(--gd-aimfs-shadow);
    display: flex;
    flex-direction: column;
}

.gd-aimfs-chatbot[data-mode="floating"][data-position="right"] .gd-aimfs-chatbot__panel { right: 0; }
.gd-aimfs-chatbot[data-mode="floating"][data-position="left"] .gd-aimfs-chatbot__panel { left: 0; }
.gd-aimfs-chatbot__panel.is-collapsed { display: none !important; }

.gd-aimfs-chatbot__header {
    min-height: 76px;
    padding: 16px 18px;
    border-bottom: 0;
    background: var(--gd-aimfs-header-bg);
    color: var(--gd-aimfs-header-text);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex: 0 0 auto;
}

.gd-aimfs-chatbot__brand {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.gd-aimfs-chatbot__logo {
    width: 44px;
    height: 44px;
    object-fit: cover;
    border-radius: 999px;
    flex: 0 0 auto;
    background: rgba(255,255,255,.18);
}

.gd-aimfs-chatbot__brand-copy {
    display: grid;
    gap: 2px;
    min-width: 0;
}

.gd-aimfs-chatbot__header h3 {
    margin: 0;
    font-size: 17px;
    font-weight: 800;
    color: var(--gd-aimfs-header-text);
    line-height: 1.15;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.gd-aimfs-chatbot__status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: rgba(255,255,255,.86);
    font-size: 13px;
    font-weight: 650;
}

.gd-aimfs-chatbot__status-dot {
    width: 10px;
    height: 10px;
    border-radius: 999px;
    background: var(--gd-aimfs-online);
    box-shadow: 0 0 0 3px rgba(38,197,111,.18);
}

.gd-aimfs-chatbot__close {
    width: 38px;
    height: 38px;
    border: 0;
    border-radius: 999px;
    background: rgba(255,255,255,.14);
    font-size: 25px;
    line-height: 1;
    cursor: pointer;
    color: var(--gd-aimfs-header-text);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
}

.gd-aimfs-chatbot__history {
    padding: 12px 16px 0;
    border-bottom: 0;
    background: var(--gd-aimfs-bg);
    flex: 0 0 auto;
}

.gd-aimfs-chatbot__history-title {
    font-size: 12px;
    font-weight: 800;
    margin: 0 0 8px;
    color: var(--gd-aimfs-muted);
}

.gd-aimfs-chatbot__history-list {
    display: flex;
    gap: 8px;
    list-style: none;
    margin: 0;
    padding: 0 0 4px;
    overflow-x: auto;
    scrollbar-width: thin;
}

.gd-aimfs-chatbot__history-list:empty { display: none; }

.gd-aimfs-chatbot__history-list button {
    border: 1px solid var(--gd-aimfs-border);
    background: #fff;
    border-radius: 999px;
    padding: 7px 11px;
    cursor: pointer;
    font-size: 12px;
    color: var(--gd-aimfs-text);
    max-width: 210px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    box-shadow: 0 8px 22px rgba(15,23,42,.05);
}

.gd-aimfs-chatbot__messages {
    min-height: 280px;
    max-height: none;
    overflow: auto;
    padding: 18px 18px 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: var(--gd-aimfs-bg);
    flex: 1 1 auto;
}

.gd-aimfs-chatbot__empty {
    margin: auto;
    color: var(--gd-aimfs-muted);
    text-align: center;
    font-weight: 600;
}

.gd-aimfs-chatbot__message {
    display: flex;
    align-items: flex-end;
    gap: 9px;
    max-width: 100%;
}

.gd-aimfs-chatbot__message--user {
    justify-content: flex-end;
}

.gd-aimfs-chatbot__message--assistant {
    justify-content: flex-start;
}

.gd-aimfs-chatbot__avatar {
    width: 32px;
    height: 32px;
    border-radius: 999px;
    object-fit: cover;
    background: #ffffff;
    box-shadow: 0 6px 16px rgba(15,23,42,.08);
    flex: 0 0 auto;
}

.gd-aimfs-chatbot__avatar-fallback {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--gd-aimfs-header-bg);
    color: #fff;
    font-weight: 800;
    font-size: 12px;
}

.gd-aimfs-chatbot__bubble {
    padding: 12px 15px;
    border-radius: 18px;
    max-width: 78%;
    line-height: 1.5;
    color: var(--gd-aimfs-text);
    word-wrap: break-word;
    overflow-wrap: anywhere;
    box-shadow: 0 10px 28px rgba(15,23,42,.06);
}

.gd-aimfs-chatbot__bubble--user {
    margin-left: auto;
    background: var(--gd-aimfs-user-bg);
    color: var(--gd-aimfs-user-text);
    border-bottom-right-radius: 8px;
}

.gd-aimfs-chatbot__bubble--assistant {
    background: var(--gd-aimfs-soft);
    color: var(--gd-aimfs-text);
    border-bottom-left-radius: 8px;
}

.gd-aimfs-chatbot__bubble--thinking { max-width: 210px; }

.gd-aimfs-chatbot__thinking {
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.gd-aimfs-chatbot__spinner {
    width: 18px;
    height: 18px;
    border: 2px solid rgba(17, 24, 39, 0.16);
    border-top-color: var(--gd-aimfs-launcher-bg);
    border-radius: 999px;
    animation: gdAimfsSpin 0.85s linear infinite;
    flex: 0 0 auto;
}

@keyframes gdAimfsSpin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }

.gd-aimfs-chatbot__sources { margin-top: 9px; font-size: 12px; }
.gd-aimfs-chatbot__sources a {
    display: block;
    color: var(--gd-aimfs-sources-link);
    text-decoration: none;
    word-break: break-word;
}
.gd-aimfs-chatbot__sources a:hover { text-decoration: underline; }

.gd-aimfs-chatbot__form {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 10px;
    padding: 14px 16px;
    border-top: 1px solid rgba(15, 69, 103, .08);
    align-items: center;
    background: #ffffff;
    flex: 0 0 auto;
}

.gd-aimfs-chatbot__form textarea {
    width: 100%;
    resize: none;
    min-height: 43px;
    max-height: 110px;
    border: 1px solid var(--gd-aimfs-border);
    border-radius: 999px;
    padding: 12px 16px;
    font: inherit;
    color: var(--gd-aimfs-text);
    background: #ffffff;
    outline: none;
    transition: border-color .18s ease, box-shadow .18s ease;
}

.gd-aimfs-chatbot__form textarea:focus {
    border-color: var(--gd-aimfs-accent);
    box-shadow: 0 0 0 3px rgba(15,69,103,.10);
}

.gd-aimfs-chatbot__form button {
    align-self: center;
    min-width: 76px;
    border: 0;
    border-radius: 999px;
    background: var(--gd-aimfs-accent);
    color: var(--gd-aimfs-button-text);
    padding: 12px 18px;
    cursor: pointer;
    font-weight: 800;
    min-height: 43px;
    box-shadow: 0 12px 24px rgba(15,69,103,.18);
}

.gd-aimfs-chatbot__form.is-loading button,
.gd-aimfs-chatbot__form button:disabled { opacity: 0.72; cursor: wait; }

.gd-aimfs-chatbot__footer-brand {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    min-height: 38px;
    padding: 7px 16px 9px;
    border-top: 1px solid rgba(15, 69, 103, .08);
    background: #ffffff;
    color: var(--gd-aimfs-muted);
    font-size: 12px;
    flex: 0 0 auto;
}

.gd-aimfs-chatbot__powered { font-weight: 600; }

@media (max-width: 640px) {
    .gd-aimfs-chatbot[data-mode="floating"] {
        left: 10px !important;
        right: 10px !important;
        bottom: 10px;
    }

    .gd-aimfs-chatbot[data-mode="floating"] .gd-aimfs-floating__launcher {
        margin-left: auto;
        display: flex;
    }

    .gd-aimfs-chatbot[data-mode="floating"] .gd-aimfs-chatbot__panel {
        right: 0 !important;
        left: 0 !important;
        width: auto;
        height: min(610px, calc(100vh - 96px));
        border-radius: 0 22px 22px 22px;
    }

    .gd-aimfs-chatbot__bubble { max-width: 82%; }
}
