/* ============================================================
   نظام إدارة الطلاب — نظام تصميم احترافي (Design System)
   Indigo / Slate / Teal · RTL · Light + Dark
   يُحمَّل بعد Bootstrap RTL ليتجاوز أنماطه الافتراضية.
   ============================================================ */

/* ----------------------------------------------------------------
   1) الرموز التصميمية (Design Tokens)
   ---------------------------------------------------------------- */
:root {
  /* الألوان الأساسية */
  --brand-50:  #eef2ff;
  --brand-100: #e0e7ff;
  --brand-200: #c7d2fe;
  --brand-400: #818cf8;
  --brand-500: #6366f1;
  --brand-600: #4f46e5;
  --brand-700: #4338ca;
  --brand-800: #3730a3;

  --accent-500: #14b8a6;  /* teal */
  --accent-600: #0d9488;

  /* دلالات */
  --success: #16a34a;  --success-bg: #dcfce7;
  --warning: #d97706;  --warning-bg: #fef3c7;
  --danger:  #dc2626;  --danger-bg:  #fee2e2;
  --info:    #0891b2;  --info-bg:    #cffafe;

  /* المحايدة (light) */
  --bg:         #f4f6fb;
  --surface:    #ffffff;
  --surface-2:  #f8fafc;
  --surface-3:  #f1f5f9;
  --border:     #e6e9f0;
  --border-2:   #eef1f6;
  --text:       #0f172a;
  --text-soft:  #334155;
  --text-muted: #64748b;
  --text-faint: #94a3b8;

  /* الشريط الجانبي */
  --sidebar-bg-1: #111827;
  --sidebar-bg-2: #1e293b;
  --sidebar-text: #cbd5e1;
  --sidebar-text-strong: #f8fafc;
  --sidebar-muted: #94a3b8;
  --sidebar-active-bg: rgba(99, 102, 241, 0.16);
  --sidebar-active-bar: var(--brand-500);
  --sidebar-hover-bg: rgba(255, 255, 255, 0.05);

  /* القياسات */
  --sidebar-w: 268px;
  --topbar-h: 66px;
  --radius:    16px;
  --radius-sm: 11px;
  --radius-xs: 8px;

  /* الظلال */
  --shadow-xs: 0 1px 2px rgba(15, 23, 42, 0.05);
  --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.06), 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow:    0 4px 12px rgba(15, 23, 42, 0.07), 0 2px 4px rgba(15, 23, 42, 0.04);
  --shadow-lg: 0 12px 32px rgba(15, 23, 42, 0.12), 0 4px 10px rgba(15, 23, 42, 0.05);
  --ring: 0 0 0 3px rgba(99, 102, 241, 0.28);

  --ease: cubic-bezier(0.4, 0, 0.2, 1);

  /* ربط متغيّرات Bootstrap بلوحتنا */
  --bs-primary: var(--brand-600);
  --bs-primary-rgb: 79, 70, 229;
  --bs-body-bg: var(--bg);
  --bs-body-color: var(--text);
  --bs-border-color: var(--border);
  --bs-link-color: var(--brand-600);
  --bs-link-hover-color: var(--brand-700);
  --bs-font-sans-serif: 'Tajawal', system-ui, sans-serif;
}

[data-bs-theme="dark"] {
  --bg:         #0b1120;
  --surface:    #131c2e;
  --surface-2:  #172136;
  --surface-3:  #1e293b;
  --border:     #263349;
  --border-2:   #1f2a3d;
  --text:       #e8edf6;
  --text-soft:  #cbd5e1;
  --text-muted: #94a3b8;
  --text-faint: #64748b;

  --sidebar-bg-1: #0a0f1c;
  --sidebar-bg-2: #111b2e;

  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.4);
  --shadow:    0 4px 14px rgba(0, 0, 0, 0.45);
  --shadow-lg: 0 14px 40px rgba(0, 0, 0, 0.55);

  --bs-body-bg: var(--bg);
  --bs-body-color: var(--text);
  --success-bg: rgba(22,163,74,.18);
  --warning-bg: rgba(217,119,6,.18);
  --danger-bg:  rgba(220,38,38,.18);
  --info-bg:    rgba(8,145,178,.18);
}

/* ----------------------------------------------------------------
   2) أساسيات
   ---------------------------------------------------------------- */
* { scrollbar-width: thin; scrollbar-color: var(--text-faint) transparent; }
*::-webkit-scrollbar { width: 9px; height: 9px; }
*::-webkit-scrollbar-thumb { background: color-mix(in srgb, var(--text-faint) 55%, transparent); border-radius: 20px; }
*::-webkit-scrollbar-thumb:hover { background: var(--text-faint); }

html { scroll-behavior: smooth; }

body {
  font-family: 'Tajawal', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  text-align: right;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  letter-spacing: -0.01em;
  transition: background-color .25s var(--ease), color .25s var(--ease);
}

h1,h2,h3,h4,h5,h6,
.h1,.h2,.h3,.h4,.h5 { font-family: 'Cairo', 'Tajawal', sans-serif; font-weight: 700; color: var(--text); letter-spacing: -0.02em; }

a { text-decoration: none; }
::selection { background: var(--brand-200); color: var(--brand-800); }

/* ----------------------------------------------------------------
   3) هيكل التطبيق: شريط جانبي + شريط علوي
   ---------------------------------------------------------------- */
.app-sidebar {
  position: fixed;
  top: 0; right: 0;
  width: var(--sidebar-w);
  height: 100vh;
  background: linear-gradient(185deg, var(--sidebar-bg-1), var(--sidebar-bg-2));
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  z-index: 1045;
  border-left: 1px solid rgba(255,255,255,0.06);
  transition: transform .3s var(--ease);
}

.sidebar-brand {
  display: flex; align-items: center; gap: .7rem;
  padding: 1.15rem 1.25rem;
  border-bottom: 1px solid rgba(255,255,255,0.07);
  min-height: var(--topbar-h);
}
.sidebar-brand img { height: 40px; width: 40px; object-fit: contain; border-radius: 9px; background: #fff; padding: 3px; }
.sidebar-brand .brand-name { color: var(--sidebar-text-strong); font-family:'Cairo',sans-serif; font-weight: 700; font-size: 1rem; line-height: 1.25; }
.sidebar-brand .brand-sub { color: var(--sidebar-muted); font-size: .72rem; font-weight: 500; }

.sidebar-nav {
  flex: 1; overflow-y: auto;
  padding: .85rem .75rem 1.5rem;
}
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,.14); }

.nav-section-title {
  color: var(--sidebar-muted);
  font-size: .7rem; font-weight: 700;
  letter-spacing: .06em;
  padding: 1rem .75rem .4rem;
  text-transform: uppercase;
}

.side-link {
  display: flex; align-items: center; gap: .75rem;
  padding: .62rem .8rem;
  margin: .12rem 0;
  border-radius: 11px;
  color: var(--sidebar-text);
  font-weight: 500; font-size: .93rem;
  position: relative;
  transition: background-color .18s var(--ease), color .18s var(--ease);
}
.side-link:hover { background: var(--sidebar-hover-bg); color: var(--sidebar-text-strong); }
.side-link svg { width: 20px; height: 20px; flex-shrink: 0; stroke-width: 2; opacity: .9; }
.side-link.active {
  background: var(--sidebar-active-bg);
  color: #fff;
  font-weight: 700;
}
.side-link.active::before {
  content: ""; position: absolute; right: -0.75rem; top: 50%; transform: translateY(-50%);
  width: 4px; height: 22px; border-radius: 4px; background: var(--sidebar-active-bar);
}
.side-link.active svg { opacity: 1; color: var(--brand-400); }

/* قائمة قابلة للطي داخل الشريط الجانبي */
.side-group > .side-link .chev { margin-inline-start: auto; transition: transform .2s var(--ease); width:16px;height:16px; }
.side-group.open > .side-link .chev { transform: rotate(-180deg); }
.side-sub { display: grid; grid-template-rows: 0fr; transition: grid-template-rows .25s var(--ease); }
.side-group.open .side-sub { grid-template-rows: 1fr; }
.side-sub > div { overflow: hidden; }
.side-sub .side-link {
  font-size: .875rem; padding: .5rem .8rem .5rem 2.6rem;
  color: var(--sidebar-muted);
}
.side-sub .side-link::after { content:""; position:absolute; right:1.4rem; top:50%; width:6px;height:6px;border-radius:50%; background: currentColor; opacity:.4; transform:translateY(-50%); }
.side-sub .side-link:hover, .side-sub .side-link.active { color: var(--sidebar-text-strong); background: var(--sidebar-hover-bg); }

.sidebar-foot { padding: .85rem; border-top: 1px solid rgba(255,255,255,.07); }
.sidebar-user {
  display:flex; align-items:center; gap:.65rem;
  padding:.5rem .6rem; border-radius: 12px;
}
.sidebar-user .avatar {
  width: 38px; height: 38px; border-radius: 50%;
  background: linear-gradient(135deg, var(--brand-500), var(--accent-600));
  color:#fff; display:grid; place-items:center; font-weight:700; font-family:'Cairo';
  flex-shrink: 0;
}
.sidebar-user .u-name { color: var(--sidebar-text-strong); font-weight:600; font-size:.9rem; }
.sidebar-user .u-role { color: var(--sidebar-muted); font-size:.72rem; }

/* المنطقة الرئيسية */
.app-main {
  margin-right: var(--sidebar-w);
  min-height: 100vh;
  display: flex; flex-direction: column;
  transition: margin .3s var(--ease);
}

.app-topbar {
  position: sticky; top: 0; z-index: 1030;
  height: var(--topbar-h);
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 1rem;
  padding: 0 1.5rem;
}
.topbar-title { font-family:'Cairo',sans-serif; font-weight:700; font-size:1.12rem; color: var(--text); }
.topbar-title small { display:block; font-family:'Tajawal'; font-weight:500; font-size:.75rem; color: var(--text-muted); letter-spacing:0; }

.icon-btn {
  width: 42px; height: 42px; border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-soft);
  display: grid; place-items: center;
  transition: all .18s var(--ease);
  cursor: pointer;
}
.icon-btn:hover { background: var(--surface-3); color: var(--brand-600); border-color: var(--brand-200); }
.icon-btn svg { width: 20px; height: 20px; }
.icon-btn.is-active { color: var(--warning); }

#sidebarToggle { display: none; }

.app-content { flex: 1; padding: 1.75rem; max-width: 1400px; width: 100%; margin: 0 auto; }

/* خلفية عند فتح الشريط على الجوال */
.sidebar-backdrop {
  position: fixed; inset: 0; background: rgba(15,23,42,.5);
  z-index: 1040; opacity: 0; visibility: hidden; transition: opacity .3s var(--ease);
  backdrop-filter: blur(2px);
}
.sidebar-backdrop.show { opacity: 1; visibility: visible; }

/* ----------------------------------------------------------------
   4) البطاقات (Cards)
   ---------------------------------------------------------------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  margin-bottom: 1.25rem;
  transition: box-shadow .2s var(--ease), border-color .2s var(--ease), transform .2s var(--ease);
}
.card.shadow-sm { box-shadow: var(--shadow-sm) !important; }
.card-header {
  background: transparent;
  border-bottom: 1px solid var(--border);
  padding: 1rem 1.35rem;
  font-family: 'Cairo', sans-serif;
  font-weight: 700; font-size: 1rem; color: var(--text);
}
.card-body { padding: 1.35rem; }
.card.border-primary,.card.border-info,.card.border-warning,.card.border-pink,.card.border-success { border-width: 1px !important; }

/* بطاقات الإحصاءات في لوحة التحكم */
.stat-card {
  position: relative; overflow: hidden;
  padding: 1.35rem 1.4rem;
  display: flex; align-items: center; gap: 1.1rem;
}
.stat-card .stat-ico {
  width: 54px; height: 54px; border-radius: 15px;
  display: grid; place-items: center; flex-shrink: 0;
}
.stat-card .stat-ico svg { width: 26px; height: 26px; }
.stat-card .stat-val { font-family:'Cairo',sans-serif; font-weight: 800; font-size: 1.9rem; line-height: 1; color: var(--text); }
.stat-card .stat-lbl { color: var(--text-muted); font-size: .85rem; font-weight: 500; margin-top: .3rem; }
.stat-card::after {
  content:""; position:absolute; inset-inline-start: -30px; top:-30px;
  width: 110px; height: 110px; border-radius: 50%;
  background: var(--_glow, var(--brand-100)); opacity: .35; z-index: 0;
}
.stat-card > * { position: relative; z-index: 1; }
.stat--brand  { --_glow: var(--brand-100); } .stat--brand  .stat-ico { background: var(--brand-50);  color: var(--brand-600); }
.stat--info   { --_glow: var(--info-bg);   } .stat--info   .stat-ico { background: var(--info-bg);   color: var(--info); }
.stat--pink   { --_glow: #fce7f3;          } .stat--pink   .stat-ico { background: #fce7f3;          color: #db2777; }
.stat--warn   { --_glow: var(--warning-bg);} .stat--warn   .stat-ico { background: var(--warning-bg);color: var(--warning); }
[data-bs-theme="dark"] .stat--brand .stat-ico { background: rgba(99,102,241,.18); color: var(--brand-400); }
[data-bs-theme="dark"] .stat--pink  .stat-ico { background: rgba(219,39,119,.18); color:#f472b6; }

/* ----------------------------------------------------------------
   5) الأزرار
   ---------------------------------------------------------------- */
.btn {
  --bs-btn-border-radius: var(--radius-xs);
  border-radius: var(--radius-xs);
  font-weight: 600;
  padding: .55rem 1.1rem;
  transition: all .18s var(--ease);
  border-width: 1px;
}
.btn:focus-visible { box-shadow: var(--ring); }
.btn-sm { padding: .35rem .7rem; border-radius: 7px; }
.btn-lg { padding: .7rem 1.4rem; }

.btn-primary {
  --bs-btn-bg: var(--brand-600); --bs-btn-border-color: var(--brand-600);
  --bs-btn-hover-bg: var(--brand-700); --bs-btn-hover-border-color: var(--brand-700);
  --bs-btn-active-bg: var(--brand-800);
  box-shadow: 0 2px 8px rgba(79,70,229,.28);
}
.btn-primary:hover { box-shadow: 0 4px 14px rgba(79,70,229,.36); transform: translateY(-1px); }
.btn-secondary {
  --bs-btn-bg: var(--surface); --bs-btn-color: var(--text-soft); --bs-btn-border-color: var(--border);
  --bs-btn-hover-bg: var(--surface-3); --bs-btn-hover-color: var(--text); --bs-btn-hover-border-color: var(--text-faint);
}
.btn-outline-primary {
  --bs-btn-color: var(--brand-600); --bs-btn-border-color: var(--brand-200);
  --bs-btn-hover-bg: var(--brand-600); --bs-btn-hover-border-color: var(--brand-600);
}
.btn-outline-secondary {
  --bs-btn-color: var(--text-soft); --bs-btn-border-color: var(--border);
  --bs-btn-hover-bg: var(--surface-3); --bs-btn-hover-color: var(--text); --bs-btn-hover-border-color: var(--text-faint);
}
.btn-light { --bs-btn-bg: var(--surface-3); --bs-btn-border-color: var(--border); --bs-btn-color: var(--text-soft); }
.btn-danger { box-shadow: 0 2px 8px rgba(220,38,38,.22); }
.btn-outline-danger { --bs-btn-color: var(--danger); --bs-btn-border-color: var(--danger-bg); }

/* ----------------------------------------------------------------
   6) النماذج
   ---------------------------------------------------------------- */
.form-control, .form-select {
  border-radius: var(--radius-xs);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  padding: .6rem .85rem;
  transition: border-color .15s var(--ease), box-shadow .15s var(--ease);
  text-align: right;
}
.form-control::placeholder { color: var(--text-faint); }
.form-control:focus, .form-select:focus {
  border-color: var(--brand-500);
  box-shadow: var(--ring);
  background: var(--surface);
  color: var(--text);
}
.form-label { font-weight: 600; color: var(--text-soft); margin-bottom: .4rem; font-size: .9rem; }
.input-group-text { background: var(--surface-3); border-color: var(--border); color: var(--text-muted); border-radius: var(--radius-xs); }

/* ----------------------------------------------------------------
   7) الجداول
   ---------------------------------------------------------------- */
.table {
  --bs-table-bg: transparent;
  color: var(--text);
  margin-bottom: 0;
  border-color: var(--border);
  vertical-align: middle;
}
.table thead th {
  background: var(--surface-2);
  color: var(--text-muted);
  font-family: 'Cairo', sans-serif;
  font-weight: 700; font-size: .82rem;
  text-transform: none; letter-spacing: 0;
  border-bottom: 1px solid var(--border);
  padding: .85rem 1rem; white-space: nowrap;
}
.table tbody td { padding: .8rem 1rem; border-bottom: 1px solid var(--border-2); color: var(--text-soft); }
.table tbody tr { transition: background-color .13s var(--ease); }
.table-striped > tbody > tr:nth-of-type(odd) > * { --bs-table-accent-bg: var(--surface-2); background: var(--surface-2); }
.table-hover tbody tr:hover, .table tbody tr:hover { background: var(--brand-50); }
[data-bs-theme="dark"] .table tbody tr:hover { background: var(--surface-3); }
.table-bordered, .table-bordered td, .table-bordered th { border-color: var(--border); }
.table > :not(caption) > * > * { box-shadow: none; }
.table img, .table .img-thumbnail { border-radius: 9px; border: 1px solid var(--border); object-fit: cover; }
.table-responsive { border-radius: var(--radius); }

/* ----------------------------------------------------------------
   8) الشارات، التبويبات، القوائم المنسدلة، الأكورديون
   ---------------------------------------------------------------- */
.badge { font-weight: 600; padding: .38em .7em; border-radius: 7px; letter-spacing: 0; }

.nav-tabs {
  border-bottom: 1px solid var(--border); gap: .2rem;
  padding: 0 .4rem;
}
.nav-tabs .nav-link {
  border: none; border-radius: 0;
  color: var(--text-muted); font-weight: 600;
  padding: .85rem 1rem; position: relative;
  background: transparent;
}
.nav-tabs .nav-link:hover { color: var(--brand-600); background: transparent; border: none; }
.nav-tabs .nav-link.active {
  color: var(--brand-700); background: transparent; border: none;
}
.nav-tabs .nav-link.active::after {
  content:""; position:absolute; bottom:-1px; inset-inline:.6rem;
  height: 3px; border-radius: 3px 3px 0 0; background: var(--brand-600);
}

.dropdown-menu {
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow-lg);
  padding: .4rem;
  background: var(--surface);
}
.dropdown-item { border-radius: 9px; padding: .55rem .8rem; color: var(--text-soft); font-weight: 500; }
.dropdown-item:hover { background: var(--surface-3); color: var(--brand-700); }
.dropdown-header { color: var(--text-faint); font-weight: 700; font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; }
.dropdown-divider { border-color: var(--border); }

.accordion {
  --bs-accordion-border-color: var(--border);
  --bs-accordion-bg: var(--surface);
  border-radius: var(--radius) !important; overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.accordion-item { background: var(--surface); border-color: var(--border); }
.accordion-button {
  background: var(--surface); color: var(--text);
  font-family:'Cairo',sans-serif; font-weight: 700; font-size: .95rem;
  padding: .95rem 1.15rem;
}
.accordion-button:not(.collapsed) {
  color: #fff !important;
  background: linear-gradient(90deg, var(--brand-600), var(--brand-700)) !important;
  box-shadow: none;
}
.accordion-button::after { margin-left: 0; margin-right: auto; }
.accordion-button:not(.collapsed)::after { filter: brightness(0) invert(1); }
.accordion-button:focus { box-shadow: none; border-color: var(--border); }

/* قوائم الإجراءات داخل الأكورديون (صفحة الطالب) */
.action-list { list-style: none; padding: .4rem; margin: 0; }
.action-list li a {
  display: flex; align-items: center; gap: .6rem;
  padding: .6rem .8rem; color: var(--text-soft);
  border-radius: 10px; font-weight: 500; font-size: .9rem;
  transition: background-color .15s var(--ease), color .15s var(--ease);
}
.action-list li a:hover { background: var(--brand-50); color: var(--brand-700); }
[data-bs-theme="dark"] .action-list li a:hover { background: var(--surface-3); }
.action-list li a i { margin-left: 4px; width: 20px; text-align: center; }

/* ----------------------------------------------------------------
   9) التنبيهات، صفحة تفاصيل الطالب، مكوّنات متنوعة
   ---------------------------------------------------------------- */
.alert { border-radius: var(--radius-sm); border: 1px solid transparent; padding: .9rem 1.1rem; font-weight: 500; }
.alert-secondary { background: var(--surface-3); color: var(--text-muted); border-color: var(--border); }
.alert-danger { background: var(--danger-bg); color: var(--danger); border-color: transparent; }

.breadcrumb { margin-bottom: 0; font-size: .875rem; }
.breadcrumb-item a { color: var(--text-muted); }
.breadcrumb-item a:hover { color: var(--brand-600); }
.breadcrumb-item.active { color: var(--text-soft); font-weight: 600; }

.page-head { display:flex; align-items:center; justify-content:space-between; flex-wrap:wrap; gap:1rem; margin-bottom:1.4rem; }
.page-head h2, .page-head h1 { margin: 0; font-size: 1.5rem; }

/* بطاقة ملف الطالب */
.profile-card { text-align: center; }
.avatar-xl {
  width: 116px; height: 116px; border-radius: 50%;
  object-fit: cover; border: 4px solid var(--surface);
  box-shadow: 0 0 0 1px var(--border), var(--shadow); margin: 0 auto;
  display: block;
}
.p-name { font-size: 1.15rem; margin-top: .9rem; }
.ref-chip {
  display: inline-flex; align-items:center; gap:.35rem;
  background: var(--brand-50); color: var(--brand-700);
  font-family:'Cairo'; font-weight:700; font-size:.8rem;
  padding: .3rem .7rem; border-radius: 8px; margin-top:.6rem;
}
[data-bs-theme="dark"] .ref-chip { background: rgba(99,102,241,.16); color: var(--brand-400); }
.nat-line { display:inline-flex; align-items:center; gap:.4rem; color: var(--text-muted); font-size:.9rem; }
.nat-line img { border-radius: 3px; box-shadow: var(--shadow-xs); }

/* صفوف تفاصيل (label/value) */
.detail-card .row { padding: .65rem .2rem; border-bottom: 1px solid var(--border-2); margin: 0; align-items:center; }
.detail-card .row:last-child { border-bottom: none; }
.detail-label { font-weight: 600; color: var(--text-muted); font-size: .88rem; }
.detail-value { color: var(--text); font-weight: 500; }
.detail-card .card-header { background: var(--surface-2); font-size: .92rem; }

/* سطر إجراءات لاصق */
.action-bar {
  position: sticky; top: calc(var(--topbar-h) + 8px); z-index: 20;
  background: var(--surface); padding: .7rem .9rem;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm); display: flex; flex-wrap: wrap; gap: .5rem; align-items: center;
}

/* الترقيم */
.pagination { --bs-pagination-color: var(--text-soft); gap: .3rem; }
.page-link {
  border: 1px solid var(--border); border-radius: 10px !important;
  color: var(--text-soft); background: var(--surface); padding: .45rem .8rem; font-weight:600;
}
.page-link:hover { background: var(--surface-3); color: var(--brand-700); border-color: var(--brand-200); }
.page-item.active .page-link { background: var(--brand-600); border-color: var(--brand-600); color:#fff; box-shadow: 0 2px 8px rgba(79,70,229,.3); }

/* حالة فارغة */
.empty-state { text-align:center; padding: 3rem 1rem; color: var(--text-muted); }
.empty-state svg { width: 54px; height: 54px; color: var(--text-faint); margin-bottom: 1rem; }

/* شبكة بيانات مضغوطة بديلة للجداول الطويلة */
.chart-wrap { position: relative; height: 320px; }

/* بطاقة الترحيب في لوحة التحكم */
.welcome-card {
  background: linear-gradient(110deg, var(--brand-600), var(--brand-800) 70%, var(--accent-600));
  border: none; color: #fff; overflow: hidden; position: relative;
}
.welcome-card::after {
  content:""; position:absolute; inset-inline-start:-40px; top:-60px;
  width: 220px; height: 220px; border-radius:50%;
  background: rgba(255,255,255,.08);
}
.welcome-card .card-body { position: relative; z-index: 1; }
.welcome-card h2 { color:#fff; }
.welcome-card .text-muted { color: rgba(255,255,255,.8) !important; }
.welcome-logo { height: 62px; width: 62px; object-fit: contain; background:#fff; border-radius: 14px; padding: 6px; box-shadow: var(--shadow); }

/* معاينة الشعار في الإعدادات */
.logo-preview { height: 84px; width: 84px; object-fit: contain; border-radius: 14px; border: 1px solid var(--border); background: var(--surface-2); padding: 8px; flex-shrink: 0; }
.logo-preview--empty { display: grid; place-items: center; color: var(--text-faint); font-size: .72rem; text-align: center; }

/* ----------------------------------------------------------------
   10) الاستجابة (Responsive)
   ---------------------------------------------------------------- */
@media (max-width: 991.98px) {
  .app-sidebar { transform: translateX(100%); box-shadow: var(--shadow-lg); }
  .app-sidebar.show { transform: translateX(0); }
  .app-main { margin-right: 0; }
  #sidebarToggle { display: grid; }
  .app-content { padding: 1.1rem; }
}
@media (max-width: 575.98px) {
  .app-topbar { padding: 0 1rem; }
  .topbar-title { font-size: 1rem; }
  .stat-card { padding: 1.1rem; }
}

/* حركة دخول ناعمة للبطاقات */
@keyframes riseIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.app-content > * { animation: riseIn .4s var(--ease) both; }
@media (prefers-reduced-motion: reduce) { .app-content > * { animation: none; } * { scroll-behavior: auto; } }

/* ----------------------------------------------------------------
   صفحة تسجيل الدخول
   ---------------------------------------------------------------- */
.auth-body {
  min-height: 100vh; margin: 0;
  background:
    radial-gradient(1000px 500px at 90% -10%, rgba(99,102,241,.16), transparent 60%),
    radial-gradient(900px 500px at 0% 110%, rgba(13,148,136,.14), transparent 55%),
    var(--bg);
  display: grid; place-items: center; padding: 1.5rem;
}
.auth-wrap { width: 100%; max-width: 940px; }
.auth-card {
  display: grid; grid-template-columns: 1.05fr 1fr;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 24px; overflow: hidden; box-shadow: var(--shadow-lg);
}
.auth-brand {
  background: linear-gradient(150deg, var(--brand-700), var(--brand-800) 55%, #0f172a);
  color: #fff; position: relative; overflow: hidden;
}
.auth-brand::before {
  content:""; position:absolute; width:280px;height:280px;border-radius:50%;
  background: rgba(255,255,255,.07); top:-90px; inset-inline-start:-70px;
}
.auth-brand::after {
  content:""; position:absolute; width:200px;height:200px;border-radius:50%;
  background: rgba(20,184,166,.18); bottom:-70px; inset-inline-end:-50px;
}
.auth-brand-inner { position: relative; z-index:1; padding: 2.6rem 2.4rem; height:100%; display:flex; flex-direction:column; }
.auth-logo img { height: 60px; width:60px; object-fit:contain; background:#fff; border-radius:16px; padding:8px; box-shadow: var(--shadow); }
.auth-brand h1 { color:#fff; font-size: 1.5rem; margin-top: 1.3rem; line-height:1.3; }
.auth-brand p { color: rgba(255,255,255,.82); margin-top:.6rem; font-size:.95rem; }
.auth-features { list-style:none; padding:0; margin: 1.6rem 0 0; }
.auth-features li { display:flex; align-items:center; gap:.6rem; color: rgba(255,255,255,.9); padding:.4rem 0; font-size:.9rem; font-weight:500; }
.auth-features .dot { width:8px;height:8px;border-radius:50%; background: var(--accent-500); box-shadow:0 0 0 4px rgba(20,184,166,.2); flex-shrink:0; }

.auth-form { display:grid; place-items:center; padding: 2.6rem 2.4rem; }
.auth-form-inner { width:100%; max-width: 340px; }
.auth-form h2 { font-size: 1.6rem; }
.auth-copy { text-align:center; color: var(--text-muted); font-size:.82rem; margin-top:1.2rem; }

@media (max-width: 767.98px) {
  .auth-card { grid-template-columns: 1fr; }
  .auth-brand { display: none; }
}

/* أيقونات زر الوضع الليلي (شمس/قمر) عبر CSS */
.theme-sun { display: none; }
[data-bs-theme="dark"] .theme-sun { display: block; }
[data-bs-theme="dark"] .theme-moon { display: none; }

/* ----------------------------------------------------------------
   صفحات الأخطاء (403 / 404)
   ---------------------------------------------------------------- */
.error-page { display: flex; justify-content: center; padding: 1.5rem 0 2.5rem; }
.error-card {
  max-width: 620px; width: 100%; text-align: center;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-sm);
  padding: 2.6rem 2.2rem;
}
.error-icon {
  width: 78px; height: 78px; border-radius: 50%; margin: 0 auto 1.2rem;
  display: grid; place-items: center;
}
.error-icon svg { width: 36px; height: 36px; }
.error-icon--warn { background: var(--warning-bg); color: var(--warning); }
.error-icon--info { background: var(--info-bg); color: var(--info); }
.error-code {
  font-family: 'Cairo', sans-serif; font-weight: 800; font-size: 3rem;
  color: var(--brand-600); line-height: 1;
}
.error-title { font-size: 1.4rem; margin: .5rem 0 .35rem; }
.error-lead { color: var(--text-muted); margin-bottom: 1.4rem; }
.error-hints {
  text-align: right; display: inline-block; color: var(--text-soft);
  margin: 0 auto 1.6rem; font-size: .9rem; line-height: 2;
}
.error-actions { display: flex; gap: .6rem; justify-content: center; flex-wrap: wrap; margin-bottom: .5rem; }
.error-meta { text-align: right; color: var(--text-muted); font-size: .82rem; line-height: 1.9; }
.error-meta code { background: var(--surface-3); padding: .1rem .4rem; border-radius: 5px; }

/* أدوات مساعدة */
.text-muted { color: var(--text-muted) !important; }
.text-primary { color: var(--brand-600) !important; }
.fw-cairo { font-family: 'Cairo', sans-serif; }
.soft-divider { height:1px; background: var(--border); border:0; margin: 1.25rem 0; }
