/* ==========================================================================
   Agent Admin Panel — شیوه‌نامه اصلی
   --------------------------------------------------------------------------
   این فایل به‌صورت دستی نوشته شده و معادل خروجی Tailwind است، اما بدون
   نیاز به NodeJS یا مرحله ساخت. کلاس‌ها همان نام‌گذاری Tailwind را دارند
   تا قالب‌ها خوانا بمانند.

   ساختار فایل:
     ۱. بازنشانی (Reset)
     ۲. توکن‌های طراحی (متغیرهای CSS) — روشن و تاریک
     ۳. پایه و تایپوگرافی
     ۴. کلاس‌های کاربردی (Utilities)
     ۵. مؤلفه‌ها (دکمه، کارت، جدول، فرم، ...)
     ۶. انیمیشن‌ها
     ۷. واکنش‌گرایی (Responsive)
     ۸. چاپ

   نکته RTL: از ویژگی‌های منطقی (margin-inline-start به‌جای margin-left)
   استفاده شده تا چیدمان بدون شیوه‌نامه جداگانه در RTL درست باشد.
   ========================================================================== */

/* ==========================================================================
   ۱. بازنشانی
   ========================================================================== */

*,
*::before,
*::after {
  box-sizing: border-box;
  border-width: 0;
  border-style: solid;
  border-color: var(--border);
}

* {
  margin: 0;
  padding: 0;
}

html {
  -webkit-text-size-adjust: 100%;
  -moz-tab-size: 4;
  tab-size: 4;
  line-height: 1.5;
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  line-height: inherit;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

hr {
  height: 0;
  color: inherit;
  border-top-width: 1px;
}

img,
svg,
video,
canvas {
  display: block;
  max-width: 100%;
  height: auto;
}

button,
input,
optgroup,
select,
textarea {
  font-family: inherit;
  font-size: 100%;
  font-weight: inherit;
  line-height: inherit;
  color: inherit;
  margin: 0;
  padding: 0;
}

button,
[type='button'],
[type='submit'],
[type='reset'] {
  -webkit-appearance: button;
  background-color: transparent;
  background-image: none;
  cursor: pointer;
}

button:disabled,
[type='submit']:disabled {
  cursor: not-allowed;
}

table {
  text-indent: 0;
  border-color: inherit;
  border-collapse: collapse;
  width: 100%;
}

summary {
  display: list-item;
  cursor: pointer;
}

ol,
ul {
  list-style: none;
}

a {
  color: inherit;
  text-decoration: inherit;
}

::placeholder {
  opacity: 1;
  color: var(--text-muted);
}

textarea {
  resize: vertical;
}

[hidden] {
  display: none !important;
}

/* ==========================================================================
   ۲. توکن‌های طراحی
   ========================================================================== */

:root {
  /* ── رنگ برند ─────────────────────────────────────────────────── */
  --brand-50:  #eef2ff;
  --brand-100: #e0e7ff;
  --brand-200: #c7d2fe;
  --brand-300: #a5b4fc;
  --brand-400: #818cf8;
  --brand-500: #6366f1;
  --brand-600: #4f46e5;
  --brand-700: #4338ca;
  --brand-800: #3730a3;
  --brand-900: #312e81;

  /* ── رنگ‌های معنایی ───────────────────────────────────────────── */
  --success: #22c55e;
  --success-bg: #dcfce7;
  --success-fg: #15803d;

  --warning: #f59e0b;
  --warning-bg: #fef3c7;
  --warning-fg: #b45309;

  --danger: #ef4444;
  --danger-bg: #fee2e2;
  --danger-fg: #b91c1c;

  --info: #0ea5e9;
  --info-bg: #e0f2fe;
  --info-fg: #0369a1;

  /* ── سطوح (تم روشن) ───────────────────────────────────────────── */
  --bg:          #f6f7fb;
  --surface:     #ffffff;
  --surface-2:   #fbfbfd;
  --surface-3:   #f2f3f7;
  --surface-hover: #f7f8fc;

  --text:        #101828;
  --text-soft:   #475467;
  --text-muted:  #98a2b3;
  --text-invert: #ffffff;

  --border:      #e6e8ee;
  --border-soft: #f0f1f5;
  --border-strong: #d0d5dd;

  /* ── سایه‌ها ──────────────────────────────────────────────────── */
  --shadow-xs: 0 1px 2px rgba(16, 24, 40, 0.04);
  --shadow-sm: 0 1px 3px rgba(16, 24, 40, 0.08), 0 1px 2px rgba(16, 24, 40, 0.04);
  --shadow-md: 0 4px 8px -2px rgba(16, 24, 40, 0.08), 0 2px 4px -2px rgba(16, 24, 40, 0.04);
  --shadow-lg: 0 12px 16px -4px rgba(16, 24, 40, 0.08), 0 4px 6px -2px rgba(16, 24, 40, 0.03);
  --shadow-xl: 0 20px 24px -4px rgba(16, 24, 40, 0.08), 0 8px 8px -4px rgba(16, 24, 40, 0.03);
  --shadow-brand: 0 6px 16px -4px rgba(99, 102, 241, 0.35);

  /* ── شعاع گوشه ────────────────────────────────────────────────── */
  --radius-sm: 6px;
  --radius:    10px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-full: 9999px;

  /* ── چیدمان ───────────────────────────────────────────────────── */
  --sidebar-width: 264px;
  --sidebar-collapsed: 76px;
  --topbar-height: 64px;

  /* ── حرکت ─────────────────────────────────────────────────────── */
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --duration: 180ms;

  color-scheme: light;
}

/* ── تم تاریک ───────────────────────────────────────────────────── */
:root.dark {
  --bg:          #0b0d13;
  --surface:     #12141c;
  --surface-2:   #171a23;
  --surface-3:   #1d2029;
  --surface-hover: #1a1d26;

  --text:        #e8eaf0;
  --text-soft:   #a0a6b8;
  --text-muted:  #6b7280;
  --text-invert: #0b0d13;

  --border:      #232733;
  --border-soft: #1b1e27;
  --border-strong: #2f3441;

  --success-bg: rgba(34, 197, 94, 0.14);
  --success-fg: #4ade80;
  --warning-bg: rgba(245, 158, 11, 0.14);
  --warning-fg: #fbbf24;
  --danger-bg:  rgba(239, 68, 68, 0.14);
  --danger-fg:  #f87171;
  --info-bg:    rgba(14, 165, 233, 0.14);
  --info-fg:    #38bdf8;

  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 4px 10px rgba(0, 0, 0, 0.45);
  --shadow-lg: 0 12px 24px rgba(0, 0, 0, 0.5);
  --shadow-xl: 0 20px 40px rgba(0, 0, 0, 0.55);
  --shadow-brand: 0 6px 20px -4px rgba(99, 102, 241, 0.5);

  color-scheme: dark;
}

/* ==========================================================================
   ۳. پایه و تایپوگرافی
   ========================================================================== */

body {
  font-family: 'Vazirmatn', -apple-system, BlinkMacSystemFont, 'Segoe UI', Tahoma, sans-serif;
  background-color: var(--bg);
  color: var(--text);
  font-size: 14px;
  /* اعداد فارسی در فونت وزیرمتن با این تنظیم بهتر رندر می‌شوند */
  font-feature-settings: 'ss01' 1, 'ss02' 1;
  transition: background-color var(--duration) var(--ease),
              color var(--duration) var(--ease);
}

h1, h2, h3, h4, h5, h6 {
  font-weight: 700;
  line-height: 1.35;
  color: var(--text);
}

h1 { font-size: 1.5rem; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.125rem; }
h4 { font-size: 1rem; }

/* اعداد لاتین در متن فارسی باید LTR رندر شوند */
.num,
.ltr {
  direction: ltr;
  unicode-bidi: embed;
  display: inline-block;
}

/* ==========================================================================
   ۴. کلاس‌های کاربردی
   ========================================================================== */

/* ── نمایش ──────────────────────────────────────────────────────── */
.block { display: block; }
.inline-block { display: inline-block; }
.inline { display: inline; }
.flex { display: flex; }
.inline-flex { display: inline-flex; }
.grid { display: grid; }
.hidden { display: none; }
.table { display: table; }
.contents { display: contents; }

/* ── فلکس ───────────────────────────────────────────────────────── */
.flex-row { flex-direction: row; }
.flex-col { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.flex-nowrap { flex-wrap: nowrap; }
.flex-1 { flex: 1 1 0%; }
.flex-auto { flex: 1 1 auto; }
.flex-none { flex: none; }
.flex-shrink-0, .shrink-0 { flex-shrink: 0; }
.flex-grow, .grow { flex-grow: 1; }

.items-start { align-items: flex-start; }
.items-center { align-items: center; }
.items-end { align-items: flex-end; }
.items-baseline { align-items: baseline; }
.items-stretch { align-items: stretch; }

.justify-start { justify-content: flex-start; }
.justify-center { justify-content: center; }
.justify-end { justify-content: flex-end; }
.justify-between { justify-content: space-between; }
.justify-around { justify-content: space-around; }
.justify-evenly { justify-content: space-evenly; }

.self-start { align-self: flex-start; }
.self-center { align-self: center; }
.self-end { align-self: flex-end; }
.self-stretch { align-self: stretch; }

/* ── گرید ───────────────────────────────────────────────────────── */
.grid-cols-1 { grid-template-columns: repeat(1, minmax(0, 1fr)); }
.grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-cols-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.grid-cols-6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.grid-cols-12 { grid-template-columns: repeat(12, minmax(0, 1fr)); }

.col-span-1 { grid-column: span 1 / span 1; }
.col-span-2 { grid-column: span 2 / span 2; }
.col-span-3 { grid-column: span 3 / span 3; }
.col-span-4 { grid-column: span 4 / span 4; }
.col-span-6 { grid-column: span 6 / span 6; }
.col-span-12 { grid-column: span 12 / span 12; }
.col-span-full { grid-column: 1 / -1; }

/* ── فاصله (gap) ────────────────────────────────────────────────── */
.gap-0 { gap: 0; }
.gap-1 { gap: 0.25rem; }
.gap-1\.5 { gap: 0.375rem; }
.gap-2 { gap: 0.5rem; }
.gap-2\.5 { gap: 0.625rem; }
.gap-3 { gap: 0.75rem; }
.gap-4 { gap: 1rem; }
.gap-5 { gap: 1.25rem; }
.gap-6 { gap: 1.5rem; }
.gap-8 { gap: 2rem; }
.gap-x-2 { column-gap: 0.5rem; }
.gap-x-3 { column-gap: 0.75rem; }
.gap-x-4 { column-gap: 1rem; }
.gap-y-2 { row-gap: 0.5rem; }
.gap-y-3 { row-gap: 0.75rem; }
.gap-y-4 { row-gap: 1rem; }

/* ── حاشیه داخلی ────────────────────────────────────────────────── */
.p-0 { padding: 0; }
.p-1 { padding: 0.25rem; }
.p-1\.5 { padding: 0.375rem; }
.p-2 { padding: 0.5rem; }
.p-2\.5 { padding: 0.625rem; }
.p-3 { padding: 0.75rem; }
.p-4 { padding: 1rem; }
.p-5 { padding: 1.25rem; }
.p-6 { padding: 1.5rem; }
.p-8 { padding: 2rem; }
.p-10 { padding: 2.5rem; }
.p-12 { padding: 3rem; }

.px-1 { padding-inline: 0.25rem; }
.px-2 { padding-inline: 0.5rem; }
.px-2\.5 { padding-inline: 0.625rem; }
.px-3 { padding-inline: 0.75rem; }
.px-4 { padding-inline: 1rem; }
.px-5 { padding-inline: 1.25rem; }
.px-6 { padding-inline: 1.5rem; }
.px-8 { padding-inline: 2rem; }

.py-1 { padding-block: 0.25rem; }
.py-1\.5 { padding-block: 0.375rem; }
.py-2 { padding-block: 0.5rem; }
.py-2\.5 { padding-block: 0.625rem; }
.py-3 { padding-block: 0.75rem; }
.py-4 { padding-block: 1rem; }
.py-5 { padding-block: 1.25rem; }
.py-6 { padding-block: 1.5rem; }
.py-8 { padding-block: 2rem; }
.py-10 { padding-block: 2.5rem; }
.py-12 { padding-block: 3rem; }
.py-16 { padding-block: 4rem; }

.pt-2 { padding-top: 0.5rem; }
.pt-3 { padding-top: 0.75rem; }
.pt-4 { padding-top: 1rem; }
.pt-6 { padding-top: 1.5rem; }
.pb-2 { padding-bottom: 0.5rem; }
.pb-3 { padding-bottom: 0.75rem; }
.pb-4 { padding-bottom: 1rem; }
.pb-6 { padding-bottom: 1.5rem; }

/* ویژگی‌های منطقی — در RTL خودکار معکوس می‌شوند */
.ps-2 { padding-inline-start: 0.5rem; }
.ps-3 { padding-inline-start: 0.75rem; }
.ps-4 { padding-inline-start: 1rem; }
.ps-10 { padding-inline-start: 2.5rem; }
.ps-11 { padding-inline-start: 2.75rem; }
.pe-2 { padding-inline-end: 0.5rem; }
.pe-3 { padding-inline-end: 0.75rem; }
.pe-4 { padding-inline-end: 1rem; }
.pe-10 { padding-inline-end: 2.5rem; }

/* ── حاشیه بیرونی ───────────────────────────────────────────────── */
.m-0 { margin: 0; }
.m-auto { margin: auto; }
.mx-auto { margin-inline: auto; }
.my-2 { margin-block: 0.5rem; }
.my-4 { margin-block: 1rem; }
.my-6 { margin-block: 1.5rem; }

.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 0.75rem; }
.mt-4 { margin-top: 1rem; }
.mt-5 { margin-top: 1.25rem; }
.mt-6 { margin-top: 1.5rem; }
.mt-8 { margin-top: 2rem; }
.mt-10 { margin-top: 2.5rem; }

.mb-1 { margin-bottom: 0.25rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 0.75rem; }
.mb-4 { margin-bottom: 1rem; }
.mb-5 { margin-bottom: 1.25rem; }
.mb-6 { margin-bottom: 1.5rem; }
.mb-8 { margin-bottom: 2rem; }

.ms-1 { margin-inline-start: 0.25rem; }
.ms-2 { margin-inline-start: 0.5rem; }
.ms-3 { margin-inline-start: 0.75rem; }
.ms-4 { margin-inline-start: 1rem; }
.ms-auto { margin-inline-start: auto; }
.me-1 { margin-inline-end: 0.25rem; }
.me-2 { margin-inline-end: 0.5rem; }
.me-3 { margin-inline-end: 0.75rem; }
.me-4 { margin-inline-end: 1rem; }
.me-auto { margin-inline-end: auto; }

/* ── اندازه ─────────────────────────────────────────────────────── */
.w-full { width: 100%; }
.w-auto { width: auto; }
.w-fit { width: fit-content; }
.w-screen { width: 100vw; }
.w-3 { width: 0.75rem; }
.w-4 { width: 1rem; }
.w-5 { width: 1.25rem; }
.w-6 { width: 1.5rem; }
.w-8 { width: 2rem; }
.w-9 { width: 2.25rem; }
.w-10 { width: 2.5rem; }
.w-11 { width: 2.75rem; }
.w-12 { width: 3rem; }
.w-14 { width: 3.5rem; }
.w-16 { width: 4rem; }
.w-20 { width: 5rem; }
.w-24 { width: 6rem; }
.w-32 { width: 8rem; }
.w-40 { width: 10rem; }
.w-48 { width: 12rem; }
.w-56 { width: 14rem; }
.w-64 { width: 16rem; }
.w-72 { width: 18rem; }
.w-80 { width: 20rem; }

.h-full { height: 100%; }
.h-auto { height: auto; }
.h-screen { height: 100vh; }
.h-1 { height: 0.25rem; }
.h-1\.5 { height: 0.375rem; }
.h-2 { height: 0.5rem; }
.h-3 { height: 0.75rem; }
.h-4 { height: 1rem; }
.h-5 { height: 1.25rem; }
.h-6 { height: 1.5rem; }
.h-8 { height: 2rem; }
.h-9 { height: 2.25rem; }
.h-10 { height: 2.5rem; }
.h-11 { height: 2.75rem; }
.h-12 { height: 3rem; }
.h-14 { height: 3.5rem; }
.h-16 { height: 4rem; }
.h-20 { height: 5rem; }
.h-24 { height: 6rem; }
.h-32 { height: 8rem; }
.h-40 { height: 10rem; }
.h-48 { height: 12rem; }
.h-64 { height: 16rem; }
.h-80 { height: 20rem; }

.min-h-screen { min-height: 100vh; }
.min-h-0 { min-height: 0; }
.min-w-0 { min-width: 0; }
.max-w-xs { max-width: 20rem; }
.max-w-sm { max-width: 24rem; }
.max-w-md { max-width: 28rem; }
.max-w-lg { max-width: 32rem; }
.max-w-xl { max-width: 36rem; }
.max-w-2xl { max-width: 42rem; }
.max-w-3xl { max-width: 48rem; }
.max-w-4xl { max-width: 56rem; }
.max-w-5xl { max-width: 64rem; }
.max-w-7xl { max-width: 80rem; }
.max-w-full { max-width: 100%; }
.max-h-full { max-height: 100%; }

.size-4 { width: 1rem; height: 1rem; }
.size-5 { width: 1.25rem; height: 1.25rem; }
.size-6 { width: 1.5rem; height: 1.5rem; }
.size-8 { width: 2rem; height: 2rem; }
.size-9 { width: 2.25rem; height: 2.25rem; }
.size-10 { width: 2.5rem; height: 2.5rem; }
.size-11 { width: 2.75rem; height: 2.75rem; }
.size-12 { width: 3rem; height: 3rem; }
.size-16 { width: 4rem; height: 4rem; }

/* ── موقعیت ─────────────────────────────────────────────────────── */
.static { position: static; }
.relative { position: relative; }
.absolute { position: absolute; }
.fixed { position: fixed; }
.sticky { position: sticky; }

.inset-0 { inset: 0; }
.top-0 { top: 0; }
.top-2 { top: 0.5rem; }
.top-3 { top: 0.75rem; }
.top-4 { top: 1rem; }
.top-full { top: 100%; }
.bottom-0 { bottom: 0; }
.bottom-4 { bottom: 1rem; }
.start-0 { inset-inline-start: 0; }
.start-3 { inset-inline-start: 0.75rem; }
.start-4 { inset-inline-start: 1rem; }
.end-0 { inset-inline-end: 0; }
.end-3 { inset-inline-end: 0.75rem; }
.end-4 { inset-inline-end: 1rem; }

.z-0 { z-index: 0; }
.z-10 { z-index: 10; }
.z-20 { z-index: 20; }
.z-30 { z-index: 30; }
.z-40 { z-index: 40; }
.z-50 { z-index: 50; }
.z-\[60\] { z-index: 60; }
.z-\[100\] { z-index: 100; }

/* ── سرریز ──────────────────────────────────────────────────────── */
.overflow-hidden { overflow: hidden; }
.overflow-auto { overflow: auto; }
.overflow-x-auto { overflow-x: auto; }
.overflow-y-auto { overflow-y: auto; }
.overflow-visible { overflow: visible; }

/* ── تایپوگرافی ─────────────────────────────────────────────────── */
.text-\[10px\] { font-size: 10px; }
.text-\[11px\] { font-size: 11px; }
.text-xs { font-size: 0.75rem; line-height: 1.6; }
.text-sm { font-size: 0.8125rem; line-height: 1.7; }
.text-base { font-size: 0.875rem; line-height: 1.75; }
.text-md { font-size: 0.9375rem; line-height: 1.75; }
.text-lg { font-size: 1rem; line-height: 1.7; }
.text-xl { font-size: 1.125rem; line-height: 1.6; }
.text-2xl { font-size: 1.375rem; line-height: 1.5; }
.text-3xl { font-size: 1.75rem; line-height: 1.4; }
.text-4xl { font-size: 2.125rem; line-height: 1.3; }
.text-5xl { font-size: 2.75rem; line-height: 1.2; }

.font-normal { font-weight: 400; }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }

.text-start { text-align: start; }
.text-center { text-align: center; }
.text-end { text-align: end; }
.text-justify { text-align: justify; }

.leading-none { line-height: 1; }
.leading-tight { line-height: 1.3; }
.leading-normal { line-height: 1.6; }
.leading-relaxed { line-height: 1.85; }
.leading-loose { line-height: 2.1; }

.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.line-clamp-1,
.line-clamp-2,
.line-clamp-3 {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.line-clamp-1 { -webkit-line-clamp: 1; line-clamp: 1; }
.line-clamp-2 { -webkit-line-clamp: 2; line-clamp: 2; }
.line-clamp-3 { -webkit-line-clamp: 3; line-clamp: 3; }

.whitespace-nowrap { white-space: nowrap; }
.whitespace-pre-wrap { white-space: pre-wrap; }
.break-words { overflow-wrap: break-word; }
.break-all { word-break: break-all; }

.uppercase { text-transform: uppercase; }
.lowercase { text-transform: lowercase; }

.underline { text-decoration-line: underline; }
.no-underline { text-decoration-line: none; }

.tabular-nums { font-variant-numeric: tabular-nums; }

/* ── رنگ متن ────────────────────────────────────────────────────── */
.text-main { color: var(--text); }
.text-soft { color: var(--text-soft); }
.text-muted { color: var(--text-muted); }
.text-invert { color: var(--text-invert); }
.text-white { color: #ffffff; }
.text-brand { color: var(--brand-600); }
.text-success { color: var(--success-fg); }
.text-warning { color: var(--warning-fg); }
.text-danger { color: var(--danger-fg); }
.text-info { color: var(--info-fg); }

.dark .text-brand { color: var(--brand-400); }

/* ── پس‌زمینه ───────────────────────────────────────────────────── */
.bg-transparent { background-color: transparent; }
.bg-body { background-color: var(--bg); }
.bg-surface { background-color: var(--surface); }
.bg-surface-2 { background-color: var(--surface-2); }
.bg-surface-3 { background-color: var(--surface-3); }
.bg-brand { background-color: var(--brand-600); }
.bg-brand-50 { background-color: var(--brand-50); }
.bg-success-soft { background-color: var(--success-bg); }
.bg-warning-soft { background-color: var(--warning-bg); }
.bg-danger-soft { background-color: var(--danger-bg); }
.bg-info-soft { background-color: var(--info-bg); }
.bg-black\/50 { background-color: rgba(0, 0, 0, 0.5); }
.bg-black\/60 { background-color: rgba(0, 0, 0, 0.6); }

.dark .bg-brand-50 { background-color: rgba(99, 102, 241, 0.12); }

/* ── حاشیه ──────────────────────────────────────────────────────── */
.border { border-width: 1px; }
.border-0 { border-width: 0; }
.border-2 { border-width: 2px; }
.border-t { border-top-width: 1px; }
.border-b { border-bottom-width: 1px; }
.border-s { border-inline-start-width: 1px; }
.border-e { border-inline-end-width: 1px; }
.border-s-2 { border-inline-start-width: 2px; }
.border-dashed { border-style: dashed; }
.border-soft { border-color: var(--border-soft); }
.border-strong { border-color: var(--border-strong); }
.border-brand { border-color: var(--brand-500); }
.border-danger { border-color: var(--danger); }
.border-transparent { border-color: transparent; }

.rounded-none { border-radius: 0; }
.rounded-sm { border-radius: var(--radius-sm); }
.rounded { border-radius: var(--radius); }
.rounded-md { border-radius: var(--radius-md); }
.rounded-lg { border-radius: var(--radius-lg); }
.rounded-xl { border-radius: var(--radius-xl); }
.rounded-full { border-radius: var(--radius-full); }

/* ── سایه ───────────────────────────────────────────────────────── */
.shadow-none { box-shadow: none; }
.shadow-xs { box-shadow: var(--shadow-xs); }
.shadow-sm { box-shadow: var(--shadow-sm); }
.shadow { box-shadow: var(--shadow-sm); }
.shadow-md { box-shadow: var(--shadow-md); }
.shadow-lg { box-shadow: var(--shadow-lg); }
.shadow-xl { box-shadow: var(--shadow-xl); }
.shadow-brand { box-shadow: var(--shadow-brand); }

/* ── شفافیت و دیگر ──────────────────────────────────────────────── */
.opacity-0 { opacity: 0; }
.opacity-50 { opacity: 0.5; }
.opacity-60 { opacity: 0.6; }
.opacity-70 { opacity: 0.7; }
.opacity-100 { opacity: 1; }

.cursor-pointer { cursor: pointer; }
.cursor-not-allowed { cursor: not-allowed; }
.cursor-grab { cursor: grab; }
.cursor-grabbing { cursor: grabbing; }

.select-none { user-select: none; }
.pointer-events-none { pointer-events: none; }
.pointer-events-auto { pointer-events: auto; }

.transition {
  transition-property: color, background-color, border-color, opacity,
                       box-shadow, transform, filter;
  transition-duration: var(--duration);
  transition-timing-function: var(--ease);
}
.transition-all { transition: all var(--duration) var(--ease); }
.transition-colors {
  transition: color var(--duration) var(--ease),
              background-color var(--duration) var(--ease),
              border-color var(--duration) var(--ease);
}
.transition-transform { transition: transform var(--duration) var(--ease); }

.duration-150 { transition-duration: 150ms; }
.duration-200 { transition-duration: 200ms; }
.duration-300 { transition-duration: 300ms; }

.scale-95 { transform: scale(0.95); }
.scale-100 { transform: scale(1); }
.scale-105 { transform: scale(1.05); }
.rotate-180 { transform: rotate(180deg); }

.backdrop-blur { backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.backdrop-blur-lg { backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); }
.backdrop-blur-xl { backdrop-filter: blur(24px); -webkit-backdrop-filter: blur(24px); }

/* ── حالت‌های تعاملی ────────────────────────────────────────────── */
.hover\:bg-surface-hover:hover { background-color: var(--surface-hover); }
.hover\:bg-surface-3:hover { background-color: var(--surface-3); }
.hover\:text-main:hover { color: var(--text); }
.hover\:text-brand:hover { color: var(--brand-600); }
.hover\:text-danger:hover { color: var(--danger-fg); }
.hover\:border-strong:hover { border-color: var(--border-strong); }
.hover\:shadow-md:hover { box-shadow: var(--shadow-md); }
.hover\:shadow-lg:hover { box-shadow: var(--shadow-lg); }
.hover\:opacity-100:hover { opacity: 1; }
.hover\:scale-105:hover { transform: scale(1.05); }
.hover\:underline:hover { text-decoration-line: underline; }

.group:hover .group-hover\:opacity-100 { opacity: 1; }
.group:hover .group-hover\:visible { visibility: visible; }
.group:hover .group-hover\:text-brand { color: var(--brand-600); }

.focus\:outline-none:focus { outline: none; }

.invisible { visibility: hidden; }
.visible { visibility: visible; }

/* ==========================================================================
   ۵. مؤلفه‌ها
   ========================================================================== */

/* ── دکمه ───────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  font-size: 0.8125rem;
  font-weight: 600;
  line-height: 1.5;
  border-radius: var(--radius);
  border: 1px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  user-select: none;
  transition: all var(--duration) var(--ease);
}

.btn:focus-visible {
  outline: 2px solid var(--brand-500);
  outline-offset: 2px;
}

.btn:disabled,
.btn.is-loading {
  opacity: 0.6;
  cursor: not-allowed;
  pointer-events: none;
}

.btn-primary {
  background-color: var(--brand-600);
  color: #ffffff;
  box-shadow: var(--shadow-xs);
}
.btn-primary:hover { background-color: var(--brand-700); box-shadow: var(--shadow-brand); }
.btn-primary:active { transform: translateY(1px); }

.btn-secondary {
  background-color: var(--surface);
  color: var(--text);
  border-color: var(--border);
}
.btn-secondary:hover { background-color: var(--surface-hover); border-color: var(--border-strong); }

.btn-ghost {
  background-color: transparent;
  color: var(--text-soft);
}
.btn-ghost:hover { background-color: var(--surface-3); color: var(--text); }

.btn-danger {
  background-color: var(--danger);
  color: #ffffff;
}
.btn-danger:hover { background-color: #dc2626; }

.btn-success {
  background-color: var(--success);
  color: #ffffff;
}
.btn-success:hover { background-color: #16a34a; }

.btn-sm { padding: 0.3125rem 0.6875rem; font-size: 0.75rem; }
.btn-lg { padding: 0.6875rem 1.375rem; font-size: 0.875rem; }
.btn-icon { padding: 0.5rem; width: 2.25rem; height: 2.25rem; }
.btn-block { width: 100%; }

/* ── کارت ───────────────────────────────────────────────────────── */
.card {
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xs);
  transition: box-shadow var(--duration) var(--ease),
              border-color var(--duration) var(--ease);
}

.card-hover:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--border-strong);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border-soft);
}

.card-body { padding: 1.25rem; }

.card-footer {
  padding: 0.875rem 1.25rem;
  border-top: 1px solid var(--border-soft);
  background-color: var(--surface-2);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

/* ── کارت آماری ─────────────────────────────────────────────────── */
.stat-card {
  position: relative;
  overflow: hidden;
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  box-shadow: var(--shadow-xs);
  transition: transform var(--duration) var(--ease-out),
              box-shadow var(--duration) var(--ease);
}

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

.stat-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  height: 2.75rem;
  border-radius: var(--radius-md);
  flex-shrink: 0;
}

.stat-value {
  font-size: 1.75rem;
  font-weight: 700;
  line-height: 1.2;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.stat-label {
  font-size: 0.8125rem;
  color: var(--text-soft);
  font-weight: 500;
}

.stat-trend {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.125rem 0.5rem;
  border-radius: var(--radius-full);
}

.stat-trend.up { background-color: var(--success-bg); color: var(--success-fg); }
.stat-trend.down { background-color: var(--danger-bg); color: var(--danger-fg); }
.stat-trend.flat { background-color: var(--surface-3); color: var(--text-muted); }

/* ── فرم ────────────────────────────────────────────────────────── */
.form-group { margin-bottom: 1.125rem; }

.form-label {
  display: block;
  margin-bottom: 0.4375rem;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text);
}

.form-label .required { color: var(--danger); margin-inline-start: 0.125rem; }

.form-input,
.form-select,
.form-textarea {
  display: block;
  width: 100%;
  padding: 0.5625rem 0.875rem;
  font-size: 0.8125rem;
  font-family: inherit;
  color: var(--text);
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color var(--duration) var(--ease),
              box-shadow var(--duration) var(--ease),
              background-color var(--duration) var(--ease);
}

.form-input:hover,
.form-select:hover,
.form-textarea:hover {
  border-color: var(--border-strong);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--brand-500);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.14);
}

.form-input:disabled,
.form-select:disabled,
.form-textarea:disabled {
  background-color: var(--surface-3);
  color: var(--text-muted);
  cursor: not-allowed;
}

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

.form-input.has-error:focus {
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.14);
}

.form-textarea { min-height: 6.5rem; line-height: 1.85; }

.form-select {
  appearance: none;
  /* فلش سفارشی — در RTL سمت چپ قرار می‌گیرد */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2398a2b3' stroke-width='2'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M19 9l-7 7-7-7'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: left 0.75rem center;
  background-size: 1.125rem;
  padding-inline-end: 0.875rem;
  padding-inline-start: 2.25rem;
}

.form-hint {
  margin-top: 0.375rem;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.form-error {
  display: flex;
  align-items: center;
  gap: 0.3125rem;
  margin-top: 0.375rem;
  font-size: 0.75rem;
  color: var(--danger-fg);
  font-weight: 500;
}

/* چک‌باکس و رادیو */
.form-check {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  user-select: none;
}

.form-checkbox,
.form-radio {
  appearance: none;
  width: 1.0625rem;
  height: 1.0625rem;
  border: 1.5px solid var(--border-strong);
  background-color: var(--surface);
  cursor: pointer;
  flex-shrink: 0;
  transition: all var(--duration) var(--ease);
  position: relative;
}

.form-checkbox { border-radius: 5px; }
.form-radio { border-radius: 50%; }

.form-checkbox:checked,
.form-radio:checked {
  background-color: var(--brand-600);
  border-color: var(--brand-600);
}

.form-checkbox:checked::after {
  content: '';
  position: absolute;
  inset-inline-start: 5px;
  top: 1.5px;
  width: 5px;
  height: 9px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.form-radio:checked::after {
  content: '';
  position: absolute;
  inset: 3.5px;
  border-radius: 50%;
  background-color: #fff;
}

.form-checkbox:focus-visible,
.form-radio:focus-visible {
  outline: 2px solid var(--brand-500);
  outline-offset: 2px;
}

/* کلید تغییر وضعیت */
.form-switch {
  appearance: none;
  position: relative;
  width: 2.5rem;
  height: 1.375rem;
  background-color: var(--border-strong);
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: background-color var(--duration) var(--ease);
  flex-shrink: 0;
}

.form-switch::after {
  content: '';
  position: absolute;
  top: 2px;
  inset-inline-start: 2px;
  width: 1.125rem;
  height: 1.125rem;
  background-color: #fff;
  border-radius: 50%;
  box-shadow: var(--shadow-sm);
  transition: transform var(--duration) var(--ease);
}

.form-switch:checked { background-color: var(--brand-600); }

/* در RTL کلید باید به سمت چپ حرکت کند */
.form-switch:checked::after { transform: translateX(-1.125rem); }
[dir='ltr'] .form-switch:checked::after { transform: translateX(1.125rem); }

/* ── نشان (Badge) ───────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.1875rem 0.5625rem;
  font-size: 0.6875rem;
  font-weight: 600;
  line-height: 1.5;
  border-radius: var(--radius-full);
  white-space: nowrap;
}

.badge-gray { background-color: var(--surface-3); color: var(--text-soft); }
.badge-brand { background-color: var(--brand-50); color: var(--brand-700); }
.badge-success { background-color: var(--success-bg); color: var(--success-fg); }
.badge-warning { background-color: var(--warning-bg); color: var(--warning-fg); }
.badge-danger { background-color: var(--danger-bg); color: var(--danger-fg); }
.badge-info { background-color: var(--info-bg); color: var(--info-fg); }

.dark .badge-brand { background-color: rgba(99, 102, 241, 0.16); color: var(--brand-300); }

/* نقطه وضعیت */
.badge-dot::before {
  content: '';
  width: 0.375rem;
  height: 0.375rem;
  border-radius: 50%;
  background-color: currentColor;
}

/* ── جدول ───────────────────────────────────────────────────────── */
.table-wrap {
  width: 100%;
  overflow-x: auto;
  /* اسکرول نرم روی iOS */
  -webkit-overflow-scrolling: touch;
}

.data-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.8125rem;
}

.data-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 0.75rem 1rem;
  text-align: start;
  font-weight: 600;
  font-size: 0.75rem;
  color: var(--text-soft);
  background-color: var(--surface-2);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.data-table tbody td {
  padding: 0.8125rem 1rem;
  border-bottom: 1px solid var(--border-soft);
  color: var(--text);
  vertical-align: middle;
}

.data-table tbody tr {
  transition: background-color 120ms var(--ease);
}

.data-table tbody tr:hover { background-color: var(--surface-hover); }
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr.is-selected { background-color: var(--brand-50); }

.dark .data-table tbody tr.is-selected { background-color: rgba(99, 102, 241, 0.1); }

/* سرستون قابل مرتب‌سازی */
.th-sort {
  cursor: pointer;
  user-select: none;
}

.th-sort:hover { color: var(--text); }

.th-sort .sort-icon {
  display: inline-block;
  margin-inline-start: 0.25rem;
  opacity: 0.35;
  transition: opacity var(--duration) var(--ease);
}

.th-sort.is-active .sort-icon { opacity: 1; color: var(--brand-600); }

/* ── حالت خالی ──────────────────────────────────────────────────── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.875rem;
  padding: 3.5rem 1.5rem;
  text-align: center;
}

.empty-state .empty-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 3.5rem;
  height: 3.5rem;
  border-radius: var(--radius-full);
  background-color: var(--surface-3);
  color: var(--text-muted);
}

.empty-state .empty-title {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text);
}

.empty-state .empty-desc {
  font-size: 0.8125rem;
  color: var(--text-muted);
  max-width: 22rem;
  line-height: 1.9;
}

/* ── هشدار (Alert) ──────────────────────────────────────────────── */
.alert {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.875rem 1rem;
  border-radius: var(--radius-md);
  font-size: 0.8125rem;
  line-height: 1.8;
  border: 1px solid transparent;
}

.alert-success { background-color: var(--success-bg); color: var(--success-fg); border-color: rgba(34,197,94,0.25); }
.alert-warning { background-color: var(--warning-bg); color: var(--warning-fg); border-color: rgba(245,158,11,0.25); }
.alert-error   { background-color: var(--danger-bg);  color: var(--danger-fg);  border-color: rgba(239,68,68,0.25); }
.alert-info    { background-color: var(--info-bg);    color: var(--info-fg);    border-color: rgba(14,165,233,0.25); }

/* ── اعلان شناور (Toast) ────────────────────────────────────────── */
.toast-container {
  position: fixed;
  bottom: 1.25rem;
  inset-inline-end: 1.25rem;
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
  pointer-events: none;
  max-width: calc(100vw - 2.5rem);
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  min-width: 17rem;
  max-width: 24rem;
  padding: 0.875rem 1rem;
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  font-size: 0.8125rem;
  pointer-events: auto;
  animation: toast-in 260ms var(--ease-out);
}

.toast.is-leaving { animation: toast-out 200ms var(--ease) forwards; }

.toast-success { border-inline-start: 3px solid var(--success); }
.toast-error   { border-inline-start: 3px solid var(--danger); }
.toast-warning { border-inline-start: 3px solid var(--warning); }
.toast-info    { border-inline-start: 3px solid var(--info); }

/* ── مودال ──────────────────────────────────────────────────────── */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 60;
  background-color: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  overflow-y: auto;
}

.modal {
  width: 100%;
  max-width: 32rem;
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  max-height: calc(100vh - 2rem);
  display: flex;
  flex-direction: column;
  animation: modal-in 220ms var(--ease-out);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.125rem 1.375rem;
  border-bottom: 1px solid var(--border-soft);
  flex-shrink: 0;
}

.modal-body {
  padding: 1.375rem;
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.625rem;
  padding: 1rem 1.375rem;
  border-top: 1px solid var(--border-soft);
  background-color: var(--surface-2);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  flex-shrink: 0;
}

/* ── منوی کشویی ─────────────────────────────────────────────────── */
.dropdown {
  position: absolute;
  z-index: 50;
  min-width: 11rem;
  padding: 0.375rem;
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  animation: dropdown-in 140ms var(--ease-out);
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  width: 100%;
  padding: 0.5rem 0.625rem;
  font-size: 0.8125rem;
  color: var(--text-soft);
  border-radius: var(--radius-sm);
  text-align: start;
  transition: all 120ms var(--ease);
  cursor: pointer;
}

.dropdown-item:hover { background-color: var(--surface-3); color: var(--text); }
.dropdown-item.is-danger { color: var(--danger-fg); }
.dropdown-item.is-danger:hover { background-color: var(--danger-bg); }

.dropdown-divider {
  height: 1px;
  margin: 0.375rem 0;
  background-color: var(--border-soft);
}

/* ── نوار کناری ─────────────────────────────────────────────────── */
.sidebar {
  position: fixed;
  top: 0;
  inset-inline-start: 0;
  width: var(--sidebar-width);
  height: 100vh;
  background-color: var(--surface);
  border-inline-end: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 40;
  transition: transform 260ms var(--ease-out);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  height: var(--topbar-height);
  padding: 0 1.25rem;
  border-bottom: 1px solid var(--border-soft);
  flex-shrink: 0;
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 0.875rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.1875rem;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.625rem 0.75rem;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-soft);
  border-radius: var(--radius);
  transition: all 140ms var(--ease);
  position: relative;
}

.nav-item:hover {
  background-color: var(--surface-3);
  color: var(--text);
}

.nav-item.is-active {
  background-color: var(--brand-50);
  color: var(--brand-700);
  font-weight: 600;
}

.dark .nav-item.is-active {
  background-color: rgba(99, 102, 241, 0.14);
  color: var(--brand-300);
}

/* نشانگر فعال بودن — سمت راست در RTL */
.nav-item.is-active::before {
  content: '';
  position: absolute;
  inset-inline-start: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 1.375rem;
  background-color: var(--brand-600);
  border-radius: 0 3px 3px 0;
}

[dir='rtl'] .nav-item.is-active::before {
  border-radius: 3px 0 0 3px;
}

.nav-item .nav-icon { flex-shrink: 0; width: 1.125rem; height: 1.125rem; }

.nav-section-title {
  padding: 0.75rem 0.75rem 0.375rem;
  font-size: 0.6875rem;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.04em;
}

.sidebar-footer {
  padding: 0.75rem;
  border-top: 1px solid var(--border-soft);
  flex-shrink: 0;
}

/* ── نوار بالا ──────────────────────────────────────────────────── */
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  height: var(--topbar-height);
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0 1.25rem;
  background-color: color-mix(in srgb, var(--surface) 85%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

/* پشتیبان برای مرورگرهایی که color-mix ندارند */
@supports not (background-color: color-mix(in srgb, red 50%, blue)) {
  .topbar { background-color: var(--surface); }
}

.main-wrap {
  margin-inline-start: var(--sidebar-width);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: margin-inline-start 260ms var(--ease-out);
}

.page-content {
  flex: 1;
  padding: 1.5rem;
  max-width: 100%;
}

/* ── آواتار ─────────────────────────────────────────────────────── */
.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-full);
  background-color: var(--brand-600);
  color: #fff;
  font-weight: 600;
  overflow: hidden;
  flex-shrink: 0;
  user-select: none;
}

.avatar img { width: 100%; height: 100%; object-fit: cover; }

.avatar-sm { width: 1.75rem; height: 1.75rem; font-size: 0.6875rem; }
.avatar-md { width: 2.25rem; height: 2.25rem; font-size: 0.8125rem; }
.avatar-lg { width: 3rem; height: 3rem; font-size: 1rem; }
.avatar-xl { width: 4.5rem; height: 4.5rem; font-size: 1.375rem; }

/* ── تخته کانبان ────────────────────────────────────────────────── */
.board {
  display: grid;
  grid-template-columns: repeat(3, minmax(280px, 1fr));
  gap: 1rem;
  align-items: start;
}

.board-column {
  background-color: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  min-height: 12rem;
  max-height: calc(100vh - 13rem);
}

.board-column-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.875rem 1rem;
  border-bottom: 1px solid var(--border-soft);
  flex-shrink: 0;
}

.board-column-body {
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
  overflow-y: auto;
  flex: 1;
  min-height: 5rem;
}

.task-card {
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.875rem;
  box-shadow: var(--shadow-xs);
  cursor: grab;
  transition: box-shadow var(--duration) var(--ease),
              border-color var(--duration) var(--ease),
              transform var(--duration) var(--ease);
}

.task-card:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--border-strong);
}

.task-card:active { cursor: grabbing; }

/* کلاس‌های SortableJS هنگام کشیدن */
.sortable-ghost {
  opacity: 0.4;
  background-color: var(--brand-50);
  border-style: dashed;
  border-color: var(--brand-400);
}

.sortable-drag {
  opacity: 0.95;
  box-shadow: var(--shadow-xl);
  transform: rotate(1.5deg);
}

.sortable-chosen { cursor: grabbing; }

.dark .sortable-ghost { background-color: rgba(99, 102, 241, 0.1); }

/* نوار اولویت روی کارت */
.priority-bar {
  height: 3px;
  border-radius: var(--radius-full);
  margin-bottom: 0.625rem;
}

.priority-low    { background-color: #94a3b8; }
.priority-medium { background-color: var(--info); }
.priority-high   { background-color: var(--warning); }
.priority-urgent { background-color: var(--danger); }

/* ── برچسب ──────────────────────────────────────────────────────── */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 0.3125rem;
  padding: 0.1875rem 0.5rem;
  font-size: 0.6875rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  line-height: 1.5;
}

.tag-dot {
  width: 0.4375rem;
  height: 0.4375rem;
  border-radius: 50%;
  flex-shrink: 0;
}

/* ── صفحه‌بندی ──────────────────────────────────────────────────── */
.pagination {
  display: flex;
  align-items: center;
  gap: 0.3125rem;
  flex-wrap: wrap;
}

.page-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.125rem;
  height: 2.125rem;
  padding: 0 0.5rem;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-soft);
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: all 140ms var(--ease);
}

.page-link:hover:not(.is-disabled):not(.is-active) {
  background-color: var(--surface-3);
  color: var(--text);
  border-color: var(--border-strong);
}

.page-link.is-active {
  background-color: var(--brand-600);
  border-color: var(--brand-600);
  color: #fff;
  font-weight: 600;
}

.page-link.is-disabled {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
}

/* ── راهنمای ابزار ──────────────────────────────────────────────── */
.tooltip {
  position: relative;
}

.tooltip::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 0.4375rem);
  inset-inline-start: 50%;
  transform: translateX(50%);
  padding: 0.3125rem 0.5625rem;
  background-color: #101828;
  color: #fff;
  font-size: 0.6875rem;
  font-weight: 500;
  border-radius: var(--radius-sm);
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  transition: opacity 140ms var(--ease), visibility 140ms var(--ease);
  pointer-events: none;
  z-index: 70;
}

[dir='ltr'] .tooltip::after { transform: translateX(-50%); }

.tooltip:hover::after { opacity: 1; visibility: visible; }

.dark .tooltip::after { background-color: #2f3441; }

/* ── نوار پیشرفت ────────────────────────────────────────────────── */
.progress {
  width: 100%;
  height: 0.4375rem;
  background-color: var(--surface-3);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  background-color: var(--brand-600);
  border-radius: var(--radius-full);
  transition: width 360ms var(--ease-out);
}

/* ── اسکلت بارگذاری ─────────────────────────────────────────────── */
.skeleton {
  background: linear-gradient(
    90deg,
    var(--surface-3) 25%,
    var(--surface-hover) 50%,
    var(--surface-3) 75%
  );
  background-size: 200% 100%;
  animation: skeleton-loading 1.4s ease-in-out infinite;
  border-radius: var(--radius-sm);
}

/* ── چرخنده ─────────────────────────────────────────────────────── */
.spinner {
  width: 1.125rem;
  height: 1.125rem;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 640ms linear infinite;
  flex-shrink: 0;
}

.spinner-lg { width: 2rem; height: 2rem; border-width: 3px; }

/* ── صفحه ورود ──────────────────────────────────────────────────── */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg, #eef2ff 0%, #f6f7fb 45%, #e0e7ff 100%);
}

.dark .auth-page {
  background: linear-gradient(135deg, #0b0d13 0%, #12141c 45%, #1a1735 100%);
}

/* حباب‌های تزئینی پس‌زمینه */
.auth-blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(72px);
  opacity: 0.4;
  pointer-events: none;
  animation: blob-float 18s ease-in-out infinite;
}

.auth-blob-1 {
  width: 26rem; height: 26rem;
  background: var(--brand-400);
  top: -7rem; inset-inline-start: -7rem;
}

.auth-blob-2 {
  width: 22rem; height: 22rem;
  background: #a78bfa;
  bottom: -6rem; inset-inline-end: -5rem;
  animation-delay: -6s;
}

.auth-blob-3 {
  width: 17rem; height: 17rem;
  background: #38bdf8;
  top: 45%; inset-inline-end: 18%;
  animation-delay: -12s;
  opacity: 0.28;
}

.dark .auth-blob { opacity: 0.22; }

/* کارت شیشه‌ای */
.auth-card {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 25.5rem;
  padding: 2.25rem 2rem;
  border-radius: var(--radius-xl);
  background-color: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(22px) saturate(180%);
  -webkit-backdrop-filter: blur(22px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.75);
  box-shadow: 0 22px 48px -12px rgba(16, 24, 40, 0.22);
  animation: card-rise 480ms var(--ease-out);
}

.dark .auth-card {
  background-color: rgba(18, 20, 28, 0.72);
  border-color: rgba(255, 255, 255, 0.07);
  box-shadow: 0 22px 48px -12px rgba(0, 0, 0, 0.6);
}

/* پشتیبان برای نبود backdrop-filter */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .auth-card { background-color: rgba(255, 255, 255, 0.97); }
  .dark .auth-card { background-color: rgba(18, 20, 28, 0.97); }
}

/* ── ویرایشگر و محتوای مقاله ────────────────────────────────────── */
.prose {
  font-size: 0.9375rem;
  line-height: 2.05;
  color: var(--text);
  word-wrap: break-word;
}

.prose > * + * { margin-top: 1.05em; }

.prose h1, .prose h2, .prose h3, .prose h4 {
  margin-top: 1.7em;
  margin-bottom: 0.6em;
  font-weight: 700;
  line-height: 1.45;
}

.prose h1 { font-size: 1.6em; }
.prose h2 { font-size: 1.35em; }
.prose h3 { font-size: 1.15em; }
.prose h4 { font-size: 1em; }

.prose p { margin-bottom: 1.05em; }

.prose a {
  color: var(--brand-600);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.prose a:hover { color: var(--brand-700); }

.prose ul, .prose ol {
  padding-inline-start: 1.6em;
  margin-bottom: 1.05em;
}

.prose ul { list-style: disc; }
.prose ol { list-style: decimal; }
.prose li { margin-bottom: 0.4em; }

.prose blockquote {
  padding-inline-start: 1.05em;
  border-inline-start: 3px solid var(--brand-400);
  color: var(--text-soft);
  font-style: normal;
  margin: 1.4em 0;
}

.prose code {
  padding: 0.15em 0.4em;
  background-color: var(--surface-3);
  border-radius: var(--radius-sm);
  font-family: 'Courier New', monospace;
  font-size: 0.875em;
  direction: ltr;
  display: inline-block;
}

.prose pre {
  padding: 1.05em;
  background-color: #1e1e2e;
  color: #cdd6f4;
  border-radius: var(--radius-md);
  overflow-x: auto;
  direction: ltr;
  text-align: left;
  margin: 1.4em 0;
  line-height: 1.7;
}

.prose pre code {
  background: none;
  padding: 0;
  color: inherit;
  display: block;
}

.prose img {
  border-radius: var(--radius-md);
  margin: 1.4em auto;
  box-shadow: var(--shadow-sm);
}

.prose table {
  width: 100%;
  margin: 1.4em 0;
  font-size: 0.9em;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.prose th, .prose td {
  padding: 0.6em 0.85em;
  border: 1px solid var(--border);
  text-align: start;
}

.prose th { background-color: var(--surface-2); font-weight: 600; }

.prose hr { margin: 2em 0; border-top: 1px solid var(--border); }

.prose mark {
  background-color: #fef08a;
  color: #713f12;
  padding: 0.1em 0.2em;
  border-radius: 3px;
}

.dark .prose mark { background-color: rgba(250, 204, 21, 0.28); color: #fde68a; }

/* ── نوار اسکرول سفارشی ─────────────────────────────────────────── */
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background-color: var(--border-strong);
  border-radius: var(--radius-full);
  border: 2px solid var(--bg);
}
::-webkit-scrollbar-thumb:hover { background-color: var(--text-muted); }

* { scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }

/* ── دسترس‌پذیری ────────────────────────────────────────────────── */
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

/* پرش به محتوا برای کاربران صفحه‌خوان */
.skip-link {
  position: absolute;
  inset-inline-start: -9999px;
  top: 0;
  z-index: 200;
  padding: 0.75rem 1.25rem;
  background-color: var(--brand-600);
  color: #fff;
  border-radius: 0 0 var(--radius) 0;
}

.skip-link:focus { inset-inline-start: 0; }

/* ==========================================================================
   ۶. انیمیشن‌ها
   ========================================================================== */

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

@keyframes skeleton-loading {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(12px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes toast-out {
  from { opacity: 1; transform: translateY(0); }
  to   { opacity: 0; transform: translateY(8px) scale(0.97); }
}

@keyframes modal-in {
  from { opacity: 0; transform: translateY(14px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes dropdown-in {
  from { opacity: 0; transform: translateY(-5px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes card-rise {
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: translateY(0); }
}

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

@keyframes blob-float {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33%      { transform: translate(24px, -28px) scale(1.06); }
  66%      { transform: translate(-18px, 16px) scale(0.95); }
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-6px); }
  40%, 80% { transform: translateX(6px); }
}

.animate-fade-in { animation: fade-in 260ms var(--ease); }
.animate-shake { animation: shake 420ms var(--ease); }
.animate-spin { animation: spin 640ms linear infinite; }

/* احترام به تنظیم کاهش حرکت کاربر */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ==========================================================================
   ۷. واکنش‌گرایی
   ========================================================================== */

/* ≥ 640px */
@media (min-width: 640px) {
  .sm\:flex { display: flex; }
  .sm\:hidden { display: none; }
  .sm\:block { display: block; }
  .sm\:inline { display: inline; }
  .sm\:grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sm\:flex-row { flex-direction: row; }
  .sm\:w-auto { width: auto; }
  .sm\:text-2xl { font-size: 1.375rem; }
}

/* ≥ 768px */
@media (min-width: 768px) {
  .md\:flex { display: flex; }
  .md\:hidden { display: none; }
  .md\:block { display: block; }
  .md\:grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .md\:grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .md\:grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .md\:col-span-2 { grid-column: span 2 / span 2; }
  .md\:flex-row { flex-direction: row; }
  .md\:w-auto { width: auto; }
  .md\:p-6 { padding: 1.5rem; }
}

/* ≥ 1024px */
@media (min-width: 1024px) {
  .lg\:flex { display: flex; }
  .lg\:hidden { display: none; }
  .lg\:block { display: block; }
  .lg\:grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .lg\:grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .lg\:grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .lg\:col-span-2 { grid-column: span 2 / span 2; }
  .lg\:col-span-3 { grid-column: span 3 / span 3; }
}

/* ≥ 1280px */
@media (min-width: 1280px) {
  .xl\:grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .xl\:grid-cols-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
}

/* ── موبایل و تبلت: نوار کناری کشویی ───────────────────────────── */
@media (max-width: 1023px) {
  .sidebar {
    transform: translateX(100%);
    box-shadow: var(--shadow-xl);
  }

  /* در LTR نوار از سمت چپ می‌آید */
  [dir='ltr'] .sidebar { transform: translateX(-100%); }

  .sidebar.is-open { transform: translateX(0); }

  .main-wrap { margin-inline-start: 0; }

  .page-content { padding: 1rem; }

  .board {
    grid-template-columns: 1fr;
  }

  .board-column { max-height: none; }
}

@media (max-width: 639px) {
  body { font-size: 13px; }

  .page-content { padding: 0.875rem; }

  .card-body { padding: 1rem; }

  .modal { max-width: 100%; }

  .toast-container {
    inset-inline: 0.75rem;
    bottom: 0.75rem;
  }

  .toast { min-width: 0; max-width: 100%; }

  .stat-value { font-size: 1.5rem; }

  /* جدول در موبایل: اسکرول افقی */
  .data-table { font-size: 0.75rem; }
  .data-table thead th,
  .data-table tbody td { padding: 0.625rem 0.75rem; }
}

/* ==========================================================================
   ۸. چاپ
   ========================================================================== */

@media print {
  .sidebar,
  .topbar,
  .no-print,
  .toast-container,
  .btn { display: none !important; }

  .main-wrap { margin: 0 !important; }

  body { background: #fff; color: #000; font-size: 11pt; }

  .card {
    border: 1px solid #ccc;
    box-shadow: none;
    break-inside: avoid;
  }

  a[href]::after { content: ' (' attr(href) ')'; font-size: 9pt; color: #555; }
}
