/* ====== Dashboard Pro (RTL-first) – Refactor of your CSS ======
   - سازگار با همان کلاس‌های فعلی شما
   - ریسپانسیو، حرفه‌ای، با دارک‌مود و انیمیشن‌های لطیف
   - بدون نیاز به تغییر HTML/PHP
============================================================== */

@import url('https://cdn.jsdelivr.net/gh/rastikerdar/vazirmatn@v33.003/Vazirmatn-font-face.css');

/* ===== Tokens & Theme ===== */
:root {
  /* رنگ‌ها */
  --bg: #fff6fb;
  --card: #ffffff;
  --grad1: #7a1fa0;
  --grad2: #e91e63;
  --txt: #1d1b26;
  --muted: #7a7a7a;
  --success-bg: #e8fff0;
  --success-txt: #0a8f43;
  --error-bg: #ffecec;
  --error-txt: #d32f2f;

  /* سایز و ریتم */
  --r-sm: 10px;
  --r-md: 14px;
  --r-lg: 24px;
  --sp-1: 6px;
  --sp-2: 10px;
  --sp-3: 14px;
  --sp-4: 18px;
  --sp-5: 24px;
  --sp-6: 32px;

  /* خطوط و سایه */
  --bd: #eee;
  --shadow-1: 0 8px 20px rgba(0,0,0,.06);
  --shadow-2: 0 10px 30px rgba(233,30,99,.25);

  /* حداکثر عرض کانتینر */
  --container: 1200px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f0e13;
    --card: #16151c;
    --txt: #f3f2f7;
    --muted: #a8a8b2;
    --bd: #272736;
    --shadow-1: 0 8px 24px rgba(0,0,0,.35);
    --shadow-2: 0 16px 40px rgba(0,0,0,.55);
    --success-bg: rgba(16,185,129,.12);
    --error-bg: rgba(239,68,68,.12);
  }
}

/* ===== Base ===== */
*,
*::before,
*::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }
html[dir="rtl"] { direction: rtl; }

* { font-family: "Vazirmatn", system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans Arabic", Arial, sans-serif; }

body {
  margin: 0;
  background: radial-gradient(1200px 700px at 85% -10%, color-mix(in oklab, var(--grad2) 7%, transparent), transparent 60%) no-repeat,
              var(--bg);
  color: var(--txt);
  line-height: 1.7;
}

/* ===== Links ===== */
a {
  color: var(--grad2);
  text-decoration: none;
  transition: opacity .2s ease;
}
a:hover { text-decoration: underline; opacity: .9; }

/* ===== Headings ===== */
h1, h2, h3, h4, h5 {
  font-weight: 900;
  margin-top: 0;
  color: var(--txt);
  letter-spacing: -.015em;
}

/* ===== Container ===== */
.container {
  width: min(100% - 32px, var(--container));
  margin-inline: auto;
  margin-block: 24px;
  padding-inline: 16px; /* برای ایمنی در صفحات خیلی کوچک */
}

/* ===== Hero / Header ===== */
.hero {
  background: linear-gradient(120deg, var(--grad1), var(--grad2));
  color: #fff;
  border-radius: var(--r-lg);
  padding: 28px;
  box-shadow: var(--shadow-2);
  position: relative;
  overflow: clip;
}
.hero h1, .hero h2, .hero h3 { color: #fff; }
.hero::after {
  /* افکت نوری لطیف */
  content: "";
  position: absolute;
  inset-inline-start: -40px;
  inset-block-start: -40px;
  width: 220px; height: 220px;
  background: radial-gradient(circle at 60% 40%, rgba(255,255,255,.25), transparent 60%);
  border-radius: 50%;
  pointer-events: none;
}

/* ===== Buttons & Inputs ===== */
button, input, select {
  border-radius: var(--r-sm);
  border: 1px solid var(--bd);
  padding: 10px 12px;
  font-weight: 600;
  font-size: 14px;
  background: #fff;
  color: var(--txt);
  outline: none;
  transition: transform .12s ease, border-color .2s ease, box-shadow .2s ease, background .2s ease, color .2s ease;
}
@media (prefers-color-scheme: dark) {
  button, input, select { background: var(--card); }
}
input[type="text"], input[type="number"], input[type="file"], select { width: 100%; }

button {
    cursor: pointer;
}
button:hover { transform: translateY(-1px); filter: brightness(1.03); }
button:active { transform: translateY(0); }

input:focus, select:focus {
  border-color: color-mix(in oklab, var(--grad1) 45%, var(--bd));
  box-shadow: 0 0 0 3px color-mix(in oklab, var(--grad2) 20%, transparent);
}

/* ===== Cards ===== */
.card {
  background: var(--card);
  border-radius: var(--r-lg);
  padding: 16px;
  box-shadow: var(--shadow-1);
  margin-top: 16px;
  border: 1px solid var(--bd);
}

/* ===== Grid ===== */
.grid { display: grid; gap: 16px; }
.grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }

@media (max-width: 1200px) {
  .grid.cols-3 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 900px) {
  .grid.cols-3 { grid-template-columns: 1fr; }
}

/* ===== KPI ===== */
.kpi {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
.kpi .big {
  font-size: 24px;
  font-weight: 900;
  letter-spacing: -.02em;
}
.kpi .delta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--bd);
  background: color-mix(in oklab, var(--grad1) 10%, var(--card));
  color: var(--txt);
}
.kpi .delta.down {
  background: color-mix(in oklab, var(--error-txt) 12%, var(--card));
  color: var(--error-txt);
}

/* ===== Text Utils ===== */
.muted { opacity: .9; font-size: 13px; color: var(--muted); }

/* ===== Tables ===== */
table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0 8px;
}
th, td {
  text-align: center;
  padding: 10px 12px;
}
thead th {
  font-weight: 800;
  background: color-mix(in oklab, var(--grad1) 6%, var(--card));
  border-top: 1px solid var(--bd);
  border-bottom: 1px solid var(--bd);
}
tbody tr {
  background: var(--card);
  transition: background .2s ease, transform .12s ease;
  border: 1px solid var(--bd);
}
tbody tr:hover {
  background: color-mix(in oklab, var(--grad2) 6%, var(--card));
  transform: translateY(-1px);
}


/* برای ستون‌های مالی خواناتر */
.money { font-variant-numeric: tabular-nums; letter-spacing: .02em; direction: ltr; unicode-bidi: plaintext; }

/* ===== Pills / Badges ===== */
.pill {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 12px;
  border: 1px solid var(--bd);
  background: var(--card);
}
.green { background: var(--success-bg); color: var(--success-txt); border-color: color-mix(in oklab, var(--success-txt) 22%, var(--bd)); }
.red   { background: var(--error-bg);   color: var(--error-txt);   border-color: color-mix(in oklab, var(--error-txt) 22%, var(--bd)); }

/* ===== Top 10 list ===== */
.top10 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.top10 li {
  padding: 10px 12px;
  background: var(--card);
  border: 1px solid var(--bd);
  border-radius: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
@media (max-width: 720px) {
  .top10 { grid-template-columns: 1fr; }
}

/* ===== Navigation / Footer ===== */
.nav { margin: 12px 0; }
.nav a {
  display: inline-block;
  margin-inline-start: 8px;
  color: #fff;
}

.footer {
  margin: 24px 0 8px;
  text-align: center;
  color: var(--muted);
  font-size: 12px;
}

/* ===== Messages ===== */
.msg {
  background: var(--card);
  border-radius: 10px;
  padding: 8px 12px;
  margin-top: 10px;
  border: 1px solid var(--bd);
  box-shadow: var(--shadow-1);
}

/* ===== Focus & Motion A11y ===== */
:focus-visible { outline: none; box-shadow: 0 0 0 3px color-mix(in oklab, var(--grad2) 20%, transparent); }
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

/* ===== گزارشات: جدول و نمودار کنار هم ===== */
.report-pair {
  display: grid;
  grid-template-columns: 1fr 1fr; /* دو ستون مساوی */
  align-items: start;
  gap: 24px;
  margin-block: 24px;
}

.report-pair table {
  width: 100%;
}

@media (max-width: 900px) {
  .report-pair {
    grid-template-columns: 1fr; /* در موبایل زیر هم بیاد */
  }
}

/* رنگ رشد مثبت و منفی */
.growth-pos {
  background-color: #e8fff0;
  color: #0a8f43;
  font-weight: 700;
}
.growth-neg {
  background-color: #ffecec;
  color: #d32f2f;
  font-weight: 700;
}

.growth.neutral{background:#f5f5f5;color:#777;}

.year-summary{ margin-bottom: 8px; }
.ys-grid{
  display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:16px; align-items:stretch;
}
@media(max-width:900px){ .ys-grid{ grid-template-columns:1fr; } }
.ys-box{
  border:1px solid var(--bd, #eee);
  background:var(--card, #fff);
  border-radius:16px; padding:16px;
}
.ys-title{ font-weight:900; margin:0 0 10px; }
.ys-kpis{ display:grid; gap:8px; font-size:14px; }
.ys-kpis .lbl{ color:var(--muted,#7a7a7a); margin-inline-start:6px; }
.ys-kpis .val{ font-weight:800; }
.ys-diff .val .growth{ margin-inline-start:6px; }
.growth{ display:inline-flex; align-items:center; gap:6px; padding:4px 10px;
  border-radius:999px; font-weight:800; border:1px solid transparent;
}
.growth.pos{ background:#e8fff0; color:#0a8f43; border-color:#b8eac9; }
.growth.neg{ background:#ffecec; color:#d32f2f; border-color:#f6c2c2; }
.growth.neutral{ background:#f5f5f5; color:#777; border-color:#e5e5e5; }
.growth .arrow{ font-size:12px; opacity:.9; }

    .chip-bar{display:flex;flex-wrap:wrap;gap:10px;margin-top:12px}
    .chip{display:flex;align-items:center;gap:8px;padding:8px 12px;border:1px solid var(--bd);background:var(--card);border-radius:20px}
    .chip label{font-size:12px;color:var(--muted)}
    .chip select{border:0;outline:0;background:transparent}
    
    .charts-wrap {
    display: grid;
    gap: 16px;
    margin: 10px 0;
}
.chart-card {
  background: #fff;
  border: 1px solid rgba(0,0,0,.1);
  border-radius: 12px;
  padding: 12px;
}
.chart-card h4 { margin: 0 0 8px; font-weight: 600; }
.chart-card canvas { width: 100%; }
html.dark .chart-card { background: rgba(255,255,255,.06); border-color: rgba(255,255,255,.14); }

/* ظرف نمودار باید ارتفاع ثابت داشته باشد */
.chart-card {
  position: relative;
  height: 280px; /* ارتفاع ثابت (می‌تونی 220/260/320 بذاری) */
}

/* بومِ نمودار کل ظرف را پر کند */
.chart-card canvas {
  position: absolute;
  inset: 0;            /* top/right/bottom/left = 0 */
  width: 100% !important;
  height: 100% !important;
  padding:10px;
}
    
    
    /* کارت نمودار خدمات (Pie/Doughnut) کمی بلندتر باشد */
#chartService { /* خود canvas */
  width: 100% !important;
  height: 100% !important;
}
.chart-card.chart-service {
  position: relative;
  height: 340px; /* پیشنهاد برای Pie */
}

.chart-card.chart-service { padding-bottom: 12px; }
.two-pies {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}
@media (min-width: 900px) {
  .two-pies { grid-template-columns: 1fr 1fr; }
}
.pie-block { background: rgba(0,0,0,.03); border: 1px solid rgba(0,0,0,.08); border-radius: 12px; padding: 10px; }
html.dark .pie-block { background: rgba(255,255,255,.06); border-color: rgba(255,255,255,.14); }
.pie-title { font-weight: 600; margin-bottom: 6px; text-align: center; }

.pie-wrap { position: relative; height: 320px; }
.pie-wrap canvas {
  position: absolute; inset: 0;
  width: 100% !important; height: 100% !important;
}
    