/* Vazirmatn محلی سرو می‌شود، نه از CDN.
   دو دلیل: Google Fonts در ایران قابل اتکا نیست (و سامانه روی شبکه‌ی داخلی
   سرو می‌شود)، پس فونت اغلب اصلاً نمی‌رسید و صفحه به Tahoma می‌افتاد؛ و
   @import در ابتدای فایل رندر را تا دریافت پاسخِ CDN بلاک می‌کند.
   فایل‌ها در wwwroot/fonts/ با مجوز SIL OFL (کنارشان OFL.txt) از مخزن رسمی
   rastikerdar/vazirmatn v33.003. فقط شش وزنی که این شیوه‌نامه استفاده می‌کند
   آورده شده‌اند. */
@font-face {
  font-family: 'Vazirmatn';
  src: url('../fonts/Vazirmatn-Light.woff2') format('woff2');
  font-weight: 300;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Vazirmatn';
  src: url('../fonts/Vazirmatn-Regular.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Vazirmatn';
  src: url('../fonts/Vazirmatn-Medium.woff2') format('woff2');
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Vazirmatn';
  src: url('../fonts/Vazirmatn-SemiBold.woff2') format('woff2');
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Vazirmatn';
  src: url('../fonts/Vazirmatn-Bold.woff2') format('woff2');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Vazirmatn';
  src: url('../fonts/Vazirmatn-ExtraBold.woff2') format('woff2');
  font-weight: 800;
  font-style: normal;
  font-display: swap;
}

/* تم روشن پردیسان.

   نام متغیرها عمداً دست‌نخورده مانده (از جمله --bg-dark که حالا مقدار روشن دارد)
   چون ۳۸ صفحه‌ی موجود به همین نام‌ها ارجاع می‌دهند؛ تغییر نام یعنی ویرایش همه‌ی
   آن‌ها در یک قدم و ریسک جا افتادن چند مورد. فقط مقادیر عوض شده‌اند.

   رنگ‌های متن نسبت به ماکت مرجع کمی تیره‌تر شده‌اند تا نسبت کنتراست روی سفید به
   حداقل ۴٫۵:۱ برسد (--text-muted ≈ ۵٫۰:۱ و --text-dim ≈ ۴٫۷:۱)؛ مقادیر خود ماکت
   حدود ۴٫۳:۱ بودند. */
:root {
  --bg-dark: #f5f7fa;          /* پس‌زمینه‌ی صفحه (نام قدیمی، مقدار روشن) */
  --bg-card: #ffffff;
  --bg-card-hover: #f0f8f7;
  --bg-subtle: #f7f9fa;        /* ردیف/نوار ملایم داخل کارت */
  --border-card: #e6ecef;

  --text-main: #203a43;
  --text-muted: #5f727c;
  --text-dim: #64767f;

  --accent-gold: #b47b16;
  /* #148f99 روی پس‌زمینه‌ی سفید فقط ۳٫۸۳:۱ کنتراست داشت و ستون «کد» جدول‌ها با
     همین رنگ نوشته می‌شود؛ تیره‌تر شد تا به ۴٫۷:۱ برسد (حداقل لازم ۴٫۵:۱). */
  --accent-cyan: #0e8089;
  --accent-purple: #855ac3;
  --accent-emerald: #16776d;
  --accent-rose: #c95367;
  --accent-indigo: #586ac3;

  --primary: #187b70;
  --primary-soft: #eaf5f2;
  --primary-ink: #16776d;

  --radius-lg: 20px;
  --radius-md: 12px;
  --radius-sm: 8px;

  --shadow-main: 0 6px 24px rgba(33, 62, 75, 0.05);
  --font-persian: 'Vazirmatn', Tahoma, -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: var(--font-persian);
}

body {
  background-color: var(--bg-dark);
  color: var(--text-main);
  direction: rtl;
  min-height: 100vh;
  overflow-x: hidden;
  font-size: 14px;
}

button, input, select, textarea { font: inherit; }
button { cursor: pointer; color: inherit; }
a { color: inherit; }

/* focus قابل دیدن روی همه‌ی کنترل‌ها — الزام دسترس‌پذیری. */
button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid #37afa1;
  outline-offset: 2px;
}

[hidden] { display: none !important; }

.app-container {
  display: flex;
  min-height: 100vh;
}

/* ---------- Sidebar ---------- */
.sidebar {
  width: 250px;
  flex-shrink: 0;
  background: #fff;
  border-left: 1px solid var(--border-card);
  padding: 1.6rem 1rem 1.2rem;
  display: flex;
  flex-direction: column;
  z-index: 30;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  scrollbar-width: thin;
}

.brand-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0 0.5rem 1.6rem;
}

.brand-logo {
  width: 43px;
  height: 43px;
  flex-shrink: 0;
  border-radius: 14px;
  background: var(--primary);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 1.5rem;
}

.brand-title {
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -1px;
  color: var(--text-main);
}

.brand-caption {
  font-size: 0.66rem;
  color: var(--text-muted);
  margin-top: 1px;
}

.nav-label {
  font-size: 0.7rem;
  color: var(--text-dim);
  padding: 0.5rem 0.85rem 0.6rem;
}

.nav-group { margin-bottom: 0.35rem; }

/* دکمه‌ی گروه — در نسخه‌ی قبلی .nav-item یک لینک بود؛ حالا دکمه‌ی آکاردئون است
   و لینک‌های واقعی به .submenu-link منتقل شده‌اند. */
.nav-item {
  display: flex;
  width: 100%;
  align-items: center;
  gap: 0.7rem;
  border: 0;
  background: transparent;
  border-radius: 10px;
  padding: 0.8rem 0.85rem;
  font-weight: 500;
  font-size: 0.9rem;
  text-align: right;
  color: var(--text-main);
  transition: background-color 0.2s ease;
}

.nav-item:hover { background: #f2f6f7; }

.nav-icon {
  font-size: 1.15rem;
  width: 22px;
  text-align: center;
  color: #5c807c;
  flex-shrink: 0;
}

.chevron {
  margin-right: auto;
  font-size: 1rem;
  color: var(--text-dim);
  transition: transform 0.2s ease;
}

.nav-group.open > .nav-item {
  background: var(--primary-soft);
  color: var(--primary-ink);
}

.nav-group.open > .nav-item .chevron { transform: rotate(90deg); }

.submenu {
  border-right: 1px solid #cee3dd;
  margin: 0.3rem 1.4rem 0.5rem 0;
  padding-right: 0.8rem;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.submenu-link {
  display: block;
  text-align: right;
  border-radius: 8px;
  padding: 0.6rem 0.6rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  text-decoration: none;
}

.submenu-link:hover { color: var(--primary-ink); background: #eef7f4; }

.submenu-link.active {
  color: var(--primary-ink);
  background: #eef7f4;
  font-weight: 600;
}

.sidebar-bottom { margin-top: auto; padding-top: 1.6rem; }

.workspace {
  border: 1px solid var(--border-card);
  border-radius: 12px;
  padding: 0.7rem;
  display: flex;
  gap: 0.6rem;
  align-items: center;
  font-size: 0.82rem;
}

.workspace small {
  display: block;
  color: var(--text-muted);
  font-size: 0.65rem;
  margin-top: 3px;
}

.avatar {
  display: grid;
  place-items: center;
  background: #f1e7db;
  color: #7d5630;
  border-radius: 12px;
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  font-weight: 700;
}

/* دکمه‌ی منوی موبایل و لایه‌ی پشت کشو — در دسکتاپ پنهان‌اند. */
.menu-toggle, .close-menu {
  display: none;
  background: #fff;
  border: 1px solid var(--border-card);
  border-radius: 8px;
  padding: 0.45rem 0.7rem;
  line-height: 1;
}

.close-menu { margin-right: auto; font-size: 1.1rem; }

.overlay { display: none; }

/* ---------- Main ---------- */
.main-wrapper {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.top-navbar {
  min-height: 72px;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border-card);
  padding: 1rem 2.2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  position: sticky;
  top: 0;
  z-index: 20;
}

.breadcrumb { color: var(--text-muted); font-size: 0.78rem; }
.breadcrumb b { color: var(--text-main); font-weight: 600; }

.header-left { display: flex; gap: 0.75rem; align-items: center; }

.top-navbar .user-badge {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  background: var(--bg-subtle);
  padding: 0.4rem 0.8rem;
  border-radius: 999px;
  border: 1px solid var(--border-card);
}

.content-area {
  padding: 2rem 2.2rem;
  max-width: 1560px;
  width: 100%;
  margin-inline: auto;
}

/* ---------- Cards ---------- */
.glass-card {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-lg);
  padding: 1.4rem;
  box-shadow: var(--shadow-main);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.glass-card:hover { border-color: #cfdde2; }

.card-title {
  font-size: 0.98rem;
  font-weight: 700;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

/* ---------- Grid ---------- */
/* min(...) لازم است: با minmax(400px, 1fr) خالی، در صفحه‌های باریک‌تر از ۴۰۰px
   ستون از عرض بدنه بزرگ‌تر می‌شد و کل صفحه اسکرول افقی می‌گرفت. */
.grid-cols-4 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(240px, 100%), 1fr));
  gap: 0.9rem;
}

.grid-cols-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(400px, 100%), 1fr));
  gap: 1.25rem;
}

/* ---------- KPI ---------- */
/* در صفحات موجود همیشه با .glass-card ترکیب می‌شود، پس سطح کارت را از آن
   می‌گیرد و این کلاس فقط چیدمان داخلی را تعریف می‌کند. */
.kpi-tile {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.kpi-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  color: var(--text-muted);
  font-size: 0.8rem;
}

.kpi-value {
  font-size: 1.7rem;
  font-weight: 750;
  letter-spacing: -0.7px;
  color: var(--text-main);
}

.kpi-value small {
  font-size: 0.62rem;
  color: var(--text-muted);
  font-weight: 400;
  letter-spacing: 0;
}

.kpi-badge {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.25rem 0.55rem;
  border-radius: 999px;
  white-space: nowrap;
}

/* رنگ تنها حامل معنا نیست: متن فارسی وضعیت همیشه داخل badge هست. */
.badge-success { background: #e8f5ef; color: #1c6e55; }
.badge-warning { background: #fff5df; color: #7a5510; }
.badge-info    { background: #eef1fc; color: #4a5fa0; }
.badge-danger  { background: #fceaee; color: #a8324a; }

/* ---------- Tables ---------- */
/* جدول در ظرف خودش اسکرول افقی می‌گیرد، نه کل صفحه. */
.table-scroll { overflow-x: auto; }

.custom-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 1rem;
  text-align: right;
  font-size: 0.85rem;
}

.custom-table th, .custom-table td {
  padding: 0.8rem 0.85rem;
  text-align: right;
  border-bottom: 1px solid #eff3f5;
}

.custom-table th {
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 500;
  background: var(--bg-subtle);
}

.custom-table tr:hover td { background: #fafcfc; }

/* ---------- Buttons ---------- */
.btn-primary {
  background: var(--primary);
  color: #fff;
  border: 1px solid var(--primary);
  padding: 0.55rem 1.1rem;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.82rem;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.btn-primary:hover { background: #14685f; }

.btn-secondary {
  background: #fff;
  color: var(--text-main);
  border: 1px solid var(--border-card);
  padding: 0.55rem 1.1rem;
  border-radius: var(--radius-sm);
  font-weight: 500;
  font-size: 0.82rem;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.btn-secondary:hover { background: var(--bg-subtle); }

/* دکمه‌ی آیکونی داخل جدول (مثل دانلود پیوست) — ظاهر متن، رفتار دکمه. */
.btn-icon-link {
  background: none;
  border: none;
  padding: 0.1rem 0.25rem;
  font-size: 1rem;
  cursor: pointer;
  line-height: 1;
  border-radius: 4px;
  transition: background-color 0.15s ease;
}

.btn-icon-link:hover { background: #eef2f4; }

/* ---------- Forms ---------- */
.form-label {
  display: block;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 0.4rem;
}

.form-control {
  width: 100%;
  background: #fafcfd;
  border: 1px solid var(--border-card);
  color: var(--text-main);
  padding: 0.6rem 0.85rem;
  border-radius: var(--radius-sm);
  outline: none;
  transition: border-color 0.2s ease;
}

.form-control::placeholder { color: var(--text-dim); }
.form-control:focus { border-color: var(--primary); }

/* ---------- صفحهٔ خانه ---------- */
.page-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.page-heading h1 {
  font-size: 1.55rem;
  letter-spacing: -0.7px;
  margin-bottom: 0.4rem;
}

.date-pill {
  font-size: 0.75rem;
  background: #fff;
  border: 1px solid var(--border-card);
  padding: 0.55rem 0.8rem;
  border-radius: 10px;
  white-space: nowrap;
  color: var(--text-muted);
}

.hero {
  border: 1px solid #d7e9e1;
  background: linear-gradient(110deg, #e3f1e9, #f0f7ed 60%, #f8fbf6);
  border-radius: var(--radius-lg);
  padding: 1.8rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
  overflow: hidden;
}

.hero h2 { font-size: 1.35rem; margin-bottom: 0.55rem; letter-spacing: -0.5px; }
.hero p { font-size: 0.8rem; max-width: 460px; color: var(--text-muted); line-height: 1.9; }

.eyebrow { color: #3f6b56; font-size: 0.7rem; font-weight: 600; margin-bottom: 0.55rem; }

.hero-art {
  width: 160px;
  height: 120px;
  position: relative;
  flex-shrink: 0;
  display: grid;
  place-items: center;
}

.carpet {
  width: 88px;
  height: 110px;
  background: repeating-linear-gradient(0deg, transparent 0 5px, rgba(255,255,255,0.16) 5px 6px), #78a28c;
  border: 7px double #d5e7ce;
  outline: 1px solid #8bab93;
  border-radius: 3px;
  transform: rotate(-17deg);
  box-shadow: 14px 16px 0 rgba(55, 101, 76, 0.05);
  display: grid;
  place-items: center;
}

.carpet:before { content: '❖'; color: #eaf4df; font-size: 3.5rem; }

.hero-tag {
  position: absolute;
  bottom: 2px;
  right: 4px;
  background: #fff;
  padding: 0.35rem 0.6rem;
  border-radius: 8px;
  font-size: 0.65rem;
  box-shadow: var(--shadow-main);
  color: #2f7c68;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.section-heading h2 { font-size: 0.98rem; font-weight: 700; }
.section-heading span { font-size: 0.72rem; color: var(--text-muted); }

.modules {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.9rem;
  margin-bottom: 1.75rem;
  /* هر کارت به اندازه‌ی محتوای خودش قد بکشد. پیش‌فرض grid یعنی
     align-items:stretch بود، پس با باز شدن یک کارت، هم‌ردیف‌های بسته‌اش هم
     به همان ارتفاع کشیده می‌شدند. */
  align-items: start;
}

.module-card {
  background: #fff;
  border: 1px solid var(--border-card);
  border-radius: 15px;
  overflow: hidden;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.module-card:hover { border-color: #b5d8cb; box-shadow: 0 8px 20px rgba(33, 72, 56, 0.03); }
.module-card.open { border-color: #b9d8ce; }

.module-head {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1.25rem;
  width: 100%;
  background: none;
  border: 0;
  text-align: right;
}

.module-symbol {
  width: 44px;
  height: 44px;
  border-radius: 13px;
  display: grid;
  place-items: center;
  font-size: 1.4rem;
  flex-shrink: 0;
}

.module-text { min-width: 0; }
.module-text h3 { font-size: 0.88rem; margin-bottom: 0.3rem; }
.module-text p { font-size: 0.68rem; line-height: 1.7; color: var(--text-muted); }

.module-head .chevron { color: #8c9ba2; }
.module-card.open .module-head .chevron { transform: rotate(-90deg); }

.module-links {
  border-top: 1px solid var(--border-card);
  padding: 0.55rem 0.85rem;
  background: #fbfdfc;
  display: grid;
  gap: 3px;
}

.module-links a {
  text-align: right;
  padding: 0.55rem 0.6rem;
  border-radius: 7px;
  font-size: 0.8rem;
  color: var(--text-muted);
  text-decoration: none;
}

.module-links a:hover { background: #eaf5f0; color: var(--primary-ink); }

/* ---------- واکنش‌گرایی ---------- */
@media (max-width: 1150px) {
  .sidebar { width: 220px; padding-inline: 0.7rem; }
  .content-area { padding: 1.5rem; }
  .top-navbar { padding-inline: 1.5rem; }
  .modules { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 760px) {
  /* سایدبار به کشوی سمت راست تبدیل می‌شود. */
  .sidebar {
    position: fixed;
    right: 0;
    top: 0;
    bottom: 0;
    width: 280px;
    height: 100dvh;
    transform: translateX(100%);
    transition: transform 0.2s ease;
    z-index: 40;
  }

  .sidebar.mobile-open { transform: translateX(0); }

  .overlay.visible {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(21, 45, 66, 0.38);
    z-index: 35;
  }

  /* دکمه در MainLayout نیست (آن کامپوننت تعاملی نیست)، پس ثابت می‌نشیند و
     هدر به‌اندازه‌ی آن از سمت شروع (راست) فاصله می‌گیرد. */
  .menu-toggle {
    display: block;
    position: fixed;
    top: 0.85rem;
    right: 1.1rem;
    z-index: 38;
  }

  .close-menu { display: block; }

  .top-navbar {
    padding: 0.8rem 1.1rem;
    padding-inline-start: 3.6rem;
    min-height: 64px;
  }

  .breadcrumb { font-size: 0.7rem; }
  .content-area { padding: 1.35rem 1.1rem; }
  .page-heading { align-items: flex-start; }
  .page-heading h1 { font-size: 1.3rem; }
  .date-pill { font-size: 0.68rem; padding: 0.4rem 0.6rem; }

  .hero { padding: 1.4rem 1.25rem; gap: 0.5rem; }
  .hero h2 { font-size: 1.12rem; }
  .hero p { font-size: 0.72rem; }
  .hero-art { width: 78px; transform: scale(0.8); margin-left: -10px; }

  .modules { gap: 0.6rem; }
  .module-head { padding: 0.95rem 0.75rem; gap: 0.55rem; }
  .module-symbol { width: 36px; height: 36px; font-size: 1.2rem; }
  .module-text h3 { font-size: 0.78rem; }
  .module-text p { font-size: 0.62rem; }

  .glass-card { padding: 1.05rem; }
  .kpi-value { font-size: 1.45rem; }

  /* جدول باید داخل ظرف خودش اسکرول افقی بگیرد، نه اینکه کل صفحه را پهن کند.
     display:block روی خود جدول اعمال می‌شود چون جدول‌های ۳۸ صفحه‌ی موجود در
     wrapper پیچیده نشده‌اند و پیچیدن دستی همه‌ی آن‌ها خارج از دامنه‌ی این مرحله
     است؛ این راه‌حل فقط CSS است و به markup صفحات دست نمی‌زند. */
  .custom-table {
    display: block;
    overflow-x: auto;
    white-space: nowrap;
    max-width: 100%;
  }
}

@media (max-width: 380px) {
  .modules, .grid-cols-4 { grid-template-columns: 1fr; }
  .date-pill { display: none; }
  .hero-art { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* ---------- نمودارهای صفحهٔ نخست ---------- */
/* چهار نمودار در یک ردیف؛ زیر ۱۱۵۰px دو‌تایی و در موبایل تک‌ستونی می‌شوند تا
   محتوای نمودار هرگز فشرده و ناخوانا نشود. */
.charts-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.9rem;
  align-items: start;
}

.chart-card {
  background: #fff;
  border: 1px solid var(--border-card);
  border-radius: 15px;
  padding: 1rem 1.05rem 0.9rem;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  min-height: 208px;
}

.chart-head { display: flex; align-items: baseline; justify-content: space-between; gap: 0.5rem; }
.chart-head h3 { font-size: 0.92rem; font-weight: 800; margin: 0; }
.chart-head span { font-size: 0.72rem; color: var(--text-muted); }

.chart-body { display: flex; flex-direction: column; gap: 0.4rem; flex: 1; justify-content: center; }
.chart-svg { width: 100%; height: 96px; display: block; }
.chart-empty { color: var(--text-muted); font-size: 0.82rem; text-align: center; margin: auto 0; }

.chart-axis { display: flex; justify-content: space-between; font-size: 0.68rem; color: var(--text-muted); }
.chart-foot { font-size: 0.74rem; color: var(--text-muted); border-top: 1px solid var(--border-card); padding-top: 0.5rem; }
.chart-foot b { color: var(--text-strong, #1d3b34); }

/* قیف */
.funnel { display: flex; flex-direction: column; gap: 0.42rem; }
.funnel-row { display: grid; grid-template-columns: 5.2rem 1fr 1.9rem; align-items: center; gap: 0.4rem; }
.funnel-label { font-size: 0.72rem; color: var(--text-muted); white-space: nowrap; }
.funnel-track { background: #eef4f2; border-radius: 999px; height: 9px; overflow: hidden; }
.funnel-track i { display: block; height: 100%; border-radius: 999px; }
.funnel-count { font-size: 0.75rem; font-weight: 700; text-align: left; }

/* دونات و گیج */
.chart-donut { width: 100%; height: 108px; display: block; }
.chart-gauge { width: 100%; height: 84px; display: block; }
.donut-value { font-size: 17px; font-weight: 800; fill: #1d3b34; }
.donut-label { font-size: 8px; fill: #7b918a; }
.gauge-value { font-size: 15px; font-weight: 800; }

.chart-legend { display: flex; flex-wrap: wrap; gap: 0.3rem 0.7rem; font-size: 0.72rem; color: var(--text-muted); }
.chart-legend span { display: inline-flex; align-items: center; gap: 0.28rem; }
.chart-legend i { width: 9px; height: 9px; border-radius: 3px; display: inline-block; }
.chart-legend b { color: #1d3b34; }
.gauge-legend { justify-content: center; }

@media (max-width: 1150px) {
  .charts-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 760px) {
  .charts-row { grid-template-columns: 1fr; }
}

/* ============================================================
   اسناد چاپی (پیش‌فاکتور / پروفرما / دیتاشیت / قرارداد فروش)

   window.print() تا پیش از این کل صفحه — سایدبار، هدر، دکمه‌ها و
   کارت‌های کاری — را چاپ می‌کرد. اینجا هر چیزی جز بلوک سند پنهان
   می‌شود، پس خروجی چاپ همان سندی است که کاربر روی صفحه می‌بیند.
   جهت سند (rtl/ltr) روی خود عنصر ست می‌شود و دست‌نخورده می‌ماند.
   ============================================================ */

/* ---- سربرگ و بدنه‌ی برگه‌ی چاپی (روی صفحه هم همین شکل دیده می‌شود) ---- */
.print-sheet { padding: 1rem 1.25rem; line-height: 2; }

.print-letterhead {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  border-bottom: 2px solid var(--border-card, #cfdad6);
  padding-bottom: 0.6rem;
}

.print-letterhead__company { font-size: 1.15rem; font-weight: 800; }
.print-letterhead__meta { display: flex; gap: 1.25rem; font-size: 0.85rem; color: var(--text-muted); }

.print-title {
  text-align: center;
  font-size: 1.25rem;
  font-weight: 800;
  margin: 1.25rem 0 1rem;
}

.print-parties {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.print-parties__label { font-size: 0.8rem; color: var(--text-muted); }
.print-parties__sub { font-size: 0.82rem; color: var(--text-muted); }

.print-body h2 { font-size: 0.95rem; font-weight: 800; margin: 1rem 0 0.35rem; }
.print-body p { margin: 0; white-space: pre-wrap; }

.print-signatures {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  margin-top: 3.5rem;
  text-align: center;
  font-size: 0.88rem;
}

.print-signatures__line {
  margin-top: 2.5rem;
  border-top: 1px dashed var(--border-card, #99a8a3);
}

.print-footer {
  margin-top: 2rem;
  padding-top: 0.6rem;
  border-top: 1px solid var(--border-card, #cfdad6);
  font-size: 0.78rem;
  color: var(--text-muted);
  text-align: center;
}

@media print {
  body * { visibility: hidden !important; }

  #printable-document,
  #printable-document *,
  .printable-document,
  .printable-document * { visibility: visible !important; }

  #printable-document,
  .printable-document {
    position: absolute;
    inset-inline-start: 0;
    top: 0;
    width: 100%;
    margin: 0;
    padding: 0;
    border: none !important;
    box-shadow: none !important;
    background: #fff !important;
    color: #000 !important;
  }

  /* دکمه‌ها و نوار ابزارِ داخل سند نباید روی کاغذ بیایند. */
  #printable-document button,
  .printable-document button,
  .no-print,
  .no-print * { display: none !important; visibility: hidden !important; }

  #printable-document .custom-table,
  .printable-document .custom-table { width: 100%; border-collapse: collapse; }

  #printable-document .custom-table th,
  #printable-document .custom-table td,
  .printable-document .custom-table th,
  .printable-document .custom-table td {
    border: 1px solid #999 !important;
    color: #000 !important;
    padding: 4px 6px;
  }

  /* جدول، ردیف و بلوک امضا نباید بین دو صفحه نصف شوند. */
  #printable-document tr,
  .printable-document tr,
  .print-signatures { page-break-inside: avoid; }

  .print-letterhead { border-bottom: 2px solid #000 !important; }
  .print-footer { border-top: 1px solid #999 !important; }
  .print-signatures__line { border-top: 1px dashed #000 !important; }

  @page { margin: 12mm; }
}
