/* مجمع آفاق التعليمي — تصميم إسلامي */
:root {
  --green-900: #0E2A44;
  --green-800: #143A5C;
  --green-700: #1B4A70;
  --green-600: #2F8E86;
  --green-500: #46AFA4;
  --gold-600: #A98230;
  --gold-500: #C2A24E;
  --gold-400: #D9BD74;
  --cream: #F4F1E9;
  --paper: #FFFFFF;
  --ink: #14232E;
  --muted: #5E6E76;
  --danger: #B3261E;
  --ok: #2F8E86;
  --warn: #A98230;
  --shadow: 0 6px 20px rgba(11,61,46,.07);
  --shadow-sm: 0 2px 8px rgba(11,61,46,.05);
  --radius: 18px;
  /* متغيرات دلالية تتبدّل مع الوضع */
  --field-bg: #FFFFFF;
  --field-border: #DCE6E0;
  --hover: #F1F6F2;
  --border: rgba(11,61,46,.07);
  --code-bg: #EEF5F0;
  --title: var(--green-800);
  --glow1: rgba(200,162,75,.06);
  --glow2: rgba(20,154,110,.10);
  --heading: var(--green-800);
  /* الخطوط */
  --font-body: 'Cairo','IBM Plex Sans Arabic','Segoe UI',system-ui,sans-serif;
  --font-head: 'Readex Pro','Cairo','IBM Plex Sans Arabic',system-ui,sans-serif;
  --font-quran: 'Amiri Quran','Cairo',serif;
}

/* ====== الوضع الليلي ====== */
[data-theme="dark"] {
  --green-900: #060F18;
  --cream: #0A1420;
  --paper: #10212F;
  --ink: #E6EEF4;
  --muted: #93A6B2;
  --gold-600: #D9BD74;
  --gold-500: #C2A24E;
  --gold-400: #E2CB8C;
  --title: #EAF1F6;
  --heading: #CBE0E8;
  --shadow: 0 10px 30px rgba(0,0,0,.45);
  --shadow-sm: 0 2px 10px rgba(0,0,0,.32);
  --field-bg: #15273A;
  --field-border: #284058;
  --hover: #14263A;
  --border: rgba(255,255,255,.06);
  --code-bg: #14263A;
  --glow1: rgba(217,189,116,.06);
  --glow2: rgba(47,142,134,.12);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font-body);
  direction: rtl;
  background:
    radial-gradient(circle at 0% 0%, var(--glow1), transparent 40%),
    radial-gradient(circle at 100% 100%, var(--glow2), transparent 40%),
    var(--cream);
  color: var(--ink);
  min-height: 100vh;
  transition: background .3s, color .3s;
}

/* أنماط زخرفية إسلامية */
.pattern-bar {
  height: 5px;
  background: linear-gradient(90deg, var(--green-800), var(--green-600) 45%, var(--gold-500));
}

/* ====== الطباعة ====== */
h1, h2, h3, h4, .page-title, .hero-title, .sec-head h2, .auth-title,
.auth-brand, .brand-name, .sb-name, .wb-name, .cta-box h2, .feature h3,
.role-card h3, .tile h3, .stat-meta .num { font-family: var(--font-head); letter-spacing: -.2px; }
.auth-aya, .ayah .q, .wb-motto, .topbar .motto { font-family: var(--font-quran); }

/* ====== الأيقونات الخطّية الموحّدة ====== */
.ic-svg { width: 22px; height: 22px; display: inline-block; vertical-align: middle; flex: none; }
.ic-xs { width: 14px; height: 14px; }
.side-nav .ic { display: inline-flex; }
.side-nav .ic-svg { width: 21px; height: 21px; }
.stat-ic .ic-svg { width: 25px; height: 25px; }
.fic .ic-svg { width: 28px; height: 28px; }
.section-head h2 .ic-svg { width: 20px; height: 20px; vertical-align: -4px; color: var(--green-600); }
.btn .ic-svg { width: 18px; height: 18px; }
.theme-toggle .ic-svg { width: 20px; height: 20px; }
.hero-badge .badge-ic .ic-svg { width: 16px; height: 16px; vertical-align: -3px; }
.pw-eye .ic-svg { width: 18px; height: 18px; }
.stat-ic { color: var(--green-700); }
.stat.gold .stat-ic { color: var(--gold-600); }
.fic { color: var(--green-700); }
.tile h3 .ic-svg, .circle-row .ic-svg { width: 20px; height: 20px; vertical-align: -4px; color: var(--green-600); }
.t-line { display: flex; align-items: center; gap: 5px; }
.t-line .ic-svg { color: var(--green-600); }

/* ====== الواجهة الرئيسة التعريفية ====== */
.landing { display: block; min-height: 100vh; }

/* شريط التنقل */
.site-nav {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px clamp(16px, 5vw, 56px);
  position: sticky; top: 0; z-index: 40;
  background: color-mix(in srgb, var(--cream) 85%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-logo { width: 46px; height: 46px; display: block; }
.brand-logo .logo-mark { width: 100%; height: 100%; }
.brand-name { font-weight: 800; color: var(--title); font-size: 18px; }
.nav-actions { display: flex; align-items: center; gap: 10px; }
.theme-toggle {
  width: 42px; height: 42px; border-radius: 12px;
  border: 1.5px solid var(--field-border); background: var(--paper);
  font-size: 18px; cursor: pointer; line-height: 1;
  transition: transform .15s, background .2s;
}
.theme-toggle:hover { transform: rotate(-15deg); }

/* البطل */
.hero { padding: clamp(48px, 9vw, 110px) clamp(16px, 5vw, 56px) 60px; text-align: center; position: relative; overflow: hidden; }
.hero::before {
  content: ""; position: absolute; inset: 0;
  background:
    radial-gradient(ellipse at 50% -10%, var(--glow2), transparent 55%);
  pointer-events: none;
}
.hero-inner { max-width: 880px; margin: 0 auto; position: relative; }
.hero-badge {
  display: inline-block; padding: 7px 16px; border-radius: 24px;
  background: color-mix(in srgb, var(--gold-500) 18%, transparent);
  color: var(--gold-600); font-weight: 700; font-size: 14px; margin-bottom: 22px;
  border: 1px solid color-mix(in srgb, var(--gold-500) 35%, transparent);
}
.hero-title { font-size: clamp(28px, 5.5vw, 52px); line-height: 1.25; color: var(--title); margin: 0 0 18px; font-weight: 800; }
.hero-title .grad {
  background: linear-gradient(90deg, var(--green-600), var(--gold-600));
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.hero-sub { font-size: clamp(16px, 2vw, 19px); color: var(--muted); max-width: 680px; margin: 0 auto 30px; line-height: 1.9; }
.hero-cta { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; margin-bottom: 50px; }
.btn.lg { padding: 14px 30px; font-size: 16px; border-radius: 12px; }
.hero-stats {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px;
  max-width: 720px; margin: 0 auto;
}
.hero-stats > div {
  background: var(--paper); border-radius: var(--radius); padding: 18px 10px;
  box-shadow: var(--shadow); border: 1px solid var(--border);
}
.hero-stats b { display: block; font-size: 28px; color: var(--gold-600); font-weight: 800; }
.hero-stats span { font-size: 13px; color: var(--muted); }

/* رؤوس الأقسام */
.sec-head { text-align: center; max-width: 640px; margin: 0 auto 42px; }
.kicker { color: var(--gold-600); font-weight: 800; font-size: 14px; letter-spacing: .5px; }
.sec-head h2 { font-size: clamp(24px, 3.5vw, 36px); color: var(--title); margin: 8px 0 12px; }
.sec-head p { color: var(--muted); font-size: 16px; line-height: 1.8; margin: 0; }

/* المميزات */
.features { padding: clamp(50px, 8vw, 90px) clamp(16px, 5vw, 56px); }
.feature-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 18px; max-width: 1100px; margin: 0 auto; }
.feature {
  background: var(--paper); border-radius: var(--radius); padding: 26px 22px;
  box-shadow: var(--shadow); border: 1px solid var(--border);
  transition: transform .18s, box-shadow .18s;
}
.feature:hover { transform: translateY(-4px); box-shadow: 0 14px 34px rgba(11,61,46,.18); }
.feature .fic {
  width: 54px; height: 54px; border-radius: 14px; display: grid; place-items: center;
  font-size: 26px; margin-bottom: 16px;
  background: color-mix(in srgb, var(--green-500) 14%, transparent);
}
.feature h3 { margin: 0 0 8px; color: var(--heading); font-size: 18px; }
.feature p { margin: 0; color: var(--muted); font-size: 14.5px; line-height: 1.8; }

/* الأدوار */
.roles-sec { padding: clamp(50px, 8vw, 90px) clamp(16px, 5vw, 56px); background: color-mix(in srgb, var(--green-700) 5%, transparent); }
.roles-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 18px; max-width: 1100px; margin: 0 auto; }
.role-card {
  background: var(--paper); border-radius: var(--radius); padding: 26px 22px;
  box-shadow: var(--shadow); border-top: 4px solid var(--gold-500); position: relative;
}
.role-card .rnum {
  width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center;
  background: linear-gradient(145deg, var(--green-700), var(--green-500));
  color: #fff; font-weight: 800; margin-bottom: 14px;
}
.role-card h3 { margin: 0 0 8px; color: var(--heading); }
.role-card p { margin: 0; color: var(--muted); font-size: 14.5px; line-height: 1.8; }

/* دعوة للبدء */
.cta-sec { padding: clamp(50px, 8vw, 90px) clamp(16px, 5vw, 56px); }
.cta-box {
  max-width: 820px; margin: 0 auto; text-align: center; padding: clamp(36px, 6vw, 64px) 28px;
  border-radius: 28px; color: #fff;
  background: linear-gradient(135deg, var(--green-800), var(--green-600));
  box-shadow: var(--shadow); position: relative; overflow: hidden;
}
.cta-box::after {
  content: ""; position: absolute; inset: 0;
  background: repeating-linear-gradient(45deg, rgba(255,255,255,.04) 0 14px, transparent 14px 28px);
  pointer-events: none;
}
.cta-box h2 { margin: 0 0 12px; font-size: clamp(22px, 3.5vw, 32px); }
.cta-box p { margin: 0 0 26px; color: rgba(255,255,255,.85); font-size: 16px; }

/* بطاقة المصادقة داخل النافذة */
.card {
  background: var(--paper);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  padding: 22px;
}
.auth-card { width: 100%; text-align: right; box-shadow: none; border: none; padding: 0; }
.auth-card h2 { margin: 0 0 16px; color: var(--title); }

label { display: block; font-size: 14px; color: var(--green-800); margin: 12px 0 6px; font-weight: 600; }
input, select, textarea {
  width: 100%;
  padding: 11px 13px;
  border-radius: 10px;
  border: 1.5px solid var(--field-border);
  background: var(--field-bg);
  font-size: 15px;
  font-family: inherit;
  color: var(--ink);
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--green-500); box-shadow: 0 0 0 3px rgba(46,158,107,.15); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 18px;
  border-radius: 10px;
  border: none;
  background: var(--green-700);
  color: #fff;
  font-size: 15px; font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  transition: transform .05s, background .15s;
}
.btn:hover { background: var(--green-800); }
.btn:active { transform: translateY(1px); }
.btn.full { width: 100%; }
.btn.gold { background: var(--gold-600); }
.btn.gold:hover { background: #9c7209; }
.btn.danger { background: var(--danger); }
.btn.ghost { background: transparent; color: var(--green-800); border: 1.5px solid var(--green-600); }
.btn.sm { padding: 6px 12px; font-size: 13px; }

.error-msg { color: var(--danger); font-size: 14px; margin-top: 10px; min-height: 18px; }
.hint { font-size: 13px; color: var(--muted); margin-top: 6px; }

/* ====== هيكل التطبيق ====== */
.app { display: none; min-height: 100vh; }
.app.active { display: block; }

.topbar {
  background: linear-gradient(120deg, var(--green-800), var(--green-600));
  color: #fff;
  padding: 12px 18px;
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px;
  position: sticky; top: 0; z-index: 50;
  box-shadow: var(--shadow);
}
.topbar .who { display: flex; flex-direction: column; }
.topbar .who .name { font-weight: 800; font-size: 16px; }
.topbar .who .motto { font-size: 13px; color: var(--gold-400); }
.topbar .role-chip {
  background: rgba(255,255,255,.18); padding: 4px 10px; border-radius: 20px; font-size: 13px; font-weight: 700;
}
.topbar .actions { display: flex; gap: 8px; align-items: center; }
.menu-btn { display: none; }

.layout { display: flex; }
.sidebar {
  width: 230px; min-height: calc(100vh - 60px);
  background: var(--green-900);
  padding: 14px 10px;
}
.sidebar a {
  display: flex; align-items: center; gap: 10px;
  color: #d7e6dd; text-decoration: none;
  padding: 11px 14px; border-radius: 10px; margin-bottom: 4px;
  font-size: 15px; cursor: pointer;
}
.sidebar a:hover { background: rgba(255,255,255,.07); }
.sidebar a.active { background: var(--gold-600); color: #fff; font-weight: 700; }
.sidebar a .ic { font-size: 18px; }

.content { flex: 1; padding: 22px; max-width: 1200px; }
.page-title { font-size: 22px; color: var(--green-800); margin: 0 0 4px; }
.page-sub { color: var(--muted); margin: 0 0 18px; }

/* بطاقات الإحصاء */
.stats { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 16px; margin-bottom: 24px; }
.stat {
  background: var(--paper); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow);
  border-right: 5px solid var(--green-600);
}
.stat .num { font-size: 30px; font-weight: 800; color: var(--green-800); }
.stat .lbl { color: var(--muted); font-size: 14px; margin-top: 4px; }
.stat.gold { border-color: var(--gold-500); }
.stat.gold .num { color: var(--gold-600); }

/* جداول */
.table-wrap { overflow-x: auto; background: var(--paper); border-radius: var(--radius); box-shadow: var(--shadow); }
table { width: 100%; border-collapse: collapse; min-width: 540px; }
th, td { padding: 12px 14px; text-align: right; border-bottom: 1px solid #eee3d0; font-size: 14px; }
th { background: var(--green-800); color: #fff; font-weight: 700; position: sticky; top: 0; }
tbody tr:hover { background: var(--hover); }
code { background: var(--code-bg); padding: 3px 10px; border-radius: 7px; font-family: 'Cairo', ui-monospace, monospace; color: var(--heading); font-size: 13.5px; direction: ltr; unicode-bidi: isolate; display: inline-block; letter-spacing: .3px; }
.badge { padding: 3px 10px; border-radius: 20px; font-size: 12px; font-weight: 700; display: inline-block; }
.badge.ok { background: #ddeee4; color: var(--ok); }
.badge.warn { background: #f6edd2; color: var(--warn); }
.badge.danger { background: #f6dcda; color: var(--danger); }
.badge.muted { background: #e9ece9; color: var(--muted); }

.row-actions { display: flex; gap: 6px; flex-wrap: wrap; }

/* أقسام/بطاقات شبكية */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px,1fr)); gap: 16px; }
.tile { background: var(--paper); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); border-top: 4px solid var(--gold-500); }
.tile h3 { margin: 0 0 8px; color: var(--green-800); }
.tile .meta { color: var(--muted); font-size: 14px; line-height: 1.9; }

.section { margin-bottom: 28px; }
.section-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; flex-wrap: wrap; gap: 10px; }
.section-head h2 { margin: 0; color: var(--green-800); font-size: 19px; }

.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px,1fr)); gap: 4px 16px; }

/* نافذة منبثقة */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(11,61,46,.45);
  display: none; align-items: center; justify-content: center; z-index: 100; padding: 16px;
}
.modal-overlay.open { display: flex; }
.modal {
  background: var(--paper); border-radius: var(--radius); padding: 22px;
  width: 100%; max-width: 560px; max-height: 90vh; overflow-y: auto; box-shadow: var(--shadow);
}
.modal h3 { margin: 0 0 14px; color: var(--green-800); }
.modal-actions { display: flex; gap: 10px; justify-content: flex-start; margin-top: 18px; }

.empty { text-align: center; color: var(--muted); padding: 40px 20px; }

/* تذييل: صُنع بواسطة عبدالله */
.made-by {
  text-align: center;
  color: var(--muted);
  font-size: 14px;
  padding: 16px;
}
.made-by a {
  color: var(--gold-600);
  font-weight: 700;
  text-decoration: none;
}
.made-by a:hover { text-decoration: underline; color: var(--green-700); }
.landing .made-by { margin-top: 22px; }
.app-footer {
  border-top: 1px solid rgba(11,61,46,.1);
  background: var(--paper);
}

/* مخطط أسبوعي */
.week-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; }
.day-cell { background: var(--paper); border-radius: 12px; padding: 10px; box-shadow: var(--shadow); min-height: 90px; }
.day-cell .dn { font-weight: 800; color: var(--green-800); font-size: 13px; }
.day-cell .hd { color: var(--gold-600); font-size: 12px; margin-bottom: 6px; }
.day-cell .task { font-size: 12px; color: var(--ink); line-height: 1.6; display: flex; flex-direction: column; gap: 5px; }

.pill-row { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.pill { background: var(--field-bg); border: 1.5px solid var(--field-border); border-radius: 20px; padding: 6px 14px; cursor: pointer; font-size: 14px; }
.pill.active { background: var(--green-700); color: #fff; border-color: var(--green-700); }

.cred-box { background: var(--code-bg); border: 1.5px dashed var(--green-500); border-radius: 12px; padding: 12px; margin-top: 12px; font-size: 14px; }
.cred-box b { color: var(--green-800); }

/* ====== الهوية البصرية: الشعار ====== */
.logo-mark { display: block; width: 100%; height: 100%; filter: drop-shadow(0 4px 8px rgba(0,0,0,.18)); }
a.btn { text-decoration: none; }

/* ====== المصادقة داخل النافذة ====== */
#modalOverlay .auth-card { animation: authpop .28s cubic-bezier(.2,.9,.3,1.2); }
.auth-head { display: flex; align-items: center; gap: 14px; margin-bottom: 20px; }
.auth-head .logo-mark { width: 56px; height: 56px; flex: 0 0 56px; }
.auth-head-txt { display: flex; flex-direction: column; }
.auth-brand { font-weight: 800; font-size: 21px; color: var(--title); }
.auth-brand-sub { font-size: 13px; color: var(--gold-600); font-weight: 700; }
.auth-title { margin: 0 0 4px; color: var(--title); font-size: 20px; }
.pw-wrap { position: relative; }
.pw-wrap input { padding-inline-start: 42px; }
.pw-eye { position: absolute; inset-inline-start: 8px; top: 50%; transform: translateY(-50%); background: none; border: none; cursor: pointer; font-size: 17px; opacity: .55; padding: 6px; }
.pw-eye:hover { opacity: 1; }
.auth-aya { margin-top: 20px; text-align: center; color: var(--muted); font-size: 14.5px; line-height: 1.9; border-top: 1px dashed var(--field-border); padding-top: 16px; }
@keyframes authpop { from { transform: scale(.95) translateY(6px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ====== الشريط الجانبي: العلامة والمستخدم ====== */
.side-brand { display: flex; align-items: center; gap: 11px; padding: 6px 12px 16px; border-bottom: 1px solid rgba(255,255,255,.08); margin-bottom: 12px; }
.side-brand .logo-mark { width: 44px; height: 44px; flex: 0 0 44px; }
.sb-txt { display: flex; flex-direction: column; }
.sb-name { color: #fff; font-weight: 800; font-size: 16px; }
.sb-sub { color: var(--gold-400); font-size: 12px; }
.side-user { padding: 0 14px 16px; }
.su-role { display: inline-block; background: rgba(255,255,255,.13); color: #fff; padding: 3px 13px; border-radius: 20px; font-size: 12px; font-weight: 700; }
.su-name { display: block; color: #d7e6dd; font-size: 14px; margin-top: 7px; font-weight: 600; }
.side-nav { display: flex; flex-direction: column; gap: 2px; }

/* تحديث التوبار */
.topbar { background: linear-gradient(120deg, var(--green-800), var(--green-700)); }
.theme-toggle { width: 40px; height: 40px; }
.topbar .theme-toggle { background: rgba(255,255,255,.12); border-color: rgba(255,255,255,.22); color: #fff; }
.topbar .theme-toggle:hover { background: rgba(255,255,255,.2); }

/* ====== لوحة الترحيب ====== */
.welcome-banner {
  position: relative; overflow: hidden; border-radius: 22px; padding: 28px 30px; margin-bottom: 24px;
  background: linear-gradient(120deg, var(--green-800), var(--green-600));
  box-shadow: var(--shadow); color: #fff;
}
.welcome-banner::after {
  content: ""; position: absolute; inset: 0; opacity: .14; pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='80' height='80'%3E%3Cpath d='M40 4 L76 40 L40 76 L4 40 Z' fill='none' stroke='%23ffffff' stroke-width='1.2'/%3E%3Ccircle cx='40' cy='40' r='14' fill='none' stroke='%23ffffff' stroke-width='1.2'/%3E%3C/svg%3E");
}
.wb-bism {
  position: absolute; inset-inline-end: 24px; top: 50%; transform: translateY(-50%);
  font-size: clamp(34px, 8vw, 84px); font-weight: 800; color: #fff; opacity: .08; white-space: nowrap; pointer-events: none;
}
.wb-content { position: relative; z-index: 1; }
.wb-name { font-size: 23px; font-weight: 800; }
.wb-chip { background: rgba(255,255,255,.2); padding: 4px 13px; border-radius: 20px; font-size: 13px; font-weight: 700; margin-inline-start: 8px; vertical-align: middle; }
.wb-motto { margin-top: 10px; color: var(--gold-400); font-size: 15.5px; }

/* ====== بطاقات الإحصاء بأيقونات ====== */
.stat { display: flex; align-items: center; gap: 14px; border-right: none; border-top: 1px solid var(--border); }
.stat-ic { width: 52px; height: 52px; border-radius: 15px; display: grid; place-items: center; font-size: 24px; flex: 0 0 52px; background: color-mix(in srgb, var(--green-500) 14%, transparent); }
.stat.gold .stat-ic { background: color-mix(in srgb, var(--gold-500) 20%, transparent); }
.stat-meta .num { font-size: 27px; }

/* ====== شبكة لوحة التحكم + المخطط الدائري ====== */
.dash-grid { display: grid; grid-template-columns: 1fr 1.3fr; gap: 18px; }
.donut-wrap { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; justify-content: center; padding: 10px 0; }
.donut { width: 170px; height: 170px; }
.donut-total { font-size: 26px; font-weight: 800; fill: var(--heading); }
.donut-cap { font-size: 12px; fill: var(--muted); }
.donut-legend { display: flex; flex-direction: column; gap: 12px; }
.lg-item { font-size: 15px; color: var(--ink); display: flex; align-items: center; gap: 9px; }
.lg-item b { color: var(--heading); }
.lg-dot { width: 14px; height: 14px; border-radius: 4px; display: inline-block; }
.circle-list { display: flex; flex-direction: column; gap: 10px; }
.circle-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 14px; border-radius: 12px; background: var(--hover); border: 1px solid var(--border); }
.cr-name { font-weight: 700; color: var(--heading); }
.cr-sub { font-size: 13px; color: var(--muted); margin-top: 2px; }

/* ====== قسم الآيات ====== */
.ayat-sec { position: relative; padding: 56px clamp(16px,5vw,56px); background: linear-gradient(125deg, var(--green-900), var(--green-700)); overflow: hidden; }
.ayat-pattern { position: absolute; inset: 0; opacity: .1; pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='70' height='70'%3E%3Cpath d='M35 2 L68 35 L35 68 L2 35 Z' fill='none' stroke='%23e0bc4a' stroke-width='1'/%3E%3Cpath d='M35 14 L56 35 L35 56 L14 35 Z' fill='none' stroke='%23e0bc4a' stroke-width='1'/%3E%3C/svg%3E");
}
.ayat-track { position: relative; display: grid; grid-template-columns: repeat(auto-fit, minmax(240px,1fr)); gap: 18px; max-width: 1100px; margin: 0 auto; }
.ayah { background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.13); border-radius: 18px; padding: 22px; text-align: center; backdrop-filter: blur(4px); }
.ayah .q { display: block; color: #fff; font-size: 17px; font-weight: 700; line-height: 2; }
.ayah .src { display: block; color: var(--gold-400); font-size: 13px; margin-top: 10px; }

/* ====== الشعار (صورة فعلية + احتياط متجه) ====== */
.brand-mark { display: inline-flex; align-items: center; justify-content: center; line-height: 0; }
.brand-mark .brand-img, .brand-mark .logo-mark { width: 100%; height: 100%; object-fit: contain; display: block; }
/* قرص فاتح خلف الشعار على الأسطح الداكنة لإبراز التفاصيل الكحلية */
.side-brand .brand-mark,
.auth-bs-inner .brand-mark,
[data-theme="dark"] .brand-logo .brand-mark,
[data-theme="dark"] .hero-logo .brand-mark {
  background: #F4F1E9; border-radius: 50%; padding: 5px; box-sizing: border-box;
  box-shadow: 0 2px 12px rgba(0,0,0,.2);
}
.brand-logo { width: 50px; height: 50px; }
.brand-logo .brand-mark { width: 100%; height: 100%; }
.side-brand .brand-mark { width: 46px; height: 46px; flex: 0 0 46px; }
.hero-logo { display: block; width: 132px; height: 132px; margin: 0 auto 24px; }
.hero-logo .brand-mark { width: 100%; height: 100%; }

/* ====== شاشتا تسجيل الدخول وإنشاء الحساب (تصميم مقسّم) ====== */
.auth-modal-box { max-width: 880px; padding: 0; overflow: hidden; border: 1px solid var(--border); }
.auth-split { display: grid; grid-template-columns: 1.05fr 1fr; min-height: 540px; }
.auth-brandside {
  position: relative; overflow: hidden; color: #fff;
  background: linear-gradient(155deg, #1B4A70 0%, #143A5C 55%, #0E2A44 100%);
  display: flex; align-items: center; justify-content: center; padding: 44px 34px;
}
.auth-bs-pattern {
  position: absolute; inset: 0; opacity: .13; pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='76' height='76'%3E%3Cpath d='M38 4 72 38 38 72 4 38Z' fill='none' stroke='%23C2A24E' stroke-width='1'/%3E%3Cpath d='M38 18 58 38 38 58 18 38Z' fill='none' stroke='%234FB6AB' stroke-width='1'/%3E%3C/svg%3E");
}
.auth-bs-inner { position: relative; text-align: center; max-width: 320px; }
.auth-bs-inner .brand-mark { width: 132px; height: 132px; margin: 0 auto 22px; filter: drop-shadow(0 8px 20px rgba(0,0,0,.3)); }
.auth-bs-title { font-size: 25px; margin: 0 0 12px; color: #fff; }
.auth-bs-sub { color: rgba(255,255,255,.82); font-size: 15px; line-height: 1.95; margin: 0 0 26px; }
.auth-bs-aya { font-family: var(--font-quran); color: var(--gold-400); font-size: 17px; line-height: 1.9; border-top: 1px solid rgba(255,255,255,.16); padding-top: 20px; }

.auth-formside { padding: 40px clamp(24px,4vw,42px); display: flex; flex-direction: column; justify-content: center; background: var(--paper); }
.auth-tabs { display: flex; gap: 6px; background: var(--hover); padding: 5px; border-radius: 14px; margin-bottom: 26px; border: 1px solid var(--border); }
.auth-tab {
  flex: 1; padding: 11px 8px; border: none; background: transparent; border-radius: 10px;
  font-family: var(--font-head); font-size: 15px; font-weight: 600; color: var(--muted); cursor: pointer;
  transition: background .2s, color .2s, box-shadow .2s;
}
.auth-tab.active { background: var(--paper); color: var(--green-800); box-shadow: var(--shadow-sm); }
.auth-lead { color: var(--muted); margin: 0 0 18px; font-size: 14.5px; line-height: 1.8; }
.auth-note { display: flex; gap: 13px; background: var(--hover); border: 1px solid var(--border); border-radius: 14px; padding: 17px; font-size: 14px; line-height: 1.95; color: var(--ink); }
.auth-note-ic { color: var(--green-600); flex: none; }
.auth-note-ic .ic-svg { width: 28px; height: 28px; }
.auth-title { margin: 0 0 6px; }

/* تجربة سريعة بحسابات جاهزة */
.auth-demo { margin-top: 24px; }
.auth-demo-head { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 13px; margin-bottom: 13px; }
.auth-demo-head .line { flex: 1; height: 1px; background: var(--border); }
.demo-roles { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.demo-chip {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 11px 8px; border: 1.5px solid var(--field-border); background: var(--field-bg);
  border-radius: 12px; font-family: var(--font-body); font-size: 14px; font-weight: 600;
  color: var(--green-800); cursor: pointer; transition: border-color .15s, background .15s, transform .1s;
}
.demo-chip:hover { border-color: var(--green-600); background: var(--hover); transform: translateY(-1px); }
.demo-chip .ic-svg { color: var(--green-600); }

/* ====== استجابة الجوال ====== */
@media (max-width: 820px) {
  .menu-btn { display: inline-flex; }
  .sidebar {
    position: fixed; right: 0; top: 60px; bottom: 0; z-index: 60;
    transform: translateX(100%); transition: transform .2s; box-shadow: var(--shadow);
  }
  .sidebar.open { transform: translateX(0); }
  .content { padding: 16px; }
  .week-grid { grid-template-columns: repeat(2, 1fr); }
  .hero-stats { grid-template-columns: repeat(2, 1fr); }
  .dash-grid { grid-template-columns: 1fr; }
  .auth-split { grid-template-columns: 1fr; min-height: 0; }
  .auth-brandside { padding: 28px 24px; }
  .auth-bs-inner .brand-mark { width: 90px; height: 90px; margin-bottom: 14px; }
  .auth-bs-sub, .auth-bs-aya { display: none; }
  .auth-bs-title { font-size: 21px; margin: 0; }
  .auth-formside { padding: 26px 22px; }
}
@media (max-width: 480px) {
  .week-grid { grid-template-columns: 1fr; }
  .stat-meta .num { font-size: 22px; }
  .site-nav { padding: 12px 16px; }
  .brand-name { font-size: 16px; }
  .wb-name { font-size: 19px; }
}

/* ====== شارة حالة المزامنة مع قاعدة البيانات ====== */
.sync-badge {
  font-size: 12px;
  font-weight: 600;
  padding: 5px 11px;
  border-radius: 20px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  line-height: 1;
}
.sync-badge::before {
  content: '';
  width: 8px; height: 8px;
  border-radius: 50%;
  background: currentColor;
}
.sync-badge.ok     { background: rgba(47, 142, 134, .14);  color: #2F8E86; }
.sync-badge.saving { background: rgba(194, 162, 78, .16);  color: #b9902f; }
.sync-badge.err    { background: rgba(200, 80, 80, .14);   color: #c85050; }
@media (max-width: 640px) {
  .sync-badge { font-size: 0; padding: 6px; gap: 0; }
  .sync-badge::before { width: 9px; height: 9px; }
}

/* زر إجراء خطر (حذف) */
.btn.ghost.danger { color: #c85050; border-color: rgba(200, 80, 80, .35); }
.btn.ghost.danger:hover { background: rgba(200, 80, 80, .1); border-color: #c85050; }

/* ==========================================================================
   تحسينات احترافية — شاشتا الدخول/التسجيل ولوحة المعلومات
   ========================================================================== */

/* ----- طبقة التعتيم بخلفية ضبابية أنعم ----- */
.modal-overlay { background: rgba(9, 26, 43, .55); backdrop-filter: blur(5px); }

/* ----- شاشتا الدخول والتسجيل ----- */
.auth-modal-box {
  max-width: 960px;
  border-radius: 26px;
  border: 1px solid var(--border);
  box-shadow: 0 40px 90px -25px rgba(9, 30, 50, .6), 0 10px 34px rgba(0, 0, 0, .16);
}
.auth-split { min-height: 588px; }

.auth-brandside {
  background:
    radial-gradient(120% 85% at 12% 0%, rgba(79, 182, 171, .30), transparent 55%),
    radial-gradient(95% 95% at 100% 100%, rgba(194, 162, 78, .22), transparent 52%),
    linear-gradient(155deg, #1B4A70 0%, #143A5C 55%, #0B2138 100%);
}
/* هالات ضوئية ناعمة تعطي عمقاً */
.auth-brandside::before {
  content: ""; position: absolute; width: 340px; height: 340px; border-radius: 50%;
  top: -110px; inset-inline-start: -90px; pointer-events: none;
  background: radial-gradient(circle, rgba(79, 182, 171, .38), transparent 70%);
}
.auth-brandside::after {
  content: ""; position: absolute; width: 260px; height: 260px; border-radius: 50%;
  bottom: -90px; inset-inline-end: -70px; pointer-events: none;
  background: radial-gradient(circle, rgba(194, 162, 78, .30), transparent 70%);
}
.auth-bs-inner { max-width: 344px; }
.auth-bs-inner .brand-mark { width: 118px; height: 118px; margin-bottom: 20px; }
.auth-bs-title { font-size: 27px; letter-spacing: -.5px; }
.auth-bs-sub { margin-bottom: 20px; }

/* نقاط المميزات على الجانب البصري */
.auth-bs-points { display: flex; flex-direction: column; gap: 13px; text-align: right; margin: 6px 0 24px; }
.auth-bs-point { display: flex; align-items: center; gap: 11px; color: rgba(255, 255, 255, .92); font-size: 14.5px; font-weight: 500; }
.auth-bs-point .tick {
  width: 28px; height: 28px; border-radius: 9px; display: grid; place-items: center; flex: none;
  background: rgba(255, 255, 255, .10); border: 1px solid rgba(255, 255, 255, .18);
}
.auth-bs-point .tick .ic-svg { width: 15px; height: 15px; color: var(--gold-400); }

/* الجانب النموذجي */
.auth-formside { padding: 48px clamp(26px, 4vw, 50px); }
.auth-title { font-size: 26px; }
.auth-tabs { padding: 6px; border-radius: 16px; }
.auth-tab { padding: 12px 8px; font-size: 15px; }
.auth-tab.active { box-shadow: 0 4px 14px rgba(11, 61, 46, .13); }
.auth-formside label { font-size: 13.5px; letter-spacing: .2px; }
.auth-formside input {
  padding: 14px 15px; border-radius: 13px; font-size: 15.5px;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
.auth-formside input:focus { border-color: var(--green-500); box-shadow: 0 0 0 4px rgba(79, 182, 171, .18); }
.auth-formside .pw-wrap input { padding-inline-start: 46px; }
.auth-formside #loginBtn, .auth-formside #setupBtn {
  border-radius: 13px; font-size: 16px; padding: 15px; border: none;
  background: linear-gradient(120deg, var(--green-700), var(--green-600));
  box-shadow: 0 12px 26px -10px rgba(47, 142, 134, .65);
  transition: filter .15s, transform .05s, box-shadow .15s;
}
.auth-formside #loginBtn:hover, .auth-formside #setupBtn:hover { filter: brightness(1.06); }

/* ----- لوحة المعلومات ----- */
.welcome-banner {
  padding: 32px 34px; border-radius: 24px;
  background:
    radial-gradient(130% 150% at 100% 0%, rgba(194, 162, 78, .26), transparent 46%),
    linear-gradient(120deg, var(--green-800), var(--green-600));
  box-shadow: 0 18px 40px -18px rgba(11, 61, 46, .35);
}
.wb-name { font-size: 25px; }
.wb-motto { font-size: 16px; }

/* بطاقات الإحصاء — تصميم KPI احترافي */
.stat {
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 20px 22px;
  display: flex; align-items: center; gap: 16px;
  box-shadow: var(--shadow-sm);
  position: relative; overflow: hidden;
  transition: transform .16s ease, box-shadow .16s ease;
}
/* شريط لوني على بداية البطاقة */
.stat::before {
  content: ''; position: absolute; top: 0; bottom: 0; inset-inline-start: 0; width: 4px;
  background: linear-gradient(180deg, var(--green-500), var(--green-600));
}
.stat.gold::before { background: linear-gradient(180deg, var(--gold-400), var(--gold-500)); }
.stat:hover { transform: translateY(-4px); box-shadow: 0 18px 34px -16px rgba(11, 61, 46, .26); }
.stat-ic {
  width: 58px; height: 58px; border-radius: 17px; flex: 0 0 58px;
  display: grid; place-items: center;
  background: linear-gradient(140deg, color-mix(in srgb, var(--green-500) 24%, transparent), color-mix(in srgb, var(--green-600) 9%, transparent));
  color: var(--green-700);
}
.stat.gold .stat-ic {
  background: linear-gradient(140deg, color-mix(in srgb, var(--gold-500) 30%, transparent), color-mix(in srgb, var(--gold-400) 11%, transparent));
  color: var(--gold-600);
}
.stat-ic .ic-svg { width: 27px; height: 27px; }
.stat-meta { display: flex; flex-direction: column; }
.stat-meta .num { font-size: 32px; font-weight: 800; color: var(--heading); line-height: 1.08; }
.stat.gold .num { color: var(--gold-600); }
.stat .lbl { color: var(--muted); font-size: 14px; margin-top: 4px; font-weight: 500; }

/* بطاقات لوحة التحكم */
.card { transition: box-shadow .16s ease, transform .16s ease; }
.dash-grid { gap: 20px; }
.dash-grid .card:hover { box-shadow: 0 18px 38px -18px rgba(11, 61, 46, .2); transform: translateY(-2px); }

/* صفوف الحلقات — أوضح وأجمل */
.circle-row {
  padding: 14px 16px; border-radius: 14px;
  background: var(--paper); border: 1px solid var(--border);
  border-inline-start: 4px solid var(--green-500);
  box-shadow: var(--shadow-sm);
  transition: transform .12s ease, box-shadow .15s ease, border-color .15s ease;
}
.circle-row:hover { transform: translateX(-4px); box-shadow: 0 10px 24px -12px rgba(11, 61, 46, .2); }
.cr-name { font-size: 15.5px; }

/* عناوين الصفحات أوضح */
.page-title { font-size: 24px; font-weight: 800; }
.section-head h2 { font-size: 20px; }

/* شبكة الإحصاء المتجاوبة */
@media (max-width: 900px) { .stats { grid-template-columns: repeat(2, minmax(0,1fr)); } }
@media (max-width: 540px) { .stats { grid-template-columns: 1fr; } }

@media (max-width: 820px) {
  .auth-split { min-height: 0; }
  .auth-bs-points { display: none; }
  .auth-formside { padding: 28px 22px; }
}
