/* ================= دفتر کلاسی — مرکز فرماندهی معلم =================
   فقط از توکن‌های app.css تغذیه می‌شود تا تم روشن/تاریک خودکار رعایت شود */

/* ---------- صفحهٔ فهرست کلاس‌ها ---------- */
.nb-top {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap; margin-bottom: 14px;
}
.nb-top h2 { margin: 0; font-size: var(--fs-title); display: flex; align-items: center; gap: 8px; }
.nb-top .sub { color: var(--muted); font-size: var(--fs-sm); margin-top: 2px; }

.nb-classes { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 14px; }
.nb-class-card {
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius-lg);
  padding: 16px 18px; box-shadow: var(--shadow-xs); display: flex; flex-direction: column;
  gap: 10px; transition: box-shadow var(--dur) var(--ease), transform var(--dur) var(--ease);
  cursor: pointer; position: relative; overflow: hidden;
}
.nb-class-card:hover { box-shadow: var(--shadow); transform: translateY(-2px); }
.nb-class-card::before {
  content: ''; position: absolute; inset-inline-start: 0; top: 0; bottom: 0;
  width: 4px; background: var(--grad-brand);
}
.nb-class-card h3 { margin: 0; font-size: var(--fs-lg); display: flex; align-items: center; gap: 8px; }
.nb-class-card .nb-meta { color: var(--muted); font-size: var(--fs-xs); }
.nb-class-card .nb-subjects { display: flex; flex-wrap: wrap; gap: 4px; }
.nb-class-card .nb-subjects .badge { font-size: var(--fs-2xs); }
.nb-class-card .nb-cstats {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; text-align: center;
  border-block: 1px dashed var(--line); padding: 8px 0;
}
.nb-class-card .nb-cstats b { display: block; font-size: var(--fs-lg); }
.nb-class-card .nb-cstats span { color: var(--muted); font-size: var(--fs-2xs); }
.nb-class-foot { display: flex; align-items: center; justify-content: space-between; font-size: var(--fs-xs); color: var(--muted); }
.nb-hchip {
  display: inline-flex; align-items: center; gap: 5px; font-size: var(--fs-xs);
  color: var(--muted); background: var(--surface-2); border: 1px solid var(--line);
  padding: 3px 9px; border-radius: var(--radius-full);
}
.nb-hchip b { color: var(--ink); font-weight: 600; }
.nb-search-box { position: relative; }
.nb-search-box input {
  width: 220px; padding-inline-start: 30px;
}
.nb-search-box svg {
  position: absolute; inset-inline-start: 9px; top: 50%; transform: translateY(-50%);
  color: var(--muted); pointer-events: none;
}
.nb-save-status {
  display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-xs);
  color: var(--muted); min-height: 22px;
}
.nb-save-status .ok-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.nb-save-status.saving .ok-dot { background: var(--gold); animation: nb-pulse 1s infinite; }
.nb-save-status.saved .ok-dot { background: var(--good); }
.nb-save-status.error .ok-dot { background: var(--bad); }
.nb-save-status.error { color: var(--bad); cursor: pointer; }
@keyframes nb-pulse { 50% { opacity: .3; } }
.nb-chip {
  border: 1px solid var(--line); background: var(--paper); color: var(--muted);
  border-radius: var(--radius-full); padding: 4px 12px; font-size: var(--fs-xs);
  cursor: pointer; transition: all var(--dur) var(--ease); display: inline-flex; gap: 6px; align-items: center;
}
.nb-chip b { color: var(--ink); }
.nb-chip:hover { border-color: var(--muted); }
.nb-chip.on { background: var(--side); border-color: var(--side); color: #fff; }
.nb-chip.on b { color: #fff; }
.nb-chip.on[data-f="weak"] { background: var(--bad); border-color: var(--bad); }
.nb-chip.on[data-f="great"] { background: var(--good); border-color: var(--good); }
.nb-chip.on[data-f="ok"] { background: var(--warn); border-color: var(--warn); }
.nb-chip.on[data-f="good"] { background: var(--info); border-color: var(--info); }
.nb-name-link { font-weight: 600; cursor: pointer; color: var(--ink); }
.nb-name-link:hover { color: var(--accent-2); text-decoration: underline; }
.nb-lvl .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--lvl); opacity: .55; transition: all var(--dur) var(--ease); }
.nb-lvl.on {
  background: var(--lvl-tint); border-color: var(--lvl); color: var(--lvl); font-weight: 700;
}
.nb-lvl.on .dot { opacity: 1; transform: scale(1.25); }
.nb-lvl.pending { animation: nb-pulse .8s infinite; }

/* ردیف فوکوس‌شده با کیبورد */
.nb-row.focused td { background: color-mix(in srgb, var(--gold) 9%, transparent) !important; }
.nb-row.focused td:first-child { box-shadow: inset 3px 0 0 var(--gold); }

/* ---------- انتخاب تصادفی ---------- */
.nb-rand-stage {
  min-height: 190px; display: flex; align-items: center; justify-content: center;
  flex-direction: column; gap: 10px; position: relative; border-radius: var(--radius-md);
  background:
    radial-gradient(circle at 50% 0%, color-mix(in srgb, var(--gold) 9%, transparent), transparent 70%);
}
.nb-rand-name {
  font-size: 42px; font-weight: 800; color: var(--ink); text-align: center;
  filter: blur(var(--blur, 0px)); transition: filter .1s linear;
}
.nb-rand-name.settled {
  color: var(--accent-2); animation: nb-pop .35s var(--ease);
  text-shadow: 0 4px 24px color-mix(in srgb, var(--good) 35%, transparent);
}
@keyframes nb-pop { 0% { transform: scale(.6); opacity: .2; } 70% { transform: scale(1.12); } 100% { transform: scale(1); } }
.nb-rand-sub { color: var(--muted); font-size: var(--fs-sm); text-align: center; }
.nb-rand-pick {
  display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; margin-top: 8px;
}
.nb-rand-pick .badge { font-size: var(--fs-sm); padding: 5px 12px; animation: nb-pop .3s var(--ease); }
.nb-pick-modes { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.nb-pick-modes .nb-chip { font-size: var(--fs-2xs); padding: 3px 10px; }

/* ---------- نمودارها و توزیع ---------- */
.nb-dbars { display: flex; flex-direction: column; gap: 7px; }
.nb-dbar .track { height: 10px; border-radius: var(--radius-full); background: var(--surface-2); overflow: hidden; }
.nb-dbar .track > i { display: block; height: 100%; border-radius: var(--radius-full); transition: width var(--dur-slow) var(--ease); }
.nb-dbar .num { text-align: left; color: var(--muted); font-size: var(--fs-2xs); }

/* ---------- تقویم آموزشی ---------- */
.nb-cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.nb-cal-head h4 { margin: 0; font-size: var(--fs-lg); }
.nb-cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; }
.nb-cal .dow {
  text-align: center; font-size: var(--fs-2xs); color: var(--muted); padding: 4px 0; font-weight: 600;
}
.nb-cal-day {
  min-height: 74px; border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 5px 6px; font-size: var(--fs-2xs); background: var(--paper); position: relative;
  display: flex; flex-direction: column; gap: 2px; overflow: hidden;
}
.nb-cal-day.off { background: var(--surface-2); opacity: .55; }
.nb-cal-day.today { border-color: var(--accent-2); box-shadow: 0 0 0 1px var(--accent-2); }
.nb-cal-day .dnum { font-weight: 700; font-size: var(--fs-sm); color: var(--muted); }
.nb-cal-day.today .dnum { color: var(--accent-2); }
/* نام کلاس‌ها با خروجی واقعی calendar در notebook.js هماهنگ شد:
   چیپ‌های درس = .ss · شمارش پرسش/نمره = .qq (قبلاً .sess/.qinfo/.asked بود
   که با هیچ عنصری سازگار نبود و سلکتورهای مرده به‌حساب می‌آمدند) */
.nb-cal-day .ss {
  background: color-mix(in srgb, var(--accent-2) 12%, transparent); color: var(--accent-2);
  border-radius: 4px; padding: 1px 5px; font-weight: 600; cursor: pointer;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.nb-cal-day .ss:hover { background: var(--accent-2); color: #fff; }
.nb-cal-day .qq { color: var(--muted); }
.nb-cal-day.hassess:hover { border-color: var(--accent-2); }
.nb-cal-day.empty-day { border-style: dashed; opacity: .4; }

/* ---------- پروفایل دانش‌آموز ---------- */
.nb-prof-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.nb-prof-head .avatar {
  width: 46px; height: 46px; border-radius: 50%; background: var(--grad-brand);
  color: #fff; display: flex; align-items: center; justify-content: center;
  font-size: var(--fs-lg); font-weight: 700; flex: none;
}
.nb-prof-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 14px; }
@media (max-width: 900px) { .nb-prof-grid { grid-template-columns: 1fr; } }
.nb-prof-grid .card { padding: 14px 16px; }
.nb-prof-grid .card h4 { margin: 0 0 10px; font-size: var(--fs-md); }
.nb-mini-table td, .nb-mini-table th { padding: 5px 8px; font-size: var(--fs-xs); }
.nb-note-item {
  border-inline-start: 3px solid var(--accent); background: var(--surface-2);
  border-radius: var(--radius-xs); padding: 7px 10px; margin-bottom: 6px; font-size: var(--fs-xs);
}
.nb-note-item .d { color: var(--muted); font-size: 10px; margin-top: 3px; display: flex; justify-content: space-between; }

/* پنل‌های فرعی مشترک */
.nb-act-row {
  display: flex; align-items: center; gap: 8px; padding: 6px 8px;
  border-radius: var(--radius-sm); border: 1px solid transparent;
}
.nb-act-row:hover { background: var(--surface-2); }
.nb-act-row .nm { flex: 1; font-size: var(--fs-sm); min-width: 130px; }
.nb-mini-btns { display: inline-flex; gap: 3px; }
.nb-mini-btns .btn { padding: 2px 8px; font-size: var(--fs-2xs); }

/* چاپ‌ها */
.print-nb-table { width: 100%; border-collapse: collapse; margin-top: 10px; }
.print-nb-table th, .print-nb-table td { border: 1px solid #cbd5e1; padding: 5px 8px; font-size: 11px; text-align: right; }
.print-nb-table thead th { background: #0d3b34; color: #fff; }

/* حالت تاریک — تنظیم ظریف رنگ‌های ثابت */
[data-theme="dark"] .nb-row.focused td { background: color-mix(in srgb, var(--gold) 14%, transparent) !important; }
[data-theme="dark"] .nb-rand-name { text-shadow: none; }
.nb-day-subjects { margin-top: 10px; }
/* برگه‌های اصلی دفتر */
/* سگمنت درس‌ها و نوع نمره */
.nb-seg { display: flex; gap: 6px; flex-wrap: wrap; }
.nb-seg button {
  border: 1px solid var(--line); background: var(--paper); color: var(--muted);
  border-radius: var(--radius-full); padding: 6px 14px; font-size: var(--fs-sm);
  font-weight: 700; cursor: pointer; font-family: inherit; transition: all var(--dur) var(--ease);
}
.nb-seg button:hover { border-color: var(--muted); }
.nb-seg button.on { background: var(--side); border-color: var(--side); color: #fff; }
.nb-seg button small { font-weight: 400; }
/* ————— نوار ابزار یکپارچهٔ دفتر کلاسی ————— */
.nb-clsbar { display: flex; flex-direction: column; gap: 10px; margin-bottom: 12px; padding: 12px 14px; }
.nb-clsbar-top { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.nb-clsbar-title { display: flex; align-items: center; gap: 7px; min-width: 0; }
.nb-clsbar-title h2 { margin: 0; font-size: var(--fs-lg); white-space: nowrap; }
.nb-clsbar-title svg { color: var(--side); flex: none; }
.nb-back {
  display: inline-flex; align-items: center; gap: 3px; padding: 3px 9px;
  border-radius: var(--radius-full); background: var(--surface-2); color: var(--muted);
  font-size: var(--fs-2xs); text-decoration: none; white-space: nowrap;
}
.nb-back:hover { background: var(--side); color: #fff; }
.nb-search-box {
  display: flex; align-items: center; gap: 6px; flex: 1; min-width: 150px; max-width: 260px;
  background: var(--surface-2); border-radius: var(--radius-full); padding: 5px 11px;
}
.nb-search-box svg { color: var(--muted); flex: none; }
.nb-search-box input {
  flex: 1; min-width: 0; border: none; background: none; outline: none;
  font-family: inherit; font-size: var(--fs-xs); color: var(--ink);
}
/* ردیف روز: پیمایش تاریخ + زنگ‌های درس */
.nb-clsbar-day { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.nb-day-nav { display: flex; align-items: center; gap: 5px; flex: none; }
.nb-day-nav .day-nav {
  display: inline-flex; align-items: center; gap: 4px; border: 1px solid var(--line);
  background: var(--paper); color: var(--muted); border-radius: var(--radius-sm);
  padding: 5px 9px; font-size: var(--fs-xs); font-family: inherit; cursor: pointer;
}
.nb-day-nav .day-nav:hover { border-color: var(--side); color: var(--side); }
.nb-day-nav input {
  width: 96px; height: 30px; text-align: center; border: 1.5px solid var(--line);
  border-radius: var(--radius-sm); font-family: inherit; font-size: var(--fs-xs);
  background: var(--paper); color: var(--ink); font-weight: 700;
}
.nb-day-nav input:focus { outline: none; border-color: var(--side); }
.nb-day-name {
  font-size: var(--fs-2xs); color: var(--muted); white-space: nowrap;
  padding: 3px 8px; background: var(--surface-2); border-radius: var(--radius-full);
}
.nb-day-subjects { display: flex; gap: 6px; flex-wrap: wrap; flex: 1; min-width: 0; }
.nb-day-subjects .nb-seg { flex-wrap: wrap; }
/* ردیف تب‌ها + ابزارها */
.nb-clsbar-tabs { display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  border-top: 1px dashed var(--line); padding-top: 9px; }
.nb-clsbar-tools { display: flex; align-items: center; gap: 6px; margin-inline-start: auto; }
/* تولتیپ شیشه‌ای دکمه‌های سربرگ دفتر:
   ۱) ‎.btn‎ با will-change:transform کانتکست می‌سازد و باکس تولتیپ (::after) زیر
      کارتِ محتوای بعدی می‌ماند؛ با z-index روی دکمهٔ هاورشده، توضیح همیشه روی
      محتوا می‌آید و بریده نمی‌شود.
   ۲) پیکان عمومی (::before) بالای دکمه بود و از باکس (پایین دکمه) جدا می‌افتاد؛
      اینجا می‌چسبد به بالای باکس. */
.nb-clsbar-tools .btn[data-tip]:hover,
.nb-clsbar-tools .btn[data-tip]:focus-visible { z-index: 40; }
.nb-clsbar [data-tip]:hover::before,
.nb-clsbar [data-tip]:focus-visible::before {
  top: 100%; bottom: auto; margin: 4px 0 0;
}
/* نوار نوع نمره‌دهی */
.nb-kindbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 10px; }
.nb-kindbar .nb-seg { flex: 1; }
.nb-kindbar .nb-seg button b { color: inherit; opacity: .8; }
/* ————— ردیف هر دانش‌آموز: نام + سطح + توضیح + وضعیت در یک خط ————— */
.nb-row { padding: 7px 12px; }
.nb-rowline { display: flex; align-items: center; gap: 8px; }
.nb-name-link {
  flex: none; max-width: 130px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-size: var(--fs-sm); font-weight: 600; cursor: pointer; color: var(--ink);
}
.nb-name-link:hover { color: var(--side); }
.nb-grade-ctrls { display: flex; gap: 4px; flex: 1; min-width: 0; align-items: center; }
.nb-rowbadge { flex: none; }
.nb-lvl-btn {
  --lvl: var(--muted); --lvl-tint: rgba(100, 116, 139, .1);
  flex: 1; min-width: 0; border: 1px solid var(--line); background: var(--paper);
  color: var(--muted); border-radius: var(--radius-sm); padding: 5px 4px;
  /* ۱۰.۵px خیلی ریز بود و در بافتِ جدول ناخوانا می‌شد — ۱۲px، طبق تصمیم ممیزی */
  font-size: var(--fs-xs); font-family: inherit; cursor: pointer; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; transition: all var(--dur) var(--ease);
}
.nb-lvl-btn:hover { border-color: var(--lvl); color: var(--lvl); background: var(--lvl-tint); }
.nb-lvl-btn.pending { animation: nb-pulse .8s infinite; }
.nb-l-great { --lvl: var(--good); --lvl-tint: rgba(5, 150, 105, .12); }
.nb-l-good { --lvl: var(--info); --lvl-tint: rgba(37, 99, 235, .12); }
.nb-l-ok { --lvl: var(--warn); --lvl-tint: rgba(217, 119, 6, .13); }
.nb-l-weak { --lvl: var(--bad); --lvl-tint: rgba(220, 38, 38, .12); }
.nb-lvl-btn.on-great, .nb-lvl-btn.on-good, .nb-lvl-btn.on-ok, .nb-lvl-btn.on-weak {
  background: var(--lvl-tint); border-color: var(--lvl); color: var(--lvl); font-weight: 700;
}
/* — سطح/وضعیت علامت‌خورده برای حذف (لمس مجدد سطح فعال — مثل گوشی) — */
.nb-lvl-btn.nb-del-btn, .nb-hw-status.nb-del-btn {
  background: #fee2e2 !important; border-color: #ef4444 !important;
  color: #991b1b !important; text-decoration: line-through; font-weight: 700;
}
/* وضعیت تکلیف — سه دکمهٔ کوتاه کنار اسم */
.nb-hw-status {
  flex: 1; min-width: 0; border: 1px solid var(--line); background: var(--paper);
  color: var(--muted); border-radius: var(--radius-sm); padding: 5px 4px;
  font-size: var(--fs-xs); font-family: inherit; cursor: pointer; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; transition: all var(--dur) var(--ease);
}
.nb-hw-status:hover { border-color: var(--side); color: var(--side); }
.nb-hw-status.on-done { background: rgba(5, 150, 105, .12); border-color: var(--good); color: var(--good); font-weight: 700; }
.nb-hw-status.on-partial { background: rgba(217, 119, 6, .13); border-color: var(--warn); color: var(--warn); font-weight: 700; }
.nb-hw-status.on-none { background: rgba(220, 38, 38, .12); border-color: var(--bad); color: var(--bad); font-weight: 700; }
/* کادر توضیح — کوچک و در انتهای همان ردیف */
.nb-note-inp {
  flex: 1.2; min-width: 90px; height: 30px; border: 1.5px solid var(--line);
  border-radius: var(--radius-sm); padding: 0 9px; font-size: var(--fs-2xs);
  font-family: inherit; background: var(--paper); color: var(--ink);
}
.nb-note-inp:focus { outline: none; border-color: var(--side); }
/* جایگاه دکمهٔ «ثبت تغییرات» */
.nb-sbcount {
  font-size: var(--fs-2xs);
  color: var(--muted);
  white-space: nowrap;
  align-self: center;
  margin: 0 10px;
}
.nb-apply-slot { display: flex; gap: 6px; align-items: center; }
.nb-apply-slot[hidden] { display: none; }
.nb-dirty-count {
  background: rgba(217, 119, 6, .13); color: var(--warn); border: 1px solid var(--warn);
  border-radius: var(--radius-full); padding: 3px 9px; font-size: var(--fs-2xs);
  font-weight: 700; white-space: nowrap;
}
/* ردیف دارای تغییر ثبت‌نشده */
.nb-row.dirty { background: rgba(217, 119, 6, .07); box-shadow: inset 3px 0 0 var(--warn); }
.nb-row .nb-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.nb-row .nm { flex: 1; min-width: 0; }
.nb-row.focused { outline: 2px solid var(--gold); outline-offset: -2px; }
/* نوار توزیع پروفایل */
.nb-bar { display: grid; grid-template-columns: 82px 1fr 56px; align-items: center; gap: 8px; font-size: var(--fs-xs); margin-bottom: 7px; }
.nb-bar .track { height: 10px; border-radius: var(--radius-full); background: var(--surface-2); overflow: hidden; }
.nb-bar .track > i { display: block; height: 100%; border-radius: var(--radius-full); }
.nb-bar .num { text-align: left; color: var(--muted); font-size: var(--fs-2xs); }

/* ————— گزارش حرفه‌ای دفتر کلاسی ————— */
.nb-rpt-shell { position: relative; }
.nb-rpt-bar {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--paper) 92%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 1px 0 color-mix(in srgb, var(--line) 60%, transparent);
}
.nb-rpt-bar h3 { margin: 0 0 10px; font-size: var(--fs-md); display: flex; align-items: center; gap: 7px; }
.nb-rpt-barhead { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.nb-rpt-quick { display: flex; gap: 5px; flex-wrap: wrap; }
.nb-rpt-quick .nb-chip { font-size: var(--fs-2xs); padding: 4px 10px; }
.nb-rpt-quick .nb-chip.on { background: var(--side); border-color: var(--side); color: #fff; }
.nb-rpt-quick .nb-chip.on b { color: #fff; }
.nb-rpt-quick .nb-chip svg { width: 12px; height: 12px; }
.nb-rpt-filters { display: flex; gap: 9px; flex-wrap: wrap; align-items: flex-end; }
.nb-rpt-filters .field { margin: 0; }
.nb-rpt-filters .btn { height: 36px; }
.nb-f-grow { flex: 1; min-width: 170px; max-width: 300px; }
.nb-rpt-actions { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin-top: 10px; }
.nb-rpt-asep { flex: 1; min-width: 4px; }
.nb-rpt-actions .btn { font-size: var(--fs-xs); }
/* حالت خالیِ اولیه */
.nb-rpt-idle {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  padding: 42px 20px; text-align: center; color: var(--muted);
}
.nb-rpt-idle svg { color: var(--muted); opacity: .65; }
.nb-rpt-idle b { font-size: var(--fs-md); color: var(--ink); }
.nb-rpt-idle p { margin: 0; font-size: var(--fs-xs); line-height: 1.9; }
.nb-rpt-idle kbd {
  border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 5px;
  padding: 1px 5px; font-family: inherit; font-size: 10px; background: var(--surface-2); color: var(--ink);
}
/* اسکلت‌لودر */
.nb-rpt-skeleton { display: flex; flex-direction: column; gap: 12px; }
.nb-rpt-skeleton .skel-row { display: grid; gap: 10px; }
.nb-rpt-skeleton .skel-row:nth-child(1) { grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); }
.nb-rpt-skeleton .skel-row:nth-child(2) { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.nb-rpt-skeleton .skel-row:nth-child(3) { grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
.nb-rpt-skeleton .skel-row:nth-child(4) { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.nb-rpt-skeleton > div > div {
  background: linear-gradient(90deg, var(--surface-2) 25%, color-mix(in srgb, var(--surface-2) 55%, var(--paper)) 37%, var(--surface-2) 63%);
  background-size: 400% 100%; border-radius: var(--radius); animation: nb-shimmer 1.4s ease-in-out infinite;
}
.nb-rpt-skeleton .skel-kpi { height: 74px; }
.nb-rpt-skeleton .skel-box { height: 96px; }
.nb-rpt-skeleton .skel-chart { height: 150px; }
.nb-rpt-skeleton .skel-card { height: 168px; }
@keyframes nb-shimmer { 0% { background-position: 100% 0; } 100% { background-position: -100% 0; } }
@media (prefers-reduced-motion: reduce) { .nb-rpt-skeleton > div > div { animation: none; } }
/* کارت‌های خلاصه با آیکون و رنگ معنایی */
.nb-rpt-kpis { display: flex; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.nb-kpi {
  flex: 1; min-width: 130px; background: var(--paper); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 12px 14px; display: flex; flex-direction: column; gap: 3px;
  position: relative; overflow: hidden;
}
.nb-kpi::before {
  content: ''; position: absolute; inset-inline-start: 0; top: 0; bottom: 0; width: 3px;
  background: var(--muted); opacity: .5;
}
.nb-kpi.k-neutral::before { background: var(--muted); }
.nb-kpi.k-brand::before { background: var(--side); }
.nb-kpi.k-ok::before { background: var(--good); }
.nb-kpi.k-warn::before { background: var(--warn); }
.nb-kpi.k-bad::before { background: var(--bad); }
.nb-kpi-ic { color: var(--muted); display: inline-flex; }
.nb-kpi.k-ok .nb-kpi-ic { color: var(--good); }
.nb-kpi.k-warn .nb-kpi-ic { color: var(--warn); }
.nb-kpi.k-bad .nb-kpi-ic { color: var(--bad); }
.nb-kpi.k-brand .nb-kpi-ic { color: var(--side); }
.nb-kpi-n { font-size: 22px; font-weight: 800; color: var(--side); line-height: 1.1; }
.nb-kpi.k-ok .nb-kpi-n { color: var(--good); }
.nb-kpi.k-warn .nb-kpi-n { color: var(--warn); }
.nb-kpi.k-bad .nb-kpi-n { color: var(--bad); }
.nb-kpi-l { font-size: var(--fs-2xs); color: var(--muted); }
/* جدول رکوردها با چیدمان بهتر */
.nb-rpt-tblscroll { max-height: 60vh; overflow: auto; border-radius: var(--radius); }
.nb-rpt-tblscroll table { margin: 0; }
.nb-rpt-tblscroll thead th { position: sticky; top: 0; z-index: 2; }
.nb-rpt-hi { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; margin-bottom: 12px; }
.nb-rpt-box { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 11px 13px; }
.nb-rpt-box h4 { margin: 0 0 8px; font-size: var(--fs-xs); color: var(--muted); }
.nb-rpt-box ol { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 5px; }
.nb-rpt-box li { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: var(--fs-xs); }
.nb-rpt-box li b { color: var(--ink); }
.nb-rpt-box.warm { border-color: rgba(217,119,6,.4); }
.nb-rpt-box.cool { border-color: rgba(37,99,235,.35); }
.nb-rpt-charts { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 16px; }
.nb-chartcol h4 { margin: 0 0 9px; font-size: var(--fs-xs); color: var(--muted); }
.nb-bars { display: flex; flex-direction: column; gap: 6px; }
.nb-barline { display: grid; grid-template-columns: 92px 1fr 58px; align-items: center; gap: 7px; }
.nb-barlbl { font-size: var(--fs-2xs); color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nb-bartrack { height: 9px; border-radius: var(--radius-full); background: var(--surface-2); overflow: hidden; }
.nb-bartrack > i { display: block; height: 100%; border-radius: var(--radius-full); }
.nb-bartrack .b-ok { background: var(--good); }
.nb-bartrack .b-good { background: var(--info); }
.nb-bartrack .b-mid { background: var(--warn); }
.nb-bartrack .b-bad { background: var(--bad); }
.nb-barnum { font-size: var(--fs-2xs); color: var(--muted); text-align: left; }
.nb-month { display: flex; flex-direction: column; gap: 6px; }
.nb-monthrow { display: grid; grid-template-columns: 62px 1fr 38px 62px; align-items: center; gap: 7px; font-size: var(--fs-2xs); }
.nb-monthrow small { color: var(--muted); text-align: left; }
.nb-rpt-detailhead { display: flex; justify-content: space-between; align-items: center; margin-bottom: 11px; flex-wrap: wrap; gap: 6px; }
.nb-rpt-detailhead h3 { margin: 0; font-size: var(--fs-md); }
.nb-rep-gridwrap { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 10px; }
.nb-rep-card {
  border: 1px solid var(--line); border-radius: var(--radius); padding: 11px 13px; background: var(--paper);
}
.nb-rep-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 9px; }
.nb-rep-head .nb-name-link { max-width: none; font-size: var(--fs-sm); font-weight: 700; }
.nb-rep-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; }
.nb-rep-grid > div { display: flex; flex-direction: column; gap: 1px; }
.nb-rep-grid small { font-size: 10px; color: var(--muted); }
.nb-rep-grid b { font-size: var(--fs-xs); }
.nb-rep-hw { display: flex; gap: 5px; margin-top: 9px; flex-wrap: wrap; }
.nb-rep-hw .pill { font-size: 10px; padding: 2px 7px; border-radius: var(--radius-full); border: 1px solid var(--line); }
.nb-rep-hw .pill.ok { color: var(--good); border-color: var(--good); }
.nb-rep-hw .pill.mid { color: var(--warn); border-color: var(--warn); }
.nb-rep-hw .pill.bad { color: var(--bad); border-color: var(--bad); }
.nb-rep-subj { display: flex; gap: 5px; flex-wrap: wrap; margin-top: 8px; }

/* ————— هشدار روز تعطیل / خارج برنامه / آینده ————— */
.nb-day-alert {
  display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px;
  border-radius: var(--radius); border: 1px solid var(--line); background: var(--paper);
}
.nb-day-alert svg { flex: none; margin-top: 1px; }
.nb-day-alert b { display: block; font-size: var(--fs-sm); margin-bottom: 4px; }
.nb-day-alert p { margin: 0; font-size: var(--fs-xs); color: var(--muted); line-height: 1.7; }
.nb-day-alert.warn { border-color: rgba(217, 119, 6, .45); background: rgba(217, 119, 6, .07); }
.nb-day-alert.warn svg { color: var(--warn); }
.nb-day-alert.warn b { color: var(--warn); }
.nb-day-alert.danger { border-color: rgba(220, 38, 38, .45); background: rgba(220, 38, 38, .07); }
.nb-day-alert.danger svg { color: var(--bad); }
.nb-day-alert.danger b { color: var(--bad); }

/* ————— ثبت گروهی ————— */
.nb-clsbar-tools .btn.on { background: var(--side); border-color: var(--side); color: #fff; }
.nb-bulk-bar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 13px;
  margin-bottom: 10px; border-radius: var(--radius); border: 1px dashed var(--side);
  background: color-mix(in srgb, var(--side) 7%, var(--paper));
}
.nb-bulk-bar[hidden] { display: none; }
.nb-bulk-count {
  font-size: var(--fs-xs); font-weight: 700; color: var(--side);
  padding: 3px 10px; background: var(--paper); border-radius: var(--radius-full);
}
.nb-bulk-bar .nb-grade-ctrls { max-width: 460px; }
.nb-bulk-apply {
  flex: 1; min-width: 0; border: 1px solid var(--line); background: var(--paper);
  color: var(--ink); border-radius: var(--radius-sm); padding: 6px 8px;
  font-size: var(--fs-2xs); font-family: inherit; cursor: pointer; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis;
}
.nb-bulk-apply:hover { border-color: var(--side); color: var(--side); background: color-mix(in srgb, var(--side) 8%, var(--paper)); }
.nb-bulk-check { flex: none; display: inline-flex; align-items: center; cursor: pointer; }
.nb-bulk-check input { width: 15px; height: 15px; cursor: pointer; accent-color: var(--side); }
/* ردیف خالی (نمره نگرفته) — رنگ خیلی کم */
.nb-row.nb-empty { background: color-mix(in srgb, var(--muted) 4%, transparent); }
.nb-row.nb-empty .nb-name-link { color: var(--muted); }
.nb-row.nb-empty .nb-rowbadge { opacity: .55; }

/* ردیف دانش‌آموز غایب — بدون opacity کلی تا در تم تیره توی ذوق نزند */
.nb-row.nb-absent {
  background: color-mix(in srgb, var(--muted) 7%, transparent);
  border-inline-start: 3px solid color-mix(in srgb, var(--bad) 55%, transparent);
}
.nb-row.nb-absent .nb-name-link { color: var(--muted); }
.nb-row.nb-absent .nb-bulk-check input { opacity: .4; cursor: not-allowed; }
/* رپر کنترل‌ها برای نگه‌داشتن کاور شفاف */
.nb-grade-ctrls-wrap { position: relative; flex: 1; min-width: 0; display: flex; }
.nb-grade-ctrls-wrap .nb-grade-ctrls { flex: 1; min-width: 0; }
/* کاور شفاف روی دکمه‌ها + متن «غایب است» */
.nb-absent-overlay {
  position: absolute; inset: 0; z-index: 2;
  display: flex; align-items: center; justify-content: center;
  background: color-mix(in srgb, var(--paper) 66%, transparent);
  backdrop-filter: blur(1.2px); -webkit-backdrop-filter: blur(1.2px);
  border: 1px dashed color-mix(in srgb, var(--bad) 38%, var(--line));
  border-radius: var(--radius-sm);
  cursor: not-allowed;
}
.nb-absent-pill {
  font-size: var(--fs-xs); font-weight: 700; white-space: nowrap;
  color: var(--bad);
  background: color-mix(in srgb, var(--bad) 9%, var(--paper));
  border: 1px solid color-mix(in srgb, var(--bad) 32%, transparent);
  padding: 3px 16px; border-radius: var(--radius-full);
}
.nb-row.nb-absent .nb-lvl-btn:hover,
.nb-row.nb-absent .nb-hw-status:hover {
  border-color: var(--line);
  color: var(--muted);
  background: var(--paper);
}
/* تم تیره: متن روشن‌تر و کاور تیرهٔ شفاف */
[data-theme="dark"] .nb-row.nb-absent {
  background: rgba(148, 163, 184, .07);
  border-inline-start-color: rgba(248, 113, 113, .55);
}
[data-theme="dark"] .nb-absent-overlay {
  background: rgba(13, 23, 32, .68);
  border-color: rgba(248, 113, 113, .35);
}
[data-theme="dark"] .nb-absent-pill {
  color: #fca5a5;
  background: rgba(220, 38, 38, .16);
  border-color: rgba(220, 38, 38, .38);
}
/* اعتبارسنجی لحظه‌ای */
.nb-note-inp.invalid { border-color: var(--bad); background: color-mix(in srgb, var(--bad) 8%, var(--paper)); }
.nb-inline-warn {
  flex: none; font-size: var(--fs-2xs); color: var(--bad); white-space: nowrap;
  padding: 2px 6px; background: color-mix(in srgb, var(--bad) 10%, var(--paper));
  border-radius: var(--radius-sm);
}

/* ————— نمودار رشد فردی + هیستوگرام درس ————— */
.nb-chart-card { padding: 12px 14px; }
.nb-chart-card h4 { margin: 0 0 9px; font-size: var(--fs-xs); color: var(--muted); }
.nb-chart-svg { width: 100%; height: auto; display: block; }
.nb-chart-legend { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 7px; }
.nb-chart-legend span { font-size: 10px; color: var(--muted); display: inline-flex; align-items: center; gap: 4px; }
.nb-chart-legend i { width: 9px; height: 9px; border-radius: 2px; display: inline-block; }
.nb-hist-subj { margin-bottom: 14px; }
.nb-hist-subj:last-child { margin-bottom: 0; }
.nb-hist-head { display: flex; justify-content: space-between; font-size: var(--fs-xs); margin-bottom: 5px; }
.nb-hist-head b { color: var(--ink); }
.nb-hist-head span { color: var(--muted); }

/* ————— استایل مشترک نمودارها ————— */
.nb-chart-svg .nb-grid { stroke: var(--line); stroke-width: .6; stroke-dasharray: 3 3; }
.nb-chart-svg .nb-axis { font-size: 8px; fill: var(--muted); }
.nb-histline {
  display: grid; grid-template-columns: 92px 1fr 42px; align-items: center; gap: 7px;
  font-size: var(--fs-2xs);
}
.nb-histline .nb-barlbl { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nb-histline .nb-barnum { color: var(--ink); text-align: left; }


/* فهرست کلاس‌های گزارش */
.nb-class-card { text-decoration: none; color: inherit; display: block; }
.nb-cc-sub {
  margin-top: 8px; font-size: var(--fs-2xs); color: var(--muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* ————— ریسک، پایداری، عدالت پرسش، فلگ ملاقات ————— */
.nb-risk-card { border-color: rgba(220, 38, 38, .3); }
.nb-risk-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 9px; }
.nb-risk-item {
  border: 1px solid var(--line); border-radius: var(--radius); padding: 9px 11px; background: var(--paper);
}
.nb-risk-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 7px; }
.nb-risk-reasons { display: flex; gap: 5px; flex-wrap: wrap; }
.nb-risk-reasons .pill {
  font-size: 10px; padding: 2px 7px; border-radius: var(--radius-full);
  border: 1px solid rgba(220, 38, 38, .35); color: var(--bad);
  background: rgba(220, 38, 38, .07);
}
.nb-risk-reasons .pill.ok { border-color: var(--good); color: var(--good); background: rgba(5,150,105,.07); }
.nb-risk-reasons .pill.mid { border-color: var(--warn); color: var(--warn); background: rgba(217,119,6,.08); }
.nb-stab-list { display: flex; flex-direction: column; gap: 6px; }
.nb-stab-row {
  display: grid; grid-template-columns: 120px 1fr 56px 78px; align-items: center; gap: 7px;
}
.nb-stab-month { font-size: var(--fs-2xs); color: var(--muted); }
.nb-stab-track {
  height: 9px; border-radius: var(--radius-full); background: var(--surface-2); overflow: hidden;
  display: block;
}
.nb-stab-track > i { display: block; height: 100%; border-radius: var(--radius-full); }
.nb-stab-num { font-size: var(--fs-2xs); color: var(--muted); text-align: left; }
.nb-fair-summary { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; margin-bottom: 9px; }
.nb-fair-summary .muted { font-size: var(--fs-2xs); }
/* نشان فلگ ملاقات کنار نام */
.nb-meet-flag {
  display: inline-flex; align-items: center; margin-inline-start: 5px; color: var(--bad);
  cursor: help; flex: none;
}
.nb-meet-flag svg { width: 12px; height: 12px; }
