.bst-widget {
    --bstw-primary: #0b5961;
    --bstw-primary-strong: #063c43;
    --bstw-accent: #d8a448;
    --bstw-surface: #ffffff;
    --bstw-surface-soft: #f2f7f7;
    --bstw-text: #12383d;
    --bstw-muted: #65777a;
    --bstw-line: #dbe6e7;
    position: fixed;
    z-index: 75;
    right: 10px;
    left: auto;
    bottom: calc(86px + env(safe-area-inset-bottom, 0px));
    direction: rtl;
    font-family: "Yekan Bakh", "IRANYekan", Tahoma, Arial, sans-serif;
    line-height: 1.65;
}

.bst-widget,
.bst-widget *,
.bst-widget *::before,
.bst-widget *::after {
    box-sizing: border-box;
}

.bst-widget [hidden] {
    display: none !important;
}

.bst-widget button,
.bst-widget input,
.bst-widget textarea {
    font: inherit;
}

.bst-widget button {
    cursor: pointer;
}

.bst-widget svg {
    display: block;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.bst-widget__launcher {
    position: relative;
    isolation: isolate;
    min-width: 58px;
    height: 58px;
    padding: 7px;
    display: flex;
    align-items: center;
    gap: 8px;
    border: 1px solid rgba(255, 255, 255, .15);
    border-radius: 999px;
    color: #fff;
    background: linear-gradient(135deg, var(--bstw-primary-strong), var(--bstw-primary));
    box-shadow: 0 14px 32px rgba(3, 42, 47, .3), inset 0 1px rgba(255, 255, 255, .12);
    transition: transform .2s ease, background .2s ease, box-shadow .2s ease;
    animation: bstw-launcher-nudge 6s ease-in-out infinite;
}

.bst-widget__launcher::before {
    position: absolute;
    inset: -5px;
    z-index: -1;
    border: 2px solid rgba(216, 164, 72, .58);
    border-radius: inherit;
    content: "";
    opacity: 0;
    animation: bstw-launcher-ring 3s ease-out infinite;
}

.bst-widget__launcher::after {
    position: absolute;
    top: 0;
    right: 17px;
    left: 17px;
    height: 2px;
    border-radius: 0 0 4px 4px;
    background: #efc777;
    content: "";
}

@keyframes bstw-launcher-nudge {
    0%, 76%, 100% { transform: translateX(0) translateY(0); }
    80% { transform: translateX(-5px) translateY(-2px); }
    84% { transform: translateX(2px) translateY(0); }
    88% { transform: translateX(-2px) translateY(-1px); }
    92% { transform: translateX(0) translateY(0); }
}

@keyframes bstw-launcher-ring {
    0%, 68%, 100% { opacity: 0; transform: scale(.94); }
    76% { opacity: .75; }
    92% { opacity: 0; transform: scale(1.12); }
}

.bst-widget__launcher:hover {
    animation: none;
    transform: none;
    background: var(--bstw-primary-strong);
    box-shadow: 0 18px 38px rgba(3, 42, 47, .32);
}

.bst-widget__launcher:hover::before {
    animation: none;
    opacity: 0;
}

.bst-widget__launcher:focus-visible,
.bst-widget button:focus-visible,
.bst-widget input:focus-visible,
.bst-widget textarea:focus-visible {
    outline: 3px solid rgba(216, 164, 72, .42);
    outline-offset: 2px;
}

.bst-widget__launcher-icon {
    width: 44px;
    height: 44px;
    flex: 0 0 44px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    color: #fff;
    background: rgba(255, 255, 255, .12);
}

.bst-widget__launcher-icon svg {
    width: 25px;
    height: 25px;
}

.bst-widget__launcher-copy {
    display: none;
    min-width: 0;
    text-align: right;
}

.bst-widget__launcher-copy b,
.bst-widget__launcher-copy small {
    display: block;
    white-space: nowrap;
}

.bst-widget__launcher-copy b {
    font-family: "Peyda", "Yekan Bakh", Tahoma, sans-serif;
    font-size: 13px;
    font-weight: 900;
}

.bst-widget__launcher-copy small {
    color: rgba(255, 255, 255, .7);
    font-size: 8px;
}

.bst-widget__launcher > i {
    position: absolute;
    top: 2px;
    right: 3px;
    width: 11px;
    height: 11px;
    border: 2px solid #fff;
    border-radius: 50%;
    background: #27bb76;
    box-shadow: 0 0 0 4px rgba(39, 187, 118, .16);
}

.bst-widget.is-open .bst-widget__launcher {
    animation: none;
    visibility: hidden;
    pointer-events: none;
}

.bst-widget__panel {
    width: min(calc(100vw - 20px), 390px);
    height: min(690px, calc(100dvh - 112px - env(safe-area-inset-bottom, 0px)));
    min-height: 460px;
    overflow: hidden;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
    border: 1px solid var(--bstw-line);
    border-radius: 24px;
    color: var(--bstw-text);
    background: var(--bstw-surface);
    box-shadow: 0 28px 72px rgba(4, 35, 39, .3), 0 3px 12px rgba(4, 35, 39, .1);
    transform-origin: bottom right;
    animation: bstw-panel-in .22s ease both;
}

@keyframes bstw-panel-in {
    from { opacity: 0; transform: translateY(12px) scale(.97); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.bst-widget__header {
    position: relative;
    min-height: 77px;
    padding: 14px 14px 13px;
    display: grid;
    grid-template-columns: 46px minmax(0, 1fr) 36px;
    align-items: center;
    gap: 10px;
    color: #fff;
    background: linear-gradient(135deg, #083e45, #0b626a);
    overflow: hidden;
}

.bst-widget__header::after {
    position: absolute;
    left: 44px;
    bottom: -30px;
    color: rgba(255, 255, 255, .07);
    content: "››";
    font-family: Arial, sans-serif;
    font-size: 92px;
    font-weight: 900;
    letter-spacing: -24px;
    line-height: 1;
    transform: rotate(180deg);
    pointer-events: none;
}

.bst-widget__header > * {
    position: relative;
    z-index: 1;
}

.bst-widget__agent {
    width: 46px;
    height: 46px;
    display: grid;
    place-items: center;
    border: 1px solid rgba(255, 255, 255, .14);
    border-radius: 15px;
    color: #f1c676;
    background: rgba(255, 255, 255, .08);
}

.bst-widget__agent svg {
    width: 25px;
    height: 25px;
}

.bst-widget__header strong,
.bst-widget__header small {
    display: block;
}

.bst-widget__header strong {
    font-family: "Peyda", "Yekan Bakh", Tahoma, sans-serif;
    font-size: 14px;
    font-weight: 900;
}

.bst-widget__header small {
    margin-top: 2px;
    color: rgba(255, 255, 255, .7);
    font-size: 8px;
}

.bst-widget__header small i {
    width: 6px;
    height: 6px;
    margin-left: 3px;
    display: inline-block;
    border-radius: 50%;
    background: #39d88e;
}

.bst-widget__header button {
    width: 36px;
    height: 36px;
    padding: 0;
    display: grid;
    place-items: center;
    border: 0;
    border-radius: 11px;
    color: rgba(255, 255, 255, .78);
    background: rgba(255, 255, 255, .08);
}

.bst-widget__header button:hover {
    color: #fff;
    background: rgba(255, 255, 255, .14);
}

.bst-widget__header button svg {
    width: 20px;
    height: 20px;
}

.bst-widget__body {
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    background: var(--bstw-surface-soft);
}

.bst-widget__intro {
    margin: 14px 14px 0;
    padding: 12px 13px;
    border: 1px solid var(--bstw-line);
    border-right: 3px solid var(--bstw-accent);
    border-radius: 6px 16px 16px 16px;
    background: var(--bstw-surface);
}

.bst-widget__intro span {
    color: var(--bstw-primary);
    font-family: "Peyda", "Yekan Bakh", Tahoma, sans-serif;
    font-size: 13px;
    font-weight: 900;
}

.bst-widget__intro p {
    margin: 3px 0 0;
    color: var(--bstw-muted);
    font-size: 10px;
    line-height: 1.9;
}

.bst-widget__guest,
.bst-widget__otp {
    padding: 14px;
}

.bst-widget__step {
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--bstw-muted);
    font-size: 10px;
}

.bst-widget__step > b {
    width: 25px;
    height: 25px;
    flex: 0 0 25px;
    display: grid;
    place-items: center;
    border-radius: 8px;
    color: #fff;
    background: var(--bstw-primary);
    font-size: 10px;
}

.bst-widget__step strong {
    color: var(--bstw-text);
}

.bst-widget__guest form,
.bst-widget__otp form {
    padding: 13px;
    display: grid;
    gap: 11px;
    border: 1px solid var(--bstw-line);
    border-radius: 18px;
    background: var(--bstw-surface);
    box-shadow: 0 8px 22px rgba(9, 63, 69, .055);
}

.bst-widget__name-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.bst-widget label {
    min-width: 0;
    display: grid;
    gap: 5px;
    color: var(--bstw-text);
    font-size: 9px;
    font-weight: 800;
}

.bst-widget label > span b {
    color: #b54658;
    font-size: 8px;
}

.bst-widget input,
.bst-widget textarea {
    width: 100%;
    border: 1px solid var(--bstw-line);
    color: var(--bstw-text);
    background: var(--bstw-surface);
    transition: border-color .18s ease, box-shadow .18s ease;
}

.bst-widget input {
    height: 46px;
    padding: 0 13px;
    border-radius: 12px;
    font-size: 11px;
}

.bst-widget input:focus,
.bst-widget textarea:focus {
    border-color: #4c9299;
    outline: 0;
    box-shadow: 0 0 0 3px rgba(11, 89, 97, .1);
}

.bst-widget__privacy {
    margin: 0;
    display: flex;
    align-items: flex-start;
    gap: 6px;
    color: var(--bstw-muted);
    font-size: 8px;
    line-height: 1.8;
}

.bst-widget__privacy svg {
    width: 14px;
    height: 14px;
    margin-top: 1px;
    flex: 0 0 14px;
    color: var(--bstw-primary);
}

.bst-widget__primary {
    min-height: 44px;
    padding: 0 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: 0;
    border-radius: 13px;
    color: #fff;
    background: var(--bstw-primary);
    font-size: 10px;
    font-weight: 900;
    transition: background .18s ease, transform .18s ease;
}

.bst-widget__primary:hover {
    background: var(--bstw-primary-strong);
    transform: translateY(-1px);
}

.bst-widget__primary:disabled,
.bst-widget__composer button:disabled {
    cursor: wait;
    opacity: .65;
}

.bst-widget__primary svg {
    width: 17px;
    height: 17px;
}

.bst-widget__button-spinner,
.bst-widget__loading i {
    width: 16px;
    height: 16px;
    border: 2px solid currentColor;
    border-left-color: transparent;
    border-radius: 50%;
    animation: bstw-spin .75s linear infinite;
}

@keyframes bstw-spin { to { transform: rotate(360deg); } }

.bst-widget__notice {
    margin: 0;
    padding: 8px 10px;
    border-radius: 10px;
    color: #176748;
    background: #e3f5ec;
    font-size: 9px;
    line-height: 1.8;
}

.bst-widget__notice.is-error {
    color: #963e4b;
    background: #fce8eb;
}

.bst-widget__back,
.bst-widget__resend {
    border: 0;
    color: var(--bstw-primary);
    background: transparent;
    font-size: 9px;
    font-weight: 800;
}

.bst-widget__back {
    margin: -2px 0 10px;
    padding: 0;
}

.bst-widget__resend {
    min-height: 32px;
}

.bst-widget__resend:disabled {
    cursor: default;
    color: var(--bstw-muted);
}

.bst-widget__chat {
    min-height: 0;
    padding: 12px 12px 16px;
}

.bst-widget__thread-meta {
    width: max-content;
    max-width: 100%;
    margin: 0 auto 12px;
    padding: 5px 10px;
    border-radius: 99px;
    color: var(--bstw-muted);
    background: #e4eded;
    font-size: 8px;
    font-weight: 800;
}

.bst-widget__messages {
    display: grid;
    align-content: start;
    gap: 11px;
}

.bst-widget__message {
    max-width: 92%;
    display: flex;
    align-items: flex-end;
    gap: 7px;
}

.bst-widget__message.is-user {
    margin-right: auto;
    flex-direction: row-reverse;
}

.bst-widget__message-avatar {
    width: 28px;
    height: 28px;
    flex: 0 0 28px;
    display: grid;
    place-items: center;
    border: 1px solid var(--bstw-line);
    border-radius: 9px;
    color: var(--bstw-primary);
    background: var(--bstw-surface);
}

.bst-widget__message-avatar svg {
    width: 16px;
    height: 16px;
}

.bst-widget__message.is-user .bst-widget__message-avatar {
    color: #fff;
    background: var(--bstw-primary);
    border-color: var(--bstw-primary);
}

.bst-widget__message-bubble {
    min-width: 0;
    padding: 9px 11px;
    border: 1px solid var(--bstw-line);
    border-radius: 5px 14px 14px 14px;
    background: var(--bstw-surface);
}

.bst-widget__message.is-user .bst-widget__message-bubble {
    border-color: var(--bstw-primary);
    border-radius: 14px 5px 14px 14px;
    color: #fff;
    background: var(--bstw-primary);
}

.bst-widget__message-bubble header {
    margin-bottom: 3px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    font-size: 8px;
}

.bst-widget__message-bubble header strong {
    font-size: 8px;
    font-weight: 900;
}

.bst-widget__message-bubble header time {
    color: var(--bstw-muted);
    white-space: nowrap;
}

.bst-widget__message.is-user header time {
    color: rgba(255, 255, 255, .65);
}

.bst-widget__message-bubble p {
    margin: 0;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    font-size: 10px;
    line-height: 1.9;
}

.bst-widget__loading,
.bst-widget__load-error {
    min-height: 120px;
    display: grid;
    place-items: center;
    align-content: center;
    gap: 8px;
    color: var(--bstw-muted);
    font-size: 9px;
    text-align: center;
}

.bst-widget__loading i {
    color: var(--bstw-primary);
}

.bst-widget__composer {
    padding: 9px 10px calc(8px + env(safe-area-inset-bottom, 0px));
    border-top: 1px solid var(--bstw-line);
    background: var(--bstw-surface);
}

.bst-widget__composer form {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 43px;
    align-items: end;
    gap: 7px;
}

.bst-widget__composer textarea {
    min-height: 43px;
    max-height: 104px;
    padding: 10px 12px;
    resize: none;
    border-radius: 13px;
    font-size: 10px;
    line-height: 1.8;
}

.bst-widget__composer form > button {
    width: 43px;
    height: 43px;
    padding: 0;
    display: grid;
    place-items: center;
    border: 0;
    border-radius: 13px;
    color: #fff;
    background: var(--bstw-primary);
}

.bst-widget__composer form > button:hover {
    background: var(--bstw-primary-strong);
}

.bst-widget__composer form > button svg {
    width: 19px;
    height: 19px;
}

.bst-widget__composer > a {
    margin-top: 6px;
    display: block;
    color: var(--bstw-muted);
    font-size: 8px;
    font-weight: 700;
    text-align: center;
    text-decoration: none;
}

.bst-widget__composer > a:hover {
    color: var(--bstw-primary);
}

.bst-widget__composer > .bst-widget__notice {
    margin-top: 6px;
}

:is(html.dark, :root[data-theme="dark"]) .bst-widget {
    --bstw-primary: #16818a;
    --bstw-primary-strong: #1b939d;
    --bstw-surface: #082d32;
    --bstw-surface-soft: #061f23;
    --bstw-text: #edf7f7;
    --bstw-muted: #a0b4b6;
    --bstw-line: rgba(210, 238, 239, .14);
}

:is(html.dark, :root[data-theme="dark"]) .bst-widget__panel {
    box-shadow: 0 24px 70px rgba(0, 0, 0, .48);
}

:is(html.dark, :root[data-theme="dark"]) .bst-widget__thread-meta {
    background: #113a40;
}

:is(html.dark, :root[data-theme="dark"]) .bst-widget__notice {
    color: #9fe5c7;
    background: #123f33;
}

:is(html.dark, :root[data-theme="dark"]) .bst-widget__notice.is-error {
    color: #ffc1cb;
    background: #55242c;
}

@media (min-width: 420px) {
    .bst-widget {
        right: 14px;
        left: auto;
    }

    .bst-widget__launcher {
        padding-left: 13px;
    }

    .bst-widget__launcher-copy {
        display: block;
    }
}

@media (min-width: 768px) {
    .bst-widget {
        right: 24px;
        left: auto;
        bottom: 24px;
    }

    .bst-widget__panel {
        width: 400px;
        height: min(690px, calc(100dvh - 48px));
    }

    .bst-widget__launcher {
        min-width: 166px;
        height: 62px;
        border-radius: 999px;
    }

    .bst-widget__launcher-icon {
        width: 46px;
        height: 46px;
        flex-basis: 46px;
    }

    .bst-widget__launcher-copy b {
        font-size: 14px;
    }

    .bst-widget__launcher-copy small {
        font-size: 9px;
    }

    .bst-widget__header {
        min-height: 82px;
        padding: 15px 16px;
    }

    .bst-widget__header strong {
        font-size: 15px;
    }

    .bst-widget__header small,
    .bst-widget__intro p,
    .bst-widget__step,
    .bst-widget__message-bubble p,
    .bst-widget__composer textarea {
        font-size: 11px;
    }
}

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

@media print {
    .bst-widget { display: none !important; }
}
