#teriyar-root {
    --teriyar-color: #4f46e5;
    --teriyar-header-text: #ffffff;
    --teriyar-bot-bg: #f1f5f9;
    --teriyar-bot-text: #1e293b;
    --teriyar-radius: 18px;
    position: fixed; bottom: 24px; z-index: 999990;
    font-family: -apple-system, "Segoe UI", Tahoma, Vazirmatn, IRANSans, sans-serif;
    direction: rtl;
    color: #182230;
}
#teriyar-root[data-position="right"] { right: 24px; }
#teriyar-root[data-position="left"]  { left: 24px; }

#teriyar-root .teriyar-launcher {
    appearance: none;
    -webkit-appearance: none;
    width: 60px !important;
    height: 60px !important;
    min-width: 60px !important;
    min-height: 60px !important;
    max-width: 60px !important;
    max-height: 60px !important;
    padding: 0 !important;
    border: 0 !important;
    border-radius: 50% !important;
    box-sizing: border-box;
    overflow: hidden;
    background: var(--teriyar-color);
    color: #fff;
    cursor: pointer;
    box-shadow: 0 8px 24px rgba(0,0,0,.2);
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    transition: transform .2s ease;
    animation: teriyar-launcher-heartbeat 2.8s ease-in-out infinite;
}
#teriyar-root .teriyar-launcher.circle,
#teriyar-root .teriyar-launcher.rectangle { border-radius: 0 !important; }
#teriyar-root .teriyar-launcher.circle { border-radius: 50% !important; }
#teriyar-root .teriyar-launcher.rectangle {
    width: auto;
    max-width: none;
    min-width: 60px;
    padding: 0 18px;
    border-radius: 50%;
    overflow: visible;
    gap: 8px;
}
.teriyar-launcher.rectangle span { white-space: nowrap; font: inherit; font-size: 13px; font-weight: 600; }
.teriyar-launcher img { width: 28px; height: 28px; object-fit: contain; border-radius: 50%; }
.teriyar-launcher:hover { transform: scale(1.06); }
#teriyar-root .teriyar-launcher:hover,
#teriyar-root .teriyar-launcher:focus-visible {
    animation-play-state: paused;
}
.teriyar-launcher svg { width: 28px; height: 28px; }

@keyframes teriyar-launcher-heartbeat {
    0%, 52%, 100% {
        transform: scale(1);
        box-shadow: 0 8px 24px rgba(0,0,0,.2);
    }
    58% {
        transform: scale(1.08);
        box-shadow: 0 10px 28px rgba(0,0,0,.24), 0 0 0 7px rgba(79,70,229,.12);
    }
    64% {
        transform: scale(1);
        box-shadow: 0 8px 24px rgba(0,0,0,.2);
    }
    70% {
        transform: scale(1.05);
        box-shadow: 0 9px 26px rgba(0,0,0,.22), 0 0 0 4px rgba(79,70,229,.08);
    }
}

.teriyar-window {
    position: absolute; bottom: 76px; width: 380px; max-width: calc(100vw - 32px);
    height: 560px; max-height: calc(100vh - 120px);
    background: #fff; border: 1px solid rgba(255,255,255,.72); border-radius: 24px;
    box-shadow: 0 24px 70px rgba(15,23,42,.25), 0 4px 16px rgba(15,23,42,.08);
    display: flex; flex-direction: column; overflow: hidden;
    opacity: 0; transform: translateY(16px) scale(.98); pointer-events: none;
    transition: opacity .22s ease, transform .22s ease;
}
#teriyar-root[data-position="right"] .teriyar-window { right: 0; }
#teriyar-root[data-position="left"]  .teriyar-window { left: 0; }
.teriyar-window.open { opacity: 1; transform: translateY(0) scale(1); pointer-events: auto; }

.teriyar-header {
    background: linear-gradient(135deg, var(--teriyar-color), #2563eb);
    color: var(--teriyar-header-text); padding: 16px 20px; min-height: 80px;
    display: flex; align-items: center; gap: 12px; box-sizing: border-box;
}
.teriyar-header .avatar { display: none; }
.teriyar-header .avatar { width: 40px; height: 40px; border-radius: 50%; background: rgba(255,255,255,.2); align-items: center; justify-content: center; flex-shrink: 0; }
.teriyar-header .avatar svg { width: 22px; height: 22px; }
.teriyar-header .meta { flex: 1; min-width: 0; }
.teriyar-header .t-title { font-weight: 800; font-size: 16px; letter-spacing: -.2px; }
.teriyar-header .t-sub { font-size: 12px; opacity: .9; margin-top: 4px; display: flex; align-items: center; gap: 6px; }
.teriyar-header .dot { width: 7px; height: 7px; border-radius: 50%; background: #4ade80; }
.teriyar-online-operators { display: flex; align-items: center; gap: 7px; margin-top: 7px; min-height: 24px; font-size: 10px; opacity: .96; }
.teriyar-online-label { white-space: nowrap; }
.teriyar-online-label strong { font-size: 11px; }
.teriyar-online-avatars { display: inline-flex; direction: ltr; align-items: center; }
.teriyar-online-avatar, .teriyar-online-more { width: 24px; height: 24px; margin-right: -5px; border: 2px solid var(--teriyar-color); border-radius: 50%; background: rgba(255,255,255,.24); display: inline-flex; align-items: center; justify-content: center; overflow: hidden; box-sizing: border-box; }
.teriyar-online-avatar img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
.teriyar-online-avatar svg { width: 14px; height: 14px; color: #fff; }
.teriyar-online-more { color: #fff; font-size: 9px; font-weight: 800; background: rgba(15,23,42,.25); }
.teriyar-online-empty { opacity: .78; }
.teriyar-header .actions { display: flex; gap: 4px; }
.teriyar-header button { background: none; border: none; color: #fff; cursor: pointer; padding: 7px; opacity: .9; border-radius: 8px; }
.teriyar-header button:hover { opacity: 1; background: rgba(255,255,255,.15); }
.teriyar-header button svg { width: 18px; height: 18px; }

.teriyar-messages { flex: 1; overflow-y: auto; padding: 18px 20px; display: flex; flex-direction: column; gap: 12px; background: #fff; }
.teriyar-date-pill {
    align-self: center; padding: 6px 14px; border-radius: 999px; background: #f2f4f7;
    color: #64748b; font-size: 11px; line-height: 1; margin: 2px auto 4px;
}
.teriyar-msg-time { display: block; margin-top: 5px; font-size: 10px; line-height: 1; opacity: .62; direction: ltr; text-align: inherit; }
.teriyar-support { align-self: center; display: inline-flex; align-items: center; gap: 6px; margin: 8px auto 2px; padding: 6px 12px; border: 1px solid var(--teriyar-color); border-radius: 999px; background: transparent; color: var(--teriyar-color); cursor: pointer; font: inherit; font-size: 12px; }
.teriyar-support svg { width: 15px; height: 15px; }
.teriyar-support:disabled { opacity: .55; cursor: wait; }
.teriyar-reopen-button { border-color: #16a34a; color: #15803d; }
.teriyar-reopen-button:hover { background: #f0fdf4; }
.teriyar-phone-button { border-color: #0ea5e9; color: #0369a1; }
.teriyar-phone-button:hover { background: #f0f9ff; }
.teriyar-phone-list { display: flex; flex-direction: column; gap: 7px; width: min(100%, 300px); margin: 0 auto 4px; }
.teriyar-phone-link { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 9px 12px; border: 1px solid #bae6fd; border-radius: 12px; background: #f0f9ff; color: #075985; text-decoration: none; font-size: 12px; }
.teriyar-phone-link span { direction: ltr; font-weight: 700; }
.teriyar-msg { max-width: 88%; padding: 12px 15px; border-radius: 16px; font-size: var(--teriyar-font-size, 14px); line-height: 1.75; word-wrap: break-word; white-space: pre-wrap; }
.teriyar-header .avatar img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
#teriyar-root[data-layout="stacked"] .teriyar-msg { align-self: stretch; max-width: none; border-radius: var(--teriyar-radius); }
#teriyar-root[data-layout="stacked"] .teriyar-msg.user,
#teriyar-root[data-layout="stacked"] .teriyar-msg.bot,
#teriyar-root[data-layout="stacked"] .teriyar-msg.operator { border-right: 3px solid var(--teriyar-color); }
#teriyar-root[data-mode="sidebar"] .teriyar-window { position: fixed; top: 0; bottom: 0; width: min(420px, 100vw); height: 100vh; max-height: none; border-radius: 0; }
#teriyar-root[data-mode="sidebar"][data-position="right"] .teriyar-window { right: 0; }
#teriyar-root[data-mode="sidebar"][data-position="left"] .teriyar-window { left: 0; }
#teriyar-root[data-mode="fullscreen"] .teriyar-window { position: fixed; inset: 0; width: 100vw; height: 100vh; max-height: none; border-radius: 0; }
#teriyar-root[data-embedded="1"] { position: relative; inset: auto; width: 100%; height: min(680px, 80vh); }
#teriyar-root[data-embedded="1"] .teriyar-window { display: flex; opacity: 1; transform: none; position: relative; inset: auto; width: 100%; height: 100%; max-height: none; }
.teriyar-msg.bot { background: #f3f4f6; color: var(--teriyar-bot-text); align-self: flex-start; border-bottom-right-radius: 6px; }
.teriyar-msg.user { background: var(--teriyar-color); color: #fff; align-self: flex-end; border-bottom-left-radius: 6px; }
.teriyar-msg.system { align-self: center; background: #fff7ed; color: #9a3412; font-size: 12px; border: 1px solid #fed7aa; }
.teriyar-msg.operator { background: #ecfdf5; color: #065f46; align-self: flex-start; border: 1px solid #a7f3d0; border-bottom-right-radius: 6px; }
.teriyar-msg.operator audio { display: block; width: min(260px, 100%); height: 38px; }
.teriyar-sender-tag { font-size: 11px; font-weight: 700; color: #059669; margin-bottom: 4px; }
.teriyar-suggestions { display: flex; flex-wrap: wrap; gap: 6px; align-self: flex-start; max-width: 90%; }
.teriyar-chip { background: #fff; border: 1px solid var(--teriyar-color); color: var(--teriyar-color); border-radius: 16px; padding: 6px 14px; font-size: 13px; cursor: pointer; font-family: inherit; text-align: right; }
.teriyar-chip:hover { background: var(--teriyar-color); color: #fff; }
.teriyar-msg a { color: inherit; text-decoration: underline; }

.teriyar-typing { align-self: flex-start; background: var(--teriyar-bot-bg); padding: 12px 16px; border-radius: 18px; display: flex; gap: 4px; }
.teriyar-typing span { width: 7px; height: 7px; border-radius: 50%; background: #94a3b8; animation: teriyar-bounce 1.2s infinite; }
.teriyar-typing span:nth-child(2) { animation-delay: .15s; }
.teriyar-typing span:nth-child(3) { animation-delay: .3s; }
@keyframes teriyar-bounce { 0%,60%,100%{transform:translateY(0);opacity:.5} 30%{transform:translateY(-6px);opacity:1} }

.teriyar-input { border-top: 1px solid #eef0f3; padding: 14px 16px 16px; background: #fff; }
.teriyar-lead {
    position: absolute; inset: 94px 14px 14px; z-index: 20; display: flex; flex-direction: column;
    gap: 13px; padding: 22px; overflow: auto; box-sizing: border-box;
    background: #fff; border: 1px solid rgba(226,232,240,.95);
    border-radius: 22px; box-shadow: 0 18px 45px rgba(15,23,42,.16);
    pointer-events: auto !important; isolation: isolate;
}
.teriyar-lead h3 { margin: 0; font-size: 18px; color: #172033; letter-spacing: -.2px; }
.teriyar-lead p { margin: -3px 0 2px; color: #64748b; font-size: 13px; line-height: 1.7; }
.teriyar-lead label { display: flex; flex-direction: column; gap: 7px; color: #334155; font-size: 13px; font-weight: 600; pointer-events: auto; }
.teriyar-lead input[type="text"], .teriyar-lead input[type="email"], .teriyar-lead input[type="tel"] {
    border: 1px solid #cbd5e1; border-radius: 13px; padding: 12px 13px;
    background: #fff; color: #0f172a; font: inherit; outline: none;
    width: 100%; box-sizing: border-box; pointer-events: auto !important;
    -webkit-user-select: text; user-select: text;
    transition: border-color .18s, box-shadow .18s, background .18s;
}
.teriyar-lead input:focus { border-color: var(--teriyar-color); background: #fff; box-shadow: 0 0 0 3px rgba(37,99,235,.14); }
.teriyar-lead .teriyar-consent { flex-direction: row; align-items: flex-start; line-height: 1.7; font-weight: 400; gap: 10px; }
.teriyar-lead .teriyar-consent input { margin-top: 4px; accent-color: var(--teriyar-color); width: auto; flex: 0 0 auto; }
.teriyar-lead button { border: 0; border-radius: 13px; padding: 12px 16px; background: var(--teriyar-color); color: #fff; font: inherit; font-weight: 700; cursor: pointer; box-shadow: 0 8px 18px rgba(37,99,235,.22); pointer-events: auto; }
.teriyar-lead button:disabled { opacity: .65; cursor: wait; }
.teriyar-lead-error { min-height: 18px; color: #dc2626; font-size: 12px; }
.teriyar-products { display: grid; gap: 8px; width: 100%; }
.teriyar-product-card { display: flex; gap: 10px; align-items: center; padding: 8px; border: 1px solid #e2e8f0; border-radius: 12px; background: #fff; color: #1e293b; text-decoration: none; }
.teriyar-product-card img { width: 58px; height: 58px; border-radius: 8px; object-fit: cover; flex: 0 0 auto; }
.teriyar-product-info { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.teriyar-product-info strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.teriyar-product-price { color: var(--teriyar-color); }
.teriyar-product-info small.in-stock { color: #15803d; }
.teriyar-product-info small.out-stock { color: #b91c1c; }
.teriyar-order-form { display: flex; flex-direction: column; gap: 8px; width: 100%; padding: 12px; border: 1px solid #e2e8f0; border-radius: 12px; background: #fff; box-sizing: border-box; }
.teriyar-order-form input { border: 1px solid #cbd5e1; border-radius: 8px; padding: 8px 10px; font: inherit; }
.teriyar-order-form small { color: #64748b; line-height: 1.6; }
.teriyar-order-form button { border: 0; border-radius: 8px; padding: 9px; background: var(--teriyar-color); color: #fff; font: inherit; cursor: pointer; }
.teriyar-order-error { color: #dc2626; font-size: 12px; }
.teriyar-input-row { display: flex; gap: 9px; align-items: center; }
.teriyar-input-row input[type="text"] { flex: 1; min-width: 0; height: 44px; border: 1px solid #cbd5e1; border-radius: 14px; padding: 0 14px; font-size: 14px; font-family: inherit; outline: none; line-height: 44px; box-sizing: border-box; }
.teriyar-input-row input[type="text"]:focus { border-color: var(--teriyar-color); }
.teriyar-send { width: 52px; height: 52px; border-radius: 50%; background: var(--teriyar-color); color: #fff; border: none; cursor: pointer; flex-shrink: 0; display: flex; align-items: center; justify-content: center; box-shadow: 0 7px 16px rgba(37,99,235,.24); }
.teriyar-voice { width: 52px; height: 52px; border-radius: 50%; border: 1px solid #cbd5e1; color: var(--teriyar-color); background: #fff; cursor: pointer; flex: 0 0 auto; display: flex; align-items: center; justify-content: center; }
.teriyar-voice.listening { color: #dc2626; border-color: #fecaca; background: #fef2f2; animation: teriyar-pulse 1s infinite; }
@keyframes teriyar-pulse { 50% { transform: scale(1.08); } }
.teriyar-send:disabled { opacity: .5; cursor: not-allowed; }
.teriyar-send svg { width: 21px; height: 21px; }
.teriyar-voice svg { width: 21px; height: 21px; }
.teriyar-foot { text-align: center; font-size: 10px; color: #cbd5e1; margin-top: 8px; }

.teriyar-rating { padding: 18px; text-align: center; border-top: 1px solid #eef0f3; background: #fff; }
.teriyar-rating h4 { margin: 0 0 10px; font-size: 14px; color: var(--teriyar-text); }
.teriyar-stars { display: flex; justify-content: center; gap: 6px; }
.teriyar-star { font-size: 26px; cursor: pointer; color: #cbd5e1; background: none; border: none; transition: color .15s, transform .15s; }
.teriyar-star:hover, .teriyar-star.active { color: #fbbf24; transform: scale(1.15); }
.teriyar-thanks { color: #16a34a; font-weight: 600; font-size: 14px; }

@media (max-width: 480px) {
    .teriyar-msg { font-size: var(--teriyar-mobile-font-size, 14px); }
    #teriyar-root { bottom: 16px; }
    #teriyar-root[data-position="right"] { right: 16px; }
    #teriyar-root[data-position="left"]  { left: 16px; }
    .teriyar-window { width: calc(100vw - 24px); height: calc(100vh - 100px); }
}
@media (prefers-reduced-motion: reduce) {
    .teriyar-window, .teriyar-launcher, .teriyar-star { transition: none; }
    #teriyar-root .teriyar-launcher { animation: none; }
    .teriyar-typing span { animation: none; }
}

/* اندازه و جایگذاری نهایی چت‌باکس دسکتاپ، مطابق قاب سبز نمونه */
@media (min-width: 781px) {
    #teriyar-root { bottom: 24px; }
    #teriyar-root[data-position="right"] { right: 32px; }
    #teriyar-root[data-position="left"] { left: 32px; right: auto; }
    .teriyar-window {
        width: 500px;
        max-width: calc(100vw - 48px);
        height: min(724px, calc(100vh - 76px));
        max-height: none;
        bottom: 0;
        border-radius: 22px;
        box-shadow: 0 24px 70px rgba(15,23,42,.28), 0 5px 20px rgba(15,23,42,.09);
    }
    .teriyar-header { min-height: 80px; padding: 16px 22px; }
    .teriyar-header .t-title { font-size: 17px; }
    .teriyar-messages { padding: 20px 26px; }
    .teriyar-input { padding: 14px 18px 18px; }
    .teriyar-launcher { position: relative; z-index: 6; width: 60px; height: 60px; }
}

/* نوار پیام مینیمال و تک‌خطی */
.teriyar-window.open + .teriyar-launcher { display: none !important; }
.teriyar-input {
    padding: 10px 14px 12px;
    border-top: 1px solid #edf1f5;
}
.teriyar-input-row {
    display: flex;
    align-items: center;
    gap: 7px;
}
.teriyar-input-row input[type="text"] {
    height: 44px !important;
    min-height: 44px !important;
    max-height: 44px !important;
    padding: 0 14px;
    border: 1px solid #d9e2eb;
    border-radius: 14px;
    background: #fbfdff;
    line-height: 24px;
    white-space: nowrap;
    overflow: hidden;
    box-shadow: none;
}
.teriyar-input-row input[type="text"]:focus {
    border-color: var(--teriyar-color);
    background: #fff;
    box-shadow: 0 0 0 3px rgba(37,99,235,.1);
}
.teriyar-send,
.teriyar-voice {
    width: 44px;
    height: 44px;
    border-radius: 13px;
    flex: 0 0 44px;
}
.teriyar-send {
    box-shadow: 0 5px 12px rgba(37,99,235,.2);
}
.teriyar-voice {
    border-color: #d9e2eb;
    background: #fff;
}
.teriyar-send svg,
.teriyar-voice svg {
    width: 18px;
    height: 18px;
}
.teriyar-foot {
    margin-top: 6px;
    font-size: 9px;
}
.teriyar-support {
    margin-top: 8px;
    padding: 5px 10px;
    font-size: 11px;
}

/* پوسته مدرن ویجت — الگوی کارت گفت‌وگوی هوشمند */
#teriyar-root {
    --teriyar-color: #3157d8;
    --teriyar-color-deep: #2447c8;
    --teriyar-bot-bg: #f5f7fb;
    --teriyar-bot-text: #172033;
    --teriyar-radius: 22px;
}

#teriyar-root .teriyar-window {
    width: var(--teriyar-window-width, 510px);
    height: min(var(--teriyar-window-height, 700px), calc(100vh - 70px));
    max-width: calc(100vw - 28px);
    border: 1px solid #e8ecf4;
    border-radius: 24px;
    background: #fff;
    box-shadow: 0 28px 80px rgba(30, 51, 108, .22), 0 8px 22px rgba(22, 36, 70, .08);
}

#teriyar-root .teriyar-header {
    min-height: 94px;
    padding: 16px 18px;
    gap: 12px;
    background: linear-gradient(135deg, var(--teriyar-color-deep), var(--teriyar-color));
}

#teriyar-root .teriyar-header .avatar {
    display: flex !important;
    width: 48px;
    height: 48px;
    order: 0;
    background: #fff;
    color: var(--teriyar-color);
    border: 4px solid rgba(255,255,255,.34);
    box-shadow: 0 5px 14px rgba(12, 31, 103, .22);
}

#teriyar-root .teriyar-header .avatar svg {
    width: 28px;
    height: 28px;
}

#teriyar-root .teriyar-header .meta {
    text-align: right;
}

#teriyar-root .teriyar-header .t-title {
    font-size: 17px;
    letter-spacing: -.3px;
}

#teriyar-root .teriyar-header .t-sub {
    margin-top: 5px;
    color: rgba(255,255,255,.88);
}

#teriyar-root .teriyar-header .actions {
    margin-right: auto;
    gap: 2px;
}

#teriyar-root .teriyar-header button {
    width: 34px;
    height: 34px;
    padding: 7px;
    border-radius: 11px;
}

#teriyar-root .teriyar-messages {
    padding: 26px 24px 18px;
    gap: 14px;
    background: linear-gradient(180deg, #fff 0%, #fcfdff 100%);
}

#teriyar-root .teriyar-msg {
    max-width: 84%;
    padding: 14px 17px;
    border-radius: 21px;
    font-size: 14px;
    line-height: 1.9;
    box-shadow: 0 4px 14px rgba(31, 48, 87, .04);
}

#teriyar-root .teriyar-msg.bot {
    align-self: flex-start;
    background: #f4f6fa;
    border: 1px solid #edf0f5;
    border-bottom-right-radius: 7px;
}

#teriyar-root .teriyar-msg.user {
    align-self: flex-end;
    color: #fff;
    background: linear-gradient(135deg, var(--teriyar-color), #466be7);
    border-bottom-left-radius: 7px;
    box-shadow: 0 8px 18px rgba(49, 87, 216, .2);
}

#teriyar-root .teriyar-date-pill {
    padding: 7px 16px;
    color: #8490a6;
    background: #f2f5fa;
    font-size: 11px;
}

#teriyar-root .teriyar-suggestions {
    align-self: flex-end;
    justify-content: flex-start;
    max-width: 94%;
    gap: 9px;
}

#teriyar-root .teriyar-chip {
    padding: 10px 15px;
    color: #263c86;
    background: #fff;
    border: 1px solid #e3e8f3;
    border-radius: 14px;
    box-shadow: 0 4px 12px rgba(31, 48, 87, .06);
}

#teriyar-root .teriyar-chip:hover {
    color: #fff;
    background: var(--teriyar-color);
    border-color: var(--teriyar-color);
}

#teriyar-root .teriyar-input {
    padding: 13px 16px 12px;
    background: #fff;
    border-top: 1px solid #edf0f5;
}

#teriyar-root .teriyar-input-row {
    direction: ltr;
    gap: 6px;
    padding: 4px;
    border: 1px solid #e1e6f0;
    border-radius: 25px;
    background: #fff;
    box-shadow: 0 5px 17px rgba(31, 48, 87, .06);
}

#teriyar-root .teriyar-input-row input[type="text"] {
    direction: rtl;
    text-align: right;
    height: 42px !important;
    min-height: 42px !important;
    max-height: 42px !important;
    padding: 0 10px;
    border: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    line-height: 42px;
}

#teriyar-root .teriyar-send,
#teriyar-root .teriyar-voice {
    width: 40px;
    height: 40px;
    flex: 0 0 40px;
    border-radius: 50%;
}

#teriyar-root .teriyar-send {
    background: var(--teriyar-color);
    box-shadow: 0 5px 13px rgba(49, 87, 216, .24);
}

#teriyar-root .teriyar-voice {
    color: #8995aa;
    border: 0;
    background: transparent;
}

#teriyar-root .teriyar-voice:hover {
    color: var(--teriyar-color);
    background: #f1f4fb;
}

#teriyar-root .teriyar-support {
    align-self: stretch;
    justify-content: center;
    margin: 10px 0 0;
    padding: 10px 12px;
    color: var(--teriyar-color);
    border: 1px solid rgba(49, 87, 216, .18);
    border-radius: 14px;
    background: linear-gradient(135deg, rgba(255,255,255,.88), rgba(241,245,255,.72));
    box-shadow: 0 8px 22px rgba(49, 87, 216, .08);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    font-size: 13px;
}
#teriyar-root .teriyar-support:hover {
    border-color: rgba(49, 87, 216, .35);
    background: #f4f7ff;
}

#teriyar-root .teriyar-foot {
    margin-top: 4px;
    color: #aab3c3;
    font-size: 10px;
}

/* فرم اطلاعات مهمان: ایزوله از استایل‌های قالب، مخصوصاً روی دسکتاپ */
#teriyar-root .teriyar-lead {
    display: flex !important;
    width: auto !important;
    max-width: none !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
    direction: rtl !important;
    text-align: right !important;
}

#teriyar-root .teriyar-lead > label:not(.teriyar-consent) {
    display: flex !important;
    width: 100% !important;
    min-width: 0 !important;
    margin: 0 !important;
    float: none !important;
    clear: both !important;
    box-sizing: border-box !important;
}

#teriyar-root .teriyar-lead > label:not(.teriyar-consent) > input[type="text"],
#teriyar-root .teriyar-lead > label:not(.teriyar-consent) > input[type="email"],
#teriyar-root .teriyar-lead > label:not(.teriyar-consent) > input[type="tel"] {
    display: block !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: none !important;
    height: 46px !important;
    min-height: 46px !important;
    max-height: 46px !important;
    margin: 0 !important;
    padding: 0 14px !important;
    box-sizing: border-box !important;
    direction: rtl !important;
    text-align: right !important;
    line-height: 46px !important;
    writing-mode: horizontal-tb !important;
    appearance: none !important;
    -webkit-appearance: none !important;
    opacity: 1 !important;
    visibility: visible !important;
}

#teriyar-root .teriyar-lead > label:not(.teriyar-consent) > input[type="tel"] {
    direction: ltr !important;
    text-align: left !important;
}

#teriyar-root .teriyar-lead .teriyar-consent {
    display: flex !important;
    width: 100% !important;
    min-width: 0 !important;
    margin: 0 !important;
    box-sizing: border-box !important;
}

#teriyar-root .teriyar-lead button[type="submit"] {
    display: block !important;
    width: 100% !important;
    min-height: 46px !important;
    margin: 0 !important;
    box-sizing: border-box !important;
}

@media (min-width: 521px) {
    #teriyar-root .teriyar-lead {
        inset: 94px 14px 14px !important;
        padding: 24px !important;
        gap: 14px !important;
        overflow-x: hidden !important;
        overflow-y: auto !important;
    }
}

@media (max-width: 520px) {
    #teriyar-root .teriyar-window {
        width: calc(100vw - 20px);
        max-width: calc(100vw - 20px);
        height: calc(100vh - 54px);
        border-radius: 22px;
    }
    #teriyar-root .teriyar-messages {
        padding: 20px 15px 14px;
    }
    #teriyar-root .teriyar-msg {
        max-width: 90%;
    }
}

/* کارت محصول فروشگاهی */
#teriyar-root .teriyar-products {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    align-self: stretch;
    margin-top: 4px;
}

#teriyar-root .teriyar-product-card {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 9px;
    padding: 9px;
    overflow: hidden;
    color: #18233d;
    text-decoration: none;
    background: #fff;
    border: 1px solid #e5eaf3;
    border-radius: 18px;
    box-shadow: 0 7px 18px rgba(31, 48, 87, .07);
    transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease;
}

#teriyar-root .teriyar-product-card:hover {
    transform: translateY(-2px);
    border-color: #b9c8f4;
    box-shadow: 0 12px 24px rgba(49, 87, 216, .15);
}

#teriyar-root .teriyar-product-media {
    position: relative;
    display: block;
    aspect-ratio: 1.18;
    overflow: hidden;
    border-radius: 13px;
    background: #f3f6fb;
}

#teriyar-root .teriyar-product-media img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
    transition: transform .25s ease;
}

#teriyar-root .teriyar-product-card:hover .teriyar-product-media img {
    transform: scale(1.04);
}

#teriyar-root .teriyar-product-stock {
    position: absolute;
    top: 8px;
    right: 8px;
    padding: 4px 8px;
    border-radius: 999px;
    color: #fff;
    font-size: 10px;
    line-height: 1.2;
    background: rgba(22, 163, 74, .9);
    backdrop-filter: blur(5px);
}

#teriyar-root .teriyar-product-stock.out-stock {
    background: rgba(185, 28, 28, .88);
}

#teriyar-root .teriyar-product-info {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 5px;
    min-width: 0;
    padding: 0 3px;
}

#teriyar-root .teriyar-product-info strong {
    width: 100%;
    overflow: hidden;
    color: #24304b;
    font-size: 13px;
    line-height: 1.7;
    white-space: nowrap;
    text-overflow: ellipsis;
}

#teriyar-root .teriyar-product-price {
    color: var(--teriyar-color);
    font-size: 13px;
    font-weight: 800;
    line-height: 1.5;
}

#teriyar-root .teriyar-product-price del {
    margin-left: 4px;
    color: #98a2b3;
    font-size: 10px;
    font-weight: 400;
}

#teriyar-root .teriyar-product-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-top: auto;
    padding: 8px 9px;
    color: var(--teriyar-color);
    background: #f1f4ff;
    border-radius: 11px;
    font-size: 11px;
    font-weight: 700;
}

#teriyar-root .teriyar-product-arrow {
    font-size: 16px;
    line-height: 1;
    transition: transform .18s ease;
}

#teriyar-root .teriyar-product-card:hover .teriyar-product-arrow {
    transform: translateX(-3px);
}

@media (max-width: 390px) {
    #teriyar-root .teriyar-products {
        grid-template-columns: 1fr;
    }
}
