#saffron-chat-btn {
    position: fixed;
    right: 20px;
    bottom: 20px;
    z-index: 99999;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: #1a2744;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.22);
    font-size: 24px;
    line-height: 1;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

#saffron-chat-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 9px 24px rgba(0, 0, 0, 0.26);
}

#saffron-chat-window {
    position: fixed;
    right: 20px;
    bottom: 92px;
    z-index: 99998;
    width: 370px;
    height: 540px;
    max-height: calc(100vh - 125px);
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 12px 38px rgba(0, 0, 0, 0.22);
    display: none;
    flex-direction: column;
    overflow: hidden;
    font-family: Arial, Helvetica, sans-serif;
}

#saffron-chat-header {
    background: #1a2744;
    color: #d5a33a;
    padding: 14px 15px;
    font-weight: 700;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

#saffron-chat-title {
    display: block;
    min-width: 0;
    margin: 0;
    padding: 0;
    font-size: 16px;
    line-height: 1.25;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.saffron-chat-header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

#saffron-lang-select {
    font-size: 12px;
    padding: 4px 6px;
    color: #111;
    background: #fff;
    border: 0;
    border-radius: 5px;
    outline: none;
}

#saffron-chat-close {
    color: #fff;
    cursor: pointer;
    font-size: 25px;
    line-height: 1;
}

#saffron-chat-messages {
    flex: 1;
    padding: 15px;
    overflow-y: auto;
    background: #f5f0e8;
    display: flex;
    flex-direction: column;
    gap: 10px;
    scroll-behavior: smooth;
}

.chat-msg {
    padding: 10px 13px;
    border-radius: 14px;
    max-width: 86%;
    word-wrap: break-word;
    overflow-wrap: anywhere;
    white-space: pre-wrap;
    font-size: 14px;
    line-height: 1.55;
}

.chat-msg.user {
    align-self: flex-start;
    background: #c9922a;
    color: #fff;
    border-bottom-left-radius: 3px;
}

.chat-msg.bot {
    align-self: flex-end;
    background: #fff;
    color: #1a2744;
    border-bottom-right-radius: 3px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
}

#saffron-chat-input-area {
    display: flex;
    gap: 8px;
    padding: 10px;
    background: #fff;
    border-top: 1px solid #ddd;
}

#saffron-chat-input {
    flex: 1;
    min-width: 0;
    padding: 10px 13px;
    border: 1px solid #cfcfcf;
    border-radius: 20px;
    outline: none;
    font-size: 14px;
}

#saffron-chat-input:focus {
    border-color: #c9922a;
    box-shadow: 0 0 0 2px rgba(201, 146, 42, 0.12);
}

#saffron-chat-send {
    border: 0;
    border-radius: 20px;
    background: #1a2744;
    color: #fff;
    cursor: pointer;
    padding: 0 17px;
    font-weight: 700;
}

#saffron-chat-send:disabled,
.saffron-lead-card button:disabled {
    cursor: not-allowed;
    opacity: 0.65;
}

.saffron-typing {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    width: 58px;
    min-height: 22px;
    padding: 9px 12px;
}

.saffron-typing span {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #8a93a4;
    animation: saffronTyping 1.2s infinite ease-in-out;
}

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

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

@keyframes saffronTyping {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.45;
    }
    30% {
        transform: translateY(-4px);
        opacity: 1;
    }
}

.saffron-lead-card {
    align-self: stretch;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 12px;
    background: #fff;
    border: 1px solid #e0d2b6;
    border-radius: 12px;
    box-shadow: 0 2px 7px rgba(0, 0, 0, 0.08);
}

.saffron-lead-card input {
    width: 100%;
    box-sizing: border-box;
    padding: 10px 11px;
    border: 1px solid #d4d4d4;
    border-radius: 8px;
    outline: none;
    font-size: 14px;
}

.saffron-lead-card input:focus {
    border-color: #c9922a;
    box-shadow: 0 0 0 2px rgba(201, 146, 42, 0.12);
}

.saffron-lead-card button {
    border: 0;
    border-radius: 8px;
    padding: 10px 12px;
    background: #1a2744;
    color: #fff;
    cursor: pointer;
    font-weight: 700;
}

.saffron-lead-card small {
    color: #6b7280;
    font-size: 11px;
    line-height: 1.45;
}

.saffron-lead-error {
    min-height: 16px;
    color: #b42318;
    font-size: 12px;
}

.saffron-product-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px;
    margin-bottom: 8px;
    border: 1px solid #e5e5e5;
    border-radius: 10px;
    background: #fff;
    white-space: normal;
}

.saffron-product-card:last-child {
    margin-bottom: 0;
}

.saffron-product-card > a {
    flex: 0 0 auto;
}

.saffron-product-image {
    display: block;
    width: 62px !important;
    height: 62px !important;
    min-width: 62px;
    max-width: 62px !important;
    margin: 0 !important;
    border-radius: 8px;
    object-fit: cover;
}

.saffron-product-info {
    flex: 1;
    min-width: 0;
}

.saffron-product-name {
    color: #1a2744;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.4;
}

.saffron-product-price {
    margin-top: 4px;
    color: #8d641c;
    font-size: 13px;
    font-weight: 700;
}

.saffron-product-link,
.saffron-source-link {
    color: #1a4c8b;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.saffron-product-link {
    display: inline-block;
    margin-top: 5px;
    font-size: 12px;
}

.saffron-source-link {
    overflow-wrap: anywhere;
}

@media (max-width: 480px) {
    #saffron-chat-btn {
        right: 12px;
        bottom: calc(12px + env(safe-area-inset-bottom));
        width: 54px;
        height: 54px;
    }

    #saffron-chat-window {
        left: 8px;
        right: 8px;
        top: auto;
        bottom: calc(74px + env(safe-area-inset-bottom));
        width: auto;
        height: 68vh;
        height: min(68dvh, 560px);
        max-height: calc(100vh - 118px);
        max-height: calc(100dvh - 118px - env(safe-area-inset-bottom));
        border-radius: 12px;
    }

    #saffron-chat-header {
        flex: 0 0 auto;
        min-height: 42px;
        padding: 8px 10px;
        gap: 8px;
    }

    #saffron-chat-title {
        font-size: 14px;
        line-height: 1.2;
    }

    .saffron-chat-header-actions {
        flex: 0 0 auto;
        gap: 7px;
    }

    #saffron-lang-select {
        max-width: 96px;
        padding: 4px 5px;
        font-size: 11px;
    }

    #saffron-chat-close {
        font-size: 24px;
    }

    #saffron-chat-messages {
        min-height: 0;
        padding: 9px;
        gap: 7px;
    }

    .chat-msg {
        max-width: 86%;
        padding: 8px 10px;
        border-radius: 12px;
        font-size: 13px;
        line-height: 1.45;
    }

    #saffron-chat-input-area {
        flex: 0 0 auto;
        gap: 7px;
        padding: 8px;
    }

    #saffron-chat-input {
        padding: 9px 11px;
        font-size: 13px;
    }

    #saffron-chat-send {
        padding: 0 13px;
        font-size: 13px;
    }

    .saffron-lead-card {
        padding: 10px;
    }

    .saffron-product-image {
        width: 54px !important;
        height: 54px !important;
        min-width: 54px;
        max-width: 54px !important;
    }
}


/* Persistent loader while a Telegram price request is waiting for an answer. */
.saffron-quote-waiting {
    flex: 0 0 auto;
    opacity: 0.92;
}

/* Secure chat checkout */
.saffron-order-button {
    appearance: none;
    border: 1px solid rgba(82, 38, 93, .22);
    border-radius: 8px;
    background: #fff;
    padding: 7px 10px;
    margin-top: 7px;
    font: inherit;
    font-size: 12px;
    font-weight: 700;
    line-height: 1.2;
    cursor: pointer;
    max-width: 100%;
}

.saffron-order-button:hover {
    transform: translateY(-1px);
}

.saffron-order-button-primary {
    background: #52265d;
    color: #fff;
    border-color: #52265d;
}

.saffron-order-button:disabled {
    cursor: wait;
    opacity: .65;
}

.saffron-order-offer,
.saffron-order-confirm-card {
    align-self: flex-start;
    max-width: min(88%, 330px);
    margin: 2px 10px 10px;
}

.saffron-order-confirm-card {
    background: #fff;
    border: 1px solid rgba(82, 38, 93, .18);
    border-radius: 12px;
    padding: 10px;
    box-shadow: 0 4px 18px rgba(0,0,0,.06);
}

.saffron-order-confirm-total {
    font-size: 13px;
    font-weight: 800;
    margin-bottom: 2px;
}

.saffron-product-info .saffron-order-button {
    display: block;
    width: fit-content;
}

@media (max-width: 480px) {
    .saffron-order-offer,
    .saffron-order-confirm-card {
        max-width: calc(100% - 20px);
        margin-left: 10px;
        margin-right: 10px;
    }

    .saffron-order-button {
        padding: 7px 9px;
        font-size: 11.5px;
    }
}

/* v2.4.0 — storefront launcher and welcome experience */
#saffron-chat-root {
    font-family: Arial, Helvetica, sans-serif;
}

#saffron-chat-btn {
    appearance: none;
    -webkit-appearance: none;
    border: 1px solid rgba(255, 255, 255, 0.16);
    padding: 0;
    overflow: visible;
    background: #1a2744;
    color: #fff;
    isolation: isolate;
}

#saffron-chat-btn:focus-visible,
#saffron-chat-welcome:focus-visible,
#saffron-chat-welcome-close:focus-visible,
#saffron-chat-close:focus-visible {
    outline: 3px solid rgba(201, 146, 42, 0.28);
    outline-offset: 3px;
}

.saffron-launcher-icon {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.2s ease, transform 0.22s ease;
}

.saffron-launcher-icon svg {
    width: 27px;
    height: 27px;
    display: block;
}

.saffron-launcher-chat-icon svg path {
    fill: currentColor;
}

.saffron-launcher-close-icon {
    opacity: 0;
    transform: rotate(-45deg) scale(0.72);
}

.saffron-launcher-close-icon svg path {
    fill: none;
    stroke: currentColor;
    stroke-width: 2.2;
    stroke-linecap: round;
}

#saffron-chat-btn.is-open .saffron-launcher-chat-icon {
    opacity: 0;
    transform: rotate(35deg) scale(0.72);
}

#saffron-chat-btn.is-open .saffron-launcher-close-icon {
    opacity: 1;
    transform: rotate(0deg) scale(1);
}

#saffron-chat-badge {
    position: absolute;
    top: -4px;
    right: -3px;
    min-width: 20px;
    height: 20px;
    padding: 0 5px;
    box-sizing: border-box;
    border: 2px solid #fff;
    border-radius: 999px;
    background: #c9922a;
    color: #fff;
    font-size: 10px;
    font-weight: 800;
    line-height: 16px;
    text-align: center;
    opacity: 0;
    transform: scale(0.65);
    pointer-events: none;
    transition: opacity 0.18s ease, transform 0.2s ease;
}

#saffron-chat-badge.is-visible {
    opacity: 1;
    transform: scale(1);
}

#saffron-chat-btn.saffron-attention {
    animation: saffronLauncherAttention 1.15s ease-out 1;
}

@keyframes saffronLauncherAttention {
    0%, 100% { transform: scale(1); }
    35% { transform: scale(1.07); }
    65% { transform: scale(0.985); }
}

#saffron-chat-welcome {
    position: fixed;
    right: 20px;
    bottom: 94px;
    z-index: 100000;
    width: min(290px, calc(100vw - 40px));
    box-sizing: border-box;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 38px 12px 12px;
    border: 1px solid rgba(26, 39, 68, 0.09);
    border-radius: 15px;
    background: rgba(255, 255, 255, 0.98);
    color: #1a2744;
    box-shadow: 0 14px 40px rgba(21, 31, 53, 0.18);
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px) scale(0.97);
    transform-origin: bottom right;
    transition: opacity 0.24s ease, transform 0.28s ease, visibility 0.24s ease;
    -webkit-font-smoothing: antialiased;
}

#saffron-chat-welcome.is-visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

#saffron-chat-welcome::after {
    content: '';
    position: absolute;
    right: 25px;
    bottom: -7px;
    width: 14px;
    height: 14px;
    background: #fff;
    border-right: 1px solid rgba(26, 39, 68, 0.09);
    border-bottom: 1px solid rgba(26, 39, 68, 0.09);
    transform: rotate(45deg);
}

.saffron-welcome-avatar {
    flex: 0 0 38px;
    width: 38px;
    height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    background: #1a2744;
    color: #d6a43b;
    font-size: 17px;
    font-weight: 800;
    box-shadow: inset 0 0 0 1px rgba(255,255,255,.08);
}

.saffron-welcome-copy {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.saffron-welcome-name {
    font-size: 11px;
    line-height: 1.25;
    font-weight: 800;
    color: #9a6b14;
    letter-spacing: 0.01em;
}

#saffron-chat-welcome-message {
    font-size: 14px;
    line-height: 1.38;
    font-weight: 600;
    color: #1a2744;
}

#saffron-chat-welcome-close {
    appearance: none;
    -webkit-appearance: none;
    position: absolute;
    top: 7px;
    right: 8px;
    width: 25px;
    height: 25px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: #7d8593;
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
}

#saffron-chat-welcome-close:hover {
    background: #f3f4f6;
    color: #1a2744;
}

#saffron-chat-window {
    border: 1px solid rgba(26, 39, 68, 0.08);
    border-radius: 17px;
    box-shadow: 0 18px 50px rgba(18, 28, 48, 0.23);
}

#saffron-chat-header {
    min-height: 56px;
    box-sizing: border-box;
    padding: 10px 12px 10px 14px;
}

.saffron-chat-brand {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

#saffron-chat-status {
    display: flex;
    align-items: center;
    gap: 5px;
    color: rgba(255, 255, 255, 0.78);
    font-size: 10.5px;
    line-height: 1.2;
    font-weight: 500;
    white-space: nowrap;
}

.saffron-online-dot {
    width: 6px;
    height: 6px;
    flex: 0 0 6px;
    border-radius: 50%;
    background: #66d28b;
    box-shadow: 0 0 0 2px rgba(102, 210, 139, 0.13);
}

#saffron-chat-close {
    appearance: none;
    -webkit-appearance: none;
    width: 30px;
    height: 30px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 0;
    border-radius: 9px;
    background: transparent;
}

#saffron-chat-close:hover {
    background: rgba(255, 255, 255, 0.09);
}

#saffron-chat-messages {
    background: linear-gradient(180deg, #f7f3ec 0%, #f3eee5 100%);
}

#saffron-chat-input-area {
    box-shadow: 0 -6px 20px rgba(26, 39, 68, 0.035);
}

@media (max-width: 480px) {
    #saffron-chat-welcome {
        right: 12px;
        bottom: calc(78px + env(safe-area-inset-bottom));
        width: min(270px, calc(100vw - 24px));
        padding: 10px 35px 10px 10px;
        border-radius: 14px;
    }

    .saffron-welcome-avatar {
        flex-basis: 34px;
        width: 34px;
        height: 34px;
        border-radius: 10px;
        font-size: 15px;
    }

    #saffron-chat-welcome-message {
        font-size: 13px;
    }

    #saffron-chat-header {
        min-height: 48px;
    }

    #saffron-chat-status {
        font-size: 9.5px;
    }
}

@media (prefers-reduced-motion: reduce) {
    #saffron-chat-btn,
    #saffron-chat-welcome,
    .saffron-launcher-icon,
    #saffron-chat-badge {
        animation: none !important;
        transition: none !important;
    }
}

/* Multi-product package suggestion cards */
.saffron-bundle-card {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
    white-space: normal;
}

.saffron-bundle-heading {
    color: #1a2744;
    font-size: 13px;
    font-weight: 800;
    line-height: 1.35;
}

.saffron-bundle-label {
    margin-top: -4px;
    color: #8d641c;
    font-size: 12px;
    font-weight: 700;
}

.saffron-bundle-product-card {
    margin-bottom: 0;
    background: #fff;
}

.saffron-product-quantity-total {
    margin-top: 3px;
    color: #1a2744;
    font-size: 12px;
    font-weight: 700;
    line-height: 1.35;
}

.saffron-bundle-footer {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding-top: 2px;
}

.saffron-bundle-total {
    color: #1a2744;
    font-size: 13px;
    font-weight: 800;
}

.saffron-bundle-order-button {
    margin-top: 0;
}

@media (max-width: 480px) {
    .saffron-bundle-footer {
        align-items: stretch;
        flex-direction: column;
    }

    .saffron-bundle-order-button {
        width: 100%;
    }
}
