.sa-root {
    --sa-accent: #7b43d1;
    --sa-accent-dark: #6332b0;
    --sa-text: #222;
    --sa-muted: #757575;
    --sa-line: #e6e6e6;
    --sa-soft: #f4f0fb;
    position: fixed;
    left: 16px;
    bottom: calc(72px + env(safe-area-inset-bottom, 0px));
    z-index: 101;
    direction: rtl;
    font-family: inherit;
    font-size: 14px;
    line-height: 1.7;
    color: var(--sa-text);
}

html.sa-open .sa-root {
    z-index: 1040;
}

.sa-root *,
.sa-root *::before,
.sa-root *::after {
    box-sizing: border-box;
}

.sa-root svg {
    width: 22px;
    height: 22px;
    display: block;
}

.sa-toggle {
    width: 52px;
    height: 52px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: var(--sa-accent);
    color: #fff;
    box-shadow: 0 4px 14px rgba(0, 0, 0, .22);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.sa-toggle svg {
    width: 26px;
    height: 26px;
}

.sa-toggle:focus-visible,
.sa-root button:focus-visible,
.sa-root a:focus-visible {
    outline: 2px solid var(--sa-accent-dark);
    outline-offset: 2px;
}

.sa-panel {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 1060;
    display: flex;
    flex-direction: column;
    background: #fff;
}

.sa-panel[hidden] {
    display: none !important;
}

.sa-head {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 14px;
    padding-top: calc(10px + env(safe-area-inset-top, 0px));
    background: var(--sa-accent);
    color: #fff;
}

.sa-title {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    line-height: 1.4;
}

.sa-title strong {
    font-size: 15px;
}

.sa-title small {
    font-size: 11px;
    opacity: .85;
}

.sa-head-btn {
    border: 1px solid rgba(255, 255, 255, .5);
    background: transparent;
    color: #fff;
    border-radius: 16px;
    padding: 3px 10px;
    font: inherit;
    font-size: 12px;
    cursor: pointer;
}

.sa-close {
    border: 0;
    padding: 4px;
    border-radius: 50%;
}

.sa-messages {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: #fafafa;
}

.sa-bubble {
    max-width: 85%;
    padding: 8px 12px;
    border-radius: 14px;
    white-space: pre-line;
    overflow-wrap: anywhere;
}

.sa-bubble--user {
    align-self: flex-end;
    background: var(--sa-accent);
    color: #fff;
    border-bottom-left-radius: 4px;
}

.sa-bubble--assistant {
    align-self: flex-start;
    background: #fff;
    border: 1px solid var(--sa-line);
    border-bottom-right-radius: 4px;
}

.sa-bubble--assistant p,
.sa-bubble--assistant ol,
.sa-bubble--assistant ul {
    margin: 0 0 6px;
}

.sa-bubble--assistant > :last-child {
    margin-bottom: 0;
}

.sa-bubble--assistant ol,
.sa-bubble--assistant ul {
    padding-right: 18px;
    padding-left: 0;
}

.sa-bubble--assistant ol {
    list-style: decimal;
}

.sa-bubble--assistant ul {
    list-style: disc;
}

.sa-bubble--assistant a {
    color: var(--sa-accent);
    text-decoration: underline;
}

.sa-intro,
.sa-reply {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.sa-examples {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: flex-start;
}

.sa-example {
    border: 1px solid var(--sa-accent);
    background: #fff;
    color: var(--sa-accent);
    border-radius: 16px;
    padding: 4px 12px;
    font: inherit;
    font-size: 13px;
    cursor: pointer;
}

.sa-example:hover {
    background: var(--sa-soft);
}

.sa-typing {
    display: flex;
    gap: 4px;
    padding: 12px 14px;
}

.sa-typing span {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--sa-muted);
    animation: sa-dot 1s infinite ease-in-out;
}

.sa-typing span:nth-child(2) {
    animation-delay: .15s;
}

.sa-typing span:nth-child(3) {
    animation-delay: .3s;
}

@keyframes sa-dot {
    0%, 80%, 100% { opacity: .3; transform: translateY(0); }
    40% { opacity: 1; transform: translateY(-3px); }
}

.sa-cards {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 4px;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
}

.sa-card {
    flex: 0 0 140px;
    scroll-snap-align: start;
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 8px;
    background: #fff;
    border: 1px solid var(--sa-line);
    border-radius: 10px;
    color: var(--sa-text);
    text-decoration: none;
    font-size: 12px;
    line-height: 1.5;
}

.sa-card:hover {
    color: var(--sa-text);
    text-decoration: none;
    border-color: var(--sa-accent);
}

.sa-card-img {
    display: block;
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    border-radius: 6px;
    background: #f1f1f1;
}

.sa-card-title {
    font-weight: 600;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.sa-card-price {
    display: flex;
    flex-direction: column;
}

.sa-card-price del {
    color: var(--sa-muted);
    font-size: 11px;
}

.sa-card-price strong {
    color: var(--sa-accent-dark);
}

.sa-card-sizes {
    color: var(--sa-muted);
    font-size: 11px;
}

.sa-whatsapp {
    align-self: flex-start;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: 18px;
    background: #25d366;
    color: #fff;
    font-weight: 600;
    text-decoration: none;
}

.sa-whatsapp:hover {
    color: #fff;
    text-decoration: none;
    background: #1ebe5b;
}

.sa-captcha {
    padding: 8px 14px 0;
    border-top: 1px solid var(--sa-line);
    background: #fff;
}

.sa-captcha[hidden] {
    display: none !important;
}

.sa-captcha-row {
    display: flex;
    gap: 8px;
    align-items: center;
}

.sa-captcha-img {
    width: 120px;
    height: 45px;
    border-radius: 6px;
    cursor: pointer;
    flex: none;
}

.sa-captcha-input {
    flex: 1;
    min-width: 0;
    height: 40px;
    border: 1px solid var(--sa-line);
    border-radius: 8px;
    padding: 0 10px;
    font: inherit;
    text-align: center;
}

.sa-captcha-error {
    color: #d32f2f;
    font-size: 12px;
    padding-top: 4px;
}

.sa-form {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    margin: 0;
    padding: 10px 14px;
    padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px));
    border-top: 1px solid var(--sa-line);
    background: #fff;
}

.sa-captcha:not([hidden]) + .sa-form {
    border-top: 0;
}

.sa-input {
    flex: 1;
    min-width: 0;
    min-height: 40px;
    max-height: 120px;
    resize: none;
    border: 1px solid var(--sa-line);
    border-radius: 20px;
    padding: 8px 14px;
    font: inherit;
    font-size: 16px;
    line-height: 1.5;
    color: var(--sa-text);
    background: #fff;
}

.sa-input:focus,
.sa-captcha-input:focus {
    outline: 0;
    border-color: var(--sa-accent);
}

.sa-send {
    flex: none;
    width: 40px;
    height: 40px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: var(--sa-accent);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.sa-send svg {
    transform: scaleX(-1);
}

.sa-send:disabled {
    opacity: .5;
    cursor: default;
}

@media (max-width: 767.98px) {
    html.sa-open,
    html.sa-open body {
        overflow: hidden;
    }
}

@media (min-width: 768px) {
    .sa-root {
        left: 20px;
        bottom: 60px;
    }

    .sa-toggle {
        width: 60px;
        height: 60px;
    }

    .sa-toggle svg {
        width: 30px;
        height: 30px;
    }

    .sa-panel {
        top: auto;
        right: auto;
        left: 20px;
        bottom: 130px;
        width: 370px;
        height: 560px;
        max-height: calc(100vh - 150px);
        border-radius: 16px;
        overflow: hidden;
        box-shadow: 0 12px 40px rgba(0, 0, 0, .2);
    }

    .sa-head {
        padding-top: 10px;
    }

    .sa-input {
        font-size: 14px;
    }
}

html[data-assistant="on"] a.float {
    display: none !important;
}
