/* ==========================================================================
   VENDORHA — کامپوننت‌های پایه
   --------------------------------------------------------------------------
   دکمه، کارت، فرم، نشان، و اجزای تکرارشونده.
   همه از توکن‌های tokens.css استفاده می‌کنند تا با تم روشن/تیره و
   جهت RTL/LTR خودکار سازگار بمانند.
   ========================================================================== */

/* ==========================================================================
   دکمه‌ها
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  padding: var(--sp-3) var(--sp-5);
  border-radius: var(--r-md);
  border: 1.5px solid transparent;
  font: inherit;
  font-weight: 700;
  font-size: var(--fs-base);
  line-height: 1.5;
  white-space: nowrap;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: background var(--dur-base) var(--ease-out),
              border-color var(--dur-base) var(--ease-out),
              color var(--dur-base) var(--ease-out),
              transform var(--dur-fast) var(--ease-out),
              box-shadow var(--dur-base) var(--ease-out);
}

/* موج لمس — بازخورد فوری بدون جاوااسکریپت */
.btn::before {
  content: "";
  position: absolute;
  inset: 0;
  background: currentColor;
  opacity: 0;
  transition: opacity var(--dur-fast) var(--ease-out);
}

.btn:hover::before { opacity: .06; }
.btn:active { transform: translateY(1px) scale(.99); }

.btn:disabled,
.btn[disabled],
.btn[aria-disabled="true"] {
  opacity: .5;
  cursor: not-allowed;
  transform: none;
}

.btn:disabled::before { opacity: 0; }

/* ---------- گونه‌ها ---------- */
.btn-primary {
  background: var(--green-btn);
  color: var(--on-green);
  box-shadow: var(--sh-sm);
}
.btn-primary:hover {
  background: var(--green-btn-hover);
  box-shadow: var(--sh-brand);
  transform: translateY(-1px);
}

.btn-ghost {
  background: var(--surface);
  border-color: var(--line-strong);
  color: var(--ink);
}
.btn-ghost:hover {
  border-color: var(--green);
  color: var(--green-text);
}

.btn-soft {
  background: var(--green-100);
  color: var(--green-text);
}
.btn-soft:hover { background: var(--green-50); }

.btn-danger {
  background: var(--danger);
  color: #fff;
}
.btn-danger:hover { background: var(--danger-text); }

.btn-plain {
  background: transparent;
  color: var(--ink-soft);
  padding-inline: var(--sp-3);
}
.btn-plain:hover { color: var(--green-text); }

/* ---------- اندازه‌ها ---------- */
.btn-xs {
  padding: var(--sp-1) var(--sp-3);
  font-size: var(--fs-xs);
  border-radius: var(--r-sm);
  min-height: 30px;
}
.btn-sm {
  padding: var(--sp-2) var(--sp-4);
  font-size: var(--fs-sm);
  border-radius: var(--r-sm);
  min-height: 36px;
}
.btn-lg {
  padding: var(--sp-4) var(--sp-8);
  font-size: var(--fs-md);
  border-radius: var(--r-lg);
  min-height: 52px;
}
.btn-block { width: 100%; }

/* دکمهٔ آیکنی گرد */
.btn-icon {
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: var(--r-full);
}

/* ==========================================================================
   کارت‌ها
   ========================================================================== */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  overflow: hidden;
  transition: transform var(--dur-base) var(--ease-out),
              box-shadow var(--dur-base) var(--ease-out),
              border-color var(--dur-base) var(--ease-out);
}

.card-hover:hover {
  transform: translateY(-3px);
  box-shadow: var(--sh-lg);
  border-color: var(--green-100);
}

.card-body { padding: var(--sp-5); }
.card-tight { padding: var(--sp-4); }

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  padding: var(--sp-4) var(--sp-5);
  border-bottom: 1px solid var(--line);
}

.card-head h3,
.card-head h4 {
  font-size: var(--fs-md);
  font-weight: 800;
}

/* کارت شیشه‌ای — برای روی تصویر یا گرادیان */
.card-glass {
  background: var(--glass-bg-strong);
  border: 1px solid var(--glass-border);
  border-radius: var(--r-lg);
  box-shadow: var(--glass-shadow);
}

@supports (backdrop-filter: blur(1px)) {
  .card-glass {
    background: var(--glass-bg);
    -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(160%);
    backdrop-filter: blur(var(--glass-blur)) saturate(160%);
  }
}

/* ==========================================================================
   فرم‌ها
   ========================================================================== */
.field {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}

.field > span,
.field > label {
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--ink-soft);
}

.field small {
  font-size: var(--fs-xs);
  color: var(--slate);
  line-height: var(--lh-normal);
}

/* `.df-time` استثناست: کادر ساعتِ ویجت تاریخ عرض ثابت خودش را دارد
   و با width:100% تمام کادر را می‌گرفت و دکمهٔ تقویم را له می‌کرد. */
.input,
.field input:not([type="checkbox"]):not([type="radio"]):not(.df-time),
.field select,
.field textarea {
  width: 100%;
  padding: var(--sp-3) var(--sp-4);
  border: 1.5px solid var(--line-strong);
  border-radius: var(--r-md);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: var(--fs-base);
  transition: border-color var(--dur-base) var(--ease-out),
              box-shadow var(--dur-base) var(--ease-out);
}

.input:hover,
.field input:hover,
.field select:hover,
.field textarea:hover { border-color: var(--slate-light); }

.input:focus,
.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--green);
  box-shadow: 0 0 0 3px var(--green-100);
}

.field textarea {
  min-height: 90px;
  resize: vertical;
  line-height: var(--lh-normal);
}

.field-error input,
.field-error select,
.field-error textarea { border-color: var(--danger); }

.field-msg {
  font-size: var(--fs-xs);
  color: var(--danger-text);
}

/* تیک و رادیو */
.field-check {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-3);
  padding: var(--sp-3);
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease-out);
}

.field-check:hover { background: var(--bg-subtle); }

.field-check input {
  width: 18px;
  height: 18px;
  margin-top: 2px;
  accent-color: var(--green-btn);
  flex: none;
}

.field-check span {
  font-size: var(--fs-base);
  line-height: var(--lh-normal);
}

/* گروه فرم دو ستونی */
.form-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--sp-4);
}

@media (min-width: 640px) {
  .form-grid { grid-template-columns: 1fr 1fr; }
  .form-grid .span-2 { grid-column: span 2; }
}

/* ==========================================================================
   نشان‌ها و برچسب‌ها
   ========================================================================== */
.chip {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-1);
  padding: var(--sp-1) var(--sp-3);
  border-radius: var(--r-full);
  font-size: var(--fs-xs);
  font-weight: 700;
  background: var(--bg-subtle);
  color: var(--ink-soft);
  white-space: nowrap;
}

.chip-success { background: var(--success-bg); color: var(--success-text); }
.chip-warn    { background: var(--warn-bg);    color: var(--warn-text); }
.chip-danger  { background: var(--danger-bg);  color: var(--danger-text); }
.chip-info    { background: var(--info-bg);    color: var(--info-text); }
.chip-brand   { background: var(--green-100);  color: var(--green-text); }

/* نشان عددی روی آیکن */
.dot-badge {
  display: inline-grid;
  place-items: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: var(--r-full);
  /* رنگ ثابت، نه متغیر: نشان عددی همیشه سفید روی قرمز است و
     در تم تیره هم نباید روشن شود. */
  background: #B91C1C;
  color: #fff;
  font-size: var(--fs-xs);
  font-weight: 800;
  line-height: 1;
}

/* ==========================================================================
   پیام‌ها
   ========================================================================== */
.alert {
  display: flex;
  gap: var(--sp-3);
  padding: var(--sp-4);
  border-radius: var(--r-md);
  border: 1px solid transparent;
  font-size: var(--fs-base);
  line-height: var(--lh-normal);
}

.alert-icon { flex: none; font-size: 1.1rem; }

.alert-success {
  background: var(--success-bg);
  border-color: var(--green);
  color: var(--success-text);
}
.alert-warn {
  background: var(--warn-bg);
  border-color: var(--warn);
  color: var(--warn-text);
}
.alert-danger {
  background: var(--danger-bg);
  border-color: var(--danger);
  color: var(--danger-text);
}
.alert-info {
  background: var(--info-bg);
  border-color: var(--info);
  color: var(--info-text);
}

/* ==========================================================================
   حالت خالی
   ========================================================================== */
.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--sp-3);
  padding: var(--sp-16) var(--sp-6);
  text-align: center;
  color: var(--slate);
}

.empty-icon {
  font-size: 2.6rem;
  opacity: .55;
  animation: fade-up var(--dur-slow) var(--ease-out) both;
}

.empty-title {
  font-size: var(--fs-md);
  font-weight: 700;
  color: var(--ink-soft);
}

.empty-text {
  font-size: var(--fs-sm);
  line-height: var(--lh-normal);
  max-width: 340px;
}

/* ==========================================================================
   جداکننده و سربرگ بخش
   ========================================================================== */
.divider {
  height: 1px;
  background: var(--line);
  border: 0;
  margin: var(--sp-6) 0;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4);
  margin-bottom: var(--sp-5);
  flex-wrap: wrap;
}

.section-head h2 {
  font-size: var(--fs-xl);
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}

.section-head p {
  font-size: var(--fs-sm);
  color: var(--slate);
  margin-top: var(--sp-1);
}

/* خط تزئینی زیر عنوان — با گرادیان برند */
.section-head h2::after {
  content: "";
  display: block;
  width: 34px;
  height: 3px;
  border-radius: var(--r-full);
  background: var(--grad-brand);
  margin-top: var(--sp-2);
}

/* ==========================================================================
   آمار
   ========================================================================== */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: var(--sp-4);
}

.stat {
  position: relative;
  padding: var(--sp-5);
  border-radius: var(--r-lg);
  background: var(--surface);
  border: 1px solid var(--line);
  overflow: hidden;
  transition: transform var(--dur-base) var(--ease-out),
              box-shadow var(--dur-base) var(--ease-out);
}

.stat:hover {
  transform: translateY(-2px);
  box-shadow: var(--sh-md);
}

/* نوار رنگی کنار — در RTL و LTR سمت درست می‌نشیند */
.stat::before {
  content: "";
  position: absolute;
  inset-block: 0;
  inset-inline-start: 0;
  width: 3px;
  background: var(--grad-brand);
}

.stat-label {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  font-size: var(--fs-sm);
  color: var(--slate);
}

.stat-value {
  font-size: var(--fs-2xl);
  font-weight: 900;
  line-height: 1.2;
  margin-top: var(--sp-2);
  color: var(--ink);
}

.stat-trend {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-1);
  font-size: var(--fs-xs);
  font-weight: 700;
  margin-top: var(--sp-2);
}

.stat-up   { color: var(--success-text); }
.stat-down { color: var(--danger-text); }

/* ==========================================================================
   تب‌ها
   ========================================================================== */
.tabs {
  display: flex;
  gap: var(--sp-2);
  overflow-x: auto;
  padding-bottom: var(--sp-2);
  scrollbar-width: none;
}

.tabs::-webkit-scrollbar { display: none; }

.tab {
  padding: var(--sp-2) var(--sp-4);
  border-radius: var(--r-full);
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--ink-soft);
  background: var(--bg-subtle);
  border: 1px solid transparent;
  white-space: nowrap;
  transition: all var(--dur-base) var(--ease-out);
}

.tab:hover { border-color: var(--line-strong); }

.tab.on {
  background: var(--green-btn);
  color: var(--on-green);
  box-shadow: var(--sh-sm);
}

.tab small { opacity: .75; margin-inline-start: var(--sp-1); }

/* ==========================================================================
   بارگذاری
   ========================================================================== */
.spinner {
  width: 22px;
  height: 22px;
  border: 2.5px solid var(--line);
  border-top-color: var(--green);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}

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

.loading-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-3);
  padding: var(--sp-10);
  color: var(--slate);
  font-size: var(--fs-sm);
}

/* ==========================================================================
   ابزارهای کوچک
   ========================================================================== */
.stack     { display: flex; flex-direction: column; gap: var(--sp-4); }
.stack-sm  { display: flex; flex-direction: column; gap: var(--sp-2); }
.row       { display: flex; align-items: center; gap: var(--sp-3); }
.row-wrap  { display: flex; align-items: center; gap: var(--sp-3);
             flex-wrap: wrap; }
.row-between { display: flex; align-items: center;
               justify-content: space-between; gap: var(--sp-3); }
.grow      { flex: 1; }
.muted     { color: var(--slate); }
.text-sm   { font-size: var(--fs-sm); }
.text-xs   { font-size: var(--fs-xs); }
.bold      { font-weight: 700; }
.center    { text-align: center; }

/* عدد و مبلغ — همیشه LTR حتی در صفحهٔ راست‌چین */
.num, .money {
  font-variant-numeric: tabular-nums;
  direction: ltr;
  unicode-bidi: isolate;
  display: inline-block;
}

.money-lg {
  font-size: var(--fs-lg);
  font-weight: 900;
  color: var(--green-text);
}

/* ==========================================================================
   سلکت جست‌وجوشونده
   ==========================================================================

   لایهٔ روییِ `<select>` بومی. خودِ سلکت در DOM می‌ماند و منبع حقیقت
   است؛ این‌ها فقط ظاهر آن لایه‌اند. منطقش در `js/vh-select.js`.

   ⚠️ چرا این‌جا و نه در `pages.css`: این یک کنترلِ فرم است و باید
   کنار `.field` بنشیند تا هم‌شکل ماندنش قابل نگهداری باشد.
   ========================================================================== */

/*
  سلکت اصلی: بصری پنهان، ولی زنده.

  ⚠️ `display: none` نه — با آن، پیام اعتبارسنجی بومی مرورگر
  («این فیلد را پر کنید») جایی برای نمایش ندارد و فرم بی‌صدا
  ارسال نمی‌شود.
*/
.vsel-native {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip-path: inset(50%);
  white-space: nowrap; border: 0;
  opacity: 0; pointer-events: none;
}

.vsel { position: relative; width: 100%; }

/* --------------------------------------------------------------------------
   دکمهٔ فیلد — دقیقاً هم‌شکل `input` و `select` سایت
   -------------------------------------------------------------------------- */
.vsel-btn {
  display: flex; align-items: center; gap: var(--sp-3);
  width: 100%; cursor: pointer;
  padding: var(--sp-3) var(--sp-4);
  border: 1.5px solid var(--line-strong);
  border-radius: var(--r-md);
  background: var(--surface);
  color: var(--ink);
  font: inherit; font-size: var(--fs-base);
  text-align: start;
  transition: border-color var(--dur-base) var(--ease-out),
              box-shadow var(--dur-base) var(--ease-out);
}
.vsel-btn:hover { border-color: var(--slate-light); }

.vsel-btn:focus-visible,
.vsel.is-open .vsel-btn {
  outline: none;
  border-color: var(--green);
  box-shadow: 0 0 0 3px var(--green-100);
}

.vsel-btn:disabled { opacity: .55; cursor: not-allowed; }

.vsel-val {
  flex: 1; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
/* چیزی انتخاب نشده → متن راهنما کم‌رنگ، مثل placeholder */
.vsel.is-empty .vsel-val { color: var(--slate); }

/*
  ⚠️ فلش با CSS کشیده می‌شود، نه با کاراکتر «▾».

  کاراکتر در فونت‌های مختلف اندازه و خط پایه‌اش فرق می‌کند و
  کنار فیلد کج به‌نظر می‌رسد.
*/
/*
  ⚠️ مرزهای **فیزیکی**، نه منطقی.

  این یک شکل هندسی است، نه چیدمان متن: فلشِ رو‌به‌پایین در RTL و
  LTR یکی است. با `border-inline-start`، در فارسی ضلع دیگری حذف
  می‌شد و فلش به پهلو می‌افتاد.
*/
.vsel-caret {
  flex: none; width: 9px; height: 9px;
  border: 2px solid currentColor;
  border-top: 0; border-left: 0;
  border-radius: 0 0 2px 0;
  color: var(--slate);
  transform: translateY(-2px) rotate(45deg);
  transition: transform var(--dur-base) var(--ease-out),
              color var(--dur-base) var(--ease-out);
}
.vsel.is-open .vsel-caret {
  transform: translateY(2px) rotate(225deg);
  color: var(--green);
}

/* خطای فیلد — هم‌رنگ بقیهٔ فیلدهای خطادار */
.field-error .vsel-btn { border-color: var(--danger); }

/* --------------------------------------------------------------------------
   پنل — دسکتاپ
   --------------------------------------------------------------------------
   ⚠️ `fixed` چون پنل به `body` منتقل شده تا نه `<label>` کلیکش را
   بدزدد و نه کارت‌های `overflow: hidden` ببرندش. مختصات را JS
   می‌گذارد.
   -------------------------------------------------------------------------- */
.vsel-pop {
  position: fixed; z-index: 80;
  display: flex; flex-direction: column;
  max-height: 460px;
  border-radius: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow:
    0 1px 2px rgba(16, 22, 20, .05),
    0 10px 28px -10px rgba(16, 22, 20, .18),
    0 26px 50px -24px rgba(16, 22, 20, .3);
  overflow: hidden;
  animation: vsel-in .16s var(--ease-out);
}
.vsel-pop[hidden] { display: none; }

@keyframes vsel-in {
  from { opacity: 0; transform: translateY(-6px) scale(.985); }
  to   { opacity: 1; transform: none; }
}

/* پوشش تیره — فقط موبایل لازمش دارد */
.vsel-veil { display: none; }
.vsel-head { display: none; }

/* --------------------------------------------------------------------------
   کادر جست‌وجو
   -------------------------------------------------------------------------- */
.vsel-search {
  position: relative; flex: none;
  padding: 10px 10px 8px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.vsel-search input {
  width: 100%; box-sizing: border-box;
  padding-block: 10px;
  padding-inline-start: 38px;
  padding-inline-end: 38px;
  border: 1.5px solid var(--line);
  border-radius: 11px;
  background: var(--bg-subtle);
  color: var(--ink);
  font: inherit; font-size: .86rem;
}
.vsel-search input:focus {
  outline: none;
  border-color: var(--green);
  background: var(--surface);
  box-shadow: 0 0 0 3px var(--green-100);
}
/* ضربدرِ خودِ مرورگر — ما دکمهٔ خودمان را داریم */
.vsel-search input::-webkit-search-cancel-button { display: none; }

/*
  ⚠️ ذره‌بین با `mask` کشیده می‌شود، نه ایموجی.

  ایموجی 🔍 در هر سیستم‌عامل شکل و رنگ دیگری دارد و با تم تیره
  هماهنگ نمی‌شود. ماسک، رنگ را از `currentColor` می‌گیرد.
*/
.vsel-search-ic {
  position: absolute;
  inset-block-start: 21px; inset-inline-start: 22px;
  width: 15px; height: 15px;
  color: var(--slate); pointer-events: none;
  background: currentColor;
  -webkit-mask: var(--vsel-ic-search) center / contain no-repeat;
  mask: var(--vsel-ic-search) center / contain no-repeat;
}

.vsel-clear {
  position: absolute;
  inset-block-start: 18px; inset-inline-end: 20px;
  width: 22px; height: 22px; cursor: pointer;
  display: none; place-items: center;
  border: 0; border-radius: 50%;
  background: var(--line); color: var(--ink-soft);
  font-size: .62rem; line-height: 1;
  transition: background var(--dur-fast, .12s) var(--ease-out);
}
.vsel-clear:hover { background: var(--line-strong); }
.vsel.has-query .vsel-clear { display: grid; }

/* --------------------------------------------------------------------------
   فهرست
   -------------------------------------------------------------------------- */
.vsel-list {
  flex: 1; min-height: 0;
  list-style: none; margin: 0; padding: 6px;
  overflow-y: auto; overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}
.vsel-list:focus { outline: none; }
.vsel-list::-webkit-scrollbar { width: 7px; }
.vsel-list::-webkit-scrollbar-thumb {
  background: var(--line); border-radius: 999px;
}
.vsel-list::-webkit-scrollbar-thumb:hover { background: var(--slate-light); }

.vsel-opt {
  display: flex; align-items: center; gap: 10px;
  width: 100%; min-height: 44px; padding: 6px 11px;
  border: 1px solid transparent; border-radius: 11px;
  cursor: pointer; background: transparent; color: var(--ink);
  font: inherit; font-size: .85rem; text-align: start;
  transition: background var(--dur-fast, .12s) var(--ease-out),
              color var(--dur-fast, .12s) var(--ease-out),
              border-color var(--dur-fast, .12s) var(--ease-out);
}

/* ⚠️ نشانگر کیبورد از «انتخاب‌شده» جداست — دو معنی متفاوت */
.vsel-opt.is-cursor { background: var(--bg-subtle); }
.vsel-opt:hover { background: var(--bg-subtle); }

.vsel-opt.is-on {
  background: var(--green-100);
  border-color: color-mix(in srgb, var(--green) 34%, transparent);
  color: var(--green-text-soft);
  font-weight: 700;
}

.vsel-opt-ic { flex: none; font-size: 1rem; line-height: 1; }

.vsel-opt-body { flex: 1; min-width: 0; }

.vsel-opt-name {
  display: block; line-height: 1.45;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/*
  ⚠️ مسیر والد، زیر نام.

  فهرست تخت بود و کاربر نمی‌فهمید «کامپیوتر و مانیتور» زیر کدام
  شاخه است. جست‌وجو روی همین متن هم انجام می‌شود.
*/
.vsel-opt-path {
  display: block; margin-top: -1px;
  font-size: .69rem; font-weight: 500; line-height: 1.4;
  color: var(--slate);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.vsel-opt.is-on .vsel-opt-path {
  color: var(--green-text-soft); opacity: .8;
}

.vsel-opt-tick {
  flex: none; width: 15px; height: 15px;
  background: currentColor; color: var(--green);
  opacity: 0; transform: scale(.6);
  -webkit-mask: var(--vsel-ic-tick) center / contain no-repeat;
  mask: var(--vsel-ic-tick) center / contain no-repeat;
  transition: opacity var(--dur-fast, .12s) var(--ease-out),
              transform var(--dur-fast, .12s) var(--ease-out);
}
.vsel-opt.is-on .vsel-opt-tick { opacity: 1; transform: none; }

/* بخشِ منطبق با عبارت جست‌وجو */
.vsel-opt mark {
  background: color-mix(in srgb, var(--green) 26%, transparent);
  color: inherit; border-radius: 3px; padding: 0 1px;
}

/* --------------------------------------------------------------------------
   خالی و پاورقی
   -------------------------------------------------------------------------- */
.vsel-empty {
  display: none;
  padding: 30px 18px; margin: 0; text-align: center;
  color: var(--slate); font-size: .84rem; line-height: 1.9;
}
.vsel.is-empty-result .vsel-empty { display: block; }
.vsel.is-empty-result .vsel-list { display: none; }

.vsel-foot {
  flex: none;
  padding: 8px 14px;
  border-top: 1px solid var(--line);
  background: var(--bg-subtle);
  color: var(--slate); font-size: .72rem;
}

/* --------------------------------------------------------------------------
   موبایل — شیت پایین‌آمدنی
   --------------------------------------------------------------------------
   ⚠️ دلیل وجود کل این کامپوننت همین‌جاست.

   `<select>` بومی را روی اندروید خود سیستم‌عامل رندر می‌کند: شیت
   تیره، بدون جست‌وجو، بی‌خبر از تم و جهت سایت — و با CSS قابل
   کنترل نیست.
   -------------------------------------------------------------------------- */
@media (max-width: 720px) {
  .vsel-veil {
    display: block; position: fixed; inset: 0; z-index: 90;
    background: rgba(8, 20, 14, .5);
    -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px);
    animation: vsel-fade .2s var(--ease-out);
  }
  .vsel-veil[hidden] { display: none; }

  @keyframes vsel-fade { from { opacity: 0; } to { opacity: 1; } }

  .vsel-pop {
    z-index: 91;
    inset-inline: 0; inset-block-end: 0; top: auto;
    /* ⚠️ نه تمام‌صفحه: کاربر باید بفهمد چه چیزی پشتش مانده */
    max-height: 86dvh;
    border-radius: 20px 20px 0 0;
    border-inline: 0; border-block-end: 0;
    padding-bottom: var(--safe-bottom, 0px);
    animation: vsel-up .24s var(--ease-out);
  }

  @keyframes vsel-up {
    from { transform: translateY(100%); }
    to   { transform: none; }
  }

  /* دستهٔ کشیدن — نشانهٔ آشنای «این یک شیت است» */
  .vsel-pop::before {
    content: ""; position: absolute;
    inset-block-start: 8px; inset-inline: 0;
    width: 38px; height: 4px; margin: 0 auto;
    border-radius: 999px; background: var(--line-strong);
  }

  .vsel-head {
    display: flex; align-items: center; gap: 10px;
    flex: none; padding: 20px 14px 10px;
  }
  .vsel-title {
    flex: 1; min-width: 0;
    font-size: .95rem; font-weight: 800; color: var(--ink);
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  }
  .vsel-x {
    width: 36px; height: 36px; flex: none; cursor: pointer;
    display: grid; place-items: center;
    border: 1px solid var(--line); border-radius: 50%;
    background: var(--surface); color: var(--ink);
    font-size: .82rem; line-height: 1;
  }

  .vsel-search { padding: 4px 14px 10px; }
  .vsel-search input {
    padding-block: 13px; padding-inline-start: 44px;
    font-size: .92rem;
  }
  .vsel-search-ic { inset-block-start: 19px; inset-inline-start: 27px; }
  .vsel-clear { inset-block-start: 16px; inset-inline-end: 24px; }

  .vsel-list { padding: 6px 10px 10px; }

  /* ⚠️ هدف لمس دست‌کم ۴۸ پیکسل */
  .vsel-opt {
    min-height: 52px; padding: 9px 12px;
    font-size: .92rem; border-radius: 13px;
  }
  .vsel-opt-path { font-size: .76rem; }
  .vsel-foot { padding: 10px 16px; font-size: .76rem; }
}

@media (prefers-reduced-motion: reduce) {
  .vsel-pop, .vsel-veil { animation: none; }
  .vsel-btn, .vsel-caret, .vsel-opt,
  .vsel-opt-tick, .vsel-clear { transition: none; }
}

/* ==========================================================================
   گفت‌وگوی سفارشی — جایگزین confirm/alert مرورگر

   در `components.css` است نه فایل بخشی، چون همهٔ صفحه‌ها از آن
   استفاده می‌کنند و باید همه‌جا در دسترس باشد.
   ========================================================================== */
.vhd { position: fixed; inset: 0; z-index: 120; }
.vhd[hidden] { display: none; }

.vhd-overlay {
  position: absolute; inset: 0;
  background: rgba(0, 0, 0, .5);
  -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px);
}

/*
  ⚠️ `inset: 0` + `margin: auto` و نه `top: 50%` با ترنسلیت.

  با متن بلند، روش دوم بالای کادر را از صفحه بیرون می‌برد و
  دکمه‌ها دیگر قابل دسترس نیستند.
*/
.vhd-box {
  position: absolute; inset: 0; margin: auto;
  width: min(420px, 92vw); height: max-content; max-height: 86vh;
  overflow-y: auto;
  padding: var(--sp-5, 20px);
  border-radius: var(--r-lg, 18px);
  background: var(--surface, #fff); color: var(--ink, #101614);
  box-shadow: var(--shadow-lg, 0 20px 50px rgba(0, 0, 0, .25));
  text-align: start;
}

.vhd-title {
  display: block; margin-bottom: var(--sp-2, 8px);
  font-size: var(--fs-md, 1rem); font-weight: 800;
}
.vhd-text {
  margin: 0 0 var(--sp-5, 20px);
  font-size: var(--fs-sm, .82rem); line-height: 2;
  color: var(--ink-soft, #3D4C46);
  white-space: pre-wrap;
}

.vhd-actions {
  display: flex; flex-wrap: wrap; gap: var(--sp-2, 8px);
  justify-content: flex-end;
}
.vhd-actions button {
  padding: var(--sp-2, 8px) var(--sp-5, 20px);
  border-radius: var(--r-sm, 10px);
  border: 1px solid var(--line, #E2EAE5);
  background: var(--surface, #fff); color: var(--ink, #101614);
  font: inherit; font-size: var(--fs-sm, .82rem); font-weight: 700;
  cursor: pointer;
}
.vhd-actions button[hidden] { display: none; }

.vhd-yes {
  border-color: var(--band, #0F5132) !important;
  background: var(--band, #0F5132) !important;
  color: var(--on-band, #fff) !important;
}
/* عمل ویرانگر باید رنگش هشدار بدهد، نه اینکه مثل تأیید عادی باشد */
.vhd-yes.is-danger {
  border-color: var(--danger, #DC2626) !important;
  background: var(--danger, #DC2626) !important;
}

/* ⚠️ قفل اسکرول روی ریشه — وگرنه پس‌زمینه زیر گفت‌وگو می‌لغزد */
.vhd-open, .vhd-open body { overflow: hidden; }
