/* ═══════════════════════════════════════════════════════
   سامانه مدیریت مدرسه — استایل اصلی
   پوسته روشن / تاریک + طراحی واکنش‌گرا راست‌چین
   ═══════════════════════════════════════════════════════ */

/* ---------- متغیرهای پوسته ---------- */
:root {
  --bg: #eef1f9;
  --surface: #ffffff;
  --surface-2: #f6f8fd;
  --surface-3: #eceff8;
  --text: #1e293b;
  --muted: #64748b;
  --border: #e3e8f2;

  --primary: #4f46e5;
  --primary-2: #7c3aed;
  --grad: linear-gradient(135deg, #6d28d9, #4f46e5);

  --t-green: #15803d;
  --t-red: #b91c1c;
  --t-amber: #b45309;
  --t-blue: #1d4ed8;
  --t-pink: #be185d;

  --shadow: 0 1px 2px rgba(15, 23, 42, .05), 0 12px 32px -14px rgba(15, 23, 42, .14);
  --radius: 18px;
}

[data-theme="dark"] {
  --bg: #0b1120;
  --surface: #121b30;
  --surface-2: #17223c;
  --surface-3: #1e2b4a;
  --text: #e2e8f0;
  --muted: #92a4c0;
  --border: #25345a;

  --t-green: #4ade80;
  --t-red: #f87171;
  --t-amber: #fbbf24;
  --t-blue: #60a5fa;
  --t-pink: #f472b6;

  --shadow: 0 1px 2px rgba(0, 0, 0, .35), 0 16px 40px -16px rgba(0, 0, 0, .55);
  color-scheme: dark;
}

/* ---------- پایه ---------- */
* { margin: 0; padding: 0; box-sizing: border-box; }

[hidden] { display: none !important; }

html { scrollbar-color: rgba(100, 116, 139, .4) transparent; }

body {
  font-family: "Noto Kufi Arabic", "Vazirmatn", Tahoma, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.8;
}

body.no-scroll { overflow: hidden; }

svg { stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-thumb { background: rgba(100, 116, 139, .35); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: rgba(100, 116, 139, .55); }
::-webkit-scrollbar-track { background: transparent; }

:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

.ltr { direction: ltr; unicode-bidi: embed; }
.muted { color: var(--muted); }
.small { font-size: 12px; }

/* ---------- چیدمان کلی ---------- */
.app { display: flex; min-height: 100vh; }

/* ═══════════ سایدبار ═══════════ */
.sidebar {
  width: 258px;
  flex-shrink: 0;
  background: linear-gradient(195deg, #312e81 0%, #4c1d95 55%, #5b21b6 100%);
  color: #fff;
  display: flex;
  flex-direction: column;
  padding: 22px 16px;
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand { display: flex; align-items: center; gap: 12px; padding: 4px 8px 22px; }

.brand-logo {
  width: 44px; height: 44px;
  border-radius: 14px;
  background: rgba(255, 255, 255, .16);
  backdrop-filter: blur(6px);
  display: grid; place-items: center;
  color: #fff;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .18);
}

.brand-info { display: flex; flex-direction: column; line-height: 1.5; }
.brand-info strong { font-size: 15.5px; font-weight: 800; }
.brand-info span { font-size: 11.5px; opacity: .75; }

.nav { display: flex; flex-direction: column; gap: 4px; flex: 1; overflow-y: auto; }

.nav-item {
  display: flex; align-items: center; gap: 12px;
  width: 100%;
  padding: 11px 14px;
  border: none; border-radius: 13px;
  background: transparent;
  color: rgba(255, 255, 255, .78);
  font-family: inherit; font-size: 14px; font-weight: 500;
  cursor: pointer;
  transition: background .2s, color .2s, transform .15s;
}

.nav-item svg { width: 19px; height: 19px; flex-shrink: 0; }

.nav-item:hover { background: rgba(255, 255, 255, .09); color: #fff; }

.nav-item.active {
  background: rgba(255, 255, 255, .17);
  color: #fff;
  font-weight: 700;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .14), 0 8px 18px -8px rgba(0, 0, 0, .4);
}

.sidebar-card {
  background: rgba(255, 255, 255, .08);
  border: 1px solid rgba(255, 255, 255, .12);
  border-radius: 14px;
  padding: 12px 14px;
  font-size: 11.5px;
  line-height: 1.8;
}
.sidebar-card p { font-weight: 700; opacity: .9; }
.sidebar-card small { opacity: .6; }

.overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(2, 6, 23, .55);
  z-index: 55;
}

/* ═══════════ بخش اصلی ═══════════ */
.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }

.topbar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: 14px;
  padding: 14px 26px;
  background: color-mix(in srgb, var(--surface) 82%, transparent);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}

.topbar-titles { flex: 1; min-width: 0; }
.topbar-titles h2 { font-size: 19px; font-weight: 800; line-height: 1.4; }
.topbar-titles span { font-size: 12px; color: var(--muted); }

.topbar-actions { display: flex; align-items: center; gap: 10px; }

.hamburger { display: none; }

.content { padding: 26px; max-width: 1280px; width: 100%; margin: 0 auto; }

/* ---------- صفحات ---------- */
.page { display: none; }
.page.active { display: block; animation: fadeUp .3s ease; }

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}

/* ---------- کارت ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
}

.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 16px; }
.card-title { font-size: 15px; font-weight: 800; }
.card-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }

/* ---------- شبکه‌ها ---------- */
.grid { display: grid; gap: 18px; }
.g2 { grid-template-columns: 1fr 1fr; }
.g3 { grid-template-columns: repeat(3, 1fr); }
.g4 { grid-template-columns: repeat(4, 1fr); }
.g-2-1 { grid-template-columns: 2fr 1fr; }
.mt { margin-top: 18px; }

/* ---------- کارت‌های آمار ---------- */
.stat {
  display: flex; align-items: center; gap: 15px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 19px;
  transition: transform .2s, box-shadow .2s;
}
.stat:hover { transform: translateY(-3px); box-shadow: 0 4px 6px rgba(15, 23, 42, .05), 0 18px 40px -14px rgba(15, 23, 42, .2); }

.stat-icon {
  width: 52px; height: 52px;
  border-radius: 15px;
  display: grid; place-items: center;
  color: #fff;
  flex-shrink: 0;
}
.stat-icon svg { width: 23px; height: 23px; }
.stat-icon.g1 { background: linear-gradient(135deg, #6d28d9, #4f46e5); box-shadow: 0 8px 18px -8px #6d28d9; }
.stat-icon.g2 { background: linear-gradient(135deg, #0891b2, #2563eb); box-shadow: 0 8px 18px -8px #2563eb; }
.stat-icon.g3 { background: linear-gradient(135deg, #d97706, #dc2626); box-shadow: 0 8px 18px -8px #dc2626; }
.stat-icon.g4 { background: linear-gradient(135deg, #db2777, #7c3aed); box-shadow: 0 8px 18px -8px #db2777; }

.stat-num { font-size: 25px; font-weight: 900; line-height: 1.3; }
.stat-label { font-size: 12.5px; color: var(--muted); font-weight: 500; }
.stat-chip {
  display: inline-block; margin-top: 4px;
  font-size: 10.5px; font-weight: 700;
  color: var(--primary);
  background: color-mix(in srgb, var(--primary) 10%, transparent);
  padding: 2px 9px; border-radius: 99px;
}

/* ---------- نمودار میله‌ای ---------- */
.chart-bars {
  display: flex; align-items: stretch; justify-content: center;
  gap: clamp(28px, 8vw, 84px);
  height: 210px;
  padding-top: 12px;
}
.bar { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 7px; width: 56px; height: 100%; }
.bar-col {
  width: 100%; max-width: 40px;
  background: var(--grad);
  border-radius: 9px 9px 4px 4px;
  min-height: 6px;
  transform-origin: bottom;
  animation: grow .7s cubic-bezier(.2, .8, .3, 1);
}
@keyframes grow { from { transform: scaleY(0); } }
.bar-val { font-size: 13px; font-weight: 800; }
.bar-name { font-size: 11.5px; color: var(--muted); white-space: nowrap; }

/* ---------- نمودار دایره‌ای ---------- */
.donut-wrap { display: flex; align-items: center; gap: 22px; justify-content: center; padding: 8px 0; }
.donut {
  width: 132px; height: 132px;
  border-radius: 50%;
  display: grid; place-items: center;
  flex-shrink: 0;
}
.donut-hole {
  width: 92px; height: 92px;
  border-radius: 50%;
  background: var(--surface);
  display: grid; place-items: center;
  text-align: center;
}
.donut-hole b { font-size: 21px; font-weight: 900; display: block; line-height: 1.4; }
.donut-hole span { font-size: 11px; color: var(--muted); }
.legend { display: flex; flex-direction: column; gap: 9px; }
.legend-item { display: flex; align-items: center; gap: 9px; font-size: 13px; font-weight: 600; }
.legend-item b { margin-inline-start: auto; font-weight: 800; }
.dot { width: 11px; height: 11px; border-radius: 4px; flex-shrink: 0; }

/* ---------- لیست برترین‌ها ---------- */
.rank-list { display: flex; flex-direction: column; }
.rank-item { display: flex; align-items: center; gap: 12px; padding: 10px 4px; border-bottom: 1px solid var(--border); }
.rank-item:last-child { border-bottom: none; }
.rank-num {
  width: 28px; height: 28px; border-radius: 10px;
  display: grid; place-items: center;
  font-size: 12.5px; font-weight: 800;
  background: var(--surface-3); color: var(--muted);
  flex-shrink: 0;
}
.rank-num.r1 { background: linear-gradient(135deg, #f59e0b, #f97316); color: #fff; }
.rank-num.r2 { background: linear-gradient(135deg, #94a3b8, #64748b); color: #fff; }
.rank-num.r3 { background: linear-gradient(135deg, #d97706, #b45309); color: #fff; }
.rank-item .info { flex: 1; min-width: 0; }
.rank-item .info b { display: block; font-size: 13.5px; }
.rank-item .info span { font-size: 11.5px; color: var(--muted); }
.rank-avg { font-weight: 900; font-size: 15px; color: var(--primary); }

/* ---------- جعبه‌ابزار (جستجو و فیلتر) ---------- */
.toolbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.toolbar .input { width: auto; }

.search-box { position: relative; flex: 1; min-width: 220px; }
.search-box svg {
  position: absolute; inset-inline-start: 13px; top: 50%;
  transform: translateY(-50%);
  width: 17px; height: 17px;
  color: var(--muted); pointer-events: none;
}
.search-box .input { width: 100%; padding-inline-start: 40px; }

/* ---------- جدول ---------- */
.table-card { padding: 0; overflow: hidden; }
.table-wrap { overflow-x: auto; border-radius: var(--radius); }

table { width: 100%; border-collapse: collapse; white-space: nowrap; }

th {
  text-align: right;
  font-size: 11.5px; font-weight: 700;
  color: var(--muted);
  background: var(--surface-2);
  padding: 13px 16px;
  border-bottom: 1px solid var(--border);
}

td { padding: 12px 16px; border-bottom: 1px solid var(--border); font-size: 13px; vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tbody tr { transition: background .15s; }
tbody tr:hover { background: color-mix(in srgb, var(--primary) 4%, transparent); }

.cell-person { display: flex; align-items: center; gap: 11px; }
.cell-person .sub { display: block; font-size: 11px; color: var(--muted); }
.num { font-weight: 800; }

.row-actions { display: flex; gap: 6px; justify-content: flex-end; }

/* ---------- دکمه‌ها ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 18px;
  border: none; border-radius: 12px;
  font-family: inherit; font-size: 13.5px; font-weight: 700;
  cursor: pointer;
  transition: transform .15s, box-shadow .2s, background .2s, opacity .2s;
}
.btn svg { width: 16px; height: 16px; }

.btn.primary {
  background: var(--grad); color: #fff;
  box-shadow: 0 8px 20px -8px rgba(79, 70, 229, .65);
}
.btn.primary:hover { transform: translateY(-1px); box-shadow: 0 12px 24px -8px rgba(79, 70, 229, .75); }

.btn.ghost { background: var(--surface-3); color: var(--text); }
.btn.ghost:hover { background: var(--surface-2); }

.btn.danger { background: linear-gradient(135deg, #dc2626, #b91c1c); color: #fff; box-shadow: 0 8px 20px -8px rgba(220, 38, 38, .6); }
.btn.danger:hover { transform: translateY(-1px); }

.btn.sm { padding: 7px 13px; font-size: 12.5px; border-radius: 10px; }

.icon-btn {
  width: 38px; height: 38px;
  display: inline-grid; place-items: center;
  border-radius: 11px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
  transition: .2s;
}
.icon-btn svg { width: 17px; height: 17px; }
.icon-btn:hover { color: var(--primary); border-color: var(--primary); }
.icon-btn.sm { width: 31px; height: 31px; border-radius: 9px; }
.icon-btn.danger:hover { color: var(--t-red); border-color: var(--t-red); }

/* ---------- نشان‌ها (Badge) ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3.5px 11px;
  border-radius: 999px;
  font-size: 11.5px; font-weight: 700;
  white-space: nowrap;
}
.b-green  { background: rgba(22, 163, 74, .13);  color: var(--t-green); }
.b-red    { background: rgba(220, 38, 38, .12);  color: var(--t-red); }
.b-amber  { background: rgba(217, 119, 6, .14);  color: var(--t-amber); }
.b-blue   { background: rgba(37, 99, 235, .12);  color: var(--t-blue); }
.b-pink   { background: rgba(219, 39, 119, .12); color: var(--t-pink); }
.b-gray   { background: rgba(100, 116, 139, .14); color: var(--muted); }
.b-purple { background: rgba(124, 58, 237, .13); color: var(--primary-2); }

.g-hi    { color: var(--t-green); font-weight: 800; }
.g-mid   { color: var(--t-blue); font-weight: 800; }
.g-low   { color: var(--t-amber); font-weight: 800; }
.g-fail  { color: var(--t-red); font-weight: 800; }

/* ---------- آواتار ---------- */
.avatar {
  display: inline-grid; place-items: center;
  border-radius: 50%;
  color: #fff;
  font-size: 12.5px; font-weight: 700;
  flex-shrink: 0;
  letter-spacing: 0;
}

/* ---------- فرم‌ها ---------- */
.field { display: flex; flex-direction: column; gap: 6px; }
.field > label { font-size: 12px; font-weight: 700; color: var(--muted); }

.input {
  width: 100%;
  padding: 10px 14px;
  border-radius: 12px;
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-family: inherit; font-size: 13.5px;
  transition: border-color .2s, box-shadow .2s;
}
.input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 4px color-mix(in srgb, var(--primary) 14%, transparent); }
textarea.input { resize: vertical; min-height: 62px; }

select.input { cursor: pointer; }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.span-2 { grid-column: 1 / -1; }

/* ---------- مودال ---------- */
.modal-overlay {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(2, 6, 23, .55);
  backdrop-filter: blur(5px);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  animation: overlayIn .2s ease;
}
@keyframes overlayIn { from { opacity: 0; } }

.modal {
  width: min(560px, 94vw);
  max-height: 88vh;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  box-shadow: 0 30px 70px -20px rgba(0, 0, 0, .45);
  display: flex; flex-direction: column;
  animation: popIn .28s cubic-bezier(.2, .9, .3, 1.2);
}
.modal.wide { width: min(780px, 94vw); }
@keyframes popIn { from { opacity: 0; transform: translateY(18px) scale(.97); } }

.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 17px 22px;
  border-bottom: 1px solid var(--border);
}
.modal-head h3 { font-size: 15.5px; font-weight: 800; }

.modal-body { padding: 22px; overflow-y: auto; }

.modal-foot {
  display: flex; gap: 10px; justify-content: flex-start;
  padding: 15px 22px;
  border-top: 1px solid var(--border);
}

.confirm-msg { display: flex; align-items: flex-start; gap: 12px; font-size: 14px; line-height: 1.9; }
.confirm-msg svg { color: var(--t-amber); flex-shrink: 0; margin-top: 4px; }

/* ---------- اعلان (Toast) ---------- */
.toast-root {
  position: fixed; top: 18px; left: 50%;
  transform: translateX(-50%);
  z-index: 200;
  display: flex; flex-direction: column; gap: 9px;
  align-items: center;
}
.toast {
  display: flex; align-items: center; gap: 10px;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 13px;
  padding: 11px 18px;
  font-size: 13px; font-weight: 600;
  box-shadow: 0 14px 40px -10px rgba(0, 0, 0, .3);
  animation: slideDown .3s cubic-bezier(.2, .9, .3, 1.2);
}
.toast svg { width: 17px; height: 17px; }
.toast.success svg { color: var(--t-green); }
.toast.error svg { color: var(--t-red); }
.toast.out { opacity: 0; transform: translateY(-10px); transition: .3s; }
@keyframes slideDown { from { opacity: 0; transform: translateY(-14px); } }

/* ---------- حضور و غیاب ---------- */
.att-row {
  display: flex; align-items: center; gap: 14px;
  padding: 11px 6px;
  border-bottom: 1px solid var(--border);
}
.att-row:last-child { border-bottom: none; }
.att-row .cell-person { flex: 1; min-width: 0; }

.seg { display: inline-flex; gap: 4px; background: var(--surface-3); padding: 4px; border-radius: 12px; }
.seg-btn {
  padding: 6px 14px;
  border: none; border-radius: 9px;
  background: transparent;
  color: var(--muted);
  font-family: inherit; font-size: 12px; font-weight: 700;
  cursor: pointer;
  transition: .18s;
}
.seg-btn.ok.active   { background: #16a34a; color: #fff; box-shadow: 0 4px 12px -4px rgba(22, 163, 74, .7); }
.seg-btn.no.active   { background: #dc2626; color: #fff; box-shadow: 0 4px 12px -4px rgba(220, 38, 38, .7); }
.seg-btn.late.active { background: #d97706; color: #fff; box-shadow: 0 4px 12px -4px rgba(217, 119, 6, .7); }

.att-summary { display: flex; gap: 10px; flex-wrap: wrap; margin: 14px 0; }
.att-chip {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  padding: 7px 15px; border-radius: 12px;
  font-size: 12.5px; font-weight: 700;
}
.att-chip .dot { width: 9px; height: 9px; border-radius: 50%; }
.att-chip b { font-weight: 900; }

/* ---------- نوار پیشرفت ظرفیت ---------- */
.progress { height: 8px; background: var(--surface-3); border-radius: 99px; overflow: hidden; }
.progress-fill { height: 100%; background: var(--grad); border-radius: 99px; transition: width .4s; }

/* ---------- کارت کلاس ---------- */
.class-card { display: flex; flex-direction: column; gap: 13px; transition: transform .2s, box-shadow .2s; }
.class-card:hover { transform: translateY(-3px); }
.class-card .head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.class-card .head h3 { font-size: 16.5px; font-weight: 800; }
.kv { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 13px; }
.kv span { color: var(--muted); font-size: 12px; display: inline-flex; align-items: center; gap: 6px; }
.kv svg { width: 15px; height: 15px; }
.class-card .foot { display: flex; justify-content: space-between; align-items: center; border-top: 1px solid var(--border); padding-top: 12px; margin-top: 2px; }

/* ---------- حالت خالی ---------- */
.empty { text-align: center; padding: 46px 20px; color: var(--muted); }
.empty svg { width: 42px; height: 42px; opacity: .45; margin-bottom: 12px; }
.empty p { font-size: 13.5px; margin-bottom: 16px; }

/* ---------- تنظیمات ---------- */
.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.settings-grid .full { grid-column: 1 / -1; }
.data-actions { display: flex; flex-wrap: wrap; gap: 10px; }

/* ---------- کارنامه ---------- */
.report-head { text-align: center; padding-bottom: 14px; border-bottom: 2px solid var(--border); margin-bottom: 16px; }
.report-head strong { font-size: 17px; font-weight: 900; display: block; }
.report-head span { font-size: 12.5px; color: var(--muted); }
.report-info { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-bottom: 18px; }
.report-info .kv2 { background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; padding: 9px 13px; font-size: 12.5px; }
.report-info .kv2 span { display: block; color: var(--muted); font-size: 11px; }
.report-info .kv2 b { font-weight: 800; }
.report h4 { font-size: 13.5px; font-weight: 800; margin: 14px 0 8px; color: var(--primary-2); }
.report .final-avg { text-align: center; margin: 18px 0 6px; }
.report .final-avg b { font-size: 30px; font-weight: 900; color: var(--primary); }
.report-actions { display: flex; gap: 10px; justify-content: center; margin-top: 20px; }

/* ---------- چاپ کارنامه ---------- */
@media print {
  body { background: #fff !important; }
  .app, .toast-root, .modal-head, .modal-foot, .no-print { display: none !important; }
  .modal-overlay { position: static; background: none; backdrop-filter: none; padding: 0; }
  .modal { box-shadow: none; border: none; width: 100%; max-height: none; animation: none; }
}

/* ---------- واکنش‌گرا ---------- */
@media (max-width: 1080px) {
  .g4 { grid-template-columns: 1fr 1fr; }
  .g-2-1 { grid-template-columns: 1fr; }
}

@media (max-width: 900px) {
  .sidebar {
    position: fixed; inset-inline-end: 0; top: 0; bottom: 0;
    transform: translateX(100%);
    transition: transform .3s cubic-bezier(.3, .8, .3, 1);
    z-index: 60;
    box-shadow: -20px 0 60px rgba(0, 0, 0, .3);
  }
  .sidebar.open { transform: none; }
  .overlay.show { display: block; }
  .hamburger { display: inline-grid; }
  .content { padding: 18px 14px; }
  .topbar { padding: 12px 16px; }
}

@media (max-width: 700px) {
  .g2, .g3, .g4 { grid-template-columns: 1fr; }
  .settings-grid { grid-template-columns: 1fr; }
  .hide-sm { display: none; }
  .form-grid { grid-template-columns: 1fr; }
  .donut-wrap { flex-direction: column; }
  .toolbar { flex-direction: column; align-items: stretch; }
  .toolbar .btn { justify-content: center; }
  .switcher { max-width: 130px; }
}

/* ═══════════ شاشەی چوونەژوورەوە ═══════════ */
.login-screen {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  background:
    radial-gradient(1100px 700px at 85% -10%, rgba(124, 58, 237, .28), transparent 60%),
    radial-gradient(900px 600px at -10% 110%, rgba(79, 70, 229, .24), transparent 60%),
    var(--bg);
}
.login-card {
  width: min(430px, 94vw);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 22px;
  box-shadow: 0 30px 70px -20px rgba(2, 6, 23, .35);
  padding: 34px 30px 26px;
  animation: popIn .35s cubic-bezier(.2, .9, .3, 1.1);
}
.login-logo {
  width: 64px; height: 64px;
  border-radius: 19px;
  background: var(--grad);
  display: grid; place-items: center;
  color: #fff;
  margin: 0 auto 16px;
  box-shadow: 0 14px 32px -10px rgba(79, 70, 229, .6);
}
.login-card h1 { font-size: 17.5px; text-align: center; font-weight: 900; line-height: 1.7; }
.login-card .sub { text-align: center; color: var(--muted); font-size: 12px; margin: 4px 0 22px; }
.login-btn { width: 100%; margin-top: 18px; padding: 12px; font-size: 14.5px; }
.login-err {
  background: rgba(220, 38, 38, .1); color: var(--t-red);
  border-radius: 11px; padding: 9px 13px; font-size: 12.5px; font-weight: 700;
  margin-top: 14px; text-align: center;
}
.demo-creds {
  margin-top: 20px;
  background: var(--surface-2);
  border: 1px dashed var(--border);
  border-radius: 13px;
  padding: 11px 14px;
  font-size: 11.5px;
}
.demo-creds b { display: block; margin-bottom: 5px; font-size: 11.5px; color: var(--muted); }
.cred { display: flex; justify-content: space-between; align-items: center; padding: 2.5px 0; }
.cred code {
  background: var(--surface-3);
  border-radius: 7px;
  padding: 1px 9px;
  font-family: inherit;
  font-weight: 800;
  color: var(--primary);
  direction: ltr;
}

/* ═══════════ بەشەکانی سیستەمی نوێ ═══════════ */
.switcher { width: auto; padding: 8px 12px; font-size: 12.5px; border-radius: 11px; }

.sidebar-user {
  background: rgba(255, 255, 255, .08);
  border: 1px solid rgba(255, 255, 255, .12);
  border-radius: 14px;
  padding: 11px 13px;
  display: flex; align-items: center; gap: 10px;
}
.sidebar-user .info { flex: 1; min-width: 0; }
.sidebar-user .info b { display: block; font-size: 12.5px; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user .info span { font-size: 10.5px; opacity: .7; }
.sidebar-user .avatar { border: 2px solid rgba(255, 255, 255, .35); }
.logout-btn {
  width: 32px; height: 32px;
  display: grid; place-items: center;
  border: none; border-radius: 9px;
  background: rgba(255, 255, 255, .14);
  color: #fff; cursor: pointer;
  transition: .2s;
}
.logout-btn:hover { background: rgba(220, 38, 38, .75); }
.logout-btn svg { width: 15px; height: 15px; }

/* گرووپی زانیاری لە مۆداڵی وردەکاری */
.group-title { font-size: 13px; font-weight: 800; color: var(--primary-2); margin: 16px 0 8px; }
.group-title:first-child { margin-top: 0; }
.detail-groups { display: grid; grid-template-columns: repeat(auto-fit, minmax(165px, 1fr)); gap: 9px; }

/* ڕیزی قیستەکان */
.ins-add {
  display: flex; gap: 8px; align-items: flex-end; flex-wrap: wrap;
  background: var(--surface-2);
  border: 1px dashed var(--border);
  border-radius: 13px;
  padding: 12px;
  margin: 12px 0 4px;
}
.ins-add .field { flex: 1; min-width: 130px; margin: 0; }
.ins-add .btn { white-space: nowrap; }
.mini-progress { height: 6px; background: var(--surface-3); border-radius: 99px; overflow: hidden; min-width: 70px; }
.mini-progress > div { height: 100%; background: linear-gradient(135deg, #16a34a, #4ade80); }

/* کارتی قوتابخانە */
.school-head { display: flex; align-items: center; gap: 12px; }
.school-icon {
  width: 46px; height: 46px; border-radius: 14px;
  display: grid; place-items: center; color: #fff; flex-shrink: 0;
}
.school-icon.girls { background: linear-gradient(135deg, #db2777, #ec4899); box-shadow: 0 8px 18px -8px #db2777; }
.school-icon.boys { background: linear-gradient(135deg, #2563eb, #0ea5e9); box-shadow: 0 8px 18px -8px #2563eb; }
.school-icon svg { width: 21px; height: 21px; }

/* ═══════════ چاپی کارتەکان ═══════════ */
#printRoot { display: none; }
@media print {
  body > *:not(#printRoot) { display: none !important; }
  #printRoot { display: block !important; }
  .print-card { page-break-after: always; break-after: page; }
  .print-card:last-child { page-break-after: auto; }
}
.print-card {
  border: 2px solid #333;
  border-radius: 14px;
  padding: 18px 22px;
  margin-bottom: 16px;
  font-size: 12.5px;
}
.print-card .pc-head {
  display: flex; align-items: center; gap: 14px;
  border-bottom: 2px solid #333;
  padding-bottom: 10px; margin-bottom: 12px;
}
.print-card .pc-head img { width: 64px; height: 64px; object-fit: contain; }
.print-card .pc-head .t { flex: 1; text-align: center; line-height: 1.8; }
.print-card .pc-head .t b { font-size: 15px; }
.print-card .pc-head .t span { display: block; font-size: 11.5px; color: #444; }
.print-card table { width: 100%; border-collapse: collapse; }
.print-card th, .print-card td { border: 1px solid #999; padding: 5px 8px; font-size: 11.5px; }
.print-card th { background: #eee; }
.print-card .pc-info { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 16px; margin-bottom: 10px; font-size: 11.5px; }
.print-card .pc-foot {
  display: flex; justify-content: space-between; gap: 20px;
  margin-top: 16px; padding-top: 8px; border-top: 1px dashed #999;
  font-size: 11px; color: #444;
}
.pc-sign { text-align: center; }
.pc-sign span { display: block; margin-top: 22px; border-top: 1px solid #333; padding-top: 3px; min-width: 110px; }

/* ═══════════ تێلێگرام ═══════════ */
.tg-log {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 14px;
  max-height: 220px;
  overflow-y: auto;
  font-size: 12px;
  line-height: 2;
}
.tg-log .ok { color: var(--t-green); font-weight: 700; }
.tg-log .err { color: var(--t-red); font-weight: 700; }

/* ═══════════ خشتەی مەپینگی ئیمپۆرت ═══════════ */
.map-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px; }
.map-item {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 9px 12px;
}
.map-item .col-name {
  font-size: 11.5px; font-weight: 800; color: var(--primary);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  margin-bottom: 4px;
}
.map-item .sample { font-size: 11px; color: var(--muted); margin-top: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.preview-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: 12px; }
.preview-wrap table { font-size: 11.5px; }
.preview-wrap td, .preview-wrap th { padding: 6px 10px; white-space: nowrap; }

/* ═══════════ پۆرتاڵی قوتابی ═══════════ */
.portal-hero {
  display: flex; align-items: center; gap: 16px;
  background: linear-gradient(135deg, rgba(109, 40, 217, .12), rgba(79, 70, 229, .08));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 18px;
}

/* فایلی ئەپلۆد */
.file-label { position: relative; overflow: hidden; display: inline-flex; }
.logo-preview {
  width: 74px; height: 74px;
  border: 1.5px dashed var(--border);
  border-radius: 13px;
  display: grid; place-items: center;
  font-size: 10px; color: var(--muted);
  overflow: hidden;
  background: var(--surface-2);
}
.logo-preview img { width: 100%; height: 100%; object-fit: contain; }

.score-input { width: 84px; text-align: center; padding: 7px 8px; }
