/* ===== Rahkaran Sales Invoices Theme ===== */
@import url('design-tokens.css');

:root {
  /* توکن‌های معنایی از design-tokens.css؛ فقط اندازه‌های اسکلت اینجا */
  --header-bg: #1e4a5c;
  --header-bg-dark: #163a48;
  --header-fg: rgba(255, 255, 255, .92);
  --header-fg-muted: rgba(255, 255, 255, .7);
  --text-light: #9ca3af;
  --panel-w: calc(312px - 1cm);
  --header-h: 42px;
  --nav-h: 24px;
  --icon-nav-h: 68px;
  --footer-h: 34px;
  --footer-panel-dock-h: 26px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html:not(:has(body.login-page)) {
  font-size: 8.5pt;
}
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  direction: rtl;
  min-height: 100vh;
}
/* اسکلت اپ — نه صفحهٔ لاگین (login-theme اندازه‌های خودش را دارد) */
body:not(.login-page) {
  font-size: 8.5pt;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  height: 100vh;
}
button, input, select, textarea, label, table, th, td, a, span, p, li, h1, h2, h3, h4 {
  font-family: inherit;
  font-size: inherit;
}
/* یک‌سایز اجباری کل UI — ۸٫۵pt (قانون persian-locale-mandatory) — خارج از لاگین */
body:not(.login-page),
body:not(.login-page) *:not(i):not(.fas):not(.far):not(.fal):not(.fab):not(.fa):not(svg):not(path) {
  font-size: 8.5pt !important;
}
/* مخفی‌سازی نشت عنوان پنل جمع‌شده — اولویت بالاتر از قانون یک‌سایز */
.panel-box.is-collapsed,
.panel-box.is-collapsed *,
.side-dock-graveyard,
.side-dock-graveyard * {
  font-size: 0 !important;
}
/* آیکون‌های فونت‌آسم: اندازه مستقل از متن */
.tb-btn .ico-chip i,
.ico-chip i,
.fas, .far, .fal, .fab, .fa {
  font-size: 11px !important;
}
.tb-btn .ico-chip i {
  font-size: 7px !important;
}

/* ===== Header ===== */
.top-header {
  height: var(--header-h);
  background: linear-gradient(180deg, var(--header-bg) 0%, var(--header-bg-dark) 100%);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 14px;
  gap: 16px;
  flex-shrink: 0;
  z-index: 100;
  box-shadow: 0 1px 3px rgba(0,0,0,.12);
  border-bottom: 1px solid #0f2f3a;
  color: var(--header-fg);
}

.header-right { display: flex; align-items: center; gap: 12px; }

.hamburger {
  width: 32px;
  height: 32px;
  border: none;
  background: rgba(255,255,255,.1);
  border-radius: 6px;
  cursor: pointer;
  /* منوی همبرگر (#۱): پیش‌فرض مخفی — فقط PWA */
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 7px;
  transition: .15s;
}
html.is-pwa .hamburger[hidden],
html.is-compact-nav .hamburger[hidden] { display: none !important; }
html.is-pwa .hamburger:not([hidden]),
html.is-compact-nav .hamburger:not([hidden]) {
  display: flex;
}
.hamburger:hover { background: rgba(255,255,255,.16); }
.hamburger span {
  display: block;
  width: 16px;
  height: 2px;
  background: var(--header-fg);
  border-radius: 1px;
}

/* پنل آکاردئون منوی همبرگر — فقط PWA */
.pwa-hamburger-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, .45);
  z-index: 1200;
}
.pwa-hamburger-panel {
  display: none;
  position: fixed;
  top: 0;
  right: 0;
  width: min(92vw, 360px);
  height: 100dvh;
  background: #f8fafc;
  box-shadow: -8px 0 28px rgba(15, 23, 42, .18);
  z-index: 1201;
  flex-direction: column;
  overflow: hidden;
}
html.is-pwa body.pwa-nav-open .pwa-hamburger-backdrop:not([hidden]),
html.is-pwa body.pwa-nav-open .pwa-hamburger-panel:not([hidden]),
html.is-compact-nav body.pwa-nav-open .pwa-hamburger-backdrop:not([hidden]),
html.is-compact-nav body.pwa-nav-open .pwa-hamburger-panel:not([hidden]) {
  display: flex;
}
html.is-pwa body.pwa-nav-open .pwa-hamburger-backdrop:not([hidden]),
html.is-compact-nav body.pwa-nav-open .pwa-hamburger-backdrop:not([hidden]) {
  display: block;
}
.pwa-hamburger-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 12px 14px;
  background: linear-gradient(180deg, #1e3a5f 0%, #16324f 100%);
  color: #fff;
  flex-shrink: 0;
}
.pwa-hamburger-head .pwa-hamburger-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.pwa-hamburger-head .pwa-hamburger-logo {
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  object-fit: contain;
  border-radius: 4px;
}
.pwa-hamburger-head strong { font-size: 9.5pt; font-weight: 700; }
.pwa-hamburger-close {
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 8px;
  background: rgba(255,255,255,.12);
  color: #fff;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}
.pwa-hamburger-body {
  flex: 1;
  overflow: auto;
  padding: 8px;
  -webkit-overflow-scrolling: touch;
}
.pwa-acc-l1,
.pwa-acc-l2 {
  border: 1px solid #d7dee8;
  border-radius: 10px;
  background: #fff;
  margin-bottom: 8px;
  overflow: hidden;
}
.pwa-acc-l1 > summary,
.pwa-acc-l2 > summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 12px;
  font-size: 9pt;
  font-weight: 700;
  color: #1e3a5f;
  background: linear-gradient(180deg, #eef4fb 0%, #e4edf7 100%);
  min-height: 44px;
}
.pwa-acc-l1 > summary::-webkit-details-marker,
.pwa-acc-l2 > summary::-webkit-details-marker { display: none; }
.pwa-acc-l2 > summary {
  background: #f3f6fa;
  font-weight: 600;
  color: #334155;
  min-height: 40px;
}
.pwa-acc-l1-body,
.pwa-acc-l2-body { padding: 6px; }
.pwa-acc-subhead {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 8px 4px;
  font-size: 8pt;
  font-weight: 700;
  color: #64748b;
}
.pwa-acc-link {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 10px;
  min-height: 44px;
  border-radius: 8px;
  text-decoration: none;
  color: #0f172a;
  font-size: 8.5pt;
}
.pwa-acc-link:hover,
.pwa-acc-link.is-active {
  background: #e8f1fa;
  color: #1e3a5f;
}
.pwa-acc-ico {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  object-fit: contain;
}
.pwa-acc-empty {
  padding: 12px;
  color: #94a3b8;
  font-size: 8.5pt;
  text-align: center;
}

/* موبایل UI / PWA: مخفی کردن منوی ماژول‌ها / آیکون / بیتا — فقط همبرگر */
html.is-pwa .main-nav,
html.is-pwa .icon-nav,
html.is-compact-nav .main-nav,
html.is-compact-nav .icon-nav {
  display: none !important;
}

.logo { display: flex; align-items: center; gap: 8px; min-width: 0; }
.logo-mark {
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.logo-mark img {
  width: 32px;
  height: 32px;
  object-fit: contain;
  display: block;
}
.logo-text { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.logo-title {
  font-size: 8.5pt;
  font-weight: 700;
  color: var(--header-fg);
  white-space: nowrap;
}
.logo-sub {
  font-size: 8pt;
  color: var(--header-fg-muted);
  letter-spacing: .02em;
  white-space: nowrap;
}

.header-center { flex: 1; text-align: center; }
.header-title {
  font-size: 8.5pt;
  font-weight: 600;
  color: var(--header-fg);
  letter-spacing: .3px;
}

.header-left { display: flex; align-items: center; gap: 14px; }
.header-cache-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 28px;
  padding: 0 8px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 4px;
  background: linear-gradient(180deg, rgba(255,255,255,.14) 0%, rgba(255,255,255,.06) 100%);
  color: inherit;
  font: 700 8.5pt Tahoma, sans-serif;
  cursor: pointer;
  white-space: nowrap;
}
.header-cache-btn:hover {
  background: linear-gradient(180deg, rgba(255,255,255,.22) 0%, rgba(255,255,255,.1) 100%);
}
.header-cache-btn.is-busy,
.header-cache-btn:disabled {
  opacity: 0.55;
  cursor: wait;
}
.header-cache-btn-label { line-height: 1; }
.header-icons { display: flex; gap: 2px; }
.icon-btn {
  position: relative;
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  color: #4b5563;
  border-radius: 6px;
  cursor: pointer;
  font-size: 8.5pt;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: .15s;
}
.icon-btn:hover { background: rgba(0,0,0,.06); color: #1f2937; }
.badge {
  /* فقط برای شمارنده روی آیکون هدر — نه برچسب نقش در جدول */
  position: absolute;
  top: 1px;
  left: 1px;
  min-width: 15px;
  height: 15px;
  border-radius: 8px;
  font-size: 8.5pt;
  font-weight: 700;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 3px;
  pointer-events: none;
}
.icon-btn > .badge {
  position: absolute;
}
.badge.red { background: #e74c3c; }
.badge.yellow { background: #f39c12; }

.user-profile {
  display: flex;
  align-items: center;
  position: relative;
  border-radius: 6px;
}
.user-profile-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  padding: 3px 8px;
  border: 0;
  background: transparent;
  border-radius: 6px;
  font: inherit;
  color: inherit;
  transition: .15s;
}
.user-profile-btn:hover,
.user-profile.is-open .user-profile-btn {
  background: rgba(255,255,255,.1);
}
.user-profile-caret {
  font-size: 8pt;
  color: var(--header-fg-muted);
  transition: transform .15s;
}
.user-profile.is-open .user-profile-caret {
  transform: rotate(180deg);
}
.avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid rgba(255,255,255,.35);
}
.user-info { display: flex; flex-direction: column; line-height: 1.2; text-align: right; }
.user-name { font-weight: 600; font-size: 8.5pt; color: var(--header-fg); }
.user-role { font-size: 8pt; color: var(--header-fg-muted); max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.user-dropdown {
  position: fixed;
  top: 0;
  right: 0;
  left: auto;
  background: #fff;
  border: 1px solid #d0d7e2;
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,.16);
  min-width: 200px;
  padding: 6px;
  display: none;
  z-index: 5000;
}
.user-dropdown:not([hidden]),
.user-dropdown.open,
.user-profile.is-open .user-dropdown {
  display: block;
}
.top-header,
.header-left,
.user-profile {
  overflow: visible;
}
.user-dropdown-head {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px 10px 10px;
  border-bottom: 1px solid var(--border, #e5e7eb);
  margin-bottom: 4px;
}
.user-dropdown-head strong {
  font-size: 8.5pt;
  color: #1f2937;
}
.user-dropdown-head span,
.user-dropdown-role {
  font-size: 8pt;
  color: #6b7280;
}
.user-dropdown-item,
.user-dropdown a {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border-radius: 5px;
  color: var(--text, #1f2937);
  text-decoration: none;
  font-size: 8.5pt;
}
.user-dropdown-item:hover,
.user-dropdown a:hover {
  background: var(--primary-light, #e8f4fc);
  color: var(--primary, #1a6fa3);
}
.user-dropdown-item.danger,
.user-dropdown a.danger { color: var(--danger, #c0392b); }
.user-dropdown-item.danger:hover,
.user-dropdown a.danger:hover {
  background: #fdecea;
  color: var(--danger, #c0392b);
}
.user-dropdown hr { border: none; border-top: 1px solid var(--border, #e5e7eb); margin: 4px 0; }

/* ===== Main Nav — تب فعال به شکل ∩ با امتداد محو زیر همسایه‌ها ===== */
.main-nav {
  background: #eef2f7;
  border-bottom: 1px solid #d0d7e2;
  height: var(--nav-h);
  flex-shrink: 0;
  padding: 0 10px;
  position: relative;
  overflow: hidden;
}
.nav-tabs {
  list-style: none;
  display: flex;
  align-items: flex-end;
  height: 100%;
  gap: 0;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: thin;
}
.nav-tab {
  position: relative;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0 12px;
  height: calc(100% - 2px);
  margin-top: 2px;
  font-size: 8.5pt;
  font-weight: 500;
  color: #5b6b7c;
  cursor: pointer;
  white-space: nowrap;
  transition: color .15s, background .15s;
  user-select: none;
  border: 1px solid transparent;
  border-bottom: none;
  background: transparent;
  border-radius: 5px 5px 0 0;
}
.nav-tab-label {
  position: relative;
  z-index: 1;
  appearance: none;
  border: none;
  background: transparent;
  color: inherit;
  font: inherit;
  font-weight: inherit;
  cursor: pointer;
  padding: 0;
  margin: 0;
}
.nav-tab-label:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
  border-radius: 3px;
}

.nav-tab:hover:not(.active) {
  color: var(--primary);
  background: rgba(255, 255, 255, .45);
}

/*
  تب فعال:
  - خط آبی نازک ساده بالا + چپ + راست (بدون سایه/هاله، بدون خط زیر خود تب)
  - امتداد محو زیر همسایه‌ها: نزدیک تب کم‌رنگ → دورتر پررنگ‌تر محو می‌شود (برعکس قبل)
*/
.nav-tab.active {
  color: var(--primary);
  font-weight: 700;
  background: #fff;
  height: calc(100% + 1px);
  margin-top: 0;
  margin-bottom: -1px;
  padding-top: 0;
  border: 1px solid #4a90e8;
  border-bottom-color: transparent;
  box-shadow: none;
  z-index: 3;
}

/* زیر همسایه راست (خانه): نزدیک فروش شفاف → به سمت وسط خانه کمی پررنگ‌تر سپس محو */
.nav-tab.active::before {
  content: '';
  position: absolute;
  bottom: -1px;
  right: calc(100% - 1px);
  width: 44px;
  height: 1px;
  background: linear-gradient(
    to right,
    transparent 0%,
    rgba(74, 144, 232, .15) 15%,
    rgba(74, 144, 232, .55) 45%,
    rgba(74, 144, 232, .25) 75%,
    transparent 100%
  );
  pointer-events: none;
  z-index: 4;
}

/* زیر همسایه چپ (خرید): نزدیک فروش شفاف → به سمت وسط خرید کمی پررنگ‌تر سپس محو */
.nav-tab.active::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: calc(100% - 1px);
  width: 44px;
  height: 1px;
  background: linear-gradient(
    to left,
    transparent 0%,
    rgba(74, 144, 232, .15) 15%,
    rgba(74, 144, 232, .55) 45%,
    rgba(74, 144, 232, .25) 75%,
    transparent 100%
  );
  pointer-events: none;
  z-index: 4;
}

.nav-tab-close {
  display: none;
}
.nav-tab-chevron {
  display: none;
}

/* ===== Icon Sub-Nav ===== */
.icon-nav {
  background: #fff;
  border-bottom: 1px solid var(--border);
  height: var(--icon-nav-h);
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 0 8px;
  overflow-x: auto;
  flex-shrink: 0;
}
.icon-nav.hidden { display: none; }
.icon-nav-placeholder {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-width: 72px;
  padding: 4px 10px;
  color: #6b7280;
  pointer-events: none;
  user-select: none;
}
.icon-nav-placeholder span {
  font-size: 8.5pt;
  font-weight: 400;
  color: #4b5563;
  white-space: nowrap;
}
.icon-nav-placeholder em {
  font-style: normal;
  font-size: 8.5pt;
  color: #94a3b8;
}
.icon-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 4px 8px;
  border: none;
  background: transparent;
  border-radius: 6px;
  cursor: pointer;
  transition: .15s;
  min-width: 72px;
  height: 58px;
  text-decoration: none;
  color: inherit;
}
.icon-nav-item:hover { background: #f3f4f6; }
.icon-nav-item:visited { color: inherit; }
.icon-nav-item.active {
  background: var(--primary-light);
}
.icon-nav-item.active span { color: var(--primary); font-weight: 700; }
.ini-icon {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 8.5pt;
  box-shadow: 0 1px 3px rgba(0,0,0,.12);
}
.ini-gfx {
  width: 36px;
  height: 36px;
  display: block;
  object-fit: contain;
  filter: drop-shadow(0 1px 2px rgba(15, 23, 42, .1));
  pointer-events: none;
}
.icon-nav-item span {
  font-size: 8.5pt;
  font-family: Tahoma, Arial, sans-serif;
  font-weight: 400;
  color: var(--text-muted);
  white-space: nowrap;
  line-height: 1.2;
}

/* ===== Workspace ===== */
.workspace {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  position: relative;
}
.workspace-stage {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  position: relative;
}

/* تب‌های تولبار (#۹) — نوار سراسری؛ active سفید+کادر؛ inactive بدون جعبه؛ × بدون کادر */
.sub-tabs,
#toolbarTabsBar {
  display: flex;
  align-items: stretch;
  background: #f0f2f5;
  border-bottom: 1px solid var(--border);
  padding: 0;
  height: 28px;
  min-height: 28px;
  flex-shrink: 0;
  gap: 0;
  width: 100%;
  box-sizing: border-box;
  position: relative;
  z-index: 20;
}
.sub-tabs-list,
#toolbarTabsList {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  flex: 1 1 auto;
  min-width: 0;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 3px 6px 0;
  scrollbar-width: thin;
}
.sub-tab {
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  gap: 4px;
  flex: 0 0 auto;
  padding: 0 8px;
  height: 22px;
  font-size: 8.5pt;
  font-family: inherit;
  color: var(--text-muted);
  background: transparent;
  border: none;
  border-radius: 4px 4px 0 0;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  position: relative;
  top: 1px;
  transition: color .12s, background .12s;
}
.sub-tab:hover {
  color: var(--text);
  background: transparent;
}
.sub-tab:not(.active) {
  background: transparent;
  border: none;
  box-shadow: none;
}
.sub-tab.active {
  background: #fff;
  color: var(--text);
  font-weight: 600;
  border: 1px solid var(--border);
  border-bottom: none;
  z-index: 1;
}
.sub-tab > .ico-3d,
.sub-tab .ico-3d {
  width: 14px !important;
  height: 14px !important;
  flex-shrink: 0;
}
.sub-tab-label {
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
}
/* × بستن: بدون دایره/مربع/پس‌زمینه؛ سمت چپ متن در RTL؛ hover قرمز */
.sub-tab-close,
.tab-close {
  order: 3;
  width: auto;
  height: auto;
  min-width: 0;
  min-height: 0;
  margin: 0;
  margin-inline-start: 2px;
  padding: 0 2px;
  border: none;
  border-radius: 0;
  background: transparent !important;
  box-shadow: none !important;
  color: var(--text-light);
  font-size: 14px;
  font-weight: 400;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.sub-tab-close:hover,
.sub-tab-close:focus,
.sub-tab-close:focus-visible,
.tab-close:hover,
.tab-close:focus {
  background: transparent !important;
  color: #dc2626;
  outline: none;
}
.sub-tab-add {
  width: 24px;
  height: 24px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  border-radius: 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.sub-tab-add:hover { background: #e5e7eb; color: var(--primary); }

/* ابزارها داخل نوار تب */
.toolbar-actions {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
  margin-inline-start: auto;
  padding-inline: 4px 0;
  align-self: stretch;
  height: 100%;
}
/* هم‌عرض و هم‌تراز با پنل سمت چپ (--panel-w) */
.toolbar-search {
  display: flex;
  align-items: center;
  align-self: stretch;
  background: #fff;
  border: none;
  border-inline-start: 1px solid #c0c4c8;
  border-radius: 0;
  padding: 0 8px;
  height: 100%;
  min-height: 100%;
  width: var(--panel-w);
  flex: 0 0 var(--panel-w);
  max-width: var(--panel-w);
  box-sizing: border-box;
  transition: background .15s, box-shadow .15s;
  margin-inline-start: 1cm;
  margin-inline-end: 0;
  margin-block: 0;
  position: relative;
}
.toolbar-actions .toolbar-search {
  margin-inline-start: 1cm;
  margin-inline-end: 0;
}
.tb-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 0 8px;
  height: 22px;
  border: 1px solid #c0c4c8;
  background: #fff;
  border-radius: 3px;
  font-family: Tahoma, Arial, sans-serif;
  font-size: 8.5pt;
  font-weight: 400;
  color: #1f2937;
  cursor: pointer;
  transition: background .1s, border-color .1s, color .1s;
  white-space: nowrap;
  box-shadow: none;
  text-decoration: none;
  box-sizing: border-box;
  line-height: 1.2;
}
a.tb-btn,
a.tb-btn:link,
a.tb-btn:visited,
a.tb-btn:hover,
a.tb-btn:active {
  text-decoration: none !important;
  color: #1f2937;
}
.tb-btn:hover { background: #f0f2f4; border-color: #9ca3af; color: #111; }
.tb-btn.primary,
a.tb-btn.primary {
  background: var(--primary, #1a73e8);
  border-color: var(--primary, #1a73e8);
  color: #fff !important;
}
.tb-btn.primary:hover,
a.tb-btn.primary:hover {
  background: var(--primary-dark, #1557b0);
  border-color: var(--primary-dark, #1557b0);
  color: #fff !important;
}
.tb-btn.is-open { background: #e8ebee; border-color: #9ca3af; }
.tb-btn kbd {
  font-size: 8.5pt;
  background: #eceff1;
  padding: 1px 4px;
  border-radius: 3px;
  color: #6b7280;
  font-family: Tahoma, Arial, sans-serif;
  font-weight: 400;
  border: 1px solid #d1d5db;
}
.tb-caret { font-size: 8.5pt; opacity: .7; margin-right: 2px; }
.tb-sep {
  width: 1px;
  height: 16px;
  background: #c0c4c8;
  margin: 0 2px;
}

/* منوی کشویی سبک ویندوزی — طوسی تخت */
.tb-menu {
  position: relative;
  display: inline-flex;
}
.tb-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 1px);
  right: 0;
  min-width: 200px;
  background: #fff;
  border: 1px solid #9ca3af;
  border-radius: 2px;
  box-shadow: 0 4px 14px rgba(15, 23, 42, .12);
  z-index: 200;
  padding: 2px 0;
}
.tb-menu.is-open .tb-dropdown { display: block; }
.tb-dd-item {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  min-height: 22px;
  height: 22px;
  padding: 0 8px;
  border: none;
  border-bottom: 1px solid #e8eaed;
  background: transparent;
  font-family: Tahoma, Arial, sans-serif;
  font-size: 8.5pt;
  font-weight: 400;
  color: #1f2937;
  cursor: pointer;
  text-align: right;
  direction: rtl;
  box-shadow: none;
  line-height: 1;
}
.tb-dd-item:last-child { border-bottom: none; }
.tb-dd-item:hover { background: #eef2f7; }
.tb-dd-item.danger:hover { background: #fef2f2; color: #b91c1c; }
a.tb-dd-item {
  text-decoration: none !important;
  color: #1f2937;
  box-sizing: border-box;
}
.tb-dd-label { flex: 1; text-align: right; white-space: nowrap; }
.tb-dd-icon {
  width: 16px;
  text-align: center;
  color: #4b5563;
  font-size: 8.5pt;
  order: -1; /* در RTL سمت راست آیتم */
}
.tb-dd-item > .ico-3d {
  order: -1; /* RTL: آیکون سمت راست (شروع) آیتم — مثل مرجع اشخاص */
  flex-shrink: 0;
  width: 16px !important;
  height: 16px !important;
  margin: 0;
  opacity: 1;
  visibility: visible;
  display: inline-block !important;
}
.tb-dd-item.tb-dd-item--missing-icon {
  outline: 1px dashed #dc2626;
  outline-offset: -1px;
}
.tb-dd-item kbd {
  font-size: 8.5pt;
  background: #f3f4f6;
  padding: 0 4px;
  border: 1px solid #d1d5db;
  border-radius: 2px;
  color: #6b7280;
  font-family: Tahoma, Arial, sans-serif;
  font-weight: 400;
  line-height: 16px;
  height: 16px;
}
.tb-dd-sep {
  height: 0;
  border: none;
  border-top: 1px solid #1a1a1a;
  margin: 2px 6px;
  background: transparent;
}
/* جداکنندهٔ قوی‌تر وقتی بعد از sep می‌آید — بدون خط دوبل با border آیتم */
.tb-dd-sep + .tb-dd-item { border-top: none; }
.tb-dd-item:has(+ .tb-dd-sep) { border-bottom: none; }
.toolbar-search:focus-within {
  background: #f8fafc;
  box-shadow: inset 0 0 0 1px var(--primary, #1a73e8);
}
.toolbar-search input.is-live-searching {
  color: var(--primary, #1a73e8);
}
.tb-btn .ico-chip {
  width: 14px;
  height: 14px;
  border-radius: 3px;
  margin-inline-end: 1px;
}
.tb-btn .ico-chip i { font-size: 8.5pt; }
.tb-btn > .ico-3d {
  margin-inline-end: 4px;
  flex-shrink: 0;
  width: 14px !important;
  height: 14px !important;
}
.toolbar-search i {
  width: 14px;
  height: 14px;
  border-radius: 3px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(145deg, #93c5fd, #2563eb);
  color: #fff !important;
  font-size: 8.5pt;
  margin-left: 6px;
}
.toolbar-search .ico-3d {
  width: 14px;
  height: 14px;
  margin-left: 6px;
  background: transparent;
  filter: drop-shadow(0 1px 1px rgba(15, 23, 42, .15));
}
.toolbar-search input {
  border: none;
  background: transparent;
  outline: none;
  width: 100%;
  height: 100%;
  font-size: 8.5pt;
  line-height: 1;
  min-width: 0;
}
.toolbar-search .search-kbd {
  flex-shrink: 0;
  font-size: 8.5pt;
  line-height: 1;
  padding: 2px 4px;
  border: 1px solid #d1d5db;
  border-radius: 3px;
  background: #f3f4f6;
  color: #6b7280;
  font-family: Tahoma, Arial, sans-serif;
  margin-inline-start: 4px;
}

/* Main Split — کادر اصلی + سایدداک در یک flex واقعی (نه overlay)
   وقتی سایدداک پین است، عرض .table-area کم می‌شود؛ محتوا زیر پنل نمی‌رود. */
.main-split {
  display: flex;
  flex: 1 1 0%;
  flex-direction: row;
  align-items: stretch;
  min-height: 0;
  min-width: 0;
  width: 100%;
  max-width: 100%;
  overflow: hidden;
  position: relative;
}

/* Table Area */
.table-area {
  flex: 1 1 0%;
  display: flex;
  flex-direction: column;
  min-width: 0;
  max-width: 100%;
  overflow: auto;
  background: #fff;
  border-left: 1px solid var(--border);
  position: relative;
  z-index: 1;
  container-type: inline-size;
  container-name: table-area;
}
.page-section-title {
  font-size: 8.5pt;
  font-weight: 700;
  color: #1e3a5f;
  padding: 6px 10px;
  background: linear-gradient(180deg, #e8f1fa 0%, #d6e6f5 100%);
  border: 1px solid #b7c9dc;
  border-bottom: none;
  flex-shrink: 0;
}
.table-area.is-form-stack {
  overflow: auto;
}
.table-area.is-form-stack .table-scroll {
  flex: 0 0 auto;
  overflow: visible;
  min-height: 0;
}
.pagination a.page-btn {
  text-decoration: none;
  color: inherit;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.pagination span.page-btn[aria-disabled="true"] {
  opacity: 0.4;
  pointer-events: none;
}
.table-scroll {
  flex: 1;
  overflow: auto;
  overflow-x: auto;
  overflow-y: auto;
  min-height: 0;
  /* اسکرول افقی واضح وقتی ستون‌ها زیاد/عریض‌اند */
  scrollbar-gutter: stable;
}
.grid-table {
  width: 100%;
  min-width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 8.5pt;
  font-family: Tahoma, Arial, sans-serif;
  font-weight: 400;
}
.grid-table.is-cols-locked {
  /* کالیبره داخل ظرف: عرض ۱۰۰٪ ظرف؛ مجموع ستون‌ها از JS برابر avail است — بدون اسکرول افقی */
  width: 100% !important;
  min-width: 100% !important;
  max-width: 100% !important;
}
body.is-col-resizing {
  cursor: col-resize !important;
  user-select: none !important;
}
body.is-col-resizing * {
  cursor: col-resize !important;
}
.grid-table td,
.grid-table th {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 0; /* با table-layout:fixed و width ستون، ellipsis درست کار می‌کند */
}
.grid-table th {
  max-width: none;
}
.grid-table td[data-col="address"],
.grid-table td[data-col="notes"],
.grid-table td[data-col="roles"] {
  white-space: nowrap;
}
.grid-table .is-col-hidden,
.grid-table col.is-col-hidden {
  display: none !important;
  width: 0 !important;
  min-width: 0 !important;
  max-width: 0 !important;
  padding: 0 !important;
  border: none !important;
  overflow: hidden !important;
}
.grid-table th {
  background: #f0f4f8;
  padding: 4px 6px;
  text-align: center;
  font-weight: 400;
  color: var(--text-muted);
  border-bottom: 1px solid #d0d5db;
  border-left: 1px solid #e5e7eb;
  white-space: nowrap;
  position: sticky;
  top: 0;
  z-index: 5;
  font-size: 8.5pt;
  overflow: hidden;
  user-select: none;
  line-height: 1.25;
}
.grid-table th:last-child {
  border-left: none;
}
.grid-table td {
  padding: 3px 6px;
  border-bottom: 1px solid #eef0f3;
  border-left: 1px solid #eceff2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: center;
  font-size: 8.5pt;
  font-weight: 400;
  line-height: 1.25;
  vertical-align: middle;
}
.grid-table td:last-child {
  border-left: none;
}
.grid-table tbody tr { cursor: pointer; transition: .1s; }
.grid-table tbody tr:hover { background: #e8f1fc; }
.grid-table tbody tr.selected {
  background: #dbeafe !important;
  outline: 1px solid var(--primary);
  outline-offset: -1px;
}
.grid-table tbody tr.selected:hover { background: #cfe0fc !important; }
.grid-table tbody tr:nth-child(even):not(.selected) { background: #fafbfc; }
.grid-table tbody tr:nth-child(even):not(.selected):hover { background: #e8f1fc; }
.grid-table td strong { font-weight: 400; }
.col-check { text-align: center !important; }
.col-check input,
.col-check input[type="radio"],
.col-check input[type="checkbox"] {
  width: 12px !important;
  height: 12px !important;
  margin: 0;
  padding: 0;
  accent-color: var(--primary);
  cursor: pointer;
  transform: none !important;
}

/* دستگیره تغییر عرض ستون — مثل اکسل روی لبه ستون */
.col-resizer {
  position: absolute;
  top: 0;
  left: -3px;
  width: 8px;
  height: 100%;
  cursor: col-resize;
  z-index: 6;
}
.col-resizer::after {
  content: '';
  position: absolute;
  top: 15%;
  bottom: 15%;
  left: 3px;
  width: 2px;
  border-radius: 1px;
  background: transparent;
}
.col-resizer:hover::after,
body.is-col-resizing .col-resizer.is-active::after {
  background: var(--primary, #1a73e8);
}
body.is-col-resizing {
  cursor: col-resize !important;
  user-select: none !important;
}
body.is-col-resizing * {
  cursor: col-resize !important;
  user-select: none !important;
}
body.is-col-resizing::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 9998;
  cursor: col-resize;
}

.badge-pill {
  display: inline-block;
  position: static;
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 8.5pt;
  font-weight: 400;
  line-height: 1.35;
  white-space: nowrap;
  vertical-align: middle;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}
.badge-pill.green { background: #dcfce7; color: #15803d; }
.badge-pill.blue { background: #dbeafe; color: #1d4ed8; }
.badge-pill.yellow { background: #fef3c7; color: #b45309; }
.badge-pill.red { background: #fee2e2; color: #b91c1c; }
/* نقش‌ها در جدول — هرگز absolute نباشند (برخلاف .badge اعلان هدر) */
.grid-table td .role-tag,
.grid-table td .badge-pill {
  position: static !important;
  top: auto !important;
  left: auto !important;
  height: auto !important;
  min-width: 0 !important;
  margin: 0 2px;
}

/* Pagination */
.pagination-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 12px;
  border-top: 1px solid var(--border);
  background: #f8fafc;
  flex-shrink: 0;
  font-size: 8.5pt;
  color: var(--text-muted);
}
.pagination { display: flex; gap: 3px; align-items: center; }
.page-btn {
  min-width: 28px;
  height: 28px;
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 4px;
  cursor: pointer;
  font-size: 8.5pt;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text);
  transition: .12s;
  padding: 0 6px;
}
.page-btn:hover { border-color: var(--primary); color: var(--primary); }
.page-btn.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
  font-weight: 700;
}
.page-btn:disabled { opacity: .4; cursor: not-allowed; }
.page-ellipsis { padding: 0 4px; color: var(--text-light); }
.pagination-size select {
  margin-inline-start: 4px;
  height: 26px;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0 6px;
  font-size: 8.5pt;
  background: #fff;
}

/* ===== Bottom Dock — نوار پنل بالای فوتر (هرگز از صفحه بیرون نزند) ===== */
.bottom-dock {
  --bottom-dock-h: 168px;
  position: relative;
  flex-shrink: 0;
  width: 100%;
  max-width: 100%;
  height: var(--bottom-dock-h);
  min-height: 100px;
  max-height: min(420px, 45vh);
  background: #eef2f6;
  border-top: 1px solid #c5ccd4;
  z-index: 40;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-sizing: border-box;
}
.bottom-dock.is-empty {
  display: none;
}
.bottom-dock-resize-y {
  position: absolute;
  top: -3px;
  left: 0;
  right: 0;
  height: 6px;
  cursor: ns-resize;
  z-index: 5;
}
.bottom-dock-resize-y:hover,
.bottom-dock-resize-y:active {
  background: rgba(30, 74, 92, .25);
}
.bottom-dock-strip {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: stretch;
  gap: 6px;
  width: 100%;
  max-width: 100%;
  height: 100%;
  padding: 6px 8px 8px;
  overflow: hidden;
  box-sizing: border-box;
  min-width: 0;
}
.bottom-panel {
  --bp-w: 180px;
  position: relative;
  display: flex;
  flex-direction: column;
  width: var(--bp-w);
  min-width: 0;
  max-width: 100%;
  flex: 1 1 var(--bp-w);
  background: #fff;
  border: 1px solid #9ca3af;
  min-height: 0;
  overflow: hidden;
  box-sizing: border-box;
}
.bottom-panel.is-collapsed {
  display: none !important;
}
/* بدون پنجره شناور — پنل فقط داخل نوار پایین */
.bottom-panel.is-flyout {
  display: none !important;
}
.bottom-panel-title {
  height: 24px;
  min-height: 24px;
  padding: 0 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  background: #f0f4f8;
  border-bottom: 1px solid var(--border, #d1d5db);
  font-size: 8.5pt;
  font-weight: 400;
  flex-shrink: 0;
}
.bottom-panel-title-text {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-weight: 400;
}
.bottom-panel-body {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 6px;
  font-size: 8.5pt;
  font-weight: 400;
}
.bottom-panel-resize-x {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 5px;
  cursor: ew-resize;
  z-index: 3;
}
[dir="rtl"] .bottom-panel-resize-x { left: 0; right: auto; }
[dir="ltr"] .bottom-panel-resize-x { right: 0; left: auto; }
.bottom-panel-resize-x:hover {
  background: rgba(26, 115, 232, .2);
}
.bottom-mini-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 8.5pt;
  font-weight: 400;
}
.bottom-mini-table th,
.bottom-mini-table td {
  border-bottom: 1px solid #e5e7eb;
  padding: 3px 5px;
  text-align: right;
  font-weight: 400;
  white-space: nowrap;
}
.bottom-mini-table th {
  background: #f8fafc;
  color: #475569;
}
.bottom-mini-table td.ok { color: var(--color-success, #059669); }
.bottom-mini-table td.bad { color: var(--color-danger, #dc2626); }
.bottom-mini-table .muted,
.bottom-mini-table td.muted { color: #94a3b8; text-align: center; }
.bottom-mini-table a { color: var(--primary, #1a73e8); text-decoration: none; }
.bottom-mini-table tr.dock-tasks-skel td {
  padding: 8px 6px;
  border-bottom: 1px solid #eef2f6;
}
.bottom-mini-table .dock-skel-bar {
  display: block;
  height: 10px;
  border-radius: 4px;
  background: linear-gradient(90deg, #e8edf2 0%, #f4f7fa 50%, #e8edf2 100%);
  background-size: 200% 100%;
  animation: dockSkelShine 1.1s ease-in-out infinite;
}
@keyframes dockSkelShine {
  0% { background-position: 100% 0; }
  100% { background-position: -100% 0; }
}
@media (prefers-reduced-motion: reduce) {
  .bottom-mini-table .dock-skel-bar { animation: none; background: #e8edf2; }
}
.pie-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 100%;
  min-height: 0;
  overflow: hidden;
}
.pie-wrap canvas {
  flex-shrink: 0;
  width: 72px;
  height: 72px;
}
/* فقط آمار نقش‌ها — دایره کوچک، بدون اسکرول */
.dock-roles-only {
  align-items: center;
  justify-content: flex-start;
  gap: 6px;
  overflow: hidden;
}
.dock-roles-only canvas {
  width: 64px !important;
  height: 64px !important;
}
.dock-roles-only .pie-legend {
  overflow: hidden;
  max-height: none;
  flex: 1 1 auto;
  min-width: 0;
}
.bottom-panel[data-bottom-panel="dock_roles_pie"] .bottom-panel-body {
  overflow: hidden;
  display: flex;
  align-items: center;
}
.bottom-panel-footer-link {
  margin-top: 4px;
  padding-top: 4px;
  border-top: 1px solid #e5e7eb;
  font-size: 8.5pt;
  text-align: left;
}
.bottom-panel-footer-link a {
  color: var(--primary, #1a73e8);
  text-decoration: none;
}
.bottom-panel-footer-link a:hover {
  text-decoration: underline;
}
.pie-legend {
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: 8.5pt;
  overflow: hidden;
  max-height: 100%;
  flex: 1;
  min-width: 0;
}
.pie-legend li {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 2px 0;
  white-space: nowrap;
}
.pie-legend em {
  font-style: normal;
  margin-inline-start: auto;
  color: #64748b;
  font-weight: 400;
}
.pie-swatch {
  width: 8px;
  height: 8px;
  border-radius: 2px;
  flex-shrink: 0;
  background: #3B82F6;
}
.pie-swatch[style*="--i:0"] { background: #3B82F6; }
.pie-swatch[style*="--i:1"] { background: #10B981; }
.pie-swatch[style*="--i:2"] { background: #F59E0B; }
.pie-swatch[style*="--i:3"] { background: #8B5CF6; }
.pie-swatch[style*="--i:4"] { background: #EF4444; }
.pie-swatch[style*="--i:5"] { background: #06B6D4; }
.pie-swatch[style*="--i:6"] { background: #EC4899; }
.pie-swatch[style*="--i:7"] { background: #64748B; }

body.has-bottom-dock .workspace-stage {
  overflow: hidden;
  min-width: 0;
  max-width: 100%;
}

.side-dock {
  position: relative;
  display: flex;
  flex-direction: row;
  flex: 0 0 auto;
  flex-shrink: 0;
  align-self: stretch;
  min-height: 0;
  overflow: hidden;
  max-width: 100%;
  z-index: 2;
  background: #f5f7fa;
}
.side-dock-tabs {
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 6px 2px;
  width: 0;
  overflow: hidden;
  z-index: 35;
  max-height: 100%;
  box-sizing: border-box;
  background: linear-gradient(
    180deg,
    rgba(243, 244, 246, .7) 0%,
    rgba(229, 231, 235, .55) 100%
  );
  border-inline-end: 1px solid rgba(156, 163, 175, .4);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.side-dock.has-collapsed-tabs .side-dock-tabs {
  display: flex;
  width: 26px;
  min-width: 26px;
  flex-shrink: 0;
}

/* دکمه عمودی کریستالی — ارتفاع = اندازهٔ نوشته (نه ارتفاع ثابت بزرگ) */
.side-dock-chip,
.side-dock-tab {
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  align-items: center;
  justify-content: flex-start;
  gap: 4px;
  width: 22px;
  min-width: 22px;
  max-width: 22px;
  height: auto;
  min-height: 0;
  padding: 5px 0 6px;
  border: 1px solid rgba(255, 255, 255, .65);
  border-radius: 0;
  background: linear-gradient(
    160deg,
    rgba(255, 255, 255, .7) 0%,
    rgba(226, 232, 240, .45) 42%,
    rgba(148, 163, 184, .34) 100%
  );
  color: #374151;
  font-family: Tahoma, Arial, sans-serif;
  font-size: 8.5pt;
  font-weight: 400;
  cursor: pointer;
  box-sizing: border-box;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, .8),
    inset 0 -1px 0 rgba(15, 23, 42, .05),
    0 1px 3px rgba(15, 23, 42, .08);
  backdrop-filter: blur(8px) saturate(1.1);
  -webkit-backdrop-filter: blur(8px) saturate(1.1);
  writing-mode: horizontal-tb;
  transform: none;
  overflow: visible;
  transition: background .15s, border-color .15s, box-shadow .15s;
}
.side-dock-chip:hover,
.side-dock-tab:hover {
  background: linear-gradient(
    160deg,
    rgba(255, 255, 255, .85) 0%,
    rgba(241, 245, 249, .6) 50%,
    rgba(148, 163, 184, .4) 100%
  );
  color: #111827;
  border-color: rgba(255, 255, 255, .85);
}
.side-dock-chip.is-active,
.side-dock-tab.is-active {
  background: linear-gradient(
    160deg,
    rgba(255, 255, 255, .92) 0%,
    rgba(248, 250, 252, .75) 55%,
    rgba(203, 213, 225, .5) 100%
  );
  border-color: rgba(148, 163, 184, .6);
  color: #111827;
}
.side-dock-chip .ico-pin,
.side-dock-tab .ico-pin,
.side-dock-chip .side-dock-chip-ico,
.side-dock-tab .side-dock-chip-ico {
  width: 12px !important;
  height: 12px !important;
  flex: 0 0 auto;
  transform: none !important;
  object-fit: contain;
  display: block;
}
.side-dock-chip-text,
.side-dock-tab-text {
  flex: 0 0 auto;
  display: inline-block;
  writing-mode: vertical-rl;
  text-orientation: mixed;
  transform: rotate(180deg);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: clip;
  font-weight: 400;
  letter-spacing: .05em;
  line-height: 1.15;
  max-height: none;
  padding: 0;
}

.right-panel {
  width: var(--panel-w);
  min-width: var(--panel-w);
  max-width: var(--panel-w);
  background: #f5f7fa;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 8px;
  overflow-y: auto;
  overflow-x: hidden;
  flex-shrink: 0;
  position: relative;
  box-sizing: border-box;
  isolation: isolate;
}
/* وقتی پنلی پین نیست ستون محتوا کاملاً بسته — بدون نشت عنوان */
.side-dock:not(.has-pinned) .right-panel {
  display: none !important;
  width: 0 !important;
  min-width: 0 !important;
  max-width: 0 !important;
  padding: 0 !important;
  margin: 0 !important;
  overflow: hidden !important;
  border: none !important;
  visibility: hidden !important;
  pointer-events: none !important;
}
.side-dock.has-collapsed-tabs:not(.has-pinned):not(.has-flyout) {
  width: 26px;
  max-width: 26px;
  overflow: hidden;
}
.side-dock.has-flyout {
  overflow: hidden;
  max-width: calc(26px + var(--panel-w));
}

/* مخزن پنل‌های جمع‌شده — کاملاً خارج از دید */
.side-dock-graveyard {
  position: fixed !important;
  left: -10000px !important;
  top: 0 !important;
  width: 0 !important;
  height: 0 !important;
  overflow: hidden !important;
  opacity: 0 !important;
  pointer-events: none !important;
  visibility: hidden !important;
  z-index: -1 !important;
}
.side-dock-graveyard .panel-box,
.side-dock-graveyard .panel-title,
.side-dock-graveyard .panel-title-text,
.side-dock-graveyard .panel-title-text * {
  display: none !important;
  visibility: hidden !important;
  color: transparent !important;
  font-size: 0 !important;
  line-height: 0 !important;
}

/* باکس جمع‌شده: کاملاً مخفی — بدون نشت عنوان آبی */
.panel-box.is-collapsed {
  display: none !important;
  visibility: hidden !important;
  opacity: 0 !important;
  pointer-events: none !important;
  position: absolute !important;
  left: -9999px !important;
  top: 0 !important;
  width: 0 !important;
  height: 0 !important;
  max-width: 0 !important;
  max-height: 0 !important;
  overflow: hidden !important;
  margin: 0 !important;
  padding: 0 !important;
  border: none !important;
  clip: rect(0, 0, 0, 0) !important;
}
.panel-box.is-collapsed .panel-title,
.panel-box.is-collapsed .panel-title-text,
.panel-box.is-collapsed .panel-title-text *,
.panel-box.is-collapsed > * {
  display: none !important;
  visibility: hidden !important;
  color: transparent !important;
  font-size: 0 !important;
}
.panel-box.is-flyout {
  display: flex !important;
  visibility: visible !important;
  opacity: 1 !important;
  flex-direction: column;
  position: relative !important;
  left: auto !important;
  right: auto !important;
  top: auto !important;
  bottom: auto !important;
  width: 100% !important;
  max-width: 100% !important;
  height: auto !important;
  min-height: 120px;
  max-height: none !important;
  z-index: 2;
  background: #fff;
  border: 1px solid #9ca3af;
  border-radius: 0;
  box-shadow: none;
  overflow: auto;
  clip: auto !important;
  pointer-events: auto !important;
  flex: 1 1 auto;
}
[dir="rtl"] .panel-box.is-flyout,
[dir="ltr"] .panel-box.is-flyout {
  left: auto;
  right: auto;
}
.footer-flyout-host {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 119;
}
.footer-flyout-host .panel-box.is-flyout {
  pointer-events: auto;
}
@keyframes footerDockFlyIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.panel-title {
  height: 26px;
  min-height: 26px;
  max-height: 26px;
  padding: 0 8px;
  font-size: 8.5pt;
  font-weight: 400;
  background: #f0f4f8;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  color: var(--text);
  box-sizing: border-box;
  line-height: 1;
}
.panel-title-text {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-weight: 600;
  line-height: 1;
  height: 26px;
  color: #1e3a5f;
}
.panel-title i { color: var(--primary); font-size: 8.5pt; }

/* CORSOR 3D icon system — Fluent/visionOS soft-clay */
.ico-3d {
  display: inline-block;
  vertical-align: middle;
  object-fit: contain;
  flex-shrink: 0;
  user-select: none;
  pointer-events: none;
  transition: opacity .15s ease, transform .15s ease;
  /* سایه ملایم مثل پین سه‌بعدی */
  filter: drop-shadow(0 1px 1.5px rgba(15, 23, 42, .18));
}
.ico-3d-14 { width: 14px; height: 14px; }
.ico-3d-16 { width: 16px; height: 16px; }
.ico-3d-18 { width: 18px; height: 18px; }
.ico-3d-20 { width: 20px; height: 20px; }
.ico-3d-22 { width: 22px; height: 22px; }
.ico-3d-24 { width: 24px; height: 24px; }
.ico-3d-32 { width: 32px; height: 32px; }
.ico-3d-48 { width: 48px; height: 48px; }
.ico-3d-64 { width: 64px; height: 64px; }
.tb-btn:hover > .ico-3d,
.tb-dd-item:hover > .ico-3d,
.sub-tab:hover .ico-3d,
.panel-title-text:hover .ico-3d {
  transform: scale(1.06);
  filter: drop-shadow(0 2px 3px rgba(37, 99, 235, .22));
  opacity: 1;
}
.sub-tab .ico-3d {
  margin-inline-end: 5px;
  width: 16px !important;
  height: 16px !important;
}
.panel-title-text .ico-3d {
  margin-inline-end: 5px;
  width: 16px !important;
  height: 16px !important;
}

/* آیکون‌های گرافیکی رنگی ۲۰۲۶ داخل سربرگ پنل / نوار */
.ico-chip {
  width: 18px;
  height: 18px;
  border-radius: 5px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 1px 2px rgba(15, 23, 42, .12);
}
.ico-chip i {
  color: #fff !important;
  font-size: 8.5pt;
  line-height: 1;
  filter: drop-shadow(0 1px 0 rgba(0,0,0,.12));
}
.ico-chip.ico-filter { background: linear-gradient(145deg, #38bdf8 0%, #2563eb 100%); }
.ico-chip.ico-calculator { background: linear-gradient(145deg, #34d399 0%, #059669 100%); }
.ico-chip.ico-info-circle { background: linear-gradient(145deg, #a78bfa 0%, #7c3aed 100%); }
.ico-chip.ico-keyboard { background: linear-gradient(145deg, #fbbf24 0%, #f59e0b 100%); }
.ico-chip.ico-cog,
.ico-chip.ico-cogs { background: linear-gradient(145deg, #94a3b8 0%, #475569 100%); }
.ico-chip.ico-print { background: linear-gradient(145deg, #67e8f9 0%, #0891b2 100%); }
.ico-chip.ico-building { background: linear-gradient(145deg, #fdba74 0%, #ea580c 100%); }
.ico-chip.ico-database { background: linear-gradient(145deg, #5eead4 0%, #0d9488 100%); }
.ico-chip.ico-users { background: linear-gradient(145deg, #93c5fd 0%, #2563eb 100%); }
.ico-chip.ico-magic { background: linear-gradient(145deg, #f9a8d4 0%, #db2777 100%); }

.panel-box[data-panel="filter"] .panel-title-text { color: #1d4ed8; }
.panel-box[data-panel="summary"] .panel-title-text { color: #047857; }
.panel-box[data-panel="help"] .panel-title-text { color: #6d28d9; }
.panel-box[data-panel="shortcuts"] .panel-title-text { color: #b45309; }

.panel-box {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.panel-box > .filter-form,
.panel-box > .summary-list,
.panel-box > .org-panel-body {
  padding: 10px 12px;
  box-sizing: border-box;
}
.pin-btn {
  width: 18px;
  height: 18px;
  border: none !important;
  outline: none;
  background: transparent !important;
  border-radius: 3px;
  color: #64748b;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: color .12s, transform .12s;
  flex-shrink: 0;
  position: relative;
  z-index: 2;
  padding: 0;
  box-shadow: none !important;
}
.pin-btn:hover {
  border: none !important;
  color: #2563eb;
  background: transparent !important;
}
.pin-btn.is-pinned {
  color: #2563eb;
  border: none !important;
  background: transparent !important;
}
.pin-btn.is-pinned i {
  background: linear-gradient(145deg, #60a5fa, #2563eb);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 1px 1px rgba(37, 99, 235, .35));
}
.pin-btn:not(.is-pinned) i {
  transform: rotate(45deg);
  color: #94a3b8;
}
.pin-btn i {
  pointer-events: none;
  font-size: 8.5pt;
}
.pin-btn .ico-pin,
.footer-pin-btn .ico-pin,
.bottom-panel .pin-btn .ico-pin {
  width: 12px !important;
  height: 12px !important;
  display: block;
  transition: filter .15s ease, opacity .15s ease;
  transform: none !important;
}
/* پین شده → طوسی */
.pin-btn.is-pinned .ico-pin,
.footer-pin-btn.is-pinned .ico-pin,
.bottom-panel .pin-btn.is-pinned .ico-pin {
  filter: grayscale(1) brightness(1.05) opacity(.85) drop-shadow(0 1px 1px rgba(15, 23, 42, .2));
  opacity: 1;
}
/* پین نیست → آبی (طرح اولیه رنگی) */
.pin-btn:not(.is-pinned) .ico-pin,
.footer-pin-btn:not(.is-pinned) .ico-pin,
.bottom-panel .pin-btn:not(.is-pinned) .ico-pin {
  filter: drop-shadow(0 1px 2px rgba(37, 99, 235, .4));
  opacity: 1;
}
/* دکمه‌های جمع‌شده چپ/پایین — آیکون اختصاصی پنل (یا پین پیش‌فرض) */
.side-dock-chip .ico-pin,
.side-dock-tab .ico-pin,
.side-dock-chip .side-dock-chip-ico,
.side-dock-tab .side-dock-chip-ico,
.footer-panel-chip .ico-pin {
  width: 12px !important;
  height: 12px !important;
  filter: drop-shadow(0 1px 1px rgba(37, 99, 235, .35));
  opacity: 1;
  transform: none !important;
  object-fit: contain;
}
.side-dock-chip.is-active .ico-pin,
.side-dock-chip.is-active .side-dock-chip-ico,
.footer-panel-chip.is-active .ico-pin {
  filter: grayscale(1) opacity(.9) drop-shadow(0 1px 1px rgba(15, 23, 42, .2));
}

.side-dock-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: transparent;
  z-index: 25;
}
.side-dock-backdrop.is-visible {
  display: block;
}

.filter-form { padding: 10px; }
.fg { margin-bottom: 8px; }
.fg label {
  display: block;
  font-size: 8.5pt;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 3px;
}
.fg input, .fg select {
  width: 100%;
  max-width: 180px;
  border: 1px solid #c5cad0;
  border-radius: 5px;
  padding: 4px 8px;
  font-size: 8.5pt;
  font-family: Tahoma, Arial, sans-serif;
  font-weight: 400;
  outline: none;
  background: #fff;
  height: 24px;
  box-sizing: border-box;
  box-shadow: inset 0 1px 1px rgba(0,0,0,.04);
}
.right-panel .fg input,
.right-panel .fg select,
.right-panel .jdate-wrap {
  max-width: none;
}
.right-panel .btn { width: 100%; }
.fg input:focus, .fg select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(26,115,232,.12);
}
.input-icon { position: relative; }
.input-icon i {
  position: absolute;
  left: 8px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-light);
  font-size: 8.5pt;
}
.input-icon input { padding-left: 28px; }
.filter-actions { display: flex; flex-direction: column; gap: 5px; margin-top: 10px; }

/* ===== Jalali Date Picker ===== */
.jdate-wrap {
  position: relative;
  display: inline-block;
  width: 100%;
  max-width: 180px;
}
.jdate-wrap input.jdate-input,
input.jdate-input {
  width: 100%;
  font-variant-numeric: tabular-nums;
  letter-spacing: .02em;
  padding-left: 28px;
  direction: ltr;
  text-align: center;
  unicode-bidi: plaintext;
}
.df-row .jdate-wrap { max-width: 108px; width: 108px; }
.detail-form .jdate-wrap {
  width: 108px;
  max-width: 108px;
}
.detail-form .jdate-wrap input.jdate-input {
  width: 100%;
  max-width: 100%;
  text-align: center;
  height: 22px;
}
.win-body .jdate-wrap { max-width: 100%; }
.jdate-trigger {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 26px;
  border: none;
  background: transparent;
  color: var(--text-light);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  z-index: 1;
}
.jdate-trigger:hover { color: var(--primary); }
.jdate-trigger i {
  position: static;
  transform: none;
  font-size: 8.5pt;
  pointer-events: none;
}
.jdate-popup {
  position: fixed;
  z-index: 12000;
  width: 260px;
  background: #f3f3f3;
  border: 1px solid rgba(0,0,0,.14);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,.16), 0 0 1px rgba(0,0,0,.2);
  padding: 8px;
  font-family: var(--font);
  direction: rtl;
  user-select: none;
}
.jdate-head {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 6px;
}
.jdate-nav {
  width: 28px;
  height: 28px;
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 4px;
  cursor: pointer;
  font-size: 8.5pt;
  line-height: 1;
  color: var(--text);
  flex-shrink: 0;
}
.jdate-nav:hover { background: var(--primary-light); color: var(--primary); }
.jdate-selectors {
  flex: 1;
  display: flex;
  gap: 4px;
  min-width: 0;
}
.jdate-month, .jdate-year {
  flex: 1;
  height: 28px;
  border: 1px solid #c5cad0;
  border-radius: 4px;
  background: #fff;
  font-family: var(--font);
  font-size: 8.5pt;
  padding: 0 4px;
  outline: none;
  min-width: 0;
}
.jdate-month:focus, .jdate-year:focus { border-color: var(--primary); }
.jdate-week {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
  margin-bottom: 4px;
  text-align: center;
}
.jdate-week span {
  font-size: 8.5pt;
  color: var(--text-muted);
  font-weight: 600;
  padding: 2px 0;
}
.jdate-days {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
}
.jdate-empty { min-height: 30px; }
.jdate-day {
  min-height: 30px;
  border: none;
  background: #fff;
  border-radius: 4px;
  cursor: pointer;
  font-family: var(--font);
  font-size: 8.5pt;
  color: var(--text);
  padding: 0;
}
.jdate-day:hover { background: var(--primary-light); color: var(--primary); }
.jdate-day.is-today { box-shadow: inset 0 0 0 1px var(--primary); }
.jdate-day.is-selected {
  background: var(--primary);
  color: #fff;
  font-weight: 700;
}
.jdate-foot {
  display: flex;
  justify-content: space-between;
  gap: 6px;
  margin-top: 8px;
  padding-top: 6px;
  border-top: 1px solid var(--border);
}
.jdate-today, .jdate-clear {
  flex: 1;
  height: 26px;
  border: 1px solid #c0c4c8;
  background: #fff;
  border-radius: 4px;
  font-family: var(--font);
  font-size: 8.5pt;
  cursor: pointer;
  color: var(--text);
}
.jdate-today:hover { background: var(--primary-light); color: var(--primary); border-color: var(--primary); }
.jdate-clear:hover { background: #fef2f2; color: var(--danger); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 7px 14px;
  border-radius: 5px;
  font-size: 8.5pt;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: .15s;
  width: 100%;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-secondary {
  background: #fff;
  color: var(--text);
  border: 1px solid #c0c4c8;
}
.btn-secondary:hover { background: #f3f4f6; }
.btn-outline {
  background: #fff;
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-outline:hover { background: #f3f4f6; }
.btn-sm { padding: 6px 12px; font-size: 8.5pt; width: auto; min-height: 30px; }

.summary-list { padding: 4px 10px; }
.sum-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 2px 0;
  font-size: 8.5pt;
  line-height: 1.2;
  color: var(--text-muted);
  border-bottom: 1px dashed #e5e7eb;
}
.sum-row:last-child { border-bottom: none; }
.sum-row strong { color: var(--text); font-weight: 700; font-variant-numeric: tabular-nums; }
.sum-row.highlight {
  margin-top: 2px;
  padding-top: 4px;
  border-top: 1px solid var(--border);
  border-bottom: none;
  color: var(--primary);
}
.sum-row.highlight strong { color: var(--primary); font-size: 8.5pt; }

/* Detail Panels */
.detail-panels {
  display: grid;
  grid-template-columns: 1fr 1.4fr 1fr;
  gap: 0;
  height: 200px;
  flex-shrink: 0;
  border-top: 1px solid var(--border);
  background: #fff;
}
.detail-panel {
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: 0;
}
.detail-panel:last-child { border-left: none; }
.dp-header {
  padding: 4px 8px;
  font-size: 8.5pt;
  font-weight: 400;
  font-family: Tahoma, Arial, sans-serif;
  background: #f0f4f8;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
}
.dp-header i { color: var(--primary); font-size: 8.5pt; }
.dp-body { flex: 1; overflow: auto; padding: 6px 8px; min-height: 0; }
.dp-body-compact { overflow: hidden; padding: 5px 6px; }
.chart-body { padding: 4px; position: relative; }

.detail-form {
  font-family: Tahoma, Arial, sans-serif;
  font-size: 8.5pt;
  height: 100%;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.detail-form .df-grid {
  display: grid;
  grid-template-columns: repeat(2, max-content);
  column-gap: 14px;
  row-gap: 5px;
  justify-content: start;
  align-content: start;
}
.detail-form .df-row {
  display: grid;
  grid-template-columns: 68px 108px;
  align-items: center;
  gap: 5px;
  margin: 0;
  min-width: 0;
}
.detail-form .df-row-full {
  grid-column: 1 / -1;
  grid-template-columns: 68px minmax(108px, 240px);
}
.detail-form label {
  font-size: 8.5pt;
  font-weight: 400;
  color: #64748b;
  white-space: nowrap;
  text-align: start;
}
.detail-form input,
.detail-form select,
.detail-form textarea {
  border: 1px solid #c5cad0;
  border-radius: 5px;
  padding: 0 6px;
  font-size: 8.5pt;
  font-family: Tahoma, Arial, sans-serif;
  font-weight: 400;
  outline: none;
  width: 108px;
  max-width: 108px;
  height: 22px;
  box-sizing: border-box;
  text-align: right;
  background: #fff;
  box-shadow: inset 0 1px 1px rgba(0,0,0,.04);
}
.detail-form .df-row-full input,
.detail-form .df-row-full select,
.detail-form .df-row-full textarea,
.detail-form .df-row-full .radio-group {
  width: 100%;
  max-width: 240px;
}
.detail-form textarea {
  height: 28px;
  resize: none;
  line-height: 1.3;
  padding-top: 4px;
}
.detail-form input:focus,
.detail-form select:focus,
.detail-form textarea:focus {
  border-color: #93a0ad;
  box-shadow: inset 0 1px 1px rgba(0,0,0,.04);
}
.detail-form input[readonly] { background: #f5f6f8; }
.radio-group {
  display: flex;
  gap: 10px;
  align-items: center;
  height: 22px;
  margin: 0;
}
.radio-group label {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-weight: 400;
  font-size: 8.5pt;
  color: #1f2937;
  cursor: pointer;
  white-space: nowrap;
  text-align: right;
}
.radio-group input {
  width: 12px !important;
  height: 12px !important;
  margin: 0;
  padding: 0;
  accent-color: var(--primary);
  transform: none !important;
}
.df-actions {
  display: flex;
  gap: 6px;
  margin: 0;
  padding-top: 2px;
  justify-content: flex-start;
  align-items: center;
  flex-shrink: 0;
}
.df-actions .btn-sm {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 0 10px;
  font-size: 8.5pt;
  font-weight: 400;
  font-family: Tahoma, Arial, sans-serif;
  border-radius: 5px;
  height: 22px;
  min-width: 64px;
  width: auto;
  line-height: 1;
}

.mini-table-wrap { overflow: auto; height: 100%; }
.mini-table {
  width: max-content;
  min-width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 8.5pt;
  font-family: Tahoma, Arial, sans-serif;
  font-weight: 400;
}
.mini-table th {
  background: #f8fafc;
  padding: 4px 6px;
  text-align: center;
  font-weight: 400;
  color: var(--text-muted);
  border-bottom: 1px solid #d0d5db;
  border-left: 1px solid #e5e7eb;
  white-space: nowrap;
  position: sticky;
  top: 0;
  z-index: 5;
  font-size: 8.5pt;
  overflow: hidden;
  user-select: none;
  line-height: 1.25;
}
.mini-table th:last-child { border-left: none; }
.mini-table td {
  padding: 3px 6px;
  border-bottom: 1px solid #eef0f3;
  border-left: 1px solid #eceff2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: center;
  font-size: 8.5pt;
  font-weight: 400;
  line-height: 1.25;
  vertical-align: middle;
}
.mini-table td:last-child { border-left: none; }
.mini-table tfoot td {
  background: #f8fafc;
  border-top: 1px solid #d0d5db;
  border-left: 1px solid #eceff2;
  padding: 3px 6px;
  text-align: center;
  font-size: 8.5pt;
  font-weight: 400;
}
.mini-table tfoot td:last-child {
  border-left: none;
  color: var(--primary);
}

/* Footer — یک ردیف ثابت، بدون پین؛ کپی‌رایت وسط؛ بدون بولد */
.app-footer {
  height: var(--footer-h);
  min-height: var(--footer-h);
  max-height: var(--footer-h);
  background: linear-gradient(180deg, var(--header-bg) 0%, var(--header-bg-dark) 100%);
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  column-gap: 12px;
  padding: 0 12px;
  font-size: 8.5pt;
  font-weight: 400;
  line-height: 1.35;
  color: var(--header-fg);
  flex-shrink: 0;
  z-index: 50;
  border-top: 1px solid #0f2f3a;
  overflow: hidden;
  box-sizing: border-box;
}
.app-footer *,
.app-footer strong,
.app-footer b {
  font-weight: 400 !important;
}
.footer-side {
  display: flex;
  align-items: center;
  gap: 0;
  min-width: 0;
  overflow: hidden;
  height: 100%;
}
.footer-side-start {
  justify-content: flex-start;
}
.footer-side-end {
  justify-content: flex-end;
}
.footer-center {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  height: 100%;
  padding: 0 10px;
  text-align: center;
  pointer-events: none;
}
.footer-copy {
  font-size: 8.5pt;
  font-weight: 400;
  line-height: 1.35;
  color: #e8f4f8;
  white-space: nowrap;
  letter-spacing: .01em;
}
.footer-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
  max-width: none;
  height: 100%;
  padding: 0 10px;
  white-space: nowrap;
  overflow: visible;
  line-height: 1.35;
  font-weight: 400;
}
.footer-item > .ico-3d {
  width: 14px !important;
  height: 14px !important;
  flex-shrink: 0;
  filter: drop-shadow(0 1px 1px rgba(0, 0, 0, .25));
}
.footer-item > span {
  overflow: visible;
  text-overflow: clip;
  font-weight: 400;
  line-height: 1.35;
}
.footer-sep {
  width: 1px;
  height: 16px;
  background: rgba(255, 255, 255, .18);
  flex-shrink: 0;
  align-self: center;
}
.footer-strong { font-weight: 400; color: #fff; }
.footer-muted { opacity: .78; font-weight: 400; }
.footer-clock,
.footer-date,
#footerSession {
  font-variant-numeric: tabular-nums;
  font-weight: 400;
  color: #fff;
  letter-spacing: .02em;
  direction: ltr;
  unicode-bidi: isolate;
  line-height: 1.35;
}
.online-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #2ecc71;
  display: inline-block;
  flex-shrink: 0;
  box-shadow: 0 0 0 2px rgba(46, 204, 113, .28);
  animation: footerOnlineBlink 1.2s ease-in-out infinite;
}
@keyframes footerOnlineBlink {
  0%, 100% {
    opacity: 1;
    box-shadow: 0 0 0 2px rgba(46, 204, 113, .35), 0 0 6px rgba(46, 204, 113, .55);
  }
  50% {
    opacity: .25;
    box-shadow: 0 0 0 2px rgba(46, 204, 113, .08), 0 0 2px rgba(46, 204, 113, .15);
  }
}

/* نوار چیپ پنل‌های جمع‌شده — بالای فوتر */
.footer-panel-dock {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  min-height: var(--footer-panel-dock-h);
  padding: 3px 8px;
  background: linear-gradient(180deg, #2a5f73 0%, #1e4a5c 100%);
  border-top: 1px solid #0f2f3a;
  flex-shrink: 0;
  z-index: 51;
}
.footer-panel-dock[hidden] { display: none !important; }
.footer-panel-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 22px;
  padding: 0 8px 0 6px;
  border: 1px solid rgba(255, 255, 255, .25);
  background: rgba(255, 255, 255, .1);
  color: #e8f4f8;
  font-family: inherit;
  font-size: 8.5pt;
  cursor: pointer;
  border-radius: 2px;
  max-width: 200px;
}
.footer-panel-chip:hover {
  background: rgba(255, 255, 255, .18);
  color: #fff;
}
.footer-panel-chip.is-active {
  background: #fff;
  color: #163a48;
  border-color: #fff;
}
.footer-panel-chip-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.footer-item.center { font-weight: 400; color: #fff; }
.sep { opacity: .4; margin: 0 2px; }

/* چگالی ردیف جدول */
.grid-table.density-compact th,
.grid-table.density-compact td { padding-top: 3px; padding-bottom: 3px; line-height: 1.15; }
.grid-table.density-normal th,
.grid-table.density-normal td { padding-top: 6px; padding-bottom: 6px; }
.grid-table.density-comfort th,
.grid-table.density-comfort td { padding-top: 10px; padding-bottom: 10px; line-height: 1.45; }
#personsTableBody.is-loading { opacity: .55; pointer-events: none; }
.grid-table .col-check { width: 36px; text-align: center; }

/* Toast */
.toast-container {
  position: fixed;
  bottom: 42px;
  left: 16px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.toast {
  background: #1f2937;
  color: #fff;
  padding: 10px 16px;
  border-radius: 7px;
  font-size: 8.5pt;
  box-shadow: 0 4px 16px rgba(0,0,0,.2);
  display: flex;
  align-items: center;
  gap: 8px;
  animation: slideIn .25s ease;
  min-width: 240px;
}
.toast.success { background: #166534; }
.toast.info { background: #1e3a5f; }
.toast.warning { background: #92400e; }
.toast.danger { background: #991b1b; }
@keyframes slideIn {
  from { opacity: 0; transform: translateX(-16px); }
  to { opacity: 1; transform: translateX(0); }
}

/* ===== Windows 11 style window ===== */
.win-overlay {
  position: absolute;
  inset: 0;
  z-index: 5000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: rgba(0, 0, 0, .28);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}
.win-overlay.open { display: flex; }
.win-overlay.is-maximized {
  padding: 0;
  background: transparent;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}
.win-overlay.is-minimized {
  align-items: flex-end;
  justify-content: flex-start;
  padding: 0 12px 10px;
  background: transparent;
  backdrop-filter: none;
  pointer-events: none;
}
.win-overlay.is-minimized .win-window { pointer-events: auto; }

.win-window {
  background: rgba(243, 243, 243, .92);
  border: 1px solid rgba(0, 0, 0, .12);
  border-radius: 8px;
  width: min(560px, 100%);
  max-height: calc(100% - 8px);
  box-shadow:
    0 8px 16px rgba(0, 0, 0, .14),
    0 0 1px rgba(0, 0, 0, .2);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: winIn .18s ease;
  backdrop-filter: blur(40px) saturate(1.2);
  -webkit-backdrop-filter: blur(40px) saturate(1.2);
}
@keyframes winIn {
  from { opacity: 0; transform: scale(.97) translateY(6px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.win-overlay.is-maximized .win-window {
  width: 100%;
  height: 100%;
  max-height: none;
  border-radius: 0;
  border: none;
  box-shadow: none;
  animation: none;
  background: #f3f3f3;
  backdrop-filter: none;
}
.win-overlay.is-minimized .win-window {
  width: 260px;
  max-height: none;
  border-radius: 8px;
  animation: none;
}
.win-overlay.is-minimized .win-body,
.win-overlay.is-minimized .win-footer { display: none; }

.win-titlebar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 32px;
  padding: 0 0 0 4px;
  flex-shrink: 0;
  user-select: none;
  cursor: default;
  background: transparent;
}
.win-title {
  flex: 1;
  font-size: 8.5pt;
  font-weight: 600;
  color: #1a1a1a;
  padding: 0 10px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 32px;
}
.win-controls {
  display: flex;
  align-items: stretch;
  height: 100%;
  flex-shrink: 0;
}
.win-caption {
  width: 46px;
  height: 100%;
  border: none;
  background: transparent;
  color: #1a1a1a;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: background .1s;
}
.win-caption svg {
  width: 10px;
  height: 10px;
  display: block;
}
.win-caption:hover { background: rgba(0, 0, 0, .06); }
.win-caption.win-close:hover {
  background: #c42b1c;
  color: #fff;
}
.win-caption .ico-restore { display: none; }
.win-overlay.is-maximized .win-caption .ico-max { display: none; }
.win-overlay.is-maximized .win-caption .ico-restore { display: block; }

.win-body {
  padding: 16px 18px;
  font-size: 8.5pt;
  line-height: 1.6;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
  background: #fff;
  border-top: 1px solid rgba(0, 0, 0, .06);
}
.win-footer {
  padding: 10px 14px;
  border-top: 1px solid rgba(0, 0, 0, .08);
  display: flex;
  gap: 6px;
  justify-content: flex-start;
  flex-shrink: 0;
  background: #f9f9f9;
}
.win-footer:empty { display: none; }
.win-footer .btn { width: auto; }

.win-window.win-lg {
  width: min(920px, 100%);
}
.win-window.win-md {
  width: min(560px, 100%);
}

.win-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 14px;
}
.win-form-grid .fg {
  margin: 0;
}
.win-form-grid .fg input,
.win-form-grid .fg select,
.win-form-grid .jdate-wrap,
.win-modal-form .fg input,
.win-modal-form .fg select,
.win-modal-form .jdate-wrap {
  max-width: none;
  width: 100%;
}
.win-form-full {
  grid-column: 1 / -1;
}
.win-modal-form textarea {
  width: 100%;
  max-width: 100%;
  min-height: 48px;
  border: 1px solid #c5cad0;
  border-radius: 5px;
  padding: 6px;
  font-family: var(--font);
  box-sizing: border-box;
}
.win-body .toast {
  position: relative;
  margin-bottom: 8px;
  opacity: 1;
}

/* سازگاری با کلاس‌های قبلی مودال */
.modal-overlay { /* legacy alias unused */ }
.modal-body, .win-body p { margin: 0 0 .6em; }
.modal-body p:last-child, .win-body p:last-child { margin-bottom: 0; }

/* Module placeholder overlay */
.module-placeholder {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: #fff;
  gap: 12px;
  color: var(--text-muted);
}
.module-placeholder i { font-size: 8.5pt; color: var(--primary); opacity: .5; }
.module-placeholder h2 { font-size: 8.5pt; color: var(--text); }

/* Responsive */
@media (max-width: 1200px) {
  .detail-panels { grid-template-columns: 1fr 1fr; height: auto; max-height: 280px; }
  .detail-panel:last-child { grid-column: 1 / -1; height: 180px; }
}
@media (max-width: 900px) {
  .header-title { display: none; }
  .detail-panels { grid-template-columns: 1fr; height: auto; }
}

/* ===== قدم ۷: mobile-first / جدول کارتی / همبرگر ناوبری ===== */
@media (max-width: 768px) {
  body {
    height: auto;
    min-height: 100dvh;
    overflow-x: hidden;
    overflow-y: auto;
  }

  .top-header {
    height: auto;
    min-height: var(--header-h);
    padding: var(--space-2) var(--space-3);
  }

  .hamburger {
    width: 44px;
    height: 44px;
    min-width: 44px;
    min-height: 44px;
  }

  /* موبایل غیر فشرده نماند — is-compact-nav همبرگر را جایگزین می‌کند */
  html:not(.is-compact-nav):not(.is-pwa) .main-nav {
    display: block;
    height: auto;
    max-height: 40vh;
    overflow-x: auto;
    overflow-y: auto;
    padding: var(--space-2);
    border-bottom: 1px solid var(--color-border);
  }

  html:not(.is-compact-nav):not(.is-pwa) .nav-tabs {
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: stretch;
    height: auto;
    gap: var(--space-1);
  }

  html.is-compact-nav .main-nav,
  html.is-pwa .main-nav {
    display: none !important;
  }

  .nav-tab {
    height: 44px;
    margin: 0;
    border-radius: var(--radius-md);
    border: 1px solid var(--color-border);
    background: var(--color-surface);
    justify-content: flex-start;
  }

  .nav-tab.active {
    background: var(--primary-light);
    color: var(--color-primary);
  }

  .workspace {
    min-height: calc(100dvh - 120px);
  }

  .workspace-stage {
    overflow: auto;
  }

  .sub-tabs {
    flex-wrap: wrap;
    gap: var(--space-2);
    height: auto;
    min-height: 44px;
  }

  .tb-btn,
  .btn {
    min-height: 44px;
    min-width: 44px;
  }

  /* جدول → کارت عمودی (بدون اسکرول افقی صفحه) */
  .table-scroll {
    overflow: visible;
  }

  .grid-table.ds-table,
  .grid-table.ds-table thead,
  .grid-table.ds-table tbody,
  .grid-table.ds-table tr,
  .grid-table.ds-table th,
  .grid-table.ds-table td,
  .ds-table-wrap .grid-table,
  .ds-table-wrap .grid-table thead,
  .ds-table-wrap .grid-table tbody,
  .ds-table-wrap .grid-table tr,
  .ds-table-wrap .grid-table th,
  .ds-table-wrap .grid-table td {
    display: block;
    width: 100%;
  }

  .ds-table-wrap .grid-table thead,
  .grid-table.ds-table thead {
    display: none;
  }

  .ds-table-wrap .grid-table tbody tr,
  .grid-table.ds-table tbody tr {
    margin-bottom: var(--space-4);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    background: var(--color-surface);
    box-shadow: var(--shadow-card);
  }

  .ds-table-wrap .grid-table td,
  .grid-table.ds-table td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-2) var(--space-3);
    border: none;
    border-bottom: 1px solid var(--color-border);
    text-align: left;
  }

  .ds-table-wrap .grid-table td:last-child,
  .grid-table.ds-table td:last-child {
    border-bottom: none;
  }

  .ds-table-wrap .grid-table td::before,
  .grid-table.ds-table td::before {
    content: attr(data-label);
    font-weight: 600;
    color: var(--color-text-muted);
    flex: 0 0 38%;
    text-align: right;
  }

  .filter-form,
  form.filter-form {
    flex-direction: column !important;
    align-items: stretch !important;
  }

  .filter-form .fg,
  .filter-form input,
  .filter-form select {
    max-width: 100% !important;
    width: 100%;
  }

  .cal-grid {
    gap: 0;
  }

  .cal-cell {
    min-height: 56px;
    font-size: 8.5pt;
  }
}

@media (min-width: 769px) {
  html:not(.is-compact-nav):not(.is-pwa) .main-nav {
    display: block !important;
  }
}

/* —— ماژول سازمان: پدینگ و فاصله اصولی —— */
.org-module .org-page-body {
  padding: 12px;
  overflow: auto;
  min-height: 0;
  box-sizing: border-box;
}
.org-module .org-page-body.with-split {
  padding: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}
.org-module .table-area.org-content-pad {
  padding: 12px 14px;
  overflow: auto;
  box-sizing: border-box;
}
.org-module .grid-table th {
  padding: 8px 10px;
  line-height: 1.35;
}
.org-module .grid-table td {
  padding: 7px 10px;
  line-height: 1.35;
}
.org-module .panel-box .filter-form,
.org-module .panel-box .summary-list,
.org-module .panel-box .org-panel-body {
  padding: 12px;
  box-sizing: border-box;
}
.org-module .panel-box .filter-form .fg input,
.org-module .panel-box .filter-form .fg select,
.org-module .panel-box .org-panel-body .fg input,
.org-module .panel-box .org-panel-body .fg select {
  max-width: none;
  width: 100%;
  box-sizing: border-box;
  height: 30px;
}
.org-module .panel-box .filter-actions {
  margin-top: 12px;
  gap: 6px;
}
.org-module .panel-box .filter-actions .btn {
  width: 100%;
}
.org-module .panel-title {
  height: 26px;
  min-height: 26px;
  max-height: 26px;
  padding: 0 8px;
  box-sizing: border-box;
}
.org-module .win-form-grid {
  gap: 10px 12px;
}
.org-module .win-form-grid .fg input,
.org-module .win-form-grid .fg select,
.org-module .win-form-grid textarea {
  max-width: none;
  width: 100%;
  box-sizing: border-box;
  min-height: 30px;
  padding: 6px 8px;
}
.org-module .win-form-grid textarea {
  min-height: 56px;
  resize: vertical;
}
.org-module .org-hint {
  margin: 0 0 12px;
  padding: 8px 10px;
  font-size: 8.5pt;
  color: var(--color-text-muted, #64748b);
  background: #f8fafc;
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 4px;
  line-height: 1.5;
}
.org-module .org-section-title {
  margin: 16px 0 8px;
  font-size: 8.5pt;
  font-weight: 700;
  color: var(--text, #1f2937);
}
.org-module .org-table-frame {
  border: 1px solid var(--border, #d0d5db);
  background: #fff;
}
.org-module .wizard-steps {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.org-module .wizard-step-chip {
  padding: 7px 12px;
  border: 1px solid var(--border, #d0d5db);
  border-radius: 4px;
  background: #fff;
  font-size: 8.5pt;
}
.org-module .wizard-step-chip.is-active {
  background: var(--primary, #1a73e8);
  border-color: var(--primary, #1a73e8);
  color: #fff;
}
.org-module .wizard-option {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 8px;
  cursor: pointer;
  padding: 10px 12px;
  border: 1px solid var(--border, #d0d5db);
  border-radius: 4px;
  background: #fff;
  box-sizing: border-box;
}
.org-module .wizard-option.is-dashed {
  border-style: dashed;
}
.org-module .wizard-actions {
  margin-top: 14px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.org-module .wizard-actions .btn {
  width: auto;
  min-width: 96px;
  padding: 7px 16px;
}
.org-modal-wrap {
  padding: 12px 14px 14px;
  font-size: 8.5pt;
  box-sizing: border-box;
}
.org-modal-wrap .win-form-grid .fg input,
.org-modal-wrap .win-form-grid .fg select,
.org-modal-wrap .win-form-grid textarea {
  max-width: none;
  width: 100%;
  box-sizing: border-box;
}
.org-modal-wrap .wizard-actions .btn {
  width: auto;
  min-width: 96px;
}
.org-modal-wrap .org-logo-preview {
  text-align: center;
  margin: 8px 0 12px;
}
.org-module .org-tax-keys {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  max-width: 920px;
}
.org-module .org-tax-key-card {
  border: 1px solid var(--border, #d0d5db);
  border-radius: 4px;
  padding: 12px;
  background: #fff;
  box-sizing: border-box;
}
.org-module .org-tax-key-title {
  font-weight: 700;
  margin-bottom: 8px;
  font-size: 8.5pt;
}
@media (max-width: 720px) {
  .org-module .org-tax-keys {
    grid-template-columns: 1fr;
  }
}

.org-modal-wrap .org-logo-preview img {
  max-width: 140px;
  max-height: 100px;
  object-fit: contain;
  border: 1px solid var(--border, #d0d5db);
  background: #fff;
  padding: 4px;
}

/* فرم شخص: هدر اطلاعات پایه + فعال */
.person-form-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 0 10px;
  margin-bottom: 4px;
  border-bottom: 1px solid var(--border, #e5e7eb);
}
.person-form-section-head .panel-title-text {
  font-weight: 700;
  font-size: 8.5pt;
}
.person-active-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 8.5pt;
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
  margin: 0;
}
.person-active-toggle input {
  width: 12px !important;
  height: 12px !important;
  margin: 0;
  padding: 0;
  accent-color: var(--primary, #1a73e8);
  transform: none !important;
}

/* کنترل‌های فرم استاندارد — رادیو/چک هرگز بزرگ نشوند (قانون egpeco-structure-mandatory) */
input[type="radio"],
input[type="checkbox"],
.role-check,
.row-check,
.filter-form input[type="radio"],
.filter-form input[type="checkbox"],
.win-window input[type="radio"],
.win-window input[type="checkbox"],
.panel-box input[type="radio"],
.panel-box input[type="checkbox"],
.grid-table input[type="radio"],
.grid-table input[type="checkbox"] {
  width: 12px !important;
  height: 12px !important;
  min-width: 12px !important;
  min-height: 12px !important;
  max-width: 13px !important;
  max-height: 13px !important;
  margin: 0;
  padding: 0;
  vertical-align: middle;
  transform: none !important;
  accent-color: var(--primary, #1a73e8);
}
.persons-basedata .basedata-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border, #e5e7eb);
  background: #f8fafc;
}
.persons-basedata .basedata-nav a {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  border: 1px solid var(--border, #d0d5db);
  border-radius: 4px;
  background: #fff;
  color: #1f2937;
  text-decoration: none;
  font-size: 8.5pt;
}
.persons-basedata .basedata-nav a.is-active {
  background: var(--primary, #1a73e8);
  border-color: var(--primary, #1a73e8);
  color: #fff;
}
.persons-basedata .basedata-body {
  padding: 12px;
  overflow: auto;
}
.persons-basedata .tb-btn.is-disabled,
.persons-basedata .tb-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
}

/* ماتریس ماژول‌های اصلی — گروه‌های اشخاص */
.person-groups-matrix thead th.person-group-mod-span {
  text-align: center;
  background: #f3f6f9;
  font-weight: 700;
  white-space: nowrap;
}
.person-groups-matrix thead th.person-group-mod-h {
  vertical-align: bottom;
  width: 28px;
  min-width: 28px;
  max-width: 36px;
  padding: 6px 2px;
  background: #f8fafc;
}
.person-groups-matrix .person-group-mod-h-text {
  display: inline-block;
  writing-mode: vertical-rl;
  text-orientation: mixed;
  transform: rotate(180deg);
  white-space: nowrap;
  font-size: 8.5pt;
  font-weight: 600;
  line-height: 1.15;
  max-height: 110px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.person-groups-matrix td.person-group-mod-cell {
  text-align: center;
  width: 28px;
  padding: 4px 2px;
}
.person-groups-matrix .person-group-mod-check {
  width: 12px;
  height: 12px;
  margin: 0;
  cursor: pointer;
  vertical-align: middle;
}

/* راهنمای کریستالی + زیباسازی سازمانی — فقط صفحهٔ گروه‌های اشخاص */
.persons-groups-page .persons-groups-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 0 0 8px;
  padding: 8px 12px;
  border-radius: 4px;
  background: linear-gradient(105deg, #e8f1fa 0%, #f4f7fb 48%, #eef4fa 100%);
  border: 1px solid #c9d8e8;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9);
}
.persons-groups-page .persons-groups-title-text {
  flex: 1;
  font-weight: 700;
  font-size: 10pt;
  color: #0f2744;
  letter-spacing: 0.01em;
}
.persons-groups-page .page-help-crystal-btn {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 24px;
  padding: 0 10px 0 8px;
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 3px;
  background: linear-gradient(
    155deg,
    rgba(255, 255, 255, 0.82) 0%,
    rgba(224, 242, 254, 0.55) 38%,
    rgba(186, 230, 253, 0.42) 100%
  );
  color: #1e3a5f;
  font-family: inherit;
  font-size: 8.5pt;
  font-weight: 700;
  letter-spacing: 0.01em;
  cursor: pointer;
  box-sizing: border-box;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.95),
    inset 0 -1px 0 rgba(59, 130, 246, 0.12),
    0 1px 4px rgba(30, 58, 95, 0.1),
    0 0 0 1px rgba(147, 197, 253, 0.35);
  backdrop-filter: blur(10px) saturate(1.25);
  -webkit-backdrop-filter: blur(10px) saturate(1.25);
  transition: background 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}
.persons-groups-page .page-help-crystal-btn i {
  font-size: 9pt;
  color: #2563eb;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.8);
}
.persons-groups-page .page-help-crystal-btn span {
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.65);
}
.persons-groups-page .page-help-crystal-btn:hover {
  background: linear-gradient(
    155deg,
    rgba(255, 255, 255, 0.95) 0%,
    rgba(219, 234, 254, 0.72) 45%,
    rgba(191, 219, 254, 0.55) 100%
  );
  border-color: rgba(255, 255, 255, 0.9);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 1),
    inset 0 -1px 0 rgba(59, 130, 246, 0.18),
    0 2px 8px rgba(37, 99, 235, 0.18),
    0 0 0 1px rgba(96, 165, 250, 0.55);
}
.persons-groups-page .page-help-crystal-btn:active {
  transform: translateY(1px);
}

.persons-groups-page .person-groups-matrix thead tr.persons-groups-head th {
  background: linear-gradient(180deg, #e8f1fa 0%, #d6e6f5 100%);
  color: #0f2744;
  font-weight: 700;
  border-bottom-color: #b7c9dc;
}
.persons-groups-page .person-groups-matrix thead th.person-group-mod-span {
  background: linear-gradient(180deg, #dbeafe 0%, #bfdbfe 100%);
  color: #1e3a5f;
  font-weight: 700;
  letter-spacing: 0.02em;
}
.persons-groups-page .person-groups-matrix thead th.person-group-mod-h {
  background: #eef4fb;
}
.persons-groups-page .person-groups-matrix tbody tr.pg-row:hover td {
  background: #f5f9fd;
}
.persons-groups-page .person-groups-matrix tbody tr.pg-row:has(.row-check:checked) td {
  background: #e8f2fc;
}
.persons-groups-page .pg-name {
  font-weight: 700;
  color: #0f2744;
}
.persons-groups-page .pg-desc {
  color: #475569;
  font-weight: 400;
}
.persons-groups-page .pg-parent-badge {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 3px;
  background: linear-gradient(180deg, #e0f2fe 0%, #bae6fd 100%);
  border: 1px solid #7dd3fc;
  color: #0c4a6e;
  font-size: 8pt;
  font-weight: 600;
}
.persons-groups-page .pg-root-badge {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 3px;
  background: linear-gradient(180deg, #f1f5f9 0%, #e2e8f0 100%);
  border: 1px solid #cbd5e1;
  color: #64748b;
  font-size: 8pt;
  font-weight: 600;
}
.persons-groups-page .pg-members-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 18px;
  padding: 0 6px;
  border-radius: 9px;
  background: linear-gradient(180deg, #dbeafe 0%, #bfdbfe 100%);
  color: #1e40af;
  font-weight: 700;
  font-size: 8pt;
  border: 1px solid #93c5fd;
}
.persons-groups-page .pg-members-pill.is-empty {
  background: linear-gradient(180deg, #f8fafc 0%, #e2e8f0 100%);
  color: #94a3b8;
  border-color: #cbd5e1;
  font-weight: 600;
}
.persons-groups-page .pg-members-pill.is-hot {
  background: linear-gradient(180deg, #fef3c7 0%, #fde68a 100%);
  color: #92400e;
  border-color: #fbbf24;
}
.persons-groups-page .pg-child-hint {
  margin-right: 4px;
  color: #0369a1;
  font-size: 7.5pt;
  font-weight: 700;
}

.persons-groups-page .side-dock .panel-box {
  border-radius: 4px;
  overflow: hidden;
  box-shadow: 0 1px 4px rgba(30, 58, 95, 0.08);
}
.persons-groups-page .side-dock .panel-box[data-panel="bd_summary"] .panel-title,
.persons-groups-page .side-dock .panel-box[data-panel="bd_pg_sel"] .panel-title {
  background: linear-gradient(90deg, #e8f1fa 0%, #f8fafc 100%);
}
.persons-groups-page .pg-sum-list .sum-row.highlight,
.persons-groups-page .summary-list .sum-row.highlight {
  background: linear-gradient(90deg, #dbeafe 0%, transparent 100%);
  border-radius: 3px;
}
.persons-groups-page .sum-row--ok {
  background: linear-gradient(90deg, #ecfdf5 0%, transparent 100%);
  border-radius: 3px;
}
.persons-groups-page .sum-row--ok strong { color: #15803d; }
.persons-groups-page .sum-row--warn {
  background: linear-gradient(90deg, #fff7ed 0%, transparent 100%);
  border-radius: 3px;
}
.persons-groups-page .sum-row--warn strong { color: #c2410c; }
.persons-groups-page .pg-sum-divider {
  margin: 8px 0 4px;
  padding: 3px 6px;
  font-size: 8pt;
  font-weight: 700;
  color: #1e3a5f;
  background: linear-gradient(90deg, #e0e7ff 0%, transparent 100%);
  border-right: 3px solid #6366f1;
  border-radius: 2px;
}

.persons-groups-help-body .acc-help-lead {
  margin: 12px 0 6px;
  font-weight: 700;
  color: #0f2744;
  font-size: 9.5pt;
}
.persons-groups-help-body .acc-help-lead:first-child {
  margin-top: 0;
}
.persons-groups-help-body .acc-label-strong {
  font-weight: 700;
  color: #1e3a5f;
}
.persons-groups-help-body .acc-type-note {
  display: inline-block;
  margin: 0 0 4px 6px;
  padding: 2px 8px;
  border-radius: 3px;
  background: #e8f1fa;
  color: #1e3a5f;
  font-size: 8pt;
  font-weight: 600;
}
.persons-groups-help-body .acc-help-note {
  margin-top: 12px;
  padding: 8px 10px;
  border-right: 3px solid #2563eb;
  background: #f0f7ff;
  color: #334155;
  font-size: 8.5pt;
  line-height: 1.55;
}
.persons-groups-help-body ul {
  margin: 6px 0 8px;
  padding-right: 18px;
  line-height: 1.65;
}
.persons-groups-help-body p {
  margin: 0 0 8px;
  line-height: 1.65;
  font-size: 8.5pt;
  color: #334155;
}

#bottomDock .pg-dock-table th {
  background: #e8f1fa;
  color: #0f2744;
  font-weight: 700;
}
#bottomDock .panel-box[data-panel="dock_pg_health"] .sum-row--ok strong { color: #15803d; }
#bottomDock .panel-box[data-panel="dock_pg_health"] .sum-row--warn strong { color: #c2410c; }

/* —— پیش‌نمایش چاپ (تمام‌صفحه) —— */
.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0);
  white-space: nowrap; border: 0;
}
html.print-preview-open {
  overflow: hidden;
}
.print-preview-overlay {
  position: fixed;
  inset: 0;
  z-index: 12000;
  display: flex;
  flex-direction: column;
  background: #e8edf3;
  font-family: Tahoma, sans-serif;
  font-size: 8.5pt;
  direction: rtl;
}
.print-preview-overlay[hidden] {
  display: none !important;
}
.print-preview-chrome {
  flex: 0 0 auto;
  background: #f4f7fb;
  border-bottom: 1px solid var(--color-border, #c5d0dc);
  padding: 6px 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.print-preview-opts,
.print-preview-toolbar {
  display: flex;
  align-items: center;
  gap: 8px 12px;
  flex-wrap: wrap;
}
.print-preview-opts--primary {
  row-gap: 8px;
}
.print-preview-opt {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin: 0;
  font-size: 8.5pt;
  white-space: nowrap;
}
.print-preview-opt select {
  font: inherit;
  font-size: 8.5pt;
  padding: 2px 6px;
  min-height: 26px;
  max-width: 260px;
}
.print-preview-nologo input,
.print-preview-opt input[type="checkbox"] {
  width: 12px;
  height: 12px;
}
.print-preview-hint {
  color: var(--color-text-muted, #64748b);
  margin-right: auto;
  white-space: normal;
  max-width: 420px;
  line-height: 1.35;
}
.print-preview-page {
  min-width: 90px;
  text-align: center;
}
.print-preview-body {
  flex: 1 1 auto;
  display: flex;
  min-height: 0;
  gap: 0;
  background: #9aa8b8;
}
.print-preview-thumbs {
  flex: 0 0 132px;
  overflow: auto;
  background: #dfe6ee;
  border-left: 1px solid var(--color-border, #c5d0dc);
  padding: 8px 6px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.print-preview-thumb {
  display: block;
  width: 100%;
  border: 1px solid #94a3b8;
  background: #fff;
  padding: 4px;
  cursor: pointer;
  font: inherit;
  font-size: 8.5pt;
  text-align: center;
}
.print-preview-thumb.is-active {
  border-color: #2563eb;
  box-shadow: 0 0 0 1px #2563eb;
}
.print-preview-thumb img {
  display: block;
  width: 100%;
  height: auto;
  margin-bottom: 4px;
}
.print-preview-stage-wrap {
  flex: 1 1 auto;
  overflow: auto;
  padding: 20px 16px 40px;
  display: flex;
  justify-content: center;
  align-items: flex-start;
}
.print-preview-stage {
  width: 100%;
  max-width: 100%;
  display: flex;
  justify-content: center;
}
.print-preview-zoom {
  transform-origin: top center;
  will-change: transform;
}
.print-preview-page-img {
  display: block;
  width: 210mm;
  max-width: 96vw;
  background: #fff;
  box-shadow: 0 8px 28px rgba(15, 23, 42, 0.28);
  border: 1px solid #64748b;
}
.print-preview-frame {
  width: 210mm;
  max-width: 96vw;
  min-height: 297mm;
  height: auto;
  border: 0;
  background: transparent;
  display: block;
  box-shadow: none;
}
.print-preview-empty {
  padding: 24px;
  color: #64748b;
  background: #fff;
  border-radius: 8px;
}
.print-preview-share-label {
  font-size: 8.5pt;
  color: #475569;
  font-weight: 700;
}
/* پاپ‌آپ win روی لایهٔ پیش‌نمایش چاپ (بدون جابه‌جایی DOM) */
html.print-preview-open .win-overlay.open,
.win-overlay.ps-over-print-preview.open {
  position: fixed !important;
  inset: 0 !important;
  z-index: 13050 !important;
  padding: 18px;
}
#modalOverlay:not(.open) {
  display: none !important;
  pointer-events: none !important;
  visibility: hidden !important;
}
.print-preview-toolbar [data-print-studio-share] {
  background: linear-gradient(180deg, #ffffff 0%, #eef6ff 100%);
  border: 1px solid #93c5fd;
  color: #1e3a8a;
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease, box-shadow .15s ease, color .15s ease, transform .12s ease, opacity .15s ease;
}
.print-preview-toolbar [data-print-studio-share].is-share-active:hover {
  background: linear-gradient(180deg, #dbeafe 0%, #93c5fd 100%);
  border-color: #1d4ed8;
  color: #1e3a8a;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.35);
  transform: translateY(-1px);
}
.print-preview-toolbar [data-print-studio-share].is-share-active:focus-visible {
  outline: 2px solid #2563eb;
  outline-offset: 1px;
}
.print-preview-toolbar [data-print-studio-share].is-share-active:active {
  transform: translateY(0);
  box-shadow: 0 0 0 1px rgba(37, 99, 235, 0.45);
}
.print-preview-toolbar [data-print-studio-share="telegram"].is-share-active:hover {
  background: linear-gradient(180deg, #e0f2fe 0%, #7dd3fc 100%);
  border-color: #0284c7;
}
.print-preview-toolbar [data-print-studio-share="whatsapp"].is-share-active:hover {
  background: linear-gradient(180deg, #dcfce7 0%, #86efac 100%);
  border-color: #16a34a;
  color: #14532d;
}
.print-preview-toolbar [data-print-studio-share="email"].is-share-active:hover {
  background: linear-gradient(180deg, #fef3c7 0%, #fcd34d 100%);
  border-color: #d97706;
  color: #78350f;
}
.print-preview-toolbar [data-print-studio-share].is-share-locked,
.print-preview-toolbar [data-print-studio-share][disabled] {
  opacity: 0.42;
  filter: grayscale(0.55);
  background: #e5e7eb !important;
  border-color: #9ca3af !important;
  color: #6b7280 !important;
  cursor: not-allowed !important;
  box-shadow: none !important;
  transform: none !important;
}
.print-preview-toolbar [data-print-studio-share].is-share-locked:hover,
.print-preview-toolbar [data-print-studio-share][disabled]:hover {
  background: #e5e7eb !important;
  border-color: #9ca3af !important;
  color: #6b7280 !important;
  box-shadow: none !important;
  transform: none !important;
}
/* ویزارد ارسال استودیوی چاپ — بدون اسکرول تو در تو */
.win-body.ps-share-win-body {
  overflow: hidden !important;
  padding: 10px 12px;
}
.ps-share-wizard {
  overflow: hidden;
  max-height: none;
  box-sizing: border-box;
}
.ps-share-lead {
  margin: 0 0 8px;
  color: #64748b;
  font-size: 8pt;
  line-height: 1.35;
}
.ps-share-top { margin-bottom: 8px; }
.ps-share-field {
  display: block;
  font-weight: 700;
  font-size: 8.5pt;
}
.ps-share-field select,
.ps-share-person input,
.ps-share-person select,
.ps-share-manual input,
.ps-share-tg input,
.ps-share-wizard textarea {
  width: 100%;
  box-sizing: border-box;
  font: inherit;
  font-size: 8.5pt;
  padding: 4px 7px;
  margin-top: 3px;
  max-width: 100%;
}
.ps-share-section { margin-top: 8px; }
.ps-share-h {
  font-weight: 700;
  margin-bottom: 5px;
  font-size: 8.5pt;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
}
.ps-share-inline {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-weight: 400;
  font-size: 8pt;
  white-space: nowrap;
}
.ps-share-grid2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-bottom: 6px;
}
.ps-share-person select {
  margin-top: 4px;
  min-height: 0;
  height: 4.6em;
}
.ps-share-wizard textarea {
  margin-top: 6px;
  resize: none;
  min-height: 0;
  height: 3.2em;
}
.ps-ch-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
}
.ps-ch-row {
  display: flex;
  align-items: center;
  gap: 6px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  padding: 4px 6px;
  background: #fff;
  cursor: pointer;
  min-width: 0;
  overflow: hidden;
}
.ps-ch-row.is-disabled,
.ps-ch-row.is-locked {
  opacity: 0.72;
  background: #e5e7eb;
  border-color: #9ca3af;
  color: #6b7280;
  cursor: not-allowed;
  pointer-events: none;
  filter: grayscale(0.35);
}
.ps-ch-row.is-locked .ps-ch-name { color: #6b7280; }
.ps-ch-name {
  font-weight: 700;
  font-size: 8pt;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ps-ch-badge {
  font-size: 7pt;
  font-weight: 800;
  padding: 1px 5px;
  border-radius: 999px;
  flex: 0 0 auto;
}
.ps-ch-on { background: #dcfce7; color: #166534; }
.ps-ch-off { background: #fee2e2; color: #b91c1c; border: 1px solid #ef4444; }
.ps-ch-hook { background: #fee2e2; color: #b91c1c; border: 1px solid #ef4444; }
.ps-ch-lock {
  font-size: 7pt;
  font-weight: 800;
  color: #b91c1c;
  background: #fecaca;
  border: 1px solid #f87171;
  border-radius: 4px;
  padding: 0 4px;
  flex: 0 0 auto;
}
.ps-share-email input {
  width: 100%;
  box-sizing: border-box;
  font: inherit;
  font-size: 8.5pt;
  padding: 4px 7px;
  margin-top: 6px;
  border: 1px solid #f59e0b;
  background: #fffbeb;
}
.print-org-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid #cbd5e1;
  font-size: 8.5pt;
}
.print-org-header__logo img {
  max-width: 72px;
  max-height: 72px;
  object-fit: contain;
}
.print-org-header__center {
  flex: 1;
  text-align: center;
}
.print-org-header__name {
  font-size: 13pt;
  font-weight: 700;
  margin: 0 0 4px;
}
.print-org-header__subject {
  font-size: 12pt;
  font-weight: 700;
  margin: 0;
}
.print-org-header__meta {
  flex: 0 0 160px;
  text-align: left;
  color: #475569;
  line-height: 1.5;
}
.print-no-logo .print-org-header,
.print-no-logo .exp-org-header {
  display: none !important;
}
@media print {
  .print-preview-overlay { display: none !important; }
}

/* ===== کامبوی inline جستجوی حساب/شخص (پارسینا) — account-person-lookup-combo-mandatory ===== */
.lookup-combo {
  position: relative;
  display: block;
  width: 100%;
  margin-bottom: 8px;
  font-family: var(--font);
  font-size: var(--font-size, 8.5pt);
}
.lookup-combo__fields {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: flex-end;
}
.lookup-combo__field {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}
.lookup-combo__field--name {
  flex: 1 1 58%;
}
.lookup-combo__field--code {
  flex: 0 1 38%;
  max-width: 160px;
}
.lookup-combo__label {
  color: var(--text, #1f2937);
  white-space: nowrap;
}
.lookup-combo__label em {
  color: var(--danger, #b91c1c);
  font-style: normal;
}
.lookup-combo__input {
  width: 100%;
}
.lookup-combo__input-wrap {
  display: flex;
  align-items: stretch;
  width: 100%;
  min-width: 0;
}
.lookup-combo__input-wrap .lookup-combo__input {
  flex: 1 1 auto;
  min-width: 0;
  border-radius: 0 3px 3px 0;
}
.lookup-combo__pick {
  flex: 0 0 22px;
  width: 22px;
  min-width: 22px;
  padding: 0;
  margin: 0;
  border: 1px solid var(--border, #94a3b8);
  border-right: none;
  background: linear-gradient(180deg, #f8fafc, #e2e8f0);
  color: #1e3a5f;
  font: 700 10pt Tahoma, Arial, sans-serif;
  line-height: 1;
  cursor: pointer;
  border-radius: 3px 0 0 3px;
}
.lookup-combo__pick:hover:not(:disabled) {
  background: #bfdbfe;
}
.lookup-combo__pick:disabled {
  opacity: 0.45;
  cursor: default;
}
.lookup-combo__panel {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 4px;
  padding: 6px;
  border: 1px solid var(--border, #d1d5db);
  background: var(--surface, #fff);
  z-index: 40;
}
.lookup-combo.is-rich .lookup-combo__panel,
.lookup-combo.is-rich-open .lookup-combo__panel {
  min-width: min(100%, 640px);
}
.lookup-combo.is-rich .lookup-combo__list-wrap {
  max-height: 280px;
}
.lookup-combo__panel[hidden] {
  display: none !important;
}
.lookup-combo__scroll {
  align-self: stretch;
  height: 22px;
  min-height: 22px;
  padding: 0;
  line-height: 1;
}
.lookup-combo__list-wrap {
  max-height: 180px;
  overflow: auto;
  border: 1px solid var(--border, #d1d5db);
}
.lookup-combo__list {
  width: 100%;
  margin: 0;
}
.lookup-combo__list thead th {
  position: sticky;
  top: 0;
  background: #dbeafe;
  color: #1e3a5f;
  z-index: 1;
}
.lookup-combo__th-code,
.lookup-combo__td-code {
  width: 18%;
  text-align: left;
  direction: ltr;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.lookup-combo__th-name,
.lookup-combo__td-name {
  width: 28%;
  text-align: right;
}
.lookup-combo.is-rich .lookup-combo__th-name,
.lookup-combo.is-rich .lookup-combo__td-name {
  width: 26%;
}
.lookup-combo__th-level,
.lookup-combo__td-level {
  width: 12%;
  text-align: center;
  white-space: nowrap;
  color: #475569;
}
.lookup-combo__th-path,
.lookup-combo__td-path {
  width: 44%;
  text-align: right;
  font-size: 7.5pt;
  color: #64748b;
  max-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.lookup-combo:not(.is-rich) .lookup-combo__th-code,
.lookup-combo:not(.is-rich) .lookup-combo__td-code {
  width: 28%;
}
.lookup-combo:not(.is-rich) .lookup-combo__th-name,
.lookup-combo:not(.is-rich) .lookup-combo__td-name {
  width: 72%;
}
.lookup-combo__row {
  cursor: pointer;
}
.lookup-combo__row:hover,
.lookup-combo__row.is-active {
  background: var(--row-hover, #e8f0fe);
}
.lookup-combo__empty td {
  text-align: center;
  color: var(--text-muted, #64748b);
  padding: 10px 8px;
}
.lookup-combo.is-open {
  z-index: 50;
}


