/* ==========================================================================
   CRM گپ · لایهٔ سازگاری با دیزاین‌سیستم GMAP
   ترتیب بارگذاری: gmap/tokens → base → components → layout → pages → crm.css
   پوشهٔ gmap/ کپی دقیق دیزاین‌سیستم پنل مرکزی است (به آن دست نزنید؛ برای
   به‌روزرسانی، فایل‌ها را از پروژهٔ panel دوباره کپی کنید).
   این فایل فقط کلاس‌های قدیمی CRM را به همان توکن‌ها و اجزا نگاشت می‌کند.
   ========================================================================== */

/* ---------- نگاشت توکن‌های قدیمی CRM به توکن‌های GMAP ----------
   استایل‌های داخلی صفحه‌ها (style داخل view) هنوز از این نام‌ها استفاده می‌کنند؛
   با این نگاشت، خودکار رنگ و شعاع و سایهٔ دیزاین‌سیستم را می‌گیرند. */
:root {
  --brand: var(--c-primary);
  --brand-600: var(--c-primary-hover);
  --brand-050: var(--c-primary-soft);
  --accent: #F59E0B;
  --accent-050: var(--c-warning-soft);
  --bg: var(--c-bg);
  --surface: var(--c-surface);
  --surface-2: var(--c-surface-2);
  --border: var(--c-border);
  --text: var(--c-text);
  --text-soft: var(--c-muted);
  --text-faint: var(--c-muted);
  --ok: var(--c-success);
  --ok-bg: var(--c-success-soft);
  --warn: var(--c-warning);
  --warn-bg: var(--c-warning-soft);
  --danger: var(--c-danger);
  --danger-bg: var(--c-danger-soft);
  --info: var(--c-info);
  --info-bg: var(--c-info-soft);
  --radius: var(--r-xl);
  --radius-sm: var(--r-md);
  --shadow: var(--shadow-pop);
  --shadow-sm: var(--shadow-card);
  --sidebar-w: 240px;
}
:root[data-theme="dark"] { --accent: #FBBF24; }

/* ---------- پایهٔ سازگار ---------- */
a { color: inherit; }
a:hover { text-decoration: none; }
.link, .content .prose a, .card-more { color: var(--c-primary-text); font-weight: 600; }
.link:hover, .content .prose a:hover, .card-more:hover { text-decoration: underline; text-underline-offset: 3px; }
.content h2, .content h3, .content h4 { font-weight: 700; line-height: 1.5; margin: 0 0 .5rem; }
.content h3 { font-size: 17px; }
.content h4 { font-size: 15px; }
.content p { margin: 0 0 .75rem; }
.content p:last-child { margin-bottom: 0; }
.content .prose ul, .content .prose ol { padding-inline-start: 1.4em; margin: 0 0 .75rem; }
.content .prose ul { list-style: disc; }
.content .prose ol { list-style: decimal; }
.content .prose { font-size: 15px; line-height: 2; color: var(--c-text-2); }
body { font-feature-settings: "kern" 1, "ss01"; } /* ارقام فارسی در متن */
.ltr-inline, [dir="ltr"], input, textarea, code, kbd, .mono, .share-box input { font-feature-settings: "kern" 1; } /* نشانی، کد و ورودی: ارقام لاتین واقعی */
svg:not(.icon):not(.brand-mark) { display: inline-block; vertical-align: middle; }

/* ---------- ابزارهای قدیمی ---------- */
.flex { display: flex; align-items: center; gap: 10px; min-width: 0; }
.between { justify-content: space-between; }
.wrap { flex-wrap: wrap; }
.muted { color: var(--c-muted); }
.faint { color: var(--c-muted); }
.small { font-size: 13px; line-height: 22px; }
.tnum { font-variant-numeric: tabular-nums; }
.text-center { text-align: center; }
.mt0 { margin-top: 0 !important; } .mb0 { margin-bottom: 0 !important; }
.mt1 { margin-top: 16px; } .mb1 { margin-bottom: 16px; }

/* .row قدیمی (ستون اصلی/کناری) در کنار .row دیزاین‌سیستم */
.row:has(> .col-main), .row:has(> .col-side) { gap: var(--gap); align-items: flex-start; }
.row.stack { flex-direction: row; }
.row > .col-main { flex: 2 1 0; min-width: 0; display: flex; flex-direction: column; gap: var(--gap); }
.row > .col-side { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; gap: var(--gap); }
.stack > * + * { margin-top: 0; }

/* ---------- سرصفحه ---------- */
.page-head { margin-bottom: var(--gap); }
.page > .page-head, .page-head.in-card { margin-bottom: 0; }
.page-head > h1, .page-head > h2, .page-head > div > h2, .page-head .page-title {
  font-size: var(--fs-h1); line-height: var(--lh-h1); font-weight: 700; margin: 0;
}
.page-head > .flex, .page-head > div:last-child:not(.page-head-text):not(:only-child) { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.page-head .btn-secondary, .page-head > .flex > .btn:not(.btn-primary):not(.btn-ghost):not(.btn-danger):not(.btn-danger-soft):not(.btn-soft),
.page-head > a.btn:not(.btn-primary):not(.btn-ghost), .page-head > button.btn:not(.btn-primary):not(.btn-ghost) {
  --btn-bg: var(--c-surface); --btn-bg-hover: var(--c-surface-2); --btn-bg-active: var(--c-surface-3); --btn-border: var(--c-border);
}
div.breadcrumb { font-size: 13px; color: var(--c-muted); margin-bottom: 4px; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
div.breadcrumb a { color: var(--c-muted); border-radius: 6px; padding: 2px 4px; margin: -2px -4px; }
div.breadcrumb a:hover { color: var(--c-primary-text); background: var(--c-surface-3); }

/* ---------- کارت ---------- */
.card-head h2, .card-head h3, .card-head h4 { font-size: 18px; line-height: 28px; font-weight: 700; margin: 0; }
.card-head .small { margin: 0; }
.card-flat { box-shadow: none; }
.card > .card-head:last-child { margin-bottom: 0; }

/* ---------- دکمه‌ها ---------- */
.btn-accent { --btn-bg: var(--c-warning-soft); --btn-bg-hover: color-mix(in srgb, var(--c-warning-soft) 70%, #F59E0B 30%); --btn-bg-active: var(--btn-bg-hover); --btn-fg: var(--c-warning); --btn-border: var(--c-warning-border); }
.btn-ok, .btn-success { --btn-bg: var(--c-success); --btn-bg-hover: #0F6B3A; --btn-bg-active: #0B5A30; --btn-fg: #fff; }
.btn > svg:not(.icon) { width: 18px; height: 18px; }
.icon-btn {
  width: 44px; height: 44px; border-radius: var(--r-md);
  display: inline-grid; place-items: center;
  background: var(--c-surface-2); color: var(--c-text-2);
  transition: background-color var(--t-fast) ease;
}
.icon-btn:hover { background: var(--c-surface-3); color: var(--c-text); }
.icon-del {
  width: 36px; height: 36px; border-radius: 10px; display: inline-grid; place-items: center;
  background: transparent; color: var(--c-muted); cursor: pointer; font-size: 14px;
  transition: background-color var(--t-fast) ease, color var(--t-fast) ease;
}
.icon-del:hover { background: var(--c-danger-soft); color: var(--c-danger); }

/* ---------- فرم ---------- */
.field { margin-bottom: var(--sp-4); }
.field:last-child, .stack > .field, .form-grid > .field, .filter-bar .field,
.stack > .grid-2 > .field, .stack > .grid-3 > .field, .modal-body.stack > .grid-2 > .field { margin-bottom: 0; }
.field > label:not(.check):not(.switch):not(.choice-card) {
  display: inline-flex; align-items: center; gap: var(--sp-1);
  font-size: 14px; line-height: 22px; font-weight: 600; color: var(--c-text);
}
.hint { font-size: var(--fs-xs); line-height: var(--lh-xs); color: var(--c-muted); }
select.select, textarea.textarea, input.select { /* ورودی‌های بومی با کلاس قدیمی */
  display: block; width: 100%; height: var(--h-md); padding-inline: 14px;
  border-radius: var(--r-md); border: 1px solid var(--c-border-strong);
  background: var(--c-surface); color: var(--c-text); font-size: 15px; line-height: 24px;
  transition: border-color var(--t-fast) ease, box-shadow var(--t-fast) ease; min-width: 0;
}
textarea.textarea { height: auto; min-height: 112px; padding-block: 10px; resize: vertical; line-height: 26px; }
select.select:hover:not(:disabled):not(:focus), textarea.textarea:hover:not(:disabled):not(:focus) { border-color: var(--c-text-2); }
select.select:focus, textarea.textarea:focus {
  outline: none; border-color: var(--c-primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--c-focus) 60%, transparent);
}
select.input, select.select {
  appearance: none; -webkit-appearance: none; cursor: pointer;
  padding-inline-end: 40px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%23657184' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: left 12px center; background-size: 18px;
}
select[multiple].input, select[multiple].select, select[size].input { height: auto; padding-block: 6px; background-image: none; padding-inline-end: 14px; }
.input[type="file"] { height: auto; padding: 8px; font-size: 14px; }
.input[type="file"]::file-selector-button {
  font: inherit; font-weight: 600; font-size: 14px; border: 0; border-radius: 10px;
  height: 34px; padding-inline: 14px; margin-inline-end: 12px;
  background: var(--c-primary-soft); color: var(--c-primary-text); cursor: pointer;
}
.input[type="color"] { padding: 4px; width: 64px; }
input[dir="ltr"].input, textarea[dir="ltr"].input { text-align: left; }

/* چک‌باکس/رادیوی قدیمی (input داخل .check) = .cb / .rb دیزاین‌سیستم */
.check { padding: 4px 0; align-items: center; }
.check > input[type="checkbox"], .check > input[type="radio"],
input[type="checkbox"].cb-auto, .perm-grid input[type="checkbox"] {
  appearance: none; -webkit-appearance: none; flex-shrink: 0;
  width: 20px; height: 20px; margin: 0;
  border: 1.5px solid var(--c-border-strong);
  background: var(--c-surface) no-repeat center / 14px 14px;
  cursor: pointer; transition: background-color var(--t-fast) ease, border-color var(--t-fast) ease;
}
.check > input[type="checkbox"], .perm-grid input[type="checkbox"] { border-radius: 6px; }
.check > input[type="radio"] { border-radius: 50%; }
.check > input:hover { border-color: var(--c-primary); }
.check > input[type="checkbox"]:checked, .perm-grid input[type="checkbox"]:checked {
  background-color: var(--c-primary); border-color: var(--c-primary);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E");
}
.check > input[type="radio"]:checked { border-color: var(--c-primary); border-width: 6px; }

/* سوییچ قدیمی (label.switch > input + .switch-track) */
label.switch {
  width: auto; height: auto; background: none; border-radius: 0;
  display: inline-flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; font-size: 13px;
}
label.switch::after { content: none; }
label.switch > input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
label.switch .switch-track {
  position: relative; width: 44px; height: 24px; border-radius: var(--r-full);
  background: var(--c-border-strong); transition: background-color var(--t-med) var(--ease); flex-shrink: 0;
}
label.switch .switch-dot {
  position: absolute; top: 2px; inset-inline-start: 2px; width: 20px; height: 20px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 3px rgba(15, 23, 42, .25); transition: inset-inline-start var(--t-med) var(--ease);
}
label.switch > input:checked + .switch-track { background: var(--c-primary); }
label.switch > input:checked + .switch-track .switch-dot { inset-inline-start: 22px; }
label.switch > input:focus-visible + .switch-track { outline: 3px solid var(--c-focus); outline-offset: 2px; }
label.switch .switch-lbl { color: var(--c-muted); font-weight: 600; min-width: 44px; }

/* سگمنت قدیمی (div.seg > label.seg-item) = .segmented دیزاین‌سیستم */
div.seg {
  display: inline-flex; gap: 4px; padding: 4px; height: auto; min-width: 0;
  background: var(--c-surface-3); border-radius: var(--r-md); flex-wrap: wrap;
}
div.seg:hover { background: var(--c-surface-3); }
.seg-item {
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 36px; padding-inline: 14px; border-radius: 9px; cursor: pointer;
  font-size: 14px; font-weight: 600; color: var(--c-text-2);
  transition: background-color var(--t-fast) ease, color var(--t-fast) ease;
}
.seg-item input { position: absolute; opacity: 0; width: 0; height: 0; }
.seg-item:hover { background: color-mix(in srgb, var(--c-surface) 60%, transparent); }
.seg-item.sel { background: var(--c-primary); color: var(--c-on-primary); }

/* ---------- نشان وضعیت (pill قدیمی = badge) ---------- */
.pill {
  --b-bg: var(--c-surface-3); --b-fg: var(--c-text-2); --b-bd: transparent;
  display: inline-flex; align-items: center; gap: 6px;
  height: 26px; padding-inline: 10px; border-radius: var(--r-full);
  border: 1px solid var(--b-bd); background: var(--b-bg); color: var(--b-fg);
  font-size: 12px; font-weight: 600; line-height: 1; white-space: nowrap;
}
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill-ok { --b-bg: var(--c-success-soft); --b-fg: var(--c-success); --b-bd: var(--c-success-border); }
.pill-warn { --b-bg: var(--c-warning-soft); --b-fg: var(--c-warning); --b-bd: var(--c-warning-border); }
.pill-danger { --b-bg: var(--c-danger-soft); --b-fg: var(--c-danger); --b-bd: var(--c-danger-border); }
.pill-info { --b-bg: var(--c-info-soft); --b-fg: var(--c-info); --b-bd: var(--c-info-border); }
.pill-muted { --b-bg: var(--c-surface-3); --b-fg: var(--c-text-2); }
.chip:not(:has(.chip-remove)) { padding-inline: 10px; height: 26px; font-size: 12px; }
.chip-ok { background: var(--c-success-soft); color: var(--c-success); }
.chip-warn { background: var(--c-warning-soft); color: var(--c-warning); }
.chip-none, .chip-more { background: var(--c-surface-3); color: var(--c-text-2); }
.tag { display: inline-flex; align-items: center; height: 22px; padding-inline: 8px; border-radius: var(--r-full); font-size: 11px; font-weight: 600; background: var(--c-folder-soft); color: #5B54C9; }
:root[data-theme="dark"] .tag { color: #C4C0FF; }
.nav-badge { display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding-inline: 6px; border-radius: var(--r-full); background: var(--c-danger); color: #fff; font-size: 11px; font-weight: 700; line-height: 1; margin-inline-start: auto; }

/* ---------- جدول قدیمی (.tbl = .table) ---------- */
table.tbl { width: 100%; font-size: var(--fs-sm); line-height: var(--lh-sm); }
.tbl th {
  height: 44px; padding: 0 16px; text-align: start; white-space: nowrap;
  color: var(--c-muted); font-size: 13px; font-weight: 600;
  border-bottom: 1px solid var(--c-border); background: var(--c-surface);
}
.tbl td { height: 56px; padding: 10px 16px; border-bottom: 1px solid var(--c-divider); vertical-align: middle; overflow-wrap: normal; word-break: normal; }
.tbl tbody tr { transition: background-color var(--t-fast) ease; }
.tbl tbody tr:hover { background: var(--c-surface-2); }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl td.num, .tbl .is-num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.tbl .text-center { text-align: center; }
.card > .table-wrap:only-child, .card > .tbl { margin-inline: -8px; }
.table-wrap { border-radius: 0; }
.empty-cell { text-align: center; padding: 40px 16px !important; color: var(--c-muted); height: auto !important; }

/* ---------- شاخص‌ها (.stat-grid > .stat قدیمی = کارت شاخص) ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: var(--gap); margin-bottom: var(--gap); }
.stat-grid > .stat, a.stat {
  position: relative;
  display: grid; grid-template-columns: minmax(0, 1fr) 44px; column-gap: 12px; row-gap: 6px; align-items: center;
  background: var(--c-surface); border-radius: var(--r-xl); padding: 18px 20px;
  box-shadow: var(--shadow-card); color: var(--c-text); min-width: 0;
  transition: background-color var(--t-fast) ease;
}
:root[data-theme="dark"] .stat-grid > .stat { border: 1px solid var(--c-border); }
a.stat:hover { background: var(--c-surface-2); }
.stat-grid > .stat::before, a.stat::before {
  content: ""; grid-column: 2; grid-row: 1; width: 44px; height: 44px; border-radius: var(--r-md);
  background-color: var(--c-primary-soft);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%231D4ED8' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 3v16a2 2 0 0 0 2 2h16'/%3E%3Cpath d='M18 17V9'/%3E%3Cpath d='M13 17V5'/%3E%3Cpath d='M8 17v-3'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: center; background-size: 22px;
}
.stat-grid > .stat.ok::before, a.stat.ok::before {
  background-color: var(--c-success-soft);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23137A43' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cpath d='m9 12 2 2 4-4'/%3E%3C/svg%3E");
}
.stat-grid > .stat.danger::before, a.stat.danger::before {
  background-color: var(--c-danger-soft);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23B42318' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cline x1='12' x2='12' y1='8' y2='12'/%3E%3Cline x1='12' x2='12.01' y1='16' y2='16'/%3E%3C/svg%3E");
}
.stat-grid > .stat.accent::before, a.stat.accent::before {
  background-color: var(--c-warning-soft);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2392400E' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cpolyline points='12 6 12 12 16 14'/%3E%3C/svg%3E");
}
.stat .lbl { grid-column: 1; grid-row: 1; color: var(--c-muted); font-size: 13px; font-weight: 500; line-height: 20px; }
.stat .val { grid-column: 1 / -1; grid-row: 2; font-size: clamp(20px, 1.7vw, 26px); line-height: 1.4; font-weight: 700; font-variant-numeric: tabular-nums; min-width: 0; white-space: nowrap; }
.stat .val small, .stat .val span { font-size: 13px; font-weight: 500; color: var(--c-muted); }
.stat > :not(.val):not(.lbl) { grid-column: 1 / -1; }

/* ---------- هشدار قدیمی (متن ساده داخل .alert) ---------- */
.alert:not(:has(> .alert-body)) { display: block; }
.alert-warn { --a-bg: var(--c-warning-soft); --a-fg: var(--c-warning); --a-bd: var(--c-warning-border); }
.alert-ok { --a-bg: var(--c-success-soft); --a-fg: var(--c-success); --a-bd: var(--c-success-border); }
.alert b, .alert strong { color: var(--c-text); }

/* ---------- حالت خالی ---------- */
.empty { min-height: 0; padding: 40px 20px; color: var(--c-muted); font-size: 14px; }
.empty:not(:has(.empty-icon))::before {
  content: ""; width: 64px; height: 64px; border-radius: 20px; margin-bottom: 8px;
  background-color: var(--c-surface-2);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23657184' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='22 12 16 12 14 15 10 15 8 12 2 12'/%3E%3Cpath d='M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: center; background-size: 28px;
}
.empty > svg:not(.icon) { display: none; }
td.empty { display: table-cell; text-align: center; }
td.empty::before { display: block; margin: 0 auto 8px; }

/* ---------- نوار پیشرفت قدیمی ---------- */
.progress > span { display: block; height: 100%; border-radius: inherit; background: var(--c-primary); transition: width var(--t-med) ease; }

/* ---------- مودال قدیمی (.modal-overlay > .modal) = Modal دیزاین‌سیستم ---------- */
.modal-overlay {
  position: fixed; inset: 0; z-index: var(--z-dialog);
  display: none; align-items: center; justify-content: center;
  padding: 16px; overflow-y: auto; background: var(--backdrop);
}
.modal-overlay.open { display: flex; animation: fade-in var(--t-med) ease; }
.modal-overlay > .modal { width: min(560px, 100%); margin: auto; }
.modal-overlay > .modal.modal-lg { width: min(720px, 100%); }
.modal-overlay > .modal.modal-xl { width: min(980px, 100%); }
.modal-overlay > .modal.modal-sm { width: min(420px, 100%); }
.modal > form { display: flex; flex-direction: column; min-height: 0; flex: 1 1 auto; }
.modal-head { align-items: center; padding: 22px 24px 10px; }
.modal-head > h3, .modal-head > h2 { flex: 1; min-width: 0; font-size: 20px; line-height: 30px; font-weight: 700; margin: 0; }
.modal-close { font-size: 16px; margin: 0; }
.modal-body { color: var(--c-text); font-size: 14px; line-height: 24px; }
.modal-body.stack { display: flex; flex-direction: column; gap: var(--sp-4); }
.modal-foot { padding: 16px 24px 24px; gap: 10px; }
.modal .filter-bar { grid-template-columns: 1fr 1fr; }
@media (max-width: 599px) {
  .modal-overlay { padding: 0; align-items: flex-end; }
  .modal-overlay > .modal { width: 100%; margin: 0; border-radius: var(--r-2xl) var(--r-2xl) 0 0; }
  .modal .filter-bar { grid-template-columns: 1fr; }
}

/* ---------- فیلتر ---------- */
.filter-bar { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; align-items: end; }
.filter-btn { position: relative; }
.filter-btn .fcount {
  position: absolute; top: -7px; inset-inline-end: -7px; min-width: 20px; height: 20px; padding: 0 5px;
  border-radius: var(--r-full); background: var(--c-primary); color: #fff;
  font-size: 11px; font-weight: 700; display: grid; place-items: center; border: 2px solid var(--c-surface);
}

/* ---------- آواتار ---------- */
.avatar[style*="background-image"] { background-size: cover; background-position: center; }
.avatar-lg.is-profile { --av: 96px; border-radius: 28px; font-size: 38px; margin: 0 auto; box-shadow: 0 0 0 6px var(--c-surface-2); }
span.avatar-xs { --av: 24px; }

/* ---------- لینک کوتاه / اشتراک ---------- */
.share-box { display: flex; gap: 6px; align-items: center; background: var(--c-surface-2); border: 1px solid var(--c-border); border-radius: var(--r-md); padding: 4px 4px 4px 10px; font-size: 13px; }
.share-box input { border: 0; background: none; flex: 1; min-width: 0; color: var(--c-text); font: inherit; direction: ltr; text-align: left; outline: none; }

/* ---------- نمودار میله‌ای ساده ---------- */
.barchart { display: flex; align-items: flex-end; gap: 12px; height: 200px; padding-top: 16px; }
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; min-width: 0; }
.bar { width: 100%; max-width: 48px; border-radius: 8px 8px 3px 3px; background: var(--chart-1); min-height: 3px; transition: height .4s ease; }
.bar.accent { background: var(--chart-2); }
.bar-val { font-size: 12px; font-weight: 700; font-variant-numeric: tabular-nums; }
.bar-lbl { font-size: 12px; color: var(--c-muted); text-align: center; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }

/* ---------- نمودارهای داشبورد ---------- */
.line-chart { width: 100%; }
.line-chart svg { display: block; overflow: visible; }
.line-labels { display: flex; justify-content: space-between; margin-top: 10px; padding: 0 4px; direction: ltr; }
.line-lbl { display: flex; flex-direction: column; align-items: center; gap: 2px; flex: 1; text-align: center; }
.line-lbl-m { font-size: 12px; color: var(--c-text-2); font-weight: 600; }
.line-lbl-v { font-size: 11px; color: var(--c-muted); }
.income-chart { display: flex; align-items: flex-end; gap: 10px; height: 190px; padding-top: 22px; }
.income-col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 6px; height: 100%; min-width: 0; }
.income-bar { width: 100%; max-width: 44px; border-radius: 8px 8px 3px 3px; min-height: 4px; background: var(--chart-1); transition: filter .2s; }
.income-col:last-child .income-bar { background: var(--chart-2); }
.income-bar:hover { filter: brightness(1.1); }
.income-val { font-size: 11px; font-weight: 700; color: var(--c-text-2); font-variant-numeric: tabular-nums; white-space: nowrap; }
.income-lbl { font-size: 12px; color: var(--c-muted); font-weight: 600; }
.donut-wrap { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }
.donut { display: block; width: 136px; height: 136px; border-radius: 50%; position: relative; flex-shrink: 0; margin: 0 auto; }
.donut::after { content: ""; position: absolute; inset: 22px; border-radius: 50%; background: var(--c-surface); }
.donut .donut-total { position: absolute; inset: 0; display: grid; place-items: center; z-index: 1; font-weight: 700; font-size: 26px; line-height: 1; font-variant-numeric: tabular-nums; }
.legend { display: flex; flex-direction: column; gap: 10px; flex: 1; min-width: 150px; }
.legend-item { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.legend-dot { width: 12px; height: 12px; border-radius: 4px; flex-shrink: 0; }
.legend-item .n { margin-inline-start: auto; font-weight: 700; font-variant-numeric: tabular-nums; }
.hbar { display: flex; height: 12px; border-radius: var(--r-full); overflow: hidden; background: var(--c-surface-3); gap: 2px; }
.hbar > span { display: block; height: 100%; }
.hbar-legend { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 10px; }
.hbar-legend .legend-item { font-size: 12px; }
@media (max-width: 767px) { .income-chart { height: 150px; } .income-val { font-size: 10px; } }

/* ---------- داشبورد مشتری ---------- */
.dash-hello { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: var(--gap); }
.dash-hello h2 { margin: 0 0 2px; font-size: var(--fs-h1); line-height: var(--lh-h1); }
.dash-hello p { margin: 0; color: var(--c-muted); }
.dash-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: var(--gap); margin-bottom: var(--gap); }
.dash-kpis .kpi {
  display: flex; align-items: center; gap: 14px;
  background: var(--c-surface); border-radius: var(--r-xl); padding: 18px 20px;
  box-shadow: var(--shadow-card); color: var(--c-text); transition: background-color var(--t-fast) ease;
}
:root[data-theme="dark"] .dash-kpis .kpi { border: 1px solid var(--c-border); }
.dash-kpis .kpi:hover { background: var(--c-surface-2); }
.kpi-ico { width: 44px; height: 44px; border-radius: var(--r-md); flex-shrink: 0; display: grid; place-items: center; font-size: 20px; background: var(--c-primary-soft); color: var(--c-primary-text); }
.kpi-ico-ok { background: var(--c-success-soft); color: var(--c-success); }
.kpi-ico-danger { background: var(--c-danger-soft); color: var(--c-danger); }
.kpi-txt { display: flex; flex-direction: column; min-width: 0; }
.kpi-txt b { font-size: 24px; font-weight: 700; line-height: 34px; font-variant-numeric: tabular-nums; }
.kpi-txt span { font-size: 13px; color: var(--c-muted); font-weight: 500; }
.kpi-alert b { color: var(--c-danger); }
.dash-grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: var(--gap); align-items: start; }
.dash-col { display: flex; flex-direction: column; gap: var(--gap); min-width: 0; }
.dash-col > .card { margin: 0; }
.card-more { font-size: 13px; }
.dash-list { display: flex; flex-direction: column; }
.dash-item { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--c-divider); color: inherit; }
.dash-item:last-child { border-bottom: 0; padding-bottom: 0; }
a.dash-item:hover .di-title { color: var(--c-primary-text); }
.di-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.di-title { font-weight: 600; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.di-sub { font-size: 12px; color: var(--c-muted); }
.di-date { font-size: 12px; color: var(--c-text-2); font-weight: 600; flex-shrink: 0; }
.di-prog { display: flex; align-items: center; gap: 8px; flex-shrink: 0; width: 140px; }
.di-prog .progress { flex: 1; }
.di-pct { font-size: 12px; font-weight: 700; color: var(--c-text-2); min-width: 34px; text-align: left; }
.quick-card { background: linear-gradient(160deg, #1D4ED8 0%, #2563EB 45%, #6D5DF6 100%); color: #fff; }
.quick-card h3 { color: #fff; margin: 0 0 6px; font-size: 17px; }
.quick-card p { font-size: 13px; line-height: 24px; color: rgba(255,255,255,.88); margin: 0; }
.quick-card .input { background: rgba(255,255,255,.97); color: #20252C; border-color: transparent; }
.quick-card .input:focus { box-shadow: 0 0 0 3px rgba(255,255,255,.35); }
.svc-card { position: relative; overflow: hidden; background: linear-gradient(160deg, #1D4ED8 0%, #2563EB 45%, #6D5DF6 100%); color: #fff; }
.svc-card::after { content: ""; position: absolute; top: -60px; inset-inline-start: -50px; width: 190px; height: 190px; border-radius: 50%; background: rgba(255,255,255,.08); pointer-events: none; }
.svc-card > * { position: relative; z-index: 1; }
.svc-kicker { display: inline-block; font-size: 11px; font-weight: 700; background: rgba(255,255,255,.16); border-radius: var(--r-full); padding: 3px 10px; margin-bottom: 10px; }
.svc-card h3 { color: #fff; margin-bottom: 6px; font-size: 17px; }
.svc-card p { font-size: 13px; line-height: 24px; color: rgba(255,255,255,.9); }
.svc-tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0 14px; }
.svc-tags span { font-size: 12px; font-weight: 600; background: rgba(255,255,255,.14); border: 1px solid rgba(255,255,255,.22); border-radius: var(--r-full); padding: 3px 10px; }
.svc-cta { display: inline-flex; align-items: center; justify-content: center; gap: 6px; width: 100%; height: 44px; background: #fff; color: #1D4ED8; font-weight: 700; font-size: 14px; border-radius: var(--r-md); }
.svc-cta:hover { background: #F4F6F9; }
.svc-cta svg { width: 16px; height: 16px; }
.svc-banner { display: flex; align-items: center; gap: 24px; }
.svc-banner-txt { flex: 1; min-width: 0; }
.svc-banner .svc-tags { margin-bottom: 0; }
.svc-cta-inline { width: auto; flex-shrink: 0; white-space: nowrap; padding-inline: 18px; }
@media (max-width: 900px) { .dash-grid { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 700px) { .svc-banner { flex-direction: column; align-items: stretch; } .svc-cta-inline { width: 100%; } }
@media (max-width: 520px) {
  .dash-kpis { grid-template-columns: 1fr 1fr; gap: 10px; }
  .dash-kpis .kpi { padding: 14px; gap: 10px; flex-direction: column; align-items: flex-start; }
  .kpi-txt b { font-size: 20px; line-height: 28px; }
  .di-prog { width: 96px; }
}

/* باکس‌های خلاصه (فاکتور مشتری) */
.stat-boxes { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--gap); margin-bottom: var(--gap); }
.stat-box { background: var(--c-surface); border-radius: var(--r-xl); padding: 18px 20px; display: flex; align-items: center; gap: 14px; box-shadow: var(--shadow-card); }
:root[data-theme="dark"] .stat-box { border: 1px solid var(--c-border); }
.stat-ic { font-size: 20px; width: 44px; height: 44px; display: grid; place-items: center; border-radius: var(--r-md); background: var(--c-primary-soft); color: var(--c-primary-text); flex-shrink: 0; }
.stat-body { min-width: 0; }
.stat-box .stat-label { margin-bottom: 2px; }
.stat-box .stat-value { font-size: 20px; line-height: 30px; }
.stat-box .stat-value span { font-size: 12px; font-weight: 500; color: var(--c-muted); }
.stat-paid .stat-ic { background: var(--c-success-soft); color: var(--c-success); }
.stat-debt .stat-ic { background: var(--c-warning-soft); color: var(--c-warning); }
.stat-count .stat-ic { background: var(--c-danger-soft); color: var(--c-danger); }
@media (max-width: 1199px) { .stat-boxes { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 520px) { .stat-boxes { grid-template-columns: minmax(0, 1fr); } }

/* ---------- تقویم محتوا ---------- */
.cal-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: var(--gap); flex-wrap: wrap; }
.cal-nav-btn { width: 44px; height: 44px; border-radius: var(--r-md); background: var(--c-surface); color: var(--c-text-2); cursor: pointer; display: grid; place-items: center; font-size: 18px; transition: background-color var(--t-fast) ease; flex-shrink: 0; border: 1px solid var(--c-border); }
.cal-nav-btn:hover { background: var(--c-surface-2); color: var(--c-primary-text); }
.cal-month { text-align: center; }
.cal-month .m { font-size: 20px; font-weight: 700; }
.cal-month .y { font-size: 12px; color: var(--c-muted); font-weight: 500; margin-top: 1px; }
.cal-today-btn { font-size: 13px; }
.cal-board { background: var(--c-surface); border-radius: var(--r-xl); padding: 16px; overflow: hidden; box-shadow: var(--shadow-card); }
:root[data-theme="dark"] .cal-board { border: 1px solid var(--c-border); }
.cal-weekdays { display: grid; grid-template-columns: repeat(7, 1fr); margin-bottom: 8px; }
.cal-weekdays > div { text-align: center; font-size: 12px; color: var(--c-muted); font-weight: 600; padding: 6px 0; }
.cal-weekdays .fri { color: var(--c-danger); }
.cal-days { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; }
.cal-day { position: relative; min-height: 108px; border-radius: var(--r-md); border: 1px solid var(--c-border); background: var(--c-surface-2); padding: 8px; display: flex; flex-direction: column; gap: 4px; transition: border-color var(--t-fast) ease, background-color var(--t-fast) ease; overflow: hidden; }
.cal-day.has-ev { background: var(--c-surface); }
.cal-day.has-ev:hover { border-color: var(--c-border-strong); }
.cal-day.other { opacity: .45; }
.cal-day.today { border-color: var(--c-primary); box-shadow: 0 0 0 2px var(--c-primary-soft); background: var(--c-surface); }
.cal-day.fri-day { background: color-mix(in srgb, var(--c-danger-soft) 45%, var(--c-surface-2)); }
.cal-daynum { font-size: 13px; font-weight: 700; color: var(--c-text-2); display: flex; align-items: center; justify-content: space-between; }
.cal-day.today .cal-daynum .num { background: var(--c-primary); color: #fff; width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; font-size: 12px; }
.cal-daynum .cnt { font-size: 11px; color: var(--c-muted); font-weight: 500; }
.cal-chip { font-size: 11px; padding: 3px 7px; border-radius: 7px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: flex; align-items: center; gap: 4px; border-inline-start: 3px solid var(--c-primary); background: var(--c-primary-soft); color: var(--c-primary-text); }
.cal-chip.done { border-inline-start-color: var(--c-success); background: var(--c-success-soft); color: var(--c-success); }
.cal-chip.fix { border-inline-start-color: var(--c-danger); background: var(--c-danger-soft); color: var(--c-danger); }
.cal-chip.progress { height: auto; overflow: hidden; border-inline-start-color: #F59E0B; background: var(--c-warning-soft); color: var(--c-warning); }
.cal-chip .t { overflow: hidden; text-overflow: ellipsis; }
.cal-more { font-size: 11px; color: var(--c-primary-text); font-weight: 600; }
.cal-dots { display: none; gap: 3px; margin-top: auto; flex-wrap: wrap; }
.cal-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--c-primary); }
.cal-dot.done { background: var(--c-success); }
.cal-dot.fix { background: var(--c-danger); }
.cal-dot.progress { background: #F59E0B; height: 6px; }
.cal-legend { display: flex; gap: 18px; flex-wrap: wrap; margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--c-divider); }
.cal-legend .item { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--c-text-2); }
.cal-legend .swatch { width: 12px; height: 12px; border-radius: 4px; padding: 0; border: 0; display: inline-block; }
.agenda { margin-top: var(--gap); }
.agenda-item { display: flex; gap: 16px; padding: 14px 0; border-bottom: 1px solid var(--c-divider); }
.agenda-item:last-child { border-bottom: 0; }
.agenda-cal { flex-shrink: 0; width: 60px; text-align: center; background: var(--c-surface-2); border-radius: var(--r-md); padding: 8px 0; }
.agenda-cal .dd { font-size: 22px; font-weight: 700; color: var(--c-primary-text); line-height: 1; }
.agenda-cal .ww { font-size: 11px; color: var(--c-muted); margin-top: 4px; }
.agenda-cal.today { background: var(--c-primary); }
.agenda-cal.today .dd, .agenda-cal.today .ww { color: #fff; }
.agenda-list { flex: 1; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.agenda-card { display: flex; align-items: center; justify-content: space-between; gap: 12px; background: var(--c-surface-2); border-radius: var(--r-md); padding: 10px 14px; flex-wrap: wrap; }
.agenda-card .info { min-width: 0; }
.agenda-card .ttl { font-weight: 600; font-size: 14px; }
.agenda-card .sub { font-size: 12px; color: var(--c-muted); margin-top: 2px; }
@media (max-width: 720px) {
  .cal-board { padding: 10px; border-radius: var(--r-lg); }
  .cal-days { gap: 4px; }
  .cal-day { min-height: 54px; padding: 5px; border-radius: 10px; gap: 2px; }
  .cal-chip, .cal-more { display: none; }
  .cal-dots { display: flex; }
  .cal-daynum { font-size: 12px; }
  .cal-daynum .cnt { display: none; }
  .cal-day.today .cal-daynum .num { width: 22px; height: 22px; font-size: 11px; }
  .cal-weekdays > div { font-size: 11px; }
}

/* ---------- دیت‌پیکر شمسی (هم‌شکل .dp دیزاین‌سیستم) ---------- */
.jdp {
  position: absolute; z-index: 75; width: 312px; /* بالاتر از مودال (۵۰) تا داخل فرم‌های مودالی هم دیده شود */
  background: var(--c-surface); border: 1px solid var(--c-border);
  border-radius: var(--r-lg); box-shadow: var(--shadow-pop); padding: 12px; user-select: none;
  animation: pop-in var(--t-med) var(--ease);
}
.jdp-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.jdp-title { font-weight: 700; font-size: 15px; background: none; border: 0; color: var(--c-text); cursor: pointer; padding: 4px 10px; border-radius: 10px; }
.jdp-title:hover { background: var(--c-surface-3); }
.jdp-sec { font-size: 12px; color: var(--c-muted); font-weight: 600; margin: 10px 0 6px; }
.jdp-months, .jdp-years { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; }
.jdp-m, .jdp-y { height: 36px; border-radius: 10px; border: 0; background: var(--c-surface-2); color: var(--c-text-2); font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; font-variant-numeric: tabular-nums; }
.jdp-m:hover, .jdp-y:hover { background: var(--c-surface-3); }
.jdp-m.on, .jdp-y.on { background: var(--c-primary); color: #fff; }
.jdp-nav { width: 36px; height: 36px; border-radius: 10px; border: 0; background: transparent; cursor: pointer; display: grid; place-items: center; color: var(--c-text-2); font-size: 16px; }
.jdp-nav:hover { background: var(--c-surface-3); color: var(--c-text); }
.jdp-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.jdp-dow { text-align: center; font-size: 12px; color: var(--c-muted); height: 32px; display: grid; place-items: center; font-weight: 600; }
.jdp-day { height: 38px; display: grid; place-items: center; border-radius: 10px; cursor: pointer; font-size: 14px; font-variant-numeric: tabular-nums; }
.jdp-day:hover { background: var(--c-surface-3); }
.jdp-day.empty { visibility: hidden; padding: 0; min-height: 0; }
.jdp-day.empty::before { content: none; }
.jdp-day.today { box-shadow: inset 0 0 0 1.5px var(--c-primary); font-weight: 700; }
.jdp-day.selected { background: var(--c-primary); color: #fff; }
.jdp-foot { display: flex; justify-content: space-between; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--c-divider); }
.jdp-foot button { background: none; border: 0; color: var(--c-primary-text); cursor: pointer; font: inherit; font-weight: 600; font-size: 13px; padding: 4px 8px; border-radius: 8px; }
.jdp-foot button:hover { background: var(--c-surface-3); }
@media (max-width: 767px) { .jdp { width: min(92vw, 312px); } }

/* ---------- آکاردئون سوالات متداول ---------- */
.faq-item { border-bottom: 1px solid var(--c-divider); }
.faq-item summary { cursor: pointer; padding: 14px 4px; font-weight: 600; list-style: none; display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after { content: ""; width: 20px; height: 20px; flex-shrink: 0; background: var(--c-muted); transition: transform var(--t-med) var(--ease);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") center / contain no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") center / contain no-repeat; }
.faq-item[open] summary::after { transform: rotate(180deg); }
.faq-item summary:hover { color: var(--c-primary-text); }
.faq-answer { padding: 0 4px 14px; color: var(--c-text-2); line-height: 2; }

/* ---------- دسترسی‌ها ---------- */
.perm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px 12px; padding: 12px; background: var(--c-surface-2); border-radius: var(--r-md); }
.perm-grid .check { display: flex; align-items: center; gap: 8px; margin: 0; cursor: pointer; font-size: 14px; }

/* ---------- پیشنهادها ---------- */
.sug-group { margin-bottom: var(--gap); padding: 0; overflow: hidden; }
.sug-cust { display: flex; align-items: center; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--c-divider); }
.sug-cust .avatar { --av: 40px; }
.sug-cust-info { flex: 1; min-width: 0; }
.sug-cust-name { font-weight: 700; font-size: 15px; }
.sug-badge { background: var(--c-danger); color: #fff; font-size: 11px; font-weight: 700; padding: 4px 10px; border-radius: var(--r-full); flex-shrink: 0; }
.sug-item { padding: 16px 20px; border-bottom: 1px solid var(--c-divider); }
.sug-item:last-child { border-bottom: 0; }
.sug-item-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.sug-title { font-weight: 700; font-size: 15px; }
.sug-pill { display: inline-flex; align-items: center; height: 26px; font-size: 12px; font-weight: 600; padding-inline: 10px; border-radius: var(--r-full); white-space: nowrap; border: 1px solid transparent; }
.sug-new { background: var(--c-surface-3); color: var(--c-text-2); }
.sug-review { background: var(--c-warning-soft); color: var(--c-warning); border-color: var(--c-warning-border); }
.sug-ok { background: var(--c-success-soft); color: var(--c-success); border-color: var(--c-success-border); }
.sug-rej { background: var(--c-danger-soft); color: var(--c-danger); border-color: var(--c-danger-border); }
.sug-body { margin: 8px 0; line-height: 2; color: var(--c-text-2); font-size: 14px; }
.sug-date { margin-bottom: 8px; }
.sug-note { background: var(--c-surface-2); border-radius: var(--r-md); padding: 10px 14px; font-size: 14px; line-height: 1.9; color: var(--c-text-2); margin-bottom: 10px; }
.sug-form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.sug-select { width: auto; min-width: 150px; }
.sug-input { flex: 1; min-width: 200px; }
@media (max-width: 620px) { .sug-form { flex-direction: column; align-items: stretch; } .sug-select, .sug-input { width: 100%; } }

/* ---------- ابزارها ---------- */
.tools-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: var(--gap); }
.tool-card { background: var(--c-surface); border-radius: var(--r-xl); overflow: hidden; display: flex; flex-direction: column; box-shadow: var(--shadow-card); transition: box-shadow var(--t-fast) ease; }
:root[data-theme="dark"] .tool-card { border: 1px solid var(--c-border); }
.tool-card:hover { box-shadow: var(--shadow-pop); }
.tool-top { padding: 24px 20px; display: flex; flex-direction: column; align-items: center; gap: 8px; color: #fff; text-align: center; }
.tool-icon { font-size: 36px; line-height: 1; }
.tool-name { font-weight: 700; font-size: 16px; }
.tool-body { padding: 16px 20px 20px; display: flex; flex-direction: column; flex: 1; }
.tool-desc { color: var(--c-text-2); font-size: 14px; line-height: 1.9; margin: 0 0 16px; flex: 1; }
.tool-btn { display: flex; align-items: center; justify-content: center; height: 44px; color: #fff; border-radius: var(--r-md); font-weight: 600; font-size: 15px; transition: filter var(--t-fast) ease; }
.tool-btn:hover { filter: brightness(1.08); }
@media (max-width: 520px) { .tools-grid { grid-template-columns: 1fr; } }

/* ---------- گالری تصاویر ---------- */
.img-grid a { display: block; border-radius: var(--r-md); overflow: hidden; aspect-ratio: 4/3; background: var(--c-surface-2); }
.img-grid img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* ---------- ورود ---------- */
.auth-tabs { display: flex; gap: 4px; background: var(--c-surface-3); padding: 4px; border-radius: var(--r-md); margin-bottom: 24px; }
.auth-tabs a { flex: 1; display: grid; place-items: center; height: 40px; border-radius: 9px; font-weight: 600; font-size: 14px; color: var(--c-text-2); }
.auth-tabs a:hover { background: color-mix(in srgb, var(--c-surface) 60%, transparent); }
.auth-tabs a.active { background: var(--c-surface); color: var(--c-text); box-shadow: 0 1px 2px rgba(15,23,42,.08); }
.otp-input { text-align: center; letter-spacing: .6em; font-size: 22px !important; font-weight: 700; height: var(--h-lg) !important; }
.auth-brand { display: flex; align-items: center; gap: 12px; }
.auth-brand img { max-height: 48px; width: auto; }
.auth-head h1 { font-size: var(--fs-h1); line-height: var(--lh-h1); font-weight: 700; margin: 0; }
.auth-head p { color: var(--c-muted); margin: 4px 0 0; }
.auth-card .card { padding: 0; box-shadow: none; background: transparent; border: 0; }
.auth-card .field { margin-bottom: var(--sp-4); }

/* ---------- واکنش‌گرایی سازگاری ---------- */
@media (max-width: 1199px) {
  .row:has(> .col-main), .row:has(> .col-side), .row.stack { flex-direction: column; align-items: stretch; }
  .row > .col-main, .row > .col-side { width: 100%; flex: none; }
}
@media (max-width: 767px) {
  .grid-2, .grid-3 { grid-template-columns: minmax(0, 1fr); }
  .page-head { align-items: stretch; flex-direction: column; }
  .page-head > .flex, .page-head > div:last-child:not(.page-head-text):not(:only-child) { width: 100%; }
  .page-head > .btn, .page-head > .flex > .btn, .page-head > a.btn { flex: 1 1 auto; justify-content: center; }
  .page-head > h2, .page-head .page-title { font-size: 22px; line-height: 34px; }
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .stat-grid > .stat { grid-template-columns: minmax(0, 1fr) 36px; padding: 14px; }
  .stat-grid > .stat::before { width: 36px; height: 36px; background-size: 19px; }
  .stat .val { font-size: 18px; }
  .filter-bar { grid-template-columns: 1fr 1fr; }
  .card > .table-wrap:only-child, .card > .tbl { margin-inline: 0; }
}

/* ---------- چاپ ---------- */
@media print {
  .sidebar, .topbar, .flash-wrap, .toast-region, .page-head .btn, .page-actions { display: none !important; }
  .shell { display: block; padding: 0; }
}

/* ---------- AppShell: جزئیات مخصوص CRM ---------- */
.brand-name { direction: rtl; font-size: 20px; letter-spacing: 0; }
.brand-logo-img { object-fit: contain; background: var(--c-surface-2); }
.sb-link .sb-ext { width: 16px; height: 16px; color: var(--c-muted); flex-shrink: 0; }
.sb-link.is-external { color: var(--c-primary-text); }
.tb-title { font-size: 18px; font-weight: 700; padding-inline: 8px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.page-body { min-width: 0; }
.alert > .btn { align-self: center; flex-shrink: 0; }
.cmdk-item { color: var(--c-text); text-decoration: none !important; }
.cmdk-ico { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: var(--c-surface-2); color: var(--c-muted); flex-shrink: 0; }
.cmdk-item.is-active .cmdk-ico { background: var(--c-surface); color: var(--c-primary-text); }
.cmdk-text { display: flex; flex-direction: column; min-width: 0; flex: 1; line-height: 1.5; }
.cmdk-text small { margin: 0; font-size: 12px; color: var(--c-muted); }
.cmdk-input-wrap .spinner { flex-shrink: 0; }
.menu-item > span { min-width: 0; }
@media (max-width: 1199px) { .sb-link .sb-ext { display: none; } }
@media (max-width: 767px) { .sb-link .sb-ext { display: inline; } }

/* انتخابگر فشرده در نوار ابزار (معادل select.is-inline دیزاین‌سیستم برای select بومی) */
.select-inline { width: auto; min-width: 150px; border-color: transparent; background-color: var(--c-surface-3); font-size: 14px; font-weight: 500; }
.select-inline:hover:not(:focus) { background-color: var(--c-surface-3-hover); border-color: transparent !important; }
.toolbar > .btn { flex-shrink: 0; }
@media (max-width: 767px) { .select-inline { width: 100%; min-width: 0; } }
.stat-card > .stat { flex: 1 1 auto; }
.stat-icon.is-danger { background: var(--c-danger-soft); color: var(--c-danger); }

/* ---------- دکمه‌ی ثانویه روی زمینه‌ی صفحه (بیرون از کارت) — مثل .page-actions پنل مرکزی ---------- */
.page-body .btn:not(.btn-primary):not(.btn-ghost):not(.btn-link):not(.btn-danger):not(.btn-danger-soft):not(.btn-soft):not(.btn-accent):not(.btn-outline):not(.btn-ok):not(.btn-success):not(.card .btn):not(.modal .btn):not(.alert .btn):not(.bulk-bar .btn):not(.save-bar .btn):not(.tool-card .btn):not(.cal-board .btn) {
  --btn-bg: var(--c-surface); --btn-bg-hover: var(--c-surface-2); --btn-bg-active: var(--c-surface-3); --btn-border: var(--c-border);
}

/* ---------- تب‌های قدیمی صفحه‌ها = .tabs دیزاین‌سیستم ---------- */
.page-body :is(.ts-tabs, .ct-tabs, .sr-tabs, .mw-tabs, .editor-tabs) {
  display: flex; gap: 4px; padding: 0; border: 0; border-bottom: 1px solid var(--c-border);
  overflow-x: auto; scrollbar-width: none; margin-bottom: var(--gap); background: none;
}
.page-body :is(.ts-tabs, .ct-tabs, .sr-tabs, .mw-tabs, .editor-tabs)::-webkit-scrollbar { display: none; }
.page-body :is(.ts-tab, .ct-tab, .sr-tab, .mw-tab, .ed-tab) {
  position: relative; display: inline-flex; align-items: center; gap: 8px;
  height: 44px; padding: 0 14px; margin: 0; border: 0; border-radius: 10px 10px 0 0; background: none;
  color: var(--c-muted); font-weight: 600; font-size: 14px; white-space: nowrap; box-shadow: none;
}
.page-body :is(.ts-tab, .ct-tab, .sr-tab, .mw-tab, .ed-tab):hover { color: var(--c-text); background: none; }
.page-body :is(.ts-tab, .ct-tab, .sr-tab, .mw-tab, .ed-tab).active { color: var(--c-primary-text); background: none; }
.page-body :is(.ts-tab, .ct-tab, .sr-tab, .mw-tab, .ed-tab).active::after {
  content: ""; position: absolute; inset-inline: 10px; bottom: 0; height: 2px; border-radius: 2px 2px 0 0; background: var(--c-primary);
}
.page-body :is(.ts-tab, .ct-tab, .sr-tab, .mw-tab) > :is(span, b, small) {
  min-width: 22px; height: 20px; padding-inline: 6px; border-radius: var(--r-full);
  background: var(--c-surface-3); color: var(--c-text-2); font-size: 11px; display: inline-grid; place-items: center; font-weight: 600;
}
.page-body :is(.ts-tab, .ct-tab, .sr-tab, .mw-tab).active > :is(span, b, small) { background: var(--c-primary-soft); color: var(--c-primary-text); }

/* فهرست فایل‌های پیوست (فایل گزارش، پیوست‌ها) */
.doc-list { display: flex; flex-direction: column; gap: 8px; }
.doc-item { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--c-border); border-radius: var(--r-md); transition: border-color var(--t-fast) ease; }
.doc-item:hover { border-color: var(--c-border-strong); }
.doc-name { font-weight: 600; font-size: 14px; }

/* صفحه‌های خطا (۴۰۳ / ۴۰۴) */
.error-page { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 24px; }
.error-page > .card { width: min(480px, 100%); }

/* ---------- بنر صفحه‌ی ورود ---------- */
.auth-art { padding: 44px 44px 32px; gap: 28px; justify-content: flex-start; isolation: isolate; }
.auth-art::before, .auth-art::after { content: ""; position: absolute; border-radius: 50%; pointer-events: none; z-index: -1; }
.auth-art::before { width: 420px; height: 420px; top: -160px; inset-inline-start: -140px; background: radial-gradient(circle, rgba(255,255,255,.16), transparent 70%); }
.auth-art::after { width: 360px; height: 360px; bottom: -150px; inset-inline-end: -120px; background: radial-gradient(circle, rgba(167,139,250,.45), transparent 70%); }
.art-top { display: flex; flex-direction: column; gap: 12px; }
.art-kicker { align-self: flex-start; display: inline-flex; align-items: center; gap: 6px; height: 30px; padding-inline: 12px; border-radius: var(--r-full); background: rgba(255,255,255,.16); border: 1px solid rgba(255,255,255,.24); font-size: 13px; font-weight: 600; }
.auth-art h2 { font-size: 28px; line-height: 44px; font-weight: 800; max-width: 460px; }
.auth-art p { opacity: .9; font-size: 15px; line-height: 28px; max-width: 440px; }
.art-ico { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; flex-shrink: 0; background: rgba(255,255,255,.18); color: #fff; }
.art-ico.is-green { background: #DCFCE7; color: #137A43; }
.art-preview { position: relative; display: flex; flex-direction: column; gap: 12px; max-width: 420px; }
.art-card { padding: 18px; border-radius: 20px; background: #fff; color: #20252C; box-shadow: 0 24px 48px rgba(15, 23, 42, .25); }
.art-card-head { display: flex; align-items: center; gap: 12px; }
.art-card-head .art-ico { background: #EAF2FF; color: #1D4ED8; }
.art-card-head strong { display: block; font-size: 15px; }
.art-card-head small { display: block; font-size: 12px; color: #657184; }
.art-pct { font-size: 20px; font-weight: 800; color: #1D4ED8; }
.art-bar { height: 8px; margin: 14px 0 12px; border-radius: 999px; background: #EEF0F4; overflow: hidden; }
.art-bar span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #6D5DF6, #2563EB); }
.art-steps { display: flex; flex-direction: column; gap: 8px; font-size: 13px; }
.art-steps li { display: flex; align-items: center; gap: 8px; color: #3A4250; }
.art-steps li.is-done { color: #657184; }
.art-steps li.is-done .icon { width: 18px; height: 18px; padding: 2px; border-radius: 50%; background: #E7F6EE; color: #137A43; stroke-width: 3; }
.art-steps li.is-now { font-weight: 700; color: #20252C; }
.art-steps li.is-now span { width: 18px; height: 18px; border-radius: 50%; border: 2px solid #2563EB; box-shadow: inset 0 0 0 3px #fff; background: #2563EB; }
.art-toast { display: flex; align-items: center; gap: 12px; align-self: flex-end; margin-top: -26px; margin-inline-end: -16px; max-width: 320px; padding: 12px 14px; border-radius: 16px; background: rgba(255,255,255,.96); color: #20252C; box-shadow: 0 16px 32px rgba(15, 23, 42, .22); }
.art-toast strong { display: block; font-size: 13px; }
.art-toast small { display: block; font-size: 12px; line-height: 20px; color: #657184; }
.art-features { display: flex; flex-direction: column; gap: 14px; margin-top: auto; }
.art-features li { display: flex; align-items: center; gap: 12px; }
.art-features strong { display: block; font-size: 14px; }
.art-features small { display: block; font-size: 13px; opacity: .82; }
.art-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding-top: 18px; border-top: 1px solid rgba(255,255,255,.2); font-size: 13px; opacity: .9; }
.art-foot span, .art-foot a { display: inline-flex; align-items: center; gap: 6px; }
.art-foot a { color: #fff; font-weight: 600; }
.art-foot a:hover { text-decoration: underline; text-underline-offset: 3px; }
@media (max-height: 820px) { .art-preview { display: none; } .art-features { margin-top: 8px; } }
@media (prefers-reduced-motion: no-preference) { .art-preview { animation: page-in .6s var(--ease) both .1s; } }

/* لوگوی سفارشی در سایدبار: فقط لوگو؛ در حالت ریل (تبلت/لپ‌تاپ کوچک) کوچک و وسط‌چین */
.sb-brand:has(.sb-logo) { padding-block: 2px 18px; }
.sb-logo { display: block; width: var(--logo-w, 140px); max-width: 100%; height: auto; max-height: 48px; object-fit: contain; object-position: right center; }
@media (min-width: 768px) and (max-width: 1199px) { .sb-logo { width: 44px; max-height: 44px; object-position: center; } }

/* پنل جزئیات فایل (هم‌رفتار فایل‌منیجر vrna) */
.fd { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 24px; align-items: start; }
.fd-prev { display: grid; place-items: center; min-height: 340px; border-radius: var(--r-lg); background: var(--c-surface-2); overflow: hidden; position: sticky; top: 0; }
.fd-prev img { max-width: 100%; max-height: 60vh; object-fit: contain; }
.fd-prev video { width: 100%; max-height: 60vh; }
.fd-prev.is-pdf { align-self: stretch; place-items: stretch; padding: 0; }
.fd-prev iframe { width: 100%; height: 60vh; border: 0; background: #fff; }
.fd-icon { display: flex; flex-direction: column; align-items: center; gap: 8px; color: var(--c-muted); }
.fd-info { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.fd-info .field { margin: 0; gap: 6px; }
.fd-nolink { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; padding: 10px 12px; border: 1px dashed var(--c-border-strong); border-radius: var(--r-md); }
.fd-dl { grid-template-columns: minmax(80px, auto) 1fr; gap: 8px 14px; font-size: 13px; padding: 14px; border-radius: var(--r-md); background: var(--c-surface-2); }
.fd-vis { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.fd-row { display: flex; gap: 8px; }
.fd-row > .input { flex: 1; min-width: 0; }
.fd-acts { display: flex; gap: 8px; flex-wrap: wrap; padding-top: 14px; border-top: 1px solid var(--c-divider); }
.fd-acts form { display: contents; }
@media (max-width: 767px) { .fd { grid-template-columns: minmax(0, 1fr); } .fd-prev { position: static; min-height: 220px; } }

/* ---------- سایدبار: گروه‌های بازشونده/بسته‌شونده (هم‌رفتار vrna) ---------- */
.sb-group-toggle {
  display: flex; align-items: center; gap: 6px; width: 100%;
  padding: 4px 12px 8px; border-radius: 8px; text-align: start;
  color: var(--c-muted); cursor: pointer; transition: color var(--t-fast) ease;
}
.sb-group-toggle:hover { color: var(--c-text); }
.sb-group-toggle .sb-group-title { padding: 0; flex: 1 1 auto; color: inherit; }
.sb-caret { width: 16px; height: 16px; opacity: .7; transition: transform var(--t-med) var(--ease); }
.sb-group.is-collapsed .sb-caret { transform: rotate(90deg); }
.sb-group-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--c-danger); display: none; }
.sb-group.is-collapsed .sb-group-dot { display: inline-block; }
.sb-list-wrap { display: grid; grid-template-rows: 1fr; transition: grid-template-rows var(--t-slow) var(--ease); }
.sb-list-wrap > .sb-list { min-height: 0; overflow: hidden; }
.sb-group.is-collapsed .sb-list-wrap { grid-template-rows: 0fr; }
.sb-group + .sb-group { margin-top: 10px; }
/* حالت ریل آیکنی (تبلت/لپ‌تاپ کوچک): عنوان گروه دیده نمی‌شود، پس همه‌ی آیتم‌ها باز می‌مانند */
@media (min-width: 768px) and (max-width: 1199px) {
  .sb-group-toggle { display: none; }
  .sb-group.is-collapsed .sb-list-wrap { grid-template-rows: 1fr; }
}
@media (max-width: 767px) { .sb-group-toggle .sb-group-title { display: block; } }

/* ---------- نمودار دونات حلقه‌ای (Helpers::donut) — هم‌شکل داشبورد vrna ---------- */
.dn { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.dn-ring { position: relative; flex: 0 0 auto; }
.dn-ring svg { display: block; }
.dn-ring circle { transition: opacity var(--t-fast) ease; }
.dn-ring:hover circle[stroke-dasharray]:not(:hover) { opacity: .45; }
.dn-c { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; pointer-events: none; }
.dn-c strong { font-size: 22px; line-height: 30px; font-weight: 700; }
.dn-c span { font-size: 11px; color: var(--c-muted); }
.dn-legend { display: flex; flex-direction: column; gap: 10px; flex: 1 1 140px; min-width: 0; }
.dn-legend li { display: grid; grid-template-columns: 12px minmax(0, 1fr) auto auto; gap: 8px; align-items: center; font-size: 13px; }
.dn-legend i { width: 12px; height: 12px; border-radius: 4px; }
.dn-legend b { font-weight: 700; }
.dn-legend small { color: var(--c-muted); min-width: 32px; text-align: end; font-size: 12px; }
/* در کارت باریک (یک‌سوم عرض) حلقه بالا و راهنما زیرش */
.span-4 .dn, .dn.is-stacked { flex-direction: column; align-items: stretch; }
.span-4 .dn-ring, .dn.is-stacked .dn-ring { align-self: center; }
.span-4 .dn-legend, .dn.is-stacked .dn-legend { width: 100%; flex: 0 0 auto; }

/* ---------- تب‌های قابل اسکرول افقی (چرخ ماوس، کشیدن، لمس) با محوشدگی لبه‌ها ---------- */
.tabs { scroll-behavior: smooth; cursor: default; }
.tabs.is-scrollable { cursor: grab; }
.tabs.is-dragging { cursor: grabbing; scroll-behavior: auto; user-select: none; }
.tabs.is-dragging .tab { pointer-events: none; }
.tabs.fade-start { -webkit-mask-image: linear-gradient(to left, transparent 0, #000 28px); mask-image: linear-gradient(to left, transparent 0, #000 28px); }
.tabs.fade-end { -webkit-mask-image: linear-gradient(to right, transparent 0, #000 28px); mask-image: linear-gradient(to right, transparent 0, #000 28px); }
.tabs.fade-start.fade-end { -webkit-mask-image: linear-gradient(to right, transparent 0, #000 28px, #000 calc(100% - 28px), transparent 100%); mask-image: linear-gradient(to right, transparent 0, #000 28px, #000 calc(100% - 28px), transparent 100%); }

/* ---------- تصویر پیوست در گفت‌وگو (مثل تلگرام) + نمایشگر بزرگ ---------- */
.msg-photo { position: relative; display: block; margin-top: 8px; border-radius: 14px; overflow: hidden; background: rgba(0,0,0,.06); max-width: 280px; line-height: 0; }
.msg-photo img { display: block; width: 100%; max-height: 320px; object-fit: cover; transition: transform var(--t-med) var(--ease); }
.msg-photo:hover img { transform: scale(1.02); }
.msg-photo-dl { position: absolute; bottom: 8px; inset-inline-start: 8px; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: rgba(15,23,42,.55); color: #fff; opacity: 0; transition: opacity var(--t-fast) ease; }
.msg-photo:hover .msg-photo-dl, .msg-photo:focus-visible .msg-photo-dl { opacity: 1; }
.msg-photo.is-broken { min-height: 80px; background: var(--c-surface-2); }
.msg-photo.is-broken img { display: none; }
.msg-photo.is-broken::after { content: "تصویر در دسترس نیست"; display: grid; place-items: center; min-height: 80px; font-size: 12px; line-height: 1.6; color: var(--c-muted); }
.lb-layer { position: fixed; inset: 0; z-index: var(--z-dialog); display: flex; flex-direction: column; background: rgba(8, 11, 16, .92); animation: fade-in var(--t-med) ease; }
.lb-bar { display: flex; align-items: center; gap: 10px; padding: 12px 16px; color: #fff; }
.lb-bar strong { flex: 1; min-width: 0; font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-bar .btn { --btn-bg: rgba(255,255,255,.12); --btn-bg-hover: rgba(255,255,255,.2); --btn-bg-active: rgba(255,255,255,.26); --btn-fg: #fff; }
.lb-stage { flex: 1; min-height: 0; display: grid; place-items: center; padding: 8px 16px 24px; }
.lb-stage img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 8px; box-shadow: 0 24px 64px rgba(0,0,0,.5); cursor: zoom-in; transition: transform var(--t-med) var(--ease); }
.lb-stage img.is-zoomed { transform: scale(1.8); cursor: zoom-out; }

/* ---------- پیش‌نمایش PDF ---------- */
.pdf-embed { display: block; width: 100%; height: 62vh; min-height: 360px; border: 0; border-radius: var(--r-md); background: #fff; }
.pdf-fallback { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 28px 20px; text-align: center; max-width: 360px; margin: auto; }
.pdf-fallback-ico { width: 64px; height: 64px; border-radius: 18px; display: grid; place-items: center; background: color-mix(in srgb, #D92D20 12%, var(--c-surface)); color: #D92D20; }
.pdf-fallback strong { font-size: 15px; overflow-wrap: anywhere; }
.pdf-fallback p { font-size: 13px; color: var(--c-muted); margin: 0 0 6px; }
.lb-stage.lb-pdf { padding: 0 16px 16px; }
.lb-stage.lb-pdf iframe { width: min(1100px, 100%); height: 100%; border: 0; border-radius: 10px; background: #fff; }
.lb-stage.lb-pdf .pdf-fallback { background: var(--c-surface); border-radius: var(--r-xl); color: var(--c-text); }

/* ---------- مالی: طرف‌حساب‌ها، دفتر پرداخت، حقوق و دستمزد ---------- */
.fin-nav .tab { display: inline-flex; align-items: center; gap: 6px; }
.fin-nav .tab .icon { width: 18px; height: 18px; opacity: .8; }
.fin-head-nav { margin-top: -4px; }
.fin-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--gap); }
.fin-kpis .stat-value { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fin-kpis .stat-sub { display: block; font-size: 12px; color: var(--c-muted); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 1199px) { .fin-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 599px) {
  .fin-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .fin-kpis .stat-card { padding: 14px; gap: 8px; flex-direction: column; align-items: flex-start; }
  .fin-kpis .stat-icon { width: 36px; height: 36px; border-radius: 10px; }
  .fin-kpis .stat-icon .icon { width: 18px; height: 18px; }
  .fin-kpis .stat-value { font-size: 18px; line-height: 28px; }
  .fin-kpis .stat-label { font-size: 12px; }
}

.py-ava { --av: 40px; flex-shrink: 0; }
.py-kind { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; color: var(--c-muted); }
.py-share { display: flex; align-items: center; gap: 8px; min-width: 120px; }
.py-share .progress { flex: 1; }
.py-share span { font-size: 12px; color: var(--c-muted); min-width: 34px; text-align: end; }
.tfoot-sum td { background: var(--c-surface-2); font-weight: 700; border-top: 1px solid var(--c-border); }

.ledger-hero { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.ledger-hero .avatar { --av: 64px; border-radius: 20px; font-size: 22px; }
.ledger-hero-text { flex: 1 1 240px; min-width: 0; }
.ledger-hero-text h1 { font-size: 22px; line-height: 1.5; font-weight: 700; margin: 0; overflow-wrap: anywhere; }
.ledger-hero-meta { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 4px; font-size: 13px; color: var(--c-muted); }
.ledger-hero-meta span { display: inline-flex; align-items: center; gap: 4px; }
.ledger-hero-meta .icon { width: 16px; height: 16px; }
.ledger-actions { display: flex; flex-wrap: wrap; gap: 8px; }

.kv { display: flex; flex-direction: column; }
.kv-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--c-divider); min-width: 0; }
.kv-row:last-child { border-bottom: 0; }
.kv-row > span { font-size: 13px; color: var(--c-muted); flex-shrink: 0; }
.kv-row > strong, .kv-row > div { font-size: 14px; font-weight: 600; min-width: 0; overflow-wrap: anywhere; text-align: end; display: flex; align-items: center; gap: 4px; justify-content: flex-end; }
.kv-row .btn-icon { --btn-size: 28px; width: 28px; height: 28px; }

.mchart { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 6px; align-items: end; height: 190px; margin-top: 12px; direction: ltr; }
.mchart-col { display: flex; flex-direction: column; align-items: center; gap: 4px; height: 100%; min-width: 0; }
.mchart-track { flex: 1; width: 100%; display: flex; align-items: flex-end; justify-content: center; border-bottom: 1px solid var(--chart-grid, var(--c-divider)); }
.mchart-bar { width: 56%; max-width: 22px; min-height: 2px; border-radius: 6px 6px 2px 2px; background: var(--chart-1, var(--c-primary)); transition: filter var(--t-fast) ease; }
.mchart-bar.is-zero { background: var(--c-surface-3); }
.mchart-col.is-now .mchart-bar:not(.is-zero) { background: var(--c-primary); }
.mchart-col:hover .mchart-bar { filter: brightness(1.12); }
.mchart-val { font-size: 10px; color: var(--c-text-2); white-space: nowrap; direction: rtl; }
.mchart-lbl { font-size: 11px; color: var(--c-muted); white-space: nowrap; }
@media (max-width: 767px) { .mchart { height: 160px; gap: 3px; } .mchart-val { display: none; } .mchart-lbl { font-size: 10px; } }

.range-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.range-form .input { width: 140px; }
.range-chips { display: flex; flex-wrap: wrap; gap: 6px; }

/* حقوق */
.period-nav { display: inline-flex; align-items: center; gap: 4px; background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--r-md); padding: 3px; }
.period-nav strong { min-width: 112px; text-align: center; font-size: 14px; font-weight: 700; }
.period-nav .btn { --btn-size: 34px; }
.slip-state { display: inline-flex; align-items: center; gap: 6px; }
.pr-form { display: grid; grid-template-columns: minmax(0, 1fr) 400px; gap: var(--gap); align-items: start; }
@media (max-width: 1199px) { .pr-form { grid-template-columns: 1fr; } }
.pr-sec + .pr-sec { margin-top: 20px; padding-top: 20px; border-top: 1px solid var(--c-divider); }
.pr-sec-title { font-size: 15px; font-weight: 700; margin: 0 0 4px; display: flex; align-items: center; gap: 8px; }
.pr-sec-title .icon { width: 18px; height: 18px; color: var(--c-primary); }
.pr-sec-desc { font-size: 12px; color: var(--c-muted); margin: 0 0 14px; }
.pr-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px 14px; }
.pr-grid .span-2 { grid-column: span 2; }
@media (max-width: 767px) { .pr-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 420px) { .pr-grid { grid-template-columns: 1fr; } .pr-grid .span-2 { grid-column: auto; } }
.pr-rows { display: flex; flex-direction: column; gap: 8px; }
.pr-row { display: grid; grid-template-columns: minmax(0, 1fr) 160px auto auto 36px; gap: 8px; align-items: center; }
.pr-row.is-ded { grid-template-columns: minmax(0, 1fr) 160px 36px; }
.pr-row .check { font-size: 12px; white-space: nowrap; }
@media (max-width: 640px) { .pr-row, .pr-row.is-ded { grid-template-columns: 1fr 1fr; } .pr-row .input:first-child { grid-column: 1 / -1; } }
.pr-flags { display: flex; flex-wrap: wrap; gap: 10px 22px; }
.pr-preview { position: sticky; top: calc(var(--header-h, 64px) + 12px); }
.pr-preview.is-busy .slip-lines { opacity: .55; }

.slip-paper { background: var(--c-surface); }
.slip-lines { display: flex; flex-direction: column; transition: opacity var(--t-fast) ease; }
.slip-line { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; font-size: 13px; border-bottom: 1px dashed var(--c-divider); }
.slip-line:last-child { border-bottom: 0; }
.slip-line > span { color: var(--c-text-2); min-width: 0; }
.slip-line > strong { font-weight: 600; white-space: nowrap; }
.slip-line.is-ded > strong { color: var(--c-danger); }
.slip-group-title { font-size: 12px; font-weight: 700; color: var(--c-muted); margin: 14px 0 2px; letter-spacing: 0; }
.slip-group-title:first-child { margin-top: 0; }
.slip-total { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 10px 0; border-top: 1px solid var(--c-border); font-size: 14px; }
.slip-total strong { font-size: 15px; white-space: nowrap; }
.slip-net { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 10px; padding: 14px 16px; border-radius: var(--r-lg); background: var(--c-primary); color: var(--c-on-primary, #fff); }
.slip-net span { font-size: 13px; opacity: .9; }
.slip-net strong { font-size: 20px; font-weight: 700; white-space: nowrap; }
.slip-net small { font-size: 12px; font-weight: 500; opacity: .85; }
.slip-foot { margin-top: 12px; font-size: 12px; color: var(--c-muted); line-height: 1.9; }
.slip-doc-head { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; padding-bottom: 16px; margin-bottom: 16px; border-bottom: 2px solid var(--c-text); }
.slip-doc-head h2 { font-size: 20px; font-weight: 700; margin: 0; }
.slip-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; }
@media (max-width: 767px) { .slip-cols { grid-template-columns: 1fr; gap: 8px; } }
.rules-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px 16px; }
@media (max-width: 991px) { .rules-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 520px) { .rules-grid { grid-template-columns: 1fr; } }
.br-table td { padding-block: 6px; }
.br-table .input { min-width: 0; }
.emp-only[hidden] { display: none !important; }
.seg-item:has(input:checked) { background: var(--c-primary); color: var(--c-on-primary); }
.seg-item:has(input:focus-visible) { outline: 3px solid var(--c-focus); outline-offset: 2px; }
.pf-kinds { display: flex; flex-wrap: wrap; width: 100%; }
.pf-kinds .seg-item { flex: 1 1 auto; padding-inline: 10px; font-size: 13px; }
.cell-text { display: block; min-width: 0; }
.cell-text .py-kind { display: flex; flex-wrap: wrap; margin-top: 2px; }
.table tr.is-muted td { opacity: .62; }
a.kpi-link { color: var(--c-text); transition: background-color var(--t-fast) ease; }
a.kpi-link:hover { background: var(--c-surface-2); }
.fin-kpis .stat { min-width: 0; }
.fin-kpis .stat-sub { white-space: normal; overflow: visible; }
