/* DaisyUI Theme Override
   دقت: DaisyUI این متغیرها را داخل oklch() مصرف می‌کند — پس مقادیر
   باید فرمت OKLCH باشند (L% C H). فرمت HSL (مثل 38deg 85% 55%) بی‌اعتبار
   است و steps/btn حباب یا پس‌زمینه شفاف می‌گیرند. */
/* daisyui theme vars → moved to frontends/a compiled build (build.js) */

/* ── کنتراست متن‌های ثانویه (QA 2026-11-27 کارت ۱۰) ──
   placeholder و متن‌های ریز slate-400 زیر حد WCAG AA (4.5:1) بودند.
   این قواعد با specificity بالاتر از preflight/utility های compiled تعریف
   می‌شوند تا بدون rebuild هم اعمال شوند. فقط در تم روشن تیره می‌شوند —
   در تم تاریک رنگ‌های روشن خودشان کنتراست کافی دارند. */
html:not([data-theme="datapilot-dark"]) input::placeholder,
html:not([data-theme="datapilot-dark"]) textarea::placeholder { color: #6b7280; }
html:not([data-theme="datapilot-dark"]) .text-slate-400 { color: #64748b; }

/* ── تم روشن سایت مستقل از تم ویندوز (2026-12-03) ──
   وقتی ویندوز تاریک است و صفحه color-scheme اعلام نکرده، مرورگر رنگ‌های
   تم سیستم را روی textarea/input/select تحمیل می‌کند: پس‌زمینهٔ تیره با
   placeholder خاکستریِ تم روشن → متن ناخوانا (گزارش کاربر از #chatInput).
   color-scheme: light به مرورگر می‌گوید این صفحه روشن است. عمداً رنگ
   اجباری روی همهٔ inputها گذاشته نمی‌شود — با specificity بالاتر از
   کلاس‌های bg-* Tailwind، پس‌زمینه‌های سفارشی را می‌شکست. تم تاریک سایت
   پایین‌تر color-scheme: dark دارد. */
html:not([data-theme="datapilot-dark"]) { color-scheme: light; }

/* Base RTL + premium corporate styling (refined) */
:root {
  --brand-primary: #0b1f3a; /* navy */
  --brand-secondary: #38b48d; /* soft green */
  --brand-accent: #9a59b4; /* plum */
  --text-color: #0f172a; /* slate-900 */
  --muted-color: #475569; /* slate-600 */
  --surface: #ffffff;
  --surface-alt: #f8fafc;
}

html[dir="rtl"] body {
  direction: rtl;
  text-align: right;
}

html, body {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  background: #fff;
}

body {
  font-family: 'Vazirmatn', ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, 'Helvetica Neue', Arial, "Noto Sans", "Apple Color Emoji", "Segoe UI Emoji";
  color: var(--text-color);
}

/* Typography scale — فارسی letter-spacing ندارد (اتصال حروف می‌شکند)؛
   سلسله‌مراتب از سایز و رنگ می‌آید، نه وزن ۹۰۰ */
.h1 { font-size: clamp(2rem, 2.6vw + 1.4rem, 3.4rem); font-weight: 600; line-height: 1.35; text-wrap: balance; }
.h2 { font-size: clamp(1.6rem, 1.8vw + 1.1rem, 2.4rem); font-weight: 600; line-height: 1.4; text-wrap: balance; }
.lead { font-size: clamp(1rem, 0.7vw + 0.85rem, 1.3rem); color: var(--muted-color); line-height: 2; }

/* وزن‌های ۸۰۰/۹۰۰ که قالب‌ها مستقیم نوشته‌اند، روی متن فارسی به ۶۰۰ می‌رسد —
   هاردکدهای رنگ/سایز دیگر خواص این کلاس‌ها را override نمی‌کنند */
.font-extrabold, .font-black { font-weight: 600 !important; }

/******** Micro-interactions ********/
.btn-soft {
  transition: transform .2s ease, box-shadow .2s ease, background-color .2s ease, color .2s ease;
}
.btn-soft:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 24px -8px rgba(11,31,58,.15);
}
.card-hover {
  transition: transform .25s ease, box-shadow .25s ease, border-color .25s ease;
}
.card-hover:hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 36px -12px rgba(11,31,58,.18);
}
.fade-in {
  opacity: 0; transform: translateY(8px);
  transition: opacity .35s ease-out, transform .35s ease-out;
}
.fade-in.appear { opacity: 1; transform: translateY(0); }

/* Reduce motion */
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

/* ── دسترسی‌پذیری و لمس (بررسی راهنمای رابط وب 2026-12-03) ── */

/* لمس فوری: حذف تاخیر دبل‌کلیک iOS/Android روی دکمه‌ها و لینک‌ها */
button, a, [role="button"], .btn, label[for] { touch-action: manipulation; }

/* ارقام هم‌عرض: قیمت‌ها و ستون‌های عددی جدول‌ها تراز بمانند */
.kpi-card .text-2xl, .kpi-card .text-3xl,
table td, .db-date, .font-mono,
.price-figure { font-variant-numeric: tabular-nums; }

/* پرش به anchorها زیر هدر چسبان — عنوان پنهان نشود */
section[id] { scroll-margin-top: 5rem; }

/* Selection & scrollbar */
::selection { background: var(--brand-secondary); color: #fff; }
* { scrollbar-width: thin; scrollbar-color: #cbd5e1 transparent; }
*::-webkit-scrollbar { height: 10px; width: 10px; }
*::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 8px; }

/* Layout helpers */
.container-xxl { max-width: 1200px; margin-inline: auto; padding-inline: 1.25rem; }
.soft-gradient {
  background: radial-gradient(1200px 600px at 85% -10%, rgba(56,180,141,.10), transparent 60%),
              linear-gradient(180deg, #ffffff 0%, #f9fbff 100%);
}
.shadow-soft { box-shadow: 0 10px 30px -15px rgba(11,31,58,.18); }
.border-subtle { border-color: rgba(2,6,23,.08); }

/* Sections */
.section { padding-block: clamp(3rem, 4vw + 2rem, 6rem); }
.section-muted { background: #f8fafc; }

/* Header behavior */
.header-blur { background: rgba(255,255,255,.85); backdrop-filter: saturate(1.5) blur(8px); }
.header-shadow { box-shadow: 0 8px 24px -12px rgba(11,31,58,.15); }

/* Logo hover */
.logo-link { transition: opacity .2s ease; }
.logo-link:hover { opacity: .85; }
.logo-icon { transition: box-shadow .25s ease, transform .25s ease; }
.logo-link:hover .logo-icon { box-shadow: 0 4px 16px -4px rgba(56,180,141,.4); }

/* Active nav link */
.nav-link-active { color: #0b1f3a; font-weight: 700; position: relative; }
.nav-link-active::after {
  content: ''; position: absolute; bottom: -6px; right: 0; left: 0;
  height: 2px; background: #38b48d; border-radius: 2px;
}

/* Mobile menu */
.mobile-menu-enter { animation: slideDown .25s ease forwards; }
@keyframes slideDown {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}
.mobile-menu-close {
  position: absolute; top: 12px; left: 12px;
  width: 32px; height: 32px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,.05); border: none; cursor: pointer;
  transition: background .15s;
}
.mobile-menu-close:hover { background: rgba(0,0,0,.1); }

/* Scroll to top */
.scroll-top-btn {
  position: fixed; bottom: 2rem; left: 2rem; z-index: 45;
  width: 44px; height: 44px; border-radius: 12px;
  background: #0b1f3a;
  color: #fff; border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 8px 24px -8px rgba(11,31,58,.35);
  opacity: 0; transform: translateY(12px);
  transition: opacity .3s, transform .3s, box-shadow .2s;
  pointer-events: none;
}
.scroll-top-btn.visible { opacity: 1; transform: translateY(0); pointer-events: auto; }
.scroll-top-btn:hover { box-shadow: 0 12px 32px -8px rgba(11,31,58,.45); }

/* ═══════════════════════════════════════════════════════
   فیکس hover دکمه‌های ghost — QA 2026-11-22
   در این build daisyUI، قانون @supports .btn-ghost:hover از
   var(--fallback-bc) (navy-900 تیره) استفاده می‌کند — با متن
   slate تیره روی آن، بلوک کاملا ناخوانا می‌شد (در کل سایت:
   منوی ادمین، هدرها، هر .btn-ghost). رنگ hover روشنِ برند + متن تیره
   ═══════════════════════════════════════════════════════ */
.btn-ghost:hover,
.btn-ghost.btn-sm:hover,
.btn-ghost.btn-circle:hover {
  background-color: rgba(56, 180, 141, 0.14) !important;
  color: #1f6c56 !important;
}
html[data-theme="datapilot-dark"] .btn-ghost:hover,
html[data-theme="datapilot-dark"] .btn-ghost.btn-sm:hover {
  background-color: rgba(56, 180, 141, 0.18) !important;
  color: #7dd4b5 !important;
}

/* Header CTA */
.header-cta {
  background: #38b48d;
  color: #fff; font-weight: 700; padding: 8px 18px;
  border-radius: 10px; font-size: 0.88rem;
  transition: background .2s, box-shadow .2s;
  text-decoration: none; display: inline-flex; align-items: center; gap: 6px;
}
.header-cta:hover { background: #2a8e70; box-shadow: 0 8px 20px -6px rgba(56,180,141,.4); color: #fff; }

/* Footer */
.footer {
  background: #0b1f3a;
  color: #cbd5e1;
  position: relative;
  overflow: hidden;
}
.footer::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: rgba(56,180,141,.45);
}
.footer::after { content: none; }
.footer > .container-xxl { position: relative; z-index: 1; }
.footer-heading {
  font-weight: 800; font-size: 0.95rem; color: #fff;
  margin-bottom: 1.2rem; position: relative; padding-bottom: 0.6rem;
}
.footer-heading::after {
  content: ''; position: absolute; bottom: 0; right: 0;
  width: 28px; height: 2px; background: #38b48d; border-radius: 2px;
}
.footer-link {
  display: block; color: #94a3b8; font-size: 0.88rem;
  padding: 5px 0; transition: color .2s, padding-right .2s;
}
.footer-link:hover { color: #38b48d; padding-right: 6px; }
.footer-social {
  display: inline-flex; align-items: center; justify-content: center;
  width: 38px; height: 38px; border-radius: 10px;
  background: rgba(255,255,255,.08); color: #94a3b8;
  transition: background .25s, color .25s, border-color .25s; border: 1px solid rgba(255,255,255,.06);
}
.footer-social:hover { background: #38b48d; color: #fff; border-color: transparent; }
.footer-newsletter {
  display: flex; gap: 0; border-radius: 12px; overflow: hidden;
  background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.1);
}
.footer-newsletter input {
  flex: 1; border: none; padding: 12px 16px; font-size: 0.88rem;
  outline: none; font-family: 'Vazirmatn', sans-serif;
  min-width: 0; background: transparent; color: #fff;
}
/* جایگزین فوکوس — outline خاموش فقط با رینگ داخلی جبران می‌شود */
.footer-newsletter:focus-within {
  border-color: #38b48d;
  box-shadow: 0 0 0 3px rgba(56,180,141,.25);
}
.footer-newsletter input::placeholder { color: #64748b; }
.footer-newsletter button {
  padding: 12px 22px; background: #38b48d; color: #fff;
  border: none; font-weight: 700; font-size: 0.85rem;
  cursor: pointer; white-space: nowrap; font-family: 'Vazirmatn', sans-serif;
  transition: background .2s;
}
.footer-newsletter button:hover { background: #2a8e70; }
.footer-bottom {
  border-top: 1px solid rgba(255,255,255,.08);
  margin-top: 2.5rem; padding-top: 1.5rem;
  display: flex; align-items: center; justify-content: space-between;
  font-size: 0.8rem; color: #64748b;
}
.footer-bottom a { color: #64748b; transition: color .2s; }
.footer-bottom a:hover { color: #38b48d; }
.footer-contact-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; border-radius: 8px;
  background: rgba(56,180,141,.12); color: #38b48d; flex-shrink: 0;
}
.footer-brand-badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px 4px 4px; border-radius: 8px;
  background: rgba(255,255,255,.06); font-size: 0.75rem;
  color: #94a3b8; margin-top: 0.5rem;
}
.footer-brand-badge span { color: #38b48d; font-weight: 600; }

/* Mesh overlay container */
.mesh { position: absolute; inset: 0; pointer-events: none; z-index: 0; }

/* Loading skeleton */
.skeleton {
  background: linear-gradient(90deg, #e2e8f0 25%, #f1f5f9 50%, #e2e8f0 75%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.5s infinite;
  border-radius: 8px;
}
@keyframes skeleton-shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
.skeleton-text { height: 14px; margin-bottom: 8px; }
.skeleton-text:last-child { width: 60%; }
.skeleton-circle { border-radius: 50%; }
.skeleton-card { padding: 1.5rem; border-radius: 1rem; border: 1px solid #e2e8f0; background: #fff; }

/* ═══════════════════════════════════════════════════════
   تم تاریک — با [data-theme="datapilot-dark"]
   همه رنگ‌های هاردکد اصلی بالا override می‌شوند.
   ═══════════════════════════════════════════════════════ */

html[data-theme="datapilot-dark"] {
  color-scheme: dark;
  --brand-primary: #38b48d;
  --brand-secondary: #38b48d;
  --brand-accent: #b47acb;
  --text-color: #e2e8f0;
  --muted-color: #94a3b8;
  --surface: #0f1e33;
  --surface-alt: #0b1f3a;
}

/* بدنه و سرفصل‌ها */
html[data-theme="datapilot-dark"] body { background: #0a1628; color: #e2e8f0; }
html[data-theme="datapilot-dark"] .h1,
html[data-theme="datapilot-dark"] .h2 { color: #f1f5f9; }
html[data-theme="datapilot-dark"] .lead { color: #94a3b8; }

/* پس‌زمینه‌های section — همان کلاس‌های tailwind که در قالب‌ها هستند
   با CSS سراسری override می‌شوند (بدون دستکاری تک‌تک قالب‌ها) */
html[data-theme="datapilot-dark"] .bg-white { background-color: #0f1e33 !important; }
html[data-theme="datapilot-dark"] .bg-slate-50 { background-color: #0b1f3a !important; }
html[data-theme="datapilot-dark"] .bg-slate-100 { background-color: #16294a !important; }
html[data-theme="datapilot-dark"] .section-muted,
html[data-theme="datapilot-dark"] .bg-gradient-to-b.from-white { background: #0a1628 !important; }
html[data-theme="datapilot-dark"] .soft-gradient {
  background: radial-gradient(1200px 600px at 85% -10%, rgba(56,180,141,.14), transparent 60%),
              radial-gradient(1000px 500px at 0% 0%, rgba(154,89,180,.10), transparent 60%),
              linear-gradient(180deg, #0a1628 0%, #0d1a30 100%);
}

/* متن‌ها */
html[data-theme="datapilot-dark"] .text-navy-900,
html[data-theme="datapilot-dark"] .text-navy-800 { color: #f1f5f9 !important; }
html[data-theme="datapilot-dark"] .text-slate-700,
html[data-theme="datapilot-dark"] .text-slate-600,
html[data-theme="datapilot-dark"] .text-slate-500 { color: #a9b6c9 !important; }
html[data-theme="datapilot-dark"] .text-slate-400 { color: #7c8ba1 !important; }
html[data-theme="datapilot-dark"] .text-slate-300 { color: #94a3b8 !important; }

/* حاشیه‌ها */
html[data-theme="datapilot-dark"] .border-slate-200,
html[data-theme="datapilot-dark"] .border-slate-100,
html[data-theme="datapilot-dark"] .border-slate-200\/60 { border-color: #22355a !important; }
html[data-theme="datapilot-dark"] .border-subtle { border-color: rgba(148,163,184,.18) !important; }

/* هدر و سایدبار */
html[data-theme="datapilot-dark"] .header-blur { background: rgba(10,22,40,.85); }
html[data-theme="datapilot-dark"] .header-shadow { box-shadow: 0 8px 24px -12px rgba(0,0,0,.5); }
html[data-theme="datapilot-dark"] .nav-link-active { color: #5dc5a1; }

/* سایه‌ها و اسکلتون */
html[data-theme="datapilot-dark"] .shadow-soft { box-shadow: 0 10px 30px -15px rgba(0,0,0,.5); }
html[data-theme="datapilot-dark"] .skeleton { background: linear-gradient(90deg, #16294a 25%, #1d3358 50%, #16294a 75%); }
html[data-theme="datapilot-dark"] .skeleton-card { border-color: #22355a; background: #0f1e33; }
html[data-theme="datapilot-dark"] .divider::before,
html[data-theme="datapilot-dark"] .divider::after { border-color: #22355a; }
html[data-theme="datapilot-dark"] * { scrollbar-color: #2b3f66 transparent; }
html[data-theme="datapilot-dark"] *::-webkit-scrollbar-thumb { background: #2b3f66; }

/* فرم‌های DaisyUI در تم تاریک */
html[data-theme="datapilot-dark"] .input,
html[data-theme="datapilot-dark"] .textarea,
html[data-theme="datapilot-dark"] .select {
  background-color: #0b1f3a;
  border-color: #22355a;
  color: #e2e8f0;
}
html[data-theme="datapilot-dark"] .input::placeholder,
html[data-theme="datapilot-dark"] .textarea::placeholder { color: #64748b; }
html[data-theme="datapilot-dark"] .input:focus,
html[data-theme="datapilot-dark"] .textarea:focus,
html[data-theme="datapilot-dark"] .select:focus {
  border-color: #38b48d;
  box-shadow: 0 0 0 3px rgba(56,180,141,.15);
}
html[data-theme="datapilot-dark"] .select option { background-color: #0b1f3a; color: #e2e8f0; }

/* کارت‌های سفید و جدول‌ها */
html[data-theme="datapilot-dark"] .card-hover:hover { box-shadow: 0 16px 36px -12px rgba(0,0,0,.55); }
html[data-theme="datapilot-dark"] .table :where(thead, tbody) :where(th, td) { color: #cbd5e1; }
html[data-theme="datapilot-dark"] .table :where(thead tr) { color: #f1f5f9; }

/* فرم ورود/ثبت‌نام (قالب‌های مستقل با هاردکد) */
html[data-theme="datapilot-dark"] .login-right,
html[data-theme="datapilot-dark"] .register-right,
html[data-theme="datapilot-dark"] .login-wrap,
html[data-theme="datapilot-dark"] .register-wrap { background: #0f1e33 !important; }
html[data-theme="datapilot-dark"] .login-left { filter: brightness(.85); }
html[data-theme="datapilot-dark"] .form-input {
  background: #0b1f3a !important;
  border-color: #22355a !important;
  color: #e2e8f0 !important;
}
html[data-theme="datapilot-dark"] .form-input:focus { border-color: #38b48d !important; }

/* صفحات مستقل با پس‌زمینه هاردکد */
html[data-theme="datapilot-dark"] .login-wrap,
html[data-theme="datapilot-dark"] .login-right { background: #0f1e33 !important; }
html[data-theme="datapilot-dark"] body:has(.login-wrap),
html[data-theme="datapilot-dark"] body:has(.register-wrap) { background: #0a1628 !important; }

/* قالب toasts روی تم تاریک بهتر دیده شوند */
html[data-theme="datapilot-dark"] .toastify { box-shadow: 0 10px 30px -10px rgba(0,0,0,.6); }

/* Toggle switch (دکمه سوییچ تم) */
.theme-toggle {
  width: 40px; height: 40px; border-radius: 10px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid rgba(2,6,23,.08);
  background: transparent; color: #475569;
  cursor: pointer; transition: all .2s ease; flex-shrink: 0;
}
.theme-toggle:hover { border-color: #38b48d; color: #38b48d; transform: translateY(-1px); }
/* color هم !important: دکمهٔ تم در chat.html رنگ را inline دارد و بدون آن
   خاکستریِ روشن (کنتراست 1.86) روی هدر تیره می‌ماند */
html[data-theme="datapilot-dark"] .theme-toggle { border-color: #22355a; color: #94a3b8 !important; background: rgba(148,163,184,.08) !important; }
html[data-theme="datapilot-dark"] .theme-toggle:hover { border-color: #38b48d; color: #5dc5a1 !important; }
.theme-toggle .icon-sun { display: none; }
html[data-theme="datapilot-dark"] .theme-toggle .icon-sun { display: block; }
html[data-theme="datapilot-dark"] .theme-toggle .icon-moon { display: none; }

/* ═══════════════════════════════════════════════════════
   اصلاحات UI — باگ‌های ریز عمومی
   ═══════════════════════════════════════════════════════ */

/* ۱. جدول‌ها در موبایل — اسکرول افقی تمیز به‌جای شکستن layout */
.table-responsive-wrapper { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* ۲. focus-ring استاندارد برای دسترسی‌پذیری روی همه عناصر تعاملی */
a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
.btn:focus-visible {
  outline: 2px solid #38b48d;
  outline-offset: 2px;
}

/* ۳. placeholders فارسی راست‌چین حتی داخل فیلدهای dir=ltr */
[dir="ltr"]::placeholder { direction: rtl; text-align: right; }
input[dir="ltr"]::placeholder { text-align: left; }

/* ۴. اعداد فارسی در بج‌ها و جدول‌ها از تراز نیفتند */
.badge { white-space: nowrap; }

/* ۵. تصاویر هرگز از قاب والد بیرون نزنند */
img { max-width: 100%; }

/* ۶. حالت hover لینک‌های footer-link در موبایل — تپ تارگت بزرگ‌تر */
.footer-link { padding: 7px 0; }

/* ۷. متن خطاها همیشه خوانا */
.text-error { color: #dc2626; }
html[data-theme="datapilot-dark"] .text-error { color: #f87171; }

/* ۸. ارتفاع خط پیام‌های بلند در حباب‌های چت/تیکت */
.leading-7 { line-height: 1.9; }

/* ۹. دکمه scroll-top روی موبایل جا باز کند */
@media (max-width: 640px) {
  .scroll-top-btn { bottom: 1.2rem; left: 1.2rem; width: 40px; height: 40px; }
}

/* ۱۰. کلاس line-clamp بدون وابستگی به نسخه tailwind */
.line-clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ══ QA موبایل 2026-11-18 ══ */
/* فیلدهای فرم زیر ۱۶px → iOS روی فوکوس auto-zoom می‌کند و کاربر صفحه
   را از دست می‌دهد (فرم درخواست دمو: ۱۰ فیلد). حداقل ۱۶px روی موبایل */
@media (max-width: 640px) {
  input:not([type=checkbox]):not([type=radio]):not([type=submit]):not([type=button]),
  select,
  textarea {
    font-size: 16px !important;
  }
  /* tap-target حداقل ۴۴px برای دکمه‌های فرم و اکشن‌های جدولی
     (!important: daisyUI .btn-xs/.btn-sm height/min-height را override کند) */
  button,
  .btn {
    min-height: 44px !important;
  }
  table button,
  table .btn {
    min-height: 44px !important;
    min-width: 64px;
    padding: 8px 12px !important;
  }
  /* لینک‌های footer و skip قابل لمس شوند */
  footer a,
  .footer-link {
    display: inline-block;
    padding: 10px 4px;
    min-height: 44px;
  }
}
/* نشانی بصری اسکرول افقی در جدول‌های ادمین (QA موبایل): کاربر نمی‌فهمد
   ستون‌های بیشتری سمت چپ هست — گرادیان محو روی لبه چپ wrapper فقط
   وقتی scrollWidth > clientWidth (کلاس با JS ست می‌شود) */
.overflow-x-auto {
  position: relative;
}
.overflow-x-auto.scrollable::before {
  content: '';
  position: absolute;
  top: 0; bottom: 0; left: 0;
  width: 24px;
  background: linear-gradient(to left, rgba(15,23,42,0) 0%, rgba(15,23,42,.06) 100%);
  pointer-events: none;
  z-index: 1;
}


/* ۱۱. آیکون‌های SVG با stroke هاردکد تیره در تم تاریک — خوانا شوند
   (قالب‌ها stroke="#1f6c56" و مشابه دارند؛ در تاریک به سبز روشن مپ می‌کنیم) */
html[data-theme="datapilot-dark"] svg[stroke="#1f6c56"],
html[data-theme="datapilot-dark"] svg[stroke="#0b1f3a"],
html[data-theme="datapilot-dark"] svg[stroke="#173b78"],
html[data-theme="datapilot-dark"] svg[stroke="#2a8e70"] { stroke: #5dc5a1; }

/* ۱۲. عنوان صفحات داشبورد که با text-navy-900 سفید می‌شود — چک شد؛ درست است
   ۱۳. دکمه‌های قرمز logout همیشه خوانا */
html[data-theme="datapilot-dark"] .bg-red-600 { background-color: #dc2626; }

/* ۱۴. کاوس‌های طرح در صفحه اصلی — ring-mint در تاریک کم‌نور نشود */
html[data-theme="datapilot-dark"] .ring-mint-500\/30 { --tw-ring-color: rgba(56,180,141,.35); }

/* ۱۵. بج‌ها در جدول‌های ادمین روی تیره */
html[data-theme="datapilot-dark"] .badge-ghost { color: #cbd5e1; background: rgba(148,163,184,.12); }
html[data-theme="datapilot-dark"] .table-zebra tbody tr:nth-child(even) { background: rgba(148,163,184,.05); }
html[data-theme="datapilot-dark"] .table :where(thead, tbody) :where(th, td) { border-color: #22355a; }

/* ═══════════════════════════════════════════════════════
   تم تاریک — فاز ۲: پوشش کامل همه صفحات (داشبورد، ادمین، چت)
   ═══════════════════════════════════════════════════════ */

/* رنگ‌های نرم پس‌زمینه (کارت‌های آماری، بخرهای هشدار، هایلایت ردیف‌ها) */
html[data-theme="datapilot-dark"] .bg-blue-50 { background-color: #12233f !important; }
html[data-theme="datapilot-dark"] .bg-blue-50\/40 { background-color: rgba(56,130,246,.12) !important; }
html[data-theme="datapilot-dark"] .bg-red-50 { background-color: #2a1620 !important; }
html[data-theme="datapilot-dark"] .bg-amber-50,
html[data-theme="datapilot-dark"] .bg-amber-50\/40 { background-color: #2a2212 !important; }
html[data-theme="datapilot-dark"] .bg-green-50 { background-color: #12281c !important; }
html[data-theme="datapilot-dark"] .hover\:bg-red-50:hover { background-color: #2a1620 !important; }
html[data-theme="datapilot-dark"] .hover\:bg-amber-100:hover { background-color: #332a15 !important; }
html[data-theme="datapilot-dark"] .hover\:bg-slate-100:hover { background-color: #16294a !important; }

/* متن‌های رنگی هشدار/وضعیت */
html[data-theme="datapilot-dark"] .text-red-500,
html[data-theme="datapilot-dark"] .text-red-600 { color: #f87171 !important; }
html[data-theme="datapilot-dark"] .text-red-700 { color: #fca5a5 !important; }
html[data-theme="datapilot-dark"] .text-amber-700 { color: #fbbf24 !important; }
html[data-theme="datapilot-dark"] .text-blue-600 { color: #60a5fa !important; }
html[data-theme="datapilot-dark"] .text-green-600,
html[data-theme="datapilot-dark"] .text-emerald-600 { color: #34d399 !important; }

/* حاشیه‌های رنگی هشدار */
html[data-theme="datapilot-dark"] .border-amber-200 { border-color: #4a3d1a !important; }
html[data-theme="datapilot-dark"] .border-red-200 { border-color: #4a2230 !important; }
html[data-theme="datapilot-dark"] .border-mint-200 { border-color: #1c4034 !important; }
html[data-theme="datapilot-dark"] .border-mint-400 { border-color: #2a6b55 !important; }
html[data-theme="datapilot-dark"] .hover\:border-mint-400:hover { border-color: #38b48d !important; }

/* mint تیره‌شده برای پس‌زمینه‌های سبز */
html[data-theme="datapilot-dark"] .bg-mint-50 { background-color: #0d271e !important; }
html[data-theme="datapilot-dark"] .bg-mint-50\/50 { background-color: rgba(13,39,30,.5) !important; }
html[data-theme="datapilot-dark"] .bg-mint-50\/40 { background-color: rgba(13,39,30,.4) !important; }
html[data-theme="datapilot-dark"] .text-mint-600 { color: #5dc5a1 !important; }
html[data-theme="datapilot-dark"] .text-mint-700 { color: #7dd4b5 !important; }

/* ویزارد اتصال دیتابیس (wizard.html) — کلاس‌های DaisyUI بدون پوشش تیره */
/* متغیرهای DaisyUI برای تم تاریک — فرمت OKLCH (همان قاعده :root) */
/* dark theme vars → moved to frontends/a compiled build (build.js) */
html[data-theme="datapilot-dark"] .label-text,
html[data-theme="datapilot-dark"] .label-text-alt { color: #cbd5e1 !important; }
html[data-theme="datapilot-dark"] .label .label-text-alt.text-base-content\/50,
html[data-theme="datapilot-dark"] .label .label-text-alt.text-base-content\/60 { color: #94a3b8 !important; }
html[data-theme="datapilot-dark"] .bg-base-200 { background-color: #0b1f3a !important; }
html[data-theme="datapilot-dark"] .card.bg-base-100 {
  background-color: #0f1e33 !important;
  border-color: #22355a;
}
html[data-theme="datapilot-dark"] .card-title { color: #38b48d !important; }
html[data-theme="datapilot-dark"] .btn-primary:not(.btn-outline) {
  background-color: #38b48d !important;
  border-color: #38b48d !important;
  color: #0b1f3a !important;
}
html[data-theme="datapilot-dark"] .btn-primary:not(.btn-outline):hover {
  background-color: #2e9a79 !important;
  border-color: #2e9a79 !important;
}
html[data-theme="datapilot-dark"] .btn-outline {
  background-color: transparent;
  border-color: #2e4a77;
  color: #e2e8f0;
}
html[data-theme="datapilot-dark"] .btn-outline:hover {
  background-color: #16294a;
  border-color: #38b48d;
}
html[data-theme="datapilot-dark"] .btn-outline.btn-primary {
  color: #5dc5a1;
  border-color: #2e6b55;
}
html[data-theme="datapilot-dark"] .btn-outline.btn-primary:hover {
  background-color: rgba(56,180,141,.15);
  color: #7dd4b5;
}
html[data-theme="datapilot-dark"] .btn:disabled,
html[data-theme="datapilot-dark"] .btn[disabled] {
  background-color: #16294a !important;
  border-color: #22355a !important;
  color: #64748b !important;
}
html[data-theme="datapilot-dark"] .steps .step { color: #94a3b8; }
html[data-theme="datapilot-dark"] .steps .step:before,
html[data-theme="datapilot-dark"] .steps .step:after {
  border-color: #2e4a77 !important;
  color: #cbd5e1 !important;
  background-color: #0f1e33 !important;
}
/* مرحله جاری روشن‌تر از انجام‌شده‌ها — تفکیک بصری */
html[data-theme="datapilot-dark"] .steps .step-primary:before,
html[data-theme="datapilot-dark"] .steps .step-primary:after {
  background-color: #38b48d !important;
  border-color: #38b48d !important;
  color: #0b1f3a !important;
}
html[data-theme="datapilot-dark"] .steps .step-success:before,
html[data-theme="datapilot-dark"] .steps .step-success:after {
  background-color: #1f5c46 !important;
  border-color: #34d399 !important;
  color: #e2e8f0 !important;
}
html[data-theme="datapilot-dark"] .steps .step-primary,
html[data-theme="datapilot-dark"] .steps .step-success { color: #f1f5f9 !important; }
html[data-theme="datapilot-dark"] .file-input { color: #e2e8f0; }
html[data-theme="datapilot-dark"] .file-input::-webkit-file-upload-button {
  background-color: #16294a;
  color: #e2e8f0;
  border-color: #2e4a77;
}
html[data-theme="datapilot-dark"] .alert-success {
  background-color: #0d271e !important;
  color: #86e0bd !important;
  border-color: #1f5c46 !important;
}
html[data-theme="datapilot-dark"] .alert-error {
  background-color: #2a1215 !important;
  color: #fca5a5 !important;
  border-color: #7f1d1d !important;
}
html[data-theme="datapilot-dark"] .loading-spinner { color: #38b48d !important; }
html[data-theme="datapilot-dark"] .text-success { color: #34d399 !important; }
html[data-theme="datapilot-dark"] .table-zebra tbody tr:nth-child(even) { background: #12233f !important; }

/* dropdown منوی کاربر در داشبورد (bg-base-100) */
html[data-theme="datapilot-dark"] .bg-base-100 { background-color: #0f1e33 !important; color: #e2e8f0; }
html[data-theme="datapilot-dark"] .dropdown-content { border-color: #22355a !important; }
html[data-theme="datapilot-dark"] .menu-title span { color: #f1f5f9 !important; }

/* جدول activity داشبورد (هاردکد در base_dashboard) */
html[data-theme="datapilot-dark"] .activity-table tbody tr:nth-child(even) { background: #12233f; }
html[data-theme="datapilot-dark"] .activity-table tbody tr:hover { background: #16294a; }

/* topbar داشبورد — سفید هاردکد */
html[data-theme="datapilot-dark"] #topbar { background: rgba(10,22,40,.9); }
html[data-theme="datapilot-dark"] #topbar .h1,
html[data-theme="datapilot-dark"] #topbar h1 { color: #f1f5f9; }

/* chat.html و chart_chat.html — پس‌زمینه و حباب‌ها هاردکد */
html[data-theme="datapilot-dark"] body:has(.chat-messages) { background: #0a1628 !important; color: #e2e8f0; }
html[data-theme="datapilot-dark"] .chat-header { background: #0f1e33 !important; box-shadow: 0 2px 12px -4px rgba(0,0,0,.5); }
html[data-theme="datapilot-dark"] .chat-header h1,
html[data-theme="datapilot-dark"] .chat-header :not(.chat-hdr-link, .chat-hdr-delete) > .header-label { color: #f1f5f9 !important; }
/* برچسب‌های داخل دکمه‌های .chat-hdr-* رنگ خودِ دکمه را دارند (پایین‌تر) */
html[data-theme="datapilot-dark"] .chat-input-area { background: #0f1e33 !important; border-top-color: #22355a !important; }
html[data-theme="datapilot-dark"] .chat-messages .welcome-msg,
html[data-theme="datapilot-dark"] .welcome-msg h2,
html[data-theme="datapilot-dark"] .welcome-title { color: #f1f5f9 !important; }
html[data-theme="datapilot-dark"] .welcome-msg p { color: #94a3b8 !important; }
html[data-theme="datapilot-dark"] .msg-assistant {
  background: #0f1e33 !important;
  border-color: #22355a !important;
  color: #e2e8f0 !important;
}
html[data-theme="datapilot-dark"] .welcome-card {
  background: #0f1e33 !important;
  border-color: #22355a !important;
}
html[data-theme="datapilot-dark"] .welcome-card h4 { color: #f1f5f9 !important; }
html[data-theme="datapilot-dark"] .welcome-card p { color: #94a3b8 !important; }
html[data-theme="datapilot-dark"] .limit-banner {
  background: #2a1620 !important; border-color: #4a2230 !important; color: #fca5a5 !important;
}
html[data-theme="datapilot-dark"] .limit-banner a { color: #f87171 !important; }

/* جدول‌های markdown داخل پیام چت (thead تیره روی تیره معلوم نبود) */
html[data-theme="datapilot-dark"] .msg-rendered td { border-bottom-color: #22355a !important; color: #cbd5e1 !important; }
html[data-theme="datapilot-dark"] .msg-rendered tbody tr:hover { background: rgba(56,180,141,.08) !important; }
html[data-theme="datapilot-dark"] .msg-rendered strong { color: #f1f5f9 !important; }
html[data-theme="datapilot-dark"] .msg-rendered p { color: #cbd5e1 !important; }
html[data-theme="datapilot-dark"] .msg-rendered code { background: #16294a !important; color: #f0abfc !important; }
html[data-theme="datapilot-dark"] .msg-rendered .sql-details summary { background: #16294a !important; color: #a9b6c9 !important; }
html[data-theme="datapilot-dark"] .msg-rendered .sql-details pre { background: #071427 !important; }
html[data-theme="datapilot-dark"] .msg-rendered .sql-details summary:hover { background: #1d3358 !important; }

/* نمودار chart_chat — container سفید و grid هاردکد */
html[data-theme="datapilot-dark"] .chart-container { background: #0f1e33 !important; border-color: #22355a !important; }

/* textarea چت */
html[data-theme="datapilot-dark"] .chat-input-area textarea {
  background: #0b1f3a !important;
  border-color: #22355a !important;
  color: #e2e8f0 !important;
}

/* wizard (extends base.html — اکثرش از ارث می‌آید) */
html[data-theme="datapilot-dark"] fieldset { border-color: #22355a !important; }
html[data-theme="datapilot-dark"] fieldset legend { color: #f1f5f9 !important; }

/* login/register — پس‌زمینه بدنه هاردکد #f0f4f8 */
html[data-theme="datapilot-dark"] body:has(.login-wrap),
html[data-theme="datapilot-dark"] body:has(.register-wrap) {
  background: #0a1628 !important;
}
html[data-theme="datapilot-dark"] .login-header h2,
html[data-theme="datapilot-dark"] .register-header h2 { color: #f1f5f9 !important; }
html[data-theme="datapilot-dark"] .login-header p,
html[data-theme="datapilot-dark"] .login-header p *,
html[data-theme="datapilot-dark"] .login-right p,
html[data-theme="datapilot-dark"] .register-right p { color: #94a3b8 !important; }
html[data-theme="datapilot-dark"] .login-right span[style*="color: #0b1f3a"],
html[data-theme="datapilot-dark"] .register-right span[style*="color: #0b1f3a"] { color: #f1f5f9 !important; }
html[data-theme="datapilot-dark"] .login-right label,
html[data-theme="datapilot-dark"] .register-right label { color: #a9b6c9 !important; }
html[data-theme="datapilot-dark"] .login-right .divider,
html[data-theme="datapilot-dark"] .register-right .divider { color: #64748b !important; }
html[data-theme="datapilot-dark"] .login-right .divider::before,
html[data-theme="datapilot-dark"] .login-right .divider::after,
html[data-theme="datapilot-dark"] .register-right .divider::before,
html[data-theme="datapilot-dark"] .register-right .divider::after { border-color: #22355a !important; }
html[data-theme="datapilot-dark"] .forgot-link { color: #5dc5a1 !important; }
html[data-theme="datapilot-dark"] .forgot-link:hover { color: #38b48d !important; }
html[data-theme="datapilot-dark"] .toggle-pw:hover { background: rgba(56,180,141,.12) !important; }
html[data-theme="datapilot-dark"] .demo-btn { background: #0b1f3a !important; color: #e2e8f0 !important; border-color: #22355a !important; }
html[data-theme="datapilot-dark"] .demo-btn:hover { background: #12233f !important; color: #5dc5a1 !important; }
html[data-theme="datapilot-dark"] .btn-login { background: linear-gradient(115deg, #173b78, #214c96) !important; }

/* دکمه‌های خروج قرمز — فقط hover */
html[data-theme="datapilot-dark"] .hover\:bg-red-700:hover { background-color: #b91c1c !important; }

/* ── دکمه‌های هدر چت (چت هوشمند + چت نمودار) ──
   رنگ‌ها و هاورِ این دکمه‌ها قبلاً inline بودند (style + onmouseover/
   onmouseout که با JS رنگ عوض می‌کرد). دو مشکل داشت: در تم تاریک هیچ
   نسخهٔ تاریکی نداشتند، و selectorهای مبتنی بر متنِ [style*="…"] با اولین
   هاور می‌شکستند — مرورگر style را بازنویسی می‌کند (color:#1f6c56 →
   color: rgb(31,108,86)) و استایل تاریک حذف می‌شد؛ روی دکمهٔ «نمودار»
   متن تیره روی پس‌زمینهٔ روشن می‌افتاد (گزارش کاربر 2026-12-03).
   حالا رنگ‌ها اینجا هستند و کلاس با هاور تغییر نمی‌کند. */
.chat-hdr-link, .chat-hdr-icon, .chat-hdr-delete {
  border: 1px solid transparent;
}
.chat-hdr-link--chart { background: linear-gradient(135deg, #dff7ec, #f2fbf7); border-color: #bcead6; color: #1f6c56; }
.chat-hdr-link--dash  { background: linear-gradient(135deg, #e6eef7, #f3f6fb); border-color: #c4d3ea; color: #173b78; }
.chat-hdr-icon { background: linear-gradient(135deg, rgba(100,116,139,.08), rgba(100,116,139,.15)); border-color: rgba(100,116,139,.2); color: #64748b; }
.chat-hdr-delete { background: linear-gradient(135deg, rgba(239,68,68,.08), rgba(239,68,68,.15)); border-color: rgba(239,68,68,.2); color: #ef4444; }
.chat-hdr-link--chart .header-label { color: #1f6c56; }
.chat-hdr-link--dash .header-label  { color: #173b78; }
.chat-hdr-delete .header-label      { color: #ef4444; }

/* هاور (تم روشن) — همان افکت‌های قبلی، بدون JS */
.chat-hdr-link--chart:hover { filter: brightness(.97); box-shadow: 0 4px 12px rgba(56,180,141,.18); }
.chat-hdr-link--dash:hover  { filter: brightness(.97); box-shadow: 0 4px 12px rgba(23,59,120,.15); }
.chat-hdr-icon:hover { background: linear-gradient(135deg, #3b82f6, #2563eb); border-color: #2563eb; color: #fff; transform: translateY(-1px); box-shadow: 0 4px 12px rgba(59,130,246,.3); }
.chat-hdr-delete:hover { background: linear-gradient(135deg, #ef4444, #dc2626); border-color: #ef4444; color: #fff; transform: translateY(-1px); box-shadow: 0 4px 12px rgba(239,68,68,.3); }
.chat-hdr-delete:hover .header-label { color: #fff; }

/* ── همان دکمه‌ها در تم تاریک ── */
html[data-theme="datapilot-dark"] .chat-hdr-link--chart { background: #0d271e; border-color: #1c4034; color: #5dc5a1; }
html[data-theme="datapilot-dark"] .chat-hdr-link--dash  { background: #12233f; border-color: #22355a; color: #9fb7dc; }
html[data-theme="datapilot-dark"] .chat-hdr-icon { background: #12233f; border-color: #22355a; color: #a9b6c9; }
html[data-theme="datapilot-dark"] .chat-hdr-delete { background: rgba(239,68,68,.14); border-color: #4a2230; color: #fca5a5; }
html[data-theme="datapilot-dark"] .chat-hdr-link--chart .header-label { color: #5dc5a1 !important; }
html[data-theme="datapilot-dark"] .chat-hdr-link--dash .header-label  { color: #9fb7dc !important; }
html[data-theme="datapilot-dark"] .chat-hdr-delete .header-label      { color: #fca5a5 !important; }

/* هاور در تم تاریک — پس‌زمینهٔ تیره می‌ماند، فقط روشن‌تر می‌شود */
html[data-theme="datapilot-dark"] .chat-hdr-link--chart:hover { background: #134534; border-color: #2a6b55; color: #7dd4b5; box-shadow: 0 4px 12px rgba(0,0,0,.45); }
html[data-theme="datapilot-dark"] .chat-hdr-link--dash:hover  { background: #1d3358; border-color: #3b5f9a; color: #c7d7f0; box-shadow: 0 4px 12px rgba(0,0,0,.45); }
html[data-theme="datapilot-dark"] .chat-hdr-icon:hover { background: #1d3358; border-color: #3b82f6; color: #e2e8f0; box-shadow: 0 4px 12px rgba(0,0,0,.45); }
html[data-theme="datapilot-dark"] .chat-hdr-delete:hover { background: #4a2230; border-color: #f87171; color: #fecaca; box-shadow: 0 4px 12px rgba(0,0,0,.45); }
html[data-theme="datapilot-dark"] .chat-hdr-link--chart:hover .header-label { color: #7dd4b5 !important; }
html[data-theme="datapilot-dark"] .chat-hdr-link--dash:hover .header-label  { color: #c7d7f0 !important; }
html[data-theme="datapilot-dark"] .chat-hdr-delete:hover .header-label      { color: #fecaca !important; }

/* دکمهٔ ☰ و select دیتابیس */
html[data-theme="datapilot-dark"] .chat-header #sidebarToggle svg[stroke="#0b1f3a"],
html[data-theme="datapilot-dark"] .chat-header #mobileMenuBtn svg[stroke="#0b1f3a"] { stroke: #e2e8f0; }
html[data-theme="datapilot-dark"] .chat-header select[style*="background:#fff"] {
  background: #0b1f3a !important; border-color: #22355a !important; color: #cbd5e1 !important;
}
html[data-theme="datapilot-dark"] .chat-header select[style*="background:#fff"] option {
  background: #0b1f3a; color: #e2e8f0;
}

/* coming_soon — پس‌زمینه و کارت */
html[data-theme="datapilot-dark"] body:has(.cs-card) { background: linear-gradient(160deg, #0a1628 0%, #0d1a30 55%, #0a1f18 100%) !important; }
html[data-theme="datapilot-dark"] .cs-card { background: #0f1e33 !important; border-color: #22355a !important; }
html[data-theme="datapilot-dark"] .cs-title { color: #f1f5f9 !important; }
html[data-theme="datapilot-dark"] .cs-text { color: #94a3b8 !important; }
html[data-theme="datapilot-dark"] .cs-badge { background: #0d271e !important; color: #5dc5a1 !important; border-color: #1c4034 !important; }
html[data-theme="datapilot-dark"] .cs-btn-ghost { background: #12233f !important; color: #e2e8f0 !important; border-color: #22355a !important; }

/* device-frame hero — در تاریک قاب تیره */
html[data-theme="datapilot-dark"] .device-frame { background: #0f1e33 !important; border-color: #22355a !important; }
html[data-theme="datapilot-dark"] .device-topbar { background: linear-gradient(180deg, #12233f, #0d1a30) !important; border-bottom-color: #22355a !important; }

/* footer — از قبل تیره، فقط متن‌های style هاردکد خاکستری روشن‌تر */
html[data-theme="datapilot-dark"] .footer { background: #071427; }
html[data-theme="datapilot-dark"] .footer-bottom { border-top-color: rgba(148,163,184,.12) !important; }

/* text-navy-900 داخل footer (درباره ما و…) */
html[data-theme="datapilot-dark"] footer .text-navy-900 { color: #f1f5f9 !important; }

/* نقطه وضعیت LLM — سبز/قرمز در تاریک روشن‌تر */
html[data-theme="datapilot-dark"] .bg-green-500 { background-color: #34d399 !important; }
html[data-theme="datapilot-dark"] .bg-red-500 { background-color: #f87171 !important; }

/* داشبورد کاربر عادی — کارت‌های جدید */
html[data-theme="datapilot-dark"] .bg-purple-50 { background-color: #1e1833 !important; }
html[data-theme="datapilot-dark"] .bg-amber-100 { background-color: #332a15 !important; }

/* پیام‌های خوانده‌نشده در داشبورد ادمین (آبی روشن) */
html[data-theme="datapilot-dark"] .bg-blue-100 { background-color: #12233f !important; }
html[data-theme="datapilot-dark"] .bg-blue-200 { background-color: #1a3358 !important; }
html[data-theme="datapilot-dark"] .text-blue-700 { color: #93c5fd !important; }
html[data-theme="datapilot-dark"] .border-blue-500 { border-color: #3b82f6 !important; }
html[data-theme="datapilot-dark"] .bg-blue-600 { background-color: #3b82f6 !important; }
