#kj-float-btn {
    position: fixed;
    left: 16px;
    bottom: 16px;
    z-index: 99998;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    border: none;
    border-radius: 50px;
    background: #0073aa;
    color: #fff;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.2);
}

.kj-float-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;
    height: 24px;
    padding: 0 6px;
    border-radius: 999px;
    background: #fff;
    color: #0073aa;
    font-size: 13px;
    font-weight: 800;
}

.kj-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 99999;
    background: rgba(0, 0, 0, 0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.kj-modal {
    position: relative;
    direction: rtl;
    text-align: right;
    background: #fff;
    color: #1f2532;
    width: 100%;
    max-width: 430px;
    max-height: 88vh;
    overflow: auto;
    border-radius: 16px;
    padding: 20px;
    box-sizing: border-box;
}

.kj-modal-large {
    max-width: 820px;
}

.kj-modal h3 {
    margin: 0 0 12px;
    font-size: 18px;
}

.kj-modal-close {
    position: absolute;
    top: 10px;
    left: 10px;
    width: 34px;
    height: 34px;
    border: none;
    border-radius: 50%;
    background: #f2f2f2;
    color: #333;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
}

.kj-label {
    display: block;
    margin: 12px 0 6px;
    font-weight: 700;
}

.kj-input {
    width: 100%;
    padding: 11px 12px;
    border: 1px solid #d5d9e0;
    border-radius: 10px;
    box-sizing: border-box;
    font-family: inherit;
}

.kj-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 11px 16px;
    border: 1px solid #d5d9e0;
    border-radius: 10px;
    background: #fff;
    color: #1f2532;
    font-weight: 700;
    cursor: pointer;
    text-decoration: none;
}

.kj-btn-primary {
    background: #0073aa;
    border-color: #0073aa;
    color: #fff;
}

.kj-btn-block {
    width: 100%;
}

.kj-divider {
    margin: 18px 0;
    text-align: center;
    color: #777;
    position: relative;
}

.kj-divider:before,
.kj-divider:after {
    content: "";
    position: absolute;
    top: 50%;
    width: 38%;
    height: 1px;
    background: #e5e7eb;
}

.kj-divider:before {
    right: 0;
}

.kj-divider:after {
    left: 0;
}

.kj-modal-message {
    margin-top: 12px;
    color: #b32d2e;
    font-size: 14px;
}

.kj-qty-price {
    margin: 6px 0 14px;
    color: #919191;
    font-weight: 600;
}

.kj-invoice-head {
    margin-bottom: 14px;
}

.kj-invoice-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    color: #444;
    font-size: 14px;
}

.kj-cart-table-wrap {
    overflow: auto;
    border: 1px solid #eee;
    border-radius: 12px;
}

.kj-cart-table {
    width: 100%;
    border-collapse: collapse;
}

.kj-cart-table th,
.kj-cart-table td {
    padding: 10px;
    border-bottom: 1px solid #eee;
    text-align: right;
    vertical-align: middle;
}

.kj-cart-table th {
    background: #fafafa;
}

.kj-cart-table tr:last-child td {
    border-bottom: none;
}

.kj-cart-qty {
    width: 72px;
    padding: 8px;
    text-align: center;
    border: 1px solid #d5d9e0;
    border-radius: 8px;
}

.kj-cart-remove {
    padding: 7px 10px;
    border: none;
    border-radius: 8px;
    background: #b32d2e;
    color: #fff;
    cursor: pointer;
}

.kj-cart-footer {
    margin-top: 16px;
}

.kj-cart-total {
    font-size: 17px;
    margin-bottom: 14px;
}

.kj-cart-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.kj-link-btn {
    border: none;
    background: none;
    color: #b32d2e;
    cursor: pointer;
    text-decoration: underline;
    padding: 0;
}

.kj-cart-note {
    margin-top: 12px;
    color: #666;
    font-size: 13px;
}

.kj-empty-items {
    padding: 14px;
    border: 1px dashed #d5d9e0;
    border-radius: 12px;
    text-align: center;
    color: #555;
}

#kj-toast {
    position: fixed;
    left: 50%;
    bottom: 84px;
    transform: translateX(-50%);
    z-index: 100000;
    background: #1f2532;
    color: #fff;
    padding: 10px 16px;
    border-radius: 10px;
    font-size: 14px;
    opacity: 0;
    visibility: hidden;
    transition: all 0.25s ease;
    max-width: 90%;
    text-align: center;
}

#kj-toast.show {
    opacity: 1;
    visibility: visible;
}

@media (max-width: 640px) {
    #kj-float-btn {
        left: 12px;
        right: 12px;
        bottom: 12px;
        justify-content: center;
    }

    .kj-modal {
        max-height: 92vh;
    }

    .kj-cart-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .kj-link-btn {
        text-align: center;
    }
}
.kj-stock {
    font-weight: 700;
    color: #333;
}

.kj-variations {
    margin: 10px 0;
    max-height: 180px;
    overflow: auto;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 10px;
    background: #fafafa;
}

.kj-variation-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 8px 4px;
    border-bottom: 1px solid #eee;
}

.kj-variation-item:last-child {
    border-bottom: none;
}

.kj-variation-item label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    margin: 0;
}

.kj-variation-item.disabled {
    opacity: 0.5;
}

.kj-variation-price {
    font-weight: 700;
    white-space: nowrap;
}

.kj-variation-stock {
    font-size: 12px;
    color: #777;
}
.kj-invoice-warning {
    color: #d63638;
    font-weight: 700;
    margin: 12px 0;
    line-height: 1.9;
}
.kj-bot-start-box {
    border: 1px dashed #2271b1;
    background: #f0f6fc;
    border-radius: 10px;
    padding: 12px;
    margin: 12px 0;
    line-height: 1.9;
}

.kj-bot-start-box .kj-btn {
    margin-left: 8px;
}
.kj-cart-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    min-height: 44px;
}
.kj-product-modal-content {
    max-height: 70vh;
    overflow: auto;
}

.kj-pd-head h3 {
    margin: 0 0 10px;
}

.kj-pd-short {
    margin-bottom: 12px;
    line-height: 1.9;
}

.kj-pd-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 8px;
    margin-bottom: 14px;
}

.kj-pd-gallery img {
    width: 100%;
    height: 120px;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid #eee;
}

.kj-pd-desc {
    line-height: 2;
}

.kj-pd-loading {
    padding: 24px;
    text-align: center;
    color: #777;
}
.kj-product-modal-content img.kj-pd-main-img,
img.kj-pd-main-img {
    display: block;
    width: auto !important;
    max-width: 100% !important;
    height: auto !important;
    max-height: 360px !important;
    object-fit: contain;
    margin: 0 auto 14px;
    border-radius: 10px;
    border: 1px solid #eee;
    background: #fff;
}
.kj-pd-attrs h4 {
    margin: 14px 0 8px;
}

.kj-pd-attrs table {
    width: 100%;
    border-collapse: collapse;
}

.kj-pd-attrs th,
.kj-pd-attrs td {
    border: 1px solid #e5e7eb;
    padding: 8px 10px;
    text-align: right;
    font-size: 13px;
}

.kj-pd-attrs th {
    background: #fafafa;
    width: 35%;
}
.kj-status-ready { background: #e5f0ff; color: #0a5cad; }
/* --- مودال محصول توسعه‌یافته (Mobile-First) --- */

.kj-modal-large {
    position: relative;
    max-height: 88vh;
    overflow-y: auto;
}

.kj-modal-large .kj-product-modal-content {
    max-height: none;
    overflow: visible;
}

/* ضربدر چسبیده بالا-چپ */
.kj-modal-large .kj-modal-close {
    position: sticky;
    top: 8px;
    left: auto;
    right: auto;
    display: block;
    width: 38px;
    height: 38px;
    line-height: 36px;
    margin-right: auto;
    margin-left: 8px;
    margin-bottom: 8px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
    font-size: 20px;
    text-align: center;
    z-index: 20;
    cursor: pointer;
    border: none;
}

/* بخش خرید */
.kj-pd-purchase-bar {
    background: #f9f9f9;
    padding: 15px;
    border-radius: 12px;
    margin: 15px 0;
    border: 1px solid #eee;
}

.kj-pd-price-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    font-size: 15px;
    font-weight: bold;
    gap: 10px;
}

.kj-pd-price-value {
    color: #d63638;
    font-size: 17px;
}

.kj-pd-variations {
    margin-bottom: 15px;
}

.kj-pd-attr-select {
    margin-bottom: 10px;
}

.kj-pd-attr-select label {
    display: block;
    margin-bottom: 5px;
    font-size: 13px;
    color: #555;
}

.kj-pd-attr-select select {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    background: #fff;
}

.kj-pd-qty-row {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.kj-pd-stock-info {
    font-size: 13px;
    color: #1e7e34;
    text-align: center;
    min-height: 18px;
}

.kj-pd-qty-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 5px;
}

.kj-qty-btn {
    width: 44px;
    height: 44px;
    border: none;
    background: #f0f0f0;
    border-radius: 8px;
    font-size: 22px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.kj-pd-qty-input {
    width: 70px;
    text-align: center;
    border: none;
    font-size: 18px;
    font-weight: bold;
    -moz-appearance: textfield;
}

.kj-pd-qty-input::-webkit-outer-spin-button,
.kj-pd-qty-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.kj-btn-add-modal {
    width: 100%;
    padding: 15px;
    font-size: 16px;
    font-weight: bold;
    background: #2271b1;
    color: #fff;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    margin-top: 10px;
}

.kj-btn-add-modal:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.kj-btn-add-modal.kj-added-flash {
    background: #1e7e34 !important;
    color: #fff !important;
}

/* نوار مشابه‌ها (اسکرول افقی) */
.kj-pd-similar-section {
    margin-top: 20px;
    border-top: 1px solid #eee;
    padding-top: 15px;
}

.kj-pd-similar-section h4 {
    margin: 0 0 10px 0;
    font-size: 14px;
    color: #555;
}

.kj-pd-similar-scroll {
    display: flex;
    overflow-x: auto;
    gap: 10px;
    padding-bottom: 10px;
    -webkit-overflow-scrolling: touch;
}

.kj-pd-similar-scroll::-webkit-scrollbar {
    height: 4px;
}

.kj-pd-similar-scroll::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 4px;
}

.kj-similar-card {
    min-width: 110px;
    max-width: 110px;
    border: 1px solid #eee;
    border-radius: 8px;
    padding: 8px;
    background: #fff;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    flex-shrink: 0;
}

.kj-scanned-card {
    border: 2px solid #2271b1;
    background: #f0f6fc;
}

.kj-sim-img-wrap {
    width: 80px;
    height: 80px;
    margin-bottom: 5px;
}

.kj-sim-img-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 6px;
}

.kj-sim-title {
    font-size: 12px;
    line-height: 1.3;
    height: 32px;
    overflow: hidden;
    margin-bottom: 5px;
    color: #333;
}

.kj-sim-price {
    font-size: 12px;
    font-weight: bold;
    color: #d63638;
    margin-bottom: 8px;
}

.kj-sim-view-btn {
    width: 100%;
    padding: 8px;
    font-size: 12px;
    background: #fff;
    border: 1px solid #2271b1;
    color: #2271b1;
    border-radius: 6px;
    cursor: pointer;
}
.kj-open-qty-modal {
    width: 100%;
    padding: 15px;
    font-size: 16px;
    font-weight: bold;
    background: #2271b1;
    color: #fff;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    margin-top: 10px;
}
/* --- دکمه اسکن کنار جستجو --- */
.kj-scan-btn {
    border: 1px solid #ddd;
    background: #fff;
    border-radius: 8px;
    font-size: 18px;
    line-height: 1;
    padding: 8px 10px;
    cursor: pointer;
    margin-right: 6px;
}

/* --- اورلی اسکن --- */
#kj-scan-overlay {
    position: fixed;
    inset: 0;
    z-index: 999990;
    background: #000;
    display: flex;
    flex-direction: column;
}

.kj-scan-top {
    display: flex;
    justify-content: space-between;
    padding: 12px 16px;
}

.kj-scan-top button {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    font-size: 20px;
    cursor: pointer;
}

.kj-scan-viewport {
    position: relative;
    flex: 1;
    overflow: hidden;
}

#kj-scan-region {
    width: 100%;
    height: 100%;
}

.kj-scan-frame {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 240px;
    height: 160px;
    border: 2px solid rgba(255, 255, 255, 0.9);
    border-radius: 12px;
    pointer-events: none;
    box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.35);
}

.kj-scan-hint {
    color: #fff;
    text-align: center;
    padding: 12px;
    font-size: 14px;
}

.kj-scan-manual {
    display: flex;
    gap: 8px;
    padding: 0 16px 16px;
}

.kj-scan-manual input {
    flex: 1;
    padding: 12px;
    border-radius: 8px;
    border: none;
    font-size: 15px;
}

.kj-scan-manual .kj-btn {
    padding: 12px 18px;
}

.kj-scan-message {
    color: #ffd7d7;
    text-align: center;
    padding: 0 16px 16px;
    font-size: 13px;
    min-height: 18px;
}

/* --- بنر نصب اپ --- */
.kj-install-banner {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #fff8e5;
    border-bottom: 1px solid #f0c36d;
    padding: 10px 16px;
}

.kj-install-banner .kj-install-close {
    margin-right: auto;
    border: none;
    background: transparent;
    font-size: 18px;
    cursor: pointer;
}
/* --- نوار نصب اپ داخل مودال --- */
.kj-scan-install-bar {
    position: sticky;
    top: 0;
    z-index: 30;
    display: flex;
    align-items: center;
    gap: 10px;
    background: linear-gradient(135deg, #fff3cd, #ffe69c);
    border-bottom: 1px solid #f0c36d;
    padding: 10px 12px;
    border-radius: 10px 10px 0 0;
    margin: -10px -10px 10px -10px;
}

.kj-scan-install-bar span {
    font-size: 13px;
    color: #664d03;
    font-weight: 700;
}

/* جابه‌جایی ضربدر وقتی نوار نصب اپ هست */
.kj-modal-large.has-install-bar .kj-modal-close {
    top: 56px;
}
/* --- کارت دیده‌شده (سبز ملایم) --- */
.kj-seen-card {
    border: 1.5px solid #1e7e34 !important;
    background: #f0faf4 !important;
}

/* --- برچسب‌های گوشه کارت --- */
.kj-card-label {
    position: absolute;
    top: -8px;
    right: 8px;
    padding: 2px 8px;
    font-size: 10px;
    font-weight: 700;
    border-radius: 4px;
    z-index: 5;
}

.kj-card-label-scanned {
    background: #2271b1;
    color: #fff;
}

.kj-card-label-seen {
    background: #1e7e34;
    color: #fff;
}

/* تنظیم موقعیت کارت‌ها برای برچسب‌ها */
.kj-similar-card {
    position: relative;
}

/* --- ردیف‌های مودال محصول: کارت اصلی / دیده‌شده / جاری --- */
.kj-main-card {
    border: 2px solid #2271b1 !important;
    background: #f0f6fc !important;
}

.kj-seen-card {
    border: 1.5px solid #1e7e34 !important;
    background: #f0faf4 !important;
}

.kj-current-card {
    opacity: 0.55;
}

.kj-similar-card {
    position: relative;
}

/* --- برچسب‌های گوشه کارت --- */
.kj-card-label {
    position: absolute;
    top: -8px;
    right: 8px;
    padding: 2px 8px;
    font-size: 10px;
    font-weight: 700;
    border-radius: 4px;
    z-index: 5;
    white-space: nowrap;
}

.kj-card-label-main {
    background: #2271b1;
    color: #fff;
}

.kj-card-label-seen {
    background: #1e7e34;
    color: #fff;
}

.kj-card-label-comp {
    background: #e9f7ef;
    color: #1e7e34;
    border: 1px solid #1e7e34;
}

/* --- عنوان ردیف‌ها --- */
.kj-pd-row-title {
    font-size: 13px;
    color: #555;
    margin: 0 0 8px;
}

/* --- دکمه ستاره زیر قیمت --- */
.kj-star-btn {
    border: none;
    background: transparent;
    font-size: 24px;
    line-height: 1;
    color: #bbb;
    cursor: pointer;
    padding: 2px 6px;
    transition: transform 0.15s ease, color 0.15s ease;
}

.kj-star-btn.starred {
    color: #f5b301;
}

.kj-star-btn:active {
    transform: scale(1.25);
}
/* --- مودال محصول: ردیف‌ها، کارت‌ها، بج‌ها، ستاره --- */
.kj-pd-similar-section {
    margin-top: 16px;
    border-top: 1px solid #eee;
    padding-top: 12px;
}

.kj-pd-row-title {
    font-size: 13px;
    color: #555;
    margin: 0 0 8px;
}

.kj-pd-similar-scroll {
    display: flex;
    overflow-x: auto;
    gap: 10px;
    padding: 8px 2px 12px;
    -webkit-overflow-scrolling: touch;
}

.kj-similar-card {
    position: relative;
    min-width: 110px;
    max-width: 110px;
    border: 1px solid #eee;
    border-radius: 8px;
    padding: 8px;
    background: #fff;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    flex-shrink: 0;
}

.kj-sim-img-wrap {
    width: 80px;
    height: 80px;
    margin-bottom: 5px;
}

.kj-sim-img-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 6px;
}

.kj-sim-title {
    font-size: 12px;
    line-height: 1.3;
    height: 32px;
    overflow: hidden;
    margin-bottom: 5px;
    color: #333;
}

.kj-sim-price {
    font-size: 12px;
    font-weight: bold;
    color: #d63638;
    margin-bottom: 8px;
}

.kj-sim-view-btn {
    width: 100%;
    padding: 6px;
    font-size: 11px;
    background: #fff;
    border: 1px solid #2271b1;
    color: #2271b1;
    border-radius: 4px;
    cursor: pointer;
}

.kj-main-card {
    border: 2px solid #2271b1 !important;
    background: #f0f6fc !important;
}

.kj-seen-card {
    border: 1.5px solid #1e7e34 !important;
    background: #f0faf4 !important;
}

.kj-current-card {
    opacity: 0.55;
}

.kj-card-label {
    position: absolute;
    top: -8px;
    right: 8px;
    padding: 2px 8px;
    font-size: 10px;
    font-weight: 700;
    border-radius: 4px;
    z-index: 5;
    white-space: nowrap;
}

.kj-card-label-main { background: #2271b1; color: #fff; }
.kj-card-label-seen { background: #1e7e34; color: #fff; }
.kj-card-label-comp { background: #e9f7ef; color: #1e7e34; border: 1px solid #1e7e34; }

.kj-star-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: none;
    background: transparent;
    cursor: pointer;
    padding: 2px 6px;
}

.kj-star-btn .kj-star-icon {
    font-size: 22px;
    line-height: 1;
    color: #bbb;
}

.kj-star-btn.starred .kj-star-icon {
    color: #f5b301;
}

.kj-star-btn .kj-star-label {
    font-size: 11px;
    color: #888;
}

.kj-star-btn.starred .kj-star-label {
    color: #b58900;
    font-weight: 700;
}
/* --- مودال محصول gen5: ردیف‌ها، کارت‌ها، بج‌ها، کم‌رنگی --- */
.kj-pd-similar-section { margin-top: 16px; border-top: 1px solid #eee; padding-top: 12px; }
.kj-pd-row-title { font-size: 13px; color: #555; margin: 0 0 8px; }
.kj-pd-similar-scroll { display: flex; overflow-x: auto; gap: 10px; padding: 8px 2px 12px; -webkit-overflow-scrolling: touch; }

.kj-similar-card { position: relative; min-width: 110px; max-width: 110px; border: 1px solid #eee; border-radius: 8px; padding: 8px; background: #fff; display: flex; flex-direction: column; align-items: center; text-align: center; flex-shrink: 0; }
.kj-sim-img-wrap { width: 80px; height: 80px; margin-bottom: 5px; }
.kj-sim-img-wrap img { width: 100%; height: 100%; object-fit: cover; border-radius: 6px; }
.kj-sim-title { font-size: 12px; line-height: 1.3; height: 32px; overflow: hidden; margin-bottom: 5px; color: #333; }
.kj-sim-price { font-size: 12px; font-weight: bold; color: #d63638; margin-bottom: 8px; }
.kj-sim-view-btn { width: 100%; padding: 6px; font-size: 11px; background: #fff; border: 1px solid #2271b1; color: #2271b1; border-radius: 4px; cursor: pointer; }

.kj-main-card { border: 2px solid #2271b1 !important; background: #f0f6fc !important; }
.kj-seen-card { border: 1.5px solid #1e7e34 !important; background: #f0faf4 !important; }
.kj-current-card { opacity: 0.55; }

.kj-card-label { position: absolute; top: -8px; right: 8px; padding: 2px 8px; font-size: 10px; font-weight: 700; border-radius: 4px; z-index: 5; white-space: nowrap; }
.kj-card-label-main { background: #2271b1; color: #fff; }
.kj-card-label-seen { background: #1e7e34; color: #fff; }
.kj-card-label-comp { background: #e9f7ef; color: #1e7e34; border: 1px solid #1e7e34; }

/* --- آیکون‌های SVG اسکن --- */
.kj-scan-btn svg,
#kj-scan-torch svg {
    display: block;
    margin: 0 auto;
}

.kj-scan-btn {
    color: #2271b1;
}
#kj-float-btn { z-index: 100001; }