/* ===== مقرأة ربيع القلوب — ألوان مستمدة من الشعار ===== */
:root {
  --gold: #C9A227;
  --gold-dark: #A07E16;
  --crimson: #B3203A;
  --crimson-dark: #8E1A2E;
  --green: #1F4D3A;
  --green-dark: #143327;
  --cream: #FBF7EE;
  --sand: #F3EBDA;
  --ink: #2A2520;
  --muted: #6B6258;
  --white: #fff;
  --radius: 18px;
  --shadow: 0 10px 30px rgba(31, 77, 58, .10);
  --font-head: "Amiri", "Traditional Arabic", serif;
  --font-body: "Tajawal", "Segoe UI", Tahoma, sans-serif;
  /* زخرفة هندسية إسلامية خفيفة */
  --pattern: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='80' height='80' viewBox='0 0 80 80'%3E%3Cg fill='none' stroke='%23C9A227' stroke-opacity='.18' stroke-width='1'%3E%3Cpath d='M40 4 50 30 76 40 50 50 40 76 30 50 4 40 30 30Z'/%3E%3Crect x='22' y='22' width='36' height='36' transform='rotate(45 40 40)'/%3E%3Ccircle cx='40' cy='40' r='6'/%3E%3C/g%3E%3C/svg%3E");
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 84px; }
body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.85;
  color: var(--ink);
  background: var(--cream);
  overflow-x: hidden;
}
img { max-width: 100%; display: block; }
a { color: var(--green); }
h1, h2, h3 { font-family: var(--font-head); line-height: 1.35; margin: 0 0 .5em; color: var(--green-dark); }
p { margin: 0 0 1em; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; border-radius: 6px; }

.container { width: min(1180px, 100% - 2.5rem); margin-inline: auto; }
.narrow { width: min(820px, 100% - 2.5rem); }
.center { text-align: center; margin-top: 2.5rem; }
.gold { color: var(--gold-dark); }

.skip { position: absolute; inset-inline-start: -999px; top: 0; background: var(--green); color: #fff; padding: .6rem 1rem; z-index: 100; }
.skip:focus { inset-inline-start: 1rem; top: 1rem; }

/* ===== الأزرار ===== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  padding: .8rem 1.6rem; border-radius: 999px;
  font: 700 1rem var(--font-body); text-decoration: none;
  border: 2px solid transparent; cursor: pointer;
  transition: transform .2s, box-shadow .2s, background .2s, color .2s;
}
.btn svg { width: 1.25em; height: 1.25em; fill: currentColor; }
.btn:hover { transform: translateY(-2px); }
.btn-primary { background: var(--crimson); color: #fff; box-shadow: 0 8px 20px rgba(179, 32, 58, .28); }
.btn-primary:hover { background: var(--crimson-dark); }
.btn-ghost { border-color: var(--green); color: var(--green); background: transparent; }
.btn-ghost:hover { background: var(--green); color: #fff; }
.btn-gold { background: var(--gold); color: var(--green-dark); }
.btn-gold:hover { background: #dcb63a; }

/* ===== الترويسة ===== */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(251, 247, 238, .92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(201, 162, 39, .25);
}
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 1rem; min-height: 72px; }
.brand { display: flex; align-items: center; gap: .7rem; text-decoration: none; }
.brand img { width: 52px; height: 52px; border-radius: 50%; object-fit: cover; border: 2px solid var(--gold); background: #fff; }
.brand-text { display: flex; flex-direction: column; line-height: 1.2; white-space: nowrap; }
.brand-text strong { font-family: var(--font-head); font-size: 1.35rem; color: var(--crimson); }
.brand-text small { color: var(--muted); font-size: .8rem; }

.nav { display: flex; align-items: center; gap: .3rem; }
.nav a:not(.btn) { padding: .5rem .8rem; color: var(--ink); text-decoration: none; font-weight: 500; border-radius: 8px; transition: color .2s, background .2s; }
.nav a:not(.btn):hover { color: var(--crimson); background: var(--sand); }
.nav-login, .nav-cta { padding: .55rem 1.3rem; }
.nav-login { margin-inline-start: .6rem; }
.nav a { white-space: nowrap; }

.nav-toggle { display: none; width: 46px; height: 46px; border: 0; background: transparent; cursor: pointer; padding: 10px; }
.nav-toggle span { display: block; height: 2px; margin: 6px 0; background: var(--green); border-radius: 2px; transition: transform .3s, opacity .3s; }
.nav-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(8px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-8px) rotate(-45deg); }

@media (max-width: 1099px) {
  .nav-toggle { display: block; }
  .nav {
    position: absolute; inset-inline: 0; top: 100%;
    flex-direction: column; align-items: stretch; gap: 0;
    background: var(--cream); padding: .5rem 1.25rem 1.25rem;
    border-bottom: 1px solid rgba(201, 162, 39, .3);
    box-shadow: var(--shadow);
    display: none;
  }
  .nav.open { display: flex; }
  .nav a:not(.btn) { padding: .85rem .5rem; border-bottom: 1px solid var(--sand); }
  .nav-login { margin: 1rem 0 0; }
  .nav-cta { margin: .6rem 0 0; }
}

/* ===== البطل ===== */
.hero {
  position: relative;
  background: var(--pattern), radial-gradient(ellipse at 20% 30%, #fff 0%, var(--cream) 60%);
  padding-block: clamp(3rem, 8vw, 6rem);
  overflow: hidden;
}
.hero-inner { display: grid; gap: 2.5rem; align-items: center; }
.eyebrow {
  display: inline-block; margin-bottom: 1rem;
  font-weight: 700; font-size: .9rem; color: var(--crimson);
  letter-spacing: 0;
}
.eyebrow::before { content: "۞ "; color: var(--gold); }
.hero h1 { font-size: clamp(2.3rem, 6vw, 4rem); color: var(--green-dark); }
.hadith {
  font-family: var(--font-head); font-size: clamp(1.1rem, 2.4vw, 1.35rem);
  color: var(--green); border-inline-start: 4px solid var(--gold);
  padding-inline-start: 1rem; margin-block: 1.25rem;
}
/* خط مصحفي (Amiri Quran) يحتاج مسافة أسطر أكبر بسبب علامات التشكيل */
.quran-font { font-family: "Amiri Quran", "Amiri", "Traditional Arabic", serif; font-size: clamp(1.15rem, 2.5vw, 1.45rem); line-height: 2.1; text-wrap: balance; }
.lead { color: var(--muted); font-size: 1.1rem; max-width: 56ch; }
.hero-actions { display: flex; flex-wrap: wrap; gap: .8rem; margin-top: 1.75rem; }

.hero-art { display: flex; justify-content: center; }
.logo-frame {
  position: relative; width: min(380px, 80vw); aspect-ratio: 1;
  border-radius: 50%; background: #fff; padding: 8%;
  box-shadow: 0 30px 60px rgba(31, 77, 58, .15), 0 0 0 10px rgba(201, 162, 39, .15), 0 0 0 22px rgba(201, 162, 39, .07);
}
.logo-frame img { width: 100%; height: 100%; object-fit: contain; border-radius: 50%; }

@media (min-width: 860px) {
  .hero-inner { grid-template-columns: 1.2fr 1fr; }
}

/* ===== الأرقام ===== */
.stats { background: var(--green); color: #fff; padding-block: 2rem; }
.stats-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1.5rem; text-align: center; }
.stat strong { display: block; font-family: var(--font-head); font-size: clamp(1.5rem, 3.5vw, 2.1rem); color: var(--gold); }
.stat span { font-size: .95rem; opacity: .9; }
/* عدد فردي على الجوال: الأخير يأخذ السطر كاملًا بدل أن يبقى وحيدًا في طرف */
.stats-grid .stat:last-child:nth-child(odd) { grid-column: 1 / -1; }
@media (min-width: 768px) {
  .stats-grid { grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); }
  .stats-grid .stat:last-child:nth-child(odd) { grid-column: auto; }
}

/* ===== الأقسام ===== */
.section { padding-block: clamp(3.5rem, 8vw, 6rem); }
.section-tint { background: var(--sand); }
.section-head { text-align: center; max-width: 680px; margin: 0 auto 3rem; }
.section-title { font-size: clamp(1.8rem, 4.5vw, 2.6rem); }
.section-title::after {
  content: ""; display: block; width: 80px; height: 3px; margin: .8rem auto 0;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
}
.about-grid .section-title::after { margin-inline: 0; }
.section-sub { color: var(--muted); }

/* عن المقرأة */
.about-grid { display: grid; gap: 2.5rem; align-items: start; }
@media (min-width: 900px) { .about-grid { grid-template-columns: 1.1fr 1fr; } }
.values { list-style: none; margin: 0; padding: 0; display: grid; gap: 1rem; }
.values li {
  display: flex; gap: 1rem; align-items: flex-start;
  background: #fff; padding: 1.2rem 1.4rem; border-radius: var(--radius);
  box-shadow: var(--shadow); border-inline-start: 4px solid var(--gold);
}
.values h3 { font-size: 1.25rem; margin-bottom: .2rem; }
.values p { margin: 0; color: var(--muted); font-size: .98rem; }
.v-icon { color: var(--crimson); font-size: 1.6rem; line-height: 1; }

/* البرامج */
.cards { display: grid; gap: 1.5rem; }
@media (min-width: 640px) { .cards { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1100px) { .cards { grid-template-columns: repeat(4, 1fr); } }
.card {
  background: #fff; border-radius: var(--radius); padding: 2rem 1.6rem;
  box-shadow: var(--shadow); position: relative; overflow: hidden;
  transition: transform .25s, box-shadow .25s;
}
.card::before { content: ""; position: absolute; inset-inline: 0; top: 0; height: 4px; background: linear-gradient(90deg, var(--crimson), var(--gold)); }
.card:hover { transform: translateY(-6px); box-shadow: 0 18px 40px rgba(31, 77, 58, .16); }
.card h3 { font-size: 1.4rem; }
.card p { color: var(--muted); margin: 0; font-size: .98rem; }
.card-icon {
  width: 56px; height: 56px; border-radius: 16px; margin-bottom: 1.2rem;
  display: grid; place-items: center; background: rgba(179, 32, 58, .08);
}
.card-icon svg { width: 28px; height: 28px; fill: none; stroke: var(--crimson); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* الخطوات */
.steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 1.5rem; counter-reset: s; }
@media (min-width: 768px) { .steps { grid-template-columns: repeat(3, 1fr); } }
.step { text-align: center; padding: 2rem 1.5rem; border: 1px dashed rgba(201, 162, 39, .6); border-radius: var(--radius); background: #fff; }
.step-num {
  display: inline-grid; place-items: center; width: 64px; height: 64px; margin-bottom: 1rem;
  border-radius: 50%; background: var(--green); color: var(--gold);
  font: 700 1.8rem var(--font-head);
  box-shadow: 0 0 0 6px rgba(31, 77, 58, .1);
}
.step h3 { font-size: 1.35rem; }
.step p { margin: 0; color: var(--muted); }

/* الدروس */
.section-dark { background: var(--pattern), var(--green-dark); color: #fff; }
.section-dark .section-title { color: #fff; }
.section-dark .section-sub { color: rgba(255, 255, 255, .8); }
.section-dark .eyebrow { color: var(--gold); }
/* الأسئلة */
.faq details {
  background: #fff; border-radius: 14px; margin-bottom: .9rem;
  box-shadow: 0 4px 14px rgba(31, 77, 58, .06); border: 1px solid var(--sand);
}
.faq summary {
  list-style: none; cursor: pointer; padding: 1.1rem 1.4rem;
  font-weight: 700; color: var(--green-dark);
  display: flex; justify-content: space-between; align-items: center; gap: 1rem;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; font-size: 1.5rem; color: var(--crimson); transition: transform .25s; }
.faq details[open] summary::after { transform: rotate(45deg); }
.faq details p { padding: 0 1.4rem 1.2rem; margin: 0; color: var(--muted); }

/* التواصل */
/* Same green family as the footer below it, gold as the one accent, so the page ends as one calm block. */
.cta { background: var(--pattern), linear-gradient(180deg, var(--green), var(--green-dark)); color: #fff; text-align: center; }
.cta h2 { color: #fff; font-size: clamp(1.9rem, 5vw, 2.8rem); }
.cta-inner > p { font-family: var(--font-head); font-size: clamp(1.2rem, 3vw, 1.6rem); color: var(--gold); margin-bottom: 2.5rem; }
.contact-buttons { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); max-width: 1120px; margin-inline: auto; }
.cbtn {
  display: flex; align-items: center; gap: .9rem; padding: 1rem 1.3rem;
  background: #fff; color: var(--ink); text-decoration: none; border-radius: 16px;
  text-align: start; transition: transform .2s, box-shadow .2s;
}
.cbtn:hover { transform: translateY(-4px); box-shadow: 0 14px 30px rgba(0, 0, 0, .2); }
.cbtn svg { width: 40px; height: 40px; padding: 8px; border-radius: 12px; fill: #fff; flex-shrink: 0; }
.cbtn span { display: flex; flex-direction: column; font-weight: 700; font-size: 1.1rem; line-height: 1.4; }
.cbtn small { font-weight: 400; color: var(--muted); font-size: .85rem; }
.messenger svg { background: linear-gradient(135deg, #0099FF, #A033FF); }
.whatsapp svg { background: #25D366; }
.youtube svg { background: #FF0000; }
.facebook svg { background: #1877F2; }
.instagram svg { background: radial-gradient(circle at 30% 107%, #fdf497 0%, #fd5949 45%, #d6249f 60%, #285AEB 90%); }

/* التذييل */
.site-footer { background: var(--green-dark); color: rgba(255, 255, 255, .85); padding-top: 3rem; border-top: 1px solid rgba(201, 162, 39, .35); }
.site-footer:has(> .copy:only-child) { padding-top: 0; } /* the plans page: just the copyright line */
.footer-inner { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 2rem; padding-bottom: 2rem; border-bottom: 1px solid rgba(255, 255, 255, .12); }
.footer-brand { display: flex; align-items: center; gap: 1rem; }
.footer-brand img { border-radius: 50%; background: #fff; border: 2px solid var(--gold); }
.footer-brand strong { font-family: var(--font-head); font-size: 1.3rem; color: var(--gold); }
.footer-brand p { margin: 0; font-size: .9rem; }
.footer-links { display: flex; flex-wrap: wrap; gap: .4rem 1.4rem; }
.footer-links a { color: rgba(255, 255, 255, .85); text-decoration: none; }
.footer-links a:hover { color: var(--gold); }
.copy { text-align: center; margin: 0; padding: 1.2rem; font-size: .9rem; opacity: .7; }

/* ===== رفيق القرآن (بطاقة في الرئيسية) ===== */
.companion {
  display: grid; gap: 2rem; align-items: center; padding: clamp(1.6rem, 4vw, 3rem);
  border-radius: 28px; color: #fff; box-shadow: var(--shadow);
  background: var(--pattern) center / 80px, linear-gradient(140deg, var(--green), var(--green-dark));
}
@media (min-width: 900px) { .companion { grid-template-columns: 1.2fr 1fr; } }
.companion .eyebrow { color: var(--gold); }
.companion .section-title { color: #fff; }
.companion-text p:not(.eyebrow) { color: rgba(255, 255, 255, .88); max-width: 36rem; }
.companion-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .7rem; }
.companion-list a {
  display: flex; align-items: center; gap: .55rem; min-height: 52px; padding: .6rem 1rem; border-radius: 14px;
  color: #fff; text-decoration: none; font-weight: 700; background: rgba(255, 255, 255, .08); border: 1px solid rgba(201, 162, 39, .35);
  transition: background .2s, border-color .2s;
}
.companion-list a::before { content: ""; width: 8px; height: 8px; flex: none; transform: rotate(45deg); background: var(--gold); }
.companion-list a:hover { background: rgba(255, 255, 255, .16); border-color: var(--gold); }

/* ===== حركة الظهور ===== */
.js .reveal { opacity: 0; transform: translateY(24px); transition: opacity .7s ease, transform .7s ease; }
.js .reveal.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .js .reveal { opacity: 1; transform: none; transition: none; }
  * { transition: none !important; }
}

/* ===== صفحات الدخول ولوحات التحكم ===== */
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: .9rem; }
.btn-sm { padding: .45rem 1rem; font-size: .9rem; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .6; cursor: wait; transform: none; }

.form { display: grid; gap: 1rem; text-align: start; }
.form label { display: grid; gap: .35rem; font-weight: 700; color: var(--green-dark); font-size: .95rem; }
.form input, .form select, .form textarea {
  width: 100%; padding: .75rem .9rem; font: 400 1rem var(--font-body); color: var(--ink);
  background: #fff; border: 1.5px solid #e2d8c3; border-radius: 12px; transition: border-color .2s, box-shadow .2s;
}
.form input:focus, .form select:focus, .form textarea:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 4px rgba(201, 162, 39, .18); }
.form-error { margin: 0; padding: .7rem .9rem; border-radius: 10px; background: #fdecef; color: var(--crimson-dark); font-weight: 500; }
.pw-row { display: flex; gap: .5rem; }

.auth-page {
  min-height: 100vh; display: grid; place-items: center; padding: 1.5rem;
  background: var(--pattern), radial-gradient(ellipse at top, #fff, var(--cream) 70%);
}
.auth-card {
  width: min(420px, 100%); background: #fff; border-radius: 24px; padding: 2.2rem 1.8rem; text-align: center;
  box-shadow: 0 30px 60px rgba(31, 77, 58, .12); border-top: 5px solid var(--gold);
}
.auth-logo img { width: 110px; height: 110px; margin: 0 auto 1rem; border-radius: 50%; }
.auth-card h1 { font-size: 2rem; margin-bottom: .2rem; }
.auth-card .form { margin-block: 1.5rem; }
/* شاشات قصيرة (لابتوب): بطاقة أصغر حتى تتسع الصفحة بلا شريط تمرير */
@media (max-height: 760px) {
  .auth-page { padding: .75rem; }
  .auth-card { padding: 1.3rem 1.6rem; }
  .auth-logo img { width: 76px; height: 76px; margin-bottom: .4rem; }
  .auth-card .form { margin-block: 1rem; }
}

.app-page { background: var(--pattern), var(--cream); min-height: 100vh; }
.app-bar { background: #fff; border-bottom: 1px solid rgba(201, 162, 39, .3); position: sticky; top: 0; z-index: 10; }
.app-bar-inner { display: flex; justify-content: space-between; align-items: center; gap: 1rem; min-height: 68px; }
.app-bar .brand img { width: 44px; height: 44px; }
.app-main { padding-block: 2rem 4rem; }

.welcome { text-align: center; padding-block: 1.5rem 2rem; }
.welcome h1 { font-size: clamp(1.9rem, 5vw, 2.8rem); }
.welcome .hadith { display: inline-block; }

.info-grid, .stat-row { display: grid; gap: 1rem; margin-bottom: 1.5rem; }
@media (min-width: 700px) { .info-grid { grid-template-columns: repeat(3, 1fr); } .stat-row { grid-template-columns: repeat(3, 1fr); } }
.info-card {
  background: #fff; border-radius: var(--radius); padding: 1.3rem 1.5rem; box-shadow: var(--shadow);
  border-inline-start: 4px solid var(--gold); display: grid; gap: .2rem;
}
.info-card span { color: var(--muted); font-size: .9rem; }
.info-card strong { font-family: var(--font-head); font-size: 1.4rem; color: var(--green-dark); overflow-wrap: anywhere; }
.note-card { background: var(--green); color: #fff; border-radius: var(--radius); padding: 1.6rem 1.8rem; margin-bottom: 2rem; }
.note-card h2 { color: var(--gold); font-size: 1.4rem; }
.note-card p { margin: 0; white-space: pre-line; }

.admin-grid { display: grid; gap: 1.5rem; align-items: start; }
@media (min-width: 1000px) { .admin-grid { grid-template-columns: 380px 1fr; } }
.panel { background: #fff; border-radius: var(--radius); padding: 1.6rem; box-shadow: var(--shadow); min-width: 0; }
.panel h2 { font-size: 1.5rem; }
.created { margin-top: 1.5rem; padding: 1.2rem; border-radius: 14px; background: #eef6f1; border: 1px solid #cfe5d8; }
.created strong { color: var(--green); }
.created pre { white-space: pre-wrap; font: 500 .95rem var(--font-body); background: #fff; padding: .8rem; border-radius: 10px; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 520px; }
th, td { padding: .75rem .6rem; text-align: start; border-bottom: 1px solid var(--sand); }
th { color: var(--muted); font-weight: 700; font-size: .9rem; }
.link-danger { background: none; border: 0; color: var(--crimson); font: 700 .9rem var(--font-body); cursor: pointer; padding: .3rem .5rem; border-radius: 6px; }
.link-danger:hover { background: #fdecef; }

/* ===== مسارات التحفيظ ===== */
:root { --c-hifz: var(--crimson); --c-link: #A8801A; --c-far: var(--green); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.section-sm { padding-block: clamp(1.5rem, 4vw, 2.5rem); }
.nav a[aria-current] { color: var(--crimson); background: var(--sand); }
.card-link { display: inline-block; margin-top: 1rem; font-weight: 700; color: var(--crimson); text-decoration: none; }
.card-link:hover { text-decoration: underline; }

.page-hero { background: var(--pattern), radial-gradient(ellipse at 80% 0%, #fff, var(--cream) 70%); padding-block: clamp(2.5rem, 6vw, 4.5rem) 1rem; }
.page-hero h1 { font-size: clamp(2.2rem, 6vw, 3.4rem); }
.page-hero .lead { max-width: 70ch; }
.legend { list-style: none; padding: 0; margin: 2rem 0 0; display: grid; gap: .8rem; }
@media (min-width: 768px) { .legend { grid-template-columns: repeat(3, 1fr); } }
.legend li { background: #fff; border-radius: 14px; padding: 1rem 1.2rem; box-shadow: var(--shadow); border-inline-start: 5px solid var(--c); display: grid; gap: .2rem; }
.legend strong { color: var(--c); font-size: 1.05rem; }
.legend span { color: var(--muted); font-size: .92rem; }
.p-hifz { --c: var(--c-hifz); --bg: #fbeef0; }
.p-link { --c: var(--c-link); --bg: #fbf5e4; }
.p-far { --c: var(--c-far); --bg: #eaf3ee; }

.panel-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; margin-bottom: 1rem; }
.panel-head h2 { margin-bottom: .2rem; }

/* جدول النظرة العامة */
.overview { min-width: 640px; }
.overview th, .overview td { text-align: center; padding: .35rem; border-bottom: 1px solid var(--sand); }
.overview thead th { font-size: .9rem; color: var(--green-dark); }
.overview tbody th { font-family: var(--font-head); font-size: 1.05rem; color: var(--green-dark); white-space: nowrap; }
.overview td.empty { color: #cbbfa6; }
.cell {
  width: 100%; display: grid; gap: .1rem; padding: .55rem .4rem; border-radius: 10px; cursor: pointer;
  background: var(--cream); border: 1.5px solid transparent; font-family: var(--font-body); color: var(--ink);
  transition: background .15s, border-color .15s;
}
.cell strong { font-size: .95rem; color: var(--green-dark); }
.cell small { font-size: .75rem; color: var(--muted); white-space: nowrap; }
.cell:hover { border-color: var(--gold); background: #fff; }
.cell.on { background: var(--green); border-color: var(--green); }
.cell.on strong, .cell.on small { color: #fff; }

/* اختيار الخطة */
.picker { display: grid; gap: 1rem; margin-bottom: 2rem; }
.picker-row { display: grid; gap: .5rem; min-width: 0; }
@media (min-width: 900px) { .picker-row { grid-template-columns: 180px 1fr; align-items: center; } }
.picker-label { font-weight: 700; color: var(--green-dark); }
.chips { display: flex; gap: .4rem; overflow-x: auto; padding-block: .2rem; min-width: 0; }
.chip {
  flex: 0 0 auto; min-width: 44px; height: 44px; border-radius: 12px; border: 1.5px solid #e2d8c3; background: #fff;
  font: 700 1rem var(--font-body); color: var(--ink); cursor: pointer; transition: all .15s;
}
.chip:hover:not(:disabled) { border-color: var(--gold); }
.chip:disabled { background: #f4efe4; border-color: #ebe3d1; color: #c4b89f; cursor: not-allowed; text-decoration: line-through; }
.chip.on { background: var(--green); border-color: var(--green); color: #fff; box-shadow: 0 6px 14px rgba(31, 77, 58, .25); }
.segmented { display: inline-flex; flex-wrap: wrap; gap: .3rem; background: var(--sand); padding: .3rem; border-radius: 14px; width: fit-content; max-width: 100%; }
.seg { border: 0; background: transparent; padding: .55rem 1.1rem; border-radius: 10px; font: 700 .95rem var(--font-body); color: var(--ink); cursor: pointer; min-height: 40px; }
.seg:hover:not(:disabled) { background: rgba(255, 255, 255, .6); }
.seg.on { background: #fff; color: var(--crimson); box-shadow: 0 2px 8px rgba(0, 0, 0, .08); }
.seg:disabled { color: #b9ad97; cursor: not-allowed; text-decoration: line-through; }

.plan-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.2rem; }
.plan-head .eyebrow { margin-bottom: .2rem; }
.plan-title { text-align: start; margin: 0; }
.plan-title::after { margin-inline: 0; }

/* ملخص الخطة */
.plan-summary { margin-bottom: 2rem; }
.tiles { display: grid; gap: .8rem; grid-template-columns: repeat(2, 1fr); margin-bottom: 1rem; }
@media (min-width: 900px) { .tiles { grid-template-columns: repeat(4, 1fr); } }
.tiles.perf { margin-bottom: 1.5rem; }
.tile { background: #fff; border-radius: 14px; padding: 1rem 1.1rem; box-shadow: var(--shadow); display: grid; gap: .1rem; align-content: start; min-width: 0; }
.tile-label { color: var(--muted); font-size: .85rem; }
.tile strong { font-family: var(--font-head); font-size: clamp(1.15rem, 2.6vw, 1.45rem); color: var(--green-dark); line-height: 1.4; overflow-wrap: anywhere; }
.tile small { color: var(--muted); font-size: .8rem; }
.tile-main { background: var(--green); }
.tile-main .tile-label, .tile-main small { color: rgba(255, 255, 255, .8); }
.tile-main strong { color: var(--gold); font-size: clamp(1.6rem, 4vw, 2rem); }

.mushaf { background: #fff; border-radius: 14px; padding: 1rem 1.2rem .7rem; box-shadow: var(--shadow); }
.mushaf-track {
  position: relative; height: 14px; border-radius: 99px; overflow: hidden;
  background: repeating-linear-gradient(to left, var(--sand) 0 calc(100% / 30 - 2px), #fff calc(100% / 30 - 2px) calc(100% / 30));
}
.mushaf-fill { position: absolute; top: 0; bottom: 0; border-radius: 99px; background: linear-gradient(90deg, var(--gold), var(--crimson)); }
.mushaf-scale { display: flex; justify-content: space-between; font-size: .8rem; color: var(--muted); margin-top: .35rem; }
.mushaf-scale span:nth-child(2) { color: var(--crimson); font-weight: 700; }

/* قائمة الدروس */
.lessons { display: grid; gap: 1.4rem; }
.week { display: grid; gap: .6rem; }
.week-title {
  font-family: var(--font-body); font-size: .9rem; font-weight: 800; color: var(--muted); margin: 0;
  display: flex; align-items: center; gap: .8rem;
}
.week-title::after { content: ""; flex: 1; height: 1px; background: #e7dcc5; }
.lesson {
  background: #fff; border-radius: 14px; box-shadow: 0 2px 10px rgba(31, 77, 58, .06); border: 1px solid #efe6d3;
  padding: .9rem 1rem; display: grid; gap: .7rem; scroll-margin-top: 90px; min-width: 0;
}
.lesson-head { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.lesson-n {
  display: inline-grid; place-items: center; min-width: 36px; height: 36px; padding-inline: .3rem; border-radius: 10px;
  background: var(--sand); color: var(--green-dark); font-weight: 800;
}
.kind { font-size: .78rem; font-weight: 700; padding: .2rem .6rem; border-radius: 99px; background: var(--sand); color: var(--muted); }
.kind-exam1, .kind-exam2, .kind-final { background: #fbf0d0; color: #7a5b06; }
.kind-intro { background: #eaf3ee; color: var(--green); }
.kind-current { background: var(--crimson); color: #fff; }
.lesson.special { background: linear-gradient(90deg, #fffaf0, #fff); border-color: #f0dfae; }
.lesson.k-intro { background: #f6faf7; border-color: #d7e9dd; }
.lesson.current { border: 2px solid var(--crimson); box-shadow: 0 8px 24px rgba(179, 32, 58, .14); }
.parts { display: grid; gap: .5rem; min-width: 0; }
.part { background: var(--bg); border-inline-start: 4px solid var(--c); border-radius: 10px; padding: .45rem .7rem; display: grid; gap: .1rem; min-width: 0; }
.part-label { font-size: .75rem; font-weight: 800; color: var(--c); }
.range { display: flex; flex-wrap: wrap; align-items: baseline; gap: .2rem .6rem; }
.range-text { font-weight: 700; color: var(--ink); }
.page-pill { font-size: .78rem; font-weight: 700; color: var(--c); background: #fff; border-radius: 99px; padding: 0 .5rem; white-space: nowrap; }
.part-empty { margin: 0; }
.lesson-title { margin: 0; font-weight: 800; color: var(--ink); }
.k-exam1 .part, .k-exam2 .part, .k-final .part { --c: #8a6a0c; --bg: #fff6dc; }
.k-exam1 .part-label::after, .k-exam2 .part-label::after, .k-final .part-label::after { content: " · نطاق الاختبار"; }

@media (min-width: 900px) {
  .lesson { grid-template-columns: 120px 1fr; align-items: center; }
  .lesson > :nth-child(3) { grid-column: 1 / -1; }
  .parts { grid-template-columns: repeat(3, 1fr); }
  .part.p-hifz { grid-column: 1; }
  .part.p-link { grid-column: 2; }
  .part.p-far { grid-column: 3; }
}
@media (min-width: 1200px) {
  .app-page .lesson:has(.controls) { grid-template-columns: 110px 1fr 430px; }
  .app-page .lesson:has(.controls) > :nth-child(3) { grid-column: auto; }
}

/* ===== لوحة الإدارة: سجل الطالبة ===== */
.back-link { display: inline-block; margin-bottom: 1rem; color: var(--green); font-weight: 700; text-decoration: none; }
.student-head { display: grid; gap: 1rem; margin-bottom: 1.5rem; }
@media (min-width: 900px) { .student-head { grid-template-columns: 1fr 380px; align-items: center; } }
.student-head h1 { margin: 0; font-size: clamp(1.7rem, 4vw, 2.2rem); }
.student-head p { margin: 0; }
.plan-pick { display: grid; gap: .35rem; font-weight: 700; color: var(--green-dark); }
.plan-pick small { font-weight: 400; }
/* حقل واحد للموقع كله: القوائم ومربعات البحث بالشكل نفسه (الحواف المنحنية والإطار وحلقة التركيز) */
select, .tk-search { padding: .7rem .9rem; font: 500 1rem var(--font-body); border: 1.5px solid #e2d8c3; border-radius: 12px; background: #fff; color: var(--ink); width: 100%; }
.tk-search { -webkit-appearance: none; appearance: none; } /* بلا شكل المتصفح المربع */
select:focus, .tk-search:focus, .ss-q:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 4px rgba(201, 162, 39, .18); }
.empty-state { text-align: center; padding-block: 2.5rem; }
.hint { margin: 0 0 1rem; }

.tabs { display: flex; gap: .3rem; border-bottom: 2px solid #e7dcc5; margin: 2rem 0 1.2rem; overflow-x: auto; }
.tabs [role=tab] {
  border: 0; background: none; padding: .8rem 1.2rem; font: 700 1rem var(--font-body); color: var(--muted); cursor: pointer;
  border-bottom: 3px solid transparent; margin-bottom: -2px; white-space: nowrap;
}
.tabs [role=tab][aria-selected=true] { color: var(--crimson); border-bottom-color: var(--crimson); }

.controls { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem .8rem; border-top: 1px dashed #eadfca; padding-top: .7rem; }
@media (min-width: 1200px) { .app-page .lesson .controls { border-top: 0; padding-top: 0; border-inline-start: 1px dashed #eadfca; padding-inline-start: .9rem; } }
.att { display: inline-flex; border: 0; padding: 0; margin: 0; gap: .25rem; }
.att-opt { position: relative; }
.att-opt input { position: absolute; opacity: 0; pointer-events: none; }
.att-opt span {
  display: inline-block; padding: .35rem .7rem; border-radius: 99px; border: 1.5px solid #e2d8c3; background: #fff;
  font-size: .85rem; font-weight: 700; color: var(--muted); cursor: pointer; user-select: none;
}
.att-opt input:focus-visible + span { outline: 3px solid var(--gold); outline-offset: 2px; }
.att-present input:checked + span { background: #e3f3e8; border-color: #3c8d5a; color: #23633b; }
.att-absent input:checked + span { background: #fde8eb; border-color: var(--crimson); color: var(--crimson-dark); }
.att-excused input:checked + span { background: #fdf3d8; border-color: #c49a1d; color: #7a5b06; }
.grade { display: inline-flex; align-items: center; gap: .35rem; font-size: .85rem; font-weight: 700; color: var(--green-dark); }
.grade input { width: 4.6rem; padding: .35rem .5rem; border: 1.5px solid #e2d8c3; border-radius: 9px; font: 600 .95rem var(--font-body); text-align: center; }
.grade input:disabled { background: #f6f2ea; color: #bbb; }
.grade input:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px rgba(201, 162, 39, .2); }
.grade input:invalid { border-color: var(--crimson); }
.link-muted { background: none; border: 0; color: var(--muted); font: 600 .8rem var(--font-body); cursor: pointer; text-decoration: underline; padding: .2rem; }
.save-state { font-size: .78rem; min-width: 4.5rem; }
.save-state.saving { color: var(--muted); }
.save-state.ok { color: #2f7a4a; }
.save-state.bad { color: var(--crimson); font-weight: 700; }

.toast {
  position: fixed; inset-inline: 0; bottom: calc(1.2rem + env(safe-area-inset-bottom, 0px)); margin: auto; width: fit-content; max-width: calc(100% - 2rem);
  background: var(--green-dark); color: #fff; padding: .7rem 1.3rem; border-radius: 12px; box-shadow: 0 10px 30px rgba(0, 0, 0, .25); z-index: 100; font-weight: 600;
}
.toast.bad { background: var(--crimson-dark); }

.badge { display: inline-block; font-size: .78rem; font-weight: 700; padding: .2rem .65rem; border-radius: 99px; background: var(--sand); color: var(--muted); }
.badge-ok { background: #e3f3e8; color: #23633b; }
.badge-warn { background: #fdf3d8; color: #7a5b06; }

.exams { display: grid; gap: 1.2rem; }
.exam-head { display: flex; align-items: center; gap: .8rem; flex-wrap: wrap; margin-bottom: 1rem; }
.exam-head h2 { margin: 0; font-size: 1.4rem; }
.exam-score-box { margin-inline-start: auto; display: flex; align-items: baseline; gap: .35rem; background: var(--green); color: #fff; padding: .4rem 1rem; border-radius: 12px; }
.exam-score-box span, .exam-score-box small { opacity: .85; font-size: .85rem; }
.exam-score { font-family: var(--font-head); font-size: 1.7rem; color: var(--gold); }
.exam-grid { min-width: 720px; }
.exam-grid th, .exam-grid td { padding: .4rem; border-bottom: 1px solid var(--sand); }
.exam-grid tbody th { font-size: .9rem; color: var(--green-dark); white-space: nowrap; }
.exam-grid tbody th small { color: var(--muted); font-weight: 500; }
.exam-grid input { width: 100%; padding: .45rem .5rem; border: 1.5px solid #e2d8c3; border-radius: 9px; font: 500 .95rem var(--font-body); text-align: center; background: #fff; }
.exam-grid input[type=text] { text-align: start; }
.exam-grid input:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px rgba(201, 162, 39, .2); }
.exam-actions { display: flex; align-items: center; gap: 1rem; margin-top: 1rem; }

/* قائمة الطالبات */
.strong-link { font-weight: 700; color: var(--green-dark); text-decoration: none; }
.strong-link:hover { color: var(--crimson); text-decoration: underline; }
.mono { font-family: ui-monospace, Consolas, monospace; font-size: .9rem; text-align: start; }
.row-actions { white-space: nowrap; }
.row-actions > * { vertical-align: middle; }
.mini-progress { display: inline-flex; align-items: center; gap: .5rem; font-size: .85rem; color: var(--muted); }
.mini-progress .bar { width: 70px; height: 6px; border-radius: 9px; background: var(--sand); overflow: hidden; }
.mini-progress .bar span { display: block; height: 100%; background: var(--green); }

/* ===== لوحة الطالبة: خطتي ===== */
#my-plan { margin-block: 2.5rem; }
.progress-line { height: 10px; border-radius: 99px; background: var(--sand); overflow: hidden; margin-bottom: .4rem; }
.progress-line span { display: block; height: 100%; background: linear-gradient(90deg, var(--gold), var(--green)); border-radius: 99px; }
.today { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.3rem 1.4rem; margin-block: 1.2rem 1.5rem; border-top: 4px solid var(--crimson); }
.today.done { border-top-color: var(--green); text-align: center; }
.today-head { display: flex; align-items: baseline; gap: .8rem; flex-wrap: wrap; margin-bottom: .8rem; }
.today-head .eyebrow { margin: 0; }
.today-head h3 { margin: 0; font-size: 1.5rem; }
.today-head a { margin-inline-start: auto; }
.today-parts { display: grid; gap: .6rem; }
@media (min-width: 768px) { .today-parts { grid-template-columns: repeat(3, 1fr); } }
.sub-title { font-size: 1.5rem; margin-top: 2rem; }
.my-result { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; }
.my-result:empty { display: none; }
.att-chip, .grade-chip { font-size: .8rem; font-weight: 700; padding: .2rem .6rem; border-radius: 99px; background: var(--sand); color: var(--muted); }
.att-chip.att-present { background: #e3f3e8; color: #23633b; }
.att-chip.att-absent { background: #fde8eb; color: var(--crimson-dark); }
.att-chip.att-excused { background: #fdf3d8; color: #7a5b06; }
.grade-chip strong { color: var(--green-dark); }

/* ===== الطباعة ===== */
.print-only { display: none; }

/* طباعة الخطة: صفحة A4، كل درس في سطر واحد بأعمدة ثابتة مثل ورقة الإكسل */
@page { size: A4 portrait; margin: 11mm 10mm 12mm; }
@media print {
  html { font-size: 10px; }
  body { background: #fff !important; font-size: 9pt; line-height: 1.45; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .site-header, .site-footer, .no-print, .overview-panel, .picker, .skip, .cta, .toast, .page-hero, .mushaf, #plan .plan-head .eyebrow { display: none !important; }
  .section-sm, .section { padding: 0 !important; }
  .container { width: 100% !important; max-width: none; margin: 0; }
  .print-only { display: revert; }

  /* الترويسة */
  .print-brand { display: flex !important; align-items: center; gap: 3mm; padding-bottom: 1.8mm; margin-bottom: 2.2mm; border-bottom: 1.5pt solid var(--gold); }
  .print-brand img { width: 10mm; height: 10mm; border-radius: 50%; }
  .print-brand strong { display: block; font-family: var(--font-head); font-size: 13pt; color: var(--crimson); line-height: 1.2; }
  .print-brand span { color: var(--muted); font-size: 8.5pt; }
  .print-brand .print-name { margin-inline-start: auto; font-size: 10pt; color: var(--ink); }

  .plan-head { margin: 0 0 1.8mm; }
  .plan-title { font-size: 14pt; }
  .plan-title::after { display: none; }
  .plan-note { font-size: 7.5pt; padding: 1mm 2.5mm; margin-bottom: 1.8mm; }

  /* ملخص الخطة في سطر واحد */
  .plan-summary { margin-bottom: 2.2mm; }
  .tiles { grid-template-columns: repeat(4, 1fr) !important; gap: 2mm; margin: 0; }
  .tile { box-shadow: none; border: .5pt solid #d9ccb0; border-radius: 1.5mm; padding: 1mm 2.5mm; gap: 0; }
  .tile-label, .tile small { font-size: 7pt; line-height: 1.25; }
  .tile strong { font-size: 10pt; line-height: 1.25; }

  /* الجدول: عمود الأسبوع (مدموج كما في الإكسل) ثم الدرس بأعمدته */
  .print-cols { display: grid !important; grid-template-columns: 7mm 8mm 1fr 1fr 1fr 13mm; column-gap: 1.5mm;
    font-weight: 800; font-size: 7.5pt; color: var(--green-dark); padding: .8mm 0; border-bottom: 1pt solid var(--green-dark); }
  .print-cols span:nth-child(3) { color: var(--c-hifz); }
  .print-cols span:nth-child(4) { color: var(--c-link); }
  .print-cols span:nth-child(5) { color: var(--c-far); }

  .lessons { display: block; }
  .week { display: grid !important; grid-template-columns: 7mm 1fr; column-gap: 1.5mm; gap: 0 1.5mm; border-bottom: .8pt solid #cdbf9f; break-inside: avoid; }
  .week-title {
    grid-column: 1; grid-row: 1 / span 20; display: flex; align-items: center; justify-content: center; margin: 0;
    font-size: 0; color: var(--green-dark); background: #f6f1e5; border-radius: 1mm; margin-block: .5mm;
  }
  .week-title::after { display: none; }
  .week-title::before { content: attr(data-week); font-size: 8pt; font-weight: 800; }
  .lesson {
    grid-column: 2; display: grid !important; grid-template-columns: 8mm 1fr 1fr 1fr 13mm; column-gap: 1.5mm; align-items: center;
    padding: .35mm 0; border: 0; border-bottom: .4pt solid #eee5d3; border-radius: 0;
    box-shadow: none !important; background: none !important; break-inside: avoid; gap: 0 1.5mm; min-width: 0;
  }
  .week .lesson:last-child { border-bottom: 0; }
  .lesson.current { border: 0; border-bottom: .4pt solid #eee5d3; }
  .lesson-head { grid-column: 1; gap: 1mm; flex-wrap: nowrap; }
  .lesson-n { min-width: 6.5mm; height: 4.6mm; border-radius: 1mm; font-size: 7.5pt; }
  .lesson-head .kind { display: none; }
  .parts { display: contents; }
  .part { padding: .15mm 1.4mm; border-inline-start-width: 1.4pt; border-radius: .8mm; gap: 0; }
  .part.p-hifz { grid-column: 2; }
  .part.p-link { grid-column: 3; }
  .part.p-far { grid-column: 4; }
  .part-label { display: none; }
  .range { gap: 0 1.2mm; line-height: 1.3; }
  .range-text { font-size: 7.8pt; }
  .page-pill { font-size: 6.5pt; padding: 0; background: none; }
  .lesson::after { content: ""; grid-column: 5; grid-row: 1; align-self: end; border-bottom: .6pt dotted #8a7f6c; height: 3.5mm; }

  /* أيام بلا حفظ جديد (لقاء، مراجعة، اختبار): اسم اليوم في عمود الحفظ */
  .lesson:not(:has(.p-hifz)) .lesson-head { grid-column: 1 / 3; }
  .lesson:not(:has(.p-hifz)) .lesson-head .kind { display: inline-block; font-size: 7pt; padding: 0 1.6mm; line-height: 1.5; }
  .lesson.special { background: #fffaf0 !important; }
  .part-empty { grid-column: 3 / 5; font-size: 7.5pt; line-height: 1.3; }
}

/* فصول مُكمَّلة لاتصال المسار */
.cell.generated { border: 1.5px dashed var(--gold); background: #fffdf6; }
.cell.generated.on { border-style: solid; border-color: var(--green); background: var(--green); }
.gen-key { display: inline-block; padding: 0 .45rem; border: 1.5px dashed var(--gold); border-radius: 6px; background: #fffdf6; }
.plan-note { background: #fff8e3; border: 1px solid #f0dfae; border-inline-start: 4px solid var(--gold); border-radius: 12px; padding: .75rem 1rem; color: #6b5310; font-size: .95rem; margin: 0 0 1rem; }

/* ===== شريط التمرير بألوان الهوية ===== */
/* Chrome / Edge / Safari: مقبض ذهبي مستدير على مسار كريمي، ويصير قرمزيًا عند المرور */
::-webkit-scrollbar { width: 12px; height: 10px; }
::-webkit-scrollbar-track { background: var(--sand); }
::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, var(--gold), var(--gold-dark));
  border-radius: 99px; border: 3px solid var(--sand);
}
::-webkit-scrollbar-thumb:hover { background: linear-gradient(180deg, var(--crimson), var(--crimson-dark)); }
::-webkit-scrollbar-thumb:active { background: var(--green); }
::-webkit-scrollbar-corner { background: var(--sand); }
/* المناطق الداخلية (شريط الفصول، الجداول العريضة): شريط أنحف */
.chips::-webkit-scrollbar, .table-wrap::-webkit-scrollbar, .tabs::-webkit-scrollbar { height: 7px; }
.chips::-webkit-scrollbar-track, .table-wrap::-webkit-scrollbar-track, .tabs::-webkit-scrollbar-track { background: transparent; }
.chips::-webkit-scrollbar-thumb, .table-wrap::-webkit-scrollbar-thumb, .tabs::-webkit-scrollbar-thumb { border-width: 2px; border-color: #fff; }

/* Firefox (لا يدعم تنسيق المقبض بالتفصيل): نفس الألوان */
@supports not selector(::-webkit-scrollbar) {
  html { scrollbar-color: var(--gold) var(--sand); }
  .chips, .table-wrap, .tabs { scrollbar-width: thin; scrollbar-color: var(--gold) transparent; }
}

/* لوحة الإدارة: قائمة الطلاب بعرض الصفحة، والإضافة في نافذة */
.panel-wide { grid-column: 1 / -1; }
.panel-tools { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; }
.modal {
  width: min(520px, calc(100% - 2rem)); max-height: calc(100dvh - 2rem); overflow-y: auto; scrollbar-width: none;
  border: 0; border-radius: var(--radius); padding: 1.3rem 1.5rem; box-shadow: 0 30px 60px rgba(31, 77, 58, .25);
}
.modal::backdrop { background: rgba(20, 40, 30, .45); }
.modal::-webkit-scrollbar { display: none; } /* بلا شريط تمرير في النوافذ؛ تبقى قابلة للتمرير في الشاشات الصغيرة جدًا */
.modal .panel-head { margin-bottom: .6rem; }
.modal .form { gap: .75rem; }
/* الملاحظة الصغيرة بجانب عنوان الحقل لا في سطر وحدها */
.modal .form label { display: flex; flex-wrap: wrap; align-items: baseline; column-gap: .4rem; row-gap: .3rem; }
.modal .form label > :is(input, select, textarea, .pw-row, .ss, span:has(select, input)) { flex-basis: 100%; }
/* نافذة بحقلين في كل سطر على الشاشات العريضة */
.modal-2col { width: min(820px, calc(100% - 2rem)); }
@media (min-width: 700px) {
  .modal-2col .form { grid-template-columns: repeat(2, minmax(0, 1fr)); row-gap: .55rem; }
  .modal-2col .form > :is(.span-all, .form-error, button) { grid-column: 1 / -1; }
}
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(180px, 100%), 1fr)); gap: .75rem; }

/* جداول القوائم (table-kit.js): بحث وتصفيات فوق الجدول، وترتيب بالنقر على الرأس، وصفحات تحته */
.tk-toolbar { display: flex; flex-wrap: wrap; gap: .6rem; margin-bottom: 1rem; }
.tk-toolbar input, .tk-toolbar select { width: auto; min-width: 0; flex: 1 1 150px; }
.tk-toolbar .tk-search { flex: 2 1 220px; min-height: 3rem; }
.tk-search::placeholder, .ss-q::placeholder { color: var(--muted); }
.tk-sort { all: unset; cursor: pointer; display: inline-flex; align-items: center; gap: .3rem; font: inherit; }
.tk-sort:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; border-radius: 4px; }
.tk-arrow::after { content: "↕"; opacity: .35; font-size: .85em; }
[aria-sort="ascending"] .tk-arrow::after { content: "↑"; opacity: 1; }
[aria-sort="descending"] .tk-arrow::after { content: "↓"; opacity: 1; }
.tk-pager { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: .8rem; margin-top: 1rem; }
.tk-pager select { width: auto; }
.tk-pages { display: inline-flex; align-items: center; gap: .6rem; }

/* قائمة منسدلة قابلة للبحث (app.js): زر بمظهر الـ select ونافذة بحث تحته */
.ss { position: relative; display: block; min-width: 0; }
.ss > select { position: absolute; inset: 0; opacity: 0; pointer-events: none; }
.ss-btn {
  width: 100%; text-align: start; cursor: pointer; padding: .7rem .9rem; padding-inline-end: 2.2rem;
  font: 500 1rem var(--font-body); color: var(--ink); background: #fff; border: 1.5px solid #e2d8c3; border-radius: 12px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; position: relative; min-height: 3rem;
}
.ss-btn::after { content: ""; position: absolute; inset-inline-end: .9rem; top: 50%; width: .45rem; height: .45rem; border: solid currentColor; border-width: 0 2px 2px 0; transform: translateY(-70%) rotate(45deg); }
.ss-btn:focus-visible, .ss-btn[aria-expanded="true"] { outline: none; border-color: var(--gold); box-shadow: 0 0 0 4px rgba(201, 162, 39, .18); }
.form .ss-btn { font-weight: 400; }
.ss-pop {
  position: absolute; z-index: 30; inset-inline: 0; top: calc(100% + 4px); min-width: 220px;
  background: #fff; border: 1.5px solid #e2d8c3; border-radius: 12px; box-shadow: var(--shadow); padding: .5rem;
}
.ss-q { width: 100%; padding: .55rem .8rem; font: 400 .95rem var(--font-body); color: var(--ink); background: #fff; border: 1.5px solid #e2d8c3; border-radius: 12px; margin-bottom: .4rem; }
.ss-list { list-style: none; margin: 0; padding: 0; max-height: 260px; overflow-y: auto; }
.ss-list li { padding: .45rem .7rem; border-radius: 8px; cursor: pointer; font-weight: 500; color: var(--ink); line-height: 1.5; }
.ss-list li.on { background: #f6efdc; }
.ss-list li.sel { color: var(--green); font-weight: 700; }
.ss-list li.ss-none { color: var(--muted); cursor: default; }

/* ===== لوحة الإدارة: التبويبات والنظرة العامة (charts.js و admin-panels.js) ===== */
.admin-tabs { margin-top: 0; }
.admin-tabs [role=tab] { display: inline-flex; align-items: center; gap: .5rem; }
.admin-tabs .badge:empty { display: none; }
.tab-ic { width: 1.25em; height: 1.25em; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.side-toggle { display: none; }

/* القائمة الجانبية: الشاشة العريضة وللمشرفين فقط (side-layout من admin-panels.js)، وتبقى شريط تبويبات في الهاتف */
@media (min-width: 1000px) {
  .has-side .container { width: min(1440px, 100% - 2.5rem); } /* الشريط العلوي بعرض اللوحة */
  .app-main.side-layout {
    display: grid; grid-template-columns: auto minmax(0, 1fr); column-gap: 1.5rem; align-items: start;
  }
  .side-layout > * { grid-column: 2; }
  .side-layout > .admin-side {
    grid-column: 1; grid-row: 1 / span 20; position: sticky; top: calc(68px + 1.25rem);
    width: 236px; display: flex; flex-direction: column; gap: .6rem; overflow: hidden;
    background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: .7rem;
    transition: width .25s ease;
  }
  .side-layout .admin-tabs { flex-direction: column; gap: .2rem; border-bottom: 0; margin: 0; overflow: visible; }
  .side-layout .admin-tabs [role=tab] {
    width: 100%; margin: 0; padding: .7rem .8rem; border: 0; border-radius: 12px; white-space: nowrap;
    transition: background .2s, color .2s;
  }
  .side-layout .admin-tabs [role=tab]:hover { background: var(--cream); color: var(--green-dark); }
  .side-layout .admin-tabs [role=tab][aria-selected=true] { background: #fbeef0; color: var(--crimson); box-shadow: inset -3px 0 0 var(--crimson); }
  .side-layout .admin-tabs .badge { margin-inline-start: auto; }
  .side-layout .side-toggle {
    display: flex; align-items: center; gap: .5rem; width: 100%; padding: .65rem .8rem; white-space: nowrap;
    border: 0; border-top: 1px solid var(--sand); border-radius: 0 0 12px 12px; background: none; cursor: pointer;
    font: 700 .9rem var(--font-body); color: var(--muted);
  }
  .side-layout .side-toggle:hover { color: var(--green-dark); }
  .side-toggle .tab-ic { transition: transform .25s ease; }

  /* مطوية: أيقونات فقط، والاسم في التلميح */
  .side-collapsed > .admin-side { width: 64px; }
  .side-collapsed .tab-label, .side-collapsed .admin-tabs .badge { display: none; }
  .side-collapsed .admin-tabs [role=tab], .side-collapsed .side-toggle { justify-content: center; padding-inline: 0; }
  .side-collapsed .side-toggle .tab-ic { transform: rotate(180deg); }
}
.overview-pane { display: grid; gap: 1.5rem; }

/* النظرة العامة: بطاقات البرامج، ثم تفاصيل البرنامج المفتوح */
.programs-strip {
  position: relative; overflow: hidden; padding: 1.1rem clamp(1rem, 2.5vw, 1.6rem);
  border-radius: var(--radius); color: var(--cream); box-shadow: 0 16px 40px rgba(20, 51, 39, .28);
  background: var(--pattern) center / 90px, linear-gradient(135deg, var(--green) 0%, var(--green-dark) 100%);
}
.programs-strip::after { /* لمعة ذهبية خفيفة في الزاوية */
  content: ""; position: absolute; inset-inline-end: -80px; top: -120px; width: 320px; height: 320px; border-radius: 50%;
  background: radial-gradient(circle, rgba(201, 162, 39, .28), transparent 65%); pointer-events: none;
}
.ps-head { position: relative; z-index: 1; display: flex; align-items: baseline; gap: .4rem 1rem; flex-wrap: wrap; margin-bottom: .75rem; }
.ps-head h2 { margin: 0; color: #fff; font-size: 1.4rem; }
.ps-head p { margin: 0; color: rgba(251, 247, 238, .7); font-size: .9rem; }
.ps-tiles { position: relative; z-index: 1; display: grid; gap: .8rem; grid-template-columns: repeat(6, minmax(0, 1fr)); }
@media (max-width: 1150px) { .ps-tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 560px) { .ps-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.ps-tile {
  display: flex; align-items: center; gap: .7rem; min-width: 0; padding: .65rem .8rem; border-radius: 14px;
  background: rgba(255, 255, 255, .07); border: 1px solid rgba(255, 255, 255, .1); backdrop-filter: blur(2px);
  opacity: 0; transform: translateY(10px); transition: opacity .5s ease, transform .5s ease, background .2s;
}
.ps-tile.in { opacity: 1; transform: none; }
.ps-tile:hover { background: rgba(255, 255, 255, .12); }
.ps-ic { flex: none; display: grid; place-items: center; width: 2.4rem; height: 2.4rem; border-radius: 50%; background: rgba(201, 162, 39, .18); color: var(--gold); }
.ps-ic svg { width: 1.3rem; height: 1.3rem; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.ps-body { display: grid; gap: .1rem; min-width: 0; flex: 1; }
.ps-body strong { font-family: var(--font-head); font-size: clamp(1.35rem, 2.2vw, 1.7rem); line-height: 1.2; color: #fff; font-variant-numeric: tabular-nums; }
.ps-body > span:not(.ps-bar) { color: rgba(251, 247, 238, .75); font-size: .82rem; font-weight: 700; line-height: 1.4; }
@media (max-width: 560px) { .ps-tile { flex-direction: column; align-items: flex-start; gap: .5rem; } .ps-body { width: 100%; } }
.ps-bar { display: block; height: 4px; margin-top: .3rem; border-radius: 9px; background: rgba(255, 255, 255, .15); overflow: hidden; }
.ps-bar span { display: block; height: 100%; width: 0; border-radius: inherit; background: linear-gradient(90deg, var(--gold), #E8CB6A); transition: width 1.2s cubic-bezier(.2, .8, .2, 1) .3s; }
.ps-tile.in .ps-bar span { width: var(--w); }
.pc-stat { display: grid; }
.pc-stat strong { font-family: var(--font-head); font-size: 1.25rem; color: var(--green-dark); font-variant-numeric: tabular-nums; line-height: 1.3; }
.pc-stat span { color: var(--muted); font-size: .82rem; font-weight: 700; }
/* صفحة البرامج تتسع في شاشة الحاسوب بلا تمرير */
.app-main:has(.program-grid:not([hidden])) { padding-block: 1.25rem 1rem; }
/* الشاشات القصيرة (حاسوب محمول مع شريط المتصفح): شريط أنحف وبطاقات بلا الشريط والعنوان الفرعي */
@media (min-width: 900px) and (max-height: 860px) {
  .app-main:has(.program-grid:not([hidden])) { padding-block: .9rem .6rem; }
  .overview-pane:has(.program-grid) { gap: .7rem; }
  .programs-strip { padding: .8rem 1.1rem; }
  .ps-head { margin-bottom: .5rem; }
  .ps-head h2 { font-size: 1.2rem; }
  .ps-tiles { gap: .55rem; }
  .ps-tile { padding: .45rem .6rem; gap: .5rem; }
  .ps-ic { width: 2rem; height: 2rem; }
  .ps-ic svg { width: 1.05rem; height: 1.05rem; }
  .ps-body strong { font-size: 1.3rem; }
  .ps-body > span:not(.ps-bar) { font-size: .74rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .program-grid { gap: .7rem; }
  .program-card { padding: .7rem 1rem; gap: .3rem; }
  .program-card h3 { font-size: 1.15rem; }
  .program-card .kpi-bar { display: none; }
  .program-card p { font-size: .8rem; }
  .pc-stat strong { font-size: 1.1rem; }
}
@media (min-width: 900px) and (max-height: 640px) { .ps-head { display: none; } }
.program-grid { display: grid; gap: 1rem; grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 1000px) { .program-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) { .program-grid { grid-template-columns: 1fr; } }
.program-card {
  --c: var(--green);
  font: inherit; color: inherit; text-align: start; cursor: pointer; border: 0; border-inline-start: 4px solid var(--gold);
  background: #fff; border-radius: var(--radius); padding: .95rem 1.15rem; box-shadow: var(--shadow);
  display: grid; gap: .45rem; align-content: start; justify-items: start; min-width: 0;
  opacity: 0; transform: translateY(12px); transition: opacity .5s ease, transform .5s ease, box-shadow .2s;
}
.program-card.in { opacity: 1; transform: none; }
.program-card:hover, .program-card:focus-visible { box-shadow: 0 14px 34px rgba(31, 77, 58, .18); }
.program-card:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
.program-card h3 { margin: 0; font-size: 1.25rem; line-height: 1.3; color: var(--green-dark); }
.program-card p { margin: 0; }
.program-card .kpi-bar { width: 100%; }
.program-card.in .kpi-bar span { width: var(--w); }
.pc-stats { display: flex; gap: 1.6rem; flex-wrap: wrap; }
.pc-open { color: var(--crimson); font-weight: 700; font-size: .9rem; }
.pc-foot { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: .5rem; flex-wrap: wrap; }
.seg.program-tabs { display: flex; flex-wrap: wrap; width: fit-content; max-width: 100%; margin-bottom: 0; border-radius: 14px; padding: .3rem; }
.program-tabs button { padding: .55rem 1.2rem; border-radius: 10px; font-size: .95rem; }
.program-head { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.program-head h2 { margin: 0; font-size: 1.6rem; color: var(--green-dark); }
.kpi-grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(min(190px, 100%), 1fr)); }
.kpi {
  --c: var(--green);
  background: #fff; border-radius: var(--radius); padding: 1.1rem 1.25rem; box-shadow: var(--shadow);
  border-inline-start: 4px solid var(--c); display: grid; gap: .15rem; align-content: start; min-width: 0;
  opacity: 0; transform: translateY(12px); transition: opacity .5s ease, transform .5s ease, box-shadow .2s;
}
.kpi.in { opacity: 1; transform: none; }
.kpi:hover { box-shadow: 0 14px 34px rgba(31, 77, 58, .16); }
.kpi-gold { --c: var(--gold); }
.kpi-red { --c: var(--crimson); }
.kpi-label { color: var(--muted); font-size: .9rem; font-weight: 700; }
.kpi strong { font-family: var(--font-head); font-size: clamp(1.6rem, 3vw, 2rem); color: var(--green-dark); line-height: 1.3; font-variant-numeric: tabular-nums; }
.kpi-red strong { color: var(--crimson-dark); }
.kpi small { color: var(--muted); font-size: .82rem; line-height: 1.5; }
.kpi-bar { height: 6px; border-radius: 9px; background: var(--sand); overflow: hidden; margin-block: .2rem; }
.kpi-bar span { display: block; height: 100%; width: 0; border-radius: inherit; background: var(--c); transition: width 1.2s cubic-bezier(.2, .8, .2, 1) .2s; }
.kpi.in .kpi-bar span { width: var(--w); }

.insights { border-inline-start: 4px solid var(--gold); }
.insights h3 { font-size: 1.3rem; }
.insights ul { margin: 0; padding-inline-start: 1.2rem; display: grid; gap: .35rem; }
.insights li::marker { color: var(--gold); }

.chart-grid { display: grid; gap: 1.5rem; }
@media (min-width: 900px) { .chart-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } .chart-wide { grid-column: 1 / -1; } }
.chart-card { display: grid; gap: .8rem; align-content: start; }
.chart-head h3 { font-size: 1.25rem; margin: 0; }
.chart-head p { margin: 0; }
.chart-foot { display: flex; justify-content: center; margin-top: .6rem; }

.ch-legend { list-style: none; margin: 0; padding: 0; display: grid; gap: .35rem; font-size: .92rem; }
.ch-legend li { display: flex; align-items: center; gap: .5rem; }
.ch-legend i { width: 12px; height: 12px; border-radius: 4px; flex: none; }
.ch-legend b { margin-inline-start: auto; color: var(--muted); font-weight: 500; font-variant-numeric: tabular-nums; }
.ch-lines .ch-legend { display: flex; flex-wrap: wrap; gap: .4rem 1.2rem; }

.ch-donut { display: grid; gap: 1.2rem; align-items: center; }
@media (min-width: 520px) { .ch-donut { grid-template-columns: 180px 1fr; } }
.ch-donut-fig { position: relative; width: 180px; max-width: 100%; justify-self: center; }
.ch-donut-fig svg { display: block; width: 100%; }
.ch-seg { stroke-dasharray: 0 100; transition: stroke-dasharray 1s cubic-bezier(.2, .8, .2, 1) var(--delay, 0s); }
.ch.in .ch-seg { stroke-dasharray: var(--d); }
.ch-seg:hover { stroke-width: 7.5; }
.ch-donut-c { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; line-height: 1.2; }
.ch-donut-c strong { font-family: var(--font-head); font-size: 1.7rem; color: var(--green-dark); }
.ch-donut-c span { font-size: .8rem; color: var(--muted); }

.ch-bars { list-style: none; margin: 0; padding: 0; display: grid; gap: .55rem; }
.ch-bars li { display: grid; grid-template-columns: minmax(7rem, 12rem) 1fr 3.4rem; gap: .7rem; align-items: center; }
.ch-bar-label { display: grid; line-height: 1.35; min-width: 0; font-weight: 700; font-size: .92rem; }
.ch-bar-label a { color: inherit; text-decoration: none; }
.ch-bar-label small { color: var(--muted); font-weight: 400; font-size: .78rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ch-bar-track { height: 12px; border-radius: 9px; background: var(--sand); overflow: hidden; }
.ch-bar { display: block; height: 100%; width: 0; border-radius: inherit; transition: width 1s cubic-bezier(.2, .8, .2, 1) var(--delay, 0s); }
.ch.in .ch-bar { width: var(--w); }
.ch-bar-v { font-variant-numeric: tabular-nums; color: var(--green-dark); }
@media (max-width: 520px) { .ch-bars li { grid-template-columns: 1fr 3rem; } .ch-bar-track { grid-column: 1 / -1; grid-row: 2; } }

.ch-cols { display: flex; align-items: stretch; gap: .5rem; height: 220px; }
.ch-col { flex: 1; display: grid; grid-template-rows: auto 1fr auto; gap: .3rem; text-align: center; min-width: 0; }
.ch-col b { font-size: .85rem; color: var(--green-dark); font-variant-numeric: tabular-nums; }
.ch-col small { font-size: .75rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ch-col-track { display: flex; align-items: flex-end; border-bottom: 1px solid var(--sand); }
.ch-col-bar { width: 100%; height: 0; border-radius: 8px 8px 3px 3px; transition: height 1s cubic-bezier(.2, .8, .2, 1) var(--delay, 0s); }
.ch.in .ch-col-bar { height: max(var(--h), 2px); }

.ch-lines svg { display: block; width: 100%; height: auto; overflow: visible; }
.ch-grid { stroke: var(--sand); }
.ch-axis { fill: var(--muted); font: 11px var(--font-body); }
.ch-line { fill: none; stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; stroke-dasharray: 1; stroke-dashoffset: 1; transition: stroke-dashoffset 1.6s ease var(--delay, 0s); }
.ch.in .ch-line { stroke-dashoffset: 0; }
.ch-area { opacity: 0; transition: opacity 1s ease calc(var(--delay, 0s) + .8s); }
.ch.in .ch-area { opacity: .08; }
.ch-dot { opacity: 0; transition: opacity .3s ease var(--delay, 0s); stroke: #fff; stroke-width: 1.5; }
.ch.in .ch-dot { opacity: 1; }
.ch-dot:hover { r: 5; }

.seg { display: inline-flex; gap: .25rem; padding: .25rem; border-radius: 99px; background: var(--sand); margin-bottom: .8rem; }
.seg button { border: 0; background: none; padding: .35rem .9rem; border-radius: 99px; font: 700 .88rem var(--font-body); color: var(--muted); cursor: pointer; }
.seg button[aria-pressed=true] { background: #fff; color: var(--green-dark); box-shadow: 0 2px 6px rgba(31, 77, 58, .12); }

.mini-table { min-width: 0; }
.mini-table th, .mini-table td { padding: .5rem .4rem; font-size: .92rem; }
.badge-bad { background: #fde8eb; color: var(--crimson-dark); }

/* محرر الخطط */
.modal-wide { width: min(1400px, calc(100% - 2rem)); }
.form-warn { margin: 0; padding: .7rem .9rem; border-radius: 10px; background: #fdf3d8; color: #7a5b06; font-weight: 500; font-size: .92rem; }
.lesson-editor-wrap { max-height: 60vh; overflow: auto; border: 1px solid var(--sand); border-radius: 12px; }
.lesson-editor { min-width: 900px; }
.lesson-editor thead th { position: sticky; top: 0; background: #fff; z-index: 1; white-space: nowrap; }
.lesson-editor td { padding: .35rem; vertical-align: top; }
.form .lesson-editor input, .form .lesson-editor select { padding: .4rem .5rem; font-size: .9rem; border-radius: 8px; }
.lesson-editor .l-n { color: var(--muted); font-weight: 700; text-align: center; padding-top: .7rem; }
.form .lesson-editor .l-week { width: 4.2rem; }
.form .lesson-editor .l-kind { min-width: 9.5rem; }
.lesson-editor .l-title { min-width: 10rem; }
.range-in { display: grid; grid-template-columns: auto minmax(6.5rem, 1fr) 4.2rem; gap: .25rem; align-items: center; font-size: .8rem; color: var(--muted); min-width: 13rem; }
.form .range-in input.bad { border-color: var(--crimson); background: #fdecef; }
.icon-btn { border: 0; background: none; cursor: pointer; padding: .25rem .4rem; border-radius: 6px; color: var(--green); font-size: 1rem; }
.icon-btn:hover { background: var(--sand); }
.icon-btn.danger { color: var(--crimson); }
@media (prefers-reduced-motion: reduce) {
  .kpi { opacity: 1; transform: none; }
  .ch-seg { stroke-dasharray: var(--d); }
  .ch-bar, .kpi-bar span { width: var(--w); }
  .ch-col-bar { height: max(var(--h), 2px); }
  .ch-line { stroke-dashoffset: 0; }
  .ch-area { opacity: .08; }
  .ch-dot { opacity: 1; }
}
.tk-toolbar .ss { flex: 1 1 150px; }

/* شريط الصفحات بعد الدخول: زيارة الموقع وتسجيل الخروج متجاوران */
.app-bar-actions { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; justify-content: flex-end; }

/* صف جدول قابل للنقر (مثل الحلقة ← طلابها) */
tr.row-link { cursor: pointer; transition: background .15s; }
tr.row-link:hover, tr.row-link:focus-visible { background: rgba(201, 162, 39, .09); }
tr.row-link:focus-visible { outline: 2px solid var(--gold); outline-offset: -2px; }
