/* ==========================================================================
   EduSky Ads Hub — base.css
   الرموز (tokens) + التخطيط + مكوّنات الواجهة المشتركة.
   كل الأبعاد مضاعفات 4px (شبكة 8px للمسافات الكبيرة). الخصائص منطقية (inline/block)
   لتعمل مع RTL بلا تعديل.
   ========================================================================== */

:root {
  /* الخطوط */
  --font-body: 'Cairo', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-display: 'Alexandria', 'Cairo', system-ui, sans-serif;
  --font-mono: ui-monospace, 'SF Mono', Consolas, 'Liberation Mono', monospace;

  /* الألوان — هوية فُصْحَى: أخضر غابي + ذهبي + ورق كريمي */
  --bg: #f6f1e4;
  --surface: #fffdf8;
  --surface-2: #faf6ea;
  --surface-3: #f0eadb;
  --border: #e4dcc6;
  --border-strong: #cdc2a3;
  --text: #13241f;
  --text-2: #3d574d;
  --text-3: #5d6f66;
  --text-inverse: #ffffff;

  /* الأخضر الزمردي = اللون الأساسي للنصوص والروابط والتحديد؛ الذهبي = زر الإجراء الرئيسي والمؤشرات */
  --primary: #2f5246;
  --primary-600: #264539;
  --primary-700: #1b3a30;
  --primary-50: #edf3ee;
  --primary-100: #d9e7de;
  --accent: #d8921a;
  --gold: #eaa72e;
  --gold-light: #f2c25e;
  --gold-600: #d8921a;
  --gold-700: #8a5a00;
  --gold-50: #fdf3dc;
  --gold-ink: #13241f;

  /* مقاييس الأخضر الداكن (الأسماء navy-* قديمة وتعني الآن الأخضر الغابي) */
  --navy-950: #0b1411;
  --navy-900: #0f1c18;
  --navy-800: #13241f;
  --navy-700: #1e3a31;
  --navy-text: #c9d6cf;
  --navy-text-dim: #8fa79c;

  --success: #166534;
  --success-bg: #ecf7ef;
  --success-border: #b3dcc0;
  --warning: #8a5a00;
  --warning-bg: #fdf3dc;
  --warning-border: #f0d490;
  --danger: #b42318;
  --danger-bg: #fdf0ee;
  --danger-border: #f3c4be;
  --info: #1e5a8a;
  --info-bg: #eef5fb;
  --info-border: #c3daee;
  --violet: #6b3fa0;
  --violet-bg: #f5f0fb;
  --violet-border: #dccaf0;
  --teal: #0f6f66;
  --teal-bg: #edf8f6;
  --teal-border: #a8dcd5;
  --slate-bg: #f1ecdd;

  /* ألوان حالات طلب الاهتمام */
  --st-new: #1e5a8a;           --st-new-bg: #eef5fb;        --st-new-bd: #c3daee;
  --st-contacted: #8a5a00;     --st-contacted-bg: #fdf3dc;  --st-contacted-bd: #f0d490;
  --st-qualified: #6b3fa0;     --st-qualified-bg: #f5f0fb;  --st-qualified-bd: #dccaf0;
  --st-applied: #0f6f66;       --st-applied-bg: #edf8f6;    --st-applied-bd: #a8dcd5;
  --st-enrolled: #166534;      --st-enrolled-bg: #ecf7ef;   --st-enrolled-bd: #b3dcc0;
  --st-rejected: #b42318;      --st-rejected-bg: #fdf0ee;   --st-rejected-bd: #f3c4be;

  /* المسافات (شبكة 4/8) */
  --s-1: 4px;
  --s-2: 8px;
  --s-3: 12px;
  --s-4: 16px;
  --s-5: 24px;
  --s-6: 32px;
  --s-7: 48px;
  --s-8: 64px;

  /* الانحناءات والظلال */
  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 14px;
  --r-xl: 20px;
  --r-full: 999px;
  --shadow-xs: 0 1px 2px rgba(19, 36, 31, 0.06);
  --shadow-sm: 0 1px 3px rgba(19, 36, 31, 0.09), 0 1px 2px rgba(19, 36, 31, 0.05);
  --shadow-md: 0 8px 24px rgba(19, 36, 31, 0.12);
  --shadow-lg: 0 24px 64px rgba(11, 20, 17, 0.3);

  /* مقاسات التخطيط */
  --sidebar-w: 264px;
  --topbar-h: 64px;
  --z-sticky: 20;
  --z-sidebar: 50;
  --z-popover: 60;
  --z-modal: 80;
  --z-confirm: 90;
  --z-toast: 100;
}

/* ---------- إعادة ضبط ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4, h5, h6 { margin: 0; font-family: var(--font-display); font-weight: 700; line-height: 1.35; }
p { margin: 0; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
img, svg { display: block; max-width: 100%; }
table { border-collapse: collapse; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--gold-600); outline-offset: 2px; }
.num, .mono { font-variant-numeric: tabular-nums; }
.ltr { direction: ltr; unicode-bidi: isolate; }
.mono { font-family: var(--font-mono); font-size: 0.92em; }
.sr-only {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
.muted { color: var(--text-3); }
.text-sm { font-size: 12.5px; }
.text-xs { font-size: 12px; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stack { display: flex; flex-direction: column; gap: var(--s-4); }
.stack-sm { display: flex; flex-direction: column; gap: var(--s-2); }
.row { display: flex; align-items: center; gap: var(--s-2); flex-wrap: wrap; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); flex-wrap: wrap; }
.grow { flex: 1 1 0; min-width: 0; }

/* ---------- الأيقونات ---------- */
.icon { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.icon-sm { width: 16px; height: 16px; }
.icon-lg { width: 22px; height: 22px; }
.icon-xl { width: 32px; height: 32px; }

/* ==========================================================================
   التخطيط العام (الهيكل)
   ========================================================================== */
.app { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); min-height: 100vh; }

.sidebar {
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column;
  background:
    url('../img/pattern-khatam-dark.svg') 0 0 / 96px 96px,
    linear-gradient(180deg, #0b1411 0%, #0f1c18 55%, #13241f 100%);
  color: var(--navy-text);
  z-index: var(--z-sidebar);
  border-inline-start: 1px solid rgba(234, 167, 46, 0.18);
}
.sidebar-brand { padding: var(--s-5) var(--s-5) var(--s-4); border-bottom: 1px solid rgba(255, 255, 255, 0.07); margin-inline: var(--s-3); padding-inline: var(--s-2); }
.brand-lockup { display: flex; align-items: center; gap: var(--s-3); }
.brand-logo { block-size: 34px; inline-size: auto; flex: none; }
.brand-x { color: var(--gold); font-weight: 700; font-size: 15px; opacity: 0.9; line-height: 1; }
.brand-name { font-family: var(--font-display); font-weight: 800; font-size: 19px; color: #fff; line-height: 1.2; letter-spacing: 0.01em; }
.brand-name span { color: var(--gold); }
.brand-sub { font-size: 12px; color: var(--navy-text-dim); margin-top: var(--s-2); }

.sidebar-nav { flex: 1; overflow-y: auto; padding: var(--s-2) var(--s-3) var(--s-4); }
.nav-group { margin-top: var(--s-4); }
.nav-group-label { padding: 0 var(--s-3); margin-bottom: var(--s-1); font-size: 11.5px; font-weight: 700; color: var(--navy-text-dim); letter-spacing: 0.02em; }
.nav-link {
  display: flex; align-items: center; gap: var(--s-3);
  width: 100%; padding: 10px var(--s-3); border-radius: var(--r-md);
  color: var(--navy-text); font-weight: 600; font-size: 14px;
  text-decoration: none; border: 0; background: transparent; text-align: start;
  transition: background 0.15s, color 0.15s;
}
.nav-link:hover { background: rgba(255, 255, 255, 0.06); color: #fff; text-decoration: none; }
.nav-link.is-active { background: rgba(234, 167, 46, 0.13); color: #fff; box-shadow: inset -3px 0 0 var(--gold); }
.nav-link .icon { opacity: 0.85; }
.nav-link.is-active .icon { opacity: 1; color: var(--gold-light); }
.nav-badge {
  margin-inline-start: auto; min-width: 22px; height: 22px; padding: 0 7px;
  border-radius: var(--r-full); background: var(--gold); color: var(--gold-ink);
  font-size: 12px; font-weight: 800; display: grid; place-items: center;
}
.nav-soon { margin-inline-start: auto; font-size: 11px; color: var(--navy-text-dim); }

.sidebar-foot { padding: var(--s-4); border-top: 1px solid rgba(255, 255, 255, 0.08); display: flex; flex-direction: column; gap: var(--s-3); }
.user-chip { display: flex; align-items: center; gap: var(--s-3); }
.avatar {
  width: 40px; height: 40px; border-radius: 50%; flex: none; overflow: hidden;
  display: grid; place-items: center;
  background: linear-gradient(135deg, #2f5246, #1e3a31); color: var(--gold-light);
  font-weight: 800; font-size: 15px;
  box-shadow: 0 0 0 2px var(--gold), 0 0 0 4px rgba(234, 167, 46, 0.2);
}
.avatar img { inline-size: 100%; block-size: 100%; object-fit: cover; }
.user-name { font-weight: 700; font-size: 13.5px; color: #fff; }
.user-role { font-size: 11.5px; color: var(--navy-text-dim); }
.sidebar-foot .icon-btn { color: var(--navy-text-dim); }
.sidebar-foot .icon-btn:hover { color: #fecaca; background: rgba(255, 255, 255, 0.06); }

.main { min-width: 0; display: flex; flex-direction: column; background: url('../img/pattern-khatam.svg') 0 0 / 96px 96px; }
.topbar {
  position: sticky; top: 0; z-index: var(--z-sticky);
  height: var(--topbar-h);
  display: flex; align-items: center; gap: var(--s-3);
  padding-inline: var(--s-5);
  background: rgba(246, 241, 228, 0.92);
  backdrop-filter: saturate(1.2) blur(8px);
  border-bottom: 1px solid var(--border);
}
.topbar-title { min-width: 0; flex: 1; }
.topbar-title h1 { font-size: 18px; font-weight: 800; color: var(--primary-700); }
.topbar-title p { font-size: 12.5px; color: var(--text-3); margin-top: 1px; }
.topbar-actions { display: flex; align-items: center; gap: var(--s-2); flex-wrap: nowrap; }
.icon-btn.menu-toggle { display: none; }
.content { width: 100%; max-width: 1480px; margin-inline: auto; padding: var(--s-5); flex: 1; }
.view-enter { animation: viewIn 0.22s ease both; }
@keyframes viewIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.sidebar-backdrop { display: none; }

@media (max-width: 1024px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .sidebar {
    position: fixed; inset-block: 0; inset-inline-start: 0; width: min(300px, 86vw);
    transform: translateX(100%); transition: transform 0.25s ease; box-shadow: var(--shadow-lg);
  }
  .sidebar.is-open { transform: none; }
  .sidebar-backdrop { position: fixed; inset: 0; background: rgba(11, 20, 17, 0.58); z-index: calc(var(--z-sidebar) - 1); }
  .sidebar-backdrop.is-open { display: block; }
  .icon-btn.menu-toggle { display: inline-grid; }
  .topbar { padding-inline: var(--s-4); }
  .content { padding: var(--s-4); }
}
@media (max-width: 640px) {
  .topbar-title p { display: none; }
  .topbar-title h1 { font-size: 16px; }
  .topbar-actions .btn-label { display: none; }
}

/* ==========================================================================
   الأزرار
   ========================================================================== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s-2);
  min-height: 40px; padding: 0 var(--s-4);
  border-radius: var(--r-md); border: 1px solid transparent;
  font-weight: 700; font-size: 13.5px; line-height: 1; white-space: nowrap;
  background: var(--surface); color: var(--text); text-decoration: none;
  transition: background 0.15s, border-color 0.15s, box-shadow 0.15s, color 0.15s;
}
.btn:hover { text-decoration: none; }
.btn:disabled, .btn[aria-disabled='true'] { opacity: 0.55; cursor: not-allowed; }
.btn-primary { background: var(--gold); color: var(--gold-ink); box-shadow: var(--shadow-xs), inset 0 -1px 0 rgba(138, 90, 0, 0.25); }
.btn-primary:hover:not(:disabled) { background: var(--gold-light); }
.btn-secondary { background: var(--surface); border-color: var(--border-strong); color: var(--text); }
.btn-secondary:hover:not(:disabled) { background: var(--surface-2); border-color: var(--text-3); }
.btn-soft { background: var(--primary-50); color: var(--primary-700); border-color: var(--primary-100); }
.btn-soft:hover:not(:disabled) { background: var(--primary-100); }
.btn-emerald { background: var(--primary); color: #fff; }
.btn-emerald:hover:not(:disabled) { background: var(--primary-600); }
.btn-ghost { background: transparent; color: var(--text-2); }
.btn-ghost:hover:not(:disabled) { background: var(--surface-3); color: var(--text); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover:not(:disabled) { background: #8f1d14; }
.btn-danger-soft { background: var(--danger-bg); color: var(--danger); border-color: var(--danger-border); }
.btn-danger-soft:hover:not(:disabled) { background: #fbe3df; }
.btn-success { background: #1f7a4d; color: #fff; }
.btn-success:hover:not(:disabled) { background: var(--success); }
.btn-sm { min-height: 32px; padding: 0 var(--s-3); font-size: 12.5px; border-radius: var(--r-sm); }
.btn-lg { min-height: 48px; padding: 0 var(--s-5); font-size: 15px; }
.btn-block { width: 100%; }
.btn.is-loading { position: relative; color: transparent !important; pointer-events: none; }
.btn.is-loading::after {
  content: ''; position: absolute; inline-size: 16px; block-size: 16px; border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.5); border-top-color: #fff; animation: spin 0.7s linear infinite;
}
.btn-primary.is-loading::after { border-color: rgba(19, 36, 31, 0.28); border-top-color: var(--gold-ink); }
.btn-secondary.is-loading::after, .btn-ghost.is-loading::after, .btn-soft.is-loading::after { border-color: var(--border-strong); border-top-color: var(--primary); }
@keyframes spin { to { transform: rotate(360deg); } }

.icon-btn {
  display: inline-grid; place-items: center; inline-size: 36px; block-size: 36px; flex: none;
  border: 0; background: transparent; border-radius: var(--r-md); color: var(--text-2);
  transition: background 0.15s, color 0.15s; text-decoration: none;
}
.icon-btn:hover { background: var(--surface-3); color: var(--text); text-decoration: none; }
.icon-btn.is-sm { inline-size: 28px; block-size: 28px; border-radius: var(--r-sm); }
.icon-btn.is-wa { color: #047857; }
.icon-btn.is-wa:hover { background: var(--success-bg); }

/* ==========================================================================
   الحقول
   ========================================================================== */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field-label { font-size: 12.5px; font-weight: 700; color: var(--text-2); }
.field-label .req { color: var(--danger); margin-inline-start: 2px; }
.field-hint { font-size: 12px; color: var(--text-3); }
.field-error { font-size: 12px; color: var(--danger); font-weight: 600; }
.input, .select, .textarea {
  width: 100%; min-height: 40px; padding: 0 var(--s-3);
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border-strong); border-radius: var(--r-md);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.textarea { padding: var(--s-2) var(--s-3); min-height: 88px; resize: vertical; line-height: 1.7; }
.input::placeholder, .textarea::placeholder { color: #7c8c83; }
.input:hover, .select:hover, .textarea:hover { border-color: var(--text-3); }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(234, 167, 46, 0.3); }
.input[aria-invalid='true'] { border-color: var(--danger); }
.input-sm, .select.input-sm { min-height: 32px; font-size: 12.5px; }
.select {
  appearance: none; padding-inline-end: 34px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: left 10px center;
}
.input-icon { position: relative; }
.input-icon > .icon { position: absolute; inset-inline-start: 12px; top: 50%; transform: translateY(-50%); color: var(--text-3); pointer-events: none; }
.input-icon > .input { padding-inline-start: 38px; }
.input-icon .input-clear { position: absolute; inset-inline-end: 6px; top: 50%; transform: translateY(-50%); }
.form-grid { display: grid; gap: var(--s-4); grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-grid .span-2 { grid-column: 1 / -1; }
@media (max-width: 640px) { .form-grid { grid-template-columns: minmax(0, 1fr); } }
.check { display: inline-flex; align-items: center; gap: var(--s-2); cursor: pointer; user-select: none; }
.check input { inline-size: 18px; block-size: 18px; accent-color: var(--primary); cursor: pointer; margin: 0; }

/* ==========================================================================
   الشارات والرقائق
   ========================================================================== */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px; border-radius: var(--r-full);
  font-size: 12px; font-weight: 700; line-height: 1.5; white-space: nowrap;
  background: var(--slate-bg); color: var(--text-2); border: 1px solid var(--border);
}
.badge-dot::before { content: ''; inline-size: 7px; block-size: 7px; border-radius: 50%; background: currentColor; }
.badge-success { background: var(--success-bg); color: var(--success); border-color: var(--success-border); }
.badge-warning { background: var(--warning-bg); color: var(--warning); border-color: var(--warning-border); }
.badge-danger { background: var(--danger-bg); color: var(--danger); border-color: var(--danger-border); }
.badge-info { background: var(--info-bg); color: var(--info); border-color: var(--info-border); }
.badge-primary { background: var(--primary-50); color: var(--primary-700); border-color: var(--primary-100); }
.badge-violet { background: var(--violet-bg); color: var(--violet); border-color: var(--violet-border); }
.badge-neutral { background: var(--slate-bg); color: var(--text-2); border-color: var(--border); }
.badge-new { background: var(--st-new-bg); color: var(--st-new); border-color: var(--st-new-bd); }
.badge-contacted { background: var(--st-contacted-bg); color: var(--st-contacted); border-color: var(--st-contacted-bd); }
.badge-qualified { background: var(--st-qualified-bg); color: var(--st-qualified); border-color: var(--st-qualified-bd); }
.badge-applied { background: var(--st-applied-bg); color: var(--st-applied); border-color: var(--st-applied-bd); }
.badge-enrolled { background: var(--st-enrolled-bg); color: var(--st-enrolled); border-color: var(--st-enrolled-bd); }
.badge-rejected { background: var(--st-rejected-bg); color: var(--st-rejected); border-color: var(--st-rejected-bd); }

.chip {
  display: inline-flex; align-items: center; gap: 6px; max-width: 100%;
  min-height: 30px; padding: 0 var(--s-3);
  background: var(--primary-50); color: var(--primary-700);
  border: 1px solid var(--primary-100); border-radius: var(--r-full);
  font-size: 12.5px; font-weight: 700;
}
.chip b { font-weight: 600; color: var(--text-2); }
.chip-x {
  display: inline-grid; place-items: center; inline-size: 18px; block-size: 18px; border-radius: 50%;
  border: 0; background: transparent; color: inherit; padding: 0;
}
.chip-x:hover { background: rgba(47, 82, 70, 0.15); }
.chip-x .icon { width: 12px; height: 12px; stroke-width: 2.6; }

/* ==========================================================================
   البطاقات والجداول
   ========================================================================== */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow-xs); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); padding: var(--s-4) var(--s-5); border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.card-title { font-size: 15px; font-weight: 800; color: var(--primary-700); display: flex; align-items: center; gap: var(--s-2); }
.card-sub { font-size: 12.5px; color: var(--text-3); margin-top: 2px; font-weight: 400; font-family: var(--font-body); }
.card-body { padding: var(--s-5); }
.card-body.is-flush { padding: 0; }

.table-wrap { overflow: auto; max-width: 100%; }
.table-wrap.is-scroll-y { max-height: 68vh; }
.table { width: 100%; font-size: 13.5px; }
.table th, .table td { padding: 12px var(--s-4); text-align: start; vertical-align: middle; }
.table thead th {
  position: sticky; top: 0; z-index: 2;
  background: var(--surface-2); color: var(--text-2);
  font-size: 12.5px; font-weight: 700; white-space: nowrap;
  border-bottom: 1px solid var(--border-strong);
}
.table tbody td { border-bottom: 1px solid var(--border); }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr.is-clickable { cursor: pointer; }
.table tbody tr.is-clickable:hover td { background: var(--surface-2); }
.table tbody tr.is-selected td { background: var(--primary-50); }
.table .col-check { inline-size: 44px; padding-inline-end: 0; }
.table .col-num { text-align: end; font-variant-numeric: tabular-nums; }
.table th.col-num { text-align: end; }
.cell-main { font-weight: 700; color: var(--text); }
.cell-sub { font-size: 12px; color: var(--text-3); margin-top: 1px; }
.cell-stack { display: flex; flex-direction: column; min-width: 0; }

.tabs { display: flex; gap: var(--s-1); border-bottom: 1px solid var(--border); overflow-x: auto; }
.tab {
  padding: 10px var(--s-4); border: 0; background: transparent; color: var(--text-3);
  font-weight: 700; font-size: 13.5px; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap;
}
.tab:hover { color: var(--text); }
.tab.is-active { color: var(--primary-700); border-bottom-color: var(--gold); }

.seg { display: inline-flex; padding: 3px; gap: 2px; background: var(--surface-3); border-radius: var(--r-md); }
.seg button {
  min-height: 32px; padding: 0 var(--s-3); border: 0; background: transparent; border-radius: 8px;
  color: var(--text-2); font-weight: 700; font-size: 13px; white-space: nowrap;
}
.seg button:hover { color: var(--text); }
.seg button.is-active { background: var(--surface); color: var(--primary-700); box-shadow: var(--shadow-sm); }

/* ---------- الحالة الفارغة والهياكل العظمية ---------- */
.empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: var(--s-2); padding: var(--s-7) var(--s-5); color: var(--text-3); }
.empty-icon { inline-size: 56px; block-size: 56px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-3); color: var(--text-3); margin-bottom: var(--s-2); }
.empty h3 { font-size: 16px; color: var(--text); }
.empty p { max-width: 420px; font-size: 13.5px; }
.empty .btn { margin-top: var(--s-3); }

.skeleton { position: relative; overflow: hidden; background: var(--surface-3); border-radius: var(--r-sm); min-height: 14px; }
.skeleton::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.7), transparent);
  transform: translateX(100%); animation: shimmer 1.3s infinite;
}
@keyframes shimmer { to { transform: translateX(-100%); } }
.skeleton-line { block-size: 14px; margin: 6px 0; }
.skeleton-box { block-size: 96px; border-radius: var(--r-lg); }

.alert { display: flex; gap: var(--s-3); align-items: flex-start; padding: var(--s-3) var(--s-4); border-radius: var(--r-md); border: 1px solid; font-size: 13.5px; }
.alert-error { background: var(--danger-bg); color: var(--danger); border-color: var(--danger-border); }
.alert-info { background: var(--info-bg); color: var(--info); border-color: var(--info-border); }
.alert-warning { background: var(--warning-bg); color: var(--warning); border-color: var(--warning-border); }

/* ==========================================================================
   النوافذ المنبثقة (modal / drawer / confirm / toast)
   ========================================================================== */
body.has-overlay { overflow: hidden; }
.overlay {
  position: fixed; inset: 0; z-index: var(--z-modal);
  background: rgba(11, 20, 17, 0.58);
  display: flex; align-items: center; justify-content: center; padding: var(--s-4);
  animation: fadeIn 0.18s ease both;
}
.overlay.is-confirm { z-index: var(--z-confirm); }
.overlay.is-drawer { align-items: stretch; justify-content: flex-start; padding: 0; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal {
  inline-size: 100%; max-inline-size: 640px; max-block-size: min(90vh, 880px);
  display: flex; flex-direction: column;
  background: var(--surface); border-radius: var(--r-xl); box-shadow: var(--shadow-lg);
  animation: popIn 0.2s ease both;
}
.modal.is-sm { max-inline-size: 420px; }
.modal.is-lg { max-inline-size: 860px; }
.modal.is-xl { max-inline-size: 1080px; }
@keyframes popIn { from { opacity: 0; transform: translateY(12px) scale(0.98); } to { opacity: 1; transform: none; } }
.modal-head { display: flex; align-items: center; gap: var(--s-3); padding: var(--s-4) var(--s-5); border-bottom: 1px solid var(--border); }
.modal-title { flex: 1; min-width: 0; font-size: 16px; font-weight: 800; }
.modal-body { padding: var(--s-5); overflow-y: auto; flex: 1; }
.modal-foot { display: flex; align-items: center; gap: var(--s-2); padding: var(--s-3) var(--s-5); border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 var(--r-xl) var(--r-xl); }
.modal-foot .spacer { flex: 1; }
.confirm-icon { inline-size: 48px; block-size: 48px; border-radius: 50%; display: grid; place-items: center; margin: 0 auto var(--s-3); background: var(--danger-bg); color: var(--danger); }
.confirm-icon.is-primary { background: var(--primary-50); color: var(--primary); }
.confirm-body { text-align: center; }
.confirm-body h3 { font-size: 16px; margin-bottom: var(--s-1); }
.confirm-body p { color: var(--text-2); font-size: 13.5px; }

.drawer {
  inline-size: min(520px, 100%); block-size: 100%;
  display: flex; flex-direction: column; background: var(--surface);
  box-shadow: var(--shadow-lg); animation: drawerIn 0.24s ease both;
}
.drawer.is-lg { inline-size: min(680px, 100%); }
@keyframes drawerIn { from { transform: translateX(32px); opacity: 0; } to { transform: none; opacity: 1; } }
.drawer .modal-body { padding: var(--s-5); }

.toast-stack {
  position: fixed; inset-block-end: var(--s-5); inset-inline: 0; z-index: var(--z-toast);
  display: flex; flex-direction: column; align-items: center; gap: var(--s-2); pointer-events: none; padding-inline: var(--s-4);
}
.toast {
  pointer-events: auto; display: flex; align-items: center; gap: var(--s-3);
  max-inline-size: min(480px, 100%); padding: 12px var(--s-4);
  background: var(--navy-900); color: #fff; border-radius: var(--r-md);
  box-shadow: var(--shadow-md); font-weight: 600; font-size: 13.5px;
  animation: toastIn 0.25s ease both;
}
.toast .icon { color: var(--gold-light); }
.toast.is-error .icon { color: #fca5a5; }
.toast.is-error { background: #7a1d14; }
.toast.is-leaving { opacity: 0; transform: translateY(8px); transition: opacity 0.3s, transform 0.3s; }
@keyframes toastIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* شاشة الدخول واللافتات ذات الصور: انظر brand.css */
.pwd-wrap { position: relative; }
.pwd-wrap .input { padding-inline-end: 44px; direction: ltr; text-align: start; }
.pwd-wrap .icon-btn { position: absolute; inset-inline-end: 4px; top: 2px; }

/* ==========================================================================
   قوائم الفلاتر المنسدلة (filter select) والتصفح (pagination)
   ========================================================================== */
.fselect { position: relative; }
.fselect-trigger {
  display: inline-flex; align-items: center; gap: var(--s-2);
  min-height: 36px; padding: 0 var(--s-3); max-inline-size: 240px;
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--r-md);
  color: var(--text-2); font-weight: 600; font-size: 13px; white-space: nowrap;
}
.fselect-trigger:hover { border-color: var(--text-3); color: var(--text); }
.fselect-trigger .fselect-value { color: var(--primary-700); font-weight: 800; overflow: hidden; text-overflow: ellipsis; }
.fselect.is-active .fselect-trigger { background: var(--primary-50); border-color: #9db8a9; color: var(--primary-700); }
.fselect.is-open .fselect-trigger { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(47, 82, 70, 0.15); }
.fselect-pop {
  position: absolute; inset-inline-start: 0; top: calc(100% + 6px); z-index: var(--z-popover);
  inline-size: 280px; max-inline-size: calc(100vw - 24px);
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow-md);
  display: flex; flex-direction: column; overflow: hidden; animation: popIn 0.15s ease both;
}
.fselect-search { padding: var(--s-2); border-bottom: 1px solid var(--border); }
.fselect-list { max-block-size: 280px; overflow-y: auto; padding: var(--s-1); margin: 0; list-style: none; }
.fselect-opt {
  display: flex; align-items: center; gap: var(--s-2); inline-size: 100%;
  padding: 8px var(--s-3); border: 0; background: transparent; border-radius: var(--r-sm);
  font-size: 13.5px; text-align: start; color: var(--text);
}
.fselect-opt:hover { background: var(--surface-3); }
.fselect-opt.is-selected { background: var(--primary-50); color: var(--primary-700); font-weight: 700; }
.fselect-opt .fselect-check { inline-size: 18px; block-size: 18px; border: 1.5px solid var(--border-strong); border-radius: 5px; display: grid; place-items: center; flex: none; background: #fff; }
.fselect-opt.is-single .fselect-check { border-radius: 50%; }
.fselect-opt.is-selected .fselect-check { background: var(--primary); border-color: var(--primary); color: #fff; }
.fselect-opt .fselect-check .icon { width: 12px; height: 12px; stroke-width: 3; opacity: 0; }
.fselect-opt.is-selected .fselect-check .icon { opacity: 1; }
.fselect-opt .fselect-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fselect-opt .fselect-count { font-size: 12px; color: var(--text-3); font-variant-numeric: tabular-nums; background: var(--surface-3); padding: 0 7px; border-radius: var(--r-full); }
.fselect-opt.is-zero { opacity: 0.5; }
.fselect-empty { padding: var(--s-4); text-align: center; color: var(--text-3); font-size: 13px; }
.fselect-foot { display: flex; justify-content: space-between; padding: var(--s-2) var(--s-3); border-top: 1px solid var(--border); background: var(--surface-2); }
@media (max-width: 640px) {
  .fselect-pop { position: fixed; inset-inline: 12px; inset-block-end: 12px; top: auto; inline-size: auto; max-inline-size: none; }
  .fselect-list { max-block-size: 50vh; }
}

.pagination { display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); flex-wrap: wrap; padding: var(--s-3) var(--s-4); border-top: 1px solid var(--border); }
.pagination-info { font-size: 13px; color: var(--text-2); }
.pagination-pages { display: flex; gap: var(--s-1); align-items: center; }
.page-btn {
  min-inline-size: 34px; block-size: 34px; padding: 0 8px; border-radius: var(--r-sm);
  border: 1px solid transparent; background: transparent; color: var(--text-2); font-weight: 700; font-size: 13px;
  display: inline-grid; place-items: center;
}
.page-btn:hover:not(:disabled) { background: var(--surface-3); }
.page-btn.is-active { background: var(--primary); color: #fff; }
.page-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.page-gap { color: var(--text-3); padding: 0 4px; }

/* ---------- شريط الإجراءات الجماعية ---------- */
.bulk-bar {
  position: sticky; inset-block-end: var(--s-4); z-index: 15;
  display: flex; align-items: center; gap: var(--s-3); flex-wrap: wrap;
  margin-top: var(--s-4); padding: var(--s-3) var(--s-4);
  background: var(--navy-900); color: #fff; border-radius: var(--r-lg); box-shadow: var(--shadow-md);
  animation: toastIn 0.2s ease both;
}
.bulk-bar .select { min-height: 36px; inline-size: auto; background-color: #fff; }
.bulk-bar b { font-family: var(--font-display); }

/* ---------- الخط الزمني ---------- */
.timeline { list-style: none; margin: 0; padding: 0; position: relative; }
.timeline::before { content: ''; position: absolute; inset-block: 8px; inset-inline-start: 11px; inline-size: 2px; background: var(--border); }
.timeline li { position: relative; padding-inline-start: 36px; padding-block-end: var(--s-4); }
.timeline-dot { position: absolute; inset-inline-start: 0; top: 2px; inline-size: 24px; block-size: 24px; border-radius: 50%; display: grid; place-items: center; background: var(--surface); border: 2px solid var(--border-strong); color: var(--text-3); }
.timeline-dot .icon { width: 12px; height: 12px; stroke-width: 2.6; }
.timeline-dot.is-status { border-color: #9db8a9; color: var(--primary); }
.timeline-dot.is-note { border-color: #fcd34d; color: var(--warning); }
.timeline-text { font-size: 13.5px; }
.timeline-note { margin-top: 4px; padding: var(--s-2) var(--s-3); background: var(--warning-bg); border: 1px solid var(--warning-border); border-radius: var(--r-md); white-space: pre-wrap; word-break: break-word; }
.timeline-meta { font-size: 12px; color: var(--text-3); margin-top: 2px; }

.kv { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s-3) var(--s-4); }
.kv-item { min-width: 0; }
.kv-item dt { font-size: 12px; color: var(--text-3); font-weight: 600; margin-bottom: 2px; }
.kv-item dd { margin: 0; font-weight: 600; word-break: break-word; }
.kv-item.span-2 { grid-column: 1 / -1; }
.section-title { font-size: 13px; font-weight: 800; color: var(--text-2); margin: var(--s-5) 0 var(--s-3); display: flex; align-items: center; gap: var(--s-2); }
.section-title:first-child { margin-top: 0; }
