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

:root {
  --primary: #7b1e3a;
  --primary-dark: #5b142a;
  --primary-light: #9d3152;
  --primary-soft: #fbf0f4;
  --accent: #0f766e;
  --accent-dark: #0b5d57;
  --accent-soft: #eaf8f6;
  --navy: #10243f;
  --navy-2: #183b5b;
  --gold: #c89b3c;
  --text: #1e293b;
  --muted: #667085;
  --bg: #f4f7fb;
  --card: #ffffff;
  --border: #dde5ee;
  --border-strong: #c9d4e0;
  --success: #157347;
  --success-bg: #ecf8f2;
  --warning: #946200;
  --warning-bg: #fff8e5;
  --danger: #b42318;
  --danger-bg: #fff1f0;
  --info: #175cd3;
  --info-bg: #eff7ff;
  --shadow-sm: 0 2px 8px rgba(16, 36, 63, .05);
  --shadow: 0 10px 28px rgba(16, 36, 63, .08);
  --shadow-lg: 0 24px 60px rgba(16, 36, 63, .15);
  --radius: 10px;
  --sidebar-width: 272px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  direction: rtl;
  font-family: "Cairo", Tahoma, Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
  font-size: 14px;
  font-weight: 400;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
button { -webkit-tap-highlight-color: transparent; }
img { max-width: 100%; }
.icon { vertical-align: middle; flex: 0 0 auto; }
::selection { background: rgba(123, 30, 58, .18); }

/* Public */
.public-body {
  min-height: 100vh;
  background:
    radial-gradient(circle at 8% 8%, rgba(15, 118, 110, .06), transparent 24%),
    radial-gradient(circle at 92% 4%, rgba(123, 30, 58, .07), transparent 27%),
    var(--bg);
}
.public-topbar {
  min-height: 72px;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(110deg, var(--navy) 0%, var(--navy-2) 62%, #234e70 100%);
  border-bottom: 4px solid var(--primary);
  box-shadow: 0 6px 20px rgba(16, 36, 63, .18);
}
.public-topbar .wrap {
  width: min(1600px, 94%);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}
.brand { display: flex; align-items: center; gap: 12px; font-weight: 800; font-size: 17px; letter-spacing: -.1px; }
.brand img {
  width: 46px;
  height: 46px;
  background: #fff;
  border-radius: 50%;
  padding: 3px;
  border: 2px solid rgba(255,255,255,.65);
  box-shadow: 0 4px 12px rgba(0,0,0,.15);
}
.public-login-link {
  border: 1px solid rgba(255,255,255,.38);
  background: rgba(255,255,255,.08);
  padding: 8px 15px;
  border-radius: 8px;
  font-weight: 700;
  transition: .2s ease;
}
.public-login-link:hover { background: #fff; color: var(--navy); border-color: #fff; transform: translateY(-1px); }
.public-main { width: min(1600px, 94%); margin: 26px auto 48px; }
.hero {
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg, #fff 0%, #fff 58%, #fbf2f5 100%);
  border: 1px solid var(--border);
  border-right: 5px solid var(--primary);
  box-shadow: var(--shadow);
  padding: 24px 26px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  border-radius: var(--radius);
  margin-bottom: 18px;
}
.hero::after {
  content: "";
  position: absolute;
  width: 180px;
  height: 180px;
  left: -70px;
  top: -92px;
  border-radius: 50%;
  background: rgba(15, 118, 110, .06);
}
.hero h1 { position: relative; z-index: 1; margin: 0; color: var(--navy); font-size: 27px; font-weight: 800; }
.hero p { margin: 4px 0 0; color: var(--muted); }
.hero-stat {
  position: relative;
  z-index: 1;
  min-width: 176px;
  text-align: center;
  padding: 13px 18px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 9px;
  box-shadow: var(--shadow-sm);
}
.hero-stat strong { display: block; font-size: 30px; color: var(--primary); line-height: 1.25; font-weight: 800; }
.hero-stat span { color: var(--muted); font-size: 12px; font-weight: 600; }
.filters-card, .data-card { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.filters-card { padding: 18px; margin-bottom: 18px; border-top: 3px solid var(--accent); }
.filters-grid { display: grid; grid-template-columns: repeat(6, minmax(140px, 1fr)); gap: 12px; align-items: end; }
.filter-actions { display: flex; gap: 8px; }
.data-card { overflow: hidden; }
.data-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(90deg, #fff, #f9fbfd);
  gap: 15px;
}
.data-card-header h2 { margin: 0; font-size: 18px; color: var(--navy); font-weight: 800; }
.public-footer { text-align: center; color: var(--muted); padding: 24px; font-size: 12px; }

/* Admin layout */
.admin-body { min-height: 100vh; background: var(--bg); }
.admin-topbar {
  position: fixed;
  top: 0;
  right: var(--sidebar-width);
  left: 0;
  height: 70px;
  z-index: 30;
  background: rgba(255,255,255,.97);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 26px;
  box-shadow: var(--shadow-sm);
  transition: .2s;
}
.admin-topbar::after {
  content: "";
  position: absolute;
  right: 0;
  left: 0;
  bottom: -1px;
  height: 2px;
  background: linear-gradient(90deg, transparent, rgba(123,30,58,.28), transparent);
}
.topbar-title { display: flex; align-items: center; gap: 12px; }
.topbar-title h1 { font-size: 19px; margin: 0; color: var(--navy); font-weight: 800; }
.topbar-user { display: flex; align-items: center; gap: 11px; color: var(--muted); font-size: 12px; }
.topbar-user strong { color: var(--text); display: block; line-height: 1.35; font-size: 13px; font-weight: 800; }
.avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: #fff;
  font-weight: 800;
  box-shadow: 0 4px 12px rgba(123,30,58,.2);
}
.sidebar-toggle { display: none; border: 0; background: transparent; cursor: pointer; padding: 7px; color: var(--navy); }
.admin-sidebar {
  position: fixed;
  top: 0;
  bottom: 0;
  right: 0;
  width: var(--sidebar-width);
  background: linear-gradient(180deg, #10243f 0%, #132d4a 54%, #0d2037 100%);
  color: #d9e2ed;
  z-index: 40;
  overflow-y: auto;
  box-shadow: -8px 0 25px rgba(16,36,63,.12);
  transition: .25s;
}
.admin-sidebar::-webkit-scrollbar { width: 5px; }
.admin-sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,.18); border-radius: 10px; }
.sidebar-brand {
  min-height: 92px;
  padding: 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid rgba(255,255,255,.09);
  background: rgba(255,255,255,.025);
}
.sidebar-brand img {
  width: 51px;
  height: 51px;
  border-radius: 50%;
  background: #fff;
  padding: 3px;
  border: 2px solid rgba(255,255,255,.65);
  box-shadow: 0 5px 14px rgba(0,0,0,.18);
}
.sidebar-brand strong { color: #fff; display: block; font-size: 15px; font-weight: 800; }
.sidebar-brand span { font-size: 12px; color: #aebed0; }
.sidebar-menu { padding: 14px 10px 30px; }
.sidebar-section {
  font-size: 10px;
  color: #8195ac;
  margin: 17px 13px 7px;
  font-weight: 800;
  letter-spacing: .2px;
}
.sidebar-link {
  position: relative;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 12px;
  margin: 3px 0;
  border-radius: 7px;
  color: #d1dbe7;
  transition: .18s ease;
}
.sidebar-link .icon { opacity: .9; }
.sidebar-link:hover { background: rgba(255,255,255,.07); color: #fff; transform: translateX(-2px); }
.sidebar-link.active {
  background: linear-gradient(100deg, var(--primary), #96304f);
  color: #fff;
  box-shadow: 0 7px 18px rgba(91,20,42,.34);
}
.sidebar-link.active::before {
  content: "";
  position: absolute;
  right: -10px;
  top: 9px;
  bottom: 9px;
  width: 3px;
  background: var(--gold);
  border-radius: 4px;
}
.admin-content { margin-right: var(--sidebar-width); padding: 94px 26px 36px; min-height: 100vh; transition: .2s; }
.content-wrap { max-width: 1500px; margin: auto; }
.sidebar-overlay { display: none; }

/* Components */
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.page-head > div:first-child { min-width: 0; }
.page-head h2 { margin: 0; font-size: 23px; color: var(--navy); font-weight: 800; letter-spacing: -.2px; }
.page-head p { margin: 3px 0 0; color: var(--muted); }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  margin-bottom: 18px;
  overflow: hidden;
}
.card:hover { box-shadow: var(--shadow); }
.card-header {
  min-height: 54px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  background: linear-gradient(90deg, #fff, #fafcfe);
}
.card-header h3 { margin: 0; font-size: 16px; color: var(--navy); font-weight: 800; }
.card-body { padding: 19px; }
.stats-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 15px; margin-bottom: 18px; }
.stat-card {
  position: relative;
  overflow: hidden;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 18px;
  display: flex;
  align-items: center;
  gap: 15px;
  transition: .2s ease;
}
.stat-card::after {
  content: "";
  position: absolute;
  width: 74px;
  height: 74px;
  left: -28px;
  top: -34px;
  border-radius: 50%;
  background: rgba(123,30,58,.035);
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.stat-icon {
  width: 52px;
  height: 52px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: var(--primary-soft);
  color: var(--primary);
  border: 1px solid #f1dce4;
}
.stat-icon.green { background: var(--accent-soft); color: var(--accent-dark); border-color: #cfebe7; }
.stat-icon.blue { background: #edf5ff; color: #175cd3; border-color: #d6e8ff; }
.stat-icon.gold { background: #fff8e9; color: #946200; border-color: #f5e4b7; }
.stat-card strong { display: block; font-size: 27px; line-height: 1.25; color: var(--navy); font-weight: 800; }
.stat-card span { color: var(--muted); font-size: 12px; font-weight: 600; }
.grid-2 { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 18px; }
.grid-3 { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 15px; }
.form-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 15px; }
.form-grid.cols-3 { grid-template-columns: repeat(3,minmax(0,1fr)); }
.form-group { min-width: 0; }
.form-group.full { grid-column: 1/-1; }
label { display: block; margin-bottom: 6px; font-weight: 700; color: #344054; font-size: 13px; }
.required::after { content: ' *'; color: var(--danger); }
.form-control {
  width: 100%;
  height: 43px;
  border: 1px solid var(--border-strong);
  border-radius: 7px;
  background: #fff;
  padding: 8px 11px;
  color: var(--text);
  outline: none;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
textarea.form-control { height: auto; min-height: 95px; resize: vertical; }
.form-control:hover { border-color: #b9c7d5; }
.form-control:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(15,118,110,.11); }
.form-control[disabled], .form-control[readonly] { background: #f3f6f9; color: #667085; }
.help-text { display: block; margin-top: 5px; color: var(--muted); font-size: 11px; }
.input-icon { position: relative; }
.input-icon .icon { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); color: #98a2b3; }
.input-icon .form-control { padding-right: 40px; }
.btn {
  min-height: 40px;
  border: 1px solid transparent;
  border-radius: 7px;
  padding: 7px 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  cursor: pointer;
  font-weight: 700;
  transition: .18s ease;
  white-space: nowrap;
  background: #fff;
  box-shadow: 0 1px 2px rgba(16,36,63,.04);
}
.btn:hover { transform: translateY(-1px); box-shadow: 0 5px 13px rgba(16,36,63,.10); }
.btn:active { transform: translateY(0); }
.btn-primary { background: linear-gradient(100deg, var(--primary), var(--primary-light)); color: #fff; border-color: var(--primary); }
.btn-primary:hover { background: linear-gradient(100deg, var(--primary-dark), var(--primary)); }
.btn-accent { background: linear-gradient(100deg, var(--accent), #168e84); color: #fff; border-color: var(--accent); }
.btn-accent:hover { background: var(--accent-dark); }
.btn-secondary { background: #fff; color: var(--navy); border-color: var(--border-strong); }
.btn-secondary:hover { border-color: #aebdcb; background: #f8fafc; }
.btn-success { background: var(--success); color: #fff; border-color: var(--success); }
.btn-danger { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-warning { background: #a96e00; color: #fff; border-color: #a96e00; }
.btn-sm { min-height: 33px; padding: 4px 9px; font-size: 12px; }
.btn-icon { width: 36px; padding: 6px; }
.actions { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.alert { border: 1px solid; border-radius: 8px; padding: 11px 14px; margin-bottom: 14px; display: flex; align-items: flex-start; gap: 10px; font-weight: 600; }
.alert-success { color: var(--success); background: var(--success-bg); border-color: #a9dec3; }
.alert-warning { color: var(--warning); background: var(--warning-bg); border-color: #ecd48e; }
.alert-danger { color: var(--danger); background: var(--danger-bg); border-color: #efb6b1; }
.alert-info { color: var(--info); background: var(--info-bg); border-color: #b8d9ff; }
.badge { display: inline-flex; align-items: center; border-radius: 999px; padding: 3px 9px; font-size: 11px; font-weight: 800; background: #eef2f6; color: #475467; }
.badge-success { background: var(--success-bg); color: var(--success); }
.badge-warning { background: var(--warning-bg); color: var(--warning); }
.badge-danger { background: var(--danger-bg); color: var(--danger); }
.badge-info { background: var(--info-bg); color: var(--info); }
.badge-muted { background: #f2f4f7; color: #667085; }
.table-wrap { width: 100%; overflow: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 11px 12px; border-bottom: 1px solid #e8edf3; text-align: right; vertical-align: middle; white-space: nowrap; }
th {
  background: #f5f8fb;
  color: #3f4d61;
  font-size: 12px;
  font-weight: 800;
  position: sticky;
  top: 0;
  z-index: 1;
  border-bottom: 1px solid #dce5ee;
}
tbody tr { transition: background .12s; }
tbody tr:hover { background: #f9fbfd; }
.table-striped tbody tr:nth-child(even) { background: #fbfcfd; }
.table-striped tbody tr:nth-child(even):hover { background: #f7fafc; }
.empty-state { text-align: center; padding: 44px 20px; color: var(--muted); }
.empty-state .icon { width: 46px; height: 46px; margin-bottom: 10px; color: #a0aec0; }
.pagination { display: flex; align-items: center; justify-content: center; gap: 5px; padding: 16px; flex-wrap: wrap; }
.pagination a, .pagination span { min-width: 35px; height: 35px; display: grid; place-items: center; border: 1px solid var(--border); border-radius: 6px; background: #fff; font-weight: 700; }
.pagination a:hover { border-color: var(--primary); color: var(--primary); }
.pagination .active { background: var(--primary); color: #fff; border-color: var(--primary); }
.filters-inline { display: grid; grid-template-columns: repeat(5,minmax(140px,1fr)); gap: 10px; align-items: end; }
.file-drop {
  border: 2px dashed #bdc9d5;
  border-radius: 10px;
  padding: 26px;
  text-align: center;
  background: linear-gradient(180deg, #fcfdff, #f7fafc);
  transition: .2s ease;
}
.file-drop:hover { border-color: var(--accent); background: var(--accent-soft); }
.file-drop .icon { color: var(--accent); }
.file-drop input { max-width: 100%; }
.file-name { display: block; color: var(--muted); margin-top: 8px; font-size: 12px; }
.step-list { display: grid; grid-template-columns: repeat(3,1fr); gap: 10px; margin-bottom: 18px; }
.step { padding: 10px; border: 1px solid var(--border); background: #fff; border-radius: 7px; text-align: center; color: var(--muted); font-size: 12px; }
.step.active { background: var(--primary-soft); border-color: #e8c9d4; color: var(--primary); font-weight: 800; }
.progress-bar { height: 8px; background: #e7edf3; border-radius: 8px; overflow: hidden; }
.progress-bar span { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), #36a99e); border-radius: inherit; }
.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 20px;
  background:
    radial-gradient(circle at 12% 12%, rgba(15,118,110,.12), transparent 26%),
    radial-gradient(circle at 88% 8%, rgba(123,30,58,.13), transparent 28%),
    linear-gradient(145deg, #eef3f8 0%, #f8fafc 56%, #edf2f7 100%);
}
.login-card {
  width: min(430px,100%);
  background: #fff;
  border: 1px solid rgba(201,212,224,.85);
  border-top: 4px solid var(--primary);
  box-shadow: var(--shadow-lg);
  border-radius: 12px;
  overflow: hidden;
}
.login-head {
  position: relative;
  overflow: hidden;
  background: linear-gradient(120deg, var(--navy), var(--navy-2));
  color: #fff;
  text-align: center;
  padding: 28px 20px 25px;
}
.login-head::after {
  content: "";
  position: absolute;
  width: 120px;
  height: 120px;
  border-radius: 50%;
  left: -48px;
  top: -58px;
  background: rgba(255,255,255,.06);
}
.login-head img { width: 73px; height: 73px; border-radius: 50%; background: #fff; padding: 4px; border: 2px solid rgba(255,255,255,.65); box-shadow: 0 6px 16px rgba(0,0,0,.16); }
.login-head h1 { position: relative; z-index: 1; font-size: 21px; margin: 10px 0 2px; font-weight: 800; }
.login-head p { position: relative; z-index: 1; margin: 0; color: #c4cfdb; font-size: 13px; }
.login-body { padding: 25px; }
.login-footer { text-align: center; border-top: 1px solid var(--border); padding: 13px; color: var(--muted); font-size: 12px; }
.note-box { background: #f8fafc; border-right: 4px solid var(--accent); padding: 12px 14px; margin: 12px 0; border-radius: 6px; }
.format-rules { display: flex; flex-wrap: wrap; gap: 7px; margin: 13px 0 0; }
.format-rules span { padding: 6px 10px; border: 1px solid var(--border); background: #f8fafc; color: #475467; border-radius: 999px; font-size: 11px; font-weight: 700; }
.kv-list { display: grid; grid-template-columns: 180px 1fr; }
.kv-list > div { padding: 10px 11px; border-bottom: 1px solid var(--border); }
.kv-list .key { background: #f7f9fc; font-weight: 800; color: #475467; }

@media (max-width: 1200px) {
  .filters-grid { grid-template-columns: repeat(3,1fr); }
  .stats-grid { grid-template-columns: repeat(2,1fr); }
  .filters-inline { grid-template-columns: repeat(3,1fr); }
}
@media (max-width: 900px) {
  .admin-sidebar { transform: translateX(110%); }
  .admin-body.sidebar-open .admin-sidebar { transform: translateX(0); }
  .admin-topbar { right: 0; padding: 0 14px; }
  .admin-content { margin-right: 0; padding: 86px 14px 25px; }
  .sidebar-toggle { display: inline-grid; place-items: center; }
  .sidebar-overlay { position: fixed; inset: 0; background: rgba(15,23,42,.48); z-index: 35; }
  .admin-body.sidebar-open .sidebar-overlay { display: block; }
  .grid-2, .grid-3, .form-grid.cols-3 { grid-template-columns: 1fr; }
  .hero { align-items: flex-start; }
  .filters-grid { grid-template-columns: repeat(2,1fr); }
  .topbar-user span { display: none; }
}
@media (max-width: 620px) {
  body { font-size: 13px; }
  .public-main { width: 94%; margin-top: 15px; }
  .public-topbar { min-height: 66px; }
  .public-topbar .wrap { width: 94%; }
  .brand { font-size: 14px; }
  .brand img { width: 39px; height: 39px; }
  .hero { padding: 18px; display: block; border-right-width: 4px; }
  .hero h1 { font-size: 20px; }
  .hero-stat { margin-top: 15px; min-width: 0; }
  .filters-grid, .filters-inline, .form-grid { grid-template-columns: 1fr; }
  .filter-actions .btn { flex: 1; }
  .stats-grid { grid-template-columns: 1fr; }
  .page-head { display: block; }
  .page-head h2 { font-size: 20px; }
  .page-actions { margin-top: 10px; }
  .page-actions .btn { flex: 1; }
  .card-body { padding: 14px; }
  .data-card-header { align-items: flex-start; flex-direction: column; }
  .public-login-link { padding: 6px 10px; font-size: 12px; }
  .step-list { grid-template-columns: 1fr; }
  .kv-list { grid-template-columns: 1fr; }
  .kv-list .key { border-bottom: 0; padding-bottom: 3px; }
  .kv-list > div:not(.key) { padding-top: 3px; }
  .mobile-card-table thead { display: none; }
  .mobile-card-table, .mobile-card-table tbody, .mobile-card-table tr, .mobile-card-table td { display: block; width: 100%; }
  .mobile-card-table tr { border: 1px solid var(--border); border-radius: 8px; margin: 10px; width: calc(100% - 20px); padding: 9px 11px; background: #fff !important; box-shadow: var(--shadow-sm); }
  .mobile-card-table td { white-space: normal; border: 0; padding: 5px 0; display: flex; justify-content: space-between; gap: 15px; }
  .mobile-card-table td::before { content: attr(data-label); font-weight: 800; color: #667085; }
}
