/* ADATASK_CRM_V2 — سیستم طراحی و پوستهٔ CRM نسخهٔ دو.
   همهٔ قواعد فقط زیر .crm2 هستند. رنگ‌ها هم‌خانوادهٔ داشبورد V11 (Editorial).
   مرجع: docs/crm-v2/README_FA.md */

.crm2{
  --c2-bg:#f6f4f0;--c2-card:#fffdfa;--c2-soft:#faf8f4;--c2-well:#f3f0eb;
  --c2-line:#e7e1da;--c2-line2:#efeae4;
  --c2-ink:#2d2a26;--c2-ink2:#57524c;--c2-mute:#80786f;--c2-faint:#a19a92;
  --c2-accent:#0b737d;--c2-accent-ink:#095d65;--c2-accent-soft:#eaf4f3;--c2-accent-line:#c7e2e0;
  --c2-t1:#0b737d;--c2-t2:#2a8a92;--c2-t3:#4fa3a9;--c2-t4:#7dbdc0;--c2-t5:#a9d4d4;--c2-t6:#d2e9e8;
  --c2-sand:#c08a1e;--c2-sand-soft:#fbf3df;
  --c2-ok:#2f6f4e;--c2-ok-soft:#e8f3ec;--c2-warn:#8f5f00;--c2-warn-soft:#fbf3d5;--c2-bad:#b42318;--c2-bad-soft:#fbeceb;
  --c2-shadow:0 1px 2px rgba(58,50,43,.04),0 6px 18px rgba(58,50,43,.045);
  --c2-shadow-pop:0 18px 40px rgba(45,42,38,.14),0 2px 6px rgba(45,42,38,.06);
  --c2-r:14px;--c2-r-sm:10px;
  font-family:Vazirmatn,Tahoma,sans-serif;color:var(--c2-ink);background:var(--c2-bg);
  direction:rtl;text-align:right;font-size:13px;line-height:1.75;
  border-radius:18px;padding:14px;min-height:calc(100vh - 32px);box-sizing:border-box;
  font-feature-settings:"ss01";-webkit-font-smoothing:antialiased
}
html[data-theme="dark"] .crm2{
  --c2-bg:#141616;--c2-card:#1c1d1d;--c2-soft:#202121;--c2-well:#262727;
  --c2-line:#323333;--c2-line2:#282929;
  --c2-ink:#ece9e4;--c2-ink2:#c7c0b8;--c2-mute:#9f9890;--c2-faint:#7d7770;
  --c2-accent:#3fa7b1;--c2-accent-ink:#5cbcc5;--c2-accent-soft:#16343a;--c2-accent-line:#25525a;
  --c2-t1:#3fa7b1;--c2-t2:#3592a0;--c2-t3:#2d7c88;--c2-t4:#26666f;--c2-t5:#205159;--c2-t6:#1a3d42;
  --c2-sand:#e0b45a;--c2-sand-soft:#2f2717;
  --c2-ok:#6cc08f;--c2-ok-soft:#183025;--c2-warn:#e0b45a;--c2-warn-soft:#2f2717;--c2-bad:#f07167;--c2-bad-soft:#3a1d1b;
  --c2-shadow:0 1px 2px rgba(0,0,0,.3);--c2-shadow-pop:0 18px 40px rgba(0,0,0,.45)
}
.crm2 *,.crm2 *::before,.crm2 *::after{box-sizing:border-box}
.crm2 button,.crm2 input,.crm2 select,.crm2 textarea{font:inherit;color:inherit}
.crm2 button{cursor:pointer}
.crm2 :focus-visible{outline:2px solid var(--c2-accent);outline-offset:2px;border-radius:8px}
.crm2 .num{font-variant-numeric:tabular-nums;font-feature-settings:"tnum"}
.crm2 .muted{color:var(--c2-mute)}
.crm2 .faint{color:var(--c2-faint)}
.crm2 .sr{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}

/* ---------- سرتیتر ---------- */
.crm2-head{display:flex;align-items:center;gap:14px;flex-wrap:wrap;padding:4px 4px 12px}
.crm2-title{display:flex;align-items:center;gap:12px;min-width:0;flex:1 1 220px}
.crm2-mark{width:40px;height:40px;border-radius:12px;display:grid;place-items:center;flex:none;
  background:var(--c2-accent-soft);color:var(--c2-accent);border:1px solid var(--c2-accent-line)}
.crm2-title h1{margin:0;font-size:17px;font-weight:800;letter-spacing:-.2px;line-height:1.4}
.crm2-title p{margin:0;font-size:11.5px;color:var(--c2-mute)}
.crm2-actions{display:flex;align-items:center;gap:8px;flex-wrap:wrap}

.crm2-search{position:relative;flex:0 1 360px;min-width:200px}
.crm2-search input{width:100%;height:40px;border-radius:12px;border:1px solid var(--c2-line);background:var(--c2-card);
  padding:0 38px 0 64px;outline:none;transition:border-color .15s,box-shadow .15s}
.crm2-search input:focus{border-color:var(--c2-accent);box-shadow:0 0 0 3px var(--c2-accent-soft)}
.crm2-search .crm2-search-ico{position:absolute;right:12px;top:50%;transform:translateY(-50%);color:var(--c2-faint);pointer-events:none;display:flex}
.crm2-search kbd{position:absolute;left:10px;top:50%;transform:translateY(-50%);font:inherit;font-size:10.5px;color:var(--c2-faint);
  border:1px solid var(--c2-line);border-radius:6px;padding:0 6px;background:var(--c2-soft);direction:ltr}
.crm2-pop{position:absolute;z-index:40;top:calc(100% + 6px);right:0;left:0;background:var(--c2-card);border:1px solid var(--c2-line);
  border-radius:var(--c2-r);box-shadow:var(--c2-shadow-pop);max-height:420px;overflow:auto;padding:6px}
.crm2-pop-group{font-size:11px;font-weight:700;color:var(--c2-mute);padding:8px 10px 4px}
.crm2-pop-item{display:flex;flex-direction:column;align-items:flex-start;gap:0;width:100%;border:0;background:none;text-align:right;
  padding:8px 10px;border-radius:10px}
.crm2-pop-item:hover,.crm2-pop-item:focus{background:var(--c2-accent-soft);outline:none}
.crm2-pop-item b{font-weight:700;font-size:12.5px}
.crm2-pop-item small{font-size:11px;color:var(--c2-mute)}
.crm2-pop-msg{padding:14px;color:var(--c2-mute);text-align:center}

/* ---------- دکمه‌ها و کنترل‌ها ---------- */
.crm2-btn{display:inline-flex;align-items:center;justify-content:center;gap:6px;height:38px;padding:0 14px;border-radius:11px;
  border:1px solid var(--c2-line);background:var(--c2-card);color:var(--c2-ink);font-weight:600;font-size:12.5px;white-space:nowrap;
  transition:background .15s,border-color .15s,color .15s}
.crm2-btn:hover{border-color:var(--c2-accent-line);background:var(--c2-soft)}
.crm2-btn.is-primary{background:var(--c2-accent);border-color:var(--c2-accent);color:#fff}
.crm2-btn.is-primary:hover{background:var(--c2-accent-ink)}
.crm2-btn.is-ghost{background:transparent;border-color:transparent;color:var(--c2-ink2)}
.crm2-btn.is-ghost:hover{background:var(--c2-well)}
.crm2-btn.is-sm{height:32px;padding:0 10px;font-size:12px;border-radius:9px}
.crm2-btn[disabled]{opacity:.5;cursor:not-allowed}
.crm2-icon-btn{width:38px;padding:0}
.crm2-select{height:34px;border-radius:10px;border:1px solid var(--c2-line);background:var(--c2-card);padding:0 10px 0 28px;font-size:12px;
  appearance:none;-webkit-appearance:none;cursor:pointer;
  background-image:linear-gradient(45deg,transparent 50%,var(--c2-mute) 50%),linear-gradient(135deg,var(--c2-mute) 50%,transparent 50%);
  background-position:12px 15px,16px 15px;background-size:4px 4px,4px 4px;background-repeat:no-repeat}
.crm2-select:focus{outline:none;border-color:var(--c2-accent)}
.crm2-seg{display:inline-flex;background:var(--c2-well);border-radius:10px;padding:3px;gap:2px}
.crm2-seg button{border:0;background:transparent;border-radius:8px;padding:3px 10px;font-size:11.5px;color:var(--c2-ink2);min-height:28px}
.crm2-seg button.is-on{background:var(--c2-card);color:var(--c2-accent-ink);font-weight:700;box-shadow:var(--c2-shadow)}

.crm2-menu{position:absolute;z-index:45;top:calc(100% + 6px);left:0;min-width:220px;background:var(--c2-card);border:1px solid var(--c2-line);
  border-radius:var(--c2-r);box-shadow:var(--c2-shadow-pop);padding:6px}
.crm2-menu button{display:flex;align-items:center;gap:10px;width:100%;border:0;background:none;border-radius:9px;padding:9px 10px;text-align:right;font-size:12.5px}
.crm2-menu button:hover,.crm2-menu button:focus{background:var(--c2-accent-soft);outline:none}
.crm2-menu button small{display:block;color:var(--c2-mute);font-size:10.5px}
.crm2-menu-ico{width:30px;height:30px;border-radius:9px;display:grid;place-items:center;background:var(--c2-well);color:var(--c2-accent);flex:none}
.crm2-rel{position:relative}

/* ---------- ناوبری ---------- */
.crm2-nav{display:flex;gap:2px;border-bottom:1px solid var(--c2-line);margin:0 0 14px;overflow-x:auto;scrollbar-width:none;
  -webkit-overflow-scrolling:touch}
.crm2-nav::-webkit-scrollbar{display:none}
.crm2-nav-item{position:relative;display:inline-flex;align-items:center;gap:7px;border:0;background:none;padding:10px 12px 12px;
  color:var(--c2-ink2);font-weight:600;font-size:13px;white-space:nowrap;border-radius:10px 10px 0 0;min-height:44px}
.crm2-nav-item svg{opacity:.75}
.crm2-nav-item:hover{color:var(--c2-ink);background:var(--c2-soft)}
.crm2-nav-item.is-active{color:var(--c2-accent-ink);font-weight:800}
.crm2-nav-item.is-active svg{opacity:1}
.crm2-nav-item.is-active::after{content:"";position:absolute;right:10px;left:10px;bottom:-1px;height:3px;border-radius:3px 3px 0 0;background:var(--c2-accent)}
.crm2-nav-count{font-size:10.5px;font-weight:700;background:var(--c2-well);color:var(--c2-mute);border-radius:999px;padding:0 7px;line-height:18px}
.crm2-nav-item.is-active .crm2-nav-count{background:var(--c2-accent-soft);color:var(--c2-accent-ink)}
.crm2-sub{display:flex;gap:6px;flex-wrap:wrap;margin:-4px 0 14px}
.crm2-chip{display:inline-flex;align-items:center;gap:6px;height:32px;border-radius:999px;border:1px solid var(--c2-line);background:var(--c2-card);
  padding:0 12px;font-size:12px;color:var(--c2-ink2);font-weight:600}
.crm2-chip:hover{border-color:var(--c2-accent-line)}
.crm2-chip.is-on{background:var(--c2-accent);border-color:var(--c2-accent);color:#fff}
.crm2-chip[disabled]{opacity:.45;cursor:not-allowed}

/* ---------- کارت و شبکه ---------- */
.crm2-grid{display:grid;grid-template-columns:repeat(12,minmax(0,1fr));gap:14px}
.crm2-span-3{grid-column:span 3}.crm2-span-4{grid-column:span 4}.crm2-span-5{grid-column:span 5}.crm2-span-6{grid-column:span 6}
.crm2-span-7{grid-column:span 7}.crm2-span-8{grid-column:span 8}.crm2-span-12{grid-column:span 12}
.crm2-card{background:var(--c2-card);border:1px solid var(--c2-line);border-radius:var(--c2-r);box-shadow:var(--c2-shadow);min-width:0;display:flex;flex-direction:column}
.crm2-card-head{display:flex;align-items:flex-start;justify-content:space-between;gap:10px;padding:14px 16px 6px;flex-wrap:wrap}
.crm2-card-head h3{margin:0;font-size:13.5px;font-weight:800;line-height:1.5}
.crm2-card-head p{margin:2px 0 0;font-size:11px;color:var(--c2-mute)}
.crm2-card-tools{display:flex;align-items:center;gap:6px;flex-wrap:wrap}
.crm2-card-body{padding:8px 16px 16px;flex:1;min-width:0}
.crm2-card-foot{border-top:1px solid var(--c2-line2);padding:10px 16px;font-size:11.5px;color:var(--c2-mute);display:flex;gap:10px;flex-wrap:wrap;justify-content:space-between}

/* ---------- فیلتر داشبورد ---------- */
.crm2-filters{display:flex;align-items:center;gap:8px;flex-wrap:wrap;margin:0 0 14px}
.crm2-filters .crm2-filters-label{font-size:11.5px;color:var(--c2-mute);margin-left:2px}
.crm2-filters .crm2-spacer{flex:1}
.crm2-stamp{font-size:11px;color:var(--c2-faint)}

/* ---------- شاخص‌ها ---------- */
.crm2-kpis{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:14px;margin-bottom:14px}
.crm2-kpi{position:relative;background:var(--c2-card);border:1px solid var(--c2-line);border-radius:var(--c2-r);box-shadow:var(--c2-shadow);
  padding:14px 16px 12px;display:flex;flex-direction:column;gap:4px;min-width:0;text-align:right}
.crm2 button.crm2-kpi{cursor:pointer;transition:border-color .15s,transform .15s}
.crm2 button.crm2-kpi:hover{border-color:var(--c2-accent-line);transform:translateY(-1px)}
.crm2-kpi-top{display:flex;align-items:center;justify-content:space-between;gap:8px}
.crm2-kpi-label{font-size:12px;color:var(--c2-ink2);font-weight:600}
.crm2-kpi-ico{width:30px;height:30px;border-radius:9px;display:grid;place-items:center;background:var(--c2-accent-soft);color:var(--c2-accent)}
.crm2-kpi-value{font-size:22px;font-weight:800;letter-spacing:-.3px;line-height:1.35;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.crm2-kpi-value small{font-size:12px;font-weight:600;color:var(--c2-mute);margin-right:4px}
.crm2-kpi-meta{font-size:11.5px;color:var(--c2-mute);display:flex;gap:8px;flex-wrap:wrap;align-items:center}
.crm2-delta{display:inline-flex;align-items:center;gap:2px;font-weight:700;border-radius:999px;padding:0 7px;font-size:11px;line-height:19px}
.crm2-delta.is-up{background:var(--c2-ok-soft);color:var(--c2-ok)}
.crm2-delta.is-down{background:var(--c2-bad-soft);color:var(--c2-bad)}
.crm2-delta.is-flat{background:var(--c2-well);color:var(--c2-mute)}
.crm2-spark{height:28px;width:100%;margin-top:2px}

.crm2-flow{display:grid;grid-template-columns:repeat(5,minmax(0,1fr));gap:0;border:1px solid var(--c2-line);border-radius:var(--c2-r);
  background:var(--c2-card);box-shadow:var(--c2-shadow);margin-bottom:14px;overflow:hidden}
.crm2-flow-step{padding:12px 14px;border-left:1px solid var(--c2-line2);min-width:0}
.crm2-flow-step:last-child{border-left:0}
.crm2-flow-step span{display:block;font-size:11.5px;color:var(--c2-mute)}
.crm2-flow-step b{font-size:18px;font-weight:800}
.crm2-flow-step.is-accent{background:var(--c2-accent-soft)}
.crm2-flow-step.is-accent b{color:var(--c2-accent-ink)}

/* ---------- کیفیت داده ---------- */
.crm2-note{display:flex;align-items:flex-start;gap:12px;border:1px solid var(--c2-warn-soft);background:var(--c2-warn-soft);color:var(--c2-ink);
  border-radius:var(--c2-r);padding:12px 14px;margin-bottom:14px}
.crm2-note-ico{color:var(--c2-warn);flex:none;margin-top:2px}
.crm2-note b{font-weight:800}
.crm2-note ul{margin:4px 0 0;padding:0 18px 0 0;font-size:12px}
.crm2-note .crm2-actions{margin-top:8px}

/* ---------- نردبان مراحل (قیف) ---------- */
.crm2-ladder{display:flex;flex-direction:column;gap:6px}
.crm2-ladder-row{display:grid;grid-template-columns:minmax(110px,180px) minmax(0,1fr) 92px;align-items:center;gap:10px;min-height:34px}
.crm2-ladder-name{font-size:12px;font-weight:600;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.crm2-ladder-name small{display:block;font-weight:400;color:var(--c2-mute);font-size:10.5px}
.crm2-ladder-track{height:22px;background:var(--c2-well);border-radius:7px;overflow:hidden;position:relative}
.crm2-ladder-bar{height:100%;border-radius:7px;background:var(--c2-accent);min-width:3px;transition:width .35s ease}
.crm2-ladder-val{font-size:12px;font-weight:700;text-align:left;white-space:nowrap}
.crm2-ladder-val small{display:block;font-weight:500;font-size:10.5px;color:var(--c2-mute)}
.crm2-ladder-drop{font-size:10.5px;color:var(--c2-bad);font-weight:600}
.crm2-ladder-row.is-won .crm2-ladder-bar{background:var(--c2-ok)}
.crm2-more{border:0;background:none;color:var(--c2-accent-ink);font-weight:700;font-size:12px;padding:6px 0}

/* ---------- نوارهای افقی ساده ---------- */
.crm2-bars{display:flex;flex-direction:column;gap:9px}
.crm2-bar-row{display:grid;grid-template-columns:minmax(90px,150px) minmax(0,1fr) auto;gap:10px;align-items:center}
.crm2-bar-row .crm2-bar-label{font-size:12px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.crm2-bar-track{height:10px;background:var(--c2-well);border-radius:999px;overflow:hidden;display:flex}
.crm2-bar-fill{height:100%;background:var(--c2-accent);border-radius:999px;min-width:2px}
.crm2-bar-fill.is-sand{background:var(--c2-sand)}
.crm2-bar-fill.is-bad{background:var(--c2-bad)}
.crm2-bar-fill.is-muted{background:var(--c2-t5)}
.crm2-bar-num{font-size:12px;font-weight:700;white-space:nowrap}
.crm2-stack{display:flex;height:10px;border-radius:999px;overflow:hidden;background:var(--c2-well)}
.crm2-stack span{height:100%}
.crm2-legend{display:flex;gap:12px;flex-wrap:wrap;font-size:11px;color:var(--c2-mute);margin-top:10px}
.crm2-legend i{display:inline-block;width:9px;height:9px;border-radius:3px;margin-left:5px;vertical-align:-1px}

/* ---------- نمودار خطی ---------- */
.crm2-chart{width:100%;height:auto;display:block;overflow:visible}
.crm2-chart .ax{stroke:var(--c2-line2);stroke-width:1}
.crm2-chart .ax-lbl{fill:var(--c2-faint);font-size:10px}
.crm2-chart .ln{fill:none;stroke:var(--c2-accent);stroke-width:2.2;stroke-linejoin:round;stroke-linecap:round}
.crm2-chart .ln-prior{fill:none;stroke:var(--c2-faint);stroke-width:1.5;stroke-dasharray:4 4}
.crm2-chart .ln-fc{fill:none;stroke:var(--c2-sand);stroke-width:2;stroke-dasharray:5 4}
.crm2-chart .area{fill:var(--c2-accent);opacity:.09}
.crm2-chart .dot{fill:var(--c2-card);stroke:var(--c2-accent);stroke-width:2}
.crm2-chart .dot-fc{fill:var(--c2-card);stroke:var(--c2-sand);stroke-width:2}
.crm2-chart .bar{fill:var(--c2-t4)}
.crm2-chart .bar-fc{fill:var(--c2-sand);opacity:.55}
.crm2-chart .tgt{stroke:var(--c2-bad);stroke-width:1.2;stroke-dasharray:3 3}
.crm2-chart-sum{display:flex;gap:20px;flex-wrap:wrap;margin-bottom:6px}
.crm2-chart-sum div{font-size:11px;color:var(--c2-mute)}
.crm2-chart-sum b{display:block;font-size:16px;color:var(--c2-ink);font-weight:800}

/* ---------- حلقهٔ نرخ ---------- */
.crm2-ring-wrap{display:flex;align-items:center;gap:18px;flex-wrap:wrap}
.crm2-ring{width:124px;height:124px;flex:none}
.crm2-ring .bg{stroke:var(--c2-well)}
.crm2-ring .fg{stroke:var(--c2-accent);transition:stroke-dasharray .4s ease}
.crm2-ring text{fill:var(--c2-ink);font-weight:800;font-size:20px}
.crm2-ring .sub{fill:var(--c2-mute);font-size:10px;font-weight:500}
.crm2-ring-stats{display:grid;gap:8px;flex:1;min-width:140px}
.crm2-ring-stats div{display:flex;justify-content:space-between;gap:10px;font-size:12px;border-bottom:1px dashed var(--c2-line2);padding-bottom:6px}
.crm2-ring-stats b{font-weight:800}

/* ---------- فهرست‌ها ---------- */
.crm2-list{display:flex;flex-direction:column}
.crm2-row{display:flex;align-items:center;gap:10px;padding:9px 0;border-bottom:1px solid var(--c2-line2);min-width:0;
  background:none;border-right:0;border-left:0;border-top:0;width:100%;text-align:right}
.crm2-row:last-child{border-bottom:0}
.crm2 button.crm2-row:hover{background:var(--c2-soft)}
.crm2-row-main{flex:1;min-width:0}
.crm2-row-main b{display:block;font-size:12.5px;font-weight:700;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.crm2-row-main small{display:block;font-size:11px;color:var(--c2-mute);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.crm2-row-side{font-size:11.5px;color:var(--c2-mute);white-space:nowrap;text-align:left}
.crm2-avatar{width:32px;height:32px;border-radius:10px;display:grid;place-items:center;background:var(--c2-accent-soft);color:var(--c2-accent-ink);
  font-weight:800;font-size:12px;flex:none}
.crm2-rank{width:22px;text-align:center;font-weight:800;color:var(--c2-faint);flex:none}
.crm2-rank.is-1{color:var(--c2-sand)}
.crm2-pill{display:inline-flex;align-items:center;border-radius:999px;padding:0 8px;font-size:10.5px;font-weight:700;line-height:20px;white-space:nowrap}
.crm2-pill.is-bad{background:var(--c2-bad-soft);color:var(--c2-bad)}
.crm2-pill.is-warn{background:var(--c2-warn-soft);color:var(--c2-warn)}
.crm2-pill.is-ok{background:var(--c2-ok-soft);color:var(--c2-ok)}
.crm2-pill.is-info{background:var(--c2-accent-soft);color:var(--c2-accent-ink)}
.crm2-progress{height:8px;border-radius:999px;background:var(--c2-well);overflow:hidden;margin-top:6px}
.crm2-progress span{display:block;height:100%;border-radius:999px;background:var(--c2-accent)}
.crm2-progress.is-done span{background:var(--c2-ok)}

/* ---------- حالت‌ها ---------- */
.crm2-empty{padding:26px 10px;text-align:center;color:var(--c2-mute);font-size:12px}
.crm2-empty b{display:block;color:var(--c2-ink2);font-size:13px;margin-bottom:2px}
.crm2-error{border:1px solid var(--c2-bad-soft);background:var(--c2-bad-soft);color:var(--c2-bad);border-radius:var(--c2-r);padding:12px 14px;margin-bottom:14px;
  display:flex;gap:10px;align-items:center;justify-content:space-between;flex-wrap:wrap}
.crm2-skel{border-radius:10px;background:linear-gradient(90deg,var(--c2-well),var(--c2-soft),var(--c2-well));background-size:200% 100%;animation:crm2-skel 1.2s linear infinite}
@keyframes crm2-skel{to{background-position:-200% 0}}
.crm2-locked{padding:24px;text-align:center;color:var(--c2-mute)}

/* ---------- میزبان بخش‌های قدیمی ---------- */
.crm2-legacy{min-width:0}
.crm2-legacy .adatask-shell-v2{background:transparent}
/* هماهنگ‌سازی رنگ صفحه‌های قدیمی با پالت داشبورد، تا وقتی هر بخش در V2 بازنویسی شود.
   متغیرها روی ریشهٔ همان کامپوننت‌ها تعریف شده‌اند، پس انتخابگر یک سطح دقیق‌تر است. */
.crm2-legacy .adatask-v3{--v3-navy:var(--c2-accent-ink);--v3-navy-soft:var(--c2-accent);--v3-navy-deep:#073f45;--v3-text:var(--c2-ink);
  --v3-muted:var(--c2-mute);--v3-purple:var(--c2-accent);--v3-teal:var(--c2-accent);--v3-turquoise:var(--c2-t4);--v3-light-blue:var(--c2-t5);
  --v3-surface:var(--c2-card);--v3-surface-alt:var(--c2-soft)}
.crm2-legacy .crm-leadref,.crm2-legacy .crm-claude-dashboard{--navy:var(--c2-accent-ink);--purple:var(--c2-accent);--purple-dark:var(--c2-accent-ink);
  --purple-tint:var(--c2-accent-soft);--turquoise:var(--c2-t4);--turquoise-dark:var(--c2-accent);--turquoise-tint:var(--c2-accent-soft);
  --pale-blue:var(--c2-soft);--text:var(--c2-ink);--text-soft:var(--c2-ink2);--text-faint:var(--c2-faint)}
.crm2-legacy .crm-sales-desk{--crm-dash-text:var(--c2-ink);--crm-dash-purple:var(--c2-accent);--crm-dash-purple-soft:var(--c2-accent-soft);
  --crm-dash-info:var(--c2-accent);--crm-dash-info-soft:var(--c2-accent-soft);--crm-dash-teal:var(--c2-accent);--crm-dash-teal-soft:var(--c2-accent-soft);
  --sd-ink:var(--c2-ink);--sd-muted:var(--c2-mute);--sd-border:var(--c2-line)}
.crm2-legacy .av2-host-crm .crm-r2 .v3-btn-primary,.crm2-legacy .av2-host-crm .v3-btn-primary{background:var(--c2-accent);border-color:var(--c2-accent);color:#fff}
.crm2-legacy .av2-host-crm .crm-r2 .v3-btn-primary:hover,.crm2-legacy .av2-host-crm .v3-btn-primary:hover{background:var(--c2-accent-ink);border-color:var(--c2-accent-ink)}
.crm2-legacy .adatask-v3 .v3-page-title{color:var(--c2-ink)}
.crm2-back-bar{display:flex;align-items:center;justify-content:space-between;gap:10px;background:var(--c2-accent-soft);color:var(--c2-accent-ink);
  border:1px solid var(--c2-accent-line);border-radius:12px;padding:8px 12px;margin:0 0 10px;font-size:12px;font-weight:600;flex-wrap:wrap}
.crm2-foot{display:flex;justify-content:space-between;gap:10px;flex-wrap:wrap;margin-top:16px;font-size:11px;color:var(--c2-faint)}
.crm2-linkbtn{border:0;background:none;padding:0;color:var(--c2-accent-ink);font-weight:700;font-size:11.5px;text-decoration:underline;text-underline-offset:3px}

/* ---------- فرم ---------- */
.crm2-input,.crm2 .crm2-field select,.crm2 .crm2-field textarea{width:100%;height:40px;border-radius:10px;border:1px solid var(--c2-line);background:var(--c2-card);
  padding:0 12px;outline:none;transition:border-color .15s,box-shadow .15s}
.crm2 textarea.crm2-input,.crm2 .crm2-field textarea{height:auto;min-height:84px;padding:10px 12px;resize:vertical;line-height:1.7}
.crm2-input:focus,.crm2 .crm2-field select:focus,.crm2 .crm2-field textarea:focus{border-color:var(--c2-accent);box-shadow:0 0 0 3px var(--c2-accent-soft)}
.crm2-field{display:grid;gap:5px;margin-bottom:12px;font-size:12px;font-weight:600;min-width:0}
.crm2-field small{font-weight:400;color:var(--c2-mute)}
.crm2-fields{display:grid;grid-template-columns:repeat(auto-fit,minmax(190px,1fr));gap:0 12px}
.crm2-date .crm-date-field{width:100%}
.crm2-date .crm-date-trigger{width:100%;min-height:40px;border-radius:10px;border:1px solid var(--c2-line);background:var(--c2-card);text-align:right;padding:0 12px}
.crm2-form-error{border-radius:10px;background:var(--c2-bad-soft);color:var(--c2-bad);padding:9px 12px;font-size:12px;margin-bottom:12px}

/* ---------- پنل کناری ---------- */
.crm2.crm2-drawer-wrap{position:fixed;inset:0;z-index:1150;background:rgba(30,26,22,.36);padding:0;min-height:0;border-radius:0;display:flex;justify-content:flex-end}
.crm2-drawer{width:min(560px,100vw);height:100%;background:var(--c2-card);box-shadow:var(--c2-shadow-pop);display:flex;flex-direction:column;
  border-radius:0 18px 18px 0;margin:0;animation:crm2-drawer-in .2s ease-out}
@keyframes crm2-drawer-in{from{transform:translateX(-24px);opacity:.4}to{transform:none;opacity:1}}
.crm2-drawer-head{display:flex;align-items:flex-start;justify-content:space-between;gap:12px;padding:18px 20px 10px;border-bottom:1px solid var(--c2-line2)}
.crm2-drawer-head h2{margin:2px 0 0;font-size:16px;font-weight:800;line-height:1.5;overflow-wrap:anywhere}
.crm2-drawer-head p{margin:2px 0 0;font-size:12px;color:var(--c2-mute)}
.crm2-drawer-kicker{font-size:11px;font-weight:700;color:var(--c2-accent-ink)}
.crm2-drawer-actions{display:flex;gap:8px;flex-wrap:wrap;padding:12px 20px;border-bottom:1px solid var(--c2-line2);background:var(--c2-soft)}
.crm2-drawer-body{padding:16px 20px 24px;overflow:auto;flex:1}
.crm2-section-title{font-size:12px;font-weight:800;color:var(--c2-ink2);margin:18px 0 8px;display:flex;align-items:center;gap:8px}
.crm2-section-title::after{content:"";flex:1;height:1px;background:var(--c2-line2)}
.crm2-kv{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}
.crm2-kv div{background:var(--c2-soft);border:1px solid var(--c2-line2);border-radius:10px;padding:8px 10px;min-width:0}
.crm2-kv span{display:block;font-size:11px;color:var(--c2-mute)}
.crm2-kv b{display:block;font-size:13px;font-weight:700;overflow-wrap:anywhere}
.crm2-steps{display:flex;gap:4px;flex-wrap:wrap}
.crm2-step{border:1px solid var(--c2-line);background:var(--c2-card);border-radius:999px;padding:3px 10px;font-size:11.5px;color:var(--c2-ink2);min-height:30px}
.crm2-step.is-past{background:var(--c2-accent-soft);border-color:var(--c2-accent-line);color:var(--c2-accent-ink)}
.crm2-step.is-current{background:var(--c2-accent);border-color:var(--c2-accent);color:#fff;font-weight:700}
.crm2-step.is-won{border-color:var(--c2-ok)}.crm2-step.is-lost{border-color:var(--c2-bad)}

/* ---------- نوار ابزار بخش ---------- */
.crm2-toolbar{display:flex;align-items:center;gap:8px;flex-wrap:wrap;margin:0 0 12px}
.crm2-toolbar .crm2-input{height:36px;width:220px;max-width:100%}
.crm2-toolbar .crm2-spacer{flex:1}

/* ---------- کانبان ---------- */
.crm2-board{display:flex;gap:12px;overflow-x:auto;padding:2px 2px 14px;scroll-snap-type:x proximity;-webkit-overflow-scrolling:touch;align-items:flex-start}
.crm2-col{flex:0 0 280px;max-width:280px;background:var(--c2-well);border:1px solid var(--c2-line2);border-radius:var(--c2-r);display:flex;flex-direction:column;
  max-height:calc(100vh - 290px);min-height:200px;scroll-snap-align:start;transition:background .15s,border-color .15s}
.crm2-col.is-over{background:var(--c2-accent-soft);border-color:var(--c2-accent)}
.crm2-col.is-won .crm2-col-head{border-top:3px solid var(--c2-ok)}
.crm2-col.is-lost .crm2-col-head{border-top:3px solid var(--c2-bad)}
.crm2-col-head{padding:10px 12px 8px;border-radius:var(--c2-r) var(--c2-r) 0 0;border-top:3px solid var(--c2-accent)}
.crm2-col-head b{display:flex;justify-content:space-between;gap:8px;font-size:12.5px;font-weight:800}
.crm2-col-head small{display:block;font-size:11px;color:var(--c2-mute)}
.crm2-col-body{padding:4px 8px 8px;overflow-y:auto;display:flex;flex-direction:column;gap:8px;flex:1}
.crm2-deal{position:relative;background:var(--c2-card);border:1px solid var(--c2-line);border-radius:12px;padding:10px 11px;box-shadow:var(--c2-shadow);
  cursor:pointer;text-align:right;width:100%;display:block;transition:border-color .15s,transform .15s,opacity .15s}
.crm2-deal:hover{border-color:var(--c2-accent-line)}
.crm2-deal[draggable="true"]{cursor:grab}
.crm2-deal.is-dragging{opacity:.45}
.crm2-deal.is-pending{opacity:.6}
.crm2-deal-title{font-size:12.5px;font-weight:700;line-height:1.55;margin:0 0 2px;padding-left:30px;overflow-wrap:anywhere}
.crm2-deal-sub{font-size:11px;color:var(--c2-mute);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.crm2-deal-foot{display:flex;align-items:center;justify-content:space-between;gap:6px;margin-top:8px;font-size:11px}
.crm2-deal-amount{font-weight:800;font-size:12.5px}
.crm2-deal-amount.is-empty{font-weight:500;color:var(--c2-faint)}
.crm2-deal-menu{position:absolute;left:6px;top:6px}
.crm2-deal-menu > button{width:28px;height:28px;border-radius:8px;border:0;background:transparent;color:var(--c2-mute);display:grid;place-items:center}
.crm2-deal-menu > button:hover{background:var(--c2-well)}
.crm2-deal-menu > button:disabled{opacity:.4;cursor:default}
.crm2 button.crm2-row:disabled{opacity:.62;cursor:default;background:none}
.crm2-mini-av{width:24px;height:24px;border-radius:8px;display:inline-grid;place-items:center;background:var(--c2-accent-soft);color:var(--c2-accent-ink);font-size:10.5px;font-weight:800}

/* ---------- جدول (در موبایل کارت) ---------- */
.crm2-table-wrap{background:var(--c2-card);border:1px solid var(--c2-line);border-radius:var(--c2-r);box-shadow:var(--c2-shadow);overflow:hidden}
.crm2-table{width:100%;border-collapse:collapse;font-size:12.5px}
.crm2-table th{background:var(--c2-soft);color:var(--c2-mute);font-weight:700;font-size:11.5px;text-align:right;padding:10px 12px;border-bottom:1px solid var(--c2-line);white-space:nowrap}
.crm2-table td{padding:10px 12px;border-bottom:1px solid var(--c2-line2);vertical-align:middle}
.crm2-table tr:last-child td{border-bottom:0}
.crm2-table tbody tr{cursor:pointer}
.crm2-table tbody tr:hover td{background:var(--c2-soft)}
.crm2-table td b{font-weight:700}
.crm2-pager{display:flex;align-items:center;justify-content:space-between;gap:10px;padding:10px 12px;border-top:1px solid var(--c2-line2);font-size:12px;color:var(--c2-mute);flex-wrap:wrap}

/* ---------- صف پیگیری ---------- */
.crm2-queue{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:14px;align-items:start}
.crm2-task{display:flex;gap:10px;align-items:flex-start;padding:10px 0;border-bottom:1px solid var(--c2-line2)}
.crm2-task:last-child{border-bottom:0}
.crm2-task-main{flex:1;min-width:0}
.crm2-task-main b{display:block;font-size:12.5px;font-weight:700;overflow-wrap:anywhere}
.crm2-task-main small{display:block;font-size:11px;color:var(--c2-mute)}
.crm2-task-actions{display:flex;gap:4px;flex-wrap:wrap;margin-top:6px}
.crm2-check{width:30px;height:30px;border-radius:9px;border:1.5px solid var(--c2-line);background:var(--c2-card);color:var(--c2-ok);display:grid;place-items:center;flex:none}
.crm2-check:hover{border-color:var(--c2-ok);background:var(--c2-ok-soft)}

/* ---------- دکمهٔ شناور موبایل ---------- */
.crm2-fab{display:none}

/* ---------- ریسپانسیو ---------- */
/* ---- سرنخ‌ها (فاز ۳): عملیات گروهی، ستون انتخاب، دکمهٔ خطر */
.crm2-kpi-value.is-bad{color:var(--c2-bad)}
.crm2-btn.is-danger{color:var(--c2-bad);border-color:var(--c2-bad-soft)}
.crm2-btn.is-danger:hover{background:var(--c2-bad-soft)}
.crm2-bulk{position:sticky;top:8px;z-index:20;display:flex;flex-wrap:wrap;align-items:center;gap:8px;padding:10px 12px;margin:0 0 12px;
  background:var(--c2-accent-soft);border:1px solid var(--c2-accent-line);border-radius:var(--c2-r);box-shadow:var(--c2-shadow)}
.crm2-bulk b{font-size:12.5px;margin-left:auto}
.crm2-td-check{width:40px;text-align:center}
.crm2-td-check input{width:18px;height:18px;accent-color:var(--c2-accent);cursor:pointer}

@media (max-width:1280px){
  .crm2-span-7,.crm2-span-5{grid-column:span 6}
}
@media (max-width:1024px){
  .crm2{padding:10px;border-radius:14px}
  .crm2-kpis{grid-template-columns:repeat(2,minmax(0,1fr))}
  .crm2-span-3,.crm2-span-4,.crm2-span-5,.crm2-span-6,.crm2-span-7,.crm2-span-8{grid-column:span 12}
  .crm2-flow{grid-template-columns:repeat(3,minmax(0,1fr))}
  .crm2-flow-step:nth-child(3){border-left:0}
  .crm2-flow-step:nth-child(n+4){border-top:1px solid var(--c2-line2)}
  .crm2-search{flex:1 1 100%;order:3}
  .crm2-queue{grid-template-columns:minmax(0,1fr)}
  .crm2-col{max-height:none}
}
@media (max-width:600px){
  .crm2-search kbd{display:none}
  .crm2{padding:8px;font-size:12.5px}
  .crm2-head{gap:10px}
  .crm2-title h1{font-size:15px}
  .crm2-actions .crm2-hide-sm{display:none}
  .crm2-kpis{gap:10px}
  .crm2-kpi{padding:12px}
  .crm2-kpi-value{font-size:18px}
  .crm2-grid{gap:10px}
  .crm2-card-head{padding:12px 12px 4px}
  .crm2-card-body{padding:6px 12px 12px}
  .crm2-flow{grid-template-columns:repeat(2,minmax(0,1fr))}
  .crm2-flow-step:nth-child(2n){border-left:0}
  .crm2-flow-step:nth-child(3){border-left:1px solid var(--c2-line2)}
  .crm2-flow-step:nth-child(n+3){border-top:1px solid var(--c2-line2)}
  .crm2-ladder-row{grid-template-columns:minmax(0,1fr) 76px;grid-template-areas:"name val" "track track";row-gap:4px}
  .crm2-ladder-name{grid-area:name}.crm2-ladder-track{grid-area:track;height:12px}.crm2-ladder-val{grid-area:val}
  .crm2-bar-row{grid-template-columns:minmax(0,1fr) auto;grid-template-areas:"label num" "track track";row-gap:4px}
  .crm2-bar-row .crm2-bar-label{grid-area:label}.crm2-bar-row .crm2-bar-track{grid-area:track}.crm2-bar-row .crm2-bar-num{grid-area:num}
  .crm2-filters .crm2-spacer{display:none}
  .crm2-toolbar .crm2-input{width:100%}
  .crm2-toolbar .crm2-spacer{display:none}
  .crm2-col{flex-basis:84vw;max-width:84vw}
  .crm2-drawer{border-radius:0;width:100vw}
  .crm2-kv{grid-template-columns:minmax(0,1fr)}
  .crm2-table thead{display:none}
  .crm2-table,.crm2-table tbody,.crm2-table tr,.crm2-table td{display:block;width:100%}
  .crm2-table tr{padding:10px 12px;border-bottom:1px solid var(--c2-line2)}
  .crm2-table td{border:0;padding:2px 0;display:flex;justify-content:space-between;gap:10px}
  .crm2-table td::before{content:attr(data-label);color:var(--c2-mute);font-size:11px;flex:none}
  .crm2-table td:first-child{font-size:13px}
  .crm2-table td:first-child::before{display:none}
  .crm2-fab{display:inline-flex;position:fixed;left:16px;bottom:calc(16px + env(safe-area-inset-bottom));z-index:60;width:54px;height:54px;border-radius:18px;
    background:var(--c2-accent);color:#fff;border:0;box-shadow:var(--c2-shadow-pop);align-items:center;justify-content:center}
  .crm2-menu{position:fixed;left:12px;right:12px;bottom:84px;top:auto;min-width:0}
}
@media (prefers-reduced-motion:reduce){
  .crm2 *{transition:none!important;animation:none!important}
}
@media print{
  .crm2{background:#fff;padding:0}
  .crm2-head .crm2-actions,.crm2-nav,.crm2-filters,.crm2-fab{display:none}
}
