/* CSS Variables for Dark/Light Mode */
:root {
  --bg-body: #fafafa;          /* خلفية عامة فاتحة ونقية مطابقة للنمط العصري */
  --bg-card: #ffffff;          /* خلفية البطاقات بيضاء نقية */
  --text-main: #0a0a0a;        /* لون النص الأساسي الداكن والواضح */
  --text-muted: #737373;       /* لون النصوص الفرعية والرمادية */
  --border-color: #ebebeb;     /* لون الحدود الخفيفة والناعمة */
  --input-bg: #fafafa;         /* خلفية حقول الإدخال */
  --sidebar-bg: #ffffff;       /* القائمة الجانبية بيضاء نظيفة تماماً مثل الصورة المرفقة */
  --sidebar-text: #737373;     /* لون نص عناصر القائمة غير النشطة */
  --sidebar-active-bg: #f4f4f5;/* خلفية العنصر النشط في القائمة (أزرق فاتح جداً) */
  --sidebar-active-text: #0a0a0a;/* لون أيقونة ونَص العنصر النشط */
  --primary-color: #0a0a0a;    /* اللون الأساسي (أزرق احترافي) */
  --primary-text: #ffffff;     /* لون النص على الأزرار الأساسية */
  --hover-bg: #f4f4f5;         /* لون الهوفر الخفيف */
  --overlay-bg: rgba(10, 10, 10, 0.45);
}
[data-theme="dark"] {
  --bg-body: #0a0a0a;          /* خلفية عامة داكنة غنية وعميقة */
  --bg-card: #111111;          /* خلفية البطاقات (داكنة بارزة عن الخلفية العامة) */
  --text-main: #fafafa;        /* نصوص بيضاء ناصعة وواضحة */
  --text-muted: #a3a3a3;       /* نصوص فرعية رمادية هادئة */
  --border-color: #242424;     /* حدود ناعمة وخفيفة جداً بين العناصر */
  --input-bg: #161616;         /* خلفية حقول الإدخال والبحث الداكنة */
  --sidebar-bg: #0d0d0d;       /* خلفية القائمة الجانبية متناسقة مع الهوية */
  --sidebar-text: #a3a3a3;     /* لون عناصر القائمة غير النشطة */
  --sidebar-active-bg: #1c1c1c;/* خلفية العنصر النشط في القائمة الداكنة */
  --sidebar-active-text: #ffffff;/* لون نص وأيقونة العنصر النشط */
  --primary-color: #fafafa;    /* لون أزرق نيون هادئ للعناصر الأساسية */
  --primary-text: #0a0a0a;     /* لون النصوص على الأزرار */
  --hover-bg: #1a1a1a;         /* خلفية الهوفر الداكنة الناعمة */
  --overlay-bg: rgba(0, 0, 0, 0.8);
}
/* تخصيص القائمة الجانبية والكاردات للوضع الليلي الفاخر */
[data-theme="dark"] .sidebar {
  background: var(--sidebar-bg) !important;
  border-left: 1px solid var(--border-color);
  box-shadow: none !important;
}
[data-theme="dark"] .card {
  background: var(--bg-card) !important;
  border: 1px solid var(--border-color) !important;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3) !important;
}
[data-theme="dark"] input,
[data-theme="dark"] select {
  background-color: var(--input-bg) !important;
  border-color: var(--border-color) !important;
  color: var(--text-main) !important;
}
[data-theme="dark"] .sidebar-menu li.active {
  background: var(--sidebar-active-bg) !important;
  color: var(--sidebar-active-text) !important;
}
[data-theme="dark"] .sidebar-menu li.active i {
  color: #ffffff !important;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: "Cairo", sans-serif; background-color: var(--bg-body); color: var(--text-main); min-height: 100vh; overflow: hidden; direction: rtl; transition: background-color 0.4s ease, color 0.4s ease; }
/* Login Overlay */
#login-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: var(--bg-body);
  background-image: radial-gradient(circle at 50% 50%, rgba(10, 10, 10, 0.04) 0%, transparent 70%);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9999;
}
.login-box { background: var(--bg-card); padding: 40px; border-radius: 20px; box-shadow: 0 15px 40px rgba(0,0,0,0.08); border: 1px solid var(--border-color); width: 100%; max-width: 400px; text-align: center; transition: background-color 0.4s ease, border-color 0.4s ease; }
.login-box img { width: 100px; height: 100px; border-radius: 50%; margin-bottom: 20px; border: 3px solid var(--primary-color); box-shadow: 0 5px 15px rgba(0,0,0,0.15); object-fit: cover; }
.login-box h2 { color: var(--text-main); font-size: 22px; font-weight: 700; margin-bottom: 5px; }
.login-box p { color: var(--text-muted); font-size: 14px; margin-bottom: 30px; font-weight: 600; }
.login-box input { width: 100%; padding: 15px; margin-bottom: 15px; border: 1.5px solid var(--border-color); border-radius: 12px; font-family: "Cairo"; font-size: 15px; text-align: left; background: var(--input-bg); color: var(--text-main); transition: 0.3s; }
.login-box input:focus { outline: none; border-color: var(--primary-color); box-shadow: 0 0 0 4px rgba(0,0,0,0.05); }
.password-wrapper { position: relative; width: 100%; }
.password-wrapper input { padding-right: 45px; }
.password-wrapper i { position: absolute; right: 15px; top: 18px; cursor: pointer; color: var(--text-muted); font-size: 16px; transition: 0.3s; }
.password-wrapper i:hover { color: var(--text-main); }
.login-box button { width: 100%; padding: 15px; background: var(--primary-color); color: var(--primary-text); border: none; border-radius: 12px; font-family: "Cairo"; font-size: 16px; font-weight: 700; cursor: pointer; transition: 0.3s; box-shadow: 0 10px 20px rgba(0,0,0,0.15); }
.login-box button:hover { opacity: 0.8; transform: translateY(-2px); }
.login-error { color: #dc2626; font-size: 14px; font-weight: 700; margin-top: 15px; display: none; }
.forgot-link { color: var(--text-muted); font-size: 13px; font-weight: 600; margin-top: 15px; display: inline-block; cursor: pointer; text-decoration: underline; transition: 0.3s; }
.forgot-link:hover { color: var(--text-main); }
/* Layout & Sidebar */
.dashboard-wrapper { display: none; height: 100vh; width: 100%; }
.sidebar { width: 260px; background: var(--sidebar-bg); color: #fff; display: flex; flex-direction: column; transition: width 0.3s ease, background-color 0.4s ease; z-index: 100; box-shadow: -4px 0 20px rgba(0,0,0,0.05); }
.sidebar.collapsed { width: 80px; }
.sidebar-header { padding: 30px 20px; display: flex; flex-direction: column; align-items: center; justify-content: center; border-bottom: 1px solid rgba(255,255,255,0.05); }
.avatar-container { position: relative; width: 100px; height: 100px; margin-bottom: 15px; cursor: pointer; }
.sidebar.collapsed .avatar-container { width: 45px; height: 45px; margin-bottom: 0; }
.sidebar-header img { width: 100%; height: 100%; border-radius: 50%; box-shadow: 0 4px 15px rgba(0,0,0,0.3); border: 2px solid #fff; object-fit: cover; transition: all 0.3s; }
.avatar-edit-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; border-radius: 50%; background: rgba(0,0,0,0.7); display: flex; flex-direction: column; justify-content: center; align-items: center; opacity: 0; transition: opacity 0.3s ease; color: #fff; font-size: 11px; font-weight: 700; text-align: center; gap: 6px; padding: 5px; }
.avatar-container:hover .avatar-edit-overlay { opacity: 1; }
.avatar-edit-overlay span:hover { color: #05cd99; }
.avatar-edit-overlay span.del:hover { color: #dc2626; }
.sidebar-header h2 { font-size: 16px; font-weight: 700; white-space: nowrap; transition: opacity 0.3s; color: #fff; text-align: center; }
.sidebar.collapsed .sidebar-header h2 { display: none; opacity: 0; }
.sidebar-menu { list-style: none; padding: 20px 15px; flex: 1; overflow-y: auto; }
.sidebar-menu li { display: flex; align-items: center; padding: 14px 15px; margin-bottom: 8px; border-radius: 12px; cursor: pointer; transition: all 0.3s ease; color: #94a3b8; }
.sidebar-menu li:hover { background: rgba(255,255,255,0.05); color: #fff; }
.sidebar-menu li.active { background: var(--primary-color); color: #fff; box-shadow: 0 10px 20px rgba(0,0,0,0.2); }
.sidebar-menu li i { font-size: 18px; min-width: 25px; text-align: center; }
.sidebar-menu li span { margin-right: 15px; font-weight: 600; font-size: 14px; white-space: nowrap; transition: opacity 0.3s; }
.sidebar-title { padding: 15px 15px 5px 15px; font-size: 11px; color: #64748b; text-transform: uppercase; letter-spacing: 1px; font-weight: 900; margin-top: 5px; pointer-events: none; }
/* تخصيص القائمة الجانبية لتطابق النمط النظيف الجديد */
.sidebar {
  background: var(--sidebar-bg) !important;
  color: var(--text-main) !important;
  border-left: 1px solid var(--border-color); /* خط فاصل خفيف جداً */
  box-shadow: none !important; /* إزالة الظلال القديمة لتصبح مسطحة واحترافية */
}
.sidebar-header {
  border-bottom: 1px solid var(--border-color);
}
.sidebar-header h2 {
  color: var(--text-main) !important;
}
.sidebar-menu li {
  color: var(--text-muted) !important;
  border-radius: 10px;
  margin: 4px 10px;
}
.sidebar-menu li:hover {
  background: var(--hover-bg) !important;
  color: var(--text-main) !important;
}
.sidebar-menu li.active {
  background: var(--sidebar-active-bg) !important;
  color: var(--sidebar-active-text) !important;
  box-shadow: none !important;
}
.sidebar-menu li.active i {
  color: var(--sidebar-active-text) !important;
}
.sidebar-title {
  color: #94a3b8 !important;
  font-size: 11px;
  letter-spacing: 0.5px;
}
.sidebar-toggle {
  border-top: 1px solid var(--border-color);
  color: var(--text-muted);
}
.sidebar-toggle:hover {
  background: var(--hover-bg);
  color: var(--text-main);
}
/* Collapsed Sidebar Fixes */
.sidebar.collapsed .sidebar-title { display: none !important; }
.sidebar.collapsed .sidebar-menu li { justify-content: center; padding: 14px 0; }
.sidebar.collapsed .sidebar-menu li span { display: none !important; opacity: 0; }
.sidebar.collapsed .sidebar-menu li i { margin: 0 !important; font-size: 20px; }
.sidebar-toggle { padding: 20px; text-align: center; cursor: pointer; border-top: 1px solid rgba(255,255,255,0.05); transition: 0.3s; color: #94a3b8; }
.sidebar-toggle:hover { color: #fff; background: rgba(255,255,255,0.05); }
.sidebar-toggle i { font-size: 18px; transition: transform 0.3s; }
.sidebar.collapsed .sidebar-toggle i { transform: rotate(180deg); }
/* Main Content */
.main-content { flex: 1; display: flex; flex-direction: column; overflow-y: auto; padding: 30px; position: relative; }
.topbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 30px; }
.topbar-title h1 { font-size: 24px; font-weight: 700; color: var(--text-main); transition: 0.4s ease; }
.topbar-title p { font-size: 14px; color: var(--text-muted); font-weight: 600; margin-top: 5px; }
.topbar-actions { display: flex; align-items: center; gap: 15px; }
.theme-toggle, .bell-icon { position: relative; cursor: pointer; color: var(--text-muted); font-size: 20px; padding: 10px; transition: 0.3s; display: flex; align-items: center; justify-content: center; border-radius: 50%; width: 40px; height: 40px; }
.theme-toggle:hover, .bell-icon:hover { color: var(--text-main); background: var(--hover-bg); }
.bell-icon .badge { position: absolute; top: 0px; right: 0px; background: #ef4444; color: #fff; font-size: 10px; font-weight: bold; width: 18px; height: 18px; border-radius: 50%; display: flex; justify-content: center; align-items: center; }
.notif-dropdown { position: absolute; top: 60px; left: 30px; background: var(--bg-card); width: 320px; border-radius: 12px; box-shadow: 0 10px 30px rgba(0,0,0,0.1); border: 1px solid var(--border-color); display: none; z-index: 1000; overflow: hidden; transition: 0.4s ease; }
.notif-dropdown.show { display: block; }
.notif-header { padding: 15px; border-bottom: 1px solid var(--border-color); font-weight: bold; font-size: 14px; background: var(--hover-bg); color: var(--text-main); }
.notif-list { max-height: 300px; overflow-y: auto; list-style: none; margin: 0; padding: 0; }
.notif-item { padding: 15px; border-bottom: 1px solid var(--border-color); font-size: 13px; color: var(--text-main); }
.notif-item:hover { background: var(--hover-bg); }
.notif-item span { display: block; color: var(--text-muted); font-size: 11px; margin-bottom: 5px; }
.notif-item button { background: #16a34a; color: #fff; border: none; padding: 5px 10px; border-radius: 6px; font-size: 11px; cursor: pointer; margin-top: 5px; font-family: "Cairo"; }
.logout-btn {
  background-color: #fceae9;
  color: #d32f2f;
  padding: 8px 16px;
  border-radius: 12px;
  font-weight: 800;
  font-size: 15px;
  cursor: pointer;
  transition: all 0.3s ease;
  border: none;
  font-family: "Cairo", sans-serif;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: none; /* إزالة الظل ليكون مسطحاً */
}
.logout-btn i { font-size: 18px; color: #d32f2f; }
.logout-btn:hover { background-color: #fad4d4; }
[data-theme="dark"] .logout-btn { background-color: rgba(220, 38, 38, 0.15); color: #ef4444; }
[data-theme="dark"] .logout-btn:hover { background-color: rgba(220, 38, 38, 0.25); }
[data-theme="dark"] .logout-btn i { color: #ef4444; }
/* UI Components */
.tab-content { display: none; animation: fadeIn 0.4s ease-in-out; }
.tab-content.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
.card { background: var(--bg-card); border-radius: 20px; padding: 30px; box-shadow: 0px 10px 30px rgba(0,0,0,0.03); margin-bottom: 25px; border: 1px solid var(--border-color); transition: background-color 0.4s ease, border-color 0.4s ease; }
.form-group { margin-bottom: 22px; position: relative; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; margin-bottom: 12px; }
label { display: block; font-weight: 700; color: var(--text-main); margin-bottom: 10px; font-size: 14px; transition: color 0.4s ease; }
input, select { width: 100%; padding: 15px 18px; border: 1px solid var(--border-color); border-radius: 12px; font-size: 15px; font-family: "Cairo", sans-serif; background: var(--input-bg); color: var(--text-main); transition: all 0.3s ease; }
input:focus, select:focus { outline: none; border-color: var(--primary-color); box-shadow: 0 0 0 4px rgba(0,0,0,0.05); }
.autocomplete-items { position: absolute; border: 1px solid var(--border-color); border-bottom: none; border-top: none; z-index: 99; top: 100%; left: 0; right: 0; background: var(--bg-card); border-radius: 0 0 12px 12px; box-shadow: 0 10px 25px rgba(0,0,0,0.1); max-height: 200px; overflow-y: auto; }
.autocomplete-items div { padding: 12px 15px; cursor: pointer; border-bottom: 1px solid var(--border-color); font-size: 14px; font-weight: 600; color: var(--text-main); display: flex; justify-content: space-between; align-items: center; }
.autocomplete-items div:hover { background-color: var(--hover-bg); }
.button-group { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 15px; margin-top: 35px; }
button { padding: 16px 20px; border: none; border-radius: 12px; font-weight: 700; cursor: pointer; font-size: 15px; font-family: "Cairo", sans-serif; transition: all 0.3s ease; }
.btn-primary { background: var(--primary-color); color: var(--primary-text); box-shadow: 0 10px 20px rgba(0,0,0,0.15); }
.btn-primary:hover { opacity: 0.8; transform: translateY(-2px); }
.btn-secondary { background: var(--hover-bg); color: var(--text-main); border: 1px solid var(--border-color); }
.btn-secondary:hover { opacity: 0.8; }
.btn-export { background: var(--primary-color); color: var(--primary-text); padding: 12px 20px; font-size: 14px; border-radius: 10px; display: inline-flex; align-items: center; gap: 8px; border: none; font-family: "Cairo", sans-serif; font-weight: 700; transition: 0.3s; cursor: pointer; }
.btn-export:hover { opacity: 0.8; transform: translateY(-2px); }
.btn-whatsapp { background: #25d366; color: white; padding: 14px 20px; font-size: 15px; border-radius: 12px; display: inline-flex; align-items: center; gap: 8px; text-decoration: none; font-weight: 700; width: 100%; justify-content: center; margin-top: 15px; border: none; font-family: "Cairo"; cursor: pointer; }
.alert { padding: 16px; border-radius: 12px; margin-bottom: 20px; display: none; font-size: 14px; font-weight: 700; line-height: 1.6; }
.alert.show { display: block; }
.alert-success { background: rgba(22, 163, 74, 0.1); color: #16a34a; border-right: 5px solid #16a34a; }
.alert-error { background: rgba(220, 38, 38, 0.1); color: #dc2626; border-right: 5px solid #dc2626; }
.search-row { display: grid; grid-template-columns: 1fr auto; gap: 15px; margin-bottom: 30px; align-items: end; }
.result-box { display: none; }
.result-box.show { display: block; }
/* 🌟 الشبكة الأكاديمية الافتراضية (3 أعمدة للديسكتوب) */
.result-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}
/* جعل الكروت الكبيرة (بدءاً من إدارة النظام المالي وحتى نهاية الصفحة) تأخذ العرض بالكامل */
.result-item.full-width,
.result-item.financial-card,
.qr-container {
  grid-column: 1 / -1 !important;
}
/* أزرار وحقول التعديل الفوري داخل كروت ملف الطالب */
.inline-edit-btn {
  background: var(--hover-bg);
  color: var(--text-main);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 3px 8px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: 0.2s;
  box-shadow: none;
}
.inline-edit-btn:hover {
  background: var(--primary-color);
  color: var(--primary-text);
  border-color: var(--primary-color);
}
.inline-edit-wrap {
  margin-top: 6px;
  width: 100%;
}
.result-item {
  background: var(--bg-card) !important;
  padding: 20px !important;
  border-radius: 14px !important;
  border: 1px solid var(--border-color) !important;
  box-shadow: 0 2px 8px rgba(0,0,0,0.02);
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 95px; /* توحيد وزيادة طفيفة في ارتفاع الكروت لتبدو أريح للعين */
  transition: border-color 0.2s;
}
.result-item:hover {
  border-color: var(--text-muted);
}
.result-item label {
  font-size: 11.5px;
  color: var(--text-muted);
  margin-bottom: 6px;
  font-weight: 700;
  text-transform: uppercase;
  display: block;
}
.result-item span {
  font-size: 15px;
  font-weight: 800;
  color: var(--text-main);
  display: block;
  word-break: break-word;
}
/* تنسيق حاوية الـ QR لتتوسط الشكل أسفل الـ 3 أعمدة */
.qr-container {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  padding: 30px;
  text-align: center;
  grid-column: 1 / -1 !important;
}
.qr-container img { width: 200px; height: 200px; border-radius: 12px; border: 2px solid var(--bg-card); padding: 8px; background: #fff; margin: 15px auto; box-shadow: 0 4px 15px rgba(0,0,0,0.05); display: block; }
.dashboard-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 20px; margin-bottom: 25px; }
.stat-card { background: var(--bg-card); border-radius: 20px; padding: 25px; text-align: right; box-shadow: 0px 10px 30px rgba(0,0,0,0.03); display: flex; flex-direction: column; justify-content: center; border: 1px solid var(--border-color); transition: 0.4s; }
.stat-card label { font-size: 13px; color: var(--text-muted); margin-bottom: 10px; font-weight: 700; display: block; }
.stat-card span { font-size: 24px; font-weight: 700; color: var(--text-main); }
.filter-panel { padding: 25px; border-radius: 20px; background: var(--bg-card); border: 1px solid var(--border-color); margin-bottom: 25px; }
.filter-grid-top { display: grid; grid-template-columns: repeat(5, 1fr); gap: 15px; margin-bottom: 15px; }
.filter-grid-bottom { display: grid; grid-template-columns: 1fr 2fr; gap: 15px; margin-bottom: 20px; }
.filter-group { background: var(--bg-card); padding: 15px; border-radius: 16px; border: 1px solid var(--border-color); box-shadow: 0 4px 15px rgba(0,0,0,0.01); }
.filter-sub-stat { background: var(--hover-bg); border: 1px solid var(--border-color); border-radius: 8px; padding: 10px; text-align: center; margin-top: 12px; font-size: 14px; font-weight: 700; color: var(--text-main); }
.table-container { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; text-align: center; margin-top: 0; background: var(--bg-card); }
th, td { padding: 12px; border-bottom: 1px solid var(--border-color); font-size: 14px; vertical-align: middle; color: var(--text-main); }
th { background: var(--hover-bg); font-weight: 700; font-size: 13px; border-bottom: 2px solid var(--border-color); white-space: nowrap; }
.grid-input { width: 100%; padding: 8px; border: 1px solid var(--border-color); border-radius: 8px; font-size: 13px; text-align: center; font-family: "Cairo"; background: var(--input-bg); transition: 0.3s; color: var(--text-main); }
.switch { position: relative; display: inline-block; width: 40px; height: 22px; margin: 0 auto; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background-color: var(--text-muted); transition: .4s; border-radius: 34px; }
.slider:before { position: absolute; content: ""; height: 16px; width: 16px; left: 3px; bottom: 3px; background-color: white; transition: .4s; border-radius: 50%; }
input:checked + .slider { background-color: #16a34a; }
input:checked + .slider:before { transform: translateX(18px); }
.perm-grid label {
  display: flex !important;
  align-items: center !important;
  gap: 12px !important;
  cursor: pointer;
  font-weight: 600;
  font-size: 14px;
  color: var(--text-main);
}
.perm-grid input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--primary-color);
  cursor: pointer;
  margin: 0 !important;
  padding: 0 !important;
  vertical-align: middle;
}
.perm-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: transparent; /* إزالة خلفية العنصر */
  padding: 8px 0;
  border: none; /* إزالة حدود العنصر الداخلي */
  box-shadow: none;
  transition: opacity 0.3s ease;
}
.perm-item:hover {
  transform: none;
  box-shadow: none;
  opacity: 0.7;
}
.perm-item span {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-main);
}
.modal-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: var(--overlay-bg); display: none; justify-content: center; align-items: center; z-index: 10000; }
.modal-content { background: var(--bg-card); padding: 30px; border-radius: 16px; width: 90%; max-width: 400px; text-align: center; border: 1px solid var(--border-color); }
@media (min-width: 993px) { .mobile-only { display: none !important; } }
#kioskModal { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: #0f172a; z-index: 99999; display: none; flex-direction: column; justify-content: center; align-items: center; color: #fff; text-align: center; padding: 20px; }
.close-kiosk { position: absolute; top: 10px; left: 15px; font-size: 32px; color: #94a3b8; cursor: pointer; transition: 0.3s; padding: 10px; }
.close-kiosk:hover { color: #dc2626; transform: scale(1.1); }
.spinner { border: 3px solid var(--border-color); border-top-color: var(--primary-color); border-radius: 50%; width: 24px; height: 24px; animation: spin 0.8s linear infinite; display: inline-block; vertical-align: middle; margin-left: 10px; }
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }
.loading { display: none; text-align: center; color: var(--text-muted); padding: 20px; font-size: 15px; font-weight: 700; }
.loading.show { display: block; }
/* Auto Login Screen */
#autoLoginOverlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background-color: var(--bg-body); display: flex; flex-direction: column; justify-content: center; align-items: center; z-index: 10000; }
#autoLoginOverlay h2 { color: var(--text-main); font-size: 20px; margin-top: 15px; }
@media (max-width: 992px) {
  /* 1. سحق القائمة الجانبية القديمة تماماً في الموبايل */
  .sidebar { display: none !important; }
  .main-content { padding: 15px; padding-bottom: 90px; } /* توفير مساحة للشريط السفلي */
  /* 2. هندسة الشريط السفلي الذكي */
  .mobile-bottom-nav {
    position: fixed; bottom: 0; left: 0; width: 100%; height: 75px;
    background: var(--bg-card); border-top: 1px solid var(--border-color);
    display: flex !important; justify-content: space-around; align-items: center;
    z-index: 9999; box-shadow: 0 -5px 25px rgba(0,0,0,0.08);
  }
  .mobile-bottom-nav .nav-item {
    flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
    color: var(--text-muted); padding: 8px 0; cursor: pointer; transition: 0.3s;
  }
  .mobile-bottom-nav .nav-item.active, .mobile-bottom-nav .nav-item:hover { color: var(--primary-color); }
  .mobile-bottom-nav .nav-item i { font-size: 22px; margin-bottom: 6px; }
  .mobile-bottom-nav .nav-item span { font-size: 11px; font-weight: 800; }
  /* 3. القائمة المنبثقة الإدارية (More Menu) */
  .mobile-more-menu {
    position: fixed; bottom: 85px; left: 15px; right: 15px;
    background: var(--bg-card); border: 1px solid var(--border-color);
    border-radius: 16px; padding: 15px; z-index: 9998;
    box-shadow: 0 15px 40px rgba(0,0,0,0.2); display: none; flex-direction: column; gap: 5px;
    transform: translateY(20px); opacity: 0; transition: all 0.3s ease;
  }
  .mobile-more-menu.show { display: flex; transform: translateY(0); opacity: 1; }
  .more-item { display: flex; align-items: center; gap: 15px; padding: 12px 15px; border-radius: 12px; color: var(--text-main); font-weight: 700; font-size: 15px; transition: 0.3s; }
  .more-item:hover { background: var(--hover-bg); color: var(--primary-color); }
  .more-item i { font-size: 20px; width: 25px; text-align: center; color: var(--text-muted); }
  .more-item:hover i { color: var(--primary-color); }
  /* إصلاحات عامة للموبايل - تم إزالة result-grid من هنا لكي لا يتحول لعمود واحد */
  .form-row, .search-row, .dashboard-grid, .filter-grid-top, .filter-grid-bottom { grid-template-columns: 1fr; }
  /* 🌟 إجبار الشبكة على عمودين في الموبايل من أول الملف حتى خانة حالة آخر حصة */
  .result-grid { grid-template-columns: repeat(2, 1fr) !important; gap: 10px !important; }
  .result-grid > .result-item:not(.full-width):not(.financial-card) { grid-column: span 1 !important; min-width: 0; padding: 14px !important; }
  /* 🌟 بداية من خانة إدارة النظام المالي وقيمة الاشتراك حتى نهاية الصفحة يظهر كعمود واحد كامل */
  .result-item.full-width, .result-item[style*="span 3"], .qr-container, .financial-card { grid-column: 1 / -1 !important; width: 100% !important; }
  .financial-controls { grid-template-columns: 1fr !important; }
  .topbar-title h1 { font-size: 18px; }
  .topbar-actions { gap: 10px; }
}
.theme-toggle, .bell-icon {
  position: relative;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 18px;
  background: var(--hover-bg);
  display: inline-flex; /* تم تغييرها من flex لضمان التوسيط الدقيق */
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  width: 42px;
  height: 42px;
  border: 1px solid var(--border-color);
  transition: all 0.3s ease;
  line-height: 1; /* منع أي تباعد خفي للنص أو الأيقونة */
}
/* ضمان أن الأيقونة نفسها تتوسط الإطار تماماً بغض النظر عن الشارة */
.theme-toggle i, .bell-icon i {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
}
@media (max-width: 768px) {
    /* جعل الهيدر ثابتاً أثناء الـ scrolling */
    header, .main-header, .top-header-bar {
        position: sticky;
        top: 0;
        z-index: 1000;
        background: var(--bg-card);
        box-shadow: 0 4px 10px rgba(0,0,0,0.05);
}
}
/* =========================================================
   Minimal Monochrome System — أبيض وأسود وتدرجات هادئة
   ========================================================= */
.card, .stat-card, .filter-panel { border-radius: 16px; box-shadow: 0 1px 2px rgba(10,10,10,0.03); }
[data-theme="dark"] .card { box-shadow: none !important; }
.btn-primary { box-shadow: none; }
.btn-primary:hover, .login-box button:hover { transform: none; opacity: 0.88; }
.sidebar-menu li.active { font-weight: 800; }
.sidebar-menu li.active span { font-weight: 800; }
.sidebar-header img { border: 1px solid var(--border-color); box-shadow: none; }
.alert-success { border-right-width: 3px; }
.alert-error { border-right-width: 3px; }
.mn-page { display: flex; flex-direction: column; gap: 16px; width: 100%; max-width: 95%; margin: 0 auto; }
.mn-page.narrow { width: 90%; max-width: 90%; margin: 0 auto; }
.mn-card { background: var(--bg-card); border: 1px solid var(--border-color); border-radius: 16px; padding: 22px 24px; box-shadow: 0 1px 2px rgba(10,10,10,0.03); }
[data-theme="dark"] .mn-card { box-shadow: none; }
.mn-eyebrow { font-size: 12px; font-weight: 700; color: var(--text-muted); margin: 0 0 6px 0; letter-spacing: 0.01em; }
.mn-title { font-size: 24px; font-weight: 800; margin: 0; color: var(--text-main); letter-spacing: -0.01em; line-height: 1.35; }
.mn-sub { font-size: 13.5px; font-weight: 600; color: var(--text-muted); line-height: 1.9; margin: 8px 0 0 0; }
.mn-h4 { font-size: 14.5px; font-weight: 800; color: var(--text-main); margin: 0; }
.mn-muted { color: var(--text-muted); }
.mn-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 16px; margin: 0; border-radius: 10px; font-size: 13px; font-weight: 700; font-family: inherit; border: 1px solid var(--border-color); background: var(--bg-card); color: var(--text-main); cursor: pointer; text-decoration: none; transition: background 0.2s, border-color 0.2s, opacity 0.2s; box-shadow: none; }
.mn-btn:hover { background: var(--hover-bg); border-color: var(--text-muted); }
.mn-btn.dark { background: var(--primary-color); color: var(--primary-text); border-color: var(--primary-color); }
.mn-btn.dark:hover { opacity: 0.88; background: var(--primary-color); }
.mn-btn.light-on-dark { background: #ffffff; color: #0a0a0a; border-color: #ffffff; }
.mn-btn.ghost-on-dark { background: transparent; color: #ffffff; border-color: rgba(255,255,255,0.28); }
.mn-btn.ghost-on-dark:hover { background: rgba(255,255,255,0.08); border-color: rgba(255,255,255,0.5); }
.mn-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.mn-icon-btn { width: 34px; height: 34px; border-radius: 9px; display: inline-flex; align-items: center; justify-content: center; border: 1px solid var(--border-color); background: var(--bg-card); color: var(--text-main); text-decoration: none; font-size: 14px; cursor: pointer; padding: 0; margin: 0; transition: background 0.2s; }
.mn-icon-btn:hover { background: var(--hover-bg); }
.mn-pill { display: inline-flex; align-items: center; gap: 6px; padding: 4px 11px; border-radius: 20px; font-size: 11.5px; font-weight: 800; background: var(--hover-bg); color: var(--text-muted); border: 1px solid var(--border-color); }
.mn-pill.solid { background: var(--primary-color); color: var(--primary-text); border-color: var(--primary-color); }
/* الرئيسية */
.mn-hero { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 18px; padding: 26px 28px; border-radius: 18px; border: 1px solid var(--border-color); background: linear-gradient(180deg, var(--bg-card) 0%, var(--hover-bg) 100%); }
.mn-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.mn-kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.mn-kpi { padding: 18px 20px; border-radius: 16px; border: 1px solid var(--border-color); background: linear-gradient(180deg, var(--bg-card) 0%, var(--hover-bg) 140%); }
.mn-kpi-label { display: flex; justify-content: space-between; align-items: center; font-size: 12.5px; font-weight: 700; color: var(--text-muted); }
.mn-kpi-label i { font-size: 13px; opacity: 0.7; }
.mn-kpi-value { font-size: 28px; font-weight: 800; line-height: 1.2; margin-top: 12px; color: var(--text-main); font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }
.mn-kpi-value small { font-size: 13px; font-weight: 700; color: var(--text-muted); margin-right: 4px; }
.mn-kpi-foot { font-size: 12px; font-weight: 600; color: var(--text-muted); margin-top: 6px; min-height: 18px; }
.mn-bar { height: 4px; background: var(--border-color); border-radius: 4px; overflow: hidden; margin-top: 12px; }
.mn-bar > span { display: block; height: 100%; width: 0; border-radius: 4px; background: linear-gradient(90deg, #0a0a0a, #525252); transition: width 0.7s ease; }
[data-theme="dark"] .mn-bar > span { background: linear-gradient(90deg, #fafafa, #a3a3a3); }
.mn-grid-2 { display: grid; grid-template-columns: 1.5fr 1fr; gap: 14px; }
.mn-grid-eq { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.mn-card-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 14px; }
.mn-link { background: none; border: none; padding: 0; margin: 0; font-family: inherit; font-size: 12.5px; font-weight: 800; color: var(--text-muted); cursor: pointer; display: inline-flex; align-items: center; gap: 6px; box-shadow: none; }
.mn-link:hover { color: var(--text-main); }
.mn-stats3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--border-color); }
.mn-stats3 div span { display: block; font-size: 11.5px; font-weight: 700; color: var(--text-muted); }
.mn-stats3 div b { display: block; margin-top: 4px; font-size: 15px; font-weight: 800; color: var(--text-main); font-variant-numeric: tabular-nums; }
.mn-row { display: flex; justify-content: space-between; align-items: center; gap: 14px; padding: 13px 0; border-bottom: 1px solid var(--border-color); }
.mn-row:last-child { border-bottom: none; padding-bottom: 0; }
.mn-row:first-child { padding-top: 0; }
.mn-row-main { display: flex; align-items: center; gap: 12px; min-width: 0; flex: 1; }
.mn-row-text { min-width: 0; }
.mn-row-title { font-size: 13.5px; font-weight: 800; color: var(--text-main); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mn-row-sub { font-size: 12px; font-weight: 600; color: var(--text-muted); margin-top: 2px; line-height: 1.6; }
.mn-row-end { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.mn-avatar { width: 36px; height: 36px; border-radius: 50%; flex-shrink: 0; background: var(--hover-bg); border: 1px solid var(--border-color); display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 800; color: var(--text-main); }
.mn-amount { font-size: 14px; font-weight: 800; color: #b91c1c; font-variant-numeric: tabular-nums; white-space: nowrap; }
[data-theme="dark"] .mn-amount { color: #f87171; }
.mn-empty { padding: 30px 10px; text-align: center; color: var(--text-muted); font-size: 13px; font-weight: 700; line-height: 1.9; }
.mn-empty i { display: block; font-size: 20px; margin-bottom: 10px; opacity: 0.5; }
/* الإعدادات */
.mn-field { margin-bottom: 14px; position: relative; }
.mn-field label { font-size: 12.5px; font-weight: 700; color: var(--text-muted); margin-bottom: 7px; }
.mn-field input { padding: 12px 14px; border-radius: 10px; font-size: 14px; background: var(--input-bg); }
.mn-field input[readonly] { color: var(--text-muted); cursor: not-allowed; }
.mn-field .mn-eye { position: absolute; right: 14px; bottom: 15px; color: var(--text-muted); cursor: pointer; font-size: 14px; }
.mn-field input.has-eye { padding-right: 40px; font-family: inherit; }
.mn-fields-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.mn-fields-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 16px; }
.mn-card-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; margin-top: 4px; }
.mn-setting { display: flex; justify-content: space-between; align-items: center; gap: 18px; padding: 16px 0; border-bottom: 1px solid var(--border-color); }
.mn-setting:last-child { border-bottom: none; padding-bottom: 0; }
.mn-card-head + .mn-setting, .mn-card-head + .mn-kv { padding-top: 0; }
.mn-setting h5 { margin: 0; font-size: 14px; font-weight: 800; color: var(--text-main); }
.mn-setting p { margin: 4px 0 0 0; font-size: 12.5px; font-weight: 600; color: var(--text-muted); line-height: 1.8; }
.mn-kv { display: flex; justify-content: space-between; align-items: center; padding: 13px 0; border-bottom: 1px solid var(--border-color); font-size: 13.5px; }
.mn-card-head + .mn-kv { border-top: none; }
.mn-kv span:first-child { color: var(--text-muted); font-weight: 700; }
.mn-kv span:last-child { color: var(--text-main); font-weight: 800; }
/* الباقات */
.mn-notice { background: var(--hover-bg); border: 1px solid var(--border-color); color: var(--text-main); padding: 14px 18px; border-radius: 12px; font-size: 13.5px; font-weight: 700; line-height: 1.8; }
.mn-plan-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; padding: 22px 26px; border-radius: 18px; background: linear-gradient(135deg, #0a0a0a 0%, #2a2a2a 100%); color: #ffffff; border: none; }
.mn-plan-head .mn-eyebrow { color: rgba(255,255,255,0.6); }
.mn-plan-head h2 { margin: 0; font-size: 24px; font-weight: 800; color: #ffffff; }
.mn-plans { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
@media (max-width: 1280px) { .mn-plans { grid-template-columns: repeat(2, 1fr); } }
.mn-plan { display: flex; flex-direction: column; padding: 24px; border-radius: 16px; border: 1px solid var(--border-color); background: var(--bg-card); transition: border-color 0.2s, opacity 0.2s; }
.mn-plan.is-current { border: 1.5px solid var(--text-main); }
.mn-plan.is-next { border: 1px dashed var(--text-muted); }
.mn-plan.is-included { opacity: 0.62; }
.mn-plan-slot { min-height: 28px; margin-bottom: 8px; }
.mn-plan h3 { margin: 0 0 8px 0; font-size: 19px; font-weight: 800; color: var(--text-main); }
.mn-plan p.desc { margin: 0 0 18px 0; font-size: 13px; font-weight: 600; color: var(--text-muted); line-height: 1.8; }
.mn-price { margin-bottom: 20px; }
.mn-price b { font-size: 30px; font-weight: 800; color: var(--text-main); font-variant-numeric: tabular-nums; }
.mn-price span { font-size: 13px; font-weight: 700; color: var(--text-muted); margin-right: 4px; }
.mn-plan ul { list-style: none; margin: 0 0 24px 0; padding: 0; font-size: 13.5px; font-weight: 700; color: var(--text-main); line-height: 2.1; }
.mn-plan ul li i { margin-left: 9px; font-size: 12px; }
.mn-plan ul li.off { color: var(--text-muted); text-decoration: line-through; }
.mn-plan .mn-btn { margin-top: auto; padding: 13px; }
.mn-ent-banner { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 20px; padding: 28px 30px; border-radius: 18px; background: linear-gradient(135deg, #0a0a0a 0%, #262626 100%); color: #ffffff; border: 1px solid #0a0a0a; }
.mn-ent-banner .mn-pill { background: rgba(255,255,255,0.12); color: #ffffff; border-color: rgba(255,255,255,0.25); }
.mn-ent-banner.is-next { box-shadow: 0 0 0 1.5px var(--text-muted); }
.mn-ent-banner h3 { margin: 0 0 8px 0; font-size: 20px; font-weight: 800; color: #ffffff; }
.mn-ent-banner p { margin: 0; font-size: 13.5px; font-weight: 600; color: rgba(255,255,255,0.65); line-height: 1.9; max-width: 640px; }
.mn-invite { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 14px; padding: 18px 22px; border-radius: 14px; border: 1px solid var(--border-color); background: linear-gradient(180deg, var(--bg-card) 0%, var(--hover-bg) 100%); }
.mn-invite b { display: block; font-size: 15px; font-weight: 800; color: var(--text-main); margin-bottom: 4px; }
.mn-invite span { font-size: 13px; font-weight: 600; color: var(--text-muted); line-height: 1.8; }
.mn-ent-hero { position: relative; overflow: hidden; padding: 34px 34px 30px; border-radius: 20px; color: #ffffff; background: linear-gradient(135deg, #050505 0%, #1c1c1c 55%, #3a3a3a 100%); }
.mn-ent-hero::after { content: ""; position: absolute; top: -90px; left: -90px; width: 260px; height: 260px; border-radius: 50%; background: radial-gradient(circle, rgba(255,255,255,0.10) 0%, rgba(255,255,255,0) 70%); pointer-events: none; }
.mn-ent-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 26px; position: relative; z-index: 1; }
.mn-ent-tag { font-size: 11.5px; font-weight: 800; letter-spacing: 0.22em; color: rgba(255,255,255,0.7); direction: ltr; }
.mn-ent-status { display: inline-flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 800; color: #ffffff; padding: 5px 12px; border-radius: 20px; border: 1px solid rgba(255,255,255,0.22); }
.mn-ent-status i { width: 7px; height: 7px; border-radius: 50%; background: #ffffff; display: inline-block; }
.mn-ent-hero h2 { margin: 0; font-size: 30px; font-weight: 800; color: #ffffff; letter-spacing: -0.01em; position: relative; z-index: 1; }
.mn-ent-hero p { margin: 10px 0 0 0; font-size: 14px; font-weight: 600; color: rgba(255,255,255,0.62); line-height: 1.9; max-width: 560px; position: relative; z-index: 1; }
.mn-ent-meta { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-top: 30px; padding-top: 22px; border-top: 1px solid rgba(255,255,255,0.14); position: relative; z-index: 1; }
.mn-ent-meta span { display: block; font-size: 12px; font-weight: 700; color: rgba(255,255,255,0.55); }
.mn-ent-meta b { display: block; margin-top: 6px; font-size: 18px; font-weight: 800; color: #ffffff; font-variant-numeric: tabular-nums; }
.mn-checklist { list-style: none; margin: 14px 0 0 0; padding: 0; }
.mn-checklist li { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--border-color); font-size: 13.5px; font-weight: 700; color: var(--text-main); }
.mn-checklist li:last-child { border-bottom: none; }
.mn-checklist li i { width: 22px; height: 22px; border-radius: 50%; border: 1px solid var(--border-color); display: inline-flex; align-items: center; justify-content: center; font-size: 10px; background: var(--hover-bg); flex-shrink: 0; }
@media (max-width: 992px) {
  .mn-kpis { grid-template-columns: repeat(2, 1fr); }
  .mn-grid-2, .mn-grid-eq, .mn-plans { grid-template-columns: 1fr; }
  .mn-hero { padding: 20px; }
  .mn-title { font-size: 20px; }
  .mn-ent-hero { padding: 26px 22px 22px; }
  .mn-ent-hero h2 { font-size: 24px; }
}
@media (max-width: 600px) {
  .mn-fields-2, .mn-fields-3 { grid-template-columns: 1fr; }
  .mn-kpis { gap: 10px; }
  .mn-kpi { padding: 14px 16px; }
  .mn-kpi-value { font-size: 22px; }
  .mn-actions { width: 100%; }
  .mn-actions .mn-btn { flex: 1 1 calc(50% - 8px); }
  .mn-ent-meta { grid-template-columns: 1fr 1fr; }
  .mn-card { padding: 18px; }
  .mn-setting { flex-direction: column; align-items: stretch; }
}
@media (max-width: 768px) {
        .mobile-hidden-debtor {
            display: none !important; /* يعرض أول 3 فقط في الموبايل */
        }
    }
    @media (min-width: 769px) {
        .desktop-hidden-debtor {
            display: none !important; /* يعرض أول 5 فقط في سطح المكتب */
        }
    }
/* حماية مكونات التصميم الجديد من قاعدة الموبايل القديمة (.tab-content > div:first-child a/button {width:100%}) */
@media (max-width: 992px) {
  .tab-content > div:first-child .mn-icon-btn { width: 34px !important; height: 34px !important; }
  .tab-content > div:first-child .mn-link { width: auto !important; }
  .tab-content > div:first-child .mn-row-end a, .tab-content > div:first-child .mn-row-end button { width: 34px !important; }
}
/* 🔒 طبقة الحماية والتغميم القابلة للتحكم (Paywall Blur Overlay) */
    .paywall-locked-wrapper {
        position: relative;
        overflow: hidden;
        border-radius: 16px;
        min-height: 255px;
    }
    .paywall-locked-content {
        /* يمكنك التحكم في درجة الضبابية (Blur) من هنا (مثلاً 2px خفيف، أو 4px متوسط) */
        filter: blur(1px) !important;
        pointer-events: none;
        user-select: none;
        /* يمكنك التحكم في درجة وضوح المحتوى تحته من هنا (0.7 يعني واضح ومقروء قليلاً) */
        opacity: 0.90 !important;
        transition: 0.3s;
    }
    .paywall-overlay-card {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        /* تحكم في شفافية خلفية البطاقة لتكون ناعمة وغير فاقعة */
        background: rgba(var(--bg-card-rgb, 255, 255, 255), 0.65);
        backdrop-filter: blur(1px);
        z-index: 10;
        text-align: center;
        padding: 20px;
    }
    [data-theme="dark"] .paywall-overlay-card {
        background: rgba(17, 17, 17, 0.7);
    }
    /* 🔒 إصلاح جذري لموضع زر الإغلاق في الباب السريع لضمان عدم خروجه من الإطار */
    #kioskContent {
        position: relative !important;
        transform: scale(1) !important; /* إنشاء سياق تكديس لحبس الزر بالداخل */
    }
    #kioskContent > button[onclick*="closeKioskMode"] {
        position: absolute !important;
        top: 20px !important;
        left: 20px !important;
        right: auto !important;
        margin: 0 !important;
        z-index: 100 !important;
        display: flex !important; /* حماية الشكل الدائري والتوسيط */
    }
    @media (max-width: 992px) {
    .mobile-hidden-section {
        display: none !important;
    }
}
/* ==========================================
   تنسيقات البطاقة المالية (الجديدة)
   ========================================== */
.financial-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    padding: 20px;
    margin-top: 16px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.02);
}
.financial-card-header {
    font-size: 13px;
    font-weight: 800;
    color: var(--text-muted);
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
    text-transform: uppercase;
}
.financial-controls {
    display: grid;
    grid-template-columns: 1fr 1fr; /* عمودين جنباً إلى جنب */
    gap: 12px;
    margin-bottom: 16px;
}
.financial-controls label {
    font-size: 11.5px;
    color: var(--text-muted);
    margin-bottom: 6px;
    font-weight: 700;
}
.btn-save-full {
    width: 100%;
    background: var(--primary-color);
    color: var(--primary-text);
    padding: 14px;
    border: none;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 800;
    font-family: "Cairo", sans-serif;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    transition: 0.3s;
}
.btn-save-full:hover {
    opacity: 0.8;
    transform: translateY(-2px);
}
/* حماية للشاشات الصغيرة جداً لتصبح عموداً واحداً */
@media (max-width: 380px) {
    .financial-controls { grid-template-columns: 1fr; }
}
/* ==========================================
   تحسينات الأداء البصري وسلاسة التمرير (GPU & Layout Containment)
   ========================================== */
.tab-content:not(.active) {
    display: none !important;
}
.table-container, .mvp-table-container {
    contain: layout style;
    -webkit-overflow-scrolling: touch;
}
.mn-kpi, .stat-card, .result-item {
    contain: layout paint;
}
/* ==========================================
   تنسيقات الدرجة المرنة للامتحانات وترتيب غياب المجموعات
   ========================================== */
.exam-max-chips {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    flex-wrap: wrap;
}
.exam-max-chip {
    padding: 4px 10px !important;
    font-size: 11.5px !important;
    font-weight: 800 !important;
    border-radius: 8px !important;
    background: var(--hover-bg);
    color: var(--text-muted);
    border: 1px solid var(--border-color);
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: none !important;
}
.exam-max-chip:hover {
    color: var(--text-main);
    border-color: var(--text-muted);
}
.exam-max-chip.active {
    background: var(--primary-color) !important;
    color: var(--primary-text) !important;
    border-color: var(--primary-color) !important;
}
.exam-score-dual-box {
    display: flex;
    align-items: center;
    gap: 8px;
}
.exam-score-sep {
    font-size: 20px;
    font-weight: 900;
    color: var(--text-muted);
    user-select: none;
}
.bulk-exam-max-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    background: var(--hover-bg);
    border: 1px solid var(--border-color);
    padding: 12px 16px;
    border-radius: 12px;
    margin-bottom: 14px;
}
@media (max-width: 768px) {
    .bulk-exam-max-bar {
        flex-direction: column;
        align-items: stretch;
    }
    .bulk-exam-max-bar > div {
        justify-content: space-between;
    }
}
/* ==========================================================================
   تحديثات الموبايل والتمرير الذكي والمصحح البصري (OMR) وتجميد الطلاب
   ========================================================================== */
/* 1. تنسيق شريط الملخص اليومي في الرئيسية والقيادة المالية (سطح المكتب والموبايل) */
.daily-summary-bar {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 10px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    padding: 12px 20px;
    border-radius: 14px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}
.daily-summary-bar .ds-title {
    font-size: 13.5px;
    font-weight: 800;
    color: var(--text-main);
    margin-left: auto;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.daily-summary-bar .ds-date {
    font-size: 12.5px;
    font-weight: 700;
    color: var(--text-muted);
}
.daily-summary-bar .ds-select-wrap {
    display: flex;
    align-items: center;
    background: var(--input-bg);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    overflow: hidden;
    height: 38px;
}
.daily-summary-bar .ds-select-wrap select {
    background: transparent !important;
    border: none !important;
    color: var(--text-main);
    font-weight: 700;
    font-family: 'Cairo', sans-serif;
    font-size: 12.5px;
    outline: none;
    cursor: pointer;
    padding: 0 12px;
    height: 100%;
}
.daily-summary-bar .ds-btn {
    background: var(--text-main);
    color: var(--bg-card);
    border: none;
    height: 38px;
    padding: 0 16px;
    border-radius: 10px;
    font-weight: 800;
    font-size: 12.5px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    cursor: pointer;
}
@media (max-width: 768px) {
    #homeDailySummaryBar,
    #finDailySummaryBar,
    .daily-summary-bar {
        display: grid !important;
        grid-template-columns: 1fr auto !important;
        gap: 10px !important;
        padding: 14px 16px !important;
        align-items: center !important;
    }
    #homeDailySummaryBar .ds-title,
    #finDailySummaryBar .ds-title {
        grid-column: 1 / 2 !important;
        margin: 0 !important;
        text-align: right !important;
        justify-self: start !important;
    }
    #homeDailySummaryBar .ds-date,
    #finDailySummaryBar .ds-date {
        grid-column: 2 / 3 !important;
        text-align: left !important;
        justify-self: end !important;
        font-size: 12px !important;
    }
    #homeDailySummaryBar .ds-select-wrap,
    #finDailySummaryBar .ds-select-wrap {
        grid-column: 1 / -1 !important;
        width: 100% !important;
        height: 42px !important;
    }
    #homeDailySummaryBar .ds-select-wrap select,
    #finDailySummaryBar .ds-select-wrap select {
        width: 100% !important;
        text-align: right !important;
    }
    #homeDailySummaryBar .ds-btn,
    #finDailySummaryBar .ds-btn,
    #btnHomeDailyPdf,
    #btnFinDailyPdf {
        grid-column: 1 / -1 !important;
        width: 100% !important;
        height: 44px !important;
        justify-content: center !important;
        font-size: 13.5px !important;
    }
    /* 2. إصلاح نافذة الباب السريع (Kiosk) في الموبايل لمنع اقتصاص التفاصيل بالأسفل */
    #kioskModal {
        overflow-y: auto !important;
        align-items: flex-start !important;
        padding: 10px !important;
    }
    #kioskContent {
        max-height: calc(100vh - 20px) !important;
        overflow-y: auto !important;
        padding: 22px 16px !important;
        border-radius: 22px !important;
        margin: auto 0 !important;
    }
    #kioskContent h2 {
        font-size: 20px !important;
        margin-bottom: 10px !important;
    }
    #kioskContent select,
    #kioskContent input {
        padding: 13px 14px !important;
        font-size: 14.5px !important;
    }
    #kioskSubmitBtn {
        padding: 15px !important;
        font-size: 16px !important;
    }
    #kioskFeedback {
        margin-top: 14px !important;
        min-height: 48px !important;
        font-size: 14px !important;
    }
}
/* 3. حاويات التمرير الذكي المحددة بعدد الصفوف */
.scroll-box-3-rows {
    max-height: 225px;
    overflow-y: auto;
}
.scroll-box-4-rows {
    max-height: 295px;
    overflow-y: auto;
}
.scroll-box-7-rows {
    max-height: 445px;
    overflow-y: auto;
}
.scroll-box-home-churn-3 {
    max-height: 225px;
    overflow-y: auto;
    padding-left: 4px;
}
/* 4. شارة وتنسيق تجميد ملف الطالب المنقطع (ترك الدرس) */
.frozen-student-banner {
    grid-column: 1 / -1 !important;
    background: rgba(220, 38, 38, 0.08);
    border: 1.5px solid rgba(220, 38, 38, 0.35);
    color: #dc2626;
    padding: 16px 20px;
    border-radius: 14px;
    font-weight: 800;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}
.frozen-badge-pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: rgba(220, 38, 38, 0.12);
    color: #dc2626;
    border: 1px solid rgba(220, 38, 38, 0.3);
    padding: 2px 8px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 800;
}
/* 5. تنسيقات المصحح البصري للبابل شيت (Half-Page OMR Scanner & Generator) */
.omr-action-bar {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
    background: linear-gradient(135deg, rgba(22, 163, 74, 0.08) 0%, rgba(15, 23, 42, 0.04) 100%);
    border: 1px solid rgba(22, 163, 74, 0.3);
    padding: 12px 16px;
    border-radius: 14px;
    margin-bottom: 18px;
    justify-content: space-between;
}
.omr-key-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(155px, 1fr));
    gap: 10px;
    max-height: 250px;
    overflow-y: auto;
    padding: 10px;
    background: var(--hover-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
}
.omr-q-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--bg-card);
    padding: 6px 10px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    font-size: 12.5px;
    font-weight: 800;
}
.omr-bubbles-select {
    display: flex;
    gap: 4px;
}
.omr-bubble-opt {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 1.5px solid var(--border-color);
    background: var(--input-bg);
    color: var(--text-main);
    font-size: 11px;
    font-weight: 900;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 0;
    transition: 0.15s;
}
.omr-bubble-opt.selected {
    background: #16a34a;
    color: #fff;
    border-color: #16a34a;
}
.omr-camera-stage {
    position: relative;
    width: 100%;
    max-width: 440px;
    margin: 0 auto;
    border-radius: 16px;
    overflow: hidden;
    background: #000;
    border: 2px solid var(--border-color);
    aspect-ratio: 4 / 3;
}
.omr-camera-stage video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.omr-fiducial-guide {
    position: absolute;
    inset: 12%;
    border: 2px dashed rgba(34, 197, 94, 0.85);
    border-radius: 8px;
    pointer-events: none;
    box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.38);
}
.omr-fiducial-corner {
    position: absolute;
    width: 18px;
    height: 18px;
    border: 3px solid #22c55e;
}
.omr-fiducial-corner.tl { top: -2px; left: -2px; border-right: none; border-bottom: none; }
.omr-fiducial-corner.tr { top: -2px; right: -2px; border-left: none; border-bottom: none; }
.omr-fiducial-corner.bl { bottom: -2px; left: -2px; border-right: none; border-top: none; }
.omr-fiducial-corner.br { bottom: -2px; right: -2px; border-left: none; border-top: none; }
/* ==========================================================================
   تحديثات الرؤية المتجاوبة، تنبيه المديونية الفوري بالكيوسك، البابل شيت، والتقارير المالية
   ========================================================================== */
/* إخفاء دائم لحقول رفع الملفات المخفية حتى لا تظهر بالخطأ في أي شاشة */
input[type="file"].hidden-file-input {
    display: none !important;
    visibility: hidden !important;
    width: 0 !important;
    height: 0 !important;
    position: absolute !important;
    pointer-events: none !important;
}
/* إظهار أزرار مسح الكاميرا والـ QR في الموبايل والتابلت والآيباد فقط وإخفاؤها تماماً في الديسكتوب */
@media (min-width: 1025px) {
    .mobile-tablet-only-bar,
    #kioskQrScanWrap {
        display: none !important;
    }
}
@media (max-width: 1024px) {
    .mobile-tablet-only-bar {
        display: flex !important;
    }
    #kioskQrScanWrap {
        display: flex !important;
    }
}
/* صندوق تنبيه المديونية الأصفر الفوري في الباب السريع (فوق زر تأكيد الحضور مباشرة) */
.kiosk-pre-debt-alert {
    display: none;
    background: linear-gradient(135deg, #FEF08A 0%, #FDE047 100%);
    color: #713F12;
    border: 2px solid #EAB308;
    border-radius: 16px;
    padding: 18px 22px;
    margin: 26px 0 28px 0 !important;
    font-family: 'Cairo', sans-serif;
    font-size: 14.5px;
    font-weight: 800;
    line-height: 1.85;
    text-align: right;
    box-shadow: 0 10px 26px rgba(234, 179, 8, 0.25);
    position: relative;
    z-index: 5;
    clear: both;
    animation: fadeIn 0.25s ease-out;
}
@media (max-width: 768px) {
    .kiosk-pre-debt-alert {
        margin: 22px 0 24px 0 !important;
        padding: 15px 16px !important;
        font-size: 13.5px !important;
        line-height: 1.75 !important;
    }
}
[data-theme="dark"] .kiosk-pre-debt-alert {
    background: linear-gradient(135deg, rgba(250, 204, 21, 0.18) 0%, rgba(234, 179, 8, 0.26) 100%);
    color: #FDE047;
    border-color: #EAB308;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
}
.kiosk-pre-debt-alert .debt-alert-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 6px;
}
.kiosk-pre-debt-alert .debt-amount-pill {
    background: #CA8A04;
    color: #FFFFFF;
    padding: 4px 12px;
    border-radius: 999px;
    font-size: 14px;
    font-weight: 900;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
[data-theme="dark"] .kiosk-pre-debt-alert .debt-amount-pill {
    background: #FACC15;
    color: #0F172A;
}
/* تحسين التباعد والتجاوب في نافذة البابل شيت والتصحيح التلقائي (OMR) */
.omr-key-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(195px, 1fr)) !important;
    gap: 12px !important;
    max-height: 270px;
    overflow-y: auto;
    padding: 14px !important;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 14px;
}
.omr-key-item,
.omr-q-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px !important;
    background: var(--hover-bg);
    padding: 10px 14px !important;
    border-radius: 10px !important;
    border: 1px solid var(--border-color);
    font-size: 13.5px !important;
    font-weight: 800;
}
.omr-key-item .q-num {
    min-width: 38px;
    text-align: right;
    font-weight: 900;
    color: var(--text-main);
    padding-left: 6px;
}
.omr-Radio-pills,
.omr-bubbles-select {
    display: flex;
    gap: 7px !important;
    direction: ltr;
}
.omr-step-card {
    background: var(--hover-bg);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 18px;
    margin-bottom: 22px;
}
.omr-step-badge {
    display: inline-block;
    font-size: 12.5px;
    font-weight: 900;
    color: var(--text-main);
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    padding: 6px 14px;
    border-radius: 999px;
    margin-bottom: 10px;
}
.omr-bubble-pill,
.omr-bubble-opt {
    width: 32px !important;
    height: 32px !important;
    border-radius: 50% !important;
    border: 1.8px solid var(--border-color) !important;
    background: var(--bg-card) !important;
    color: var(--text-main) !important;
    font-size: 12.5px !important;
    font-weight: 900 !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    cursor: pointer !important;
    user-select: none !important;
    padding: 0 !important;
    margin: 0 !important;
    transition: all 0.15s ease !important;
    box-shadow: none !important;
}
.omr-bubble-pill:hover,
.omr-bubble-opt:hover {
    border-color: #16a34a !important;
    transform: scale(1.06);
}
.omr-bubble-pill.selected,
.omr-bubble-opt.selected,
.omr-bubble-pill.active,
.omr-bubble-opt.active {
    background: #16a34a !important;
    color: #ffffff !important;
    border-color: #16a34a !important;
    box-shadow: 0 3px 10px rgba(22, 163, 74, 0.35) !important;
}
.bulk-pay-input-compact {
    width: 82px !important;
    max-width: 86px !important;
    min-width: 68px !important;
    padding: 7px 6px !important;
    margin: 0 auto !important;
    display: block !important;
    text-align: center !important;
    font-weight: 800 !important;
}
@media (max-width: 1024px) {
    #omrSystemModal .modal-content {
        width: 96% !important;
        max-width: 96% !important;
        padding: 18px 16px !important;
        border-radius: 20px !important;
    }
    .omr-key-grid {
        grid-template-columns: repeat(auto-fill, minmax(175px, 1fr)) !important;
        gap: 10px !important;
    }
}
@media (max-width: 640px) {
    #omrSystemModal .modal-content {
        width: 98% !important;
        padding: 16px 12px !important;
        max-height: 92vh !important;
    }
    .omr-step-card {
        padding: 14px 12px !important;
    }
    .omr-key-grid {
        grid-template-columns: 1fr 1fr !important;
        gap: 8px !important;
        padding: 10px !important;
    }
    .omr-key-item {
        padding: 8px 10px !important;
        gap: 10px !important;
    }
    .omr-bubble-pill {
        width: 27px !important;
        height: 27px !important;
        font-size: 11px !important;
    }
}
@media (max-width: 400px) {
    .omr-key-grid {
        grid-template-columns: 1fr !important;
    }
}
/* نافذة التقرير المالي المبوب التفاعلي (Multi-Tab Financial Report Modal) */
.fin-report-tabs-bar {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 10px;
    margin-bottom: 16px;
    border-bottom: 1px solid var(--border-color);
    scrollbar-width: thin;
}
.fin-report-tab-btn {
    padding: 10px 18px;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    background: var(--hover-bg);
    color: var(--text-muted);
    font-family: 'Cairo', sans-serif;
    font-size: 13px;
    font-weight: 800;
    cursor: pointer;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: 0.2s;
}
.fin-report-tab-btn.active {
    background: var(--primary-color);
    color: var(--primary-text);
    border-color: var(--primary-color);
}
.fin-report-pane {
    display: none;
    font-family: 'Cairo', sans-serif;
}
.fin-report-pane.active {
    display: block;
    animation: fadeIn 0.25s ease;
}
.header-class {
    position: sticky !important; /* أو fixed إذا كان تصميمك يعتمد عليها */
    top: 30px !important;
    z-index: 9999 !important; /* لضمان بقائه فوق باقي عناصر الصفحة عند التمرير */
}
/* =========================================
   الضبط النهائي للهيدر والمساحة العلوية وأيقونة الإشعارات
   ========================================= */
body {
    padding-top: 0 !important;
}
.sidebar-header {
    padding: 38px 20px 24px 20px !important;
}
.avatar-container {
    margin-top: 8px !important;
    margin-bottom: 14px !important;
}
.sidebar.collapsed .sidebar-header {
    padding: 28px 10px 18px 10px !important;
}
.sidebar.collapsed .avatar-container {
    margin-top: 4px !important;
    margin-bottom: 0 !important;
}
.main-content {
    padding: 24px 28px 30px 28px !important;
}
.smart-header {
    position: sticky !important;
    z-index: 9999 !important;
    border-radius: 16px !important;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.04) !important;
}
@media (max-width: 992px) {
    .main-content {
        padding: 16px 14px 28px 14px !important;
    }
    .smart-header {
        top: 8px !important;
        margin: 0 0 18px 0 !important;
        padding: 14px 15px !important;
        border-radius: 14px !important;
    }
}
@media (min-width: 993px) {
    .smart-header {
        top: 12px !important;
        margin: 0 0 22px 0 !important;
        padding: 15px 22px !important;
        border-radius: 16px !important;
    }
}
/* تصميم أيقونة الجرس وشارة الإشعارات الاحترافية */
#notifBell .notif-bell-btn {
    position: relative;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: var(--hover-bg);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}
#notifBell .notif-bell-btn:hover {
    transform: translateY(-1px);
    background: var(--bg-card);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}
#notifBell .notif-bell-btn.has-unread {
    border-color: rgba(239, 68, 68, 0.35);
    background: rgba(239, 68, 68, 0.06);
}
#notifBell .notif-bell-btn.has-unread i {
    color: #ef4444;
    animation: bellRingSubtle 2.4s ease-in-out infinite;
    transform-origin: top center;
}
@keyframes bellRingSubtle {
    0%, 100% { transform: rotate(0deg); }
    8% { transform: rotate(12deg); }
    16% { transform: rotate(-10deg); }
    24% { transform: rotate(6deg); }
    32% { transform: rotate(-4deg); }
    40% { transform: rotate(0deg); }
}
#notifBadge {
    position: absolute !important;
    top: -4px !important;
    right: -4px !important;
    min-width: 19px !important;
    height: 19px !important;
    padding: 0 5px !important;
    border-radius: 999px !important;
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%) !important;
    color: #ffffff !important;
    font-family: 'Cairo', sans-serif !important;
    font-size: 10.5px !important;
    font-weight: 900 !important;
    line-height: 1 !important;
    align-items: center !important;
    justify-content: center !important;
    border: 2px solid var(--bg-card) !important;
    box-shadow: 0 3px 8px rgba(220, 38, 38, 0.45) !important;
    box-sizing: border-box !important;
    pointer-events: none;
}