/* ============================================================
   🆕 (Update 37) ویجت‌هایِ داشبورد — مشترک بینِ صفحاتِ واقعی (/dashboard، /) و پیش‌نمایشِ سازنده‌ی داشبورد.
   واکنش‌گرایی با Container Query ⇒ پیش‌نمایشِ «موبایل» در پنلِ ادمین هم دقیقاً مثلِ گوشی چیده می‌شود.
   ============================================================ */

.dbw {
  --dbw-surface: var(--tm-c-surface, #ffffff);
  --dbw-bg: var(--tm-c-bg, #f5f5f3);
  --dbw-border: var(--tm-c-border, rgba(0,0,0,.08));
  --dbw-text: var(--tm-c-text, #1a1a18);
  --dbw-text-2: var(--tm-c-text-2, #5a5a56);
  --dbw-text-3: var(--tm-c-text-3, #8a8984);
  --dbw-accent: #2563eb;
  container-type: inline-size;
  font-family: 'Vazirmatn', system-ui, sans-serif;
  color: var(--dbw-text);
}
[data-theme="dark"] .dbw {
  --dbw-surface: #1c1d22; --dbw-bg: #15161a; --dbw-border: rgba(255,255,255,.09);
  --dbw-text: #f1f1ef; --dbw-text-2: #b3b3ad; --dbw-text-3: #85857e;
}
.dbw *, .dbw *::before, .dbw *::after { box-sizing: border-box; }

/* رنگ‌هایِ ازپیش‌تعریف‌شده (DashboardColors) */
.dbw .c-amber   { --h1: #f59e0b; --h2: #ea580c; --tint: rgba(245,158,11,.12); --ink: #b45309; }
.dbw .c-rose    { --h1: #f43f5e; --h2: #9333ea; --tint: rgba(244,63,94,.10);  --ink: #be123c; }
.dbw .c-sky     { --h1: #0ea5e9; --h2: #2563eb; --tint: rgba(14,165,233,.11); --ink: #0369a1; }
.dbw .c-emerald { --h1: #10b981; --h2: #0d9488; --tint: rgba(16,185,129,.11); --ink: #047857; }
.dbw .c-violet  { --h1: #8b5cf6; --h2: #6d28d9; --tint: rgba(139,92,246,.11); --ink: #6d28d9; }
.dbw .c-indigo  { --h1: #6366f1; --h2: #4338ca; --tint: rgba(99,102,241,.11); --ink: #4338ca; }
.dbw .c-teal    { --h1: #14b8a6; --h2: #0f766e; --tint: rgba(20,184,166,.11); --ink: #0f766e; }
.dbw .c-slate   { --h1: #64748b; --h2: #334155; --tint: rgba(100,116,139,.11); --ink: #334155; }
[data-theme="dark"] .dbw :is(.c-amber, .c-rose, .c-sky, .c-emerald, .c-violet, .c-indigo, .c-teal, .c-slate) { --ink: color-mix(in srgb, var(--h1) 70%, #fff); }

/* ── رندرکننده: فاصله‌ی بلوک‌ها و نمایشِ موبایل/دسکتاپ ── */
.dbr { max-width: 980px; margin: 0 auto; display: flex; flex-direction: column; gap: 18px; }
.dbr-block { min-width: 0; }
@container (max-width: 640px) { .dbr-on-desktop { display: none; } }
@container (min-width: 641px) { .dbr-on-mobile { display: none; } }
.dbr-notice { font-size: 12px; color: var(--dbw-text-3); border: 1px dashed var(--dbw-border); border-radius: 12px; padding: 10px 12px; display: flex; gap: 6px; align-items: center; }
.dbr-empty { text-align: center; padding: 40px 16px; color: var(--dbw-text-3); font-size: 13px; }
.dbr-empty i { font-size: 34px; display: block; margin-bottom: 8px; }

/* ── کارت‌هایِ ویژه (PromoCards) ── */
.sdq-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 10px; margin: 0 2px 12px; }
.sdq-eyebrow { font-size: 11px; font-weight: 800; color: var(--dbw-accent); letter-spacing: .02em; display: inline-flex; align-items: center; gap: 4px; }
.sdq-title { font-size: 17px; font-weight: 800; margin-top: 2px; line-height: 1.5; }
.sdq-sub { font-size: 12px; color: var(--dbw-text-3); }

.sdq-grid { display: grid; grid-template-columns: repeat(var(--cols, 4), minmax(0, 1fr)); gap: 12px; }
.sdq-card {
  --h1: #0ea5e9; --h2: #2563eb; --tint: rgba(14,165,233,.11); --ink: #0369a1;
  position: relative; overflow: hidden; isolation: isolate;
  display: flex; flex-direction: column; align-items: flex-start; gap: 8px; text-align: right;
  min-height: 188px; padding: 16px 14px 14px;
  background: linear-gradient(160deg, var(--tint), transparent 62%), var(--dbw-surface);
  border: 1px solid var(--dbw-border); border-radius: 18px;
  color: inherit; font: inherit; cursor: pointer; text-decoration: none;
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
  -webkit-tap-highlight-color: transparent;
}
.sdq-card:hover { transform: translateY(-3px); border-color: color-mix(in srgb, var(--h1) 45%, transparent); box-shadow: 0 12px 28px -12px color-mix(in srgb, var(--h2) 55%, transparent); color: inherit; text-decoration: none; }
.sdq-card:active { transform: translateY(-1px) scale(.99); }
.sdq-card:focus-visible { outline: 3px solid color-mix(in srgb, var(--h1) 55%, transparent); outline-offset: 2px; }
.sdq-card.is-static { cursor: default; }
.sdq-card.is-static:hover { transform: none; }
.sdq-watermark { position: absolute; z-index: -1; left: -14px; bottom: -22px; font-size: 104px; line-height: 1; color: var(--h1); opacity: .08; transform: rotate(-12deg); pointer-events: none; }
.sdq-icon { width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; flex-shrink: 0;
  color: #fff; font-size: 23px; background: linear-gradient(135deg, var(--h1), var(--h2)); box-shadow: 0 8px 18px -8px var(--h2); }
.sdq-card-top { width: 100%; display: flex; align-items: flex-start; justify-content: space-between; gap: 6px; }
.sdq-tag { font-size: 10px; font-weight: 800; padding: 3px 8px; border-radius: 999px; white-space: nowrap; color: var(--ink); background: color-mix(in srgb, var(--h1) 14%, transparent); }
.sdq-name { font-size: 16px; font-weight: 900; line-height: 1.4; }
.sdq-tagline { font-size: 12px; line-height: 1.85; color: var(--dbw-text-2); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.sdq-foot { margin-top: auto; width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 6px; padding-top: 4px; }
.sdq-stat { font-size: 11px; font-weight: 800; color: var(--ink); display: inline-flex; align-items: center; gap: 4px; min-width: 0; }
.sdq-stat span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sdq-go { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; flex-shrink: 0;
  background: color-mix(in srgb, var(--h1) 14%, transparent); color: var(--ink); transition: transform .18s ease, background .18s ease; }
.sdq-card:hover .sdq-go, .sdq-card:focus-visible .sdq-go { background: linear-gradient(135deg, var(--h1), var(--h2)); color: #fff; transform: translateX(-3px); }

@container (max-width: 760px) {
  .sdq-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .sdq-card { min-height: 172px; padding: 14px 12px 12px; border-radius: 16px; }
  .sdq-name { font-size: 15px; }
  .sdq-tagline { font-size: 11.5px; }
}
@container (max-width: 360px) {
  .sdq-tagline { -webkit-line-clamp: 4; }
  .sdq-stat span { white-space: normal; }
}

/* ── بنرِ خوش‌آمد (Welcome) ── */
.dbw-welcome { --h1: #6366f1; --h2: #4338ca; --tint: rgba(99,102,241,.11); --ink: #4338ca;
  position: relative; overflow: hidden; isolation: isolate; border-radius: 20px; padding: 20px 22px;
  border: 1px solid color-mix(in srgb, var(--h1) 28%, var(--dbw-border));
  background: radial-gradient(120% 140% at 0% 0%, color-mix(in srgb, var(--h1) 16%, transparent), transparent 60%), var(--dbw-surface);
  display: flex; align-items: center; gap: 16px; }
.dbw-welcome-ic { width: 56px; height: 56px; border-radius: 18px; display: grid; place-items: center; flex-shrink: 0; font-size: 28px; color: #fff;
  background: linear-gradient(135deg, var(--h1), var(--h2)); box-shadow: 0 10px 22px -10px var(--h2); }
.dbw-welcome-body { flex: 1; min-width: 0; }
.dbw-welcome-eyebrow { font-size: 11px; font-weight: 800; color: var(--ink); }
.dbw-welcome-title { font-size: 19px; font-weight: 900; line-height: 1.55; }
.dbw-welcome-sub { font-size: 13px; line-height: 1.9; color: var(--dbw-text-2); margin-top: 2px; white-space: pre-line; }
.dbw-welcome-btn { border-radius: 999px; padding: 10px 20px; font-size: 13px; font-weight: 800; color: #fff; text-decoration: none; white-space: nowrap;
  background: linear-gradient(135deg, var(--h1), var(--h2)); box-shadow: 0 8px 18px -8px var(--h2); display: inline-flex; align-items: center; gap: 6px; }
.dbw-welcome-btn:hover { color: #fff; filter: brightness(1.06); text-decoration: none; }
.dbw-welcome-btn:focus-visible { outline: 3px solid color-mix(in srgb, var(--h1) 50%, transparent); outline-offset: 2px; }
.dbw-welcome-wm { position: absolute; z-index: -1; left: -10px; bottom: -30px; font-size: 130px; color: var(--h1); opacity: .07; transform: rotate(-12deg); }
@container (max-width: 560px) {
  .dbw-welcome { flex-wrap: wrap; padding: 16px; }
  .dbw-welcome-ic { width: 46px; height: 46px; font-size: 23px; border-radius: 14px; }
  .dbw-welcome-title { font-size: 16.5px; }
  .dbw-welcome-btn { width: 100%; justify-content: center; }
}

/* ── بنرِ اشتراک ── */
.sda-sub-banner { display: flex; align-items: center; gap: 14px; border-radius: 16px; padding: 14px 18px; color: var(--dbw-text); }
.sda-sub-banner.warn { background: linear-gradient(90deg, #fff7ed, var(--dbw-surface)); border: 1px solid #fed7aa; }
.sda-sub-banner.ok { background: linear-gradient(90deg, #f0fdf4, var(--dbw-surface)); border: 1px solid #bbf7d0; }
.sda-sub-banner.loading { justify-content: center; color: var(--dbw-text-3); font-size: 12px; background: var(--dbw-surface); border: 1px solid var(--dbw-border); }
[data-theme="dark"] .sda-sub-banner.warn { background: linear-gradient(90deg, rgba(234,88,12,.16), #1c1d22); border-color: rgba(234,88,12,.35); }
[data-theme="dark"] .sda-sub-banner.ok { background: linear-gradient(90deg, rgba(22,163,74,.16), #1c1d22); border-color: rgba(22,163,74,.35); }
.sda-sub-icon { width: 44px; height: 44px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 20px; flex-shrink: 0; }
.sda-sub-banner.warn .sda-sub-icon { background: #ffedd5; color: #c2410c; }
.sda-sub-banner.ok .sda-sub-icon { background: #dcfce7; color: #15803d; }
.sda-sub-text { flex: 1; min-width: 0; }
.sda-sub-title { font-size: 13.5px; font-weight: 700; }
.sda-sub-sub { font-size: 11.5px; color: var(--dbw-text-2); margin-top: 2px; }
.sda-sub-btn { background: #2563eb; color: #fff; border: none; border-radius: 9999px; padding: 9px 18px; font-size: 12px; font-weight: 700; cursor: pointer; white-space: nowrap;
  font-family: inherit; box-shadow: 0 4px 12px rgba(37,99,235,0.3); transition: background .15s ease, box-shadow .15s ease; }
.sda-sub-btn:hover { background: #1d4ed8; box-shadow: 0 6px 16px rgba(37,99,235,0.4); }
.sda-sub-btn.ghost { background: var(--dbw-surface); color: #1d4ed8; border: 1px solid #bfdbfe; box-shadow: none; }
@container (max-width: 480px) {
  .sda-sub-banner { flex-wrap: wrap; text-align: center; justify-content: center; }
  .sda-sub-btn { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  .sdq-card, .sdq-go { transition: none; }
  .sdq-card:hover { transform: none; }
}
