/**
 * استایل پنل مشتری و نماینده — بر پایه متغیرهای front.css (RTL، روشن/تیره).
 */

.bn-panel {
	padding: 40px 0 80px;
	min-height: 70vh;
}

.bn-panel-head { margin-bottom: 26px; }
.bn-panel-head h1 { font-size: 30px; margin: 0 0 6px; }
.bn-panel-head p { color: var(--text-soft); margin: 0; }

.bn-panel-grid {
	display: grid;
	grid-template-columns: 1fr 1.4fr;
	gap: 22px;
	align-items: start;
}
@media (max-width: 860px) {
	.bn-panel-grid { grid-template-columns: 1fr; }
}

/* کارت پایه پنل (کارت‌های front.css گرد و سایه‌دارند؛ اینجا هم‌راستا می‌کنیم) */
.bn-panel .bn-card {
	background: var(--card-bg);
	border: 0;
	border-radius: var(--radius);
	box-shadow: var(--neu-shadow-sm);
	padding: 24px;
	text-align: right;
}
.bn-panel .bn-card h3 { margin: 0 0 16px; font-size: 18px; }
.bn-card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.bn-card-head h3 { margin: 0; }

/* دکمه کوچک/بلوک */
.bn-btn.bn-sm { padding: 8px 16px; font-size: 14px; }
.bn-btn.bn-block { width: 100%; justify-content: center; margin-top: 6px; }

/* کارت لینک اختصاصی نماینده */
.bn-referral { margin-bottom: 22px; }
.bn-referral-desc { color: var(--text-soft); margin: 0 0 14px; font-size: 14px; }
.bn-referral-box {
	display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
	background: var(--bg-soft, var(--bg)); border-radius: var(--radius-sm);
	box-shadow: var(--neu-inset); padding: 12px 16px;
}
.bn-referral-value { flex: 1 1 260px; word-break: break-all; font-family: monospace; color: var(--text); }

/* ── پروفایل (key/value) ── */
.bn-kv { margin: 0; display: grid; gap: 12px; }
.bn-kv > div { display: flex; justify-content: space-between; gap: 14px; border-bottom: 1px dashed var(--border); padding-bottom: 12px; }
.bn-kv > div:last-child { border-bottom: 0; padding-bottom: 0; }
.bn-kv dt { color: var(--text-soft); font-size: 14px; margin: 0; }
.bn-kv dd { margin: 0; font-weight: 600; word-break: break-all; }
.bn-kv dd.ok { color: #1a9b62; }
.bn-kv dd.warn { color: #c47f17; }

/* ── سفارش‌ها ── */
.bn-orders-list { display: grid; gap: 12px; }
.bn-order-row {
	display: flex; align-items: center; justify-content: space-between; gap: 14px;
	background: var(--surface-2); border: 1px solid var(--border);
	border-radius: var(--radius-sm); padding: 14px 16px;
}
.bn-order-title { font-weight: 700; }
.bn-order-meta { color: var(--text-soft); font-size: 13px; }
.bn-order-side { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }

.bn-status { font-size: 13px; font-weight: 700; padding: 5px 12px; border-radius: 999px; white-space: nowrap; }
.bn-status.is-wait   { background: #fdf0dc; color: #a86a12; }
.bn-status.is-serial { background: #e6f0fb; color: #2f6aa6; }
.bn-status.is-proc   { background: #efe6fb; color: #6b3aa6; }
.bn-status.is-done   { background: #e2f6ea; color: #1a9b62; }
[data-theme="dark"] .bn-status.is-wait   { background: #3a2f16; color: #e6b56a; }
[data-theme="dark"] .bn-status.is-serial { background: #182635; color: #7fb0e6; }
[data-theme="dark"] .bn-status.is-proc   { background: #241a35; color: #b48fe0; }
[data-theme="dark"] .bn-status.is-done   { background: #12331f; color: #6fd39c; }

/* ── حالت خالی / بارگذاری ── */
.bn-empty, .bn-loading {
	text-align: center; color: var(--text-soft);
	padding: 30px 14px;
}
.bn-empty .ico { font-size: 34px; margin-bottom: 8px; }
.bn-empty p { margin: 0 0 14px; }

/* ── گیت ورود (پنل مشتری) ── */
.bn-panel-guard { display: flex; justify-content: center; padding: 50px 0; }
.bn-guard-card { max-width: 440px; text-align: center; }
.bn-guard-card .ico { font-size: 44px; margin-bottom: 8px; }
.bn-guard-card h2 { margin: 0 0 8px; font-size: 22px; }
.bn-guard-card p { color: var(--text-soft); margin: 0 0 18px; }

/* ── کارت احراز هویت نماینده ── */
.bn-auth-wrap { display: flex; justify-content: center; padding: 30px 0; }
.bn-auth-card { width: 100%; max-width: 460px; }
.bn-modal-tabs { display: flex; gap: 8px; margin-bottom: 18px; }
.bn-modal-tab {
	flex: 1; padding: 10px; border-radius: var(--radius-sm); cursor: pointer;
	border: 1px solid var(--border); background: var(--surface-2);
	color: var(--text-soft); font-family: inherit; font-size: 15px; font-weight: 600;
}
.bn-modal-tab.active { background: var(--brand); color: #fff; border-color: var(--brand); }

.bn-auth-view label, .bn-inline-form label { display: block; font-size: 14px; margin: 12px 0 6px; color: var(--text-soft); }
.bn-auth-view input[type="text"],
.bn-auth-view input[type="password"],
.bn-inline-form input[type="number"] {
	width: 100%; padding: 11px 14px; border-radius: var(--radius-sm);
	border: 1px solid var(--border); background: var(--surface-2);
	color: var(--text); font-family: inherit; font-size: 15px;
}
.bn-auth-view input:focus, .bn-inline-form input:focus {
	outline: none; border-color: var(--brand);
	box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 20%, transparent);
}
.bn-check { display: flex !important; align-items: center; gap: 8px; font-size: 14px; color: var(--text) !important; }
.bn-check input { width: auto !important; }
.bn-auth-note { color: var(--text-soft); font-size: 13px; text-align: center; margin: 16px 0 0; }

/* ── پیام فرم ── */
.bn-form-msg { min-height: 20px; font-size: 14px; margin: 10px 0; text-align: center; }
.bn-form-msg.is-info    { color: var(--text-soft); }
.bn-form-msg.is-success { color: #1a9b62; }
.bn-form-msg.is-error   { color: #d0433f; }

/* ── فرم درون‌خطی (ساخت کد) ── */
.bn-inline-form {
	display: flex; align-items: flex-end; gap: 10px; flex-wrap: wrap;
	background: var(--surface-2); border: 1px solid var(--border);
	border-radius: var(--radius-sm); padding: 14px; margin-bottom: 6px;
}
.bn-inline-form label { margin: 0 0 6px; flex: 1 1 100%; }
.bn-inline-form input[type="number"] { width: 110px; }

/* ── کدهای تخفیف ── */
.bn-codes-list, .bn-sales-list { display: grid; gap: 10px; margin-top: 14px; }
.bn-code-row {
	display: flex; align-items: center; justify-content: space-between; gap: 12px;
	background: var(--surface-2); border: 1px solid var(--border);
	border-radius: var(--radius-sm); padding: 12px 14px;
}
.bn-code-row.is-off { opacity: .55; }
.bn-code-main { display: flex; align-items: center; gap: 12px; }
.bn-code-value {
	font-family: monospace; font-size: 16px; font-weight: 700; letter-spacing: 1px;
	background: var(--brand-050); color: var(--brand); padding: 4px 10px;
	border-radius: 8px; cursor: pointer;
}
.bn-code-pct { font-weight: 700; color: var(--accent); }
.bn-code-side { display: flex; align-items: center; gap: 10px; }
.bn-code-uses { font-size: 13px; color: var(--text-soft); }

/* ── فروش ── */
.bn-sale-row {
	display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
	background: var(--surface-2); border: 1px solid var(--border);
	border-radius: var(--radius-sm); padding: 12px 14px; font-size: 14px;
}

/* ── اسکلتون بارگذاری (به‌جای «در حال بارگذاری…») ── */
.bn-skel {
	position: relative; overflow: hidden;
	background: color-mix(in srgb, var(--text-soft) 16%, var(--card-bg));
	border-radius: 8px;
}
.bn-skel::after {
	content: ""; position: absolute; inset: 0;
	transform: translateX(-100%);
	background: linear-gradient(90deg, transparent, color-mix(in srgb, #fff 45%, transparent), transparent);
	animation: bnSkel 1.2s infinite;
}
[data-theme="dark"] .bn-skel::after { background: linear-gradient(90deg, transparent, rgba(255,255,255,.08), transparent); }
@keyframes bnSkel { 100% { transform: translateX(100%); } }
.bn-skel-line { height: 12px; margin: 6px 0; display: inline-block; }
.bn-skel-pill { width: 96px; height: 26px; border-radius: 999px; }
.bn-order-row.is-skel { pointer-events: none; }
@media (prefers-reduced-motion: reduce) { .bn-skel::after { animation: none; } }

/* ── فرم ثبت سریال (پنل مشتری) ── */
.bn-serial-form { margin-top: 10px; width: 100%; }
.bn-serial-hint { font-size: 13px; color: var(--text-soft); margin-bottom: 6px; }
.bn-serial-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.bn-serial-input {
	flex: 1; min-width: 160px; padding: 9px 12px; border-radius: var(--radius-sm);
	border: 1px solid var(--border); background: var(--surface-2); color: var(--text);
	font-family: inherit; font-size: 14px;
}
.bn-serial-input:focus { outline: none; border-color: var(--brand); background: var(--surface); }
.bn-serial-msg { font-size: 13px; margin-top: 6px; min-height: 16px; }
.bn-serial-msg.is-error { color: #d9534f; }
.bn-serial-msg.is-success { color: #2e9e6b; }

/* ── کلید لایسنس (پنل مشتری) ── */
.bn-license-key { display: flex; align-items: center; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.bn-license-key code {
	background: var(--surface-2); border: 1px solid var(--border);
	border-radius: 8px; padding: 5px 10px; font-size: 13px; direction: ltr; word-break: break-all;
}

/* ══════════════ بازطراحی پنل: کارت سفارش، مودال پروفایل، تیکت ══════════════ */

/* سفارش‌ها تمام‌عرض؛ هر سفارش یک کارت مستقل */
.bn-orders-wide { margin-bottom: 28px; }
.bn-section-title h3 { font-size: 20px; margin: 0 0 16px; }
.bn-orders-cards { display: grid; gap: 16px; }
.bn-order-card { padding: 22px 24px; }
.bn-order-card-head {
	display: flex;
	justify-content: space-between;
	align-items: flex-start;
	gap: 14px;
	flex-wrap: wrap;
}
.bn-order-product { display: flex; align-items: center; gap: 12px; }
.bn-order-ico {
	width: 46px; height: 46px;
	display: flex; align-items: center; justify-content: center;
	font-size: 22px;
	border-radius: 14px;
	box-shadow: var(--neu-shadow-xs);
	flex-shrink: 0;
}
.bn-order-card .bn-order-title { font-weight: 700; font-size: 16px; }
.bn-order-card .bn-order-meta { color: var(--text-soft); font-size: 13px; margin-top: 3px; }
.bn-order-license {
	display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
	margin-top: 14px; padding: 10px 14px;
	border-radius: 12px;
	box-shadow: var(--neu-inset);
}
.bn-order-license-label { color: var(--text-soft); font-size: 13px; }
.bn-order-license code { direction: ltr; font-weight: 700; word-break: break-all; }
/* تکست‌باکس باریک لایسنس: کلید کامل نمایش داده نمی‌شود، فقط تک‌خطی و قابل اسکرول/انتخاب */
.bn-license-box {
	flex: 1 1 160px; min-width: 0;
	direction: ltr; text-align: left; font-family: monospace; font-size: 13px;
	padding: 8px 12px; border: 0; border-radius: 10px;
	background: var(--bg); color: var(--text);
	box-shadow: var(--neu-inset);
	white-space: nowrap; overflow-x: auto; text-overflow: ellipsis;
}
.bn-license-box:focus { outline: none; box-shadow: var(--neu-inset), 0 0 0 2px var(--brand); }
.bn-order-actions {
	display: flex; gap: 10px; flex-wrap: wrap;
	margin-top: 14px; padding-top: 14px;
	border-top: 1px dashed var(--border);
}
.bn-order-serial-slot .bn-serial-form { margin-top: 14px; }
.bn-order-card.is-skel { pointer-events: none; }

/* گروه‌بندی کارتِ لایسنس بر اساس محصول: دو شمارشگر (فعال/در انتظار سریال) + واحدها */
.bn-group-counters { display: flex; gap: 8px; flex-wrap: wrap; }
.bn-counter { font-size: 12.5px; font-weight: 700; padding: 5px 12px; border-radius: 999px; white-space: nowrap; }
.bn-counter.is-done   { background: #e2f6ea; color: #1a9b62; }
.bn-counter.is-serial { background: #e6f0fb; color: #2f6aa6; }
[data-theme="dark"] .bn-counter.is-done   { background: #12331f; color: #6fd39c; }
[data-theme="dark"] .bn-counter.is-serial { background: #182635; color: #7fb0e6; }
.bn-product-units { display: flex; flex-direction: column; gap: 14px; margin-top: 16px; }
.bn-order-unit { padding-top: 14px; border-top: 1px dashed var(--border); }
.bn-order-unit:first-child { padding-top: 0; border-top: 0; }
.bn-order-unit-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }

/* مودال پروفایل / تیکت (هم‌سبک مودال احراز هویت) */
.bn-profile-modal {
	position: fixed; inset: 0; z-index: 1000;
	display: none; align-items: center; justify-content: center;
	background: rgba(20, 30, 45, .45);
	backdrop-filter: blur(3px);
	padding: 20px;
}
.bn-profile-modal.open { display: flex; }
.bn-profile-card {
	position: relative;
	width: 100%; max-width: 420px;
	max-height: 88vh; overflow-y: auto;
	padding: 30px 28px;
	background: var(--card-bg);
	border-radius: var(--radius);
	box-shadow: none; /* کارت اطلاعات حساب بدون سایه (خواسته‌ی کاربر) */
	animation: bnModalIn .25s ease-out;
}
@keyframes bnModalIn { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .bn-profile-card { animation: none; } }
.bn-profile-close {
	position: absolute; top: 14px; left: 14px;
	width: 34px; height: 34px;
	border: 0; border-radius: 50%;
	background: var(--card-bg);
	box-shadow: none;
	cursor: pointer; color: var(--text-soft);
	font-size: 14px;
}
.bn-profile-avatar {
	width: 64px; height: 64px;
	margin: 0 auto 12px;
	display: flex; align-items: center; justify-content: center;
	font-size: 30px; border-radius: 50%;
	box-shadow: none;
}
.bn-profile-card h3 { text-align: center; margin: 0 0 18px; }

/* حریم خصوصی (داخل مودال اطلاعات حساب) */
.bn-privacy-box { margin-top: 18px; padding-top: 16px; border-top: 1px dashed var(--border); }
.bn-privacy-box h4 { margin: 0 0 10px; font-size: 14px; color: var(--text-soft); }
.bn-privacy-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.bn-btn-danger { background: none; border: 1px solid #e35252; color: #e35252; }
.bn-btn-danger:hover { background: #e3525214; }
.bn-privacy-otp { margin-top: 12px; display: flex; flex-direction: column; gap: 8px; }
.bn-privacy-otp input { padding: 8px 10px; border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--bg); color: var(--text); font-family: inherit; }
.bn-privacy-otp-actions { display: flex; gap: 8px; }
.bn-privacy-msg { margin-top: 10px; font-size: 13px; }
.bn-privacy-msg.ok { color: #1a9b62; }
.bn-privacy-msg.err { color: #e35252; }

/* کارت تیکت‌ها */
.bn-tickets { margin-bottom: 28px; }
.bn-tickets .bn-card-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 14px; }
.bn-tickets .bn-card-head h3 { margin: 0; }
.bn-ticket-form { margin-bottom: 16px; padding: 16px; border-radius: 14px; box-shadow: var(--neu-inset); }
.bn-ticket-input, .bn-ticket-textarea {
	width: 100%; box-sizing: border-box;
	border: 0; border-radius: 12px;
	padding: 11px 14px; margin-bottom: 10px;
	background: var(--bg); color: var(--text);
	box-shadow: var(--neu-inset);
	font: inherit; font-size: 15px;
}
.bn-ticket-textarea { resize: vertical; min-height: 90px; }
.bn-ticket-form-actions { display: flex; gap: 10px; }
.bn-ticket-form-msg { margin-top: 8px; font-size: 13px; min-height: 18px; }
.bn-ticket-form-msg.is-error { color: #d64545; }
.bn-ticket-form-msg.is-success { color: #1a9b62; }

.bn-tickets-list { display: grid; gap: 10px; }
.bn-tickets-empty { color: var(--text-soft); font-size: 14px; padding: 8px 2px; }
.bn-ticket-row {
	display: flex; justify-content: space-between; align-items: center; gap: 12px;
	width: 100%; text-align: right;
	border: 0; cursor: pointer;
	padding: 13px 16px; border-radius: 12px;
	background: var(--card-bg); color: var(--text);
	box-shadow: var(--neu-shadow-xs);
	font: inherit; font-size: 14px;
	transition: transform .15s ease;
}
.bn-ticket-row:hover { transform: translateY(-1px); }
.bn-ticket-subject { font-weight: 600; display: flex; align-items: center; gap: 8px; }
.bn-ticket-dot { width: 9px; height: 9px; border-radius: 50%; background: #d64545; flex-shrink: 0; }
.bn-ticket-side { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.bn-ticket-date { color: var(--text-soft); font-size: 12px; }

/* گفتگوی تیکت درجا (زیر لیست تیکت‌ها) */
.bn-ticket-thread-inline {
	margin-top: 18px;
	padding: 18px;
	border-radius: 14px;
	box-shadow: var(--neu-inset);
}
.bn-ticket-thread-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.bn-ticket-thread-head h3 { margin: 0; font-size: 17px; }
.bn-ticket-thread-side { display: flex; align-items: center; gap: 10px; }
.bn-ticket-msgs { max-height: 44vh; overflow-y: auto; display: grid; gap: 10px; padding: 4px 2px; }
.bn-tmsg { max-width: 85%; padding: 10px 14px; border-radius: 14px; }
.bn-tmsg.is-customer { background: var(--bg); box-shadow: var(--neu-shadow-xs); justify-self: start; }
.bn-tmsg.is-admin { background: rgba(58, 124, 191, .12); justify-self: end; }
.bn-tmsg-head { font-size: 11px; color: var(--text-soft); margin-bottom: 5px; }
.bn-tmsg-body { font-size: 14px; line-height: 1.9; word-break: break-word; }
.bn-ticket-reply { margin-top: 14px; }
.bn-ticket-reply textarea {
	width: 100%; box-sizing: border-box;
	border: 0; border-radius: 12px;
	padding: 11px 14px;
	background: var(--bg); color: var(--text);
	box-shadow: var(--neu-inset);
	font: inherit; font-size: 14px;
	resize: vertical;
}
.bn-ticket-reply-actions { display: flex; gap: 10px; margin-top: 10px; }
.bn-ticket-closed-note { margin-top: 14px; color: var(--text-soft); font-size: 13px; text-align: center; padding: 10px; border-radius: 10px; box-shadow: var(--neu-inset); }

/* دکمه نام کاربر (حالا کلیک‌پذیر) */
button.bn-btn-user { cursor: pointer; }

/* موبایل */
@media (max-width: 640px) {
	.bn-order-card { padding: 18px 16px; }
	.bn-order-card-head { flex-direction: column; }
	.bn-order-actions .bn-btn { flex: 1 1 auto; text-align: center; }
	.bn-ticket-row { flex-direction: column; align-items: flex-start; gap: 6px; }
	.bn-tmsg { max-width: 100%; }
	.bn-profile-card { padding: 24px 18px; }
	.bn-ticket-thread-inline { padding: 14px 12px; }
}
