/* ============================================================
   فروشگاه VPN — تم تیره‌ی مدرن، موبایل‌اول، فارسی/RTL
   همه‌چیز خودمیزبان (بدون منبع خارجی) تا هنگام «نت ملی» هم کار کند.
   ============================================================ */

/* ---------- فونت خودمیزبان (Vazirmatn، فایل متغیر) ---------- */
@font-face {
  font-family: "Vazirmatn";
  src: url("/static/fonts/Vazirmatn-Variable.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

/* ---------- توکن‌های طراحی ---------- */
:root {
  --bg: #0b0e1a;
  --bg-2: #0f1424;
  --card: #151a2e;
  --card-2: #1b2138;
  --inset: #0e1324;
  --text: #eef1fa;
  --muted: #98a2c0;
  --faint: #6b7596;

  --accent: #5b8cff;
  --accent-2: #8a6bff;
  --accent-grad: linear-gradient(135deg, #5b8cff 0%, #8a6bff 100%);
  --accent-soft: rgba(91, 140, 255, .14);

  --border: #273052;
  --border-soft: rgba(255, 255, 255, .06);

  --ok: #34d399;
  --warn: #fbbf24;
  --danger: #fb7185;

  --r: 18px;
  --r-md: 14px;
  --r-sm: 10px;
  --pill: 999px;

  --shadow: 0 10px 30px -12px rgba(0, 0, 0, .55);
  --shadow-sm: 0 4px 14px -8px rgba(0, 0, 0, .6);
  --ring: 0 0 0 3px var(--accent-soft);

  --nav-h: 66px;
  --maxw: 780px;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  font-family: "Vazirmatn", Tahoma, "Segoe UI", sans-serif;
  color: var(--text);
  line-height: 1.75;
  background:
    radial-gradient(1200px 600px at 100% -5%, rgba(138, 107, 255, .13), transparent 60%),
    radial-gradient(1000px 500px at -10% 0%, rgba(91, 140, 255, .12), transparent 55%),
    var(--bg);
  background-attachment: fixed;
}

/* فضای خالی زیر صفحه برای نوار پایین در موبایل */
body.has-bottomnav .container {
  padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 24px);
}

h1 { font-size: 1.5rem; margin: 0 0 4px; font-weight: 800; letter-spacing: -.01em; }
h2 { font-size: 1.2rem; font-weight: 700; }
h3 { font-size: 1.08rem; font-weight: 700; margin: 0 0 6px; }
h4 { font-size: .98rem; font-weight: 700; margin: 0 0 6px; color: var(--text); }
p { margin: 8px 0; }
a { color: var(--accent); }

::selection { background: rgba(91, 140, 255, .3); }

/* اسکرول‌بار نازک و تیره */
* { scrollbar-width: thin; scrollbar-color: var(--border) transparent; }
*::-webkit-scrollbar { width: 9px; height: 9px; }
*::-webkit-scrollbar-thumb { background: var(--border); border-radius: 99px; }

/* ============================================================
   نوار بالا (هدر)
   ============================================================ */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  padding-top: calc(10px + env(safe-area-inset-top));
  /* پس‌زمینه‌ی تمام‌رنگ عمدی است: backdrop-filter روی هدر باعث می‌شد
     نوار ناوبریِ fixed به‌جای پایینِ صفحه به هدر بچسبد (containing block). */
  background: var(--bg-2);
  border-bottom: 1px solid var(--border-soft);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text);
  font-weight: 800;
  flex: 0 0 auto;
}
.brand-logo {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 11px;
  background: var(--accent-grad);
  box-shadow: 0 6px 16px -6px rgba(91, 140, 255, .7);
}
.brand-logo svg { width: 22px; height: 22px; fill: #fff; }
.brand-name {
  font-size: 1.08rem;
  white-space: nowrap;
  max-width: 48vw;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* جعبه‌ی کاربر */
.userbox {
  margin-inline-start: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
  min-width: 0;
}
.user-id {
  font-size: .85rem;
  font-variant-numeric: tabular-nums;
  direction: ltr;
}

/* نشان مدیر */
.badge {
  display: inline-block;
  background: rgba(52, 211, 153, .16);
  color: var(--ok);
  padding: 3px 9px;
  border-radius: var(--pill);
  font-size: .72rem;
  font-weight: 700;
  border: 1px solid rgba(52, 211, 153, .3);
  white-space: nowrap;
}
.badge-admin { background: var(--accent-soft); color: #9db8ff; border-color: rgba(91, 140, 255, .35); }
.badge-off { background: rgba(152, 162, 192, .18); color: var(--muted); border-color: var(--border); }

/* زنگِ اعلان */
.notif-bell {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  text-decoration: none;
  color: var(--muted);
  transition: background .15s, color .15s;
}
.notif-bell:hover, .notif-bell:focus-visible { background: var(--accent-soft); color: var(--text); }
.notif-icon svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; display: block; }
.notif-badge {
  position: absolute;
  top: 4px;
  inset-inline-end: 4px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  background: var(--danger);
  color: #fff;
  border: 2px solid var(--bg-2);
  border-radius: var(--pill);
  font-size: .68rem;
  font-weight: 800;
  line-height: 15px;
  text-align: center;
}
.notif-enable { font-size: .78rem; padding: 7px 12px; }

.btn-logout { padding: 9px 11px; }
.btn-logout .nav-ic { width: 19px; height: 19px; }
.btn-logout-label { display: none; }

/* ============================================================
   ناوبری — پایین در موبایل، درون هدر در دسکتاپ
   ============================================================ */
.mainnav {
  position: fixed;
  z-index: 60;
  inset-inline: 0;
  bottom: 0;
  display: flex;
  justify-content: space-around;
  gap: 2px;
  padding: 6px 8px;
  padding-bottom: calc(6px + env(safe-area-inset-bottom));
  background: rgba(13, 17, 32, .92);
  backdrop-filter: saturate(150%) blur(16px);
  -webkit-backdrop-filter: saturate(150%) blur(16px);
  border-top: 1px solid var(--border-soft);
}
.nav-link {
  flex: 1 1 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  min-height: 54px;
  padding: 6px 4px;
  border-radius: 14px;
  text-decoration: none;
  color: var(--muted);
  font-size: .72rem;
  font-weight: 600;
  transition: color .15s, background .15s;
  -webkit-tap-highlight-color: transparent;
}
.nav-link:hover, .nav-link:focus-visible { color: var(--text); background: rgba(255, 255, 255, .04); }
.nav-link:active { background: var(--accent-soft); color: var(--text); }
.nav-ic { width: 23px; height: 23px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; display: block; }
.nav-label { line-height: 1.2; }

/* ============================================================
   چیدمان صفحه
   ============================================================ */
.container {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 20px 16px 32px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.footer { text-align: center; color: var(--faint); padding: 8px 20px 28px; font-size: .85rem; display: flex; gap: 14px; justify-content: center; align-items: center; }
.footer-link { color: var(--muted); }
.footer-link:hover { color: #9db8ff; }

.muted { color: var(--muted); }
.todo { color: var(--muted); }
.todo li { margin: 6px 0; }

.row-between { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }

/* ---------- کارت ---------- */
.card {
  background: linear-gradient(180deg, var(--card-2), var(--card));
  border: 1px solid var(--border-soft);
  border-radius: var(--r);
  padding: 20px;
  box-shadow: var(--shadow-sm);
}
.card + .card { margin-top: 0; }

.auth-card {
  max-width: 420px;
  margin: 8vh auto 0;
  padding: 28px 24px;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}
.auth-card::before {
  content: "";
  position: absolute;
  inset: -1px -1px auto -1px;
  height: 3px;
  background: var(--accent-grad);
}

/* ---------- فرم‌ها ---------- */
.form { display: flex; flex-direction: column; gap: 12px; margin-top: 16px; }
.form label { font-size: .86rem; color: var(--muted); font-weight: 600; margin-bottom: -4px; }

.form input,
.form textarea,
.form select,
.news-input, .news-textarea, .news-select {
  width: 100%;
  padding: 13px 15px;
  border-radius: var(--r-sm);
  border: 1px solid var(--border);
  background: var(--inset);
  color: var(--text);
  font-family: inherit;
  font-size: 1rem;
  letter-spacing: normal;
  text-align: start;
  transition: border-color .15s, box-shadow .15s, background .15s;
  min-height: 48px;
}
.form textarea, .news-textarea { min-height: 84px; resize: vertical; line-height: 1.8; }
.form input:focus,
.form textarea:focus,
.form select:focus,
.news-input:focus, .news-textarea:focus, .news-select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: var(--ring);
  background: #0c1120;
}
.form input::placeholder, .form textarea::placeholder { color: var(--faint); }

/* فیلدهای احراز هویت کمی بزرگ‌تر */
.auth-card .form input { font-size: 1.1rem; padding: 14px 16px; }

/* فایل‌انتخاب‌کن */
input[type="file"] {
  width: 100%;
  font-size: .9rem;
  color: var(--muted);
  padding: 9px 12px;
  border: 1px dashed var(--border);
  border-radius: var(--r-sm);
  background: var(--inset);
  cursor: pointer;
}
input[type="file"]::file-selector-button {
  font-family: inherit;
  margin-inline-end: 12px;
  padding: 8px 14px;
  border: none;
  border-radius: var(--r-sm);
  background: var(--accent-soft);
  color: #bcd0ff;
  font-weight: 600;
  cursor: pointer;
}

/* ---------- دکمه‌ها ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 18px;
  min-height: 46px;
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  background: var(--accent-grad);
  color: #fff;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  text-align: center;
  line-height: 1.2;
  box-shadow: 0 8px 20px -10px rgba(91, 140, 255, .8);
  transition: transform .08s, box-shadow .15s, filter .15s, background .15s;
  -webkit-tap-highlight-color: transparent;
}
.btn:hover { filter: brightness(1.06); box-shadow: 0 10px 24px -8px rgba(91, 140, 255, .9); }
.btn:active { transform: translateY(1px) scale(.99); }
.btn:focus-visible { outline: none; box-shadow: var(--ring); }

.btn-ghost {
  background: rgba(255, 255, 255, .035);
  border: 1px solid var(--border);
  color: var(--text);
  box-shadow: none;
  font-weight: 600;
}
.btn-ghost:hover { background: var(--accent-soft); border-color: var(--accent); filter: none; box-shadow: none; }

.btn-danger { background: linear-gradient(135deg, #fb7185, #e11d48); box-shadow: 0 8px 20px -10px rgba(251, 113, 133, .8); }

.btn-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.btn-row form { margin: 0; }

/* ---------- هشدارها ---------- */
.alert {
  padding: 12px 15px;
  border-radius: var(--r-sm);
  margin: 14px 0;
  font-size: .95rem;
  border: 1px solid transparent;
  display: flex;
  gap: 8px;
  align-items: flex-start;
}
.alert.error { background: rgba(251, 113, 133, .1); color: #ffc2cc; border-color: rgba(251, 113, 133, .3); }
.alert.dev { background: var(--accent-soft); color: #c6d6ff; border-color: rgba(91, 140, 255, .3); }
.alert.ok { background: rgba(52, 211, 153, .1); color: #a7f3d0; border-color: rgba(52, 211, 153, .3); }
.alert .code { font-size: 1.3rem; letter-spacing: 3px; font-weight: 800; }

/* فرم افزودن کاربر (صفحه‌ی مدیریت کاربران) */
.adduser-form { display: flex; gap: 8px; margin: 10px 0 14px; flex-wrap: wrap; align-items: center; }
.adduser-form input[name="telegram_id"] { flex: 0 0 160px; }
.adduser-form input[name="note"] { flex: 1 1 180px; min-width: 0; }
.adduser-form select { flex: 0 0 auto; }
.adduser-form .btn { flex: 0 0 auto; }

.hint { margin-top: 16px; font-size: .86rem; color: var(--muted); }
.hint a { color: var(--accent); font-weight: 600; }

/* ============================================================
   کاشی‌های صفحه‌ی اصلی و پنل
   ============================================================ */
.tiles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
}
.tile {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  min-height: 92px;
  padding: 18px 14px;
  text-decoration: none;
  background: linear-gradient(180deg, var(--card-2), var(--card));
  border: 1px solid var(--border-soft);
  border-radius: var(--r);
  color: var(--text);
  font-weight: 700;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: transform .12s, border-color .15s, box-shadow .15s;
}
.tile::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 3px;
  background: var(--accent-grad);
  opacity: .0;
  transition: opacity .15s;
}
.tile:hover, .tile:focus-visible {
  transform: translateY(-3px);
  border-color: rgba(91, 140, 255, .4);
  box-shadow: var(--shadow);
}
.tile:hover::before, .tile:focus-visible::before { opacity: 1; }
.tile-title { font-size: 1.02rem; line-height: 1.5; }

/* کاشی با آیکون (صفحه‌ی اصلی) */
.tile-icon { flex-direction: column; gap: 10px; }
.tile-ic {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 13px;
  background: var(--accent-soft);
  color: #9db8ff;
}
.tile-ic .nav-ic { width: 25px; height: 25px; }
.tile:hover .tile-ic { background: var(--accent-grad); color: #fff; }
.tile-soon { opacity: .55; cursor: default; }
.tile-soon:hover { transform: none; border-color: var(--border-soft); box-shadow: var(--shadow-sm); }
.tile-soon:hover::before { opacity: 0; }

/* ============================================================
   محصولات
   ============================================================ */
.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 14px;
}
.product { display: flex; flex-direction: column; transition: transform .12s, border-color .15s, box-shadow .15s; }
.product:hover { transform: translateY(-3px); border-color: rgba(91, 140, 255, .35); box-shadow: var(--shadow); }
.product-name { margin: 0 0 8px; }
.product-desc { flex: 1; white-space: pre-wrap; font-size: .92rem; }
.product-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--border-soft);
}
.price {
  color: var(--ok);
  font-weight: 800;
  font-size: 1.05rem;
  font-variant-numeric: tabular-nums;
}

/* ============================================================
   جدول‌ها
   ============================================================ */
.table-wrap {
  overflow-x: auto;
  margin-top: 14px;
  border-radius: var(--r-md);
  border: 1px solid var(--border-soft);
}
.otable { width: 100%; border-collapse: collapse; font-size: .94rem; }
.otable th, .otable td {
  padding: 12px 14px;
  text-align: right;
  border-bottom: 1px solid var(--border-soft);
  white-space: nowrap;
}
.otable thead th {
  color: var(--muted);
  font-weight: 700;
  font-size: .82rem;
  background: rgba(255, 255, 255, .02);
}
.otable tbody tr { transition: background .12s; }
.otable tbody tr:hover { background: rgba(91, 140, 255, .05); }
.otable tbody tr:last-child td { border-bottom: none; }
.otable td.btn-row { display: table-cell; white-space: nowrap; }
.otable td.btn-row .btn { margin-inline-start: 6px; }
.otable td.btn-row form { display: inline; }

/* ---------- وضعیت‌ها ---------- */
.status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 11px;
  border-radius: var(--pill);
  font-size: .8rem;
  font-weight: 700;
  white-space: nowrap;
  border: 1px solid transparent;
}
.status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.status-awaiting_receipt { background: rgba(251, 191, 36, .13); color: var(--warn); border-color: rgba(251, 191, 36, .3); }
.status-pending { background: var(--accent-soft); color: #9db8ff; border-color: rgba(91, 140, 255, .3); }
.status-approved { background: rgba(52, 211, 153, .13); color: var(--ok); border-color: rgba(52, 211, 153, .3); }
.status-rejected { background: rgba(251, 113, 133, .13); color: var(--danger); border-color: rgba(251, 113, 133, .3); }

/* ============================================================
   جعبه‌های سفارش (پرداخت/کانفیگ)
   ============================================================ */
.pay-box, .config-box { margin-top: 16px; }
.pay-info, .config {
  background: var(--inset);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 15px;
  white-space: pre-wrap;
  word-break: break-all;
  font-family: inherit;
  margin: 6px 0;
}
.config {
  direction: ltr;
  text-align: left;
  font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
  font-size: .9rem;
  line-height: 1.7;
}

/* ردیف‌های پرداخت (مبلغ/ریال/شماره کارت) با دکمه‌ی کپی */
.pay-rows { display: flex; flex-direction: column; gap: 10px; margin: 6px 0 12px; }
.pay-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 12px 14px;
  border: 1px solid var(--border-soft);
  border-radius: var(--r-sm);
  background: var(--inset);
}
.pay-row-amount {
  border-color: rgba(91, 140, 255, .45);
  background: var(--accent-soft);
}
.pay-label { color: var(--muted); font-size: .9rem; }
.pay-value {
  margin-inline-start: auto;
  font-weight: 700;
  font-size: 1.12rem;
  letter-spacing: .3px;
}
.pay-value small { font-weight: 500; font-size: .8rem; color: var(--muted); }
.pay-card { letter-spacing: 2px; font-size: 1.05rem; }
.btn-copy {
  flex: 0 0 auto;
  border: 1px solid var(--border);
  background: var(--bg-2);
  color: var(--text);
  border-radius: var(--r-sm);
  padding: 7px 14px;
  font-family: inherit;
  font-size: .85rem;
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease, color .15s ease;
}
.btn-copy:hover { border-color: var(--accent); color: #9db8ff; }
.btn-copy.copied { background: rgba(52, 211, 153, .15); border-color: rgba(52, 211, 153, .4); color: var(--ok); }
.pay-hint { margin: 4px 2px 0; font-size: .85rem; }

/* دکمه‌ی چشمِ نمایش رمز */
.pw-wrap { position: relative; display: block; }
.pw-wrap input { padding-inline-end: 44px; width: 100%; }
.pw-eye {
  position: absolute; inset-inline-end: 6px; top: 50%; transform: translateY(-50%);
  width: 34px; height: 34px; display: flex; align-items: center; justify-content: center;
  background: none; border: none; cursor: pointer; color: var(--muted); padding: 0;
}
.pw-eye:hover { color: #9db8ff; }
.pw-eye svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.pw-eye .eye-off { display: none; }
.pw-wrap.revealed .pw-eye .eye { display: none; }
.pw-wrap.revealed .pw-eye .eye-off { display: block; }
.pay-warning {
  margin: 0 0 12px; padding: 12px 14px; border-radius: var(--r-sm);
  background: rgba(251, 191, 36, .14); border: 1px solid rgba(251, 191, 36, .45);
  color: var(--warn); font-weight: 700; font-size: .95rem; line-height: 1.7;
}

/* صفحه‌ی درباره ما */
.about-text { white-space: pre-wrap; line-height: 2; color: var(--text); }

/* آمار و گزارش */
.stat-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px; margin-top: 14px;
}
.stat-card {
  padding: 16px; border: 1px solid var(--border-soft); border-radius: var(--r-md);
  background: var(--inset); text-align: center;
}
.stat-online { border-color: rgba(52, 211, 153, .5); background: rgba(52, 211, 153, .1); }
.stat-num { font-size: 1.9rem; font-weight: 800; line-height: 1.2; color: var(--text); }
.stat-online .stat-num { color: var(--ok); }
.stat-label { color: var(--muted); font-size: .85rem; margin-top: 4px; }
.stat-sub { color: var(--faint); font-size: .78rem; margin-top: 2px; }

.chart {
  display: flex; align-items: flex-end; gap: 8px; height: 180px; margin-top: 14px;
  padding: 10px; border: 1px solid var(--border-soft); border-radius: var(--r-md); background: var(--inset);
}
.chart-col { flex: 1 1 0; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 4px; }
.chart-bar {
  width: 70%; min-height: 3px; border-radius: 6px 6px 0 0;
  background: linear-gradient(180deg, #5b8cff, #8a6bff);
}
.chart-val { font-size: .8rem; color: var(--muted); }
.chart-day { font-size: .72rem; color: var(--faint); }

/* نوار جست‌وجوی کاربران */
.search-form { display: flex; gap: 8px; margin: 10px 0 6px; flex-wrap: wrap; }
.search-form input { flex: 1 1 200px; min-width: 0; }
.search-form .btn { flex: 0 0 auto; }

/* صفحه‌بندی */
.pager { display: flex; align-items: center; justify-content: center; gap: 12px; margin-top: 14px; flex-wrap: wrap; }
.pager-info { color: var(--muted); font-size: .9rem; }
.btn.disabled { opacity: .4; pointer-events: none; }

/* ردیفِ کاربرِ دارای تیکت باز */
.row-ticket { background: var(--accent-soft); }
.badge-danger { background: rgba(251, 113, 133, .16); color: var(--danger); border-color: rgba(251, 113, 133, .35); }

/* فهرست دستگاه‌های کاربر */
.device-list { list-style: none; padding: 0; margin: 8px 0 0; display: flex; flex-direction: column; gap: 8px; }
.device-list li {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 10px 12px; border: 1px solid var(--border-soft); border-radius: var(--r-sm);
  background: var(--inset); font-size: .9rem;
}
.device-id { font-family: ui-monospace, Consolas, monospace; }

/* جعبه‌ی پیام پشتیبانی در صفحه ورود */
.support-box summary {
  cursor: pointer;
  font-weight: 600;
  padding: 4px 0;
  color: #9db8ff;
  list-style: none;
}
.support-box summary::-webkit-details-marker { display: none; }
.support-box summary::before { content: "💬 "; }
.support-box[open] summary { margin-bottom: 8px; }

/* فهرست پیام‌های پشتیبانی (پنل مدیر) */
.support-list { display: flex; flex-direction: column; gap: 12px; margin-top: 12px; }
.support-item {
  border: 1px solid var(--border-soft);
  border-radius: var(--r-md);
  padding: 14px;
  background: rgba(255, 255, 255, .02);
}
.support-unread { border-color: rgba(91, 140, 255, .5); background: var(--accent-soft); }
.support-head { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; font-size: .88rem; }
.support-from { font-weight: 700; }
.support-body { white-space: pre-wrap; word-break: break-word; margin: 4px 0; line-height: 1.7; }
.support-thread { display: flex; flex-direction: column; gap: 8px; margin: 10px 0; }
.support-msg { padding: 8px 10px; border-radius: var(--r-sm); background: var(--inset); }
.support-msg-time { font-size: .78rem; }

/* پیام‌های آماده (چیپ‌ها بالای فرم چت) */
.canned-row { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.canned-chip {
  border: 1px solid var(--border-soft); background: var(--inset); color: var(--muted);
  border-radius: 999px; padding: 5px 12px; font-family: inherit; font-size: .82rem;
  cursor: pointer; transition: border-color .15s, color .15s;
}
.canned-chip:hover { border-color: var(--accent); color: #9db8ff; }

/* پنل تایید سریع رسیدها */
.receipt-list { display: flex; flex-direction: column; gap: 14px; }
.receipt-thumb {
  max-width: 100%; max-height: 320px; border-radius: var(--r-sm);
  border: 1px solid var(--border); margin-top: 8px; display: block;
}
.receipt-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.receipt-actions form { display: inline; margin: 0; }
.receipt-nav { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.shortcuts-help { margin-top: 12px; font-size: .85rem; }
kbd {
  display: inline-block; font-family: ui-monospace, Consolas, monospace; font-size: .8em;
  padding: 1px 6px; border: 1px solid var(--border); border-bottom-width: 2px;
  border-radius: 5px; background: var(--bg-2); color: var(--text); margin-inline-start: 4px;
}
.support-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.btn-danger { color: var(--danger); }
.btn-danger:hover { border-color: var(--danger); }

.admin-item {
  border: 1px solid var(--border-soft);
  border-radius: var(--r-md);
  padding: 16px;
  margin-bottom: 14px;
  background: rgba(255, 255, 255, .02);
}
.admin-item .form input, .admin-item .form textarea { letter-spacing: normal; }

/* فهرست چک‌باکس (انتخاب inbound) */
.checks { display: flex; flex-direction: column; gap: 6px; margin: 8px 0 14px; }
.check {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  padding: 10px 12px;
  border: 1px solid var(--border-soft);
  border-radius: var(--r-sm);
  background: var(--inset);
  font-size: .92rem;
}
.check input { width: auto; min-height: 0; margin: 0; }

/* چک‌باکس/اینپوت‌های کوچک با رنگ برند */
input[type="checkbox"], input[type="radio"] { accent-color: var(--accent); width: 18px; height: 18px; }

/* ============================================================
   چت
   ============================================================ */
.chat-box {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 60vh;
  overflow-y: auto;
  padding: 14px;
  background: var(--inset);
  border: 1px solid var(--border-soft);
  border-radius: var(--r-md);
  margin: 14px 0;
}
.bubble {
  max-width: 80%;
  padding: 10px 14px;
  border-radius: 16px;
  line-height: 1.6;
  font-size: .95rem;
  box-shadow: var(--shadow-sm);
  animation: bubble-in .18s ease;
}
@keyframes bubble-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.bubble-text { white-space: pre-wrap; word-break: break-word; }
.bubble.mine { align-self: flex-start; background: var(--accent-grad); color: #fff; border-bottom-right-radius: 5px; }
.bubble.theirs { align-self: flex-end; background: var(--card-2); border: 1px solid var(--border-soft); border-bottom-left-radius: 5px; }
.bubble-img, .bubble-video { max-width: min(240px, 60vw); border-radius: 12px; margin-top: 6px; display: block; }

.chat-form { display: flex; flex-direction: column; gap: 10px; }
.chat-form textarea {
  padding: 12px 14px;
  border-radius: var(--r-sm);
  border: 1px solid var(--border);
  background: var(--inset);
  color: var(--text);
  font-family: inherit;
  font-size: 1rem;
  letter-spacing: normal;
  min-height: 56px;
  resize: vertical;
  transition: border-color .15s, box-shadow .15s;
}
.chat-form textarea:focus { outline: none; border-color: var(--accent); box-shadow: var(--ring); }
.chat-form-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.chat-form-row input[type="file"] { flex: 1 1 160px; }

/* فهرست گفتگوها */
.thread-list { list-style: none; padding: 0; margin: 14px 0 0; display: flex; flex-direction: column; gap: 8px; }
.thread-list li { margin: 0; }
.thread-link {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border: 1px solid var(--border-soft);
  border-radius: var(--r-md);
  background: rgba(255, 255, 255, .02);
  text-decoration: none;
  color: var(--text);
  transition: border-color .15s, background .15s, transform .1s;
}
.thread-link:hover { border-color: rgba(91, 140, 255, .4); background: var(--accent-soft); transform: translateX(-3px); }

/* ============================================================
   دسکتاپ — ناوبری به داخل هدر می‌رود
   ============================================================ */
@media (min-width: 720px) {
  :root { --nav-h: 0px; }

  .topbar { padding: 12px 24px; gap: 20px; }
  .brand-name { max-width: none; font-size: 1.15rem; }

  .mainnav {
    position: static;
    inset: auto;
    flex: 1 1 auto;
    min-width: 0;
    background: none;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    border: none;
    padding: 0;
    gap: 4px;
    margin-inline-start: 8px;
    justify-content: flex-start;
    overflow-x: auto;
    scrollbar-width: none;
  }
  .mainnav::-webkit-scrollbar { display: none; }
  .nav-link {
    flex: 0 0 auto;
    flex-direction: row;
    gap: 8px;
    min-height: 40px;
    padding: 8px 14px;
    border-radius: var(--pill);
    font-size: .95rem;
    font-weight: 600;
  }
  .nav-ic { width: 19px; height: 19px; }

  .btn-logout-label { display: inline; }
  .btn-logout { padding: 9px 14px; }

  .container { padding: 28px 24px 40px; gap: 18px; }
  h1 { font-size: 1.7rem; }
}

@media (min-width: 720px) {
  body.has-bottomnav .container { padding-bottom: 40px; }
}

/* دسترس‌پذیری: احترام به کاهش حرکت */
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}

/* ============================================================
   اصلاح سرریز نوار بالا در موبایل (زیر ۷۲۰px)
   جعبه‌ی کاربر نباید پهن‌تر از صفحه شود.
   ============================================================ */
@media (max-width: 719px) {
  .topbar { flex-wrap: nowrap; }
  .user-id { display: none; }
  .brand-name { max-width: 32vw; }
  /* دکمه‌ی فعال‌کردن اعلان‌ها در موبایل آیکونی و جمع‌وجور */
  .notif-enable {
    font-size: 0;
    width: 42px;
    height: 42px;
    padding: 0;
    display: inline-grid;
    place-items: center;
  }
  .notif-enable::before { content: "🔔"; font-size: 1.05rem; line-height: 1; }
}
