/* =====================================================================
   تكتل الفتح الرباني — نظام التصميم (الزمردي الليلي والذهب العتيق)
   ===================================================================== */
:root {
  --emerald-deep: #03201e;
  --emerald: #073832;
  --green: #0b4a41;
  --green-2: #126356;
  --gold: #c4ae84;
  --gold-deep: #9e8a67;
  --gold-light: #e7d7b5;
  --gold-soft: #f5eedf;
  --bg: #f7f4ec;
  --card: #ffffff;
  --ink: #142622;
  --muted: #5d6e69;
  --line: #e6dfd0;
  --red: #b3261e;
  --radius: 16px;
  --shadow: 0 2px 6px rgba(3, 32, 30, 0.05), 0 10px 26px rgba(3, 32, 30, 0.07);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: "Tajawal", system-ui, -apple-system, sans-serif;
  background:
    radial-gradient(900px 500px at 100% -5%, rgba(18, 99, 86, 0.08) 0%, transparent 60%),
    radial-gradient(700px 420px at 0% 100%, rgba(196, 174, 132, 0.14) 0%, transparent 60%),
    var(--bg);
  color: var(--ink);
  font-size: 16px;
  min-height: 100dvh;
}
a { color: var(--green-2); }
.loading { padding: 48px 20px; text-align: center; color: var(--muted); font-weight: 500; }

/* =====================================================================
   الافتتاحية الحركية (Animated Splash Screen)
   ===================================================================== */
.splash {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 24px;
  background: radial-gradient(circle at 50% 42%, #083b35 0%, #03201e 58%, #021514 100%);
  color: var(--gold-light);
  overflow: hidden;
  transition: opacity 0.55s ease, transform 0.55s ease;
}
.splash.is-hidden { display: none !important; }
.splash.leaving { opacity: 0; transform: scale(1.03); pointer-events: none; }

.splash-aura {
  position: absolute;
  width: min(82vw, 480px);
  height: min(82vw, 480px);
  border-radius: 50%;
  background: radial-gradient(circle, rgba(196, 174, 132, 0.22) 0%, rgba(196, 174, 132, 0.04) 48%, transparent 72%);
  animation: pulseRing 3.4s ease-in-out infinite;
  pointer-events: none;
}

.splash-motes { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.splash-motes span {
  position: absolute;
  bottom: -12px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--gold-light);
  box-shadow: 0 0 10px rgba(231, 215, 181, 0.9);
  opacity: 0;
  animation: floatMote 4.8s ease-in infinite;
}
.splash-motes span:nth-child(1)  { left: 8%;  animation-delay: 0.1s; animation-duration: 4.5s; }
.splash-motes span:nth-child(2)  { left: 16%; animation-delay: 1.2s; animation-duration: 5.1s; width: 4px; height: 4px; }
.splash-motes span:nth-child(3)  { left: 24%; animation-delay: 0.5s; animation-duration: 4.2s; }
.splash-motes span:nth-child(4)  { left: 32%; animation-delay: 1.8s; animation-duration: 5.4s; width: 6px; height: 6px; }
.splash-motes span:nth-child(5)  { left: 40%; animation-delay: 0.3s; animation-duration: 4.6s; }
.splash-motes span:nth-child(6)  { left: 48%; animation-delay: 1.5s; animation-duration: 4.9s; width: 4px; height: 4px; }
.splash-motes span:nth-child(7)  { left: 56%; animation-delay: 0.8s; animation-duration: 5.2s; }
.splash-motes span:nth-child(8)  { left: 64%; animation-delay: 2.0s; animation-duration: 4.4s; width: 6px; height: 6px; }
.splash-motes span:nth-child(9)  { left: 72%; animation-delay: 0.2s; animation-duration: 5.0s; }
.splash-motes span:nth-child(10) { left: 80%; animation-delay: 1.4s; animation-duration: 4.7s; width: 4px; height: 4px; }
.splash-motes span:nth-child(11) { left: 88%; animation-delay: 0.7s; animation-duration: 5.3s; }
.splash-motes span:nth-child(12) { left: 93%; animation-delay: 1.9s; animation-duration: 4.5s; }
.splash-motes span:nth-child(13) { left: 20%; animation-delay: 2.4s; animation-duration: 5.6s; width: 3px; height: 3px; }
.splash-motes span:nth-child(14) { left: 76%; animation-delay: 2.2s; animation-duration: 5.5s; width: 3px; height: 3px; }

.splash-stage {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  max-width: 420px;
}

.splash-crest {
  position: relative;
  width: 240px;
  height: 240px;
  display: grid;
  place-items: center;
  margin-bottom: 10px;
}
.splash-mandala {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.mandala-outer {
  transform-origin: 130px 130px;
  animation: spinSlow 46s linear infinite, drawStar 1.4s ease-out both;
  stroke-dasharray: 760;
}
.mandala-inner {
  transform-origin: 130px 130px;
  animation: spinReverse 34s linear infinite;
}

.splash-emblem {
  position: relative;
  width: 158px;
  height: 158px;
  border-radius: 50%;
  padding: 6px;
  background: radial-gradient(circle, #06312d 0%, #03201e 74%);
  border: 1.5px solid rgba(196, 174, 132, 0.52);
  box-shadow: 0 0 0 6px rgba(196, 174, 132, 0.08), 0 18px 46px rgba(0, 0, 0, 0.55);
  overflow: hidden;
  animation: emblemIn 0.9s cubic-bezier(0.22, 1, 0.36, 1) both;
}
.splash-emblem img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  display: block;
}
.shimmer {
  position: absolute;
  inset: 0;
  background: linear-gradient(115deg, transparent 32%, rgba(231, 215, 181, 0.28) 50%, transparent 68%);
  transform: translateX(-130%);
  animation: shimmerSweep 2.6s ease-in-out 0.6s infinite;
  pointer-events: none;
}

.splash-talbiyah {
  font-family: "Amiri", serif;
  font-size: 22px;
  color: var(--gold);
  letter-spacing: 0.4px;
  margin-top: 6px;
  opacity: 0;
  animation: fadeUp 0.7s ease 0.35s forwards;
}
.splash-title {
  font-size: 28px;
  font-weight: 800;
  color: #fff;
  margin-top: 4px;
  opacity: 0;
  animation: fadeUp 0.7s ease 0.55s forwards;
}
.splash-sub {
  font-size: 15px;
  color: rgba(231, 215, 181, 0.85);
  margin-top: 4px;
  opacity: 0;
  animation: fadeUp 0.7s ease 0.75s forwards;
}
.splash-bar {
  width: 170px;
  height: 3px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.14);
  overflow: hidden;
  margin-top: 22px;
  opacity: 0;
  animation: fadeUp 0.4s ease 0.7s forwards;
}
.splash-bar span {
  display: block;
  height: 100%;
  width: 0;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--gold-deep), var(--gold-light), var(--gold));
  animation: barFill 1.85s cubic-bezier(0.4, 0, 0.2, 1) 0.35s forwards;
}

.splash-skip {
  position: absolute;
  bottom: max(22px, env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%);
  background: rgba(255, 255, 255, 0.08);
  color: rgba(231, 215, 181, 0.85);
  border: 1px solid rgba(196, 174, 132, 0.28);
  border-radius: 99px;
  padding: 6px 16px;
  font: inherit;
  font-size: 13px;
  cursor: pointer;
  backdrop-filter: blur(6px);
}
.splash-skip:hover { background: rgba(196, 174, 132, 0.18); }

/* =====================================================================
   شاشة الدخول واختيار القسم (Animated Hero + Elevated Card)
   ===================================================================== */
.login-shell {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-bottom: 32px;
}
.login-hero {
  position: relative;
  width: 100%;
  padding: max(28px, env(safe-area-inset-top)) 20px 64px;
  background: radial-gradient(circle at 50% 35%, #0a423b 0%, #03201e 72%);
  color: #fff;
  text-align: center;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.login-hero::after {
  content: "";
  position: absolute;
  inset: auto -10% -26px -10%;
  height: 52px;
  background: var(--bg);
  border-radius: 50% 50% 0 0 / 100% 100% 0 0;
}
.login-hero .hero-mandala {
  position: absolute;
  top: -36px;
  left: 50%;
  transform: translateX(-50%);
  width: 310px;
  height: 310px;
  opacity: 0.35;
  pointer-events: none;
}
.login-hero .hero-mandala g {
  transform-origin: 130px 130px;
  animation: spinSlow 60s linear infinite;
}
.login-crest {
  position: relative;
  z-index: 2;
  width: 126px;
  height: 126px;
  border-radius: 50%;
  padding: 5px;
  background: radial-gradient(circle, #06312d 0%, #03201e 76%);
  border: 1.5px solid rgba(196, 174, 132, 0.65);
  box-shadow: 0 0 0 6px rgba(196, 174, 132, 0.1), 0 14px 34px rgba(0, 0, 0, 0.42);
  overflow: hidden;
  margin-bottom: 12px;
  animation: emblemIn 0.7s ease both;
}
.login-crest img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; display: block; }
.login-hero .talbiyah {
  position: relative;
  z-index: 2;
  font-family: "Amiri", serif;
  color: var(--gold);
  font-size: 19px;
}
.login-hero h1 {
  position: relative;
  z-index: 2;
  color: #fff;
  margin: 4px 0 4px;
  font-size: 26px;
}
.login-hero h1::after { display: none; }
.login-hero .hero-sub {
  position: relative;
  z-index: 2;
  color: rgba(231, 215, 181, 0.85);
  font-size: 14px;
  margin: 0;
}

.login-card {
  position: relative;
  z-index: 3;
  width: min(430px, calc(100% - 28px));
  margin: -34px auto 0;
  background: var(--card);
  border: 1px solid var(--line);
  border-top: 4px solid var(--gold);
  border-radius: 20px;
  padding: 24px 20px 22px;
  box-shadow: 0 14px 36px rgba(3, 32, 30, 0.12);
  animation: fadeUp 0.5s ease 0.1s both;
}
.login-card h2 { margin-top: 0; text-align: center; color: var(--emerald-deep); }
.login { max-width: 430px; margin: 6vh auto; border-top: 4px solid var(--gold); }
.replay-link {
  display: block;
  margin: 14px auto 0;
  background: none;
  border: 0;
  color: var(--muted);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}
.replay-link:hover { color: var(--green); }

.mode-btn {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  text-align: right;
  padding: 16px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: #fbf9f4;
  cursor: pointer;
  font: inherit;
  margin-top: 10px;
  transition: transform 0.12s, border-color 0.15s, box-shadow 0.15s;
}
.mode-btn:hover { transform: translateY(-2px); border-color: var(--gold); box-shadow: var(--shadow); }
.mode-btn .m-ico {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-size: 24px;
  background: linear-gradient(135deg, var(--emerald-deep), var(--green-2));
  color: var(--gold-light);
  flex-shrink: 0;
}
.mode-btn.pilgrim-choice .m-ico { background: linear-gradient(135deg, var(--gold-deep), var(--gold)); color: var(--emerald-deep); }
.mode-btn b { display: block; font-size: 17px; color: var(--ink); }
.mode-btn span.muted { font-size: 13px; }

/* =====================================================================
   الشريط العلوي والقائمة الجانبية
   ===================================================================== */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 10px;
  background:
    linear-gradient(135deg, rgba(3, 32, 30, 0.98), rgba(11, 74, 65, 0.96)),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='44' height='44'%3E%3Cpath d='M22 2l5 15 15 5-15 5-5 15-5-15-15-5 15-5z' fill='%23c4ae84' fill-opacity='.12'/%3E%3C/svg%3E");
  color: #fff;
  padding: 10px 14px;
  padding-top: max(10px, env(safe-area-inset-top));
  border-bottom: 2px solid rgba(196, 174, 132, 0.45);
  box-shadow: 0 4px 16px rgba(3, 32, 30, 0.16);
}
.brand {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 17px;
  color: #fff;
}
.brand-logo {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  object-fit: cover;
  border: 1.5px solid var(--gold);
  background: var(--emerald-deep);
  flex-shrink: 0;
}
.icon-btn {
  background: rgba(255, 255, 255, 0.1);
  color: var(--gold-light);
  border: 1px solid rgba(196, 174, 132, 0.24);
  border-radius: 10px;
  width: 40px;
  height: 40px;
  font-size: 18px;
  cursor: pointer;
}
.icon-btn:hover { background: rgba(196, 174, 132, 0.22); }

.nav-backdrop {
  position: fixed;
  inset: 0;
  z-index: 28;
  background: rgba(3, 32, 30, 0.48);
  backdrop-filter: blur(2px);
}
.sidenav {
  position: fixed;
  inset: 0 0 0 auto;
  width: 278px;
  background: #fff;
  z-index: 30;
  padding: 14px;
  overflow: auto;
  box-shadow: -8px 0 30px rgba(3, 32, 30, 0.18);
  transform: translateX(100%);
  transition: transform 0.22s ease;
}
.sidenav.open { transform: none; }
.sidenav .who {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 12px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--emerald-deep), var(--green));
  color: #fff;
  margin-bottom: 12px;
  border: 1px solid rgba(196, 174, 132, 0.35);
}
.sidenav .who img {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  object-fit: cover;
  border: 1.5px solid var(--gold);
  flex-shrink: 0;
}
.sidenav .who b { display: block; font-size: 15px; }
.sidenav .who .muted { color: var(--gold-light); font-size: 12px; }

.sidenav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 12px;
  border-radius: 11px;
  text-decoration: none;
  color: var(--ink);
  font-weight: 500;
  margin-bottom: 3px;
  border-right: 3px solid transparent;
  transition: background 0.12s, color 0.12s;
}
.sidenav a:hover { background: #f2f7f5; color: var(--green); }
.sidenav a.active {
  background: #eaf3ef;
  color: var(--emerald-deep);
  font-weight: 700;
  border-right-color: var(--gold-deep);
}

@media (min-width: 900px) {
  .sidenav { transform: none; top: 62px; box-shadow: none; border-left: 1px solid var(--line); }
  #menuBtn, .nav-backdrop { display: none !important; }
  body.has-nav main { margin-right: 278px; }
}

/* =====================================================================
   المحتوى العام والبطاقات والجداول والأزرار
   ===================================================================== */
main { padding: 18px 16px 36px; max-width: 1120px; margin: 0 auto; }
h1 { font-size: 23px; font-weight: 800; letter-spacing: -0.2px; margin: 6px 0 14px; color: var(--emerald-deep); }
h1::after { content: ""; display: block; width: 46px; height: 4px; border-radius: 4px; background: linear-gradient(90deg, var(--gold-deep), var(--gold)); margin-top: 7px; }
.row h1::after { display: none; }
h2 { font-size: 18px; margin: 18px 0 10px; color: var(--emerald); }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: var(--shadow);
  transition: transform 0.14s ease, box-shadow 0.14s ease;
}
a.card:hover, .card[data-open]:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 28px rgba(3, 32, 30, 0.12);
}

.grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.stat { text-align: center; position: relative; overflow: hidden; border-top: 3px solid var(--gold); }
.stat b { display: block; font-size: 34px; font-weight: 800; color: var(--emerald-deep); }
.stat::after { content: ""; position: absolute; inset: auto -20px -30px auto; width: 92px; height: 92px; border-radius: 50%; background: var(--gold-soft); z-index: 0; }
.stat > * { position: relative; z-index: 1; }

.muted { color: var(--muted); font-size: 14px; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.spacer { flex: 1; }

label { display: block; font-size: 14px; color: var(--muted); margin: 10px 0 4px; font-weight: 500; }
input, select, textarea {
  width: 100%;
  padding: 12px 13px;
  border: 1px solid var(--line);
  border-radius: 12px;
  font: inherit;
  background: #fff;
  color: var(--ink);
}
textarea { min-height: 100px; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--green-2); border-color: transparent; }
.form-grid { display: grid; gap: 0 12px; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }

.btn {
  border: 0;
  border-radius: 12px;
  padding: 11px 18px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  background: linear-gradient(135deg, var(--emerald-deep), var(--green));
  color: #fff;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  box-shadow: 0 2px 8px rgba(3, 32, 30, 0.14);
  transition: filter 0.12s, transform 0.06s;
}
.btn:hover { filter: brightness(1.08); }
.btn:active { transform: scale(0.98); }
.btn.secondary { background: #eaf3ef; color: var(--emerald-deep); box-shadow: none; }
.btn.danger { background: #fbeaea; color: var(--red); box-shadow: none; }
.btn.small { padding: 7px 13px; font-size: 14px; border-radius: 10px; }
.btn:disabled { opacity: 0.5; cursor: wait; }
.btn.block { width: 100%; margin-top: 14px; }

table { width: 100%; border-collapse: collapse; background: #fff; border-radius: var(--radius); overflow: hidden; }
th, td { padding: 11px 10px; border-bottom: 1px solid var(--line); text-align: right; font-size: 15px; }
th { background: #f2ede0; font-weight: 700; font-size: 14px; color: var(--emerald-deep); }
tr:hover td { background: #fbf9f4; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }

.badge { display: inline-block; padding: 3px 10px; border-radius: 99px; background: #eaf3ef; color: var(--emerald); font-size: 13px; font-weight: 700; }
.badge.gold { background: var(--gold-soft); color: #7c6438; }
.badge.red { background: #fbeaea; color: var(--red); }

.otp { letter-spacing: 10px; text-align: center; font-size: 24px; direction: ltr; font-weight: 800; }
.ltr { direction: ltr; text-align: left; }

.person { display: flex; gap: 12px; align-items: center; }
.avatar {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: #e6efe9;
  border: 2px solid rgba(196, 174, 132, 0.55);
  display: grid;
  place-items: center;
  font-weight: 800;
  color: var(--emerald);
  flex-shrink: 0;
  overflow: hidden;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.list-item { display: flex; gap: 12px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line); }
.list-item:last-child { border-bottom: 0; }
.notif.unread { border-right: 4px solid var(--gold); }

.tabs { display: flex; gap: 6px; overflow-x: auto; margin-bottom: 12px; padding-bottom: 2px; }
.tabs button { flex-shrink: 0; }

.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--emerald-deep);
  color: #fff;
  border: 1px solid rgba(196, 174, 132, 0.45);
  padding: 12px 20px;
  border-radius: 14px;
  z-index: 60;
  max-width: 90vw;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
}
.toast.error { background: var(--red); border-color: transparent; }

dialog { border: 0; border-radius: 18px; padding: 0; width: min(640px, 94vw); box-shadow: 0 24px 60px rgba(3, 32, 30, 0.3); }
dialog::backdrop { background: rgba(3, 32, 30, 0.52); backdrop-filter: blur(3px); }
dialog .dlg-body { padding: 20px; max-height: 80vh; overflow: auto; }
dialog .dlg-err { margin: 0 20px 12px; padding: 10px 14px; border-radius: 10px; background: #fbeaea; color: var(--red); border: 1px solid rgba(179, 38, 30, 0.28); font-size: 14px; font-weight: 700; }
dialog .dlg-foot { padding: 12px 20px; border-top: 1px solid var(--line); display: flex; gap: 8px; justify-content: flex-start; background: #fbf9f4; }

/* =====================================================================
   واجهة الحاج الفاخرة والواضحة لكبار السن
   ===================================================================== */
.pilgrim-hero {
  position: relative;
  overflow: hidden;
  border-radius: 20px;
  padding: 18px;
  margin-bottom: 12px;
  background:
    radial-gradient(circle at 0% 0%, rgba(196, 174, 132, 0.16), transparent 55%),
    linear-gradient(135deg, #03201e 0%, #0b4a41 100%);
  color: #fff;
  border: 1px solid rgba(196, 174, 132, 0.45);
  box-shadow: 0 14px 32px rgba(3, 32, 30, 0.18);
}
.pilgrim-hero .hero-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 12px;
  font-size: 13px;
  color: var(--gold-light);
}
.pilgrim-hero .stage-pill {
  padding: 4px 12px;
  border-radius: 99px;
  background: rgba(196, 174, 132, 0.2);
  border: 1px solid rgba(196, 174, 132, 0.45);
  color: var(--gold-light);
  font-weight: 700;
  font-size: 13px;
}
.pilgrim-hero .avatar {
  width: 68px;
  height: 68px;
  border-color: var(--gold);
  background: rgba(255, 255, 255, 0.12);
  color: var(--gold-light);
}
.pilgrim-hero .group-tag {
  display: inline-block;
  margin-top: 4px;
  padding: 3px 10px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font-size: 14px;
}

.sos-banner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: linear-gradient(135deg, #991b1b, #c8231d);
  color: #fff;
  text-decoration: none;
  font-size: 20px;
  font-weight: 800;
  padding: 18px 16px;
  border-radius: 18px;
  margin-bottom: 12px;
  box-shadow: 0 10px 24px rgba(179, 38, 30, 0.26);
  border: 1px solid rgba(255, 255, 255, 0.2);
}
.sos-banner:hover { filter: brightness(1.06); }
.sos-dot { display: inline-grid; place-items: center; animation: sosPulse 1.8s ease-in-out infinite; }

.next-card { border-right: 5px solid var(--gold); background: linear-gradient(135deg, #fffdf8, #ffffff); }

.qr-pass {
  text-align: center;
  padding: 0;
  overflow: hidden;
  border: 1px solid rgba(196, 174, 132, 0.55);
}
.qr-pass-head {
  background: linear-gradient(135deg, var(--emerald-deep), var(--green));
  color: var(--gold-light);
  padding: 10px 14px;
  font-weight: 700;
  font-size: 15px;
  border-bottom: 2px solid var(--gold);
}
.qr-pass-body { padding: 18px; }
.qr-frame {
  display: inline-block;
  padding: 12px;
  border-radius: 16px;
  background: #fff;
  border: 1px solid var(--line);
  box-shadow: 0 4px 14px rgba(3, 32, 30, 0.08);
  margin: 10px auto;
}

body.pilgrim { font-size: 18px; }
body.pilgrim .btn { padding: 14px 20px; font-size: 17px; }
body.pilgrim .btn.small { padding: 10px 14px; font-size: 16px; }
body.pilgrim h1 { font-size: 26px; }
body.pilgrim h2 { font-size: 21px; }
body.pilgrim .muted { font-size: 15px; }
body.pilgrim .list-item { padding: 14px 0; }

/* شريط التنقل السفلي للحاج على الجوال */
.bottombar { display: none; }
@media (max-width: 899px) {
  body.pilgrim .bottombar {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    position: fixed;
    bottom: 0;
    inset-inline: 0;
    z-index: 25;
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(10px);
    border-top: 1px solid var(--line);
    padding-bottom: env(safe-area-inset-bottom);
    box-shadow: 0 -6px 22px rgba(3, 32, 30, 0.08);
  }
  body.pilgrim .bottombar a {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 8px 2px;
    text-decoration: none;
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
  }
  body.pilgrim .bottombar a span { font-size: 23px; }
  body.pilgrim .bottombar a.active { color: var(--emerald-deep); }
  body.pilgrim .bottombar a.sos { color: var(--red); }
  body.pilgrim main { padding-bottom: 98px; }
}

/* =====================================================================
   الحركات (Keyframes) وإتاحة تقليل الحركة
   ===================================================================== */
@keyframes spinSlow { to { transform: rotate(360deg); } }
@keyframes spinReverse { to { transform: rotate(-360deg); } }
@keyframes drawStar { from { stroke-dashoffset: 760; } to { stroke-dashoffset: 0; } }
@keyframes emblemIn { from { opacity: 0; transform: scale(0.84); } to { opacity: 1; transform: scale(1); } }
@keyframes fadeUp { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: translateY(0); } }
@keyframes shimmerSweep {
  0% { transform: translateX(-140%); }
  45%, 100% { transform: translateX(160%); }
}
@keyframes floatMote {
  0% { opacity: 0; transform: translateY(0) scale(0.7); }
  20% { opacity: 0.75; }
  80% { opacity: 0.4; }
  100% { opacity: 0; transform: translateY(-75vh) scale(1.1); }
}
@keyframes barFill { from { width: 0%; } to { width: 100%; } }
@keyframes pulseRing {
  0%, 100% { transform: scale(0.95); opacity: 0.7; }
  50% { transform: scale(1.06); opacity: 1; }
}
@keyframes sosPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.15); }
}

@media (prefers-reduced-motion: reduce) {
  .splash-aura, .splash-motes span, .mandala-outer, .mandala-inner, .shimmer, .sos-dot,
  .login-hero .hero-mandala g { animation: none !important; }
}

/* =====================================================================
   واجهة الذكاء الاصطناعي (البطاقات والمحادثة ومسح الجواز)
   ===================================================================== */
.ai-card { border-top: 3px solid var(--gold); background: linear-gradient(135deg, #fffdf9, #ffffff); }
.ai-promo-card {
  text-decoration: none;
  color: var(--ink);
  border-right: 5px solid var(--gold);
  background: linear-gradient(135deg, #f3f9f6, #ffffff);
}
.ai-chips { display: flex; gap: 8px; flex-wrap: wrap; }
.ai-reply {
  margin-top: 12px;
  padding: 14px;
  border-radius: 14px;
  background: #f5f9f7;
  border: 1px solid #d7e6df;
  line-height: 1.7;
}
.ai-chat { display: flex; flex-direction: column; gap: 10px; margin-bottom: 12px; }
.ai-msg { padding: 14px 16px; border-radius: 16px; max-width: 92%; line-height: 1.7; box-shadow: var(--shadow); }
.ai-msg.user {
  align-self: flex-start;
  background: linear-gradient(135deg, var(--emerald-deep), var(--green));
  color: #fff;
  border-bottom-right-radius: 4px;
}
.ai-msg.bot {
  align-self: flex-end;
  background: #fff;
  border: 1px solid var(--line);
  border-right: 4px solid var(--gold);
  border-bottom-left-radius: 4px;
}
.scan-box {
  padding: 12px;
  margin-bottom: 12px;
  border-radius: 14px;
  background: #f4f8f6;
  border: 1px dashed var(--gold-deep);
}

@media print {
  .splash, .topbar, .sidenav, .bottombar, .nav-backdrop { display: none !important; }
}

/* =====================================================================
   تبويبات الدخول وكلمة المرور + الدخول السريع للتجربة + شبكة الصلاحيات
   ===================================================================== */
.login-tabs {
  display: flex;
  gap: 6px;
  background: #f1ece0;
  padding: 4px;
  border-radius: 12px;
  margin-bottom: 14px;
}
.login-tab {
  flex: 1;
  border: 0;
  background: transparent;
  padding: 9px 10px;
  border-radius: 9px;
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  color: var(--muted);
  cursor: pointer;
  transition: background 0.14s, color 0.14s, box-shadow 0.14s;
}
.login-tab.active {
  background: #fff;
  color: var(--emerald-deep);
  box-shadow: 0 1px 4px rgba(3, 32, 30, 0.1);
}

.pass-wrap { position: relative; }
.pass-wrap input { padding-right: 44px; }
.pass-toggle {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  border: 0;
  background: transparent;
  font-size: 18px;
  cursor: pointer;
  padding: 6px 8px;
  color: var(--muted);
}

.demo-box {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px dashed var(--line);
}
.demo-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 10px;
  max-height: 290px;
  overflow-y: auto;
}
.demo-role-btn {
  width: 100%;
  text-align: right;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #faf8f2;
  color: var(--ink);
  font: inherit;
  cursor: pointer;
  transition: border-color 0.14s, background 0.14s, transform 0.08s;
}
.demo-role-btn:hover {
  border-color: var(--gold-deep);
  background: #f3ede0;
}
.demo-role-btn:active { transform: scale(0.99); }
.demo-role-info { display: flex; flex-direction: column; gap: 3px; align-items: flex-start; }
.demo-role-phone { font-size: 13px; color: var(--muted); font-weight: 700; }

.perm-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 8px;
  margin: 8px 0 12px;
}
.perm-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #faf8f2;
  color: var(--ink);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.perm-chip:has(input:checked) {
  border-color: var(--green-2);
  background: #eaf3ef;
  color: var(--emerald-deep);
}
.perm-chip input { width: auto; margin: 0; padding: 0; }
