:root {
    --ag-chat-navy: #17233c;
    --ag-chat-navy-soft: #263a61;
    --ag-chat-red: #b5121b;
    --ag-chat-border: #dfe3e8;
    --ag-chat-muted: #68707d;
    --ag-chat-bg: #f4f5f7;
}

.ag-chat-root,
.ag-chat-root * {
    box-sizing: border-box;
}

.ag-chat-root {
    position: fixed;
    right: 24px;
    bottom: 126px;
    z-index: 2147482000;
    color: #1d2430;
    font-family: "Noto Sans KR", "Apple SD Gothic Neo", Arial, sans-serif;
    font-size: 14px;
    line-height: 1.5;
}

.ag-chat-launcher {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    min-width: 112px;
    height: 52px;
    padding: 0 17px;
    border: 0;
    border-radius: 999px;
    background: var(--ag-chat-navy);
    box-shadow: 0 8px 25px rgba(23, 35, 60, .28);
    color: #fff;
    font: inherit;
    font-size: 15px;
    font-weight: 800;
    cursor: pointer;
}

.ag-chat-launcher:hover,
.ag-chat-launcher:focus-visible {
    background: var(--ag-chat-navy-soft);
    outline: 3px solid rgba(181, 18, 27, .2);
}

.ag-chat-launcher svg {
    width: 21px;
    height: 21px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.9;
}

.ag-chat-launcher-dot {
    width: 7px;
    height: 7px;
    margin-left: -3px;
    border-radius: 50%;
    background: #ee3943;
}

.ag-pc-v3-float .ag-chat-launcher.is-inline-tool,
.ag-v3-float-tools .ag-chat-launcher.is-inline-tool {
    min-width: 0;
    padding: 0;
    border: 1px solid #ddd;
    border-radius: 50%;
    background: rgba(255, 255, 255, .96);
    color: #333;
    box-shadow: 0 3px 12px rgba(0, 0, 0, .12);
}

.ag-pc-v3-float .ag-chat-launcher.is-inline-tool {
    width: 48px;
    height: 48px;
    border-color: #d9dde3;
    color: #222;
    box-shadow: 0 4px 14px rgba(0, 0, 0, .12);
}

.ag-v3-float-tools .ag-chat-launcher.is-inline-tool {
    width: 42px;
    height: 42px;
}

.ag-pc-v3-float .ag-chat-launcher.is-inline-tool:hover,
.ag-pc-v3-float .ag-chat-launcher.is-inline-tool:focus-visible,
.ag-v3-float-tools .ag-chat-launcher.is-inline-tool:hover,
.ag-v3-float-tools .ag-chat-launcher.is-inline-tool:focus-visible {
    background: rgba(255, 255, 255, .96);
    outline: 0;
}

.ag-pc-v3-float .ag-chat-launcher.is-inline-tool svg {
    width: 23px;
    height: 23px;
    stroke-width: 2;
}

.ag-v3-float-tools .ag-chat-launcher.is-inline-tool svg {
    width: 21px;
    height: 21px;
    stroke-width: 1.8;
}

.ag-chat-backdrop {
    display: none;
}

.ag-chat-panel {
    position: absolute;
    right: 0;
    bottom: 64px;
    display: flex;
    flex-direction: column;
    width: 390px;
    height: min(650px, calc(100vh - 170px));
    min-height: 430px;
    overflow: hidden;
    border: 1px solid rgba(23, 35, 60, .18);
    border-radius: 18px;
    background: #fff;
    box-shadow: 0 20px 55px rgba(20, 29, 45, .24);
    transform-origin: right bottom;
    animation: ag-chat-open .16s ease-out;
}

.ag-chat-panel[hidden] {
    display: none;
}

@keyframes ag-chat-open {
    from { opacity: 0; transform: translateY(8px) scale(.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.ag-chat-header {
    display: flex;
    align-items: center;
    min-height: 66px;
    padding: 13px 14px 13px 18px;
    background: var(--ag-chat-navy);
    color: #fff;
}

.ag-chat-heading {
    min-width: 0;
    flex: 1;
}

.ag-chat-heading strong,
.ag-chat-heading small {
    display: block;
}

.ag-chat-heading strong {
    font-size: 17px;
    font-weight: 800;
    letter-spacing: -.2px;
}

.ag-chat-heading small {
    margin-top: 1px;
    color: rgba(255, 255, 255, .72);
    font-size: 12px;
}

.ag-chat-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: #fff;
    font-size: 25px;
    line-height: 1;
    cursor: pointer;
}

.ag-chat-close:hover,
.ag-chat-close:focus-visible {
    background: rgba(255, 255, 255, .12);
    outline: 0;
}

.ag-chat-messages {
    flex: 1;
    overflow-x: hidden;
    overflow-y: auto;
    padding: 18px 16px 24px;
    background: var(--ag-chat-bg);
    overscroll-behavior: contain;
}

.ag-chat-welcome {
    max-width: 300px;
    padding: 12px 14px;
    border: 1px solid var(--ag-chat-border);
    border-radius: 5px 16px 16px 16px;
    background: #fff;
    color: #343b46;
}

.ag-chat-message {
    display: flex;
    margin-top: 13px;
}

.ag-chat-message.is-user {
    justify-content: flex-end;
}

.ag-chat-bubble {
    max-width: 86%;
    padding: 10px 13px;
    border-radius: 5px 15px 15px 15px;
    background: #fff;
    box-shadow: 0 1px 2px rgba(20, 29, 45, .08);
    color: #242b35;
    white-space: pre-wrap;
    word-break: keep-all;
    overflow-wrap: anywhere;
}

.ag-chat-message.is-user .ag-chat-bubble {
    border-radius: 15px 5px 15px 15px;
    background: var(--ag-chat-navy-soft);
    color: #fff;
}

.ag-chat-message.is-error .ag-chat-bubble {
    border: 1px solid #edc5c8;
    background: #fff7f7;
    color: #8f1119;
}

.ag-chat-typing .ag-chat-bubble {
    color: var(--ag-chat-muted);
}

.ag-chat-typing-dot {
    display: inline-block;
    width: 5px;
    height: 5px;
    margin: 0 2px;
    border-radius: 50%;
    background: #7b8491;
    animation: ag-chat-dot 1s infinite ease-in-out;
}

.ag-chat-typing-dot:nth-child(2) { animation-delay: .13s; }
.ag-chat-typing-dot:nth-child(3) { animation-delay: .26s; }

@keyframes ag-chat-dot {
    0%, 70%, 100% { transform: translateY(0); opacity: .45; }
    35% { transform: translateY(-4px); opacity: 1; }
}

.ag-chat-results,
.ag-chat-model-results {
    margin-top: 10px;
}

.ag-chat-card,
.ag-chat-model-card {
    display: flex;
    gap: 11px;
    width: 100%;
    margin-top: 8px;
    padding: 10px;
    border: 1px solid var(--ag-chat-border);
    border-radius: 12px;
    background: #fff;
    color: inherit;
    text-align: left;
    text-decoration: none;
}

.ag-chat-card:hover,
.ag-chat-card:focus-visible {
    border-color: #aeb7c5;
    box-shadow: 0 4px 12px rgba(23, 35, 60, .1);
    outline: 0;
}

.ag-chat-card-image {
    width: 74px;
    height: 62px;
    flex: 0 0 74px;
    border-radius: 8px;
    background: #eceff2;
    object-fit: cover;
}

.ag-chat-card-body {
    min-width: 0;
    flex: 1;
}

.ag-chat-card-title {
    display: -webkit-box;
    overflow: hidden;
    color: #202733;
    font-size: 14px;
    font-weight: 800;
    line-height: 1.35;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.ag-chat-card-price {
    display: block;
    margin-top: 4px;
    color: var(--ag-chat-red);
    font-size: 14px;
    font-weight: 800;
}

.ag-chat-card-meta {
    display: block;
    margin-top: 2px;
    color: var(--ag-chat-muted);
    font-size: 12px;
}

.ag-chat-model-card {
    display: block;
}

.ag-chat-model-card strong {
    display: block;
    color: #202733;
}

.ag-chat-model-card span {
    display: block;
    margin-top: 3px;
    color: var(--ag-chat-muted);
    font-size: 12px;
}

.ag-chat-help-link {
    display: inline-flex;
    align-items: center;
    min-height: 36px;
    margin-top: 9px;
    padding: 0 13px;
    border: 1px solid var(--ag-chat-navy-soft);
    border-radius: 8px;
    color: var(--ag-chat-navy-soft);
    font-weight: 800;
    text-decoration: none;
}

.ag-chat-form {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    padding: 11px 12px calc(11px + env(safe-area-inset-bottom));
    border-top: 1px solid var(--ag-chat-border);
    background: #fff;
}

.ag-chat-input {
    min-width: 0;
    min-height: 44px;
    max-height: 110px;
    flex: 1;
    resize: none;
    overflow-y: auto;
    padding: 11px 12px;
    border: 1px solid #cfd5dd;
    border-radius: 12px;
    background: #fff;
    color: #1e252e;
    font: inherit;
    line-height: 1.45;
    outline: 0;
}

.ag-chat-input:focus {
    border-color: var(--ag-chat-navy-soft);
    box-shadow: 0 0 0 3px rgba(38, 58, 97, .1);
}

.ag-chat-send {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    flex: 0 0 44px;
    border: 0;
    border-radius: 12px;
    background: var(--ag-chat-red);
    color: #fff;
    font: inherit;
    font-weight: 800;
    cursor: pointer;
}

.ag-chat-send:disabled {
    background: #afb4bd;
    cursor: default;
}

@media (max-width: 767px) {
    .ag-chat-root {
        right: 14px;
        bottom: calc(82px + env(safe-area-inset-bottom));
    }

    body.ag-v3-hide-bottom-nav .ag-chat-root {
        bottom: calc(18px + env(safe-area-inset-bottom));
    }

    .ag-chat-launcher {
        width: 50px;
        min-width: 50px;
        height: 50px;
        padding: 0;
        box-shadow: 0 7px 20px rgba(23, 35, 60, .3);
    }

    .ag-chat-launcher-label,
    .ag-chat-launcher-dot {
        display: none;
    }

    .ag-chat-backdrop {
        position: fixed;
        inset: 0;
        display: block;
        background: rgba(13, 20, 33, .34);
    }

    .ag-chat-backdrop[hidden] {
        display: none;
    }

    .ag-chat-panel {
        position: fixed;
        right: 0;
        bottom: 0;
        left: 0;
        width: 100%;
        height: min(78dvh, 720px);
        min-height: 440px;
        border-width: 1px 0 0;
        border-radius: 20px 20px 0 0;
        transform-origin: center bottom;
    }

    .ag-chat-panel::before {
        position: absolute;
        top: 7px;
        left: 50%;
        width: 38px;
        height: 4px;
        border-radius: 4px;
        background: rgba(255, 255, 255, .35);
        content: "";
        transform: translateX(-50%);
    }

    .ag-chat-header {
        min-height: 68px;
        padding-top: 17px;
    }

    .ag-chat-messages {
        padding-right: 13px;
        padding-left: 13px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .ag-chat-panel,
    .ag-chat-typing-dot {
        animation: none;
    }
}
