/* ============================================================
   مَدار — سیستم طراحی به سبک shadcn/ui (RTL، فارسی)
   ============================================================ */

@font-face {
  font-family: 'Vazirmatn';
  src: url('/fonts/Vazirmatn-Regular.woff2') format('woff2');
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: 'Vazirmatn';
  src: url('/fonts/Vazirmatn-Medium.woff2') format('woff2');
  font-weight: 500 600;
  font-display: swap;
}
@font-face {
  font-family: 'Vazirmatn';
  src: url('/fonts/Vazirmatn-Bold.woff2') format('woff2');
  font-weight: 700 800;
  font-display: swap;
}

/* ===== سیستم طراحی تلگرام — تم روشن (Telegram Day) ===== */
:root {
  --background: 0 0% 100%;
  --foreground: 0 0% 11%;
  --card: 0 0% 100%;
  --card-foreground: 0 0% 11%;
  --popover: 0 0% 100%;
  --popover-foreground: 0 0% 11%;
  --primary: 211 84% 56%;            /* آبی تلگرام #3390EC */
  --primary-foreground: 0 0% 100%;
  --secondary: 240 7% 95%;
  --secondary-foreground: 0 0% 13%;
  --muted: 240 7% 96%;
  --muted-foreground: 210 4% 46%;    /* خاکستری راهنمای تلگرام #707579 */
  --accent: 211 84% 95%;             /* تینت آبی روشن */
  --accent-foreground: 211 84% 40%;
  --destructive: 4 75% 53%;          /* قرمز تلگرام */
  --destructive-foreground: 0 0% 100%;
  --success: 134 61% 41%;            /* سبز تیک تلگرام */
  --success-foreground: 0 0% 100%;
  --warning: 36 100% 50%;
  --warning-foreground: 0 0% 100%;
  --border: 220 13% 91%;
  --input: 220 13% 89%;
  --ring: 211 84% 56%;
  --radius: 0.75rem;

  /* نوار کناری تلگرام در تم روشن: سفید با متن تیره و انتخاب آبی */
  --sidebar: 0 0% 100%;
  --sidebar-foreground: 0 0% 13%;
  --sidebar-muted: 210 4% 46%;
  --sidebar-accent: 211 84% 56%;
  --sidebar-hover: 240 7% 95%;
  --sidebar-border: 220 13% 92%;

  --shadow-sm: 0 1px 2px hsl(214 30% 30% / 0.06);
  --shadow: 0 1px 3px hsl(214 30% 30% / 0.08), 0 1px 2px hsl(214 30% 30% / 0.04);
  --shadow-md: 0 6px 18px hsl(214 30% 30% / 0.10), 0 2px 6px hsl(214 30% 30% / 0.06);
  --shadow-lg: 0 16px 40px hsl(214 30% 25% / 0.18);
}

/* ===== تم تیره (Telegram Night) ===== */
.dark {
  --background: 214 40% 9%;          /* #0E1621 ناحیه محتوا */
  --foreground: 0 0% 98%;
  --card: 210 30% 13%;              /* #17212B پنل */
  --card-foreground: 0 0% 98%;
  --popover: 210 30% 13%;
  --popover-foreground: 0 0% 98%;
  --primary: 211 84% 60%;           /* آبی تلگرام روشن‌تر در شب */
  --primary-foreground: 0 0% 100%;
  --secondary: 214 26% 19%;
  --secondary-foreground: 0 0% 96%;
  --muted: 214 24% 18%;
  --muted-foreground: 211 18% 58%;  /* #708499 */
  --accent: 214 26% 22%;
  --accent-foreground: 0 0% 96%;
  --destructive: 4 70% 58%;
  --destructive-foreground: 0 0% 100%;
  --success: 134 50% 50%;
  --warning: 36 90% 55%;
  --border: 214 22% 22%;
  --input: 214 22% 24%;
  --ring: 211 84% 60%;

  --sidebar: 210 30% 13%;           /* #17212B */
  --sidebar-foreground: 0 0% 92%;
  --sidebar-muted: 211 18% 56%;
  --sidebar-accent: 211 84% 56%;
  --sidebar-hover: 214 26% 20%;
  --sidebar-border: 0 0% 100% / 0.06;

  --shadow-sm: 0 1px 2px hsl(0 0% 0% / 0.3);
  --shadow: 0 1px 3px hsl(0 0% 0% / 0.4);
  --shadow-md: 0 6px 18px hsl(0 0% 0% / 0.45);
  --shadow-lg: 0 16px 40px hsl(0 0% 0% / 0.55);
}

* { box-sizing: border-box; }

body, .card, .btn, .input, .select, .textarea, .sidebar, .topbar, .dialog, .bell-panel, .search-panel {
  transition: background-color .25s ease, border-color .25s ease, color .25s ease;
}

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  font-family: 'Vazirmatn', 'Segoe UI', Tahoma, system-ui, sans-serif;
  background: hsl(var(--background));
  background-image:
    radial-gradient(900px 500px at 100% -5%, hsl(var(--primary) / 0.06), transparent 60%),
    radial-gradient(800px 500px at 0% 0%, hsl(var(--primary) / 0.04), transparent 55%);
  background-attachment: fixed;
  color: hsl(var(--foreground));
  font-size: 14px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; font-size: 14px; }
h1, h2, h3, h4 { margin: 0; font-weight: 700; letter-spacing: -0.01em; }

/* ---------- چیدمان اصلی ---------- */
.layout {
  display: grid;
  grid-template-columns: 96px 1fr;
  min-height: 100vh;
}

/* ---------- نوار کناری ---------- */
.sidebar {
  background: hsl(var(--sidebar));
  color: hsl(var(--sidebar-foreground));
  display: flex;
  flex-direction: column;
  padding: 12px 8px;
  position: sticky;
  top: 0;
  height: 100vh;
  border-left: 1px solid hsl(var(--sidebar-border));
}

/* ---------- نوار باریک (rail) ---------- */
.rail-brand { display: flex; justify-content: center; padding: 6px 0 12px; }
.rail-logo { filter: drop-shadow(0 4px 10px hsl(211 84% 50% / 0.35)); }
.rail { display: flex; flex-direction: column; gap: 3px; flex: 1; min-height: 0; overflow-y: auto; padding-bottom: 8px; }
.rail::-webkit-scrollbar { width: 0; }
.rail { scrollbar-width: none; }
.rail-item {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 9px 4px; border-radius: 14px; text-decoration: none;
  color: hsl(var(--sidebar-muted)); transition: background .12s, color .12s;
}
.rail-item:hover { background: hsl(var(--sidebar-hover)); color: hsl(var(--sidebar-foreground)); }
.rail-item.active { background: hsl(var(--sidebar-accent) / 0.12); color: hsl(var(--sidebar-accent)); }
.rail-fa { font-size: 11.5px; font-weight: 600; text-align: center; line-height: 1.25; }
.rail-en { font-size: 8.5px; font-weight: 500; opacity: 0.65; text-align: center; line-height: 1; letter-spacing: .2px; }
.rail-foot { display: flex; flex-direction: column; align-items: center; gap: 6px; padding-top: 10px; border-top: 1px solid hsl(var(--sidebar-border)); }
.rail-avatar {
  width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center;
  background: hsl(var(--sidebar-accent)); color: #fff; font-weight: 700; font-size: 15px;
}
.brand { display: flex; align-items: center; gap: 12px; padding: 6px 8px 20px; }
.brand-mark {
  width: 42px; height: 42px; border-radius: 12px;
  background: hsl(var(--sidebar-accent));
  display: grid; place-items: center; font-size: 22px;
  box-shadow: 0 8px 20px hsl(var(--sidebar-accent) / 0.4);
}
.brand-logo { font-size: 21px; font-weight: 800; color: hsl(var(--sidebar-foreground)); line-height: 1.1; }
.brand-sub { font-size: 11.5px; color: hsl(var(--sidebar-muted)); }
.nav { display: flex; flex-direction: column; gap: 3px; flex: 1; min-height: 0; overflow-y: auto; margin-top: 6px; }
/* اسکرول‌بار باریک و هم‌رنگ نوار کناری */
.nav::-webkit-scrollbar { width: 6px; }
.nav::-webkit-scrollbar-thumb { background: hsl(var(--sidebar-muted) / 0.35); border-radius: 99px; }
.nav { scrollbar-width: thin; scrollbar-color: hsl(var(--sidebar-muted) / 0.35) transparent; }
.nav-label { font-size: 11px; color: hsl(var(--sidebar-muted)); padding: 12px 12px 6px; font-weight: 600; }
.nav a {
  display: flex; align-items: center; gap: 11px;
  padding: 10px 13px; border-radius: 10px;
  color: hsl(var(--sidebar-foreground) / 0.86);
  font-weight: 500; font-size: 14px;
  transition: background .12s, color .12s;
}
.nav a:hover { background: hsl(var(--sidebar-hover)); color: hsl(var(--sidebar-foreground)); }
.nav a.active {
  background: hsl(var(--sidebar-accent));
  color: #fff;
}
.nav a:active { transform: scale(0.985); }
.ic-svg { display: inline-block; vertical-align: middle; flex-shrink: 0; }
.nav-ic { width: 20px; height: 20px; flex-shrink: 0; }
.sidebar-foot { font-size: 11px; color: hsl(var(--sidebar-muted)); text-align: center; padding-top: 14px; }
.user-box { border-top: 1px solid hsl(var(--sidebar-border)); padding-top: 14px; margin-top: 8px; }
.user-info { display: flex; align-items: center; gap: 10px; }
.user-avatar {
  width: 36px; height: 36px; border-radius: 50%; flex-shrink: 0;
  background: hsl(var(--sidebar-accent)); color: #fff;
  display: grid; place-items: center; font-weight: 700; font-size: 15px;
}
.user-name { font-size: 13px; font-weight: 600; color: hsl(var(--sidebar-foreground)); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { font-size: 11px; color: hsl(var(--sidebar-muted)); }

/* ---------- محتوای اصلی ---------- */
.main { display: flex; flex-direction: column; min-width: 0; }
.topbar {
  height: 62px; background: hsl(var(--background) / 0.85);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid hsl(var(--border));
  display: flex; align-items: center; gap: 14px; padding: 0 26px;
  position: sticky; top: 0; z-index: 20;
}
.topbar-title { font-size: 17px; font-weight: 700; white-space: nowrap; }
.topbar-date {
  font-size: 12.5px; color: hsl(var(--muted-foreground));
  background: hsl(var(--muted)); padding: 5px 12px; border-radius: 8px;
}
.menu-btn { display: none; background: none; border: none; font-size: 22px; color: hsl(var(--foreground)); }
.icon-btn {
  background: none; border: 1px solid transparent; font-size: 18px; width: 40px; height: 40px;
  border-radius: 10px; display: grid; place-items: center; color: hsl(var(--foreground)); transition: background .15s;
}
.icon-btn:hover { background: hsl(var(--accent)); }

/* ---------- جستجوی سراسری ---------- */
.search-wrap { flex: 1; max-width: 440px; margin: 0 auto; position: relative; display: flex; align-items: center; }
.search-ic { position: absolute; inset-inline-start: 13px; color: hsl(var(--muted-foreground)); pointer-events: none; }
.search-input {
  width: 100%; height: 40px; border: 1px solid hsl(var(--input)); background: hsl(var(--muted) / 0.5);
  border-radius: 20px; padding: 0 14px; padding-inline-start: 38px; color: hsl(var(--foreground)); outline: none; transition: all .15s;
}
.search-input:focus { background: hsl(var(--background)); border-color: hsl(var(--ring)); box-shadow: 0 0 0 3px hsl(var(--ring) / 0.15); }
.search-backdrop { position: fixed; inset: 0; z-index: 40; }
.search-panel {
  position: absolute; top: 48px; right: 0; left: 0; z-index: 50;
  background: hsl(var(--popover)); border: 1px solid hsl(var(--border)); border-radius: 12px;
  box-shadow: var(--shadow-lg); overflow: hidden; max-height: 70vh; overflow-y: auto;
}
.search-item { display: flex; align-items: center; gap: 11px; padding: 10px 14px; cursor: pointer; border-bottom: 1px solid hsl(var(--border)); }
.search-item:last-child { border-bottom: none; }
.search-item:hover { background: hsl(var(--accent)); }
.search-ic { font-size: 18px; width: 24px; text-align: center; }
.search-title { font-weight: 600; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.search-sub { font-size: 11.5px; color: hsl(var(--muted-foreground)); }

/* ---------- زنگوله اعلان ---------- */
.bell-wrap { position: relative; }
.bell-btn { position: relative; background: none; border: none; font-size: 20px; width: 40px; height: 40px; border-radius: 10px; transition: background .15s; }
.bell-btn:hover { background: hsl(var(--accent)); }
.bell-badge {
  position: absolute; top: 3px; left: 3px; min-width: 17px; height: 17px; padding: 0 4px;
  background: hsl(var(--destructive)); color: #fff; border-radius: 10px;
  font-size: 10px; font-weight: 700; display: grid; place-items: center; line-height: 1;
}
.bell-backdrop { position: fixed; inset: 0; z-index: 40; }
.bell-panel {
  position: absolute; top: 48px; left: 0; z-index: 50; width: 340px;
  background: hsl(var(--popover)); border: 1px solid hsl(var(--border)); border-radius: 12px;
  box-shadow: var(--shadow-lg); overflow: hidden;
}
.bell-head { display: flex; align-items: center; justify-content: space-between; padding: 13px 16px; border-bottom: 1px solid hsl(var(--border)); font-size: 14px; }
.bell-list { max-height: 60vh; overflow-y: auto; }
.bell-item { display: flex; gap: 11px; padding: 12px 16px; cursor: pointer; border-bottom: 1px solid hsl(var(--border)); }
.bell-item:last-child { border-bottom: none; }
.bell-item:hover { background: hsl(var(--accent)); }
.bell-item.unread { background: hsl(var(--primary) / 0.05); }
.bell-item.unread .bell-title::after { content: '●'; color: hsl(var(--primary)); font-size: 9px; margin-right: 6px; vertical-align: middle; }
.bell-ic { font-size: 18px; width: 26px; text-align: center; flex-shrink: 0; }
.bell-title { font-weight: 600; font-size: 13.5px; }
.bell-msg { font-size: 12.5px; color: hsl(var(--muted-foreground)); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bell-time { font-size: 11px; color: hsl(var(--muted-foreground)); margin-top: 3px; }

.content { padding: 26px; max-width: 1320px; width: 100%; margin: 0 auto; }
.loading { padding: 70px; text-align: center; color: hsl(var(--muted-foreground)); }

/* ---------- کارت (shadcn) ---------- */
.card {
  background: hsl(var(--card));
  color: hsl(var(--card-foreground));
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  transition: box-shadow .2s ease, transform .2s ease, border-color .2s ease;
}
.card-pad { padding: 22px; }
.card + .card, .stack > * + * { margin-top: 18px; }
.card-header { padding: 18px 22px 0; }
.card-title { font-size: 16px; font-weight: 700; }
.card-desc { font-size: 12.5px; color: hsl(var(--muted-foreground)); margin-top: 3px; }
.card-content { padding: 18px 22px; }

.page-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 14px; margin-bottom: 22px; flex-wrap: wrap;
}
.page-head h2 { font-size: 22px; }
.page-head .sub { color: hsl(var(--muted-foreground)); font-size: 13px; margin-top: 4px; }

.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.flex { display: flex; align-items: center; gap: 8px; }
.flex-between { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.gap { gap: 10px; }
.wrap { flex-wrap: wrap; }
.grow { flex: 1; }
.mt { margin-top: 16px; }
.muted { color: hsl(var(--muted-foreground)); }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.divider { height: 1px; background: hsl(var(--border)); margin: 16px 0; }

/* ---------- کارت آماری ---------- */
.stat { display: flex; align-items: center; gap: 14px; padding: 20px; position: relative; overflow: hidden; }
.stat::before {
  content: ''; position: absolute; top: 0; right: 0; width: 4px; height: 100%;
  background: hsl(var(--primary)); opacity: .85;
}
.stat:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
.stat .ic {
  width: 50px; height: 50px; border-radius: 14px;
  display: grid; place-items: center; font-size: 23px; flex-shrink: 0;
  color: hsl(var(--primary));
  background: linear-gradient(135deg, hsl(var(--primary) / 0.16), hsl(var(--primary) / 0.06));
}
.stat .v { font-size: 27px; font-weight: 800; line-height: 1.15; letter-spacing: -0.02em; }
.stat .l { font-size: 12.5px; color: hsl(var(--muted-foreground)); }

/* ---------- دکمه (shadcn) ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  border: 1px solid hsl(var(--border));
  background: hsl(var(--background));
  color: hsl(var(--foreground));
  padding: 0 15px; height: 38px;
  border-radius: 8px; font-weight: 600; font-size: 13.5px;
  white-space: nowrap; transition: background .15s, border-color .15s, opacity .15s;
}
.btn:hover { background: hsl(var(--accent)); }
.btn:focus-visible { outline: none; box-shadow: 0 0 0 2px hsl(var(--background)), 0 0 0 4px hsl(var(--ring)); }
.btn:disabled { opacity: .5; pointer-events: none; }
.btn:active { transform: translateY(1px); }
.btn-primary { background: hsl(var(--primary)); border-color: hsl(var(--primary)); color: hsl(var(--primary-foreground)); box-shadow: 0 2px 8px hsl(var(--primary) / 0.3); }
.btn-primary:hover { background: hsl(var(--primary) / 0.92); box-shadow: 0 4px 14px hsl(var(--primary) / 0.4); }
.btn-destructive { background: hsl(var(--background)); border-color: hsl(var(--destructive) / 0.4); color: hsl(var(--destructive)); }
.btn-destructive:hover { background: hsl(var(--destructive) / 0.08); }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-ghost:hover { background: hsl(var(--accent)); }
.btn-sm { height: 32px; padding: 0 11px; font-size: 12.5px; border-radius: 7px; }
.btn-icon { height: 32px; width: 32px; padding: 0; }
.btn-block { width: 100%; }

/* ---------- فرم (shadcn) ---------- */
.field { margin-bottom: 15px; }
.field > label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 7px; }
.field .hint { font-size: 11.5px; color: hsl(var(--muted-foreground)); font-weight: 400; }
.input, .select, .textarea {
  width: 100%;
  border: 1px solid hsl(var(--input));
  background: hsl(var(--background));
  border-radius: 8px;
  padding: 0 12px; height: 40px;
  color: hsl(var(--foreground));
  outline: none; transition: border-color .15s, box-shadow .15s;
}
.textarea { height: auto; min-height: 110px; padding: 10px 12px; line-height: 1.9; resize: vertical; }
.input:focus, .select:focus, .textarea:focus {
  border-color: hsl(var(--ring));
  box-shadow: 0 0 0 3px hsl(var(--ring) / 0.18);
}
.input::placeholder, .textarea::placeholder { color: hsl(var(--muted-foreground)); }
.select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: left 12px center; padding-left: 34px; }
.dark .select { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.form-grid .full { grid-column: 1 / -1; }

/* انتخابگر چندتایی (chips) */
.chips {
  display: flex; flex-wrap: wrap; gap: 6px;
  border: 1px solid hsl(var(--input)); border-radius: 8px;
  padding: 8px; min-height: 42px; background: hsl(var(--background));
}
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  background: hsl(var(--primary) / 0.1); color: hsl(var(--primary));
  padding: 4px 10px; border-radius: 7px; font-size: 12.5px; font-weight: 600;
}
.chip .x { cursor: pointer; opacity: .65; font-weight: 700; }
.chip .x:hover { opacity: 1; }

/* ---------- جدول ---------- */
.table-wrap { overflow-x: auto; border: 1px solid hsl(var(--border)); border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; background: hsl(var(--card)); }
th, td { padding: 11px 14px; text-align: right; border-bottom: 1px solid hsl(var(--border)); white-space: nowrap; }
thead th { background: hsl(var(--muted) / 0.5); font-weight: 600; font-size: 12.5px; color: hsl(var(--muted-foreground)); }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: hsl(var(--muted) / 0.4); }
td.col-wrap, th.col-wrap { white-space: normal; min-width: 170px; }
.row-click { cursor: pointer; }

/* ---------- بج (shadcn) ---------- */
.badge {
  display: inline-flex; align-items: center; padding: 2px 10px; border-radius: 20px;
  font-size: 11.5px; font-weight: 600; border: 1px solid transparent; line-height: 1.7;
}
.badge-secondary { background: hsl(var(--secondary)); color: hsl(var(--secondary-foreground)); }
.badge-primary { background: hsl(var(--primary) / 0.12); color: hsl(var(--primary)); }
.badge-success { background: hsl(var(--success) / 0.14); color: hsl(var(--success)); }
.badge-warning { background: hsl(var(--warning) / 0.16); color: hsl(var(--warning)); }
.badge-destructive { background: hsl(var(--destructive) / 0.12); color: hsl(var(--destructive)); }
.badge-outline { border-color: hsl(var(--border)); color: hsl(var(--muted-foreground)); }

.tag-product {
  background: hsl(var(--muted)); border: 1px solid hsl(var(--border));
  border-radius: 6px; padding: 2px 9px; font-size: 12px; font-weight: 500;
}

/* ---------- نوار پیشرفت ---------- */
.progress { background: hsl(var(--muted)); border-radius: 20px; height: 8px; overflow: hidden; min-width: 60px; flex: 1; }
.progress > span { display: block; height: 100%; border-radius: 20px; transition: width .3s; }
.progress-lg { height: 11px; }
.progress-wrap { display: flex; align-items: center; gap: 9px; min-width: 86px; }
.progress-val { font-size: 12px; font-weight: 700; min-width: 36px; }

/* ---------- چارت سازمانی ---------- */
.org-tree { padding: 10px; min-width: max-content; margin: 0 auto; }
.org-node { display: flex; flex-direction: column; align-items: center; }
.org-card {
  background: hsl(var(--card)); border: 1px solid hsl(var(--border)); border-radius: 11px;
  padding: 11px 16px; min-width: 168px; text-align: center;
  box-shadow: 0 1px 2px hsl(222 47% 11% / 0.05); cursor: pointer; transition: border-color .15s, box-shadow .15s;
}
.org-card:hover { border-color: hsl(var(--ring)); box-shadow: 0 4px 12px hsl(222 47% 11% / 0.08); }
.org-card .t { font-weight: 700; font-size: 13.5px; }
.org-card .n { color: hsl(var(--muted-foreground)); font-size: 12.5px; margin-top: 3px; }
.org-card.root { background: hsl(var(--primary)); border-color: hsl(var(--primary)); color: #fff; }
.org-card.root .n { color: hsl(var(--primary-foreground) / 0.85); }
.org-children { display: flex; gap: 20px; padding-top: 26px; position: relative; justify-content: center; }
.org-children::before { content: ''; position: absolute; top: 0; right: 50%; width: 2px; height: 26px; background: hsl(var(--border)); }
.org-child { position: relative; }
.org-child::before { content: ''; position: absolute; top: -26px; right: 50%; width: 2px; height: 26px; background: hsl(var(--border)); }

/* ---------- نامه (سربرگ و چاپ) ---------- */
.letter-paper {
  background: #fff; color: hsl(222.2 84% 4.9%); border: 1px solid hsl(var(--border)); border-radius: var(--radius);
  padding: 40px 46px; max-width: 840px; margin: 0 auto;
  box-shadow: 0 1px 3px hsl(222 47% 11% / 0.06); line-height: 2.1;
}
/* کاغذ نامه همیشه سفید است؛ متن مات/برچسب‌ها هم رنگ ثابت تیره داشته باشند تا در حالت تیره خوانا بمانند */
.letter-paper .muted, .letter-paper .lbl, .letter-to .lbl { color: hsl(215.4 16.3% 46.9%); }
.letter-head { display: flex; justify-content: space-between; align-items: flex-start; border-bottom: 2px solid hsl(var(--primary)); padding-bottom: 16px; margin-bottom: 24px; }
.letter-head .org { font-size: 21px; font-weight: 800; color: hsl(var(--primary)); }
.letter-meta { font-size: 13px; color: #333; text-align: left; line-height: 2; }
.letter-meta b { color: #000; }
.letter-to { margin: 16px 0; }
.letter-to .lbl { color: hsl(var(--muted-foreground)); font-weight: 600; }
.letter-subject { font-weight: 700; margin: 16px 0; font-size: 15.5px; }
.letter-body { white-space: pre-wrap; min-height: 150px; }
.letter-sign { margin-top: 46px; text-align: left; line-height: 2; }
.letter-cc { margin-top: 32px; padding-top: 14px; border-top: 1px dashed hsl(var(--border)); font-size: 13px; color: #333; }

/* ---------- OKR ---------- */
.okr-meta-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px 22px; }
.okr-meta-grid .m .k { font-size: 12px; color: hsl(var(--muted-foreground)); margin-bottom: 2px; }
.okr-meta-grid .m .vv { font-weight: 600; }
.objective { border: 1px solid hsl(var(--border)); border-radius: var(--radius); margin-top: 14px; overflow: hidden; }
.objective-head {
  background: linear-gradient(90deg, hsl(var(--primary) / 0.08), hsl(var(--primary) / 0.02));
  padding: 13px 16px; display: flex; align-items: center; gap: 12px; justify-content: space-between;
}
.objective-head .ttl { font-weight: 700; font-size: 14.5px; display: flex; align-items: center; gap: 8px; }
.kr-block { padding: 6px 16px 16px; }
.kr-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 11px 4px; border-bottom: 1px solid hsl(var(--border)); }
.kr-head .ttl { font-weight: 600; display: flex; align-items: center; gap: 8px; }
.kr-head .ttl b { color: hsl(var(--primary)); }

/* ---------- دیالوگ (shadcn) ---------- */
.overlay { position: fixed; inset: 0; background: hsl(222 47% 11% / 0.55); display: grid; place-items: center; z-index: 90; padding: 20px; animation: fade .15s ease; }
.dialog {
  background: hsl(var(--popover)); color: hsl(var(--popover-foreground));
  border: 1px solid hsl(var(--border)); border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  width: 100%; max-width: 560px; max-height: 92vh; overflow: auto; animation: pop .15s ease;
}
.dialog.wide { max-width: 860px; }
.dialog-head { display: flex; align-items: flex-start; justify-content: space-between; padding: 20px 22px 0; }
.dialog-head h3 { font-size: 17px; }
.dialog-head .desc { font-size: 12.5px; color: hsl(var(--muted-foreground)); margin-top: 3px; }
.dialog-body { padding: 20px 22px; }
.dialog-foot { display: flex; justify-content: flex-start; gap: 10px; padding: 0 22px 20px; flex-wrap: wrap; }
.close-x { background: none; border: none; font-size: 20px; color: hsl(var(--muted-foreground)); line-height: 1; padding: 4px; border-radius: 6px; }
.close-x:hover { background: hsl(var(--accent)); }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: scale(.97); } }

/* ---------- Toast (shadcn) ---------- */
.toast-host { position: fixed; bottom: 22px; left: 22px; z-index: 100; display: flex; flex-direction: column; gap: 10px; max-width: 360px; }
.toast {
  background: hsl(var(--popover)); color: hsl(var(--popover-foreground));
  border: 1px solid hsl(var(--border)); border-radius: 10px;
  padding: 13px 16px; box-shadow: var(--shadow-md);
  font-size: 13.5px; display: flex; align-items: center; gap: 10px; animation: slidein .2s ease;
}
.toast .dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; background: hsl(var(--muted-foreground)); }
.toast.success { border-color: hsl(var(--success) / 0.4); }
.toast.success .dot { background: hsl(var(--success)); }
.toast.error { border-color: hsl(var(--destructive) / 0.4); }
.toast.error .dot { background: hsl(var(--destructive)); }
@keyframes slidein { from { transform: translateY(12px); opacity: 0; } }

/* ---------- تایم‌لاین گردش نامه ---------- */
.timeline { position: relative; padding-right: 6px; }
.tl-item { position: relative; padding-right: 22px; padding-bottom: 16px; }
.tl-item:last-child { padding-bottom: 0; }
.tl-item::before { content: ''; position: absolute; right: 5px; top: 14px; bottom: -2px; width: 2px; background: hsl(var(--border)); }
.tl-item:last-child::before { display: none; }
.tl-dot { position: absolute; right: 0; top: 4px; width: 12px; height: 12px; border-radius: 50%; background: hsl(var(--warning)); border: 2px solid hsl(var(--background)); box-shadow: 0 0 0 1px hsl(var(--warning)); }
.tl-dot.done { background: hsl(var(--success)); box-shadow: 0 0 0 1px hsl(var(--success)); }
.tl-body { font-size: 13px; display: flex; flex-direction: column; gap: 4px; }
.tl-time { font-size: 11px; color: hsl(var(--muted-foreground)); }

/* ---------- کارتابل (تب‌ها) ---------- */
.tabs { display: flex; gap: 6px; border-bottom: 1px solid hsl(var(--border)); margin-bottom: 18px; flex-wrap: wrap; }
.tab {
  padding: 10px 16px; border: none; background: none; font-weight: 600; font-size: 14px;
  color: hsl(var(--muted-foreground)); border-bottom: 2px solid transparent; margin-bottom: -1px; cursor: pointer;
  display: flex; align-items: center; gap: 7px;
}
.tab:hover { color: hsl(var(--foreground)); }
.tab.active { color: hsl(var(--primary)); border-bottom-color: hsl(var(--primary)); }
.tab .cnt { background: hsl(var(--muted)); color: hsl(var(--muted-foreground)); border-radius: 20px; padding: 1px 8px; font-size: 11.5px; }
.tab.active .cnt { background: hsl(var(--primary) / 0.12); color: hsl(var(--primary)); }

/* ---------- وضعیت خالی ---------- */
.empty { text-align: center; color: hsl(var(--muted-foreground)); padding: 48px 20px; }
.empty .ic { font-size: 42px; margin-bottom: 12px; opacity: .6; }
.link { color: hsl(var(--primary)); cursor: pointer; font-weight: 600; }
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 18px; }
.search { max-width: 300px; }

/* ---------- خطای Blazor ---------- */
#blazor-error-ui {
  display: none; position: fixed; bottom: 0; right: 0; left: 0;
  background: hsl(var(--destructive)); color: #fff; padding: 12px 20px;
  text-align: center; z-index: 1000; box-shadow: 0 -2px 10px rgba(0,0,0,.2);
}
#blazor-error-ui .reload { color: #fff; text-decoration: underline; margin: 0 8px; }
#blazor-error-ui .dismiss { cursor: pointer; position: absolute; left: 16px; top: 12px; }

/* ---------- واکنش‌گرا ---------- */
.sidebar-scrim { display: none; }

/* ---------- راهنمای صفحه ---------- */
.page-help {
  border: 1px solid hsl(var(--primary) / 0.25);
  background: linear-gradient(100deg, hsl(var(--primary) / 0.07), hsl(var(--primary) / 0.02));
  border-radius: var(--radius);
  margin-bottom: 18px;
  overflow: hidden;
}
.help-toggle {
  width: 100%; display: flex; align-items: center; gap: 10px;
  background: none; border: none; padding: 12px 16px;
  font-weight: 600; font-size: 13.5px; color: hsl(var(--foreground)); cursor: pointer;
}
.help-toggle:hover { background: hsl(var(--primary) / 0.06); }
.help-ic { font-size: 17px; }
.help-label { flex: 1; text-align: right; }
.help-chevron { font-size: 10px; color: hsl(var(--muted-foreground)); }
.help-body {
  padding: 4px 16px 16px; display: grid; gap: 14px;
  border-top: 1px solid hsl(var(--primary) / 0.15);
  animation: helpdown .2s ease;
}
.help-sec .help-h { font-weight: 700; font-size: 13px; margin-bottom: 5px; }
.help-sec { font-size: 13px; line-height: 1.9; color: hsl(var(--foreground)); }
.help-steps { margin: 0; padding-inline-start: 20px; display: grid; gap: 3px; }
.help-steps li { font-size: 12.8px; }
.help-tip {
  background: hsl(var(--warning) / 0.1); border: 1px solid hsl(var(--warning) / 0.25);
  border-radius: 9px; padding: 10px 12px;
}
@keyframes helpdown { from { opacity: 0; transform: translateY(-4px); } }

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

/* ---------- تبلت ---------- */
@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; right: 0; top: 0; z-index: 60; width: 96px; height: 100dvh;
    transform: translateX(100%); transition: transform .25s ease; box-shadow: var(--shadow-lg);
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-scrim {
    display: block; position: fixed; inset: 0; z-index: 55;
    background: hsl(222 47% 11% / 0.55); backdrop-filter: blur(1px); animation: fade .2s ease;
  }
  .menu-btn { display: block; }
  .search-wrap { max-width: none; }
}

/* ---------- موبایل ---------- */
@media (max-width: 680px) {
  .grid-2, .grid-3, .grid-4, .form-grid, .okr-meta-grid { grid-template-columns: 1fr; }
  .content { padding: 16px; }
  .topbar { padding: 0 14px; gap: 10px; }
  .topbar-title { font-size: 15.5px; overflow: hidden; text-overflow: ellipsis; }
  .topbar-date { display: none; }
  .search-wrap { display: none; }
  .page-head h2 { font-size: 19px; }
  .page-head { margin-bottom: 18px; }
  .card-pad, .card-content { padding: 16px; }
  .card-header { padding: 16px 16px 0; }
  .letter-paper { padding: 22px 18px; }
  .letter-head { flex-direction: column; gap: 12px; }
  .letter-meta { text-align: right; }
  .objective-head { flex-direction: column; align-items: stretch; gap: 10px; }
  .objective-head .flex { flex-wrap: wrap; }
  .kr-head { flex-direction: column; align-items: stretch; gap: 8px; }
  .overlay { padding: 12px; align-items: flex-end; }
  .dialog { max-height: 88vh; border-bottom-left-radius: 0; border-bottom-right-radius: 0; }
  .dialog-foot { flex-direction: column-reverse; }
  .dialog-foot .btn { width: 100%; }
  .tabs { overflow-x: auto; flex-wrap: nowrap; }
  .tab { white-space: nowrap; }
  .toast-host { left: 12px; right: 12px; max-width: none; }
  .bell-panel { width: min(92vw, 340px); }
  .stat .v { font-size: 23px; }
}

/* ---------- چاپ ---------- */
@media print {
  /* چاپ همیشه روی کاغذ سفید با متن تیره؛ متغیرهای تم تیره برای چاپ خنثی می‌شوند */
  :root, .dark {
    --background: 0 0% 100%; --foreground: 222.2 84% 4.9%;
    --card: 0 0% 100%; --card-foreground: 222.2 84% 4.9%;
    --muted-foreground: 215.4 16.3% 46.9%; --border: 214.3 31.8% 91.4%;
  }
  body { background: #fff; color: hsl(222.2 84% 4.9%); }
  .sidebar, .topbar, .toast-host, .no-print, .btn, .toolbar select { display: none !important; }
  .layout { display: block; }
  .content { padding: 0; max-width: 100%; }
  .letter-paper { border: none; box-shadow: none; max-width: 100%; padding: 0; }
  .objective, .card, .table-wrap { break-inside: avoid; }
}

/* ============================================================
   تسک‌منیجر — پروژه‌ها، تیم‌ها، اعضا، بورد کانبان
   ============================================================ */

.page-h2 { font-size: 18px; font-weight: 800; margin: 0; }
.lang-btn { font-weight: 700; font-size: 12px; }

.icon-btn.sm { width: 30px; height: 30px; font-size: 14px; }

/* گرید کارت‌های پروژه/تیم */
.entity-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.entity-card {
  background: hsl(var(--card)); border: 1px solid hsl(var(--border)); border-radius: var(--radius);
  padding: 16px; box-shadow: var(--shadow-sm); cursor: pointer; transition: all .15s;
}
.entity-card:hover { box-shadow: var(--shadow-md); border-color: hsl(var(--ring) / .5); transform: translateY(-2px); }
.entity-top { display: flex; align-items: center; gap: 12px; }
.entity-icon {
  width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center;
  font-size: 22px; color: #fff; flex-shrink: 0;
}
.entity-meta { flex: 1; min-width: 0; }
.entity-name { font-weight: 700; font-size: 15px; }
.entity-sub { font-size: 12.5px; color: hsl(var(--muted-foreground)); margin-top: 2px; }
.entity-desc { font-size: 13px; color: hsl(var(--muted-foreground)); margin-top: 10px; line-height: 1.7; }

.pbar { height: 7px; background: hsl(var(--muted)); border-radius: 99px; margin-top: 14px; overflow: hidden; }
.pbar-fill { height: 100%; border-radius: 99px; transition: width .3s; }

/* انتخاب رنگ */
.swatch { width: 26px; height: 26px; border-radius: 8px; cursor: pointer; border: 2px solid transparent; }
.swatch.on { border-color: hsl(var(--foreground)); box-shadow: 0 0 0 2px hsl(var(--background)); }

/* فهرست انتخاب (اعضای تیم/چک‌لیست) */
.check-list { display: flex; flex-direction: column; gap: 4px; max-height: 220px; overflow-y: auto; }
.check-row { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 8px; cursor: pointer; }
.check-row:hover { background: hsl(var(--accent)); }
.check-row input[type=checkbox] { width: 16px; height: 16px; accent-color: hsl(var(--primary)); }
.done-text { text-decoration: line-through; color: hsl(var(--muted-foreground)); }

/* فهرست اعضا */
.member-list { display: flex; flex-direction: column; }
.member-row { display: flex; align-items: center; gap: 12px; padding: 11px 6px; border-bottom: 1px solid hsl(var(--border)); }
.member-row:last-child { border-bottom: none; }
.member-avatar {
  width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center;
  background: hsl(var(--primary)); color: hsl(var(--primary-foreground)); font-weight: 700; flex-shrink: 0;
}
.member-info { flex: 1; min-width: 0; }
.member-name { font-weight: 600; font-size: 14px; }
.member-sub { font-size: 12.5px; color: hsl(var(--muted-foreground)); margin-top: 2px; }

/* نوار ابزار تسک */
.task-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }

/* بورد کانبان */
.kanban { display: flex; gap: 14px; overflow-x: auto; padding-bottom: 12px; align-items: flex-start; }
.kanban-col {
  flex: 0 0 280px; background: hsl(var(--muted) / .5); border: 1px solid hsl(var(--border));
  border-radius: var(--radius); display: flex; flex-direction: column; max-height: calc(100vh - 200px);
  transition: background .12s, box-shadow .12s;
}
.kanban-col.drag-over { background: hsl(var(--primary) / .08); box-shadow: inset 0 0 0 2px hsl(var(--primary) / .5); }
.kanban-head {
  display: flex; align-items: center; gap: 8px; padding: 12px 14px; border-top: 3px solid;
  border-radius: var(--radius) var(--radius) 0 0; font-weight: 700; font-size: 13.5px;
}
.kanban-dot { width: 9px; height: 9px; border-radius: 50%; }
.kanban-title { flex: 1; }
.kanban-count { background: hsl(var(--background)); color: hsl(var(--muted-foreground)); border-radius: 99px; padding: 1px 9px; font-size: 12px; }
.kanban-body { padding: 10px; display: flex; flex-direction: column; gap: 9px; overflow-y: auto; }
.kanban-add {
  background: transparent; border: 1px dashed hsl(var(--border)); color: hsl(var(--muted-foreground));
  border-radius: 8px; padding: 7px; cursor: pointer; font-size: 15px; transition: all .15s;
}
.kanban-add:hover { background: hsl(var(--accent)); color: hsl(var(--foreground)); }

/* کارت تسک */
.tcard {
  background: hsl(var(--card)); border: 1px solid hsl(var(--border)); border-radius: 10px;
  padding: 11px; cursor: pointer; box-shadow: var(--shadow-sm); transition: all .12s;
}
.tcard:hover { box-shadow: var(--shadow-md); border-color: hsl(var(--ring) / .5); }
.tcard-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.tcard-num { font-size: 11.5px; color: hsl(var(--muted-foreground)); font-weight: 600; }
.tcard-title { font-size: 13.5px; font-weight: 600; line-height: 1.6; }
.tcard-labels { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 8px; }
.tlabel { font-size: 10.5px; background: hsl(var(--accent)); color: hsl(var(--accent-foreground)); padding: 1px 7px; border-radius: 99px; }
.tcard-foot { display: flex; align-items: center; gap: 8px; margin-top: 9px; flex-wrap: wrap; }
.mini-avatar {
  width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center;
  background: hsl(var(--primary)); color: hsl(var(--primary-foreground)); font-size: 11px; font-weight: 700;
}
.tcard-due, .tcard-check { font-size: 11px; color: hsl(var(--muted-foreground)); }

/* کامنت تسک */
.cmt { padding: 7px 0; border-bottom: 1px solid hsl(var(--border)); font-size: 13px; }
.cmt:last-of-type { border-bottom: none; }

@media (max-width: 640px) {
  .kanban-col { flex-basis: 85vw; }
}

/* تردد */
.btn-lg { padding: 0 26px; height: 46px; font-size: 15px; font-weight: 700; }
.tc-clock { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.tc-now { display: flex; flex-direction: column; gap: 2px; }
.tc-time { font-size: 30px; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: 1px; }
.tc-elapsed { font-size: 18px; font-weight: 700; color: hsl(var(--primary)); font-variant-numeric: tabular-nums; }

/* داشبورد */
.dash-hero { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  background: linear-gradient(135deg, hsl(var(--primary) / .10), hsl(var(--card))); }
.dash-clock { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }

/* گفتگو */
.chat-wrap { display: grid; grid-template-columns: 240px 1fr; gap: 14px; height: calc(100vh - 170px); }
.chat-channels { background: hsl(var(--card)); border: 1px solid hsl(var(--border)); border-radius: var(--radius); padding: 8px; overflow-y: auto; }
.chat-ch { display: flex; align-items: center; gap: 8px; padding: 9px 11px; border-radius: 8px; cursor: pointer; font-size: 13.5px; }
.chat-ch:hover { background: hsl(var(--accent)); }
.chat-ch.on { background: hsl(var(--primary) / .12); color: hsl(var(--primary)); font-weight: 700; }
.chat-main { display: flex; flex-direction: column; background: hsl(var(--card)); border: 1px solid hsl(var(--border)); border-radius: var(--radius); overflow: hidden; }
.chat-msgs { flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.chat-msg { max-width: 75%; align-self: flex-start; }
.chat-msg.mine { align-self: flex-end; }
.chat-bubble { background: hsl(var(--muted)); padding: 8px 12px; border-radius: 12px; font-size: 13.5px; line-height: 1.7; }
.chat-msg.mine .chat-bubble { background: hsl(var(--primary) / .14); }
.chat-msg .who { font-size: 11.5px; color: hsl(var(--muted-foreground)); margin-bottom: 3px; }
.chat-input { display: flex; gap: 8px; padding: 12px; border-top: 1px solid hsl(var(--border)); }
@media (max-width: 640px) {
  .chat-wrap { grid-template-columns: 1fr; height: calc(100vh - 150px); }
  .chat-channels { max-height: 120px; }
}

/* انتخابگر تاریخ شمسی */
.jdp { position: relative; }
.jdp-field { position: relative; display: flex; align-items: center; cursor: pointer; }
.jdp-cal { position: absolute; inset-inline-start: 11px; color: hsl(var(--muted-foreground)); pointer-events: none; }
.jdp-input { cursor: pointer; padding-inline-start: 34px; width: 100%; }
.jdp-backdrop { position: fixed; inset: 0; z-index: 60; }
.jdp-pop {
  position: absolute; z-index: 61; top: calc(100% + 6px); inset-inline-start: 0;
  width: 268px; background: hsl(var(--popover)); border: 1px solid hsl(var(--border));
  border-radius: 14px; box-shadow: var(--shadow-lg); padding: 12px;
}
.jdp-nav { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.jdp-title { font-weight: 700; font-size: 14px; }
.jdp-arrow { background: none; border: none; cursor: pointer; font-size: 20px; color: hsl(var(--muted-foreground)); width: 30px; height: 30px; border-radius: 8px; }
.jdp-arrow:hover { background: hsl(var(--accent)); color: hsl(var(--foreground)); }
.jdp-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.jdp-wd { text-align: center; font-size: 11px; color: hsl(var(--muted-foreground)); padding: 4px 0; font-weight: 600; }
.jdp-day {
  aspect-ratio: 1; border: none; background: none; cursor: pointer; border-radius: 8px;
  font-size: 13px; color: hsl(var(--foreground)); font-variant-numeric: tabular-nums;
}
.jdp-day:hover { background: hsl(var(--accent)); }
.jdp-day.today { border: 1px solid hsl(var(--primary)); }
.jdp-day.sel { background: hsl(var(--primary)); color: #fff; font-weight: 700; }
.jdp-foot { display: flex; gap: 8px; margin-top: 10px; }
.jdp-foot .btn { flex: 1; }

/* کارت‌های KPI گزارشات */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.kpi { background: hsl(var(--card)); border: 1px solid hsl(var(--border)); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow-sm); }
.kpi-v { font-size: 24px; font-weight: 800; font-variant-numeric: tabular-nums; }
.kpi-l { font-size: 12px; color: hsl(var(--muted-foreground)); margin-top: 4px; }

/* تعویض نما (بورد/لیست) */
.view-toggle { display: inline-flex; border: 1px solid hsl(var(--border)); border-radius: 8px; overflow: hidden; }
.vt { background: hsl(var(--card)); border: none; padding: 7px 12px; cursor: pointer; font-size: 13px; color: hsl(var(--muted-foreground)); }
.vt.on { background: hsl(var(--primary) / .12); color: hsl(var(--primary)); font-weight: 700; }

/* تقویم رویدادها */
.cal-nav { display: flex; align-items: center; justify-content: center; gap: 16px; margin-bottom: 12px; font-weight: 700; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.cal-wd { text-align: center; font-size: 12.5px; font-weight: 700; color: hsl(var(--muted-foreground)); padding: 6px 0; }
.cal-cell { min-height: 96px; background: hsl(var(--card)); border: 1px solid hsl(var(--border)); border-radius: 10px; padding: 6px; display: flex; flex-direction: column; gap: 4px; }
.cal-cell.empty { background: transparent; border: none; }
.cal-cell.today { border-color: hsl(var(--primary)); box-shadow: 0 0 0 1px hsl(var(--primary)); }
.cal-day { display: flex; align-items: center; justify-content: space-between; font-weight: 700; font-size: 13px; }
.cal-add { background: transparent; border: none; color: hsl(var(--muted-foreground)); cursor: pointer; font-size: 14px; opacity: 0; transition: opacity .15s; }
.cal-cell:hover .cal-add { opacity: 1; }
.cal-ev { font-size: 11px; padding: 2px 6px; border-radius: 6px; border-inline-start: 3px solid; cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* مناسبت‌ها */
.cal-cell.holiday { background: hsl(var(--destructive) / 0.04); border-color: hsl(var(--destructive) / 0.25); }
.holiday-num { color: hsl(var(--destructive)); font-weight: 800; }
.cal-occ { font-size: 10px; line-height: 1.4; padding: 1px 4px; border-radius: 5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.occ-holiday { color: hsl(var(--destructive)); font-weight: 600; }
.occ-solar { color: hsl(var(--success)); }
.occ-lunar { color: hsl(var(--primary)); }
.occ-world { color: hsl(var(--muted-foreground)); }
.cal-legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: hsl(var(--muted-foreground)); margin: 4px 0 12px; }
.cal-legend span { display: inline-flex; align-items: center; gap: 5px; }
.cal-legend i { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
@media (max-width: 640px) { .cal-cell { min-height: 64px; } .cal-ev { font-size: 9.5px; } }

/* ============================================================
   پولیش بصری حرفه‌ای (UI/UX) — ریزتعامل، سایه، فوکوس، انیمیشن
   ============================================================ */

/* سایه‌های نرم‌تر و لایه‌ای (با تینت رنگ نشانه برای عمق بیشتر) */
:root {
  --shadow-sm: 0 1px 2px hsl(214 40% 30% / 0.06);
  --shadow:    0 1px 2px hsl(214 40% 30% / 0.06), 0 2px 6px hsl(214 40% 30% / 0.06);
  --shadow-md: 0 4px 12px hsl(214 40% 30% / 0.10), 0 2px 4px hsl(214 40% 30% / 0.06);
  --shadow-lg: 0 12px 32px hsl(214 40% 25% / 0.16), 0 4px 10px hsl(214 40% 25% / 0.08);
  --ease-spring: cubic-bezier(.34, 1.56, .64, 1);
}

/* اعداد جدولی (بدون پرش هنگام تغییر) برای داده‌ها */
.stat .v, .kpi-v, .tcard-num, .kanban-count, .tc-time, .tc-elapsed,
.member-sub, .entity-sub, .pbar + *, .badge { font-variant-numeric: tabular-nums; }

/* کارت‌ها: گذار نرم و حسِ بالاآمدن */
.card { transition: box-shadow .2s ease, border-color .2s ease, transform .2s ease; }

/* سطوح تعاملی: بازخورد فشار (scale) + بالاآمدن هنگام hover */
.entity-card, .tcard, .kpi, .member-row, .search-item, .chat-ch, .vt, .tab {
  transition: transform .16s var(--ease-spring), box-shadow .18s ease, background .15s ease, border-color .15s ease, color .15s ease;
}
.entity-card:active, .tcard:active { transform: scale(.98); }
.kpi { cursor: default; }
.kpi:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); border-color: hsl(var(--ring) / .4); }

/* دکمه‌ها: فشار با scale ملایم به‌جای جابه‌جایی */
.btn { transition: background .15s ease, border-color .15s ease, box-shadow .18s ease, transform .12s var(--ease-spring); }
.btn:active { transform: scale(.96); }
.btn-primary:active { transform: scale(.96); }

/* فوکوس قابل‌دسترس روی ورودی‌ها و select و textarea */
.input:focus, .select:focus, .textarea:focus {
  outline: none; border-color: hsl(var(--ring));
  box-shadow: 0 0 0 3px hsl(var(--ring) / 0.18);
}

/* اسکرول‌بار باریک و یکدست در کل اپ */
* { scrollbar-width: thin; scrollbar-color: hsl(var(--muted-foreground) / .3) transparent; }
*::-webkit-scrollbar { width: 9px; height: 9px; }
*::-webkit-scrollbar-thumb { background: hsl(var(--muted-foreground) / .28); border-radius: 99px; border: 2px solid transparent; background-clip: padding-box; }
*::-webkit-scrollbar-thumb:hover { background: hsl(var(--muted-foreground) / .45); background-clip: padding-box; }
*::-webkit-scrollbar-track { background: transparent; }

/* انیمیشن ورود نرم (fade-up) برای محتوای صفحه و کارت‌ها */
@keyframes fadeUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes popIn { from { opacity: 0; transform: scale(.96) translateY(6px); } to { opacity: 1; transform: none; } }
.page-head, .kpi-grid, .grid, .kanban, .card, .entity-grid, .cal-grid, .table-wrap {
  animation: fadeUp .28s ease-out both;
}
/* استگر ملایم برای کارت‌های آماری و KPI */
.kpi:nth-child(1){animation-delay:.02s} .kpi:nth-child(2){animation-delay:.05s}
.kpi:nth-child(3){animation-delay:.08s} .kpi:nth-child(4){animation-delay:.11s}
.kpi:nth-child(5){animation-delay:.14s} .kpi:nth-child(6){animation-delay:.17s}
.kpi:nth-child(7){animation-delay:.20s} .kpi:nth-child(8){animation-delay:.23s}

/* دیالوگ و Toast با حرکت طبیعی‌تر */
.dialog { animation: popIn .22s var(--ease-spring) both; }
.overlay { animation: fadeUp .18s ease-out both; }
.toast { animation: popIn .25s var(--ease-spring) both; }

/* لوگو: نبض ملایم مدار */
@keyframes orbitFloat { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-2px); } }
.rail-logo { animation: orbitFloat 4s ease-in-out infinite; }

/* لمس راحت‌تر: حداقل ناحیه‌ی لمسی برای دکمه‌های آیکونی کوچک */
.icon-btn.sm { min-width: 32px; min-height: 32px; }

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

/* ============================================================
   پولیش premium (نسخه ۲) — دکمه گرادیانی، آواتار، پیشرفت، KPI، دیالوگ
   ============================================================ */

/* دکمه‌ی اصلی: گرادیان ظریف + درخشش */
.btn-primary {
  background: linear-gradient(180deg, hsl(211 90% 58%), hsl(211 84% 50%));
  border-color: hsl(211 84% 48%);
  box-shadow: 0 1px 2px hsl(211 84% 40% / .25), 0 4px 14px hsl(211 84% 50% / .35);
}
.btn-primary:hover {
  background: linear-gradient(180deg, hsl(211 90% 60%), hsl(211 84% 52%));
  box-shadow: 0 2px 4px hsl(211 84% 40% / .3), 0 6px 18px hsl(211 84% 50% / .45);
}

/* کارت‌ها: درخشش ظریف لبه هنگام hover (بدون جابه‌جایی) */
.card:hover { border-color: hsl(var(--ring) / .35); box-shadow: var(--shadow-md); }
.card-title { letter-spacing: -0.01em; }

/* کارت‌های KPI: نوار رنگی بالا + عدد بزرگ‌تر + بالاآمدن */
.kpi { position: relative; overflow: hidden; }
.kpi::before {
  content: ''; position: absolute; top: 0; inset-inline: 0; height: 3px;
  background: linear-gradient(90deg, hsl(var(--primary)), hsl(var(--primary) / .35));
}
.kpi-v { font-size: 26px; letter-spacing: -0.02em; }

/* آواتارها: پس‌زمینه‌ی گرادیانی برای عمق */
.user-avatar, .mini-avatar, .member-avatar, .rail-avatar {
  background: linear-gradient(135deg, hsl(211 84% 60%), hsl(211 84% 46%)) !important;
  box-shadow: 0 2px 6px hsl(211 84% 45% / .35);
}

/* نوار پیشرفت: گرادیان + درخشش ملایم */
.progress > span, .pbar-fill {
  background-image: linear-gradient(90deg, hsl(var(--primary)), hsl(199 89% 56%));
  position: relative;
}
.progress { box-shadow: inset 0 1px 2px hsl(214 30% 30% / .12); }

/* اندیکاتور آیتم فعال نوار کناری */
.rail-item { position: relative; }
.rail-item.active::after {
  content: ''; position: absolute; inset-inline-start: 3px; top: 50%; transform: translateY(-50%);
  width: 3px; height: 56%; border-radius: 99px; background: hsl(var(--sidebar-accent));
}

/* تاپ‌بار: دکمه‌های آیکونی و سوییچ زبان به‌صورت قرص (pill) */
.lang-btn { border: 1px solid hsl(var(--border)); border-radius: 99px; min-width: 42px; }
.lang-btn:hover { border-color: hsl(var(--ring) / .5); }
.topbar { box-shadow: 0 1px 0 hsl(var(--border)); }

/* ورودی‌ها: پس‌زمینه‌ی نرم‌تر و گذار روان */
.input, .select, .textarea { transition: border-color .15s ease, box-shadow .18s ease, background .15s ease; }

/* خالی‌بودن: آیکون داخل دایره‌ی نرم */
.empty .ic {
  width: 76px; height: 76px; border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, hsl(var(--primary) / .12), hsl(var(--muted)));
  display: grid; place-items: center; margin: 0 auto 14px;
  color: hsl(var(--primary) / .75); opacity: 1; font-size: 36px;
}

/* دیالوگ: گوشه‌ی گردتر + سرستون با جداکننده + فوتر تمیز */
.dialog { border-radius: 18px; }
.dialog-head { border-bottom: 1px solid hsl(var(--border)); }
.dialog-foot { border-top: 1px solid hsl(var(--border)); }
.overlay { background: hsl(222 30% 10% / .5); backdrop-filter: blur(3px); }

/* بَج‌ها: قرصِ یکدست و کمی فشرده‌تر */
.badge { border-radius: 99px; font-weight: 600; }

/* عنوان صفحه: آیکون و متن هم‌تراز و متعادل */
.page-h2 { display: inline-flex; align-items: center; gap: 8px; }
.page-h2 .ic-svg { color: hsl(var(--primary)); }

/* کارت تسک: نوار رنگیِ وضعیت در لبه‌ی شروع */
.tcard { position: relative; }

/* نوار رنگیِ ظریف کنار عنوان کارت‌ها (حس داشبورد حرفه‌ای) */
.card-title::before {
  content: ''; display: inline-block; width: 4px; height: 16px; border-radius: 99px;
  background: linear-gradient(180deg, hsl(var(--primary)), hsl(199 89% 56%));
  margin-inline-end: 9px; vertical-align: -3px;
}

/* کارت‌ها: تینت بسیار ظریف بالا برای عمق */
.card { background-image: linear-gradient(180deg, hsl(var(--foreground) / .015), transparent 64px); }
.dark .card { background-image: linear-gradient(180deg, hsl(0 0% 100% / .025), transparent 64px); }

/* جداکننده‌ی ظریف زیر سرستون کارت */
.card-content { padding-top: 16px; }

/* نوار اسکرول افقی بورد کانبان: ظریف‌تر */
.kanban::-webkit-scrollbar { height: 8px; }

/* hero داشبورد: حاشیه‌ی درخشان ظریف */
.dash-hero { border: 1px solid hsl(var(--primary) / .18); box-shadow: 0 8px 24px hsl(var(--primary) / .10); }

/* دکمه‌ی بزرگ تردد: درخشش بیشتر */
.btn-lg { box-shadow: 0 4px 16px hsl(var(--primary) / .35); }
.btn-destructive.btn-lg { box-shadow: 0 4px 16px hsl(var(--destructive) / .3); }
