/* ============================================================
   CRM آژانس زِد — استایل اصلی
   پالت: آبی + نارنجی + سفید | فونت: وزیرمتن
   ============================================================ */

:root {
  /* زمینه و سطح‌ها */
  --bg: #f4f7fc;
  --surface: #ffffff;
  --surface-2: #f5f8fd;
  --line: #e3e9f2;
  --line-soft: #eef2f8;

  /* مرکب */
  --ink: #15213a;
  --ink-2: #47546e;
  --ink-3: #8791a6;

  /* برند: آبی */
  --brand: #1f6feb;
  --brand-deep: #124a9e;
  --brand-ink: #0d3574;
  --brand-soft: #e7f0fd;
  --brand-softer: #f1f6fe;

  /* اکسنت: نارنجی */
  --accent: #f97316;
  --accent-deep: #ea580c;
  --accent-text: #c2410c;
  --accent-soft: #fff2e6;

  /* واتس‌اپ/سبز فرعی */
  --teal: #0e9f6e;
  --teal-soft: #e6f6ef;

  /* وضعیت */
  --good: #0ca35a;
  --good-text: #067a41;
  --good-soft: #e6f6ee;
  --warn-text: #b45309;
  --warn-soft: #fff2dd;
  --crit: #e0524a;
  --crit-text: #c23a34;
  --crit-soft: #fdeceb;

  /* نمودار — اسلات‌های دسته‌ای */
  --s1: #3b82f6; --s2: #0e9f6e; --s3: #f59e0b;
  --s4: #0891b2; --s5: #7c3aed; --s6: #f97316;
  --s4-soft: #e0f2f7;
  /* رمپ ترتیبی قیف (آبی) */
  --seq-250:#8fb8f4; --seq-300:#74a6f0; --seq-350:#5f9bef; --seq-400:#4a8bec;
  --seq-450:#3b82f6; --seq-500:#2f74e6; --seq-550:#2563eb; --seq-650:#1749b8;

  --grid: #e3e9f2;
  --radius: 14px;
  --radius-s: 10px;
  --shadow-1: 0 1px 2px rgba(29,28,25,.05), 0 2px 8px rgba(29,28,25,.04);
  --shadow-2: 0 4px 14px rgba(18,61,116,.10), 0 2px 4px rgba(29,28,25,.06);
  --shadow-3: 0 18px 50px rgba(13,44,85,.22);
  --font: "Vazirmatn", "Segoe UI", Tahoma, sans-serif;
  --sidebar-w: 252px;
  --topbar-h: 62px;
  --ease: cubic-bezier(.22,.9,.3,1);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
::selection { background: var(--brand-soft); }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--brand); text-decoration: none; }
img { max-width: 100%; }
/* اندازه پایه آیکون‌های خطی داخل متن؛ کلاس‌های اختصاصی آن را بازنویسی می‌کنند */
svg { width: 1em; height: 1em; vertical-align: -0.14em; flex: none; }
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-thumb { background: #d4d2c8; border-radius: 9px; border: 2px solid var(--bg); }
::-webkit-scrollbar-track { background: transparent; }

/* ---------- حرکت ---------- */
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes pop  { from { opacity: 0; transform: scale(.94); } to { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes slide-up { from { transform: translateY(100%); } to { transform: none; } }
@keyframes bar-grow { from { transform: scaleY(0); } to { transform: scaleY(1); } }
@keyframes hbar-grow { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@keyframes donut-in { from { stroke-dashoffset: var(--full, 100); } }
@keyframes pulse-dot { 0%,100% { box-shadow: 0 0 0 0 rgba(208,59,59,.45);} 60% { box-shadow: 0 0 0 7px rgba(208,59,59,0);} }
@keyframes shimmer-bg { from { background-position: 200% 0; } to { background-position: -200% 0; } }

.anim-rise { animation: rise .5s var(--ease) both; }
.stagger > * { animation: rise .55s var(--ease) both; }
.stagger > *:nth-child(1){animation-delay:.02s} .stagger > *:nth-child(2){animation-delay:.07s}
.stagger > *:nth-child(3){animation-delay:.12s} .stagger > *:nth-child(4){animation-delay:.17s}
.stagger > *:nth-child(5){animation-delay:.22s} .stagger > *:nth-child(6){animation-delay:.27s}
.stagger > *:nth-child(7){animation-delay:.32s} .stagger > *:nth-child(8){animation-delay:.37s}
.stagger > *:nth-child(n+9){animation-delay:.42s}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ============================================================
   صفحه ورود
   ============================================================ */
.login-wrap { min-height: 100vh; display: grid; grid-template-columns: 1.05fr 1fr; }
.login-hero {
  position: relative; overflow: hidden; color: #eef4fc;
  background:
    radial-gradient(900px 500px at 88% -10%, rgba(249,115,22,.38), transparent 58%),
    radial-gradient(700px 600px at -10% 110%, rgba(59,130,246,.35), transparent 55%),
    linear-gradient(155deg, #0d3574 0%, #124a9e 55%, #1f6feb 100%);
  display: flex; flex-direction: column; justify-content: space-between; padding: 48px 52px;
}
.login-hero::after {
  content: ""; position: absolute; inset: 0; opacity: .5; pointer-events: none;
  background:
    repeating-linear-gradient(115deg, transparent 0 90px, rgba(255,255,255,.03) 90px 92px),
    repeating-linear-gradient(28deg, transparent 0 140px, rgba(255,255,255,.02) 140px 143px);
}
.login-hero .brand-row { display: flex; align-items: center; gap: 12px; animation: rise .6s var(--ease) both; }
.login-hero h1 { font-size: 40px; font-weight: 800; line-height: 1.35; margin-top: 20px; text-wrap: balance; animation: rise .6s var(--ease) .1s both; }
.login-hero h1 em { font-style: normal; color: #9ec5f4; }
.login-hero p.sub { color: #b7d3f6; max-width: 46ch; margin-top: 12px; animation: rise .6s var(--ease) .18s both; }
.hero-stats { display: flex; gap: 12px; flex-wrap: wrap; animation: rise .6s var(--ease) .26s both; }
.hero-stat {
  background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.14);
  border-radius: 12px; padding: 12px 18px; backdrop-filter: blur(6px);
}
.hero-stat b { display: block; font-size: 21px; font-weight: 800; }
.hero-stat span { font-size: 12px; color: #b7d3f6; }

.login-panel { display: flex; align-items: center; justify-content: center; padding: 32px 24px; }
.login-card { width: min(410px, 100%); animation: pop .5s var(--ease) .15s both; }
.login-card h2 { font-size: 23px; font-weight: 800; }
.login-card .hint { color: var(--ink-3); font-size: 13px; margin: 6px 0 22px; }
.demo-users { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 20px; }
.demo-user {
  display: flex; align-items: center; gap: 10px; padding: 11px 12px; cursor: pointer;
  background: var(--surface); border: 1.5px solid var(--line); border-radius: 12px;
  transition: border-color .2s, box-shadow .2s, transform .2s; text-align: right;
}
.demo-user:hover { border-color: var(--brand); box-shadow: var(--shadow-2); transform: translateY(-2px); }
.demo-user.active { border-color: var(--brand); background: var(--brand-softer); box-shadow: 0 0 0 3px var(--brand-soft); }
.demo-user b { display: block; font-size: 13px; }
.demo-user span { font-size: 11px; color: var(--ink-3); }
.login-field { margin-bottom: 14px; }
.login-btn {
  width: 100%; padding: 13px; border: 0; border-radius: 12px; cursor: pointer;
  background: linear-gradient(135deg, var(--brand-deep), var(--brand));
  color: #fff; font-weight: 700; font-size: 15px;
  box-shadow: 0 8px 20px rgba(18,61,116,.28);
  transition: transform .15s, box-shadow .2s, filter .2s;
}
.login-btn:hover { filter: brightness(1.08); transform: translateY(-1px); box-shadow: 0 12px 26px rgba(18,61,116,.34); }
.login-btn:active { transform: translateY(0); }
.login-note { text-align: center; color: var(--ink-3); font-size: 12px; margin-top: 16px; }

/* ============================================================
   چیدمان اصلی
   ============================================================ */
.shell { display: block; }
.sidebar {
  position: fixed; inset-block: 0; inset-inline-start: 0; width: var(--sidebar-w); z-index: 40;
  display: flex; flex-direction: column; color: #dbe7f6;
  background:
    radial-gradient(420px 280px at 110% -5%, rgba(249,115,22,.30), transparent 60%),
    linear-gradient(170deg, #0d3574, #124a9e 70%, #1f6feb);
}
.sidebar::after {
  content: ""; position: absolute; inset: 0; pointer-events: none; opacity: .45;
  background: repeating-linear-gradient(115deg, transparent 0 70px, rgba(255,255,255,.04) 70px 72px);
}
.sb-brand { display: flex; align-items: center; gap: 11px; padding: 20px 20px 16px; position: relative; z-index: 1; }
.logo-badge {
  width: 40px; height: 40px; border-radius: 12px; flex: none;
  display: grid; place-items: center;
  background: linear-gradient(135deg, #1f6feb, #f97316);
  box-shadow: 0 6px 16px rgba(0,0,0,.25);
}
.logo-badge svg { width: 22px; height: 22px; }
.sb-brand b { font-size: 17px; font-weight: 800; color: #fff; letter-spacing: .2px; }
.sb-brand span { display: block; font-size: 10.5px; color: #86b6ef; }
.sb-nav { padding: 8px 12px; flex: 1; overflow-y: auto; position: relative; z-index: 1; }
.sb-nav a {
  display: flex; align-items: center; gap: 11px; padding: 10.5px 12px; margin-bottom: 3px;
  border-radius: 11px; color: #b9cce7; font-size: 13.5px; font-weight: 500;
  transition: background .18s, color .18s, transform .18s;
}
.sb-nav a svg { width: 19px; height: 19px; flex: none; opacity: .85; }
.sb-nav a:hover { background: rgba(255,255,255,.07); color: #fff; transform: translateX(-2px); }
.sb-nav a.active {
  background: linear-gradient(90deg, rgba(255,255,255,.16), rgba(255,255,255,.08));
  color: #fff; font-weight: 700; box-shadow: inset 3px 0 0 var(--accent);
}
.sb-nav a .nav-badge {
  margin-inline-start: auto; min-width: 20px; height: 20px; padding: 0 6px;
  display: grid; place-items: center; border-radius: 20px;
  background: var(--crit); color: #fff; font-size: 11px; font-weight: 700;
  animation: pulse-dot 2.4s infinite;
}
.sb-user { position: relative; z-index: 1; margin: 12px; padding: 12px; border-radius: 12px; background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.1); display: flex; align-items: center; gap: 10px; }
.sb-user b { font-size: 13px; color: #fff; display: block; }
.sb-user span { font-size: 11px; color: #9ec5f4; }
.sb-user button { margin-inline-start: auto; background: none; border: 0; color: #9ec5f4; cursor: pointer; padding: 6px; border-radius: 8px; transition: background .15s, color .15s; }
.sb-user button:hover { background: rgba(255,255,255,.1); color: #fff; }

.main { margin-inline-start: var(--sidebar-w); min-height: 100vh; display: flex; flex-direction: column; }

/* نوار بالا */
.topbar {
  position: sticky; top: 0; z-index: 30; height: var(--topbar-h);
  display: flex; align-items: center; gap: 14px; padding: 0 26px;
  background: rgba(244,247,252,.86); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.page-title { font-size: 17px; font-weight: 800; }
.page-title small { display: block; font-size: 11.5px; font-weight: 400; color: var(--ink-3); }
.top-search { position: relative; margin-inline-start: auto; width: min(340px, 38vw); }
.top-search input {
  width: 100%; padding: 9px 38px 9px 14px; border-radius: 12px; border: 1.5px solid var(--line);
  background: var(--surface); font-size: 13px; transition: border-color .2s, box-shadow .2s;
}
.top-search input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.top-search .s-icon { position: absolute; inset-inline-start: auto; inset-inline-end: 12px; top: 50%; transform: translateY(-50%); color: var(--ink-3); pointer-events: none; }
.search-pop {
  position: absolute; top: calc(100% + 8px); inset-inline: 0; max-height: 330px; overflow-y: auto;
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-3);
  animation: pop .18s var(--ease); z-index: 60;
}
.search-pop .sp-item { display: flex; align-items: center; gap: 10px; padding: 10px 14px; cursor: pointer; transition: background .12s; }
.search-pop .sp-item:hover { background: var(--brand-softer); }
.search-pop .sp-item b { font-size: 13px; }
.search-pop .sp-item span { font-size: 11.5px; color: var(--ink-3); }
.search-pop .sp-empty { padding: 18px; text-align: center; color: var(--ink-3); font-size: 13px; }

.content { flex: 1; padding: 24px 26px 90px; max-width: 1340px; width: 100%; margin: 0 auto; }

/* ============================================================
   اجزای مشترک
   ============================================================ */
.avatar {
  width: 38px; height: 38px; border-radius: 50%; flex: none;
  display: grid; place-items: center; color: #fff; font-weight: 700; font-size: 13px;
  background: var(--brand);
}
.avatar.sm { width: 30px; height: 30px; font-size: 11px; }
.avatar.lg { width: 54px; height: 54px; font-size: 19px; }

.panel {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow-1); padding: 20px;
}
.panel-head { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }
.panel-head h3 { font-size: 14.5px; font-weight: 800; }
.panel-head .spacer { flex: 1; }
.panel-head .more-link { font-size: 12.5px; color: var(--brand); font-weight: 600; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 9px 16px; border-radius: 11px; border: 1.5px solid transparent; cursor: pointer;
  font-size: 13px; font-weight: 700; white-space: nowrap;
  transition: transform .15s, box-shadow .2s, filter .2s, background .2s, border-color .2s;
}
.btn svg { width: 16px; height: 16px; }
.btn:active { transform: scale(.97); }
.btn-primary { background: linear-gradient(135deg, var(--brand-deep), var(--brand)); color: #fff; box-shadow: 0 6px 16px rgba(18,61,116,.22); }
.btn-primary:hover { filter: brightness(1.09); transform: translateY(-1px); }
.btn-ghost { background: var(--surface); border-color: var(--line); color: var(--ink-2); }
.btn-ghost:hover { border-color: var(--brand); color: var(--brand); background: var(--brand-softer); }
.btn-soft { background: var(--brand-soft); color: var(--brand-deep); }
.btn-soft:hover { background: #dbe8f8; }
.btn-good { background: var(--good-soft); color: var(--good-text); }
.btn-good:hover { background: #d8efd8; }
.btn-danger { background: var(--crit-soft); color: var(--crit-text); }
.btn-danger:hover { background: #fbdddd; }
.btn-sm { padding: 6px 11px; font-size: 12px; border-radius: 9px; }
.btn-icon { padding: 8px; border-radius: 10px; }
.btn[disabled] { opacity: .5; pointer-events: none; }

.chip {
  display: inline-flex; align-items: center; gap: 5px; padding: 2.5px 10px; border-radius: 99px;
  font-size: 11.5px; font-weight: 600; background: var(--surface-2); border: 1px solid var(--line); color: var(--ink-2);
  white-space: nowrap;
}
.chip .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex: none; }
.chip-brand { background: var(--brand-soft); border-color: transparent; color: var(--brand-deep); }
.chip-teal  { background: var(--teal-soft); border-color: transparent; color: var(--teal); }
.chip-good  { background: var(--good-soft); border-color: transparent; color: var(--good-text); }
.chip-warn  { background: var(--warn-soft); border-color: transparent; color: var(--warn-text); }
.chip-crit  { background: var(--crit-soft); border-color: transparent; color: var(--crit-text); }
.chip-muted { color: var(--ink-3); }

/* فرم */
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 12px; font-weight: 700; color: var(--ink-2); }
.field label .req { color: var(--crit); }
.input, .select, textarea.input {
  width: 100%; padding: 9.5px 13px; border-radius: 11px; border: 1.5px solid var(--line);
  background: var(--surface); font-size: 13.5px; transition: border-color .2s, box-shadow .2s;
}
.input:focus, .select:focus, textarea.input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
textarea.input { resize: vertical; min-height: 74px; }
.select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238f8d84' stroke-width='2.4'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: left 12px center; padding-inline-start: 32px; cursor: pointer; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-grid .full { grid-column: 1 / -1; }
.quick-chips { display: flex; gap: 7px; flex-wrap: wrap; }
.quick-chips button {
  padding: 5px 12px; border-radius: 99px; border: 1.5px solid var(--line); background: var(--surface);
  font-size: 12px; cursor: pointer; transition: all .15s; color: var(--ink-2);
}
.quick-chips button:hover { border-color: var(--brand); color: var(--brand); }
.quick-chips button.on { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 700; }

/* جدول */
.table-wrap { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface); box-shadow: var(--shadow-1); }
table.tbl { width: 100%; border-collapse: collapse; min-width: 720px; }
.tbl th {
  text-align: right; font-size: 11.5px; color: var(--ink-3); font-weight: 700;
  padding: 12px 16px; background: var(--surface-2); border-bottom: 1px solid var(--line);
  white-space: nowrap; position: sticky; top: 0;
}
.tbl td { padding: 12px 16px; border-bottom: 1px solid var(--line-soft); font-size: 13px; vertical-align: middle; }
.tbl tbody tr { transition: background .13s; cursor: pointer; }
.tbl tbody tr:hover { background: var(--brand-softer); }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl .num { font-variant-numeric: tabular-nums; }
.t-main b { display: block; font-size: 13.5px; }
.t-main span { font-size: 11.5px; color: var(--ink-3); }

/* ============================================================
   KPI
   ============================================================ */
.kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 20px; }
.kpi {
  position: relative; overflow: hidden; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow-1);
  transition: transform .22s var(--ease), box-shadow .22s;
}
.kpi:hover { transform: translateY(-3px); box-shadow: var(--shadow-2); }
.kpi::before { content: ""; position: absolute; inset-inline-start: 0; inset-block: 14px; width: 4px; border-radius: 4px; background: var(--kpi-accent, var(--brand)); }
.kpi .k-label { font-size: 12px; color: var(--ink-2); font-weight: 600; display: flex; align-items: center; gap: 8px; }
.kpi .k-ico { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--kpi-soft, var(--brand-soft)); color: var(--kpi-accent, var(--brand)); position: absolute; inset-inline-end: 16px; top: 16px; }
.kpi .k-ico svg { width: 18px; height: 18px; }
.kpi .k-value { font-size: 27px; font-weight: 800; margin-top: 8px; line-height: 1.3; }
.kpi .k-value small { font-size: 13px; font-weight: 600; color: var(--ink-3); }
.kpi .k-delta { font-size: 11.5px; margin-top: 3px; display: flex; align-items: center; gap: 4px; }
.k-delta.up { color: var(--good-text); } .k-delta.down { color: var(--crit-text); } .k-delta.flat { color: var(--ink-3); }

/* شبکه داشبورد */
.dash-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 16px; margin-bottom: 16px; }
.dash-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 16px; }
.quick-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 20px; }

/* لیست پیگیری */
.fu-item { display: flex; align-items: flex-start; gap: 12px; padding: 12px 4px; border-bottom: 1px solid var(--line-soft); transition: background .13s; }
.fu-item:last-child { border-bottom: 0; }
.fu-item:hover { background: var(--surface-2); border-radius: 10px; }
.fu-check {
  width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--line); background: var(--surface);
  cursor: pointer; flex: none; margin-top: 3px; display: grid; place-items: center; color: transparent;
  transition: all .18s;
}
.fu-check:hover { border-color: var(--good); color: var(--good); }
.fu-item.done .fu-check { background: var(--good); border-color: var(--good); color: #fff; }
.fu-item.done .fu-note { text-decoration: line-through; color: var(--ink-3); }
.fu-body { flex: 1; min-width: 0; }
.fu-note { font-size: 13px; font-weight: 600; }
.fu-meta { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 4px; font-size: 11.5px; color: var(--ink-3); }
.fu-late { color: var(--crit-text); font-weight: 700; }

/* ============================================================
   کانبان قیف فروش
   ============================================================ */
.kanban { display: flex; gap: 14px; overflow-x: auto; padding-bottom: 16px; align-items: flex-start; scroll-snap-type: x proximity; }
.kb-col {
  flex: 0 0 272px; scroll-snap-align: start;
  background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius);
  display: flex; flex-direction: column; max-height: calc(100vh - 210px);
}
.kb-head { padding: 13px 15px 10px; display: flex; align-items: center; gap: 8px; border-bottom: 2.5px solid var(--stage-c, var(--brand)); }
.kb-head b { font-size: 13.5px; }
.kb-head .kb-count { margin-inline-start: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 99px; font-size: 11.5px; padding: 1px 9px; font-weight: 700; color: var(--ink-2); }
.kb-sum { font-size: 11px; color: var(--ink-3); padding: 6px 15px 4px; }
.kb-body { padding: 10px; overflow-y: auto; flex: 1; min-height: 90px; transition: background .18s; }
.kb-col.drag-over .kb-body { background: var(--brand-soft); border-radius: 0 0 var(--radius) var(--radius); }
.kb-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px 13px;
  margin-bottom: 9px; cursor: grab; box-shadow: var(--shadow-1);
  transition: transform .18s var(--ease), box-shadow .18s, border-color .18s;
}
.kb-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-2); border-color: #cfd9ea; }
.kb-card.dragging { opacity: .55; transform: rotate(2.5deg) scale(1.02); cursor: grabbing; }
.kb-card .kc-name { font-size: 13.5px; font-weight: 700; display: flex; align-items: center; gap: 7px; }
.kb-card .kc-sub { font-size: 11.5px; color: var(--ink-3); margin-top: 2px; }
.kb-card .kc-foot { display: flex; align-items: center; gap: 6px; margin-top: 9px; flex-wrap: wrap; }
.kb-card .kc-value { margin-inline-start: auto; font-size: 11.5px; font-weight: 700; color: var(--brand-deep); font-variant-numeric: tabular-nums; }
.kb-move { border: 0; background: none; color: var(--ink-3); cursor: pointer; padding: 3px; border-radius: 7px; }
.kb-move:hover { background: var(--brand-soft); color: var(--brand); }

/* درجه حرارت سرنخ */
.heat { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.heat.hot { background: var(--crit); box-shadow: 0 0 0 3px var(--crit-soft); }
.heat.warm { background: var(--s3); box-shadow: 0 0 0 3px var(--warn-soft); }
.heat.cold { background: var(--s1); box-shadow: 0 0 0 3px var(--brand-soft); }

/* ============================================================
   پرونده مشتری
   ============================================================ */
.cust-hero {
  background:
    radial-gradient(500px 200px at 90% -30%, rgba(249,115,22,.20), transparent 60%),
    linear-gradient(150deg, #0d3574, #1f6feb);
  color: #eef4fc; border-radius: var(--radius); padding: 22px 24px; margin-bottom: 16px;
  position: relative; overflow: hidden; box-shadow: var(--shadow-2);
}
.cust-hero::after { content: ""; position: absolute; inset: 0; background: repeating-linear-gradient(115deg, transparent 0 80px, rgba(255,255,255,.04) 80px 82px); pointer-events: none; }
.ch-top { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; position: relative; z-index: 1; }
.ch-top .avatar.lg { background: rgba(255,255,255,.16); border: 1px solid rgba(255,255,255,.25); }
.ch-name { font-size: 20px; font-weight: 800; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.ch-sub { color: #9ec5f4; font-size: 12.5px; margin-top: 3px; }
.ch-actions { display: flex; gap: 9px; margin-inline-start: auto; flex-wrap: wrap; position: relative; z-index: 1; }
.act-btn {
  display: inline-flex; flex-direction: column; align-items: center; gap: 4px; min-width: 62px;
  padding: 9px 10px; border-radius: 12px; border: 1px solid rgba(255,255,255,.18);
  background: rgba(255,255,255,.09); color: #fff; cursor: pointer; font-size: 11px; font-weight: 600;
  transition: background .18s, transform .18s;
}
.act-btn:hover { background: rgba(255,255,255,.18); transform: translateY(-2px); }
.act-btn svg { width: 19px; height: 19px; }
.act-btn.wa:hover { background: rgba(27,175,122,.35); }

/* استپر مرحله */
.stepper { display: flex; gap: 6px; margin-top: 20px; position: relative; z-index: 1; overflow-x: auto; padding-bottom: 4px; }
.step {
  flex: 1; min-width: 86px; text-align: center; padding: 8px 6px; font-size: 11.5px; font-weight: 600;
  color: #b9cce7; background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.12);
  border-radius: 10px; cursor: pointer; transition: all .18s; white-space: nowrap;
}
.step:hover { background: rgba(255,255,255,.15); color: #fff; }
.step.done { background: rgba(94,234,212,.16); color: #5eead4; border-color: rgba(94,234,212,.3); }
.step.now { background: #fff; color: var(--brand-deep); font-weight: 800; box-shadow: 0 4px 12px rgba(0,0,0,.25); }
.step.lost-step.now { background: var(--crit); color: #fff; }

/* تب‌ها */
.tabs { display: flex; gap: 4px; background: var(--surface-2); border: 1px solid var(--line); padding: 4px; border-radius: 12px; margin-bottom: 16px; overflow-x: auto; }
.tabs button {
  flex: 1; padding: 8.5px 14px; border: 0; background: none; border-radius: 9px; cursor: pointer;
  font-size: 13px; font-weight: 600; color: var(--ink-2); white-space: nowrap; transition: all .18s;
}
.tabs button.active { background: var(--surface); color: var(--brand-deep); font-weight: 800; box-shadow: var(--shadow-1); }

.info-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 2px 20px; }
.info-item { padding: 9px 0; border-bottom: 1px dashed var(--line); }
.info-item label { font-size: 11px; color: var(--ink-3); display: block; }
.info-item b { font-size: 13.5px; font-weight: 700; }

/* تایم‌لاین */
.timeline { position: relative; padding-inline-start: 24px; }
.timeline::before { content: ""; position: absolute; inset-block: 6px; inset-inline-start: 8px; width: 2px; background: var(--line); border-radius: 2px; }
.tl-item { position: relative; padding: 0 0 18px; animation: rise .4s var(--ease) both; }
.tl-item .tl-dot {
  position: absolute; inset-inline-start: -24px; top: 4px; width: 18px; height: 18px; border-radius: 50%;
  background: var(--surface); border: 2px solid var(--tl-c, var(--brand)); color: var(--tl-c, var(--brand));
  display: grid; place-items: center;
}
.tl-item .tl-dot svg { width: 9px; height: 9px; }
.tl-item .tl-text { font-size: 13px; }
.tl-item .tl-meta { font-size: 11px; color: var(--ink-3); margin-top: 2px; }

/* ============================================================
   نمودارها
   ============================================================ */
.chart-box { position: relative; }
/* direction:ltr تا لنگر متن‌های SVG (text-anchor) طبق مختصات چپ‌به‌راست عمل کند */
.chart-box svg { display: block; width: 100%; height: auto; direction: ltr; }
.chart-box svg text { font-family: var(--font); }
.ax-label { font-size: 10.5px; fill: var(--ink-3); }
.ax-val { font-size: 10px; fill: var(--ink-3); font-variant-numeric: tabular-nums; }
.bar-rect { transform-origin: bottom; animation: bar-grow .7s var(--ease) both; transition: filter .15s, opacity .15s; cursor: pointer; }
.bar-rect:hover { filter: brightness(1.12); }
.hbar-rect { transform-origin: right center; animation: hbar-grow .7s var(--ease) both; transition: filter .15s; cursor: pointer; }
.hbar-rect:hover { filter: brightness(1.12); }
.d-label { font-size: 11px; font-weight: 700; fill: var(--ink-2); font-variant-numeric: tabular-nums; }
.grid-line { stroke: var(--grid); stroke-width: 1; }
.base-line { stroke: #c3c2b7; stroke-width: 1.2; }

.chart-tip {
  position: fixed; z-index: 200; pointer-events: none; opacity: 0; transform: translateY(4px);
  background: #1d1c19; color: #fff; font-size: 12px; padding: 7px 11px; border-radius: 9px;
  box-shadow: var(--shadow-3); transition: opacity .12s, transform .12s; max-width: 240px; line-height: 1.6;
}
.chart-tip.show { opacity: 1; transform: none; }
.chart-tip b { color: #9ec5f4; }

.legend { display: flex; flex-wrap: wrap; gap: 7px 16px; margin-top: 12px; }
.legend .lg-item { display: flex; align-items: center; gap: 7px; font-size: 12px; color: var(--ink-2); }
.legend .lg-swatch { width: 11px; height: 11px; border-radius: 4px; flex: none; }
.legend .lg-val { font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; }

/* قیف */
.funnel-row { display: flex; align-items: center; gap: 12px; margin-bottom: 9px; }
.funnel-row .f-label { width: 108px; font-size: 12px; font-weight: 600; color: var(--ink-2); flex: none; }
.funnel-row .f-track { flex: 1; height: 30px; background: var(--surface-2); border-radius: 8px; position: relative; overflow: hidden; }
.funnel-row .f-fill {
  height: 100%; border-radius: 8px; transform-origin: right; animation: hbar-grow .8s var(--ease) both;
  display: flex; align-items: center; padding: 0 10px; color: #fff; font-size: 11.5px; font-weight: 700;
  min-width: 34px; font-variant-numeric: tabular-nums;
}
.funnel-row .f-conv { width: 62px; flex: none; font-size: 11px; color: var(--ink-3); text-align: left; font-variant-numeric: tabular-nums; }

/* ============================================================
   فیلترها و نوار ابزار
   ============================================================ */
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }
.toolbar .select, .toolbar .input { width: auto; min-width: 130px; padding-block: 8px; font-size: 12.5px; }
.toolbar .search-inline { flex: 1; min-width: 180px; }
.seg { display: inline-flex; background: var(--surface); border: 1.5px solid var(--line); border-radius: 11px; padding: 3px; gap: 2px; }
.seg button { border: 0; background: none; padding: 6px 14px; border-radius: 8px; font-size: 12.5px; font-weight: 600; color: var(--ink-2); cursor: pointer; transition: all .15s; white-space: nowrap; }
.seg button.on { background: var(--brand); color: #fff; font-weight: 700; }
.result-count { font-size: 12px; color: var(--ink-3); }

/* کارت مشتری موبایل */
.cust-cards { display: none; }
.cust-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 15px; margin-bottom: 10px; box-shadow: var(--shadow-1); cursor: pointer;
  transition: transform .18s, box-shadow .18s;
}
.cust-card:active { transform: scale(.985); }
.cc-row1 { display: flex; align-items: center; gap: 11px; }
.cc-row1 b { font-size: 14px; display: block; }
.cc-row1 span { font-size: 11.5px; color: var(--ink-3); }
.cc-badges { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.cc-actions { display: flex; gap: 8px; margin-top: 11px; padding-top: 11px; border-top: 1px dashed var(--line); }
.cc-actions .btn { flex: 1; }

/* ============================================================
   مودال و شیت
   ============================================================ */
.modal-overlay {
  position: fixed; inset: 0; z-index: 100; background: rgba(13,20,33,.5); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center; padding: 20px; animation: fade .2s;
}
.modal {
  background: var(--surface); border-radius: 18px; width: min(560px, 100%); max-height: calc(100vh - 60px);
  display: flex; flex-direction: column; box-shadow: var(--shadow-3); animation: pop .28s var(--ease);
}
.modal.wide { width: min(760px, 100%); }
.modal-head { display: flex; align-items: center; gap: 10px; padding: 18px 22px 14px; border-bottom: 1px solid var(--line); }
.modal-head h3 { font-size: 16px; font-weight: 800; flex: 1; }
.modal-x { border: 0; background: var(--surface-2); width: 32px; height: 32px; border-radius: 50%; cursor: pointer; color: var(--ink-2); display: grid; place-items: center; transition: all .15s; }
.modal-x:hover { background: var(--crit-soft); color: var(--crit-text); transform: rotate(90deg); }
.modal-body { padding: 18px 22px; overflow-y: auto; }
.modal-foot { display: flex; gap: 10px; justify-content: flex-start; padding: 14px 22px 18px; border-top: 1px solid var(--line); }
.sheet-grip { display: none; }

/* توست */
.toast-root { position: fixed; bottom: 24px; inset-inline-start: 50%; transform: translateX(50%); z-index: 300; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast {
  display: flex; align-items: center; gap: 9px; padding: 11px 18px; border-radius: 12px;
  background: #1d1c19; color: #fff; font-size: 13px; font-weight: 600; box-shadow: var(--shadow-3);
  animation: rise .3s var(--ease);
}
.toast svg { width: 17px; height: 17px; flex: none; }
.toast.ok svg { color: #4ade80; } .toast.err svg { color: #f87171; }
.toast.out { opacity: 0; transform: translateY(10px); transition: all .3s; }

/* حالت خالی */
.empty { text-align: center; padding: 44px 20px; color: var(--ink-3); }
.empty svg { width: 46px; height: 46px; opacity: .4; margin-bottom: 10px; }
.empty b { display: block; color: var(--ink-2); font-size: 14.5px; margin-bottom: 4px; }
.empty p { font-size: 12.5px; }

/* هشدار راکد */
.stale-banner {
  display: flex; align-items: center; gap: 12px; padding: 13px 18px; margin-bottom: 16px;
  background: linear-gradient(90deg, var(--warn-soft), #fff8ec); border: 1px solid #f3dfb2;
  border-radius: var(--radius); font-size: 13px;
}
.stale-banner svg { width: 21px; height: 21px; color: var(--warn-text); flex: none; }
.stale-banner b { color: var(--warn-text); }

/* ============================================================
   ناوبری موبایل + FAB
   ============================================================ */
.bottom-nav {
  display: none; position: fixed; bottom: 0; inset-inline: 0; z-index: 50; height: 64px;
  background: rgba(255,255,255,.92); backdrop-filter: blur(14px); border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.bottom-nav .bn-inner { display: grid; grid-template-columns: repeat(5, 1fr); height: 100%; max-width: 560px; margin: 0 auto; }
.bottom-nav a {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  color: var(--ink-3); font-size: 10px; font-weight: 600; position: relative; transition: color .18s;
}
.bottom-nav a svg { width: 22px; height: 22px; transition: transform .2s var(--ease); }
.bottom-nav a.active { color: var(--brand-deep); }
.bottom-nav a.active svg { transform: translateY(-2px); }
.bottom-nav a.active::before { content: ""; position: absolute; top: 0; width: 34px; height: 3px; border-radius: 0 0 4px 4px; background: var(--brand); }
.bottom-nav a .nav-badge {
  position: absolute; top: 8px; inset-inline-end: calc(50% - 21px); min-width: 16px; height: 16px;
  background: var(--crit); color: #fff; font-size: 9.5px; font-weight: 700; border-radius: 99px;
  display: grid; place-items: center; padding: 0 4px;
}
.fab {
  display: grid; place-items: center; position: fixed; bottom: 26px; inset-inline-end: 26px; z-index: 49;
  width: 56px; height: 56px; border-radius: 18px; border: 0; cursor: pointer;
  background: linear-gradient(135deg, var(--brand-deep), var(--brand)); color: #fff;
  box-shadow: 0 10px 26px rgba(18,61,116,.4); transition: transform .2s var(--ease), box-shadow .2s;
}
.fab:hover { transform: scale(1.06) rotate(90deg); }
.fab svg { width: 24px; height: 24px; }

/* ============================================================
   ریسپانسیو
   ============================================================ */
@media (max-width: 1080px) {
  .kpi-grid { grid-template-columns: 1fr 1fr; }
  .dash-grid, .dash-grid-2 { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  :root { --topbar-h: 58px; }
  .sidebar { display: none; }
  .main { margin-inline-start: 0; }
  .bottom-nav { display: block; }
  .fab { bottom: 82px; inset-inline-end: 18px; }
  .content { padding: 16px 14px 110px; }
  .topbar { padding: 0 14px; }
  .top-search { width: 44vw; }
  .login-wrap { grid-template-columns: 1fr; }
  .login-hero { padding: 34px 26px; min-height: 34vh; }
  .login-hero h1 { font-size: 27px; }
  .hero-stats { display: none; }
  .table-wrap.resp { display: none; }
  .cust-cards { display: block; }
  .form-grid { grid-template-columns: 1fr; }
  .kb-col { flex-basis: 82vw; max-height: none; }
  .kanban { scroll-snap-type: x mandatory; margin-inline: -14px; padding-inline: 14px; }
  .modal-overlay { align-items: flex-end; padding: 0; }
  .modal { width: 100%; max-height: 92vh; border-radius: 22px 22px 0 0; animation: slide-up .3s var(--ease); }
  .sheet-grip { display: block; width: 42px; height: 4.5px; border-radius: 4px; background: var(--line); margin: 10px auto 0; }
  .ch-actions { width: 100%; margin-inline-start: 0; }
  .act-btn { flex: 1; }
  .kpi .k-value { font-size: 22px; }
  .toast-root { bottom: 148px; }
  .wb-grid { grid-template-columns: 1fr; }
  .inv-meta { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 480px) {
  .kpi-grid { gap: 10px; }
  .kpi { padding: 14px 15px; }
  .demo-users { grid-template-columns: 1fr; }
  .content { padding-inline: 12px; }
}

/* ============================================================
   کامبوباکس جستجودار + چندانتخابی + تقویم جلالی
   ============================================================ */
.combo { position: relative; }
.combo-pop {
  position: absolute; top: calc(100% + 6px); inset-inline: 0; z-index: 120; max-height: 220px; overflow-y: auto;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-3);
  animation: pop .15s var(--ease);
}
.combo-item {
  display: block; width: 100%; text-align: right; padding: 9px 14px; border: 0; background: none;
  font-size: 13px; cursor: pointer; transition: background .12s;
}
.combo-item:hover { background: var(--brand-softer); }
.combo-empty { padding: 13px; text-align: center; color: var(--ink-3); font-size: 12.5px; }

.ms-chips { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 4px; min-height: 26px; }
.ms-x {
  border: 0; background: none; cursor: pointer; color: inherit; font-size: 14px; line-height: 1;
  padding: 0 2px; border-radius: 50%; opacity: .7;
}
.ms-x:hover { opacity: 1; color: var(--crit); }

.jcal { background: var(--surface-2); border: 1.5px solid var(--line); border-radius: 14px; padding: 12px 14px; }
.jcal-quick { margin-bottom: 10px; }
.jcal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.jcal-title { font-size: 13.5px; }
.jcal-nav {
  width: 30px; height: 30px; border-radius: 9px; border: 1.5px solid var(--line); background: var(--surface);
  cursor: pointer; font-size: 16px; color: var(--ink-2); transition: all .15s;
}
.jcal-nav:hover { border-color: var(--brand); color: var(--brand); }
.jcal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; }
.jcal-week span { text-align: center; font-size: 10.5px; color: var(--ink-3); padding: 3px 0; font-weight: 700; }
.jcal-day {
  aspect-ratio: 1; border: 0; background: var(--surface); border-radius: 9px; cursor: pointer;
  font-size: 12.5px; font-variant-numeric: tabular-nums; color: var(--ink); transition: all .13s;
}
.jcal-day:hover { background: var(--brand-soft); color: var(--brand-deep); }
.jcal-day.dis { opacity: .3; cursor: not-allowed; background: transparent; }
.jcal-day.today { box-shadow: inset 0 0 0 1.5px var(--brand); }
.jcal-day.sel { background: var(--brand); color: #fff; font-weight: 800; }
.jcal-sel { margin-top: 10px; font-size: 12px; color: var(--ink-2); display: flex; align-items: center; gap: 6px; }

/* KPI قابل کلیک */
.kpi-link { cursor: pointer; }
.kpi-link:active { transform: scale(.985); }

/* ============================================================
   نوار هدف فروش
   ============================================================ */
.target-bar {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 18px; margin-bottom: 16px; box-shadow: var(--shadow-1);
}
.target-bar .tb-info { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 13px; margin-bottom: 9px; }
.target-bar .tb-info svg { color: var(--s3); width: 18px; height: 18px; }
.target-bar .tb-info span { color: var(--ink-2); font-size: 12px; }
.target-bar .tb-pct { margin-inline-start: auto; font-size: 16px; font-variant-numeric: tabular-nums; }
.tb-track { height: 10px; border-radius: 10px; background: var(--surface-2); overflow: hidden; border: 1px solid var(--line-soft); }
.tb-fill { height: 100%; border-radius: 10px; transform-origin: right; animation: hbar-grow 1s var(--ease) both; transition: width .4s var(--ease); }
.target-bar.low  .tb-fill { background: linear-gradient(90deg, #eda100, #eb6834); }
.target-bar.low  .tb-pct  { color: var(--warn-text); }
.target-bar.good .tb-fill { background: linear-gradient(90deg, var(--seq-400), var(--brand)); }
.target-bar.good .tb-pct  { color: var(--brand-deep); }
.target-bar.done .tb-fill { background: linear-gradient(90deg, #0ca30c, #1baf7a); }
.target-bar.done .tb-pct  { color: var(--good-text); }
.mini-track { width: 90px; height: 7px; border-radius: 7px; background: var(--surface-2); border: 1px solid var(--line-soft); overflow: hidden; display: inline-block; vertical-align: middle; margin-inline-end: 6px; }
.mini-fill { height: 100%; background: var(--brand); border-radius: 7px; }
.mini-fill.full { background: var(--good); }

/* ============================================================
   میز کار پیگیری‌ها — ویژه و توی چشم
   ============================================================ */
.workbench {
  position: relative; border-radius: var(--radius); padding: 2px; margin-bottom: 16px;
  background: linear-gradient(120deg, var(--crit), var(--s3), var(--seq-400));
  box-shadow: 0 10px 30px rgba(18,61,116,.12);
}
.workbench .wb-title {
  position: absolute; top: -11px; inset-inline-start: 18px; z-index: 1;
  background: linear-gradient(135deg, var(--brand-deep), var(--brand)); color: #fff;
  font-size: 12px; font-weight: 800; padding: 3px 14px; border-radius: 99px;
  display: flex; align-items: center; gap: 6px; box-shadow: var(--shadow-2);
}
.wb-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 2px; background: transparent; border-radius: calc(var(--radius) - 2px); overflow: hidden; }
.wb-col { background: var(--surface); padding: 18px 16px 12px; }
.wb-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; font-size: 13.5px; }
.wb-count { margin-inline-start: auto; min-width: 26px; height: 26px; display: grid; place-items: center; border-radius: 99px; font-weight: 800; font-size: 13px; padding: 0 8px; }
.wb-late    .wb-count { background: var(--crit-soft); color: var(--crit-text); }
.wb-today   .wb-count { background: var(--warn-soft); color: var(--warn-text); }
.wb-tomorrow .wb-count { background: var(--brand-soft); color: var(--brand-deep); }
.wb-late    { box-shadow: inset 0 3px 0 var(--crit); }
.wb-today   { box-shadow: inset 0 3px 0 var(--s3); }
.wb-tomorrow{ box-shadow: inset 0 3px 0 var(--seq-400); }
.wb-item { padding: 9px 10px; border-radius: 11px; background: var(--surface-2); margin-bottom: 7px; cursor: pointer; transition: background .15s, transform .15s; }
.wb-item:hover { background: var(--brand-softer); transform: translateX(-2px); }
.wb-item b { font-size: 12.5px; display: block; }
.wb-item > span { font-size: 11.5px; color: var(--ink-3); display: block; margin-top: 1px; }
.wb-acts { display: flex; gap: 6px; margin-top: 8px; }
.wb-acts .btn { padding: 4px 9px; font-size: 11px; }
.wb-empty { font-size: 12px; color: var(--ink-3); padding: 10px 4px; }
.wb-more { display: block; font-size: 11.5px; font-weight: 700; margin-top: 4px; }

/* ============================================================
   هشدار سرنخ تکراری + نوار انتخاب گروهی + گفتگو
   ============================================================ */
.dup-warning {
  display: flex; align-items: center; gap: 10px; margin-top: 8px; padding: 10px 12px;
  background: var(--crit-soft); border: 1px solid #f3c1c1; border-radius: 11px; font-size: 12px;
  animation: rise .25s var(--ease);
}
.dup-warning svg { color: var(--crit-text); width: 20px; height: 20px; flex: none; }
.dup-warning b { color: var(--crit-text); }

.bulk-bar {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  background: var(--brand-softer); border: 1.5px solid var(--brand-soft); border-radius: var(--radius);
  padding: 11px 16px; margin-bottom: 12px; animation: rise .25s var(--ease);
}
.bulk-bar b { color: var(--brand-deep); font-size: 13px; }

.cm-list { display: flex; flex-direction: column; gap: 12px; max-height: 420px; overflow-y: auto; padding: 4px 2px; }
.cm-item { display: flex; gap: 9px; align-items: flex-start; }
.cm-item .cm-bubble {
  background: var(--surface-2); border: 1px solid var(--line-soft); border-radius: 3px 14px 14px 14px;
  padding: 9px 13px; max-width: 78%; animation: rise .25s var(--ease);
}
.cm-item.mine { flex-direction: row-reverse; }
.cm-item.mine .cm-bubble { background: var(--brand-softer); border-color: var(--brand-soft); border-radius: 14px 3px 14px 14px; }
.cm-bubble b { font-size: 11.5px; color: var(--brand-deep); display: block; }
.cm-bubble p { font-size: 13px; margin: 2px 0; }
.cm-time { font-size: 10.5px; color: var(--ink-3); }

/* ============================================================
   فاکتور چاپی
   ============================================================ */
.invoice { background: #fff; color: #1d1c19; font-size: 13px; }
.inv-head { display: flex; align-items: center; gap: 14px; border-bottom: 2.5px solid var(--brand-deep); padding-bottom: 14px; }
.inv-logo { width: 48px; height: 48px; border-radius: 13px; display: grid; place-items: center; background: linear-gradient(135deg, #123d74, #0e7f74); color: #fff; }
.inv-logo svg { width: 26px; height: 26px; }
.inv-head h2 { font-size: 18px; font-weight: 800; }
.inv-head p { font-size: 11.5px; color: #5d5b53; }
.inv-type { font-size: 14px; font-weight: 800; color: var(--warn-text); border: 2px dashed currentColor; border-radius: 11px; padding: 7px 16px; }
.inv-type.final { color: var(--good-text); }
.inv-meta { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 5px 18px; padding: 13px 0; font-size: 12px; border-bottom: 1px solid var(--line); }
.inv-table { width: 100%; border-collapse: collapse; margin: 14px 0; }
.inv-table th { background: #eef2f8; font-size: 11.5px; padding: 8px 10px; text-align: right; border: 1px solid #d9dfe9; }
.inv-table td { padding: 8px 10px; border: 1px solid #e3e7ee; font-size: 12.5px; font-variant-numeric: tabular-nums; }
.inv-table td small { color: #8f8d84; }
.inv-sums { display: flex; gap: 22px; justify-content: flex-end; flex-wrap: wrap; font-size: 13px; padding: 6px 0 14px; }
.inv-payable { border: 2px solid var(--brand-deep); border-radius: 10px; padding: 6px 14px; color: var(--brand-deep); font-weight: 800; }
.inv-foot { display: flex; justify-content: space-between; padding: 26px 40px 8px; color: #5d5b53; font-size: 12px; }
.inv-note { font-size: 10.5px; color: #8f8d84; border-top: 1px dashed var(--line); padding-top: 8px; }

#print-root { display: none; }
@media print {
  body.printing #app, body.printing #modal-root, body.printing #toast-root, body.printing .chart-tip { display: none !important; }
  body.printing #print-root { display: block; padding: 20px; }
}

/* چاپ */
@media print {
  .sidebar, .topbar, .bottom-nav, .fab, .toolbar, .quick-actions { display: none !important; }
  .main { margin: 0; }
  .panel, .kpi { box-shadow: none; break-inside: avoid; }
}

/* ============================================================
   افزوده‌های آژانس زِد (کامپوننت‌های جدید)
   ============================================================ */

/* چیپ‌های جدید */
.chip-accent { background: var(--accent-soft); border-color: transparent; color: var(--accent-text); }
.chip-soft   { background: var(--brand-softer); border-color: transparent; color: var(--brand-deep); }

/* آواتار روی‌هم */
.avatar-stack { display: inline-flex; align-items: center; }
.avatar-stack .avatar { margin-inline-start: -8px; border: 2px solid var(--surface); box-shadow: 0 0 0 .5px rgba(0,0,0,.04); }
.avatar-stack .avatar:first-child { margin-inline-start: 0; }
.avatar.more { background: var(--surface-2); color: var(--ink-2); font-size: 10px; }

/* خط وظیفهٔ داشبورد */
.task-line { display: flex; align-items: center; gap: 10px; padding: 9px 6px; border-bottom: 1px solid var(--line-soft); cursor: pointer; transition: background .13s; border-radius: 8px; }
.task-line:last-child { border-bottom: 0; }
.task-line:hover { background: var(--surface-2); }
.tl-prio { width: 4px; height: 26px; border-radius: 4px; flex: none; }

/* انتخاب عضو (چند) */
.member-pick { display: flex; flex-wrap: wrap; gap: 7px; }
.member-tag {
  display: inline-flex; align-items: center; gap: 7px; padding: 4px 11px 4px 5px; border-radius: 99px;
  border: 1.5px solid var(--line); background: var(--surface); cursor: pointer; font-size: 12px; color: var(--ink-2);
  transition: all .15s;
}
.member-tag:hover { border-color: var(--brand); }
.member-tag.on { border-color: var(--brand); background: var(--brand-soft); color: var(--brand-deep); font-weight: 700; }
.member-tag .avatar { width: 22px; height: 22px; font-size: 9.5px; }

/* ردیف‌های فرم جلسه */
.res-row, .link-row { display: flex; gap: 8px; margin-bottom: 8px; align-items: center; }
.res-row .res-text, .link-row .link-url { flex: 1; }
.res-row .res-assignee { max-width: 150px; }
.link-row .link-title { max-width: 140px; }
.res-item { display: flex; gap: 10px; align-items: flex-start; padding: 8px 10px; background: var(--surface-2); border-radius: 10px; }
.res-item .chip { flex: none; }

/* ردیف مالی */
.fin-row { display: flex; align-items: center; gap: 10px; padding: 9px 4px; border-bottom: 1px solid var(--line-soft); }
.fin-row:last-child { border-bottom: 0; }

/* کارت سند/دسترسی */
.asset-card, .cred-card { display: flex; align-items: flex-start; gap: 11px; padding: 11px 12px; background: var(--surface-2); border: 1px solid var(--line-soft); border-radius: 12px; }
.ac-ico { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; flex: none; }
.ac-ico svg { width: 19px; height: 19px; }
.cred-line { display: flex; align-items: center; gap: 6px; font-size: 12px; margin-top: 3px; flex-wrap: wrap; }
.cred-line code { background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 2px 8px; font-family: monospace; font-size: 12px; }
.asset-card b, .cred-card b { font-size: 13.5px; display: block; }

/* فهرست وظایف (داخل پرونده) */
.task-list { display: flex; flex-direction: column; gap: 8px; }
.task-list-item { display: flex; align-items: center; gap: 10px; padding: 10px 12px; background: var(--surface-2); border: 1px solid var(--line-soft); border-radius: 11px; cursor: pointer; transition: background .13s, transform .13s; }
.task-list-item:hover { background: var(--brand-softer); transform: translateX(-2px); }
.task-list-item.done { opacity: .6; }
.task-list-item.done b { text-decoration: line-through; }
.task-list-item b { font-size: 13px; }
.tl-status { width: 9px; height: 9px; border-radius: 50%; flex: none; }

/* تخته وظایف */
.task-board .kb-card.task-card.late { border-color: var(--crit); box-shadow: inset 3px 0 0 var(--crit), var(--shadow-1); }
.kb-card .kc-name { cursor: pointer; }
.kb-card .kc-name:hover { color: var(--brand); }

/* جلسات */
.meeting-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; }
.meeting-card { display: flex; gap: 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow-1); cursor: pointer; transition: transform .18s var(--ease), box-shadow .18s, border-color .18s; }
.meeting-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-2); border-color: #c9d9f2; }
.mc-date { text-align: center; flex: none; width: 62px; padding: 8px 0; background: var(--brand-softer); border-radius: 12px; }
.mc-date b { display: block; font-size: 13px; color: var(--brand-deep); }
.mc-date span { font-size: 11px; color: var(--ink-3); }

/* کاتالوگ نمونه‌کار */
.portfolio-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.pf-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-1); transition: transform .18s var(--ease), box-shadow .18s; display: flex; flex-direction: column; }
.pf-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-2); }
.pf-thumb { position: relative; height: 130px; background: linear-gradient(135deg, var(--brand-soft), var(--accent-soft)); background-size: cover; background-position: center; display: grid; place-items: center; }
.pf-ph { color: var(--brand); opacity: .4; }
.pf-ph svg { width: 44px; height: 44px; }
.pf-service { position: absolute; top: 10px; inset-inline-end: 10px; background: rgba(255,255,255,.92); color: var(--brand-deep); font-size: 11px; font-weight: 700; padding: 3px 10px; border-radius: 99px; backdrop-filter: blur(4px); }
.pf-body { padding: 14px 15px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.pf-body b { font-size: 14.5px; }
.pf-body p { font-size: 12px; color: var(--ink-3); line-height: 1.7; }
.pf-tags { display: flex; flex-wrap: wrap; gap: 5px; }
.pf-actions { display: flex; gap: 6px; margin-top: auto; padding-top: 6px; flex-wrap: wrap; }

/* تنظیمات */
.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
.le-chips { display: flex; flex-wrap: wrap; gap: 6px; min-height: 28px; }
.le-chip { font-size: 12px; }
.member-row { display: flex; align-items: center; gap: 11px; padding: 10px 4px; border-bottom: 1px solid var(--line-soft); }
.member-row:last-child { border-bottom: 0; }
.member-row b { font-size: 13.5px; display: block; }

@media (max-width: 1080px) {
  .settings-grid { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .meeting-card .mc-date { width: 54px; }
  .res-row { flex-wrap: wrap; }
  .res-row .res-assignee { max-width: none; flex: 1; }
}

/* ============================================================
   نقش‌محوری: گزارش‌ساز و ماتریس مجوز
   ============================================================ */
/* کارت‌های گزارش */
.report-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; }
.report-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow-1); transition: transform .18s var(--ease), box-shadow .18s; }
.report-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-2); }
.rc-head { display: flex; align-items: center; gap: 8px; }
.rc-head b { flex: 1; font-size: 14px; }
.rc-sub { font-size: 11.5px; color: var(--ink-3); margin: 4px 0 10px; }
.rc-viz { min-height: 60px; }
.rc-kpi { text-align: center; padding: 18px 8px; }
.rc-kpi b { display: block; font-size: 30px; font-weight: 800; color: var(--brand-deep); font-variant-numeric: tabular-nums; }
.rc-kpi span { font-size: 12px; color: var(--ink-3); }

/* ردیف فیلتر گزارش‌ساز */
.filter-row { display: flex; gap: 8px; margin-bottom: 8px; align-items: center; }
.filter-row .f-field { max-width: 150px; }
.filter-row .f-op { max-width: 110px; }
#rb-preview { background: var(--surface-2); }

/* ماتریس مجوز */
.perm-matrix { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.perm-group { background: var(--surface-2); border: 1px solid var(--line-soft); border-radius: 12px; padding: 12px 14px; }
.perm-group > b { font-size: 12.5px; color: var(--brand-deep); display: block; margin-bottom: 8px; }
.perm-item { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--ink-2); padding: 4px 0; cursor: pointer; }
.perm-item input { width: 16px; height: 16px; accent-color: var(--brand); flex: none; }
.perm-item input:disabled { opacity: .6; }
input[type="color"] { border: 1.5px solid var(--line); border-radius: 11px; background: var(--surface); cursor: pointer; }

/* ============================================================
   نسخهٔ ۱.۲ — اعلان، جانشینی، هزینه، معوقات، زیرکار، منشن
   ============================================================ */

/* --- زنگ اعلان و آیکن‌های نوار بالا --- */
.notif-bell, .topbar-icon {
  position: relative; flex: none; width: 40px; height: 40px; border-radius: 12px;
  border: 1.5px solid var(--line); background: var(--surface); color: var(--ink-2);
  display: grid; place-items: center; cursor: pointer; transition: all .15s;
}
.notif-bell:hover, .topbar-icon:hover { color: var(--brand); border-color: var(--brand-soft); background: var(--brand-softer); }
.notif-badge {
  position: absolute; top: -5px; inset-inline-end: -5px; min-width: 18px; height: 18px; padding: 0 4px;
  border-radius: 9px; background: var(--crit); color: #fff; font-size: 10.5px; font-weight: 700;
  display: grid; place-items: center; border: 2px solid var(--surface);
}

/* --- پنل اعلان --- */
.notif-list { display: flex; flex-direction: column; gap: 2px; max-height: 60vh; overflow-y: auto; margin: -4px; }
.notif-row { display: flex; align-items: flex-start; gap: 10px; padding: 11px 10px; border-radius: 12px; cursor: pointer; transition: background .12s; }
.notif-row:hover { background: var(--surface-2); }
.notif-row.unread { background: var(--brand-softer); }
.notif-ico { flex: none; width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; }
.notif-ico svg { width: 17px; height: 17px; }
.notif-row p { font-size: 13px; line-height: 1.6; margin: 0; }
.notif-time { font-size: 11px; color: var(--ink-3); }
.notif-dot { flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--brand); margin-top: 6px; }

/* --- نوار جانشینی --- */
.imp-banner {
  position: sticky; top: 0; z-index: 35; display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 9px 18px; background: linear-gradient(90deg, var(--accent), #f3944a); color: #fff; font-size: 12.5px; font-weight: 600;
}
.imp-banner svg { width: 17px; height: 17px; }
.imp-banner b { font-weight: 800; }
.imp-banner .btn { margin-inline-start: auto; background: rgba(255,255,255,.22); color: #fff; border: 1px solid rgba(255,255,255,.35); }
.imp-banner .btn:hover { background: rgba(255,255,255,.32); }
.imp-list { display: flex; flex-direction: column; gap: 6px; }
.imp-item {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px;
  border: 1.5px solid var(--line); background: var(--surface); cursor: pointer; transition: all .15s; text-align: right;
}
.imp-item:hover { border-color: var(--brand); background: var(--brand-softer); }
.imp-item > svg { width: 17px; height: 17px; color: var(--ink-3); }

/* --- گزارش ماه شمسی (مالی/هزینه) --- */
.month-strip { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 18px; margin-bottom: 18px; }
.ms-title { font-size: 13px; font-weight: 700; display: flex; align-items: center; gap: 7px; margin-bottom: 12px; }
.ms-title svg { width: 17px; height: 17px; color: var(--brand); }
.ms-title b { color: var(--brand-deep); }
.ms-cells { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; }
.ms-cell { background: var(--surface-2); border: 1px solid var(--line-soft); border-radius: 12px; padding: 10px 12px; }
.ms-cell span { display: block; font-size: 11.5px; color: var(--ink-3); margin-bottom: 3px; }
.ms-cell b { font-size: 15px; font-weight: 800; }

/* --- معوقات --- */
.row-overdue { background: var(--crit-soft) !important; }
.row-overdue:hover { background: #fbe0de !important; }

/* --- زیرکارها (فرم و چک‌لیست) --- */
.subtask-row, .res-row { display: grid; grid-template-columns: 1fr 160px auto; gap: 8px; margin-bottom: 8px; align-items: center; }
.subtask-check { display: flex; flex-direction: column; gap: 4px; }
.stc-row { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--line-soft); }
.stc-row.done { background: var(--good-soft); border-color: transparent; }
.stc-main { display: flex; align-items: center; gap: 9px; flex: 1; min-width: 0; }
.stc-main b { font-size: 13px; }
.stc-row.done .stc-main b { text-decoration: line-through; color: var(--ink-3); }
.stc-who { font-size: 11px; color: var(--ink-3); margin-inline-start: 6px; }
.stc-doneby { font-size: 11px; color: var(--good-text); display: inline-flex; align-items: center; gap: 3px; white-space: nowrap; }
.stc-doneby svg { width: 13px; height: 13px; }
.stc-shortfall { font-size: 12px; color: var(--warn-text); display: flex; align-items: center; gap: 6px; margin-top: 8px; }
.stc-shortfall.done { color: var(--good-text); }
.stc-shortfall svg { width: 15px; height: 15px; flex: none; }

/* --- راهنمای ورود بانک تماس --- */
.import-help { background: var(--surface-2); border: 1px solid var(--line-soft); border-radius: 12px; padding: 12px 14px; font-size: 12.5px; color: var(--ink-2); }
.import-help b { color: var(--brand-deep); display: inline-flex; align-items: center; gap: 5px; }
.import-help svg { width: 15px; height: 15px; }
.import-help p { margin: 6px 0; line-height: 1.7; }
.import-help code { display: block; direction: ltr; text-align: left; background: var(--surface); border: 1px dashed var(--line); border-radius: 8px; padding: 7px 10px; font-size: 12px; color: var(--brand-deep); }

/* --- منشن در گفتگو --- */
.mention { color: var(--brand-deep); font-weight: 700; background: var(--brand-softer); border-radius: 5px; padding: 0 3px; }
.mention-pop {
  position: absolute; bottom: calc(100% + 6px); inset-inline: 0; background: var(--surface);
  border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-3); padding: 5px; z-index: 40; max-height: 240px; overflow-y: auto;
}
.mp-item { display: flex; align-items: center; gap: 8px; width: 100%; border: 0; background: none; padding: 8px 10px; border-radius: 9px; cursor: pointer; font-size: 13px; color: var(--ink-1); }
.mp-item:hover { background: var(--brand-softer); }

/* --- بخش‌بندی سرنخ/کارفرما --- */
.seg-wide { display: flex; flex-wrap: wrap; }
.seg-wide button { display: inline-flex; align-items: center; gap: 6px; }
.seg-wide button svg { width: 15px; height: 15px; }
.seg-n { font-size: 11px; background: rgba(0,0,0,.06); padding: 0 6px; border-radius: 8px; min-width: 18px; text-align: center; }
.seg-wide button.on .seg-n { background: rgba(255,255,255,.28); }

/* --- گزارش آماده --- */
.report-card.preset { border-style: dashed; }
.status-row { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }

/* ============================================================
   نسخهٔ ۱.۳ — بازطراحی کامل ریسپانسیو موبایل
   ============================================================ */

/* دکمهٔ «بیشتر» در ناوبری پایین موبایل */
.bn-more {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  border: 0; background: none; color: var(--ink-3); font-size: 10px; font-weight: 600;
  font-family: inherit; cursor: pointer; position: relative; transition: color .18s;
}
.bn-more svg { width: 22px; height: 22px; }
.bn-more.active { color: var(--brand-deep); }
.bn-more.active::before { content: ""; position: absolute; top: 0; width: 34px; height: 3px; border-radius: 0 0 4px 4px; background: var(--brand); }

/* منوی کامل موبایل */
.mmenu { display: flex; flex-direction: column; gap: 14px; }
.mmenu-user { display: flex; align-items: center; gap: 12px; padding: 4px 2px 14px; border-bottom: 1px solid var(--line-soft); }
.mmenu-user b { font-size: 15px; display: block; }
.mmenu-user span { font-size: 12px; color: var(--ink-3); }
.mmenu-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.mmenu-item {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 7px;
  padding: 16px 8px; border-radius: 14px; border: 1.5px solid var(--line); background: var(--surface);
  color: var(--ink-2); font-size: 12px; font-weight: 600; text-align: center; transition: all .15s;
}
.mmenu-item svg { width: 22px; height: 22px; }
.mmenu-item.on { border-color: var(--brand); background: var(--brand-softer); color: var(--brand-deep); }
.mmenu-item:active { transform: scale(.96); }

@media (max-width: 900px) {
  /* نوار ابزار: جستجو تمام‌عرض، فیلترها زیر آن جای می‌گیرند */
  .toolbar { gap: 8px; }
  .toolbar .search-inline { flex: 1 1 100%; min-width: 0; order: -1; }
  .toolbar .select { flex: 1 1 auto; min-width: 0; }
  .result-count { flex: 1 1 100%; text-align: start; }
  /* ردیف‌های فرمِ چندستونی → عمودی */
  .subtask-row, .res-row, .link-row, .filter-row { grid-template-columns: 1fr; display: grid; gap: 8px; }
  .subtask-row .st-rm, .res-row .res-rm, .link-row .link-rm, .filter-row .f-rm { justify-self: end; }
  .res-row .res-assignee, .link-row .link-title, .filter-row .f-field, .filter-row .f-op { max-width: none; }
  .filter-row .f-value-wrap { width: 100%; }
  /* نوار ماه شمسی */
  .ms-cells { grid-template-columns: 1fr 1fr; }
  /* پنل اعلان و فهرست جانشینی تمام‌عرض شیت */
  .notif-list { max-height: 62vh; }
  /* دکمه‌های پایین مودال زیر هم و تمام‌عرض */
  .modal-foot { flex-wrap: wrap; }
  .modal-foot .btn { flex: 1 1 auto; justify-content: center; }
}

@media (max-width: 700px) {
  /* نوار بالای جمع‌وجور: عنوان + آیکن‌ها؛ جستجوی سراسری پنهان (هر صفحه جستجوی خودش را دارد) */
  .top-search { display: none; }
  .page-title { flex: 1; min-width: 0; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .page-title small { display: none; }
  .topbar { gap: 10px; }
  .notif-bell, .topbar-icon { width: 38px; height: 38px; }
  .topbar .avatar { width: 36px; height: 36px; }
}

@media (max-width: 680px) {
  /* ---- جدول‌ها → کارت (بدون اسکرول افقی) ---- */
  .table-wrap { overflow-x: visible; border: 0; background: transparent; box-shadow: none; border-radius: 0; }
  table.tbl { min-width: 0; display: block; }
  .tbl thead { display: none; }
  .tbl tbody { display: block; }
  .tbl tbody tr {
    display: block; background: var(--surface); border: 1px solid var(--line);
    border-radius: 14px; box-shadow: var(--shadow-1); margin-bottom: 12px; overflow: hidden;
  }
  .tbl tbody tr:hover { background: var(--surface); }
  .tbl tbody tr:last-child td { border-bottom: 0; }
  .tbl td {
    display: flex; align-items: center; justify-content: space-between; gap: 14px;
    padding: 10px 14px; border-bottom: 1px solid var(--line-soft); font-size: 13px; text-align: start;
    min-height: 0; white-space: normal;
  }
  .tbl td[data-label]::before {
    content: attr(data-label); font-size: 11.5px; font-weight: 700; color: var(--ink-3);
    flex: 0 0 auto; white-space: nowrap;
  }
  /* سلول نخست = سرِ کارت (بدون برچسب، پس‌زمینهٔ ملایم) */
  .tbl td:first-child {
    display: block; background: var(--surface-2); border-bottom: 1px solid var(--line);
    padding: 12px 14px;
  }
  .tbl td:first-child::before { display: none; }
  /* سلول‌های بدون برچسب (ستون اکشن) → دکمه‌ها ته ردیف */
  .tbl td:not([data-label]):not(:first-child) { justify-content: flex-end; }
  .tbl td:not([data-label]):not(:first-child):empty { display: none; }
  .tbl td > div { min-width: 0; }
  /* ستون انتخاب گروهی در موبایل پنهان (بیشتر برای دسکتاپ) */
  .tbl td:has(.cb-sel), .tbl td:has(.row-sel) { display: none; }
  .tbl td:has(.cb-sel) + td, .tbl td:has(.row-sel) + td {
    display: block; background: var(--surface-2); border-bottom: 1px solid var(--line); padding: 12px 14px;
  }
  .tbl td:has(.cb-sel) + td::before, .tbl td:has(.row-sel) + td::before { display: none; }
  /* اعداد در نمای کارتی چپ‌چین نمانند */
  .tbl td.num { justify-content: space-between; }

  /* KPI تک‌ستونه در گوشی‌های کوچک نه — دوتایی می‌ماند ولی جمع‌وجورتر */
  .kpi { padding: 14px 15px; }
  .kpi .k-value { font-size: 20px; }

  /* بخش‌بندی سرنخ/کارفرما اسکرول‌پذیر افقی نرم */
  .seg-wide { flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; margin-inline: -2px; padding: 2px; }
  .seg-wide button { white-space: nowrap; flex: 0 0 auto; }

  /* هیروی پروندهٔ کارفرما */
  .cust-hero .ch-top { flex-wrap: wrap; }
  .stepper { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .tabs { margin-inline: -12px; padding-inline: 12px; }

  /* منوی موبایل ۲ ستون در گوشی باریک */
  .mmenu-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 380px) {
  .kpi-grid { grid-template-columns: 1fr; }
  .ms-cells { grid-template-columns: 1fr; }
}

/* ============================================================
   نسخهٔ ۱.۴ — آپلود، پروژه، فاکتور، پیوست
   ============================================================ */

/* ویجت آپلود */
.upload-field > label { display:block; font-size:12.5px; color:var(--ink-2); font-weight:600; margin-bottom:6px; }
.up-list { display:flex; flex-wrap:wrap; gap:8px; margin-bottom:8px; }
.up-item { display:flex; align-items:center; gap:8px; background:var(--surface-2); border:1px solid var(--line); border-radius:10px; padding:5px 8px 5px 5px; font-size:12px; max-width:220px; }
.up-item img { width:34px; height:34px; border-radius:7px; object-fit:cover; flex:none; }
.up-item .up-doc { width:34px; height:34px; border-radius:7px; background:var(--brand-softer); display:grid; place-items:center; color:var(--brand); flex:none; }
.up-item .up-doc svg { width:17px; height:17px; }
.up-name { flex:1; min-width:0; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.up-view { color:var(--ink-3); display:grid; place-items:center; } .up-view svg { width:15px; height:15px; }
.up-rm { border:0; background:none; color:var(--crit); cursor:pointer; display:grid; place-items:center; } .up-rm svg { width:14px; height:14px; }
.up-empty { font-size:12px; color:var(--ink-3); margin:0; }
.up-loading { color:var(--ink-3); font-size:12px; padding:8px 12px; }
.up-actions { display:flex; gap:8px; flex-wrap:wrap; }

/* نمایش پیوست‌ها */
.att-view { display:flex; flex-wrap:wrap; gap:8px; }
.att-chip { display:flex; align-items:center; gap:7px; background:var(--surface-2); border:1px solid var(--line); border-radius:10px; padding:5px 10px 5px 6px; font-size:12px; color:var(--ink-1); max-width:200px; }
.att-chip img { width:30px; height:30px; border-radius:6px; object-fit:cover; }
.att-chip svg { width:16px; height:16px; color:var(--brand); }
.att-chip span { white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }

/* کارت پروژه */
.project-grid { display:grid; grid-template-columns:repeat(auto-fill,minmax(280px,1fr)); gap:14px; }
.project-card { background:var(--surface); border:1px solid var(--line); border-inline-start:4px solid var(--pc,var(--brand)); border-radius:14px; padding:14px 16px; cursor:pointer; box-shadow:var(--shadow-1); transition:transform .18s var(--ease), box-shadow .18s; }
.project-card:hover { transform:translateY(-3px); box-shadow:var(--shadow-2); }
.pc-head { display:flex; align-items:center; gap:8px; }
.pc-head b { font-size:14.5px; }
.pc-dot { width:10px; height:10px; border-radius:50%; flex:none; }
.pc-sub { font-size:12px; color:var(--ink-3); margin:6px 0 10px; display:flex; align-items:center; gap:5px; }
.pc-sub svg { width:14px; height:14px; }
.pc-bar { display:flex; align-items:center; gap:8px; }
.pc-bar .tb-track { flex:1; }
.pc-bar span { font-size:12px; font-weight:700; color:var(--brand-deep); }
.pc-foot { display:flex; align-items:center; gap:8px; margin-top:10px; font-size:11.5px; color:var(--ink-3); flex-wrap:wrap; }

/* ساخت فاکتور */
.inv-buyer { border:1px solid var(--line); border-radius:12px; padding:10px 14px 4px; }
.inv-buyer legend { font-size:12px; color:var(--brand-deep); font-weight:700; padding:0 6px; }
.inv-items-head, .inv-item { display:grid; grid-template-columns:1fr 70px 120px 90px 34px; gap:8px; align-items:center; }
.inv-items-head { font-size:11px; color:var(--ink-3); font-weight:700; margin-bottom:6px; padding:0 2px; }
.inv-item { margin-bottom:8px; }
.inv-item .it-total { font-size:12.5px; font-weight:700; text-align:center; font-variant-numeric:tabular-nums; }
.inv-total-box { display:flex; justify-content:space-between; align-items:center; background:var(--brand-softer); border:1px solid var(--brand-soft); border-radius:12px; padding:12px 16px; }
.inv-total-box b { font-size:18px; color:var(--brand-deep); }

/* پیش‌نمایش فاکتور در مودال */
.invoice-doc { background:#fff; border:1px solid var(--line); border-radius:12px; padding:20px; color:#1a2b45; }
.inv-head { display:flex; gap:14px; align-items:flex-start; border-bottom:2px solid var(--brand); padding-bottom:12px; margin-bottom:12px; }
.inv-logo, .inv-logo-badge { width:56px; height:56px; border-radius:12px; flex:none; }
.inv-logo { object-fit:cover; } .inv-logo-badge { background:var(--brand); display:grid; place-items:center; } .inv-logo-badge svg { width:30px; height:30px; }
.inv-head-txt { flex:1; min-width:0; } .inv-head-txt b { font-size:17px; display:block; margin-bottom:3px; } .inv-head-txt span { display:block; font-size:11.5px; color:#667; }
.inv-meta-box { text-align:left; font-size:12px; } .inv-kind { font-size:15px; font-weight:800; color:var(--brand); margin-bottom:5px; }
.inv-buyer-box { background:var(--surface-2); padding:8px 12px; border-radius:8px; font-size:12.5px; margin-bottom:12px; }
.inv-table { width:100%; border-collapse:collapse; font-size:12.5px; }
.inv-table th { background:#f0f5fc; padding:7px; border:1px solid #dbe6f5; text-align:right; }
.inv-table td { padding:7px; border:1px solid #e6eef8; }
.inv-sums { margin-top:12px; max-width:280px; margin-inline-start:auto; }
.inv-sums > div { display:flex; justify-content:space-between; padding:4px 2px; font-size:12.5px; }
.inv-sums .inv-grand { border-top:2px solid var(--brand); margin-top:5px; font-size:14.5px; font-weight:800; color:var(--brand); }
.inv-note { margin-top:12px; font-size:12px; color:#667; background:var(--surface-2); padding:9px; border-radius:8px; }
.inv-foot { margin-top:16px; text-align:center; font-size:11.5px; color:#889; border-top:1px solid #eee; padding-top:10px; }

@media (max-width: 680px) {
  .inv-items-head { display:none; }
  .inv-item { grid-template-columns:1fr 1fr; gap:6px; background:var(--surface-2); padding:8px; border-radius:10px; }
  .inv-item .it-desc { grid-column:1 / -1; }
  .inv-item .it-total { grid-column:1 / -1; text-align:start; }
}

/* ============================================================
   نسخهٔ ۱.۵ — ارسال پیام، جستجوی سراسری، تبدیل، ادغام دسته
   ============================================================ */
.msg-preview { background: var(--surface-2); border: 1px solid var(--line-soft); border-radius: 10px; padding: 10px 12px; font-size: 12.5px; white-space: pre-wrap; max-height: 130px; overflow-y: auto; color: var(--ink-2); }
.msg-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; }
.msg-btn { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px 8px; border: 1.5px solid var(--line); border-radius: 14px; background: var(--surface); cursor: pointer; transition: all .15s; }
.msg-btn:hover { border-color: var(--mc); transform: translateY(-2px); box-shadow: var(--shadow-1); }
.msg-btn b { font-size: 12.5px; }
.msg-ico { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; color: #fff; }
.msg-ico svg { width: 20px; height: 20px; }
.msg-mode { font-size: 10.5px; color: var(--ink-3); }

/* جستجوی سراسری بخش‌بندی‌شده */
.search-pop .sp-head { font-size: 11px; font-weight: 700; color: var(--ink-3); padding: 8px 14px 4px; display: flex; align-items: center; gap: 6px; background: var(--surface-2); position: sticky; top: 0; }
.search-pop .sp-head svg { width: 13px; height: 13px; }
.sp-item .sp-dot { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.sp-item { gap: 10px; }

/* دکمهٔ تبدیل به کارفرما در هیرو */
.act-btn.convert { background: rgba(255,255,255,.28); border: 1px solid rgba(255,255,255,.4); }
.act-btn.convert:hover { background: rgba(255,255,255,.4); }

/* دکمهٔ تغییرنام در چیپ لیست تنظیمات */
.le-chip { display: inline-flex; align-items: center; gap: 4px; }
.le-chip .le-rn { border: 0; background: none; cursor: pointer; color: currentColor; opacity: .7; display: inline-grid; place-items: center; padding: 0 2px; }
.le-chip .le-rn:hover { opacity: 1; }
.le-chip .le-rn svg { width: 12px; height: 12px; }

/* ============================================================
   نسخهٔ ۱.۶ — اهداف/KPI فردی
   ============================================================ */
.goals-panel .goals-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.goal-card { background: var(--surface-2); border: 1px solid var(--line-soft); border-radius: 12px; padding: 12px 14px; }
.goal-card.done { background: var(--good-soft); border-color: transparent; }
.goal-top { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin-bottom: 8px; }
.goal-top span { font-size: 12px; color: var(--ink-2); }
.goal-top b { font-size: 12.5px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.goal-pct { display: block; margin-top: 6px; font-size: 11.5px; font-weight: 700; color: var(--brand-deep); }
.goal-card.done .goal-pct { color: var(--good-text); }

/* ============================================================
   نسخهٔ ۱.۷ — تاریخ نوار بالا، گروه پروژه/وظیفه، دفتر ماهانه،
   پروفایل، گزارش‌ساز، مایلستون، خط زمانی (Gantt)
   ============================================================ */

/* تاریخ امروز در نوار بالا */
.top-date { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--ink-2);
  background: var(--brand-softer); padding: 6px 10px; border-radius: var(--radius-s); white-space: nowrap; }
.top-date svg { width: 15px; height: 15px; color: var(--brand); }
@media (max-width: 900px) { .top-date { display: none; } }

/* گروه‌بندی وظایف بر اساس پروژه */
.proj-groups { display: flex; flex-direction: column; gap: 14px; }
.proj-group { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; border-inline-start: 3px solid var(--pc, var(--brand)); }
.pg-head { display: flex; align-items: center; gap: 10px; padding: 12px 14px; flex-wrap: wrap;
  background: var(--surface-2); border-bottom: 1px solid var(--line-soft); }
.pg-head a { color: inherit; }
.pg-head a b { font-size: 14px; }
.pg-client { font-size: 11.5px; color: var(--ink-3); display: inline-flex; align-items: center; gap: 4px; }
.pg-client svg { width: 13px; height: 13px; }
.pg-progress { font-size: 11.5px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.pc-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.pg-body { padding: 8px 12px 12px; }

/* دفتر ماهانهٔ قرارداد */
.ledger-summary { display: flex; gap: 16px; flex-wrap: wrap; font-size: 13px; margin-bottom: 10px; }
.ledger-summary b { font-variant-numeric: tabular-nums; }

/* پروفایل کاربر */
.profile-view { display: flex; align-items: flex-start; gap: 14px; }
.pv-avatar { width: 56px; height: 56px; border-radius: 16px; flex-shrink: 0; display: grid; place-items: center;
  color: #fff; font-weight: 800; font-size: 20px; background-size: cover; background-position: center; }
.profile-edit-top { display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding-bottom: 12px; border-bottom: 1px dashed var(--line); }
.pe-avatar { width: 64px; height: 64px; border-radius: 16px; display: grid; place-items: center;
  color: #fff; font-weight: 800; font-size: 22px; background-size: cover; background-position: center; position: relative; }
.pe-avatar.loading::after, .rp-img-prev.loading::after, .pe-avatar.loading::after {
  content: ""; position: absolute; inset: 0; background: rgba(0,0,0,.35);
  border-radius: inherit; background-image: repeating-linear-gradient(45deg, transparent, transparent 6px, rgba(255,255,255,.2) 6px, rgba(255,255,255,.2) 12px); }

/* گزارش‌ساز — بخش‌ها */
.rp-section { border: 1px solid var(--line); border-radius: var(--radius-s); padding: 10px; margin-bottom: 10px; background: var(--surface-2); }
.rp-sec-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.rp-drag { color: var(--ink-3); display: inline-flex; }
.rp-drag svg { width: 16px; height: 16px; }
.rp-heading { flex: 1; }
.rp-text { min-height: 60px; width: 100%; }
.rp-img-row { display: flex; align-items: center; gap: 10px; margin-top: 8px; }
.rp-img-prev { width: 60px; height: 44px; border-radius: 8px; background: var(--brand-softer); display: grid; place-items: center;
  color: var(--brand); background-size: cover; background-position: center; position: relative; flex-shrink: 0; }
.rp-img-prev svg { width: 18px; height: 18px; }
.rp-img-btn { cursor: pointer; }

/* پیش‌نمایش گزارش در سامانه */
.report-doc { background: #fff; color: #1a2b45; border-radius: var(--radius); padding: 18px; border: 1px solid var(--line); }
.report-doc .rep-head { display: flex; justify-content: space-between; gap: 16px; border-bottom: 2px solid var(--brand); padding-bottom: 12px; margin-bottom: 14px; }
.report-doc .rep-head b { font-size: 17px; display: block; }
.report-doc .rep-head span { display: block; font-size: 12.5px; color: #556; margin-top: 3px; }
.report-doc .rep-cover { width: 110px; height: 72px; object-fit: cover; border-radius: 8px; }
.report-doc .rep-summary { background: #f5f8fd; padding: 11px; border-radius: 8px; font-size: 13.5px; margin-bottom: 14px; white-space: pre-wrap; }
.report-doc .rep-section { margin-bottom: 16px; }
.report-doc .rep-section h4 { font-size: 14px; color: var(--brand); margin: 0 0 6px; }
.report-doc .rep-section p { font-size: 13px; line-height: 1.9; white-space: pre-wrap; margin: 0 0 8px; }
.report-doc .rep-section img { max-width: 100%; border-radius: 8px; border: 1px solid #e6eef8; }
.report-doc .rep-foot { margin-top: 20px; text-align: center; font-size: 12px; color: #889; border-top: 1px solid #eee; padding-top: 12px; }

/* قالب‌های پیام و مایلستون */
.tpl-row { border: 1px solid var(--line); border-radius: var(--radius-s); padding: 10px; margin-bottom: 10px; background: var(--surface-2); }
.tpl-row-head { display: flex; gap: 8px; margin-bottom: 8px; }
.tpl-title { flex: 1; }
.ms-row { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; }
.ms-row .ms-title { flex: 1; min-width: 140px; }
.ms-row .jcal { flex: 1; min-width: 200px; }
.ms-legend { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 12px; }

/* خط زمانی (Gantt) */
.gantt { margin-top: 6px; }
.gantt-scale { display: flex; justify-content: space-between; font-size: 11px; color: var(--ink-3);
  padding-inline-start: 140px; margin-bottom: 6px; }
.gantt-body { display: flex; flex-direction: column; gap: 6px; }
.gantt-row { display: flex; align-items: center; gap: 8px; }
.gantt-label { width: 132px; flex-shrink: 0; font-size: 12px; color: var(--ink-2);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gantt-track { position: relative; flex: 1; height: 20px; background: var(--surface-2);
  border-radius: 6px; overflow: hidden; }
.gantt-bar { position: absolute; top: 3px; height: 14px; border-radius: 5px; min-width: 4px; opacity: .9; }
.gantt-bar.done { opacity: .55; }
.gantt-bar.late { background: var(--crit) !important; }
.gantt-ms { position: absolute; top: 2px; width: 15px; height: 15px; background: var(--accent);
  transform: translateX(50%) rotate(45deg); border-radius: 3px; }
.gantt-ms.done { background: var(--good); }
.gantt-today { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--crit); opacity: .5; z-index: 2; }
@media (max-width: 640px) {
  .gantt-label { width: 90px; font-size: 11px; }
  .gantt-scale { padding-inline-start: 98px; }
  .gantt-today { display: none; }
}
