/* ============================================================================
   نگاه — مرکز محرمانهٔ شرایط خاص
   صفحهٔ بازطراحی‌شده: سربرگ، شاخص‌های زنده، تب‌های چهارگانه، فیلتر سریع،
   نمای جدول/کارت، ماتریس پوشش کلاس‌ها، تحلیل و بینش.
   همهٔ رنگ‌ها از توکن‌های app.css می‌آیند تا حالت شب بدون بازنویسی کار کند.
   ============================================================================ */

.ngx-page {
  display: flex;
  flex-direction: column;
  gap: 14px;
  --ngx-violet: #7c3aed;
  --ngx-violet-soft: #ede9fe;
  --ngx-violet-ink: #5b21b6;
  --ngx-rose: #be123c;
}
.ngx-page [hidden] { display: none !important; }
#ngx-main { display: flex; flex-direction: column; gap: 12px; }

/* ------------------------------- سربرگ ------------------------------- */
.ngx-hero {
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 20px 22px;
  border-radius: var(--radius-xl);
  color: #f5f1ff;
  background:
    radial-gradient(520px 220px at 88% -50%, rgba(245, 158, 11, .34), transparent 70%),
    radial-gradient(460px 250px at 6% 140%, rgba(16, 185, 129, .26), transparent 70%),
    linear-gradient(135deg, #3b1d78 0%, #4c1d95 48%, #1c2b52 100%);
  box-shadow: var(--shadow-md);
}
.ngx-hero::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image: radial-gradient(rgba(255, 255, 255, .14) 1px, transparent 1px);
  background-size: 22px 22px;
  opacity: .45;
}
.ngx-hero-main {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
  position: relative;
  z-index: 1;
}
.ngx-hero-ic {
  width: 54px;
  height: 54px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 17px;
  color: #fff;
  background: rgba(255, 255, 255, .14);
  border: 1px solid rgba(255, 255, 255, .26);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .24);
}
.ngx-hero-title {
  margin: 0 0 4px;
  font-size: var(--fs-xl);
  font-weight: 800;
  letter-spacing: -.2px;
}
.ngx-hero-sub {
  margin: 0;
  max-width: 680px;
  font-size: var(--fs-sm);
  line-height: 1.85;
  color: rgba(255, 255, 255, .84);
}
.ngx-hero-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 8px;
}
.ngx-hero-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: var(--fs-2xs);
  font-weight: 700;
  color: rgba(255, 255, 255, .92);
  background: rgba(255, 255, 255, .11);
  border: 1px solid rgba(255, 255, 255, .22);
  backdrop-filter: blur(4px);
}
.ngx-hero-pill.is-locked { background: rgba(190, 18, 60, .28); border-color: rgba(251, 113, 133, .46); }
.ngx-hero-pill.is-open { background: rgba(4, 120, 87, .3); border-color: rgba(52, 211, 153, .45); }
.ngx-hero-actions {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
  position: relative;
  z-index: 1;
}
.ngx-hero-actions .btn {
  background: rgba(255, 255, 255, .1);
  border-color: rgba(255, 255, 255, .28);
  color: #fff;
  backdrop-filter: blur(4px);
}
.ngx-hero-actions .btn:hover {
  background: rgba(255, 255, 255, .2);
  border-color: rgba(255, 255, 255, .46);
}
.ngx-hero-actions .btn.accent {
  background: var(--gold);
  border-color: var(--gold);
  color: #17252d;
  font-weight: 800;
}
.ngx-hero-actions .btn.accent:hover { background: #fbbf24; }

/* ------------------------------- شاخص‌ها ------------------------------- */
.ngx-kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(156px, 1fr));
  gap: 10px;
}
.ngx-kpi {
  position: relative;
  overflow: hidden;
  display: grid;
  grid-template-columns: 34px 1fr;
  grid-template-rows: auto auto;
  gap: 0 10px;
  align-items: center;
  text-align: right;
  padding: 12px 14px;
  cursor: pointer;
  background: var(--paper);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xs);
  font-family: inherit;
  transition: transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.ngx-kpi::before {
  content: '';
  position: absolute;
  inset-inline-start: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  border-radius: 0 4px 4px 0;
  background: var(--line);
}
.ngx-kpi:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
  border-color: var(--ngx-violet);
}
.ngx-kpi:focus-visible { outline: 3px solid var(--ring); outline-offset: 2px; }
.ngx-kpi.is-active {
  border-color: var(--ngx-violet);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--ngx-violet) 20%, transparent);
}
.ngx-kpi-ic {
  grid-row: 1 / 3;
  display: grid;
  place-items: center;
  color: var(--ngx-violet);
}
.ngx-kpi b {
  font-size: var(--fs-2xl);
  line-height: 1.05;
  font-weight: 800;
  color: var(--side);
  font-variant-numeric: tabular-nums;
}
.ngx-kpi-l {
  font-size: var(--fs-xs);
  color: var(--muted);
  font-weight: 600;
}
.ngx-kpi.tone-good::before { background: var(--good); }
.ngx-kpi.tone-good .ngx-kpi-ic, .ngx-kpi.tone-good b { color: var(--good); }
.ngx-kpi.tone-warn::before { background: var(--warn); }
.ngx-kpi.tone-warn .ngx-kpi-ic, .ngx-kpi.tone-warn b { color: var(--warn); }
.ngx-kpi.tone-bad::before { background: var(--bad); }
.ngx-kpi.tone-bad .ngx-kpi-ic, .ngx-kpi.tone-bad b { color: var(--bad); }
.ngx-kpi.tone-violet::before { background: var(--ngx-violet); }
.ngx-kpi.tone-violet .ngx-kpi-ic, .ngx-kpi.tone-violet b { color: var(--ngx-violet); }
.ngx-kpi.tone-info::before { background: var(--info); }
.ngx-kpi.tone-info .ngx-kpi-ic, .ngx-kpi.tone-info b { color: var(--info); }
.ngx-kpi.is-zero { opacity: .72; }
.ngx-kpi.is-zero b { color: var(--muted); }
.ngx-kpi-skel {
  height: 62px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  background: linear-gradient(90deg, var(--surface-2), var(--paper), var(--surface-2));
  background-size: 220% 100%;
  animation: ngxShimmer 1.2s linear infinite;
}

/* ------------------------------- تب‌ها ------------------------------- */
.ngx-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: stretch;
  padding: 4px;
  background: color-mix(in srgb, var(--paper) 65%, transparent);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
}
.ngx-tab {
  flex: 1 1 140px;
  min-width: 126px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 12px;
  font-size: var(--fs-sm);
  font-weight: 700;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  background: transparent;
  color: var(--ink);
  font-family: inherit;
  cursor: pointer;
  transition: background var(--dur-fast), color var(--dur-fast), box-shadow var(--dur-fast);
}
.ngx-tab:hover { background: var(--paper); border-color: var(--line); }
.ngx-tab.active {
  background: linear-gradient(135deg, #6d28d9, #4c1d95);
  color: #fff;
  box-shadow: 0 4px 14px rgba(76, 29, 149, .3);
}
.ngx-tab-n {
  min-width: 21px;
  padding: 1px 7px;
  border-radius: var(--radius-full);
  font-size: var(--fs-2xs);
  font-weight: 800;
  background: color-mix(in srgb, currentColor 14%, transparent);
}
.ngx-tab.active .ngx-tab-n { background: rgba(255, 255, 255, .22); }

/* ------------------------------- پنل و کارت ------------------------------- */
.ngx-panel { animation: ngxPanelIn var(--dur-base) var(--ease-out) both; }
@keyframes ngxPanelIn { from { opacity: 0; transform: translateY(5px); } }
.ngx-card { padding: 18px; border-radius: var(--radius-lg); background: var(--paper); border: 1px solid var(--line); box-shadow: var(--shadow-xs); }
.ngx-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.ngx-card-title { margin: 0; font-size: var(--fs-lg); font-weight: 800; }
.ngx-card-sub { margin: 3px 0 0; font-size: var(--fs-xs); color: var(--muted); line-height: 1.7; }
.ngx-card-tools { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.ngx-count {
  font-size: var(--fs-xs);
  font-weight: 700;
  color: var(--muted);
  background: var(--surface-2);
  border: 1px solid var(--line);
  padding: 4px 10px;
  border-radius: var(--radius-full);
  white-space: nowrap;
}

/* ------------------------------- نوار ابزار ------------------------------- */
.ngx-toolbar {
  display: grid;
  grid-template-columns: minmax(220px, 1.8fr) repeat(4, minmax(112px, 1fr)) auto;
  gap: 9px;
  align-items: end;
}
.ngx-toolbar.is-records {
  grid-template-columns: minmax(200px, 1.6fr) repeat(4, minmax(112px, 1fr)) auto;
}
.ngx-toolbar .field { margin: 0; min-width: 0; }
.ngx-toolbar .field label { font-size: var(--fs-2xs); font-weight: 700; color: var(--muted); }
.ngx-toolbar .btn { min-height: 38px; }
.ngx-search { position: relative; }
.ngx-search input { padding-inline-start: 34px; }
.ngx-search .ngx-search-ic {
  position: absolute;
  inset-inline-start: 10px;
  bottom: 11px;
  color: var(--muted);
  pointer-events: none;
  display: grid;
  place-items: center;
}
.ngx-search .ngx-search-clear {
  position: absolute;
  inset-inline-end: 6px;
  bottom: 6px;
  width: 26px;
  height: 26px;
  border: 0;
  border-radius: 50%;
  background: var(--surface-2);
  color: var(--muted);
  cursor: pointer;
  display: none;
  place-items: center;
  font-family: inherit;
}
.ngx-search.has-value .ngx-search-clear { display: grid; }
.ngx-search .ngx-search-clear:hover {
  color: var(--bad);
  background: color-mix(in srgb, var(--bad) 10%, var(--paper));
}
.ngx-toolbar-btns { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.ngx-kbd {
  display: inline-grid;
  place-items: center;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  border-radius: 5px;
  font-size: var(--fs-3xs);
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--muted);
}

/* ------------------------------- چیپ‌ها و گروه‌ها ------------------------------- */
.ngx-chips {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 11px;
}
.ngx-chips-l { font-size: var(--fs-xs); color: var(--muted); font-weight: 600; }
.ngx-chip {
  cursor: pointer;
  font-family: inherit;
  font-size: var(--fs-xs);
  font-weight: 700;
  padding: 5px 11px;
  border-radius: var(--radius-full);
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--ink);
  transition: background var(--dur-fast), border-color var(--dur-fast), color var(--dur-fast);
}
.ngx-chip:hover { border-color: var(--ngx-violet); color: var(--ngx-violet); }
.ngx-chip.active {
  background: var(--ngx-violet);
  border-color: var(--ngx-violet);
  color: #fff;
}
.ngx-chip-n { opacity: .8; font-weight: 600; }
.ngx-types-strip {
  display: flex;
  gap: 7px;
  margin-top: 11px;
  padding-bottom: 4px;
  overflow-x: auto;
  scrollbar-width: thin;
}
.ngx-types-strip::-webkit-scrollbar { height: 6px; }
.ngx-types-strip::-webkit-scrollbar-thumb { background: var(--line); border-radius: 999px; }
.ngx-type-btn {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 11px;
  border-radius: var(--radius-full);
  border: 1.5px solid var(--line);
  background: var(--paper);
  color: var(--muted);
  font-family: inherit;
  font-size: var(--fs-xs);
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: border-color var(--dur-fast), background var(--dur-fast), color var(--dur-fast);
}
.ngx-type-btn:hover { border-color: var(--ngx-violet); color: var(--ngx-violet); }
.ngx-type-btn.has-items {
  border-color: color-mix(in srgb, var(--ngx-violet) 38%, var(--line));
  background: color-mix(in srgb, var(--ngx-violet-soft) 55%, var(--paper));
  color: var(--ngx-violet-ink);
}
.ngx-type-btn.active {
  background: var(--ngx-violet);
  border-color: var(--ngx-violet);
  color: #fff;
}
.ngx-type-btn .ngx-type-n {
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: var(--radius-full);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: var(--fs-2xs);
  font-weight: 800;
  background: color-mix(in srgb, currentColor 13%, transparent);
}
.ngx-type-btn.active .ngx-type-n { background: rgba(255, 255, 255, .22); }

/* ------------------------------- کلید نمایش ------------------------------- */
.ngx-viewtoggle {
  display: inline-flex;
  padding: 3px;
  gap: 3px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
}
.ngx-viewtoggle button {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 30px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-family: inherit;
}
.ngx-viewtoggle button:hover { color: var(--ink); background: var(--paper); }
.ngx-viewtoggle button.active {
  background: var(--paper);
  color: var(--ngx-violet);
  box-shadow: var(--shadow-xs);
}

/* ------------------------------- جدول ------------------------------- */
.ngx-table-wrap {
  margin-top: 12px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--paper);
}
.ngx-table {
  width: 100%;
  min-width: 700px;
  border-collapse: separate;
  border-spacing: 0;
  font-size: var(--fs-sm);
}
.ngx-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--surface-2);
  color: var(--muted);
  font-size: var(--fs-xs);
  font-weight: 800;
  text-align: right;
  padding: 10px 9px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.ngx-table thead th.ngx-sortable { cursor: pointer; user-select: none; }
.ngx-table thead th.ngx-sortable:hover { color: var(--ngx-violet); }
.ngx-table thead th.active { color: var(--ngx-violet); }
.ngx-table thead th .ngx-sort-ar { font-size: var(--fs-2xs); opacity: .85; }
.ngx-table tbody td {
  padding: 10px 9px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
.ngx-table tbody tr:last-child td { border-bottom: 0; }
.ngx-table tbody tr { transition: background var(--dur-fast); }
.ngx-table tbody tr:hover { background: color-mix(in srgb, var(--ngx-violet-soft) 34%, var(--paper)); }
.ngx-table tbody tr.ngx-row { cursor: pointer; }
.ngx-table .ngx-date { color: var(--muted); font-size: var(--fs-xs); white-space: nowrap; }
.ngx-table .ngx-num { font-variant-numeric: tabular-nums; }
.ngx-linkbtn {
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--ink);
  font-family: inherit;
  font-size: inherit;
  font-weight: 700;
  cursor: pointer;
  text-align: right;
}
.ngx-linkbtn:hover { color: var(--ngx-violet); text-decoration: underline; }

.ngx-stu {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 150px;
}
.ngx-avatar {
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 11px;
  font-size: var(--fs-sm);
  font-weight: 800;
  background: var(--ngx-violet-soft);
  color: var(--ngx-violet-ink);
  border: 1px solid color-mix(in srgb, var(--ngx-violet) 18%, transparent);
}
.ngx-avatar.t0 { background: #ede9fe; color: #5b21b6; }
.ngx-avatar.t1 { background: #dbeafe; color: #1e40af; }
.ngx-avatar.t2 { background: #d1fae5; color: #065f46; }
.ngx-avatar.t3 { background: #fef3c7; color: #92400e; }
.ngx-avatar.t4 { background: #fee2e2; color: #991b1b; }
.ngx-avatar.t5 { background: #cffafe; color: #155e75; }
.ngx-avatar.t6 { background: #fae8ff; color: #86198f; }
.ngx-stu-txt { min-width: 0; }
.ngx-stu-name {
  display: block;
  font-weight: 700;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 190px;
}
.ngx-stu-sub { display: block; font-size: var(--fs-2xs); color: var(--muted); margin-top: 1px; }
.ngx-badges { display: flex; flex-wrap: wrap; gap: 4px; max-width: 330px; }
.ngx-badges .badge { white-space: nowrap; }
.ngx-badge-off { opacity: .68; text-decoration: line-through; }
.ngx-note {
  max-width: 240px;
  font-size: var(--fs-xs);
  color: var(--muted);
  line-height: 1.65;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.ngx-row-actions { display: inline-flex; align-items: center; gap: 4px; }
.ngx-icon-btn {
  width: 30px;
  height: 30px;
  display: inline-grid;
  place-items: center;
  padding: 0;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--muted);
  cursor: pointer;
  font-family: inherit;
  transition: background var(--dur-fast), border-color var(--dur-fast), color var(--dur-fast);
}
.ngx-icon-btn:hover { border-color: var(--ngx-violet); color: var(--ngx-violet); background: var(--ngx-violet-soft); }
.ngx-icon-btn.is-ai:hover { border-color: var(--gold); color: #92400e; background: #fffbeb; }
.ngx-icon-btn.is-danger:hover { border-color: var(--bad); color: var(--bad); background: #fef2f2; }

/* ------------------------------- نمای کارت ------------------------------- */
.ngx-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(258px, 1fr));
  gap: 10px;
  margin-top: 12px;
}
.ngx-scard {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 9px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--paper);
  box-shadow: var(--shadow-xs);
  cursor: pointer;
  transition: transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.ngx-scard:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
  border-color: color-mix(in srgb, var(--ngx-violet) 42%, var(--line));
}
.ngx-scard-top { display: flex; align-items: center; gap: 9px; }
.ngx-scard-name { font-weight: 800; font-size: var(--fs-sm); line-height: 1.5; }
.ngx-scard-sub { font-size: var(--fs-2xs); color: var(--muted); margin-top: 1px; }
.ngx-scard-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin-top: auto;
  padding-top: 8px;
  border-top: 1px dashed var(--line);
}
.ngx-scard-date { font-size: var(--fs-2xs); color: var(--muted); }
.ngx-scard .ngx-row-actions { flex-wrap: nowrap; }
.ngx-scard-notes { font-size: var(--fs-xs); color: var(--muted); line-height: 1.7; }

/* ------------------------------- حالت خالی/بارگذاری ------------------------------- */
.ngx-loading {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 0;
}
.ngx-loading-row {
  height: 46px;
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  background: linear-gradient(90deg, var(--surface-2), var(--paper), var(--surface-2));
  background-size: 220% 100%;
  animation: ngxShimmer 1.2s linear infinite;
}
@keyframes ngxShimmer { to { background-position: -220% 0; } }

/* ------------------------------- قفل رمز ------------------------------- */
.ngx-lock {
  max-width: 470px;
  margin: 18px auto;
  padding: 26px 24px;
  text-align: center;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow);
}
.ngx-lock-ic {
  width: 64px;
  height: 64px;
  margin: 0 auto 12px;
  display: grid;
  place-items: center;
  border-radius: 20px;
  color: #fff;
  background: linear-gradient(135deg, #6d28d9, #4c1d95);
  box-shadow: 0 10px 24px rgba(76, 29, 149, .28);
}
.ngx-lock h3 { margin: 0 0 6px; font-size: var(--fs-lg); }
.ngx-lock p { margin: 0 0 14px; color: var(--muted); font-size: var(--fs-sm); line-height: 1.8; }
.ngx-lock-form {
  display: flex;
  gap: 7px;
  align-items: stretch;
  max-width: 330px;
  margin: 0 auto;
}
.ngx-lock-form input {
  flex: 1;
  min-width: 0;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  background: var(--paper);
  color: var(--ink);
  font-family: inherit;
  text-align: center;
  letter-spacing: 2px;
}
.ngx-lock-form input:focus { outline: none; border-color: var(--ngx-violet); box-shadow: 0 0 0 4px rgba(124, 58, 237, .14); }
.ngx-lock-err { margin-top: 10px; color: var(--bad); font-size: var(--fs-xs); font-weight: 700; }
.ngx-lock small { display: block; margin-top: 12px; color: var(--muted); font-size: var(--fs-2xs); }
.ngx-lock.is-shake { animation: ngxShake .32s ease; }
@keyframes ngxShake {
  20% { transform: translateX(-6px); }
  40% { transform: translateX(6px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(4px); }
}

/* ------------------------------- گروه‌ها ------------------------------- */
.ngx-type-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 10px;
  margin-top: 12px;
}
.ngx-type-card {
  position: relative;
  overflow: hidden;
  text-align: right;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--paper);
  box-shadow: var(--shadow-xs);
  cursor: pointer;
  font-family: inherit;
  color: var(--ink);
  transition: transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.ngx-type-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
  border-color: var(--ngx-violet);
}
.ngx-type-card.is-active { border-color: var(--ngx-violet); box-shadow: 0 0 0 2px rgba(124, 58, 237, .18); }
.ngx-type-card-head { display: flex; align-items: center; gap: 9px; }
.ngx-type-card-ic {
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 11px;
  background: var(--ngx-violet-soft);
  color: var(--ngx-violet-ink);
}
.ngx-type-card.tone-gold .ngx-type-card-ic { background: #fef3c7; color: #92400e; }
.ngx-type-card.tone-blue .ngx-type-card-ic { background: #dbeafe; color: #1e40af; }
.ngx-type-card.tone-green .ngx-type-card-ic { background: #d1fae5; color: #065f46; }
.ngx-type-card.tone-rose .ngx-type-card-ic { background: #fee2e2; color: #991b1b; }
.ngx-type-card.tone-cyan .ngx-type-card-ic { background: #cffafe; color: #155e75; }
.ngx-type-card.tone-violet .ngx-type-card-ic { background: #ede9fe; color: #5b21b6; }
.ngx-type-card-name { font-weight: 800; font-size: var(--fs-sm); }
.ngx-type-card-hint { font-size: var(--fs-2xs); color: var(--muted); margin-top: 2px; }
.ngx-type-card-count {
  margin-top: 10px;
  font-size: var(--fs-2xl);
  font-weight: 800;
  line-height: 1;
  color: var(--ngx-violet-ink);
  font-variant-numeric: tabular-nums;
}
.ngx-type-card-count small { font-size: var(--fs-xs); font-weight: 600; color: var(--muted); margin-inline-start: 4px; }
.ngx-bar {
  height: 7px;
  margin-top: 9px;
  border-radius: 999px;
  background: var(--surface-2);
  overflow: hidden;
}
.ngx-bar-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #8b5cf6, #6d28d9);
  transition: width var(--dur-slow) var(--ease);
}
.ngx-type-card.tone-gold .ngx-bar-fill { background: linear-gradient(90deg, #fbbf24, #d97706); }
.ngx-type-card.tone-blue .ngx-bar-fill { background: linear-gradient(90deg, #60a5fa, #2563eb); }
.ngx-type-card.tone-green .ngx-bar-fill { background: linear-gradient(90deg, #34d399, #047857); }
.ngx-type-card.tone-rose .ngx-bar-fill { background: linear-gradient(90deg, #fb7185, #be123c); }
.ngx-type-card.tone-cyan .ngx-bar-fill { background: linear-gradient(90deg, #22d3ee, #0e7490); }
.ngx-type-card-meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 8px;
  font-size: var(--fs-2xs);
  color: var(--muted);
}
.ngx-type-card-classes { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 7px; }
.ngx-mini-tag {
  display: inline-flex;
  align-items: center;
  padding: 2px 7px;
  border-radius: var(--radius-full);
  font-size: var(--fs-3xs);
  font-weight: 700;
  color: var(--muted);
  background: var(--surface-2);
  border: 1px solid var(--line);
  white-space: nowrap;
}

/* ------------------------------- ماتریس ------------------------------- */
.ngx-matrix-wrap {
  margin-top: 12px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
}
.ngx-matrix {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: var(--fs-xs);
  min-width: 720px;
}
.ngx-matrix th, .ngx-matrix td {
  padding: 8px 6px;
  text-align: center;
  border-bottom: 1px solid var(--line);
  border-inline-start: 1px solid var(--line);
}
.ngx-matrix th:first-child, .ngx-matrix td:first-child {
  border-inline-start: 0;
  text-align: right;
  position: sticky;
  inset-inline-start: 0;
  background: var(--paper);
  z-index: 1;
  min-width: 132px;
}
.ngx-matrix thead th {
  position: sticky;
  top: 0;
  background: var(--surface-2);
  color: var(--muted);
  font-weight: 800;
  z-index: 2;
  white-space: nowrap;
}
.ngx-matrix thead th:first-child { z-index: 3; background: var(--surface-2); }
.ngx-matrix tbody tr:hover td { background: color-mix(in srgb, var(--ngx-violet-soft) 30%, var(--paper)); }
.ngx-matrix tbody tr:hover td:first-child { background: color-mix(in srgb, var(--ngx-violet-soft) 30%, var(--paper)); }
.ngx-matrix .ngx-cell-has {
  background: color-mix(in srgb, var(--ngx-violet) 13%, var(--paper));
  color: var(--ngx-violet-ink);
  font-weight: 800;
}
.ngx-matrix .ngx-matrix-total { font-weight: 800; color: var(--ink); background: var(--surface-2); }
.ngx-matrix tfoot td { border-top: 1px solid var(--line); font-weight: 800; background: var(--surface-2); }

/* ------------------------------- تحلیل ------------------------------- */
.ngx-insight-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 12px;
}
.ngx-insight {
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--paper);
  box-shadow: var(--shadow-xs);
  min-width: 0;
}
.ngx-insight.is-wide { grid-column: 1 / -1; }
.ngx-insight h4 {
  margin: 0 0 2px;
  font-size: var(--fs-sm);
  font-weight: 800;
}
.ngx-insight p { margin: 0 0 10px; font-size: var(--fs-2xs); color: var(--muted); }
.ngx-donut-row { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.ngx-donut {
  --p: 0;
  width: 132px;
  height: 132px;
  flex: 0 0 auto;
  border-radius: 50%;
  position: relative;
  display: grid;
  place-items: center;
  background: conic-gradient(var(--good) calc(var(--p) * 1%), var(--line) 0);
}
.ngx-donut::before {
  content: '';
  position: absolute;
  inset: 14px;
  border-radius: 50%;
  background: var(--paper);
}
.ngx-donut > * { position: relative; z-index: 1; text-align: center; }
.ngx-donut b { display: block; font-size: var(--fs-xl); font-weight: 800; line-height: 1; }
.ngx-donut small { font-size: var(--fs-2xs); color: var(--muted); }
.ngx-legend { display: flex; flex-direction: column; gap: 7px; font-size: var(--fs-xs); min-width: 130px; }
.ngx-legend span { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); }
.ngx-legend i {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  display: inline-block;
  background: var(--line);
}
.ngx-legend .is-good { background: var(--good); }
.ngx-legend .is-bad { background: var(--bad); }
.ngx-legend .is-violet { background: var(--ngx-violet); }
.ngx-legend .is-gold { background: var(--gold); }
.ngx-legend b { color: var(--ink); }

.ngx-bars { display: flex; flex-direction: column; gap: 8px; }
.ngx-bars-row { display: grid; grid-template-columns: 92px 1fr 34px; gap: 7px; align-items: center; font-size: var(--fs-xs); }
.ngx-bars-row > span { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ngx-bars-row > b { text-align: left; font-variant-numeric: tabular-nums; color: var(--ink); }
.ngx-bars-track { height: 8px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.ngx-bars-fill { height: 100%; border-radius: 999px; background: linear-gradient(90deg, #a78bfa, #6d28d9); }
.ngx-bars-fill.tone-gold { background: linear-gradient(90deg, #fbbf24, #d97706); }
.ngx-bars-fill.tone-green { background: linear-gradient(90deg, #34d399, #047857); }
.ngx-bars-fill.tone-rose { background: linear-gradient(90deg, #fb7185, #be123c); }
.ngx-bars-fill.tone-blue { background: linear-gradient(90deg, #60a5fa, #2563eb); }
.ngx-bars-fill.tone-cyan { background: linear-gradient(90deg, #22d3ee, #0e7490); }

.ngx-trend {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  height: 140px;
  padding-top: 8px;
}
.ngx-trend-col { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; }
.ngx-trend-barwrap { flex: 1; width: 100%; display: flex; align-items: flex-end; }
.ngx-trend-bar {
  width: 100%;
  min-height: 4px;
  border-radius: 8px 8px 3px 3px;
  background: linear-gradient(180deg, #a78bfa, #6d28d9);
  transition: height var(--dur-slow) var(--ease);
}
.ngx-trend-col.is-now .ngx-trend-bar { background: linear-gradient(180deg, #fbbf24, #d97706); }
.ngx-trend-l { font-size: var(--fs-3xs); color: var(--muted); white-space: nowrap; }
.ngx-trend-n { font-size: var(--fs-2xs); font-weight: 800; color: var(--ink); }

.ngx-dq { display: flex; flex-direction: column; gap: 7px; }
.ngx-dq-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 9px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  font-size: var(--fs-xs);
}
.ngx-dq-item > span { min-width: 0; line-height: 1.7; }
.ngx-dq-item b { color: var(--ink); }
.ngx-dq-item.is-ok { background: color-mix(in srgb, var(--good) 8%, var(--paper)); border-color: color-mix(in srgb, var(--good) 30%, var(--line)); }
.ngx-dq-item.is-warn { background: color-mix(in srgb, var(--warn) 8%, var(--paper)); border-color: color-mix(in srgb, var(--warn) 28%, var(--line)); }
.ngx-dq-item .ngx-icon-btn { flex: 0 0 auto; }

/* ------------------------------- مودال‌ها ------------------------------- */
.ngx-modal-sub {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin: 0 0 12px;
  color: var(--muted);
  font-size: var(--fs-xs);
}
.ngx-mrow {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 9px;
  padding: 10px 0;
  border-bottom: 1px dashed var(--line);
}
.ngx-mrow:last-child { border-bottom: 0; }
.ngx-mrow-main { min-width: 0; flex: 1; }
.ngx-mrow-title {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  font-size: var(--fs-sm);
  font-weight: 700;
}
.ngx-mrow-meta { font-size: var(--fs-2xs); color: var(--muted); margin-top: 3px; }
.ngx-mrow-note { font-size: var(--fs-xs); line-height: 1.8; margin-top: 5px; }
.ngx-mrow-actions { display: flex; align-items: center; gap: 4px; flex-wrap: nowrap; }
.ngx-modal-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 12px;
}
.ngx-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
}
.ngx-form-grid .field { margin: 0; }
.ngx-form-grid .field.is-full { grid-column: 1 / -1; }
.ngx-type-picks { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 6px; }
.ngx-type-pick { position: relative; cursor: pointer; }
.ngx-type-pick input {
  position: absolute;
  opacity: 0;
  inset: 0;
  margin: 0;
  cursor: pointer;
}
.ngx-type-pick span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 12px;
  border-radius: var(--radius-full);
  border: 1.5px solid var(--line);
  background: var(--paper);
  font-size: var(--fs-xs);
  font-weight: 600;
  color: var(--muted);
  transition: border-color var(--dur) var(--ease), background var(--dur) var(--ease), color var(--dur) var(--ease);
  user-select: none;
}
.ngx-type-pick:hover span { border-color: var(--ngx-violet); color: var(--ngx-violet); }
.ngx-type-pick input:checked + span {
  border-color: var(--ngx-violet);
  background: var(--ngx-violet);
  color: #fff;
  box-shadow: 0 1px 6px rgba(124, 58, 237, .28);
}
.ngx-type-pick input:focus-visible + span { outline: 2px solid #a78bfa; outline-offset: 2px; }
.ngx-type-pick.is-disabled { opacity: .48; cursor: not-allowed; }
.ngx-type-pick.is-disabled span { text-decoration: line-through; }
.ngx-type-pick .ngx-dup {
  font-size: var(--fs-3xs);
  font-weight: 800;
  padding: 0 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .24);
}
.ngx-note-row { margin-top: 9px; }
.ngx-hint {
  margin: 8px 0 0;
  font-size: var(--fs-xs);
  color: var(--muted);
  line-height: 1.8;
}
.ngx-danger-box {
  padding: 9px 11px;
  border-radius: var(--radius-sm);
  border: 1px solid color-mix(in srgb, var(--bad) 30%, var(--line));
  background: color-mix(in srgb, var(--bad) 8%, var(--paper));
  color: var(--bad);
  font-size: var(--fs-xs);
  line-height: 1.8;
}
.ngx-ai-out { margin-top: 12px; }
.ngx-ai-item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 0;
  border-bottom: 1px dashed var(--line);
}
.ngx-ai-item:last-child { border-bottom: 0; }
.ngx-ai-item > span { flex: 1; font-size: var(--fs-sm); line-height: 1.9; }
.ngx-ai-text {
  white-space: pre-wrap;
  line-height: 2;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 11px 12px;
  background: var(--surface-2);
  font-size: var(--fs-sm);
}
.ngx-pin-status {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  background: var(--surface-2);
  font-size: var(--fs-xs);
  margin-bottom: 12px;
}
.ngx-pin-status.is-on { border-color: color-mix(in srgb, var(--good) 34%, var(--line)); background: color-mix(in srgb, var(--good) 8%, var(--paper)); }
.ngx-pin-status.is-off { border-color: color-mix(in srgb, var(--warn) 34%, var(--line)); background: color-mix(in srgb, var(--warn) 8%, var(--paper)); }
.ngx-pin-status b { color: var(--ink); }

/* ------------------------------- حالت شب ------------------------------- */
[data-theme="dark"] .ngx-kpi b { color: #e9f5ef; }
[data-theme="dark"] .ngx-kpi.is-zero b { color: var(--muted); }
[data-theme="dark"] .ngx-avatar.t0 { background: #3b2a66; color: #ddd6fe; }
[data-theme="dark"] .ngx-avatar.t1 { background: #1e3a5f; color: #bfdbfe; }
[data-theme="dark"] .ngx-avatar.t2 { background: #064e3b; color: #a7f3d0; }
[data-theme="dark"] .ngx-avatar.t3 { background: #4a2e0a; color: #fde68a; }
[data-theme="dark"] .ngx-avatar.t4 { background: #4c1d1d; color: #fecaca; }
[data-theme="dark"] .ngx-avatar.t5 { background: #164e63; color: #a5f3fc; }
[data-theme="dark"] .ngx-avatar.t6 { background: #4a1d4f; color: #f5d0fe; }
[data-theme="dark"] .ngx-type-btn.has-items { background: #2a1f4d; color: #ddd6fe; }
[data-theme="dark"] .ngx-type-card-ic { background: #2a1f4d; color: #ddd6fe; }
[data-theme="dark"] .ngx-type-card.tone-gold .ngx-type-card-ic { background: #4a2e0a; color: #fde68a; }
[data-theme="dark"] .ngx-type-card.tone-blue .ngx-type-card-ic { background: #1e3a5f; color: #bfdbfe; }
[data-theme="dark"] .ngx-type-card.tone-green .ngx-type-card-ic { background: #064e3b; color: #a7f3d0; }
[data-theme="dark"] .ngx-type-card.tone-rose .ngx-type-card-ic { background: #4c1d1d; color: #fecaca; }
[data-theme="dark"] .ngx-type-card.tone-cyan .ngx-type-card-ic { background: #164e63; color: #a5f3fc; }
[data-theme="dark"] .ngx-type-card-count { color: #ddd6fe; }
[data-theme="dark"] .ngx-icon-btn.is-ai:hover { background: #4a2e0a; color: #fde68a; }
[data-theme="dark"] .ngx-icon-btn.is-danger:hover { background: #4c1d1d; color: #fecaca; }
[data-theme="dark"] .ngx-scard:hover,
[data-theme="dark"] .ngx-table tbody tr:hover { background: #241b3d; }
[data-theme="dark"] .ngx-matrix .ngx-cell-has { background: #2a1f4d; color: #ddd6fe; }
[data-theme="dark"] .ngx-matrix tbody tr:hover td,
[data-theme="dark"] .ngx-matrix tbody tr:hover td:first-child { background: #241b3d; }
[data-theme="dark"] .ngx-dq-item.is-ok { background: #0c2f27; }
[data-theme="dark"] .ngx-dq-item.is-warn { background: #3a280c; }
[data-theme="dark"] .ngx-lock { background: var(--paper); }

/* ------------------------------- موبایل ------------------------------- */
@media (max-width: 980px) {
  .ngx-toolbar { grid-template-columns: 1fr 1fr 1fr; }
  .ngx-toolbar .ngx-search { grid-column: 1 / -1; }
  .ngx-toolbar.is-records { grid-template-columns: 1fr 1fr; }
  .ngx-insight-grid { grid-template-columns: 1fr; }
}
@media (max-width: 700px) {
  .ngx-hero { padding: 16px; }
  .ngx-hero-actions { width: 100%; }
  .ngx-hero-actions .btn { flex: 1 1 auto; justify-content: center; }
  .ngx-toolbar, .ngx-toolbar.is-records { grid-template-columns: 1fr 1fr; }
  .ngx-toolbar .ngx-search { grid-column: 1 / -1; }
  .ngx-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ngx-type-grid { grid-template-columns: 1fr; }
  .ngx-cards { grid-template-columns: 1fr; }
  .ngx-form-grid { grid-template-columns: 1fr; }
  .ngx-mrow { flex-direction: column; }
  .ngx-mrow-actions { width: 100%; justify-content: flex-end; }
  .ngx-lock { padding: 20px 16px; }
}

/* ------------------------------- کاهش حرکت ------------------------------- */
@media (prefers-reduced-motion: reduce) {
  .ngx-panel, .ngx-kpi, .ngx-scard, .ngx-type-card, .ngx-bar-fill, .ngx-trend-bar { animation: none !important; transition: none !important; }
  .ngx-kpi-skel, .ngx-loading-row { animation: none; }
}
