.amper-ai {
    --amper-ai-ink: #10243d;
    --amper-ai-muted: #64748b;
    --amper-ai-line: #dbe4ee;
    --amper-ai-soft: #f4f7fa;
    --amper-ai-lime: #98c900;
    --amper-ai-lime-dark: #6f9700;
    --amper-ai-link: #175cd3;
    position: fixed;
    right: max(24px, env(safe-area-inset-right));
    bottom: max(24px, env(safe-area-inset-bottom));
    z-index: 2147483000;
    color: var(--amper-ai-ink);
    font-family: inherit;
    font-size: 15px;
    line-height: 1.45;
    letter-spacing: 0;
}

.amper-ai *,
.amper-ai *::before,
.amper-ai *::after {
    box-sizing: border-box;
}

.amper-ai button,
.amper-ai textarea {
    font: inherit;
    letter-spacing: 0;
    text-transform: none;
}

.amper-ai [hidden] {
    display: none !important;
}

.amper-ai-launcher {
    position: relative;
    display: grid;
    width: 58px;
    height: 58px;
    margin-left: auto;
    padding: 0;
    place-items: center;
    border: 0;
    border-radius: 50%;
    background: var(--amper-ai-ink);
    color: #fff;
    box-shadow: 0 12px 28px rgba(16, 36, 61, .25);
    cursor: pointer;
    transition: transform .16s ease, background .16s ease;
}

.amper-ai-launcher:hover,
.amper-ai-launcher:focus-visible {
    background: #0a192b;
    transform: translateY(-2px);
}

.amper-ai-launcher:focus-visible,
.amper-ai-nudge:focus-visible,
.amper-ai button:focus-visible,
.amper-ai a:focus-visible,
.amper-ai textarea:focus-visible {
    outline: 3px solid rgba(23, 92, 211, .28);
    outline-offset: 2px;
}

.amper-ai-launcher .dashicons {
    width: 25px;
    height: 25px;
    font-size: 25px;
    line-height: 25px;
}

.amper-ai-launcher-dot {
    position: absolute;
    top: 3px;
    right: 3px;
    width: 13px;
    height: 13px;
    border: 3px solid #fff;
    border-radius: 50%;
    background: var(--amper-ai-lime);
}

.amper-ai-nudge {
    position: absolute;
    right: 0;
    bottom: 70px;
    width: max-content;
    max-width: min(260px, calc(100vw - 32px));
    padding: 11px 15px;
    border: 1px solid var(--amper-ai-line);
    border-radius: 8px;
    background: #fff;
    color: var(--amper-ai-ink);
    box-shadow: 0 12px 30px rgba(16, 36, 61, .15);
    font-weight: 700;
    opacity: 0;
    cursor: pointer;
    transform: translateY(8px);
    transition: opacity .2s ease, transform .2s ease;
}

.amper-ai-nudge.is-visible {
    opacity: 1;
    transform: translateY(0);
}

.amper-ai-panel {
    position: absolute;
    right: 0;
    bottom: 72px;
    display: grid;
    width: min(420px, calc(100vw - 32px));
    height: min(700px, calc(100vh - 118px));
    height: min(700px, calc(100dvh - 118px));
    min-height: 480px;
    grid-template-rows: auto minmax(0, 1fr) auto auto auto;
    overflow: hidden;
    border: 1px solid var(--amper-ai-line);
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 24px 70px rgba(16, 36, 61, .24);
    opacity: 0;
    transform: translateY(12px) scale(.98);
    transform-origin: bottom right;
    transition: opacity .18s ease, transform .18s ease;
}

.amper-ai.is-open .amper-ai-panel {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.amper-ai.is-open .amper-ai-launcher {
    background: var(--amper-ai-lime-dark);
}

.amper-ai-header {
    display: flex;
    min-height: 70px;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 12px 14px;
    border-bottom: 1px solid var(--amper-ai-line);
    background: #fff;
}

.amper-ai-brand {
    display: flex;
    min-width: 0;
    align-items: center;
    gap: 10px;
}

.amper-ai-brand-mark {
    display: grid;
    flex: 0 0 42px;
    width: 42px;
    height: 42px;
    place-items: center;
    border-radius: 7px;
    background: #0d1117;
    color: var(--amper-ai-lime);
    font-size: 23px;
    font-weight: 900;
}

.amper-ai-brand strong,
.amper-ai-brand span {
    display: block;
}

.amper-ai-brand strong {
    overflow: hidden;
    color: var(--amper-ai-ink);
    font-size: 16px;
    line-height: 1.25;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.amper-ai-brand div > span {
    margin-top: 3px;
    color: var(--amper-ai-muted);
    font-size: 12px;
    font-weight: 600;
}

.amper-ai-brand i {
    display: inline-block;
    width: 7px;
    height: 7px;
    margin-right: 5px;
    border-radius: 50%;
    background: #16a34a;
}

.amper-ai-header-actions {
    display: flex;
    flex: 0 0 auto;
    gap: 4px;
}

.amper-ai-header-actions button {
    display: grid;
    width: 38px;
    height: 38px;
    padding: 0;
    place-items: center;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: var(--amper-ai-muted);
    cursor: pointer;
}

.amper-ai-header-actions button:hover {
    background: var(--amper-ai-soft);
    color: var(--amper-ai-ink);
}

.amper-ai-header-actions .dashicons {
    width: 21px;
    height: 21px;
    font-size: 21px;
    line-height: 21px;
}

.amper-ai-messages {
    min-height: 0;
    padding: 18px 14px 8px;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    background: var(--amper-ai-soft);
    scrollbar-color: #cbd5e1 transparent;
    scrollbar-width: thin;
}

.amper-ai-message {
    display: flex;
    width: 100%;
    margin: 0 0 12px;
}

.amper-ai-message--user {
    justify-content: flex-end;
}

.amper-ai-bubble {
    max-width: 88%;
    color: var(--amper-ai-ink);
}

.amper-ai-message--assistant .amper-ai-bubble {
    width: 100%;
    max-width: 100%;
}

.amper-ai-copy {
    width: fit-content;
    max-width: 100%;
    padding: 11px 13px;
    border: 1px solid var(--amper-ai-line);
    border-radius: 8px;
    background: #fff;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.amper-ai-message--user .amper-ai-copy {
    border-color: var(--amper-ai-ink);
    background: var(--amper-ai-ink);
    color: #fff;
}

.amper-ai-message--error .amper-ai-copy {
    border-color: #fecaca;
    background: #fff7f7;
    color: #a31515;
}

.amper-ai-products {
    display: grid;
    gap: 8px;
    margin-top: 9px;
}

.amper-ai-product {
    display: grid;
    min-width: 0;
    grid-template-columns: 78px minmax(0, 1fr);
    gap: 11px;
    padding: 10px;
    border: 1px solid var(--amper-ai-line);
    border-radius: 8px;
    background: #fff;
}

.amper-ai-product-media {
    display: grid;
    width: 78px;
    height: 78px;
    place-items: center;
    overflow: hidden;
    border: 1px solid #edf1f5;
    border-radius: 6px;
    background: #fff;
    color: var(--amper-ai-muted);
    text-decoration: none;
}

.amper-ai-product-media img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.amper-ai-product-media .dashicons {
    width: 28px;
    height: 28px;
    font-size: 28px;
    line-height: 28px;
}

.amper-ai-product-body {
    min-width: 0;
}

.amper-ai-product-name {
    display: -webkit-box;
    overflow: hidden;
    color: var(--amper-ai-ink);
    font-size: 13px;
    font-weight: 750;
    line-height: 1.35;
    text-decoration: none;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.amper-ai-product-name:hover {
    color: var(--amper-ai-link);
}

.amper-ai-product-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 5px 8px;
    margin-top: 7px;
}

.amper-ai-product-price {
    color: var(--amper-ai-ink);
    font-size: 14px;
    white-space: nowrap;
}

.amper-ai-product-stock {
    color: #b42318;
    font-size: 11px;
    font-weight: 700;
}

.amper-ai-product-stock--instock {
    color: #16843d;
}

.amper-ai-product-stock--onbackorder {
    color: #9a6700;
}

.amper-ai-product-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
}

.amper-ai-product-view,
.amper-ai-product-add {
    min-height: 30px;
    padding: 5px 9px;
    border-radius: 5px;
    font-size: 11px;
    font-weight: 750;
    line-height: 18px;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
}

.amper-ai-product-view {
    border: 1px solid #b9c9dc;
    background: #fff;
    color: var(--amper-ai-ink);
}

.amper-ai-product-add {
    border: 1px solid var(--amper-ai-lime-dark);
    background: var(--amper-ai-lime);
    color: #122008;
}

.amper-ai-product-view:hover {
    border-color: var(--amper-ai-link);
    color: var(--amper-ai-link);
}

.amper-ai-product-add:hover {
    background: #a8dc00;
}

.amper-ai-product-add:disabled {
    cursor: wait;
    opacity: .72;
}

.amper-ai-product-add.is-added {
    border-color: #16843d;
    background: #16843d;
    color: #fff;
}

.amper-ai-product-add.is-error {
    border-color: #b42318;
    background: #fff;
    color: #b42318;
}

.amper-ai-quick-replies {
    display: flex;
    gap: 7px;
    padding: 8px 14px 6px;
    overflow-x: auto;
    border-top: 1px solid var(--amper-ai-line);
    background: #fff;
    scrollbar-width: none;
}

.amper-ai-quick-replies::-webkit-scrollbar {
    display: none;
}

.amper-ai-quick-reply {
    flex: 0 0 auto;
    max-width: 270px;
    min-height: 34px;
    padding: 6px 10px;
    overflow: hidden;
    border: 1px solid #b9c9dc;
    border-radius: 6px;
    background: #fff;
    color: var(--amper-ai-ink);
    font-size: 12px;
    font-weight: 650;
    text-overflow: ellipsis;
    white-space: nowrap;
    cursor: pointer;
}

.amper-ai-quick-reply:hover {
    border-color: var(--amper-ai-link);
    color: var(--amper-ai-link);
}

.amper-ai-composer {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 42px;
    align-items: end;
    gap: 8px;
    padding: 9px 12px 7px;
    border-top: 1px solid var(--amper-ai-line);
    background: #fff;
}

.amper-ai-composer textarea {
    width: 100%;
    min-height: 42px;
    max-height: 112px;
    margin: 0;
    padding: 10px 11px;
    resize: none;
    border: 1px solid #b9c9dc;
    border-radius: 6px;
    background: #fff;
    color: var(--amper-ai-ink);
    font-size: 14px;
    line-height: 20px;
    box-shadow: none;
}

.amper-ai-composer textarea::placeholder {
    color: #8996a7;
}

.amper-ai-composer button {
    display: grid;
    width: 42px;
    height: 42px;
    padding: 0;
    place-items: center;
    border: 0;
    border-radius: 6px;
    background: var(--amper-ai-ink);
    color: #fff;
    cursor: pointer;
}

.amper-ai-composer button:hover {
    background: #0a192b;
}

.amper-ai-composer button:disabled {
    cursor: wait;
    opacity: .55;
}

.amper-ai-composer .dashicons {
    width: 20px;
    height: 20px;
    font-size: 20px;
    line-height: 20px;
}

.amper-ai-disclaimer {
    margin: 0;
    padding: 0 12px 9px;
    background: #fff;
    color: var(--amper-ai-muted);
    font-size: 10px;
    line-height: 1.35;
    text-align: center;
}

.amper-ai-typing {
    display: flex;
    width: 51px;
    height: 38px;
    align-items: center;
    justify-content: center;
    gap: 4px;
    border: 1px solid var(--amper-ai-line);
    border-radius: 8px;
    background: #fff;
}

.amper-ai-typing i {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--amper-ai-muted);
    animation: amper-ai-dot 1s infinite ease-in-out;
}

.amper-ai-typing i:nth-child(2) {
    animation-delay: .14s;
}

.amper-ai-typing i:nth-child(3) {
    animation-delay: .28s;
}

@keyframes amper-ai-dot {
    0%, 70%, 100% {
        opacity: .35;
        transform: translateY(0);
    }
    35% {
        opacity: 1;
        transform: translateY(-3px);
    }
}

@media (max-width: 600px) {
    body.amper-ai-open {
        overflow: hidden;
    }

    .amper-ai {
        right: max(14px, env(safe-area-inset-right));
        bottom: max(88px, calc(env(safe-area-inset-bottom) + 72px));
    }

    .amper-ai-launcher {
        width: 54px;
        height: 54px;
    }

    .amper-ai-panel {
        position: fixed;
        inset: 0;
        width: 100%;
        height: 100vh;
        height: 100dvh;
        min-height: 0;
        border: 0;
        border-radius: 0;
        transform: translateY(18px);
        transform-origin: bottom center;
    }

    .amper-ai.is-open .amper-ai-panel {
        transform: translateY(0);
    }

    .amper-ai-header {
        min-height: 66px;
        padding-top: max(10px, env(safe-area-inset-top));
    }

    .amper-ai-messages {
        padding-right: 12px;
        padding-left: 12px;
    }

    .amper-ai-composer {
        padding-right: max(10px, env(safe-area-inset-right));
        padding-left: max(10px, env(safe-area-inset-left));
    }

    .amper-ai-disclaimer {
        padding-bottom: max(8px, env(safe-area-inset-bottom));
    }

    .amper-ai-nudge {
        bottom: 66px;
    }
}

@media (max-width: 360px) {
    .amper-ai-brand strong {
        max-width: 150px;
    }

    .amper-ai-product {
        grid-template-columns: 68px minmax(0, 1fr);
    }

    .amper-ai-product-media {
        width: 68px;
        height: 68px;
    }
}

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