/* شاهین — سیستمِ طراحی (۲۰۲۶-۰۷). فونت/آیکنِ محلی از index.html. کلاس‌ها ثابت‌اند؛ فقط لایهٔ بصری. */

:root {
  /* سطوح + زمینه */
  --bg: #F3F5F8; --surface: #FFFFFF; --sunken: #EBEEF2;
  /* هویتِ نفتی — عمیق‌تر */
  --primary: #16455F; --primary-deep: #0F3446; --primary-soft: #E7EFF3; --ring: rgba(22,69,95,.15);
  --brass: #B0863A;
  /* خاکستریِ سردِ انتخاب‌شده (نه خام) */
  --ink: #16212C; --ink-2: #45566A; --ink-3: #798795; --ink-4: #A6B1BC;
  --line: #E4E9EE; --line-2: #D3DAE1;
  /* سمانتیک + نرم‌هایشان */
  --ok: #1F7A54; --ok-soft: #E4F1EB; --warn: #B06F1C; --warn-soft: #FAEEDA; --danger: #C13B36; --danger-soft: #F9E7E5;
  /* مقیاسِ فاصله (۴px) */
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 20px; --s6: 24px; --s7: 32px; --s8: 40px; --s9: 48px;
  /* مقیاسِ تایپ (پایه ۱۵) */
  --fs-xs: 12px; --fs-sm: 13px; --fs-base: 15px; --fs-md: 17px; --fs-lg: 20px; --fs-xl: 25px; --fs-2xl: 31px;
  /* شعاع */
  --r-sm: 8px; --r: 12px; --r-lg: 16px;
  /* ارتفاع — سه‌پله، سایهٔ نرمِ نفتی‌ته‌رنگ */
  --e1: 0 1px 2px rgba(23,34,46,.05), 0 1px 3px rgba(23,34,46,.045);
  --e2: 0 3px 10px rgba(23,34,46,.08), 0 1px 3px rgba(23,34,46,.05);
  --e3: 0 14px 38px rgba(23,34,46,.17);
  /* نام‌های قدیمی (برای استایل‌های inline در JS) → نگاشت به سیستمِ جدید */
  --text: var(--ink); --text-muted: var(--ink-2); --text-subtle: var(--ink-3);
  --border: var(--line); --primary-hover: var(--primary-deep);
  --success: var(--ok); --warning: var(--warn);
  --shadow-card: var(--e1); --shadow-pop: var(--e3);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: 'Vazirmatn', 'Segoe UI', Tahoma, system-ui, sans-serif;
  background: var(--bg); color: var(--ink); line-height: 1.75; font-size: var(--fs-base);
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
button { font-family: inherit; }
.tnum, .dash-stat-v, .dash-fin-v, .q-count, .prof-v, .lead-est { font-variant-numeric: tabular-nums; }

.layout { display: flex; min-height: 100vh; }

/* سایدبار */
.sidebar { width: 232px; flex-shrink: 0; background: var(--surface); border-inline-start: 1px solid var(--line); padding: var(--s6) var(--s4); }
.brand { font-size: var(--fs-xl); font-weight: 700; color: var(--primary); margin-bottom: var(--s6); padding-inline-start: 6px; letter-spacing: -.01em; display: flex; align-items: center; gap: var(--s2); }
.brand::before { content: ""; width: 8px; height: 22px; border-radius: 3px; background: linear-gradient(var(--primary), var(--brass)); flex-shrink: 0; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-item { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: var(--r-sm); color: var(--ink-2); cursor: pointer; font-size: var(--fs-sm); transition: background .16s, color .16s; }
.nav-item i { font-size: 18px; color: var(--ink-3); transition: color .16s; }
.nav-item:hover { background: var(--sunken); color: var(--ink); }
.nav-item.active { background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.nav-item.active i { color: var(--primary); }

.main { flex: 1; min-width: 0; padding: var(--s7); max-width: 1140px; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--s4); margin-bottom: var(--s7); }
.page-title { font-size: var(--fs-2xl); font-weight: 700; letter-spacing: -.015em; line-height: 1.25; }
.page-sub { font-size: var(--fs-sm); color: var(--ink-3); margin-top: var(--s1); }

/* دکمه‌ها — سلسله‌مراتبِ روشن */
.btn { height: 40px; padding: 0 var(--s5); border-radius: var(--r-sm); font-size: var(--fs-base); font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 7px; border: 1px solid transparent; transition: background .15s, border-color .15s, box-shadow .15s, filter .15s; }
.btn-primary { background: var(--primary); color: #fff; box-shadow: var(--e1); }
.btn-primary:hover { background: var(--primary-deep); }
.btn-secondary { background: var(--surface); color: var(--ink); border-color: var(--line-2); }
.btn-secondary:hover { background: var(--bg); border-color: var(--ink-4); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { filter: brightness(.93); }
.btn-soft { background: var(--surface); border: 1px solid var(--line-2); color: var(--ink); }
.btn-soft:hover { background: var(--bg); }
.btn-text { background: none; border: none; color: var(--primary); cursor: pointer; font-size: var(--fs-sm); font-weight: 500; padding: 7px 10px; border-radius: var(--r-sm); transition: background .15s; }
.btn-text:hover { background: var(--primary-soft); }
.btn-row { height: auto; padding: 7px 14px; font-size: var(--fs-sm); }

/* کارتِ واحد (فهرست) + ردیف */
.list { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--e1); overflow: hidden; }
.row { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); padding: var(--s4); min-height: 54px; border-bottom: 1px solid var(--line); transition: background .15s; }
.row:last-child { border-bottom: none; }
.row:hover { background: var(--bg); }
.row-info { display: flex; align-items: center; gap: var(--s3); min-width: 0; }
.row-ic { color: var(--ink-3); font-size: 20px; width: 24px; text-align: center; flex-shrink: 0; }
.row-title { font-size: var(--fs-base); font-weight: 600; }
.row-meta { font-size: var(--fs-sm); color: var(--ink-3); }
.row-actions { display: flex; align-items: center; gap: 4px; flex-shrink: 0; position: relative; }

/* نشان‌ها */
.badge { font-size: var(--fs-xs); font-weight: 600; padding: 4px 11px; border-radius: var(--r-full, 999px); white-space: nowrap; }
.badge-stage { background: var(--primary-soft); color: var(--primary); }
.badge-success { background: var(--ok-soft); color: var(--ok); }
.badge-warning { background: var(--warn-soft); color: var(--warn); }
.badge-danger { background: var(--danger-soft); color: var(--danger); }

/* منوی شناور */
.menu { position: absolute; top: 100%; left: 0; margin-top: var(--s2); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--e3); padding: 6px; min-width: 198px; z-index: 10; }
.menu-label { font-size: var(--fs-xs); color: var(--ink-4); padding: 6px 8px; font-weight: 500; }
.menu-item { display: block; width: 100%; text-align: right; background: none; border: none; padding: 9px 10px; border-radius: var(--r-sm); font-size: var(--fs-sm); color: var(--ink); cursor: pointer; transition: background .12s; }
.menu-item:hover { background: var(--sunken); }
.menu-divider { height: 1px; background: var(--line); margin: 6px 4px; }
.menu-item.danger { color: var(--danger); }
.menu-item.active-month { background: var(--primary-soft); color: var(--primary); font-weight: 600; }

.empty { padding: var(--s9) var(--s4); text-align: center; color: var(--ink-3); }

@media (max-width: 720px) {
  .layout { flex-direction: column; }
  .sidebar { width: auto; border-inline-start: none; border-bottom: 1px solid var(--line); }
  .main { padding: var(--s5); }
  .page-title { font-size: var(--fs-xl); }
}

/* فرم و مودال */
.field { margin-bottom: var(--s4); }
.field label { display: block; font-size: var(--fs-sm); color: var(--ink-3); margin-bottom: 6px; font-weight: 500; }
.field input, .field select, .field textarea {
  width: 100%; min-height: 40px; padding: 8px 12px; font: inherit; font-size: var(--fs-base); color: var(--ink);
  background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--r-sm);
  transition: border-color .15s, box-shadow .15s;
}
.field textarea { min-height: 66px; resize: vertical; line-height: 1.75; }
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--ring);
}
.field-err { color: var(--danger); font-size: var(--fs-sm); min-height: 20px; margin-bottom: var(--s2); }
.check { display: flex; align-items: center; gap: var(--s2); cursor: pointer; font-size: var(--fs-base); }
.check input { width: auto; min-height: auto; }
.hint { font-size: var(--fs-xs); color: var(--ink-3); margin-top: 6px; line-height: 1.65; }
.sidebar-add { margin-top: 6px; width: 100%; justify-content: flex-start; }
.user-switch { display: flex; align-items: center; gap: var(--s2); width: 100%; padding: 10px 12px; background: var(--primary-soft); color: var(--primary); border: none; border-radius: var(--r-sm); cursor: pointer; font: inherit; font-size: var(--fs-sm); font-weight: 600; text-align: right; transition: background .15s; }
.user-switch:hover { background: #dbe6ec; }
.user-switch-name { display: flex; flex-direction: column; min-width: 0; line-height: 1.35; }
.usn-name { font-weight: 600; white-space: normal; word-break: break-word; }
.usn-role { font-size: 11px; font-weight: 400; opacity: .72; }
.page-search { width: 100%; box-sizing: border-box; margin: var(--s1) 0 6px; padding: 8px 11px; border: 1px solid var(--line-2); border-radius: var(--r-sm); background: var(--surface); font: inherit; font-size: var(--fs-sm); }
.page-search:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--ring); }

/* کارتِ قرارداد */
.contract-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--e1); padding: var(--s5); margin-bottom: var(--s4); }
.contract-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: var(--s3); font-size: var(--fs-base); font-weight: 600; }
.contract-sub { font-size: var(--fs-xs); color: var(--ink-3); font-weight: 400; }
.q-grid { display: flex; flex-direction: column; gap: var(--s2); }
.q-line { display: flex; align-items: center; gap: var(--s3); }
.q-label { width: 92px; font-size: var(--fs-sm); color: var(--ink-2); flex-shrink: 0; }
.q-bar { flex: 1; height: 8px; background: var(--sunken); border-radius: var(--r-full, 999px); overflow: hidden; }
.q-fill { height: 100%; background: var(--primary); border-radius: var(--r-full, 999px); transition: width .3s; }
.q-fill.done { background: var(--ok); }
.q-count { width: 54px; text-align: left; font-size: var(--fs-sm); color: var(--ink-2); flex-shrink: 0; }
.q-rate { font-size: 10px; color: var(--ink-3); font-weight: 400; }
.contract-empty { background: var(--surface); border: 1px dashed var(--line-2); border-radius: var(--r); padding: var(--s4) var(--s5); margin-bottom: var(--s4); font-size: var(--fs-base); color: var(--ink-3); }
.month-switch { background: none; border: none; cursor: pointer; font: inherit; font-size: var(--fs-base); color: var(--ink-3); padding: 3px 8px; border-radius: var(--r-sm); transition: background .15s, color .15s; }
.month-switch:hover { background: var(--sunken); color: var(--ink); }

/* مودال */
.modal-overlay { position: fixed; inset: 0; background: rgba(15,23,32,.42); backdrop-filter: blur(2px); display: flex; align-items: center; justify-content: center; padding: var(--s6); z-index: 50; animation: fade .16s ease; }
.modal-card { background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--e3); padding: var(--s6); width: 100%; max-width: 460px; }
.modal-title { font-size: var(--fs-lg); font-weight: 700; margin-bottom: var(--s5); letter-spacing: -.01em; }
.modal-actions { display: flex; gap: var(--s2); margin-top: var(--s4); }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
@media (max-width: 720px) { .modal-card { max-width: none; } }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* آنبوردینگ / چرخهٔ قرارداد */
.onboard-banner { display: flex; align-items: center; gap: var(--s2); background: var(--warn-soft); border: 1px solid #F0D9AE; color: #8A5314; border-radius: var(--r-sm); padding: 11px 14px; margin-bottom: var(--s4); font-size: var(--fs-sm); }
.onboard-banner i { font-size: 18px; flex-shrink: 0; }
.brief-view { border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; box-shadow: var(--e1); }
.brief-row { display: flex; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.brief-row:last-child { border-bottom: none; }
.brief-q { flex: 0 0 38%; color: var(--ink-3); font-size: var(--fs-sm); }
.brief-a { flex: 1; color: var(--ink); font-size: var(--fs-base); white-space: pre-wrap; word-break: break-word; }
.months-strip { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin-bottom: var(--s4); font-size: var(--fs-sm); }
.month-chip { padding: 3px 11px; border-radius: var(--r-full, 999px); border: 1px solid var(--line-2); background: var(--surface); color: var(--ink-3); }
.month-chip.open { background: var(--primary-soft); color: var(--primary); border-color: var(--primary-soft); font-weight: 600; }
.setup-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--e1); padding: var(--s4) var(--s5); margin-bottom: var(--s4); }
.pref-time { margin-top: 10px; font-size: var(--fs-sm); color: var(--ink-2); display: flex; align-items: center; gap: 4px; }
.form-divider { margin: var(--s4) 0 var(--s2); padding-top: var(--s3); border-top: 1px solid var(--line); font-size: var(--fs-xs); font-weight: 600; color: var(--ink-3); letter-spacing: .04em; }

/* بردِ برنامه‌ریزیِ تصویربرداری */
.pl-grid { display: flex; border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; background: var(--surface); box-shadow: var(--e1); }
.pl-axis { width: 52px; flex-shrink: 0; border-inline-end: 1px solid var(--line); background: var(--surface); }
.pl-col { flex: 1; min-width: 0; border-inline-end: 1px solid var(--line); position: relative; }
.pl-col:last-child { border-inline-end: none; }
.pl-col.friday { background: #FCFBF9; }
.pl-col.today { background: rgba(22,69,95,.02); }
.pl-colhead { height: 58px; display: flex; flex-direction: column; align-items: center; justify-content: center; border-bottom: 2px solid var(--line); font-size: var(--fs-xs); color: var(--ink-3); gap: 1px; background: var(--surface); }
/* خلاصهٔ بارِ per روز در سرِ ستونِ هفته — یک‌نگاه به شلوغیِ هر روز */
.pl-load { display: flex; align-items: center; gap: 4px; width: 80%; margin-top: 3px; }
.pl-load-bar { flex: 1; height: 4px; background: var(--sunken); border-radius: 999px; overflow: hidden; }
.pl-load-fill { height: 100%; background: var(--primary); border-radius: 999px; }
.pl-load-fill.peak { background: var(--warn); }
.pl-load-n { font-size: 10px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.pl-load.empty { justify-content: center; color: var(--ink-4); font-size: 10px; }
/* CRM — رابطهٔ مشتری (نقطهٔ سلامت + دکمه‌های وضعیت) */
.crm-dot { width: 11px; height: 11px; border-radius: 50%; flex-shrink: 0; }
.crm-dot.ok { background: var(--ok); }
.crm-dot.watch { background: var(--warn); }
.crm-dot.risk { background: var(--danger); }
.crm-health-btns { display: flex; gap: 8px; flex-wrap: wrap; }
.crm-hbtn { border: 1px solid var(--line-2); background: var(--surface); color: var(--ink-2); font: inherit; font-size: var(--fs-sm); font-weight: 600; padding: 7px 18px; border-radius: var(--r-sm); cursor: pointer; transition: background .15s, color .15s, border-color .15s; }
.crm-hbtn:hover { background: var(--bg); }
.crm-hbtn.ok.active { background: var(--ok-soft); color: var(--ok); border-color: var(--ok); }
.crm-hbtn.watch.active { background: var(--warn-soft); color: var(--warn); border-color: var(--warn); }
.crm-hbtn.risk.active { background: var(--danger-soft); color: var(--danger); border-color: var(--danger); }
/* «مالی» — نوارِ تب (سود و زیان / حسابداری / طلب‌ها و بدهی‌ها) زیرِ یک سرشاخه */
.money-tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: var(--s5); flex-wrap: wrap; }
.money-tab { display: inline-flex; align-items: center; gap: 7px; border: none; background: none; color: var(--ink-3); font: inherit; font-size: var(--fs-base); font-weight: 600; padding: 11px 18px; cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; transition: color .15s, border-color .15s; }
.money-tab i { font-size: 18px; }
.money-tab:hover { color: var(--ink); }
.money-tab.active { color: var(--primary); border-bottom-color: var(--primary); }
.money-tab-badge { font-size: 11px; font-weight: 700; border-radius: 999px; padding: 0 7px; margin-inline-start: 3px; background: var(--sunken); color: var(--ink-2); font-variant-numeric: tabular-nums; }
.money-tab-badge.danger { background: var(--danger-soft); color: var(--danger); }
@media (max-width: 720px) { .money-tab { padding: 9px 12px; font-size: var(--fs-sm); } }
.pl-col.today .pl-colhead { background: var(--primary-soft); }
.pl-col.today .pl-colhead b { color: var(--primary); }
.pl-colhead.friday { color: var(--danger); }
.pl-colhead b { color: var(--ink); font-size: var(--fs-sm); font-weight: 600; }
.pl-date { font-size: 10px; color: var(--ink-4); }
.pl-hour { font-size: 10px; color: var(--ink-4); text-align: left; padding: 0 6px; display: flex; align-items: flex-start; transform: translateY(-1px); box-sizing: border-box; }
.pl-daybody { position: relative; background-image: repeating-linear-gradient(to bottom, var(--line) 0, var(--line) 1px, transparent 1px, transparent 38px); }
.pl-sess { position: absolute; background: #fff; border: 1px solid var(--line); border-inline-end: 3px solid var(--primary); border-radius: 7px; padding: 3px 7px; overflow: hidden; cursor: pointer; font-size: 11px; line-height: 1.25; box-sizing: border-box; box-shadow: var(--e1); transition: box-shadow .12s; z-index: 1; }
.pl-sess:hover { box-shadow: var(--e2); z-index: 4; }
.pl-sess.mine { border-inline-end-color: #2563EB; background: #EFF6FF; }
.pl-sess.anon { background: repeating-linear-gradient(45deg, #F2F5F8, #F2F5F8 6px, #E9EFF4 6px, #E9EFF4 12px); border: 1px solid var(--line); border-inline-end: 3px solid #CBD5E1; color: var(--ink-4); box-shadow: none; cursor: default; }
.pl-sess.done { opacity: .5; }
.pl-sess.at-risk { border-inline-end-color: var(--danger) !important; background: var(--danger-soft); }
.pl-sess-t { font-weight: 700; color: var(--primary); font-size: 11px; }
.pl-sess.mine .pl-sess-t { color: #2563EB; }
.pl-sess.anon .pl-sess-t { color: var(--ink-4); font-weight: 600; }
.pl-sess-c { color: var(--ink); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pl-sess-v { color: var(--ink-3); font-size: 10px; }
.pl-sess-meta { display: flex; gap: 5px; flex-wrap: wrap; align-items: center; margin-top: 1px; }
.pl-sess-l { color: var(--primary); font-size: 10px; font-weight: 500; background: var(--primary-soft); border-radius: 4px; padding: 0 5px; white-space: nowrap; }
.pl-risk { color: var(--danger); font-size: 10px; font-weight: 700; background: var(--danger-soft); border-radius: 4px; padding: 0 5px; white-space: nowrap; }
.pl-unconfirmed { color: var(--warn); font-size: 10px; font-weight: 700; background: var(--warn-soft); border-radius: 4px; padding: 0 5px; white-space: nowrap; }
.pl-confirmed { color: var(--ok); font-size: 11px; font-weight: 700; }
.pl-sess[draggable=true] { cursor: grab; }
.pl-sess.dragging { opacity: .45; }
.pl-free { position: absolute; left: 2px; right: 2px; background: rgba(31,122,84,.09); border: 1.5px dashed var(--ok); border-radius: 7px; pointer-events: none; z-index: 0; }
.pl-drop-preview { position: absolute; left: 2px; right: 2px; background: rgba(22,69,95,.12); border: 2px dashed var(--primary); border-radius: 7px; pointer-events: none; z-index: 5; font-size: 11px; font-weight: 700; color: var(--primary); padding: 2px 6px; }
.pl-colhead.clickable { cursor: pointer; }
.pl-colhead.clickable:hover { background: var(--primary-soft); }
.pl-daycontrols { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.pl-daychips { display: flex; gap: 4px; flex-wrap: wrap; }
.pl-daychip { border: 1px solid var(--line-2); background: var(--surface); border-radius: var(--r-full, 999px); padding: 5px 13px; font: inherit; font-size: var(--fs-xs); color: var(--ink-2); cursor: pointer; transition: background .14s; }
.pl-daychip:hover { background: var(--bg); }
.pl-daychip.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.pl-daychip.friday:not(.active) { color: var(--danger); }
.pl-axistoggle { display: flex; border: 1px solid var(--line-2); border-radius: var(--r-sm); overflow: hidden; flex-shrink: 0; }
.pl-axisbtn { border: none; background: var(--surface); padding: 7px 16px; font: inherit; font-size: var(--fs-xs); color: var(--ink-2); cursor: pointer; }
.pl-axisbtn.active { background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.pl-daygrid { overflow: visible; overflow-x: auto; }
.pl-daygrid .pl-axis { position: sticky; right: 0; z-index: 6; background: var(--surface); }
.pl-daygrid .pl-colhead { height: 56px; min-height: 56px; padding: 5px 2px; gap: 2px; }
.pl-rescol { flex: 1 0 132px; }
.pl-avatar { width: 24px; height: 24px; border-radius: 50%; background: var(--primary-soft); color: var(--primary); font-size: 11px; font-weight: 600; display: flex; align-items: center; justify-content: center; }
.pl-colhead.unassigned b { color: var(--ink-4); }
.pl-col-empty { position: absolute; top: 50%; left: 0; right: 0; transform: translateY(-50%); text-align: center; color: var(--ink-4); font-size: var(--fs-xs); pointer-events: none; }

/* کارتابلِ سناریو */
.scenario-task { align-items: stretch; }
.scenario-box { white-space: pre-wrap; background: var(--sunken); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 10px 12px; font-size: var(--fs-sm); line-height: 1.75; color: var(--ink); max-height: 180px; overflow: auto; margin-top: 6px; }
.scenario-note { background: var(--warn-soft); border: 1px solid #EFD6A9; border-radius: var(--r-sm); padding: 7px 11px; font-size: var(--fs-xs); color: #8A5314; margin: 6px 0; }

/* انتخابگرِ اسلاتِ خالیِ مشتری */
.slot-day { margin-bottom: var(--s3); }
.slot-day-h { font-size: var(--fs-sm); font-weight: 600; color: var(--ink-2); margin-bottom: 6px; }
.slot-chips { display: flex; flex-wrap: wrap; gap: var(--s2); }
.slot-chip { border: 1px solid var(--line-2); background: var(--surface); color: var(--primary); font-weight: 600; font-size: var(--fs-sm); padding: 8px 15px; border-radius: var(--r-sm); cursor: pointer; direction: ltr; transition: .15s; }
.slot-chip:hover { background: var(--primary); color: #fff; border-color: var(--primary); }

/* قیفِ فروش (CRM) */
.lead-funnel { display: flex; gap: var(--s3); overflow-x: auto; padding-bottom: var(--s2); }
.lead-col { flex: 0 0 224px; min-width: 224px; background: var(--sunken); border-radius: var(--r); padding: var(--s3); }
.lead-col-h { display: flex; align-items: center; justify-content: space-between; font-weight: 600; font-size: var(--fs-sm); margin-bottom: var(--s2); color: var(--ink); }
.lead-col-n { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-full, 999px); padding: 1px 9px; font-size: var(--fs-xs); color: var(--ink-3); }
.lead-col-empty { color: var(--ink-3); font-size: var(--fs-xs); text-align: center; padding: 10px 0; }
.lead-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-sm); padding: var(--s3); margin-bottom: var(--s2); box-shadow: var(--e1); transition: box-shadow .15s; }
.lead-card:hover { box-shadow: var(--e2); }
.lead-card.muted { opacity: .68; }
.lead-head { display: flex; align-items: baseline; justify-content: space-between; gap: 6px; }
.lead-name { font-weight: 700; font-size: var(--fs-base); }
.lead-est { font-size: 11px; color: var(--ok); font-weight: 600; direction: ltr; white-space: nowrap; }
.lead-meta { font-size: var(--fs-xs); color: var(--ink-3); margin-top: 3px; }
.lead-actions { display: flex; flex-wrap: wrap; gap: 2px 8px; margin-top: var(--s2); }

/* بارِ کاری/ظرفیت + آنبوردینگِ نیرو (HR) */
.cap-badge { font-size: var(--fs-xs); font-weight: 600; color: var(--ink-2); background: var(--sunken); border: 1px solid var(--line-2); border-radius: var(--r-full, 999px); padding: 3px 11px; white-space: nowrap; direction: rtl; }
.cap-badge.full { color: var(--warn); border-color: var(--warn); background: var(--warn-soft); }
.cap-badge.over { color: var(--danger); border-color: var(--danger); background: var(--danger-soft); }
.cap-badge.done { color: var(--ok); border-color: var(--ok); background: var(--ok-soft); }
.cap-badge.warn { color: var(--warn); border-color: var(--warn); }
.row-badges { display: flex; flex-direction: column; gap: 4px; align-items: flex-end; margin-inline: 10px; }
.ob-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 0; border-bottom: 1px dashed var(--line); }
.ob-row:last-child { border-bottom: none; }
.ob-check { display: flex; align-items: center; gap: var(--s2); font-size: var(--fs-base); cursor: pointer; }
.ob-check input { width: 17px; height: 17px; cursor: pointer; accent-color: var(--primary); }
.ob-done { text-decoration: line-through; color: var(--ink-3); }
.row-link { cursor: pointer; }
.row-link:hover { color: var(--primary); text-decoration: underline; }
.prof-grid { display: flex; flex-direction: column; gap: 0; }
.prof-row { display: flex; align-items: baseline; justify-content: space-between; gap: var(--s3); padding: 10px 0; border-bottom: 1px dashed var(--line); font-size: var(--fs-sm); }
.prof-row:last-child { border-bottom: none; }
.prof-l { color: var(--ink-3); white-space: nowrap; }
.prof-v { font-weight: 600; text-align: left; }
.row-meta.deadline { color: var(--primary); font-weight: 600; margin-top: 2px; }
.row-meta.deadline.overdue { color: var(--danger); }

/* نوارِ فیلترِ چیپ (کارهای من) */
.tk-chips { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: var(--s5); }
.tk-chip { border: 1px solid var(--line-2); background: var(--surface); border-radius: var(--r-full, 999px); padding: 6px 14px; font: inherit; font-size: var(--fs-sm); color: var(--ink-2); cursor: pointer; transition: background .14s, border-color .14s; }
.tk-chip:hover { background: var(--bg); }
.tk-chip.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* داشبوردِ مدیریت */
.dash-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(134px, 1fr)); gap: var(--s3); margin-bottom: var(--s6); }
.dash-stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: var(--s4) var(--s5); box-shadow: var(--e1); }
.dash-stat-v { font-size: 28px; font-weight: 700; color: var(--primary); line-height: 1.1; letter-spacing: -.02em; }
.dash-stat-l { font-size: var(--fs-xs); color: var(--ink-3); margin-top: 4px; }
.dash-stat.danger .dash-stat-v { color: var(--danger); }
.dash-stat.warning .dash-stat-v { color: var(--warn); }
.dash-section { margin-bottom: var(--s6); }
.dash-section-h { display: flex; align-items: center; gap: var(--s2); font-size: var(--fs-md); font-weight: 700; color: var(--ink); margin-bottom: var(--s3); }
.dash-section-h i { color: var(--ink-3); }
.dash-count { background: var(--primary-soft); color: var(--primary); font-size: var(--fs-xs); font-weight: 700; border-radius: var(--r-full, 999px); padding: 1px 10px; }
.dash-empty { color: var(--ink-3); font-size: var(--fs-sm); padding: var(--s3) 2px; }
.dash-dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.dash-dot.danger { background: var(--danger); }
.dash-dot.warning { background: var(--warn); }
.dash-team { display: grid; grid-template-columns: repeat(auto-fit, minmax(158px, 1fr)); gap: 10px; }
.dash-team-item { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 11px 14px; display: flex; justify-content: space-between; align-items: center; font-size: var(--fs-base); box-shadow: var(--e1); }
.dash-team-n { font-weight: 600; color: var(--primary); font-size: var(--fs-sm); }
.dash-pipe { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: var(--s3) var(--s5); box-shadow: var(--e1); }
.dash-pipe-row { display: flex; align-items: center; gap: 10px; padding: 6px 0; }
.dash-pipe-l { width: 122px; font-size: var(--fs-sm); color: var(--ink-2); flex-shrink: 0; }
.dash-pipe-bar { flex: 1; height: 8px; background: var(--sunken); border-radius: var(--r-full, 999px); overflow: hidden; }
.dash-pipe-fill { height: 100%; background: var(--primary); border-radius: var(--r-full, 999px); }
.dash-pipe-n { width: 30px; text-align: left; font-size: var(--fs-sm); font-weight: 700; color: var(--ink); flex-shrink: 0; font-variant-numeric: tabular-nums; }
@media (max-width: 720px) { .dash-stats { grid-template-columns: repeat(2, 1fr); } }

/* جدولِ مالی */
.fin-table { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; box-shadow: var(--e1); }
.fin-row { display: grid; grid-template-columns: 2fr 1fr 1.4fr 1fr; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--line); font-size: var(--fs-sm); align-items: center; }
.fin-row:last-child { border-bottom: none; }
.fin-row span:not(:first-child) { text-align: left; direction: ltr; font-variant-numeric: tabular-nums; }
.fin-head { background: var(--bg); font-weight: 600; color: var(--ink-3); font-size: var(--fs-xs); }
.fin-detail { color: var(--ink-3); font-size: var(--fs-xs); }
.fin-pos { color: var(--ok); font-weight: 600; }
.fin-neg { color: var(--danger); font-weight: 600; }
.fin-contract { margin-top: 10px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--e1); overflow: hidden; }
.fin-contract-summary { display: flex; align-items: center; justify-content: space-between; font-weight: 600; font-size: var(--fs-sm); padding: 13px 16px; cursor: pointer; list-style: none; transition: background .15s; }
.fin-contract-summary::-webkit-details-marker { display: none; }
.fin-contract-summary::after { content: '▾'; color: var(--ink-3); margin-inline-start: 6px; transition: transform .15s; }
details.fin-contract[open] .fin-contract-summary::after { transform: rotate(180deg); }
.fin-contract-summary:hover { background: var(--bg); }
.fin-contract-body { padding: 0 16px 14px; }
.fin-contract-head { display: flex; align-items: center; justify-content: space-between; font-weight: 600; font-size: var(--fs-sm); }
.fin-contract-sub { color: var(--ink-3); font-size: var(--fs-xs); margin: 4px 0 6px; }
.fin-statement { display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: var(--fs-xs); margin-bottom: var(--s2); padding: 9px 12px; background: var(--sunken); border-radius: var(--r-sm); }
.fin-statement span { direction: rtl; font-variant-numeric: tabular-nums; }
.dash-fin { display: grid; grid-template-columns: repeat(auto-fit, minmax(154px, 1fr)); gap: 10px; }
.dash-fin-item { display: flex; flex-direction: column; gap: 3px; padding: 12px 14px; background: var(--sunken); border-radius: var(--r-sm); }
.dash-fin-l { font-size: var(--fs-xs); color: var(--ink-3); }
.dash-fin-v { font-size: var(--fs-md); font-weight: 700; direction: ltr; text-align: right; }
.dash-fin-sub { font-size: 11px; color: var(--warn); margin-top: 1px; }
/* داشبورد — زونِ سلامتِ مالی (بازچینیِ ۲۰۲۶-۰۷): عددِ قهرمان + روند + پشتیبان‌ها */
.mh { display: flex; flex-direction: column; gap: var(--s4); }
.mh-top { display: grid; grid-template-columns: 1.35fr 2fr; gap: var(--s3); align-items: stretch; }
.mh-hero { background: var(--surface); border: 1px solid var(--line); border-top: 3px solid var(--ink-4); border-radius: var(--r); box-shadow: var(--e1); padding: var(--s4) var(--s5); display: flex; flex-direction: column; justify-content: center; }
.mh-hero.pos { border-top-color: var(--ok); }
.mh-hero.neg { border-top-color: var(--danger); }
.mh-hero-l { font-size: var(--fs-sm); color: var(--ink-3); }
.mh-hero-v { font-size: var(--fs-2xl); font-weight: 700; line-height: 1.2; letter-spacing: -.02em; direction: ltr; text-align: right; font-variant-numeric: tabular-nums; margin: 2px 0; }
.mh-hero.pos .mh-hero-v { color: var(--ok); }
.mh-hero.neg .mh-hero-v { color: var(--danger); }
.mh-hero-sub { font-size: var(--fs-xs); color: var(--ink-3); }
.mh-trend-cap { font-size: var(--fs-xs); color: var(--ink-3); margin-bottom: 6px; display: flex; align-items: center; gap: 6px; }
.trend.mini { height: 120px; padding: 8px 6px 0; gap: 6px; }
@media (max-width: 720px) { .mh-top { grid-template-columns: 1fr; } }
/* داشبورد — زونِ نیاز به توجه */
.att-chips { display: flex; flex-wrap: wrap; gap: var(--s2); margin-bottom: var(--s4); }
.att-chip { font-size: var(--fs-sm); font-weight: 600; padding: 5px 13px; border-radius: var(--r-full, 999px); border: 1px solid var(--line-2); color: var(--ink-2); background: var(--surface); }
.att-chip.danger { color: var(--danger); background: var(--danger-soft); border-color: transparent; }
.att-chip.warn { color: var(--warn); background: var(--warn-soft); border-color: transparent; }
.att-chip.ok { color: var(--ok); background: var(--ok-soft); border-color: transparent; }
.att-blocks { display: flex; flex-direction: column; gap: var(--s4); }
.att-block-h { display: flex; align-items: center; gap: var(--s2); font-size: var(--fs-sm); font-weight: 600; color: var(--ink-2); margin-bottom: 6px; }
.att-clear { display: flex; align-items: center; gap: var(--s2); background: var(--ok-soft); color: var(--ok); border-radius: var(--r); padding: 14px 16px; font-size: var(--fs-sm); font-weight: 500; }
.att-clear i { font-size: 20px; }
/* داشبورد — نبضِ کار: آمارِ عملیاتیِ فشرده‌تر از عددِ مالی */
.dash-stats.ops { margin-bottom: var(--s4); }
.dash-stats.ops .dash-stat-v { font-size: 22px; }
/* مالی — میله‌های سود/زیانِ هر مشتری */
.pnl-bars { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--e1); padding: var(--s4) var(--s5); display: flex; flex-direction: column; gap: 12px; }
.pnl-row { display: grid; grid-template-columns: 150px 1fr 130px; gap: 12px; align-items: center; }
.pnl-name { min-width: 0; }
.pnl-name > div:first-child { font-size: var(--fs-sm); font-weight: 600; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pnl-sub { font-size: 11px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pnl-track { height: 16px; background: var(--sunken); border-radius: var(--r-sm); overflow: hidden; }
.pnl-fill { height: 100%; border-radius: var(--r-sm); min-width: 2px; }
.pnl-fill.pos { background: var(--ok); }
.pnl-fill.neg { background: var(--danger); }
.pnl-val { font-size: var(--fs-sm); font-weight: 600; text-align: left; direction: ltr; font-variant-numeric: tabular-nums; }
@media (max-width: 720px) { .pnl-row { grid-template-columns: 96px 1fr 96px; } }
/* مالی — نوارِ ساختارِ دستمزد (ثابت vs متغیر) */
.struct { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--e1); padding: var(--s4) var(--s5); margin-bottom: 10px; }
.struct-bar { display: flex; height: 20px; border-radius: var(--r-sm); overflow: hidden; margin-bottom: 10px; background: var(--sunken); }
.struct-seg.salary { background: var(--primary); }
.struct-seg.variable { background: var(--brass); }
.struct-legend { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: var(--fs-sm); color: var(--ink-2); }
.struct-legend span { display: flex; align-items: center; gap: 6px; }
.struct-dot { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.struct-dot.salary { background: var(--primary); }
.struct-dot.variable { background: var(--brass); }
/* مالی — نرخِ کارها، جمع‌شونده */
.fin-collapse { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--e1); padding: var(--s3) var(--s5); margin-bottom: var(--s6); }
.fin-collapse-h { cursor: pointer; font-weight: 600; font-size: var(--fs-sm); color: var(--ink-2); list-style: none; display: flex; align-items: center; gap: 6px; }
.fin-collapse-h::-webkit-details-marker { display: none; }
.fin-collapse-h::before { content: '▾'; color: var(--ink-3); transition: transform .15s; }
.fin-collapse[open] .fin-collapse-h::before { transform: rotate(180deg); }
/* بردِ محتوا — سوییچِ نما (فهرست/تقویم) */
.board-toolbar { display: flex; justify-content: flex-end; margin-bottom: var(--s4); }
.seg { display: inline-flex; border: 1px solid var(--line-2); border-radius: var(--r-sm); overflow: hidden; }
.seg-btn { display: inline-flex; align-items: center; gap: 6px; border: none; background: var(--surface); color: var(--ink-2); font: inherit; font-size: var(--fs-sm); padding: 7px 15px; cursor: pointer; transition: background .14s, color .14s; }
.seg-btn i { font-size: 16px; }
.seg-btn + .seg-btn { border-inline-start: 1px solid var(--line-2); }
.seg-btn.active { background: var(--primary-soft); color: var(--primary); font-weight: 600; }
/* نمای تقویمیِ محتوا */
.cal { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--e1); overflow: hidden; }
.cal-head, .cal-body { display: grid; grid-template-columns: repeat(7, 1fr); }
.cal-head { background: var(--bg); border-bottom: 1px solid var(--line); }
.cal-hd { padding: 8px 4px; text-align: center; font-size: var(--fs-xs); color: var(--ink-3); font-weight: 600; }
.cal-hd.fri { color: var(--danger); }
.cal-cell { min-height: 94px; border-inline-start: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 5px; display: flex; flex-direction: column; gap: 4px; }
.cal-cell.blank { background: var(--bg); }
.cal-cell.today { background: var(--primary-soft); }
.cal-daynum { font-size: var(--fs-xs); color: var(--ink-3); font-variant-numeric: tabular-nums; text-align: left; }
.cal-cell.today .cal-daynum { color: var(--primary); font-weight: 700; }
.cal-chips { display: flex; flex-direction: column; gap: 3px; }
.cal-chip { display: flex; align-items: center; gap: 4px; padding: 3px 6px; border-radius: 6px; font-size: 11px; cursor: pointer; border-inline-start: 3px solid var(--ink-4); background: var(--sunken); color: var(--ink); overflow: hidden; transition: filter .12s; }
.cal-chip:hover { filter: brightness(.96); }
.cal-chip i { font-size: 13px; flex-shrink: 0; }
.cal-chip span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-chip.ok { border-inline-start-color: var(--ok); background: var(--ok-soft); color: var(--ok); }
.cal-chip.prog { border-inline-start-color: var(--primary); background: var(--primary-soft); color: var(--primary); }
.cal-chip.warn { border-inline-start-color: var(--warn); background: var(--warn-soft); color: var(--warn); }
.cal-chip.neutral { border-inline-start-color: var(--ink-4); }
.cal-chip.muted { opacity: .55; text-decoration: line-through; }
.cal-undated { margin-top: var(--s4); background: var(--surface); border: 1px dashed var(--line-2); border-radius: var(--r); padding: var(--s3) var(--s4); }
.cal-undated-h { display: flex; align-items: center; gap: 6px; font-size: var(--fs-sm); color: var(--ink-3); margin-bottom: 8px; }
.cal-undated .cal-chips { flex-direction: row; flex-wrap: wrap; }
.cal-undated .cal-chip { max-width: 230px; }
@media (max-width: 720px) { .cal-cell { min-height: 72px; } }
/* حسابداری — جریانِ نقد، ردیف‌های هزینه/دستمزد/تنخواه (RTLِ کامل، مستقل از fin-row) */
.acct-flow { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; margin-bottom: var(--s5); }
.acct-flow-item { display: flex; align-items: center; justify-content: space-between; padding: 13px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-sm); box-shadow: var(--e1); font-size: var(--fs-sm); color: var(--ink-2); }
.acct-flow-item b { direction: ltr; font-variant-numeric: tabular-nums; font-size: var(--fs-md); }
.acct-flow-net { background: var(--sunken); color: var(--ink); font-weight: 700; }
.acct-list { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; box-shadow: var(--e1); margin-top: 8px; }
.acct-row { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line); font-size: var(--fs-sm); }
.acct-row:last-child { border-bottom: none; }
.acct-main { flex: 1; min-width: 0; }
.acct-main .acct-sub { color: var(--ink-3); font-size: var(--fs-xs); margin-top: 2px; }
.acct-amt { direction: ltr; font-variant-numeric: tabular-nums; font-weight: 700; white-space: nowrap; }
.acct-cats { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 2px; }
.acct-cat-chip { background: var(--sunken); border-radius: 999px; padding: 4px 12px; font-size: var(--fs-xs); color: var(--ink-2); font-variant-numeric: tabular-nums; }
.acct-paid { color: var(--ok); font-weight: 600; font-size: var(--fs-xs); white-space: nowrap; }
.acct-toolbar { display: flex; justify-content: flex-end; margin-bottom: 2px; }
/* روندِ چند ماهه — ستون‌های ساده */
.trend { display: flex; align-items: flex-end; gap: 10px; height: 150px; padding: 10px 4px 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--e1); }
.trend-col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 4px; min-width: 0; }
.trend-bar { width: 62%; max-width: 36px; border-radius: 4px 4px 0 0; background: var(--ok); min-height: 3px; }
.trend-bar.neg { background: var(--danger); }
.trend-val { font-size: 10px; direction: ltr; font-variant-numeric: tabular-nums; white-space: nowrap; }
.trend-lbl { font-size: var(--fs-xs); color: var(--ink-3); }
.pay-list { display: flex; flex-direction: column; gap: 0; margin-bottom: 6px; }
.pay-row { display: flex; align-items: center; justify-content: space-between; font-size: var(--fs-xs); padding: 6px 0; border-bottom: 1px dashed var(--line); }
.pay-row:last-child { border-bottom: none; }
.pay-row span:last-child { direction: ltr; font-weight: 600; font-variant-numeric: tabular-nums; }

/* ── سوییچِ تم (کنارِ لوگو) ── */
.brand-name { flex: 0 1 auto; }
.theme-toggle { margin-inline-start: auto; background: none; border: 1px solid var(--line-2); color: var(--ink-3); width: 32px; height: 32px; border-radius: var(--r-sm); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; transition: background .15s, color .15s, border-color .15s; }
.theme-toggle:hover { background: var(--sunken); color: var(--ink); border-color: var(--ink-4); }
.theme-toggle i { font-size: 17px; }

/* ── حالتِ تیره (انتخابی) — فقط متغیرها را برمی‌گرداند؛ چون کلِ اپ روی همین متغیرهاست، بقیه خودکار می‌شود ── */
:root[data-theme="dark"] {
  --bg: #0F1720; --surface: #18222E; --sunken: #131C25;
  --primary: #3E93B8; --primary-deep: #327C9C; --primary-soft: #16303D; --ring: rgba(62,147,184,.25);
  --brass: #C8A25C;
  --ink: #E6ECF2; --ink-2: #AEBAC7; --ink-3: #7C8896; --ink-4: #566270;
  --line: #263241; --line-2: #33404F;
  --ok: #3FB080; --ok-soft: #123024; --warn: #D79B44; --warn-soft: #2E2410; --danger: #E06B62; --danger-soft: #331B19;
  --e1: 0 1px 2px rgba(0,0,0,.28), 0 1px 3px rgba(0,0,0,.22);
  --e2: 0 3px 10px rgba(0,0,0,.34), 0 1px 3px rgba(0,0,0,.28);
  --e3: 0 14px 40px rgba(0,0,0,.55);
}
/* رنگ‌های هاردکدِ معدود (بردِ برنامه‌ریزی + بنرها + هاورِ سوییچ) که در تیره باید برگردند */
:root[data-theme="dark"] .pl-col.friday { background: rgba(255,255,255,.025); }
:root[data-theme="dark"] .pl-sess { background: var(--surface); }
:root[data-theme="dark"] .pl-sess.mine { background: rgba(62,147,184,.16); border-inline-end-color: #4C9BE0; }
:root[data-theme="dark"] .pl-sess.mine .pl-sess-t { color: #6FB2F0; }
:root[data-theme="dark"] .pl-sess.anon { background: repeating-linear-gradient(45deg, #1b2530, #1b2530 6px, #223041 6px, #223041 12px); border-inline-end-color: var(--line-2); }
:root[data-theme="dark"] .user-switch:hover { background: #1c3a49; }
:root[data-theme="dark"] .onboard-banner { border-color: var(--warn); color: var(--warn); }
:root[data-theme="dark"] .scenario-note { border-color: var(--warn); color: var(--warn); }

/* ── سابقهٔ اکشن‌ها (audit trail) ── */
.aud-count{font-size:var(--fs-sm);color:var(--ink-3);font-weight:600;white-space:nowrap}
.aud-filters{display:flex;flex-direction:column;gap:10px;margin:14px 0 6px}
.aud-filter-row{display:flex;gap:8px;flex-wrap:wrap;align-items:center}
.aud-search{flex:1;min-width:180px;background:var(--surface);border:1px solid var(--line);border-radius:var(--r-sm);padding:8px 12px;color:var(--ink);font-family:inherit;font-size:var(--fs-sm);outline:none}
.aud-search:focus{border-color:var(--primary);box-shadow:0 0 0 3px var(--ring)}
.aud-sel{background:var(--surface);border:1px solid var(--line);border-radius:var(--r-sm);padding:8px 10px;color:var(--ink);font-family:inherit;font-size:var(--fs-sm);cursor:pointer;outline:none}
.aud-ranges{display:flex;gap:6px;flex-wrap:wrap}
.aud-range{background:var(--surface);border:1px solid var(--line);border-radius:999px;padding:5px 14px;color:var(--ink-2);font-family:inherit;font-size:var(--fs-sm);cursor:pointer}
.aud-range:hover{border-color:var(--primary);color:var(--ink)}
.aud-range.active{background:var(--primary-soft);border-color:var(--primary);color:var(--primary-deep);font-weight:600}

.aud-list{margin-top:8px}
.aud-day{display:flex;align-items:center;gap:10px;position:sticky;top:0;background:var(--bg);padding:12px 2px 6px;z-index:1}
.aud-day::after{content:'';flex:1;height:1px;background:var(--line)}
.aud-day-wd{font-weight:700;color:var(--ink);font-size:var(--fs-sm)}
.aud-day-date{color:var(--ink-3);font-size:var(--fs-xs);font-variant-numeric:tabular-nums}
.aud-day-rows{display:flex;flex-direction:column}
.aud-row{display:flex;gap:12px;padding:9px 4px;border-bottom:1px solid var(--line-2)}
.aud-row:hover{background:var(--surface)}
.aud-time{flex:0 0 auto;width:44px;text-align:center;color:var(--ink-3);font-size:var(--fs-xs);font-variant-numeric:tabular-nums;padding-top:2px}
.aud-body{flex:1;min-width:0;display:flex;flex-direction:column;gap:5px}
.aud-line{display:flex;align-items:baseline;gap:8px;flex-wrap:wrap}
.aud-summary{color:var(--ink);font-size:var(--fs-sm);line-height:1.6}
.aud-sub{display:flex;align-items:center;gap:8px;flex-wrap:wrap}

.aud-cat{display:inline-flex;align-items:center;gap:5px;flex:0 0 auto;padding:1px 9px 1px 7px;border-radius:999px;font-size:11px;font-weight:600;background:var(--sunken);border:1px solid var(--line);color:var(--ink-2)}
.aud-cat::before{content:'';width:7px;height:7px;border-radius:50%;background:var(--dot,#9aa4ad)}
.aud-c-money{--dot:#2f9e5f}.aud-c-content{--dot:#4a7dff}.aud-c-contract{--dot:#7a5cff}.aud-c-film{--dot:#14a0a8}
.aud-c-mission{--dot:#d99422}.aud-c-hr{--dot:#3b93c4}.aud-c-sales{--dot:#d0669b}.aud-c-crm{--dot:#d0577a}
.aud-c-setup{--dot:#7b8a9a}.aud-c-page{--dot:#4a7dff}.aud-c-sec{--dot:#d05555}.aud-c-sys{--dot:#8a94a0}.aud-c-other{--dot:#9aa4ad}

.aud-actor{display:inline-flex;align-items:center;gap:4px;font-size:var(--fs-xs);color:var(--ink-2)}
.aud-actor-ic{font-size:14px;color:var(--ink-3)}
.aud-actor-name{font-weight:600;color:var(--ink)}
.aud-actor-role{color:var(--ink-3)}
.aud-actor-sys .aud-actor-ic,.aud-actor-sys .aud-actor-name{color:var(--brass)}

.aud-chip{display:inline-flex;align-items:center;gap:5px;max-width:100%;background:var(--surface);border:1px solid var(--line);border-radius:999px;padding:2px 10px;color:var(--ink-2);font-family:inherit;font-size:var(--fs-xs);cursor:pointer}
.aud-chip:hover{border-color:var(--primary);color:var(--primary-deep);background:var(--primary-soft)}
.aud-chip-ic{font-size:13px;flex:0 0 auto}
.aud-chip-t{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:220px}
.aud-more{background:none;border:none;color:var(--primary);font-family:inherit;font-size:var(--fs-xs);cursor:pointer;padding:2px 4px}
.aud-more:hover{text-decoration:underline}
.aud-details{flex-basis:100%;margin-top:4px;background:var(--sunken);border:1px solid var(--line-2);border-radius:var(--r-sm);padding:7px 10px;color:var(--ink-2);font-size:var(--fs-xs);line-height:1.7;word-break:break-word;direction:ltr;text-align:right}
.aud-more-btn{margin:16px auto;display:block}

/* تایم‌لاینِ یک مورد (مودال) */
.aud-tl-card{max-width:640px;width:94vw;max-height:86vh;display:flex;flex-direction:column}
.aud-tl-sub{color:var(--ink-3);font-size:var(--fs-sm);margin:-4px 0 12px}
.aud-tl-loading{color:var(--ink-3);padding:22px 4px;text-align:center}
.aud-tl{overflow-y:auto;padding:2px 2px 2px 6px;margin:0 -2px}
.aud-tl-node{display:flex;gap:12px;position:relative;padding-bottom:16px}
.aud-tl-node::before{content:'';position:absolute;top:16px;bottom:-2px;right:6px;width:2px;background:var(--line)}
.aud-tl-node:last-child::before{display:none}
.aud-tl-dot{flex:0 0 auto;width:14px;height:14px;border-radius:50%;margin-top:2px;background:var(--dot,#9aa4ad);border:3px solid var(--surface);box-shadow:0 0 0 1px var(--line);z-index:1}
.aud-tl-content{flex:1;min-width:0;display:flex;flex-direction:column;gap:4px}
.aud-tl-when{font-size:var(--fs-xs);color:var(--ink-3);font-variant-numeric:tabular-nums}
.aud-tl-summary{font-size:var(--fs-sm);color:var(--ink);font-weight:600;line-height:1.6}
.aud-tl-actor{display:flex;flex-wrap:wrap;gap:8px;align-items:center}

.aud-d-before{color:var(--warn)}
.aud-d-sep{color:var(--ink-4,var(--ink-3))}

/* ── اعلان‌ها: زنگوله + کشو + صفحهٔ تاریخچه (همه با توکن‌ها ⇒ تمِ تیره هم می‌گیرد) ── */
.brand-actions { margin-inline-start: auto; display: inline-flex; align-items: center; gap: 6px; }
.brand-actions .theme-toggle { margin-inline-start: 0; }
.notif-bell { position: relative; background: none; border: 1px solid var(--line-2); color: var(--ink-3); width: 32px; height: 32px; border-radius: var(--r-sm); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; transition: background .15s, color .15s, border-color .15s; }
.notif-bell:hover { background: var(--sunken); color: var(--ink); border-color: var(--ink-4); }
.notif-bell i { font-size: 17px; }
.notif-badge { position: absolute; top: -5px; left: -5px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 999px; background: var(--danger); color: #fff; font-size: 10px; font-weight: 700; line-height: 16px; text-align: center; box-shadow: 0 0 0 2px var(--surface); font-variant-numeric: tabular-nums; }
.notif-badge.hidden { display: none; }

.notif-panel { position: fixed; z-index: 200; width: 340px; max-width: calc(100vw - 24px); max-height: 72vh; display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--e3); overflow: hidden; }
.notif-panel-loading { padding: 28px 16px; text-align: center; color: var(--ink-3); font-size: var(--fs-sm); }
.notif-panel-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 12px 14px; border-bottom: 1px solid var(--line); flex-shrink: 0; }
.notif-panel-title { font-weight: 700; font-size: var(--fs-base); color: var(--ink); }
.notif-markall { background: none; border: none; color: var(--primary); font: inherit; font-size: var(--fs-xs); cursor: pointer; padding: 4px 6px; border-radius: var(--r-sm); }
.notif-markall:hover { background: var(--primary-soft); }
.notif-panel-list { overflow-y: auto; flex: 1; }
.notif-panel-foot { border-top: 1px solid var(--line); padding: 8px; text-align: center; flex-shrink: 0; }
.notif-seeall { background: none; border: none; color: var(--ink-2); font: inherit; font-size: var(--fs-sm); cursor: pointer; padding: 6px 10px; border-radius: var(--r-sm); width: 100%; }
.notif-seeall:hover { background: var(--sunken); color: var(--ink); }

.notif-row { display: flex; align-items: flex-start; gap: 10px; padding: 11px 14px; cursor: pointer; border-bottom: 1px solid var(--line); transition: background .12s; }
.notif-row:last-child { border-bottom: none; }
.notif-row:hover { background: var(--bg); }
.notif-row.unread { background: var(--primary-soft); }
.notif-ic { flex-shrink: 0; width: 30px; height: 30px; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center; font-size: 16px; }
.notif-ic.n-task { background: var(--primary-soft); color: var(--primary); }
.notif-ic.n-approval { background: var(--warn-soft); color: var(--warn); }
.notif-ic.n-mission { background: rgba(176,134,58,.15); color: var(--brass); }
.notif-ic.n-deadline { background: var(--danger-soft); color: var(--danger); }
.notif-ic.n-finance { background: var(--ok-soft); color: var(--ok); }
.notif-ic.n-system { background: var(--sunken); color: var(--ink-3); }
.notif-body { min-width: 0; flex: 1; }
.notif-title { font-size: var(--fs-sm); color: var(--ink); line-height: 1.6; }
.notif-meta { margin-top: 3px; font-size: var(--fs-xs); color: var(--ink-3); display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.notif-page { color: var(--ink-2); }
.notif-time { color: var(--ink-3); font-variant-numeric: tabular-nums; }
.notif-dot { flex-shrink: 0; width: 8px; height: 8px; border-radius: 50%; background: var(--danger); margin-top: 6px; }

.notif-empty { padding: 32px 16px; text-align: center; color: var(--ink-3); font-size: var(--fs-sm); display: flex; flex-direction: column; align-items: center; gap: 8px; }
.notif-empty i { font-size: 28px; color: var(--ink-4); }

.notif-filters { display: flex; gap: 8px; margin-bottom: var(--s4); }
.notif-filter { background: var(--surface); border: 1px solid var(--line-2); color: var(--ink-2); font: inherit; font-size: var(--fs-sm); padding: 6px 14px; border-radius: 999px; cursor: pointer; transition: background .14s, color .14s, border-color .14s; }
.notif-filter:hover { border-color: var(--ink-4); }
.notif-filter.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.notif-fulllist { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--e1); overflow: hidden; }
.notif-day { padding: 10px 14px 6px; font-size: var(--fs-xs); color: var(--ink-3); background: var(--sunken); display: flex; gap: 8px; align-items: center; }
.notif-day-wd { font-weight: 600; }
.notif-day-date { color: var(--ink-4); }

/* ── دستیارِ هوش مصنوعی: دکمهٔ شناور + پنجرهٔ چت ── */
.ai-fab { position: fixed; bottom: 20px; left: 20px; z-index: 150; width: 52px; height: 52px; border-radius: 50%; border: none; cursor: pointer; background: linear-gradient(135deg, var(--primary), var(--brass)); color: #fff; box-shadow: var(--e3); display: flex; align-items: center; justify-content: center; transition: transform .15s; }
.ai-fab:hover { transform: scale(1.06); }
.ai-fab i { font-size: 24px; }
.ai-panel { position: fixed; bottom: 84px; left: 20px; z-index: 151; width: 384px; max-width: calc(100vw - 40px); height: 560px; max-height: calc(100vh - 120px); display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--e3); overflow: hidden; }
.ai-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px; border-bottom: 1px solid var(--line); background: linear-gradient(135deg, var(--primary-soft), transparent); flex-shrink: 0; }
.ai-head-t { font-weight: 700; color: var(--primary); display: flex; align-items: center; gap: 8px; }
.ai-x { background: none; border: none; color: var(--ink-3); cursor: pointer; padding: 4px; border-radius: var(--r-sm); display: inline-flex; }
.ai-x:hover { background: var(--sunken); color: var(--ink); }
.ai-body { flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.ai-hello { text-align: center; color: var(--ink-3); padding: 16px 8px; }
.ai-hello-t { font-size: var(--fs-md); color: var(--ink); font-weight: 600; margin-bottom: 8px; }
.ai-hello-s { font-size: var(--fs-sm); line-height: 1.85; }
.ai-msg { max-width: 86%; padding: 9px 13px; border-radius: 14px; font-size: var(--fs-sm); line-height: 1.8; white-space: pre-wrap; word-break: break-word; }
.ai-user { align-self: flex-start; background: var(--primary); color: #fff; border-bottom-left-radius: 4px; }
.ai-bot { align-self: flex-end; background: var(--sunken); color: var(--ink); border-bottom-right-radius: 4px; }
.ai-typing { color: var(--ink-3); font-style: italic; }
.ai-action { align-self: flex-end; width: 92%; background: var(--surface); border: 1px solid var(--brass); border-radius: 12px; padding: 10px 12px; }
.ai-action-t { font-weight: 600; font-size: var(--fs-sm); color: var(--ink); display: flex; align-items: center; gap: 6px; }
.ai-action-t i { color: var(--brass); }
.ai-action-p { font-size: var(--fs-xs); color: var(--ink-3); margin: 5px 0 9px; line-height: 1.7; }
.ai-action-btns { display: flex; }
.ai-do { padding: 6px 16px; font-size: var(--fs-sm); }
.ai-do.done { background: var(--ok); border-color: var(--ok); cursor: default; }
.ai-foot { display: flex; gap: 8px; padding: 10px; border-top: 1px solid var(--line); flex-shrink: 0; align-items: flex-end; }
.ai-input { flex: 1; resize: none; max-height: 110px; min-height: 42px; padding: 10px 12px; border: 1px solid var(--line-2); border-radius: 12px; font: inherit; font-size: var(--fs-sm); background: var(--surface); color: var(--ink); }
.ai-input:focus { outline: none; border-color: var(--primary); }
.ai-send { flex-shrink: 0; width: 42px; height: 42px; border-radius: 50%; border: none; background: var(--primary); color: #fff; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.ai-send:hover { background: var(--primary-deep); }
