@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@400;500;600;700;800&display=swap');

:root {
  --primary: #2563eb;
  --primary-dark: #1741a6;
  --primary-soft: #eff6ff;
  --navy: #0f2a4a;
  --gold: #a97416;
  --gold-soft: #f3e2c2;
  --secondary: #64748b;
  --success: #16a34a;
  --success-soft: #dcfce7;
  --warning: #d97706;
  --warning-soft: #fef3c7;
  --danger: #dc2626;
  --danger-soft: #fee2e2;
  --bg: #f4f7fc;
  --card: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --border: #e2e8f0;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow-sm: 0 1px 2px rgba(15, 42, 74, 0.06);
  --shadow-md: 0 8px 24px rgba(15, 42, 74, 0.08);
  --shadow-rich: 0 14px 34px rgba(15, 42, 74, 0.16), 0 3px 10px rgba(169, 116, 22, 0.14);
  --gradient-panel: linear-gradient(160deg, #eaf2ff 0%, #cfe2fb 45%, #9dc4f5 100%);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Cairo', 'Segoe UI', Tahoma, Arial, sans-serif;
  direction: rtl;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  font-size: 15.5px;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ============ شريط التنقّل ============ */
.navbar {
  background: var(--gradient-panel);
  color: var(--navy);
  padding: 1rem 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
  box-shadow: var(--shadow-rich);
  border-bottom: 3px solid var(--gold);
}
.navbar-brand { color: var(--navy); font-size: 1.25rem; font-weight: 800; }
.navbar-nav { display: flex; gap: 0.4rem; list-style: none; flex-wrap: wrap; }
.navbar-nav a {
  color: rgba(15, 42, 74, 0.75);
  padding: 0.55rem 1.1rem;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.92rem;
  background: rgba(255, 255, 255, 0.35);
  transition: background 0.15s, color 0.15s, transform 0.15s, box-shadow 0.15s;
}
.navbar-nav a:hover { background: rgba(255, 255, 255, 0.75); color: var(--navy); text-decoration: none; transform: translateY(-1px); }
.navbar-nav a.active { background: var(--navy); color: #fff; box-shadow: 0 10px 22px rgba(15, 42, 74, 0.28); }
.navbar-user { color: var(--navy); font-size: 0.88rem; display: flex; gap: 0.75rem; align-items: center; font-weight: 600; }
.btn-logout { background: rgba(255,255,255,0.55); border: 1px solid rgba(15,42,74,0.12); color: var(--navy); padding: 0.4rem 0.9rem; border-radius: 999px; cursor: pointer; font-weight: 700; font-family: inherit; }
.btn-logout:hover { background: rgba(255,255,255,0.85); }

.container { max-width: 1400px; margin: 0 auto; padding: 1.5rem; }

.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow-md);
  border: 1px solid rgba(15, 42, 74, 0.04);
  margin-bottom: 1.25rem;
}
.card-title { font-size: 1.2rem; font-weight: 800; margin-bottom: 1rem; color: var(--navy); padding-bottom: 0.75rem; border-bottom: 1px solid var(--border); }

.alert { padding: 0.85rem 1.1rem; border-radius: var(--radius-sm); margin-bottom: 1rem; font-weight: 600; }
.alert-success { background: var(--success-soft); color: #166534; border: 1px solid #bbf7d0; }
.alert-danger { background: var(--danger-soft); color: #991b1b; border: 1px solid #fecaca; }
.alert-info { background: #dbeafe; color: #1e40af; border: 1px solid #bfdbfe; }
.alert-warning { background: var(--warning-soft); color: #92400e; border: 1px solid #fde68a; }

.btn {
  display: inline-block;
  padding: 0.6rem 1.2rem;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-family: inherit;
  border: none;
  cursor: pointer;
  transition: transform 0.12s, box-shadow 0.12s, background 0.15s;
  text-decoration: none;
  font-size: 0.9rem;
}
.btn:hover { transform: translateY(-1px); text-decoration: none; }
.btn-primary { background: var(--primary); color: white; box-shadow: 0 6px 16px rgba(37, 99, 235, 0.28); }
.btn-primary:hover { background: var(--primary-dark); box-shadow: 0 8px 20px rgba(37, 99, 235, 0.34); }
.btn-success { background: var(--success); color: white; }
.btn-success:hover { background: #15803d; }
.btn-secondary { background: #eef2f6; color: var(--navy); }
.btn-secondary:hover { background: #e2e8f0; }
.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { background: #b91c1c; }
.btn-outline { background: white; color: var(--primary); border: 1.5px solid var(--primary); }
.btn-outline:hover { background: var(--primary-soft); }
.btn-sm { padding: 0.35rem 0.8rem; font-size: 0.8rem; }

.form-group { margin-bottom: 1rem; }
.form-label { display: block; margin-bottom: 0.4rem; font-weight: 700; color: var(--navy); font-size: 0.9rem; }
.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 0.65rem 0.9rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.92rem;
  font-family: inherit;
  background: white;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(37,99,235,0.12);
}
.form-textarea { resize: vertical; min-height: 100px; }

table { width: 100%; border-collapse: collapse; }
th, td { padding: 0.7rem 0.85rem; text-align: right; border: 1px solid var(--border); font-size: 0.875rem; vertical-align: middle; }
th { background: #dbe6f7; font-weight: 800; color: var(--navy); white-space: nowrap; font-size: 0.82rem; }
thead th:first-child { border-top-right-radius: var(--radius-sm); }
thead th:last-child { border-top-left-radius: var(--radius-sm); }
tbody tr:nth-child(even) { background: #f6f9fe; }
tbody tr:hover td { background: #dbeafe; }

.badge {
  display: inline-block;
  padding: 0.22rem 0.65rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
}
.badge-green { background: var(--success-soft); color: #166534; }
.badge-blue { background: #dbeafe; color: #1e40af; }
.badge-yellow { background: var(--warning-soft); color: #92400e; }
.badge-red { background: var(--danger-soft); color: #991b1b; }
.badge-gray { background: #f1f5f9; color: #475569; }
.badge-purple { background: #f3e8ff; color: #6b21a8; }

.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1rem; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; }
@media (max-width: 1024px) { .grid-4 { grid-template-columns: repeat(2, 1fr); } .grid-3 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 640px) { .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; } }

.stat-card {
  background: white;
  border-radius: var(--radius);
  padding: 1.25rem;
  border: 1px solid rgba(15, 42, 74, 0.04);
  box-shadow: var(--shadow-sm);
}
.stat-card .label { font-size: 0.85rem; color: var(--muted); margin-bottom: 0.3rem; font-weight: 600; }
.stat-card .value { font-size: 1.85rem; font-weight: 800; color: var(--navy); }

.auth-wrap {
  min-height: 100vh;
  display: flex;
}
.auth-form-side {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1.25rem;
  background: #fff;
}
.auth-brand-side {
  flex: 1;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.25rem;
  padding: 3rem;
  background: var(--gradient-panel);
  color: var(--navy);
  text-align: center;
  position: relative;
  overflow: hidden;
}
.auth-brand-side::before, .auth-brand-side::after {
  content: '';
  position: absolute;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.35);
}
.auth-brand-side::before { width: 260px; height: 260px; top: -80px; inset-inline-end: -80px; }
.auth-brand-side::after { width: 180px; height: 180px; bottom: -60px; inset-inline-start: -60px; background: rgba(255, 255, 255, 0.25); }
.auth-brand-side > * { position: relative; z-index: 1; }
.auth-brand-wordmark { font-size: 2.1rem; font-weight: 800; letter-spacing: -0.5px; }
.auth-brand-tagline { font-size: 0.95rem; color: rgba(15, 42, 74, 0.75); max-width: 320px; }
@media (min-width: 820px) { .auth-brand-side { display: flex; } .auth-form-side { max-width: 50%; } }

.auth-card {
  background: white;
  border-radius: var(--radius);
  padding: 2.5rem;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow-md);
}
.auth-card h2 { text-align: center; margin-bottom: 1.5rem; color: var(--navy); font-size: 1.4rem; font-weight: 800; }

.import-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1rem; }
.import-tile {
  background: white;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  transition: all 0.2s;
  display: block;
  color: inherit;
}
.import-tile:hover { border-color: var(--primary); background: var(--primary-soft); text-decoration: none; transform: translateY(-2px); box-shadow: var(--shadow-md); }
.import-tile h3 { color: var(--primary-dark); margin-bottom: 0.4rem; font-size: 1rem; }
.import-tile p { color: var(--muted); font-size: 0.85rem; }

.flex { display: flex; }
.flex-wrap { flex-wrap: wrap; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.mb-2 { margin-bottom: 1rem; }
.mt-2 { margin-top: 1rem; }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
.strong { font-weight: 700; }

.pagination { display: flex; gap: 0.4rem; justify-content: center; margin-top: 1.25rem; }
.pagination a, .pagination span { padding: 0.45rem 0.8rem; border-radius: 999px; background: white; border: 1px solid var(--border); font-size: 0.85rem; font-weight: 600; }
.pagination .current { background: var(--navy); color: white; border-color: var(--navy); }

@media print {
  .navbar, .btn, form, .no-print { display: none !important; }
  .card { box-shadow: none; border: 1px solid #ccc; }
  body { background: #fff; }
}

/* ===== لوحة التنقّل بأسلوب نظام اللجان (smart-queue-system) ===== */
.container-wide { max-width: 1520px; margin: 0 auto; padding: 16px; }
.card.app-nav {
  background: var(--gradient-panel);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  border: 1px solid rgba(15, 42, 74, 0.06);
  margin-bottom: 20px;
  padding: 18px 22px;
}

/* عمق أوضح + خط جانبي (ذهبي↔أزرق) يميّز لوحة التنقّل الرئيسية عن باقي البطاقات */
.card.app-nav.app-nav-rich {
  box-shadow: var(--shadow-rich);
  border-color: var(--gold-soft);
  position: relative;
}

.card.app-nav.app-nav-rich::before {
  content: '';
  position: absolute;
  inset-inline-start: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  border-start-start-radius: var(--radius);
  border-end-start-radius: var(--radius);
  background: linear-gradient(180deg, var(--gold), var(--primary));
}

.app-nav-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.app-nav-identity p {
  margin: 0 0 2px;
  font-size: 12px;
  font-weight: 600;
  color: rgba(15, 42, 74, 0.65);
}

.app-nav-identity h1 {
  margin: 0 0 2px;
  font-size: 22px;
  color: var(--navy);
}

.app-nav-identity .muted {
  color: rgba(15, 42, 74, 0.65);
}

.app-nav-top .btn.secondary {
  background: rgba(255, 255, 255, 0.65);
  border-color: rgba(15, 42, 74, 0.12);
  color: var(--navy);
}

.app-nav-announcement {
  margin-top: 12px;
  padding: 10px 16px;
  border-radius: 10px;
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.6;
  word-break: break-word;
}

.app-nav-announcement-global {
  background: rgba(15, 42, 74, 0.08);
  color: var(--navy);
  border: 1px solid rgba(15, 42, 74, 0.14);
}

.app-nav-announcement-committee {
  background: var(--gold-soft);
  color: #7a5410;
  border: 1px solid rgba(169, 116, 22, 0.25);
  margin-top: 8px;
}

.app-nav-tabs {
  display: flex;
  justify-content: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 16px;
  border-top: 1px solid rgba(15, 42, 74, 0.14);
  padding-top: 14px;
}

.app-nav-tab {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 15px;
  font-weight: 700;
  color: rgba(15, 42, 74, 0.75);
  text-decoration: none;
  background: rgba(255, 255, 255, 0.35);
  transition: background 0.15s, color 0.15s, transform 0.15s, box-shadow 0.15s;
  position: relative;
}

.app-nav-tab svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.app-nav-tab:hover {
  background: rgba(255, 255, 255, 0.75);
  color: var(--navy);
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}

.app-nav-tab.active {
  background: var(--navy);
  color: #fff;
  box-shadow: 0 10px 22px rgba(15, 42, 74, 0.28);
}

.app-nav-tab.active::after {
  content: '';
  position: absolute;
  bottom: -7px;
  right: 50%;
  transform: translateX(50%);
  width: 20px;
  height: 3px;
  border-radius: 3px;
  background: var(--gold);
}

.app-nav-divider {
  width: 1px;
  align-self: stretch;
  margin: 4px 8px;
  background: rgba(15, 42, 74, 0.16);
}

/* قوائم منسدلة مجمّعة (تُستخدم فقط لما تكون navItems مصنّفة بـgroup - حالياً السوبر أدمن فقط) */
.app-nav-tabs-grouped {
  align-items: flex-start;
}

.app-nav-group {
  position: relative;
}

.app-nav-group-summary {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 15px;
  font-weight: 700;
  color: rgba(15, 42, 74, 0.75);
  background: rgba(255, 255, 255, 0.35);
  cursor: pointer;
  transition: background 0.15s, color 0.15s, transform 0.15s, box-shadow 0.15s;
  list-style: none;
  user-select: none;
  position: relative;
}

.app-nav-group-summary svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.app-nav-group-summary::-webkit-details-marker {
  display: none;
}

.app-nav-group-summary::after {
  content: '▾';
  font-size: 11px;
  transition: transform 0.15s;
}

.app-nav-group[open] > .app-nav-group-summary::after {
  transform: rotate(180deg);
}

.app-nav-group-summary:hover {
  background: rgba(255, 255, 255, 0.75);
  color: var(--navy);
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}

.app-nav-group-summary.active {
  background: var(--navy);
  color: #fff;
  box-shadow: 0 10px 22px rgba(15, 42, 74, 0.28);
}

.app-nav-group-summary.active::before {
  content: '';
  position: absolute;
  bottom: -7px;
  right: 50%;
  transform: translateX(50%);
  width: 20px;
  height: 3px;
  border-radius: 3px;
  background: var(--gold);
}

.app-nav-group-menu {
  position: absolute;
  top: calc(100% + 8px);
  inset-inline-start: 0;
  z-index: 20;
  min-width: 240px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px;
  background: #fff;
  border-radius: 14px;
  box-shadow: var(--shadow-rich);
  border: 1px solid rgba(15, 42, 74, 0.08);
}

.app-nav-group-link {
  display: block;
  padding: 9px 14px;
  border-radius: 9px;
  font-size: 14px;
  font-weight: 600;
  color: rgba(15, 42, 74, 0.82);
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.15s, color 0.15s;
}

.app-nav-group-link:hover {
  background: rgba(15, 42, 74, 0.06);
}

.app-nav-group-link.active {
  background: var(--navy);
  color: #fff;
}

.page-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  align-items: start;
}

@media (min-width: 900px) {
  .page-grid.cols-2 {
    grid-template-columns: 1fr 1fr;
  }
}


.card:not(.app-nav) { overflow-x: auto; } /* لا تقص القوائم المنسدلة للوحة التنقّل */

/* شريط بيئة التطوير */
.dev-banner { background: #f97316; color: #fff; text-align: center; font-weight: 800; padding: .55rem 1rem; font-size: .95rem; position: sticky; top: 0; z-index: 100; box-shadow: 0 2px 8px rgba(0,0,0,.15); }
.dev-banner a { color: #fff; text-decoration: underline; }
