/* ============ الأساسيات ============ */
:root {
  /* هوية مدارك AI */
  --bg: #F3F4F8;
  --surface: #ffffff;
  --surface-2: #F1F3F9;
  --border: #E1E6F3;
  --text: #1E2440;
  --muted: #5A6385;
  --primary: #1A34C2;
  --primary-600: #12239A;
  --primary-m: #4D69E6;
  --primary-50: #EEF2FD;
  --primary-100: #E4EAFD;
  --teal: #14B8A6;
  --teal-d: #0A7C6F;
  --mint: #6FF0DC;
  --success: #0A7C6F;
  --success-50: #E3F8F4;
  --gold: #B7791F;
  --gold-50: #FFF8EC;
  --danger: #E5484D;
  --danger-50: #FDECEC;
  --warn: #C2410C;
  --warn-50: #FFF3E8;
  --wa: #1fa855;
  --hero: linear-gradient(155deg, #2342D8, #1733C4 48%, #0E2193);
  --font-head: 'Readex Pro', 'IBM Plex Sans Arabic', system-ui, sans-serif;
  --radius: 20px;
  --radius-sm: 12px;
  --shadow: 0 1px 2px rgba(30, 36, 64, .04), 0 6px 20px rgba(30, 36, 64, .04);
  --shadow-lg: 0 20px 60px rgba(14, 33, 147, .22);
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: 'IBM Plex Sans Arabic', system-ui, -apple-system, 'Segoe UI', Tahoma, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.75;
  font-size: 15.5px;
}
body.no-scroll { overflow: hidden; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.35; margin: 0 0 .4em; font-family: var(--font-head); font-weight: 700; }
h1 { color: var(--text); }
h1 { font-size: 1.6rem; font-weight: 700; }
h2 { font-size: 1.2rem; font-weight: 600; }
p { margin: 0 0 .6em; }
img, video { max-width: 100%; }
[hidden] { display: none !important; }
.ic { width: 1.15em; height: 1.15em; vertical-align: -0.2em; flex-shrink: 0; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.center { text-align: center; }
.mono { font-family: ui-monospace, Menlo, Consolas, monospace; letter-spacing: .05em; }
.ltr-inline { direction: ltr; unicode-bidi: isolate; display: inline-block; }
.sr-only { position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; border: 0 !important; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.push-end { margin-inline-start: auto; }

.container { max-width: 1120px; margin: 0 auto; padding: 0 16px; }
.page { padding: 24px 0 96px; }

/* ============ الشريط العلوي ============ */
.topbar {
  position: sticky; top: 0; z-index: 40;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--border);
}
.topbar-inner { max-width: 1120px; margin: 0 auto; padding: 10px 16px; display: flex; align-items: center; gap: 16px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); }
.brand:hover { text-decoration: none; }
.brand-logo { height: 34px; width: auto; display: block; }
.brand-tag {
  font-family: var(--font-head); font-weight: 600; font-size: .78rem; color: var(--primary);
  background: var(--primary-50); border: 1px solid var(--primary-100); padding: 3px 12px; border-radius: 99px; white-space: nowrap;
}
.topbar-prog { height: 3px; background: var(--primary-100); }
.topbar-prog i { display: block; height: 100%; background: linear-gradient(90deg, var(--teal), var(--primary)); border-radius: 0 3px 3px 0; margin-inline-start: 0; }
.mainnav { display: flex; gap: 2px; margin-inline-start: 12px; overflow-x: auto; scrollbar-width: none; }
.mainnav::-webkit-scrollbar { display: none; }
.mainnav a {
  display: flex; align-items: center; gap: 6px; padding: 8px 12px; border-radius: 12px;
  color: var(--muted); font-family: var(--font-head); font-weight: 600; font-size: .9rem; white-space: nowrap; position: relative;
}
.mainnav a:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.mainnav a.active { background: var(--primary-100); color: var(--primary); }
.usermenu { margin-inline-start: auto; display: flex; align-items: center; gap: 8px; }
.usermenu form { margin: 0; }
.bell { position: relative; color: var(--gold); display: grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; background: var(--gold-50); }
.bell .count { position: absolute; top: -4px; inset-inline-end: -4px; }
.count {
  display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px;
  border-radius: 999px; background: var(--danger); color: #fff; font-size: .72rem; font-weight: 700;
}
.avatar {
  width: 34px; height: 34px; border-radius: 50%; display: inline-grid; place-items: center; flex-shrink: 0;
  background: var(--primary-100); color: var(--primary); font-weight: 700; font-family: var(--font-head);
}
.avatar.sm { width: 30px; height: 30px; font-size: .85rem; }
.avatar.lg { width: 56px; height: 56px; font-size: 1.4rem; }

/* شريط التنقل السفلي للجوال (المشتركين) */
.bottomnav { display: none; }
@media (max-width: 760px) {
  .role-student .mainnav { display: none; }
  .role-student .page { padding-bottom: 110px; }
  .bottomnav {
    display: flex; position: fixed; bottom: 0; inset-inline: 0; z-index: 40;
    background: var(--surface); border-top: 1px solid var(--border);
    padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
  }
  .bottomnav a {
    flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px;
    padding: 6px 0; color: var(--muted); font-size: .72rem; border-radius: 10px;
  }
  .bottomnav a .ic { width: 22px; height: 22px; }
  .bottomnav a.active { color: var(--primary); background: var(--primary-50); }
  .bottomnav a:hover { text-decoration: none; }
  .hide-sm { display: none; }
  .role-admin .topbar-inner { flex-wrap: wrap; row-gap: 6px; }
  .role-admin .mainnav { order: 3; width: 100%; margin: 0; }
  .role-admin .mainnav a span { font-size: .85rem; }
}
.support-fab {
  position: fixed; bottom: 24px; inset-inline-start: 24px; z-index: 30;
  width: 52px; height: 52px; border-radius: 50%; background: var(--wa); color: #fff;
  display: grid; place-items: center; box-shadow: 0 6px 20px rgba(31, 168, 85, .4);
}
.support-fab .ic { width: 24px; height: 24px; }
@media (max-width: 760px) { .support-fab { bottom: 84px; inset-inline-start: 16px; width: 46px; height: 46px; } }

/* ============ الأزرار والحقول ============ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 16px; border-radius: 12px; border: 1px solid transparent;
  font: inherit; font-family: var(--font-head); font-weight: 600; font-size: .92rem; cursor: pointer; white-space: nowrap;
  transition: background .15s, border-color .15s, transform .05s;
  text-decoration: none !important;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-600); }
.btn-success { background: linear-gradient(135deg, var(--teal), var(--teal-d)); color: #fff; }
.btn-success:hover { filter: brightness(1.05); }
.btn-gold { background: var(--gold); color: #fff; }
.btn-gold:disabled { background: var(--surface-2); color: var(--muted); border-color: var(--border); opacity: 1; }
.btn-ghost { background: var(--surface); color: var(--text); border-color: var(--border); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger-ghost { background: var(--danger-50); color: var(--danger); }
.btn-wa { background: var(--wa); color: #fff; }
.btn-sm { padding: 6px 10px; font-size: .82rem; border-radius: 8px; }
.btn-lg { padding: 12px 22px; font-size: 1rem; border-radius: 14px; }
.btn-white { background: #fff; color: var(--primary); font-weight: 700; }
.btn-white:hover { background: var(--primary-50); }
.btn-outline-light { background: rgba(255, 255, 255, .08); color: #fff; border-color: rgba(255, 255, 255, .35); }
.btn-outline-light:hover { background: rgba(255, 255, 255, .16); }
.btn-block { width: 100%; }
.icon-btn {
  display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 8px;
  background: transparent; border: 0; color: var(--muted); cursor: pointer;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn.danger:hover { background: var(--danger-50); color: var(--danger); }
.link-btn { background: none; border: 0; padding: 0; font: inherit; color: var(--primary); cursor: pointer; display: inline-flex; align-items: center; gap: 8px; text-align: start; }

.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > span, .field > legend { font-weight: 600; font-size: .88rem; }
input:not([type=radio]):not([type=checkbox]):not([type=file]), select, textarea {
  width: 100%; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); font: inherit; font-size: .95rem;
}
input[type=file] { font: inherit; font-size: .88rem; padding: 10px; border: 1px dashed var(--border); border-radius: 10px; background: var(--surface-2); width: 100%; }
input:focus, select:focus, textarea:focus { outline: 2px solid color-mix(in srgb, var(--primary) 40%, transparent); outline-offset: 1px; border-color: var(--primary); }
textarea { resize: vertical; }
input[dir=ltr] { text-align: left; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 16px; }
.span-2 { grid-column: 1 / -1; }
@media (max-width: 640px) { .form-row, .form-grid { grid-template-columns: 1fr; } }
fieldset { border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; margin: 0; }
.radio { display: flex; align-items: center; gap: 8px; font-weight: 400 !important; cursor: pointer; padding: 3px 0; }
.publish-box input[type=datetime-local] { margin-top: 6px; max-width: 280px; }
.inline-form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.inline-form input { flex: 1; min-width: 200px; }

/* ============ البطاقات والتخطيط ============ */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px; box-shadow: var(--shadow); margin-bottom: 16px; min-width: 0;
}
.card-title { display: flex; align-items: center; gap: 8px; font-size: 1.08rem; margin-bottom: 14px; color: var(--primary-600); }
.card-title .ic { color: var(--primary); }
.card-title-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.card-title-row .card-title { margin: 0; }
.card.attention { border-color: color-mix(in srgb, var(--gold) 45%, var(--border)); background: linear-gradient(0deg, var(--surface), var(--gold-50)); }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
.grid-2 > .card { margin-bottom: 0; }
.grid-2 { margin-bottom: 16px; }
@media (max-width: 860px) { .grid-2 { grid-template-columns: 1fr; } }
.cards-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 16px; }
.cards-grid .card { margin: 0; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head h1 { margin-bottom: 4px; }
.page-head p { margin: 0; }
.actions, .row-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.section-label { font-family: var(--font-head); font-size: .82rem; color: var(--primary-m); font-weight: 600; margin: 18px 0 10px; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 8px 16px; margin: 0 0 12px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 600; }
.is-muted { opacity: .6; }

/* التنبيهات */
.flashes { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.flash {
  display: flex; align-items: center; gap: 10px; padding: 11px 14px; border-radius: 10px; font-weight: 500;
  border: 1px solid transparent; transition: opacity .4s;
}
.flash.fade { opacity: 0; pointer-events: none; height: 0; padding: 0; margin: -4px 0; border: 0; overflow: hidden; }
.flash-success { background: var(--success-50); color: var(--success); border-color: color-mix(in srgb, var(--success) 25%, transparent); }
.flash-error { background: var(--danger-50); color: var(--danger); border-color: color-mix(in srgb, var(--danger) 25%, transparent); }
.flash-info { background: var(--primary-50); color: var(--primary); }
.flash-x { margin-inline-start: auto; background: none; border: 0; font-size: 1.3rem; color: inherit; cursor: pointer; line-height: 1; opacity: .6; }

/* الشارات */
.badge {
  display: inline-flex; align-items: center; gap: 4px; padding: 2px 10px; border-radius: 999px;
  font-family: var(--font-head); font-size: .76rem; font-weight: 600; background: var(--surface-2); color: var(--muted); white-space: nowrap;
}
.badge-ok { background: var(--success-50); color: var(--success); }
.badge-wait { background: var(--warn-50); color: var(--warn); }
.badge-err { background: var(--danger-50); color: var(--danger); }
.badge-new { background: var(--primary-50); color: var(--primary); }
.day-chip {
  display: inline-flex; align-items: center; padding: 3px 12px; border-radius: 999px;
  background: var(--primary-100); color: var(--primary); font-family: var(--font-head); font-weight: 700; font-size: .82rem;
}
.day-chip.sm { padding: 1px 10px; }

/* الفارغ */
.empty { text-align: center; padding: 28px 16px; color: var(--muted); }
.empty.big { padding: 64px 16px; }
.empty-ic { width: 60px; height: 60px; margin: 0 auto 12px; border-radius: 18px; background: var(--surface-2); display: grid; place-items: center; color: var(--muted); }
.empty-ic .ic { width: 28px; height: 28px; }
.empty strong, .empty h1, .empty h2 { color: var(--text); }

/* ============ صفحة الدخول ============ */
body.guest { background: var(--hero); background-attachment: fixed; min-height: 100vh; position: relative; overflow-x: hidden; }
body.guest::before { content: ""; position: fixed; inset: auto -120px -160px auto; width: 420px; height: 420px; border-radius: 50%; background: rgba(255, 255, 255, .06); pointer-events: none; }
body.guest::after { content: ""; position: fixed; left: -80px; top: -100px; width: 340px; height: 340px; border-radius: 50%; background: radial-gradient(circle, rgba(111, 240, 220, .25), transparent 70%); pointer-events: none; }
.auth-wrap { min-height: calc(100vh - 48px); display: grid; place-items: center; position: relative; z-index: 1; }
.auth-card {
  width: 100%; max-width: 420px; background: var(--surface); border-radius: 26px;
  padding: 30px 28px; box-shadow: var(--shadow-lg);
}
.auth-card.wide { max-width: 480px; }
.auth-card h1 { text-align: center; margin: 14px 0 2px; font-size: 1.45rem; color: var(--primary-600); }
.auth-card > p { text-align: center; }
.auth-logo { display: block; height: 52px; width: auto; margin: 0 auto; }
.auth-card form { margin: 20px 0 16px; }
.auth-help { margin-top: 14px; margin-bottom: 0; }
.auth-support-link {
  display: inline-block;
  color: var(--primary);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 4px;
  text-decoration-thickness: 1.5px;
  transition: color 0.18s ease, text-decoration-color 0.18s ease;
  outline: none;
  cursor: pointer;
}
.auth-support-link:hover {
  color: var(--primary-600);
  text-decoration-color: var(--primary-600);
}
.auth-support-link:focus-visible {
  color: var(--primary-600);
  outline: 2px solid var(--primary-m);
  outline-offset: 3px;
  border-radius: 4px;
}
.auth-support-missing {
  color: var(--muted);
  text-decoration: none;
}

/* ============ الغلاف (Hero) بهوية مدارك ============ */
.hero {
  position: relative; overflow: hidden; color: #fff; background: var(--hero);
  border-radius: 26px 26px 26px 56px; padding: 26px 28px 30px; margin-bottom: 20px;
}
.hero::before { content: ""; position: absolute; inset: auto -90px -140px auto; width: 340px; height: 340px; border-radius: 50%; background: rgba(255, 255, 255, .06); }
.hero::after { content: ""; position: absolute; left: -60px; top: -80px; width: 280px; height: 280px; border-radius: 50%; background: radial-gradient(circle, rgba(111, 240, 220, .25), transparent 70%); }
.hero > * { position: relative; z-index: 1; }
.hero-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.hero-kicker {
  white-space: nowrap; font-family: var(--font-head); font-weight: 600; font-size: .8rem; padding: 4px 14px;
  border: 1px solid rgba(255, 255, 255, .35); border-radius: 99px; background: rgba(255, 255, 255, .08); color: #fff;
}
.hero h1 { color: #fff; font-size: clamp(1.7rem, 4.6vw, 2.6rem); line-height: 1.25; margin: 18px 0 6px; }
.hero h1 span { display: block; color: var(--mint); font-size: .6em; margin-top: 4px; }
.hero p { color: rgba(255, 255, 255, .88); max-width: 640px; margin: 0; }
.hero .muted { color: rgba(255, 255, 255, .8); }
.hero-pills { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 18px; }
.hero-pills span {
  font-family: var(--font-head); font-weight: 600; font-size: .85rem; background: #fff; color: var(--primary);
  border-radius: 99px; padding: 4px 14px; display: inline-flex; align-items: center; gap: 6px;
}
.hero-pills span:first-child { background: var(--mint); color: #063f39; }
.hero .row-actions { margin-top: 20px; }
.hero.compact { padding: 22px 26px 24px; }
.hero.compact h1 { margin-top: 12px; }
.hero .day-chip { background: var(--mint); color: #063f39; }
.hero .badge-ok { background: rgba(255, 255, 255, .95); color: var(--teal-d); }
.hero a:not(.btn) { color: var(--mint); }
@media (max-width: 640px) { .hero { padding: 22px 18px 24px; border-radius: 22px 22px 22px 40px; } }

/* ============ لوحة المشترك ============ */
.dash-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.dash-grid > .card { margin: 0; }
.today-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.days-card { grid-column: 1 / -1; }
.link-card { display: flex; align-items: center; gap: 14px; color: var(--text); grid-column: 1 / -1; }
.link-card:hover { text-decoration: none; border-color: var(--primary); }
.link-card > span:nth-child(2) { display: flex; flex-direction: column; }
@media (max-width: 860px) { .dash-grid { grid-template-columns: 1fr; } }

.progress-block { display: flex; flex-direction: column; gap: 10px; }
.progress-top { display: flex; align-items: baseline; gap: 10px; }
.progress-num { font-family: var(--font-head); font-size: 2.1rem; line-height: 1; color: var(--primary); }
.progress-num small { font-size: 1rem; color: var(--muted); font-weight: 500; }
.bar { position: relative; height: 12px; background: var(--surface-2); border-radius: 999px; border: 1px solid var(--border); }
.bar.sm { height: 8px; min-width: 80px; }
.bar-fill { height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--teal), var(--primary)); transition: width .3s; max-width: 100%; }
.bar-fill.ok { background: linear-gradient(90deg, var(--mint), var(--teal)); }
.bar-mark { position: absolute; top: -6px; bottom: -6px; width: 2px; background: var(--gold); transform: translateX(50%); }
.bar-mark span {
  position: absolute; top: calc(100% + 2px); left: 50%; transform: translateX(-50%);
  font-size: .72rem; color: var(--gold); font-weight: 700; display: flex; align-items: center; gap: 2px; white-space: nowrap;
}
.progress-hint { margin: 16px 0 0; font-size: .9rem; }
.progress-cell { display: flex; align-items: center; gap: 8px; min-width: 140px; }
.progress-cell .bar { flex: 1; }
.compact-progress { padding-bottom: 14px; }

.cert-card.is-eligible { border-color: color-mix(in srgb, var(--gold) 50%, var(--border)); background: linear-gradient(160deg, var(--gold-50), var(--surface) 60%); }
.cert-card form { margin: 12px 0 6px; }
.cert-state.ok strong { color: var(--success); }
.cert-state.pending strong { color: var(--warn); display: flex; align-items: center; gap: 6px; }
.cert-state .btn { margin-top: 6px; }

.days { display: grid; grid-template-columns: repeat(auto-fill, minmax(42px, 1fr)); gap: 8px; }
.day {
  aspect-ratio: 1; display: grid; place-items: center; border-radius: 12px; font-family: var(--font-head); font-weight: 700; font-size: .9rem;
  border: 1px solid var(--border); color: var(--muted); background: var(--surface);
}
a.day:hover { text-decoration: none; border-color: var(--primary); }
.day.done { background: var(--teal); border-color: var(--teal); color: #fff; }
.day.open { background: var(--primary-100); border-color: color-mix(in srgb, var(--primary) 35%, transparent); color: var(--primary); }
.day.locked { background: var(--surface-2); opacity: .7; }
.legend { display: flex; gap: 16px; margin-top: 14px; font-size: .8rem; color: var(--muted); flex-wrap: wrap; }
.legend span { display: flex; align-items: center; gap: 6px; }
.legend i.day { width: 14px; height: 14px; aspect-ratio: auto; border-radius: 4px; display: inline-block; }

/* قائمة التحديات */
.ch-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.ch-item {
  display: flex; align-items: center; gap: 14px; padding: 14px 16px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--border); color: var(--text); box-shadow: var(--shadow);
}
.ch-item:hover { text-decoration: none; border-color: var(--primary); }
.ch-day {
  width: 54px; height: 54px; border-radius: 14px; background: var(--primary-100); color: var(--primary);
  display: flex; flex-direction: column; align-items: center; justify-content: center; font-family: var(--font-head); font-weight: 700; font-size: 1.2rem; line-height: 1; flex-shrink: 0;
}
.ch-day small { font-size: .65rem; font-weight: 500; margin-bottom: 3px; }
.ch-item.is-done .ch-day { background: var(--success-50); color: var(--success); }
.ch-body { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.ch-body strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: var(--font-head); font-weight: 600; }
.ch-status .ic { width: 26px; height: 26px; color: var(--border); }
.ch-item.is-done .ch-status .ic { color: var(--teal); }
b.new { color: var(--primary); }

/* صفحة التحدي */
.challenge { max-width: 820px; margin: 0 auto; }

.prose { font-size: 1.02rem; line-height: 1.9; }
.prose p:last-child { margin-bottom: 0; }
.video-embed { position: relative; padding-top: 56.25%; border-radius: 12px; overflow: hidden; background: #000; }
.video-embed iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.media-list { display: flex; flex-direction: column; gap: 14px; }
.media-item { display: flex; flex-direction: column; gap: 8px; }
.media-item audio { width: 100%; }
.media-item video, .media-item img { border-radius: 12px; background: #000; max-height: 480px; }
.media-name { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: .9rem; }
.file-chip { display: inline-flex; align-items: center; gap: 10px; padding: 8px 12px; border: 1px solid var(--border); border-radius: 10px; color: var(--text); }
.complete-bar {
  position: sticky; bottom: 12px; z-index: 5; display: flex; flex-direction: column; gap: 8px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow-lg); margin-bottom: 16px;
}
.complete-bar p { margin: 0; text-align: center; font-size: .9rem; }
.complete-bar.is-done { position: static; flex-direction: row; align-items: center; justify-content: space-between; background: var(--success-50); border-color: color-mix(in srgb, var(--success) 30%, transparent); box-shadow: none; }
.done-msg { display: flex; align-items: center; gap: 12px; }
.done-msg > div { display: flex; flex-direction: column; }
.done-msg strong { color: var(--success); }
.done-ic { width: 40px; height: 40px; border-radius: 50%; background: linear-gradient(135deg, var(--teal), var(--teal-d)); color: #fff; display: grid; place-items: center; }
.done-ic .ic { stroke-width: 3; }
@media (max-width: 760px) { .complete-bar { bottom: 76px; } }
.pager { display: flex; justify-content: space-between; gap: 8px; }

/* ============ الملفات (درايف) ============ */
.crumbs { display: flex; align-items: center; flex-wrap: wrap; gap: 4px; font-size: .9rem; margin-bottom: 6px; }
.crumbs a { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); }
.crumbs a:hover { color: var(--primary); }
.crumbs .sep { color: var(--border); display: inline-flex; }
.dropzone {
  display: block; margin-bottom: 20px; border: 2px dashed var(--border); border-radius: var(--radius);
  background: var(--surface); transition: border-color .15s, background .15s;
}
.dropzone.drag { border-color: var(--primary); background: var(--primary-50); }
.dropzone.busy .dz-inner { pointer-events: none; opacity: .5; }
.dz-inner { display: flex; align-items: center; gap: 14px; padding: 18px 20px; cursor: pointer; }
.dz-ic { width: 46px; height: 46px; border-radius: 14px; background: var(--primary-100); color: var(--primary); display: grid; place-items: center; flex-shrink: 0; }
.dz-ic .ic { width: 22px; height: 22px; }
.dz-text { display: flex; flex-direction: column; }
.dz-text small { color: var(--muted); }
.dz-progress { padding: 0 20px 16px; }
.upload-submit .dz-progress { padding: 12px 0 0; }
.dz-progress-text { display: flex; justify-content: space-between; font-size: .85rem; margin-bottom: 6px; }
.dz-progress.is-error .dz-status { color: var(--danger); }

.drive-grid { display: grid; gap: 12px; }
.drive-grid.folders { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.drive-grid.files { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
.tile { position: relative; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; transition: border-color .15s, box-shadow .15s; min-width: 0; }
.tile:hover { border-color: color-mix(in srgb, var(--primary) 50%, var(--border)); box-shadow: var(--shadow); }
.folder-tile .tile-link { display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; column-gap: 12px; padding: 14px; color: var(--text); padding-inline-end: 76px; }
.folder-tile .tile-link:hover { text-decoration: none; }
.folder-tile .ficon { grid-row: span 2; }
.tile-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; display: block; }
.tile-meta { font-size: .78rem; color: var(--muted); }
.tile-actions { position: absolute; top: 8px; inset-inline-end: 6px; display: flex; gap: 0; opacity: .85; }
.tile-actions form { margin: 0; }
.folder-tile .tile-actions { top: 50%; transform: translateY(-50%); }
.file-tile .tile-actions { background: color-mix(in srgb, var(--surface) 92%, transparent); border-radius: 10px; opacity: 0; transition: opacity .15s; }
.file-tile:hover .tile-actions, .file-tile:focus-within .tile-actions { opacity: 1; }
@media (hover: none) { .file-tile .tile-actions { opacity: 1; } }
.tile-preview {
  display: grid; place-items: center; width: 100%; aspect-ratio: 4 / 3; border: 0; padding: 0; cursor: pointer;
  background: var(--surface-2); border-radius: 11px 11px 0 0; overflow: hidden;
}
.tile-preview img { width: 100%; height: 100%; object-fit: cover; }
.thumb-ic { width: 56px; height: 56px; border-radius: 14px; display: grid; place-items: center; }
.thumb-ic .ic { width: 28px; height: 28px; }
.tile-foot { display: flex; align-items: center; gap: 10px; padding: 10px 12px; }
.tile-text { display: flex; flex-direction: column; min-width: 0; }
.ficon { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; flex-shrink: 0; }
.ficon.big { width: 48px; height: 48px; }
.ficon.big .ic { width: 24px; height: 24px; }
.tile-foot .ficon { width: 28px; height: 28px; border-radius: 8px; }
.tile-foot .ficon .ic { width: 15px; height: 15px; }
.k-folder { background: #FFF1D6; color: #B7791F; }
.k-image { background: #e0f2fe; color: #0369a1; }
.k-video { background: #fce7f3; color: #be185d; }
.k-audio { background: #ede9fe; color: #6d28d9; }
.k-pdf { background: #fee2e2; color: #b91c1c; }
.k-doc { background: #dbeafe; color: #1d4ed8; }
.k-sheet { background: #dcfce7; color: #15803d; }
.k-slides { background: #ffedd5; color: #c2410c; }
.k-archive, .k-file { background: var(--surface-2); color: var(--muted); }
.file-rows { list-style: none; margin: 12px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.file-row-wrap { display: flex; align-items: center; gap: 6px; }
.file-row {
  flex: 1; display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border: 1px solid var(--border);
  border-radius: 10px; background: var(--surface); color: var(--text); font: inherit; cursor: pointer; text-align: start; min-width: 0;
}
.file-row:hover { border-color: var(--primary); }
.file-row .tile-name { flex: 1; }
.file-row .ficon { width: 30px; height: 30px; border-radius: 8px; }

/* ============ الجداول والقوائم (الإدارة) ============ */
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat { display: flex; align-items: center; gap: 12px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.stat-ic { width: 42px; height: 42px; border-radius: 14px; background: var(--primary-100); color: var(--primary); display: grid; place-items: center; }
.stat strong { display: block; font-family: var(--font-head); font-size: 1.45rem; line-height: 1.1; color: var(--primary-600); }
.stat span { color: var(--muted); font-size: .82rem; }
.table-wrap { overflow-x: auto; margin: 0 -20px; padding: 0 20px; }
.table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.table th { text-align: start; font-weight: 600; color: var(--muted); font-size: .8rem; padding: 8px 10px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.table td { padding: 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table td form { margin: 0; }
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.list li:last-child { border-bottom: 0; }
.list li form { margin: 0; }
.list-main { display: flex; align-items: center; gap: 10px; color: var(--text); min-width: 0; }
.list-main:hover { text-decoration: none; }
.list-main > span:last-child { display: flex; flex-direction: column; min-width: 0; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 16px; overflow-x: auto; }
.tabs a { display: flex; align-items: center; gap: 6px; padding: 10px 14px; color: var(--muted); font-family: var(--font-head); font-weight: 600; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs a:hover { color: var(--text); text-decoration: none; }
.tabs a.active { color: var(--primary); border-color: var(--primary); }
.tabs b { font-size: .75rem; background: var(--surface-2); padding: 0 8px; border-radius: 999px; }
.toolbar { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
.toolbar select { width: auto; }
.search { flex: 1; min-width: 220px; position: relative; }
.search .ic { position: absolute; top: 50%; transform: translateY(-50%); inset-inline-start: 12px; color: var(--muted); }
.search input { padding-inline-start: 38px !important; }
.cohort-card { color: var(--text); display: block; }
.cohort-card:hover { text-decoration: none; border-color: var(--primary); }
.cohort-card h2 { margin: 12px 0 2px; }
.mini-stats { display: flex; gap: 16px; flex-wrap: wrap; margin: 10px 0 4px; font-size: .85rem; color: var(--muted); }
.mini-stats strong { color: var(--text); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border-radius: 999px; background: var(--surface-2); color: var(--muted); font-size: .85rem; border: 1px solid var(--border); }
.chip-ok { background: var(--success-50); color: var(--success); border-color: transparent; }
.chip:hover { text-decoration: none; border-color: var(--primary); }
.danger-zone { display: flex; align-items: center; justify-content: space-between; gap: 16px; border-color: color-mix(in srgb, var(--danger) 25%, var(--border)); }
.danger-zone p { margin: 0; }
.profile-head { display: flex; align-items: center; gap: 14px; }
.cert-row-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.cert-meta { display: flex; align-items: center; gap: 10px; }
.cert-row-body { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 10px; }
.cert-actions { display: grid; grid-template-columns: 1.4fr 1fr; gap: 16px; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--border); }
.cert-actions form { margin: 0; }
@media (max-width: 760px) { .cert-actions { grid-template-columns: 1fr; } }
.creds-card { border-color: color-mix(in srgb, var(--primary) 40%, var(--border)); background: linear-gradient(0deg, var(--surface), var(--primary-50)); }

/* ============ العارض (Modal) ============ */
.modal { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 16px; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(5, 10, 9, .75); }
.modal-box {
  position: relative; background: var(--surface); border-radius: 16px; width: min(1000px, 100%);
  max-height: calc(100vh - 32px); display: flex; flex-direction: column; overflow: hidden; box-shadow: var(--shadow-lg);
}
.modal-head { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--border); }
.modal-title { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.modal-actions { display: flex; gap: 6px; }
.modal-body { flex: 1; overflow: auto; display: grid; place-items: center; background: var(--surface-2); min-height: 200px; }
.modal-body img, .modal-body video { max-width: 100%; max-height: calc(100vh - 110px); display: block; }
.modal-body audio { width: min(500px, 90%); margin: 40px 0; }
.modal-body iframe { width: 100%; height: calc(100vh - 110px); border: 0; background: #fff; }
.list-main .ltr-inline, .kv .ltr-inline { align-self: flex-start; }
.guest .empty.big { background: var(--surface); border-radius: 26px; max-width: 480px; margin: 10vh auto 0; box-shadow: var(--shadow-lg); position: relative; z-index: 1; }

/* ============ الشهادة الصادرة ============ */
.cert-card.is-issued { grid-column: 1 / -1; order: -1; border-color: color-mix(in srgb, var(--teal) 40%, var(--border)); background: linear-gradient(160deg, var(--success-50), var(--surface) 55%); }
.cert-issued { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 24px; align-items: center; }
.cert-thumb { position: relative; display: block; width: 100%; padding: 0; border: 0; background: none; cursor: zoom-in; border-radius: 16px; overflow: hidden; box-shadow: var(--shadow-lg); }
.cert-thumb img { display: block; width: 100%; height: auto; }
.cert-zoom { position: absolute; inset-inline-start: 12px; bottom: 12px; display: inline-flex; align-items: center; gap: 6px; background: rgba(14, 33, 147, .85); color: #fff; font-family: var(--font-head); font-size: .8rem; font-weight: 600; padding: 4px 12px; border-radius: 99px; }
.cert-info { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.cert-info .kv { margin: 0; }
.cert-congrats { font-family: var(--font-head); font-weight: 700; font-size: 1.35rem; color: var(--teal-d); margin: 0; }
.cert-dl { display: flex; gap: 10px; flex-wrap: wrap; }
.cert-dl .btn { flex: 1 1 180px; }
@media (max-width: 760px) { .cert-issued { grid-template-columns: 1fr; } }
.cert-preview-box { display: flex; flex-direction: column; gap: 6px; }
.cert-preview { display: block; border-radius: 12px; overflow: hidden; border: 1px solid var(--border); background: var(--surface-2); aspect-ratio: 4 / 3; max-width: 100%; }
.cert-preview img { display: block; width: 100%; height: 100%; object-fit: cover; }
.cert-links { display: inline-flex; gap: 6px; flex-wrap: wrap; }
details.field summary { cursor: pointer; }
details.field[open] { gap: 8px; }
.dash-grid.has-cert > .progress-card { grid-column: 1 / -1; }

/* ============ صفحة التحدي (تصميم مفصّل) ============ */
.preview-banner {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: space-between;
  background: var(--warn-50); color: var(--warn); border: 1px solid color-mix(in srgb, var(--warn) 30%, transparent);
  border-radius: 14px; padding: 10px 14px; margin-bottom: 14px; font-weight: 600;
}
.preview-banner > span { flex: 1; }
.preview-banner .btn-white { border: 1px solid var(--border); }
.challenge-v2 { display: flex; flex-direction: column; gap: 16px; }
.ch-hero { margin-bottom: 0; }
.ch-hero h1 { margin: 16px 0 6px; font-size: clamp(1.6rem, 4vw, 2.3rem); }
.chip-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ch-summary { font-size: 1.05rem; max-width: 70ch; }
.ch-meta { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 16px; }
.ch-meta span {
  display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border-radius: 99px;
  background: rgba(255, 255, 255, .12); border: 1px solid rgba(255, 255, 255, .25);
  font-family: var(--font-head); font-weight: 600; font-size: .85rem; color: #fff;
}
.ch-meta span.is-gold { background: #F6C35A; border-color: #F6C35A; color: #3B2A05; }

.ch-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 18px; align-items: start; }
.ch-main { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.ch-main > .card { margin: 0; }
.ch-side { display: flex; flex-direction: column; gap: 14px; position: sticky; top: 84px; }
.ch-side > .card { margin: 0; padding: 18px; }
@media (max-width: 960px) {
  .ch-layout { grid-template-columns: 1fr; }
  .ch-side { position: static; }
}

.ch-sec { padding: 22px 24px; }
@media (max-width: 640px) { .ch-sec { padding: 18px 16px; } }
.sec-title { display: flex; align-items: center; gap: 10px; font-size: 1.12rem; color: var(--primary-600); margin: 0 0 14px; }
.sec-title small { font-family: var(--font-body); font-weight: 500; font-size: .8rem; margin-inline-start: auto; }
.sec-ic { width: 34px; height: 34px; border-radius: 10px; background: var(--primary-100); color: var(--primary); display: grid; place-items: center; flex-shrink: 0; }
.sec-ic .ic { width: 18px; height: 18px; }
.sec-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.sec-head .sec-title { margin: 0; }
.side-card .sec-title { font-size: 1rem; margin-bottom: 8px; }
.side-card .sec-ic { width: 30px; height: 30px; }

/* نصوص غنية: جداول وقوائم */
.prose ul, .prose ol { margin: 0 0 .8em; padding-inline-start: 1.4em; }
.prose li { margin-bottom: .3em; }
.rt-table { overflow-x: auto; margin: 4px 0 14px; border: 1px solid var(--border); border-radius: 14px; }
.rt-table table { width: 100%; border-collapse: collapse; font-size: .92rem; line-height: 1.6; }
.rt-table th { background: var(--primary-50); color: var(--primary-600); font-family: var(--font-head); font-weight: 600; text-align: start; padding: 10px 14px; white-space: nowrap; }
.rt-table td { padding: 10px 14px; border-top: 1px solid var(--border); vertical-align: top; }
.rt-table tr:nth-child(even) td { background: color-mix(in srgb, var(--surface-2) 55%, transparent); }
.rt-table td:first-child { font-weight: 600; color: var(--text); }

/* بطاقة التحدي */
.fact-table { border: 1px solid var(--border); border-radius: 14px; overflow: hidden; }
.fact-table table { width: 100%; border-collapse: collapse; }
.fact-table th, .fact-table td { padding: 11px 14px; text-align: start; border-top: 1px solid var(--border); }
.fact-table tr:first-child th, .fact-table tr:first-child td { border-top: 0; }
.fact-table th { width: 40%; background: var(--primary-50); color: var(--muted); font-weight: 500; font-size: .9rem; white-space: nowrap; }
.fact-table td { font-family: var(--font-head); font-weight: 600; color: var(--text); }
.fact-ic { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 8px; background: var(--surface); color: var(--primary); margin-inline-end: 8px; vertical-align: middle; }
.fact-ic .ic { width: 15px; height: 15px; }
.ch-lists { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 14px; }
@media (max-width: 640px) { .ch-lists { grid-template-columns: 1fr; } }
.ch-list-box { border: 1px solid var(--border); border-radius: 14px; padding: 14px; background: var(--surface); }
.ch-list-box.is-proof { background: var(--primary-50); border-color: var(--primary-100); }
.ch-list-box h3 { display: flex; align-items: center; gap: 8px; font-size: .95rem; margin: 0 0 10px; color: var(--text); }
.ch-list-box h3 .ic { color: var(--primary); }
.check-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.check-list li { display: flex; gap: 8px; align-items: flex-start; font-size: .92rem; line-height: 1.6; }
.check-list li .ic { color: var(--teal); margin-top: 3px; }
.is-proof .check-list li .ic { color: var(--primary); }

/* الخطوات: خط زمني */
.steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.step { position: relative; display: flex; gap: 14px; padding-bottom: 18px; }
.step:last-child { padding-bottom: 0; }
.step::before { content: ""; position: absolute; inset-inline-start: 17px; top: 38px; bottom: 2px; width: 2px; background: var(--primary-100); }
.step:last-child::before { display: none; }
.step-num {
  position: relative; z-index: 1; flex-shrink: 0; width: 36px; height: 36px; border-radius: 50%;
  background: var(--hero); color: #fff; display: grid; place-items: center;
  font-family: var(--font-head); font-weight: 700; box-shadow: 0 4px 12px rgba(26, 52, 194, .25);
}
.step-body { padding-top: 5px; min-width: 0; }
.step-body strong { font-family: var(--font-head); font-weight: 600; font-size: 1.02rem; display: block; color: var(--text); }
.step-body p { margin: 4px 0 0; color: var(--muted); line-height: 1.8; }

/* القالب */
.tpl {
  margin: 0 0 10px; padding: 16px 18px; border-radius: 14px; white-space: pre-wrap; direction: rtl; text-align: start;
  background: #141C3F; color: #E8ECFF; font-family: var(--font-body); font-size: .95rem; line-height: 1.9;
  border-inline-start: 4px solid var(--mint); overflow-x: auto;
}

/* صناديق التنبيه */
.callouts { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; }
.callout { display: flex; gap: 12px; padding: 14px 16px; border-radius: 16px; border: 1px solid transparent; }
.callout strong { font-family: var(--font-head); display: block; margin-bottom: 2px; }
.callout p { margin: 0; line-height: 1.75; font-size: .93rem; }
.c-ic { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; flex-shrink: 0; }
.c-ic .ic { width: 19px; height: 19px; }
.c-tip { background: var(--success-50); border-color: color-mix(in srgb, var(--teal) 25%, transparent); }
.c-tip strong, .c-tip .c-ic { color: var(--teal-d); }
.c-tip .c-ic { background: #fff; }
.c-warn { background: var(--warn-50); border-color: color-mix(in srgb, var(--warn) 25%, transparent); }
.c-warn strong, .c-warn .c-ic { color: var(--warn); }
.c-warn .c-ic { background: #fff; }
.c-save { background: var(--primary-50); border-color: var(--primary-100); }
.c-save strong, .c-save .c-ic { color: var(--primary); }
.c-save .c-ic { background: #fff; }

/* النتيجة والتسليم */
.ch-outcome, .ch-deliver { display: flex; gap: 14px; padding: 18px 20px; border-radius: 18px; align-items: flex-start; }
.ch-outcome strong, .ch-deliver strong { font-family: var(--font-head); font-size: 1.02rem; display: block; margin-bottom: 4px; }
.ch-outcome p, .ch-deliver p { margin: 0; line-height: 1.8; }
.ch-outcome { background: linear-gradient(135deg, var(--success-50), #fff); border: 1px solid color-mix(in srgb, var(--teal) 30%, transparent); }
.ch-outcome .c-ic { background: var(--teal); color: #fff; }
.ch-outcome strong { color: var(--teal-d); }
.ch-deliver { background: linear-gradient(135deg, var(--gold-50), #fff); border: 1px solid color-mix(in srgb, var(--gold) 35%, transparent); }
.ch-deliver .c-ic { background: #F6C35A; color: #3B2A05; }
.ch-deliver strong { color: var(--gold); }
.ch-deliver small { display: block; margin-top: 6px; color: var(--muted); }

/* الشريط الجانبي */
.side-card .dropzone { margin-bottom: 10px; }
.side-card .dz-inner { flex-direction: column; text-align: center; padding: 18px 12px; gap: 8px; }
.dropzone.is-disabled { opacity: .6; }
.complete-card.is-done { background: var(--success-50); border-color: color-mix(in srgb, var(--teal) 30%, transparent); }
.complete-card .done-msg { margin-bottom: 10px; }
.complete-card .done-msg strong { color: var(--teal-d); }
.mini-progress { display: flex; flex-direction: column; gap: 8px; }
.ch-side .pager .btn { flex: 1; }

/* قائمة التحديات حسب الأسبوع */
.week-group { margin-bottom: 18px; }
.week-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 0 4px 10px; }
.week-head h2 { font-size: 1.05rem; margin: 0; color: var(--primary-600); display: flex; align-items: center; gap: 8px; }
.week-head .badge { font-size: .78rem; }
.ch-item .ch-summary-line { color: var(--muted); font-size: .86rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ch-item-meta { display: flex; gap: 10px; flex-wrap: wrap; font-size: .78rem; color: var(--muted); margin-top: 2px; }
.ch-item-meta span { display: inline-flex; align-items: center; gap: 4px; }
.ch-item-meta .ic { width: 13px; height: 13px; }
.ch-item-meta .is-gold { color: var(--gold); font-weight: 600; }
.journey-card summary { cursor: pointer; font-family: var(--font-head); font-weight: 600; color: var(--primary-600); display: flex; align-items: center; gap: 8px; list-style: none; }
.journey-card summary::-webkit-details-marker { display: none; }
.journey-card[open] summary { margin-bottom: 12px; }

/* الإدارة: ظهور التحديات */
.vis-badge { display: inline-flex; align-items: center; gap: 4px; }
.vis-toggle { display: inline-flex; }
.bulk-bar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.bulk-bar form { display: inline-flex; gap: 6px; align-items: center; margin: 0; }
.bulk-bar input[type=number] { width: 80px !important; padding: 6px 8px !important; }
.pack-card { border-color: color-mix(in srgb, var(--primary) 30%, var(--border)); background: linear-gradient(160deg, var(--primary-50), var(--surface) 60%); }
.pack-card .pack-row { display: flex; gap: 16px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.form-section { border: 1px solid var(--border); border-radius: 16px; padding: 16px; display: grid; grid-template-columns: 1fr 1fr; gap: 12px 14px; }
.form-section > legend { font-family: var(--font-head); font-weight: 600; color: var(--primary-600); padding: 0 8px; display: flex; align-items: center; gap: 6px; }
.form-section .span-2 { grid-column: 1 / -1; }
@media (max-width: 640px) { .form-section { grid-template-columns: 1fr; } }
.field-hint { font-size: .78rem; color: var(--muted); }
.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-weight: 600; }
.switch input { width: 20px; height: 20px; accent-color: var(--primary); }
.callouts > .callout:last-child:nth-child(odd) { grid-column: 1 / -1; }

/* ===== الفتح اليومي: التحديات المقفلة والعدّاد ===== */
.countdown { font-family: var(--font-head); font-variant-numeric: tabular-nums; font-weight: 700; letter-spacing: .5px; }
.countdown:empty { display: none; }
.unlock-next { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 14px; padding: 10px 14px; border-radius: var(--radius-sm); background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.22); font-size: .92rem; }
.unlock-next .ic { width: 18px; height: 18px; color: var(--mint); flex: none; }
.unlock-next .countdown { margin-inline-start: auto; background: rgba(0,0,0,.18); padding: 2px 10px; border-radius: 999px; }
.unlock-banner { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 14px 16px; margin-bottom: 16px; border-radius: var(--radius); background: var(--primary-50); border: 1px solid color-mix(in srgb, var(--primary) 25%, var(--border)); color: var(--primary-600); }
.unlock-banner > span:nth-child(2) { flex: 1 1 220px; }
.unlock-ic { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; background: var(--primary); color: #fff; flex: none; }
.unlock-ic .ic { width: 18px; height: 18px; }
.unlock-banner .countdown { background: var(--surface); border: 1px solid var(--border); padding: 4px 12px; border-radius: 999px; color: var(--primary); }

.ch-item.is-locked { background: var(--surface-2); border-style: dashed; }
.ch-item.is-locked .ch-day { background: var(--surface); color: var(--muted); }
.ch-item.is-locked strong { color: var(--muted); }
.ch-item.is-locked .ch-status .ic { color: var(--muted); width: 20px; height: 20px; }
.ch-item.is-today { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-50); }
.ch-item-meta .is-lock { color: var(--primary); font-weight: 600; }
.badge-lock { background: rgba(255,255,255,.16); color: #fff; border: 1px solid rgba(255,255,255,.3); }
a.day.locked { cursor: pointer; }
a.day.locked:hover { opacity: 1; }

.locked-hero { background: linear-gradient(155deg, #3A4570, #2A3358 55%, #1E2440); }
.lock-card { text-align: center; padding: 34px 20px; display: grid; justify-items: center; gap: 6px; }
.lock-card h2 { margin: 4px 0 0; font-family: var(--font-head); }
.lock-ic { width: 64px; height: 64px; border-radius: 20px; display: grid; place-items: center; background: var(--primary-50); color: var(--primary); }
.lock-ic .ic { width: 30px; height: 30px; }
.lock-when { font-size: 1.05rem; margin: 6px 0 0; display: inline-flex; align-items: center; gap: 6px; }
.lock-when .ic { width: 18px; height: 18px; color: var(--primary); }
.countdown.big { font-size: 1.9rem; color: var(--primary); margin: 4px 0; }
.lock-card p.muted { max-width: 460px; margin: 4px auto; }
.center-actions { justify-content: center; margin-top: 10px; }
.is-locked-page .pager { margin-top: 16px; }

.schedule-card { padding: 16px 18px; }
.schedule-row { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.schedule-ic { width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; background: var(--primary-50); color: var(--primary); flex: none; }
.schedule-ic .ic { width: 22px; height: 22px; }
.schedule-text { flex: 1 1 260px; display: grid; gap: 2px; min-width: 0; }

.how-steps { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.how-steps > div { display: flex; gap: 10px; align-items: flex-start; }
.how-steps p { margin: 2px 0 0; }
.how-n { width: 30px; height: 30px; border-radius: 10px; background: var(--primary); color: #fff; display: grid; place-items: center; font-family: var(--font-head); font-weight: 700; flex: none; }
@media (max-width: 860px) { .how-steps { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 520px) { .how-steps { grid-template-columns: 1fr; } }
.lib-choice { padding: 12px 14px; border-radius: var(--radius-sm); background: var(--primary-50); border: 1px solid color-mix(in srgb, var(--primary) 20%, var(--border)); gap: 6px; }
.field-hint .ic { width: 14px; height: 14px; vertical-align: -2px; }
.ch-table td:nth-child(2) { min-width: 210px; }

/* ============ صفحة الهبوط العامة (Landing Page) ============ */
body.is-landing { background: var(--bg); }
body.is-landing .page { padding: 0 0 60px; }
body.is-landing .page > .container { max-width: 100%; padding: 0; }

.landing-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid var(--border);
}
.landing-nav-inner {
  max-width: 1160px; margin: 0 auto; padding: 14px 20px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.landing-links { display: flex; align-items: center; gap: 24px; }
.landing-links a { color: var(--muted); font-weight: 600; font-size: .94rem; transition: color .2s; }
.landing-links a:hover { color: var(--primary); text-decoration: none; }
.landing-actions { display: flex; align-items: center; gap: 10px; }

/* ============ قسم الهيرو المطابق للتوجيه البصري الدقيق (Refined Seamless Hero) ============ */
.landing-hero-exact {
  position: relative;
  overflow: hidden;
  background: radial-gradient(circle at 18% 45%, rgba(224, 231, 255, 0.55), transparent 50%),
              radial-gradient(circle at 85% 20%, rgba(219, 234, 254, 0.4), transparent 45%),
              linear-gradient(180deg, #FFFFFF 0%, #F8FAFC 100%);
  min-height: calc(100vh - 70px);
  min-height: calc(100dvh - 70px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 24px;
  box-sizing: border-box;
  border-bottom: 1px solid rgba(226, 232, 240, 0.85);
}

.landing-hero-container {
  width: 100%;
  max-width: 1240px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  align-items: center;
  gap: 48px;
}

/* العمود النصي (في اليمين لـ RTL) */
.hero-text-col {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  text-align: right;
  z-index: 2;
}

.hero-badge-pill {
  display: inline-flex;
  align-items: center;
  padding: 7px 22px;
  border-radius: 999px;
  background: #EEF2FF;
  color: #2563EB;
  font-family: var(--font-head);
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 22px;
  border: 1px solid rgba(199, 210, 254, 0.65);
  box-shadow: 0 2px 6px rgba(37, 99, 235, 0.04);
}

.hero-main-title {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-family: 'IBM Plex Sans Arabic', var(--font-head), sans-serif;
  font-size: clamp(2.3rem, 4.4vw, 3.4rem);
  font-weight: 800;
  line-height: 1.25;
  letter-spacing: -0.5px;
  margin: 0 0 16px 0;
}

.hero-title-dark {
  color: #0F172A;
}

.hero-title-accent {
  color: #2563EB;
  position: relative;
  display: inline-block;
  white-space: nowrap;
}

.hero-swoosh {
  position: absolute;
  right: 0;
  bottom: -10px;
  width: 140px;
  height: 14px;
  pointer-events: none;
}

.hero-description {
  color: #334155;
  font-size: clamp(1.1rem, 1.8vw, 1.25rem);
  line-height: 1.85;
  margin: 14px 0 28px 0;
  max-width: 530px;
  font-weight: 400;
}

.hero-actions-group {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 16px;
  flex-wrap: nowrap;
}

.hero-btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: linear-gradient(135deg, #1A34C2 0%, #2563EB 100%);
  color: #ffffff !important;
  font-family: var(--font-head);
  font-size: 1.05rem;
  font-weight: 700;
  padding: 13px 30px;
  border-radius: 14px;
  box-shadow: 0 10px 24px -4px rgba(37, 99, 235, 0.42), 0 2px 6px rgba(0, 0, 0, 0.04);
  transition: transform 0.22s ease, box-shadow 0.22s ease;
  text-decoration: none !important;
  border: 1px solid transparent;
}

.hero-btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 30px -4px rgba(37, 99, 235, 0.52);
  background: linear-gradient(135deg, #152A9D 0%, #1D4ED8 100%);
}

.hero-btn-icon {
  width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.hero-btn-icon .ic {
  width: 20px;
  height: 20px;
  fill: currentColor;
}

.hero-btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: #FFFFFF;
  color: #1E293B !important;
  font-family: var(--font-head);
  font-size: 1.05rem;
  font-weight: 600;
  padding: 13px 26px;
  border-radius: 14px;
  border: 1.5px solid #CBD5E1;
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.04);
  transition: all 0.2s ease;
  text-decoration: none !important;
}

.hero-btn-secondary:hover {
  background: #F8FAFC;
  border-color: #93C5FD;
  color: #2563EB !important;
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(37, 99, 235, 0.08);
}

.hero-btn-secondary .hero-arrow {
  display: inline-block;
  font-size: 1.2rem;
  transition: transform 0.2s ease;
}

.hero-btn-secondary:hover .hero-arrow {
  transform: translateX(-4px);
}

/* عمود العرض البصري المدمج بانسيابية طبيعية */
.hero-visual-col {
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
}

.hero-mockup-wrapper {
  position: relative;
  max-width: 620px;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  background: transparent !important;
  overflow: visible !important;
}

.hero-mockup-img {
  width: 100%;
  max-width: 620px;
  height: auto;
  display: block;
  object-fit: contain;
  border-radius: 0 !important;
  filter: drop-shadow(0 16px 36px rgba(15, 23, 42, 0.08));
  transition: transform 0.3s ease;
}

.hero-mockup-img:hover {
  transform: translateY(-4px);
}

/* التجاوب مع مختلف أحجام الشاشات */
@media (max-width: 980px) {
  .landing-hero-exact {
    min-height: auto;
    padding: 56px 20px 64px;
  }
  .landing-hero-container {
    grid-template-columns: 1fr;
    text-align: center;
    gap: 40px;
  }
  .hero-text-col {
    align-items: center;
    text-align: center;
  }
  .hero-description {
    margin-inline: auto;
  }
  .hero-actions-group {
    justify-content: center;
    flex-wrap: nowrap;
  }
  .hero-mockup-wrapper {
    max-width: 520px;
  }
}

/* ============ قسم كتب أخرى تفتح لك آفاقاً جديدة (Other Books Showcase) ============ */
.other-books-section {
  position: relative;
  background: #F8FAFC;
  padding: 96px 24px 108px;
  direction: rtl;
  border-top: 1px solid rgba(226, 232, 240, 0.85);
  border-bottom: 1px solid rgba(226, 232, 240, 0.85);
}
.other-books-container {
  max-width: 1240px;
  margin: 0 auto;
}
.other-books-header {
  text-align: center;
  max-width: 680px;
  margin: 0 auto 52px;
}
.other-books-title {
  font-family: 'IBM Plex Sans Arabic', var(--font-head), sans-serif;
  font-size: clamp(2rem, 3.8vw, 2.7rem);
  font-weight: 800;
  color: #0F172A;
  margin: 0 0 14px 0;
  letter-spacing: -0.5px;
}
.other-books-subtitle {
  font-family: 'IBM Plex Sans Arabic', sans-serif;
  font-size: 1.08rem;
  color: #64748B;
  line-height: 1.7;
  margin: 0;
}
.other-books-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 22px;
}
.other-book-card {
  background: #FFFFFF;
  border: 1px solid rgba(226, 232, 240, 0.95);
  border-radius: 22px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  box-shadow: 0 6px 20px -4px rgba(15, 23, 42, 0.04), 0 2px 6px -1px rgba(15, 23, 42, 0.02);
  transition: transform 0.28s ease, box-shadow 0.28s ease, border-color 0.28s ease;
}
.other-book-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 18px 36px -6px rgba(37, 99, 235, 0.12), 0 6px 12px -2px rgba(15, 23, 42, 0.04);
  border-color: #C7D2FE;
}
.other-book-cover-wrap {
  width: 100%;
  aspect-ratio: 3 / 4;
  border-radius: 16px;
  overflow: hidden;
  background: #F1F5F9;
  margin-bottom: 16px;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.06);
}
.other-book-cover-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.35s ease;
}
.other-book-card:hover .other-book-cover-img {
  transform: scale(1.03);
}
.other-book-info {
  display: flex;
  flex-direction: column;
  flex-grow: 1;
  justify-content: space-between;
}
.other-book-name {
  font-family: 'IBM Plex Sans Arabic', var(--font-head), sans-serif;
  font-size: 1.15rem;
  font-weight: 700;
  color: #0F172A;
  margin: 0 0 8px 0;
  line-height: 1.4;
  text-align: right;
}
.other-book-summary {
  font-family: 'IBM Plex Sans Arabic', sans-serif;
  font-size: 0.9rem;
  color: #64748B;
  line-height: 1.6;
  margin: 0 0 18px 0;
  min-height: 44px;
  text-align: right;
}
.other-book-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}
.other-book-btn-wa {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: linear-gradient(135deg, #4F46E5 0%, #3B82F6 50%, #6366F1 100%);
  color: #ffffff !important;
  font-family: 'IBM Plex Sans Arabic', var(--font-head), sans-serif;
  font-size: 0.95rem;
  font-weight: 700;
  padding: 10px 14px;
  border-radius: 999px;
  text-decoration: none !important;
  box-shadow: 0 6px 16px -2px rgba(79, 70, 229, 0.36);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.other-book-btn-wa:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 22px -2px rgba(79, 70, 229, 0.46);
}
.other-book-btn-wa .btn-wa-icon {
  width: 20px;
  height: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.other-book-btn-wa .btn-wa-icon .ic {
  width: 18px;
  height: 18px;
  fill: currentColor;
}
.other-book-btn-more {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 16px;
  border-radius: 999px;
  background: #FFFFFF;
  border: 1.5px solid #3B82F6;
  color: #2563EB !important;
  font-family: var(--font-head);
  font-size: 0.92rem;
  font-weight: 700;
  text-decoration: none !important;
  transition: all 0.22s ease;
  white-space: nowrap;
}
.other-book-btn-more:hover {
  background: #EFF6FF;
  border-color: #1D4ED8;
  color: #1D4ED8 !important;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.12);
}
.other-book-btn-more .btn-more-arrow {
  display: inline-block;
  font-size: 1.1rem;
  transition: transform 0.2s ease;
}
.other-book-btn-more:hover .btn-more-arrow {
  transform: translateX(-3px);
}
.other-books-bottom-cta {
  display: flex;
  justify-content: center;
  margin-top: 50px;
}
.other-books-more-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 13px 34px;
  border-radius: 999px;
  background: #FFFFFF;
  border: 1.5px solid #3B82F6;
  color: #2563EB !important;
  font-family: 'IBM Plex Sans Arabic', var(--font-head), sans-serif;
  font-size: 1.05rem;
  font-weight: 700;
  text-decoration: none !important;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.08);
  transition: all 0.24s ease;
}
.other-books-more-btn:hover {
  background: #EFF6FF;
  border-color: #1D4ED8;
  color: #1D4ED8 !important;
  transform: translateY(-2px);
  box-shadow: 0 8px 22px rgba(37, 99, 235, 0.16);
}
.other-books-more-btn .more-btn-icon {
  width: 22px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.other-books-more-btn .more-btn-icon .ic {
  width: 20px;
  height: 20px;
  color: currentColor;
}
@media (max-width: 1060px) {
  .other-books-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
  }
}
@media (max-width: 860px) {
  .other-books-section {
    padding: 60px 16px 76px;
  }
  .other-books-grid {
    grid-template-columns: 1fr;
    gap: 20px;
    max-width: 680px;
    margin: 0 auto;
  }
  .other-book-card {
    display: flex;
    flex-direction: row; /* في اتجاه RTL: غلاف الكتاب في اليمين والنصوص في اليسار تماماً مثل الصورة */
    align-items: center;
    justify-content: space-between;
    padding: 22px 24px;
    border-radius: 28px;
    gap: 24px;
    background: #FFFFFF;
    border: 1px solid rgba(226, 232, 240, 0.9);
    box-shadow: 0 8px 24px -4px rgba(15, 23, 42, 0.05), 0 2px 6px -1px rgba(15, 23, 42, 0.02);
  }
  .other-book-cover-wrap {
    flex: 0 0 170px;
    width: 170px;
    max-width: 170px;
    aspect-ratio: 1 / 1;
    border-radius: 20px;
    margin-bottom: 0;
    background: transparent;
    box-shadow: none;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  .other-book-cover-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 14px;
    filter: drop-shadow(0 10px 22px rgba(15, 23, 42, 0.12));
  }
  .other-book-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    text-align: right;
  }
  .other-book-name {
    font-family: var(--font-head);
    font-size: 1.35rem;
    font-weight: 800;
    color: #0F172A;
    line-height: 1.35;
    margin: 0 0 8px 0;
  }
  .other-book-summary {
    font-size: 0.95rem;
    color: #64748B;
    line-height: 1.6;
    margin: 0 0 18px 0;
    min-height: auto;
  }
  .other-book-actions {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
  }
  .other-book-btn-wa {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 22px;
    font-size: 0.95rem;
    font-weight: 700;
    border-radius: 999px;
    background: linear-gradient(135deg, #2563EB 0%, #4F46E5 100%);
    color: #ffffff !important;
    box-shadow: 0 4px 14px rgba(37, 99, 235, 0.35);
  }
  .other-book-btn-more {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    font-size: 0.95rem;
    font-weight: 700;
    border-radius: 999px;
    background: #FFFFFF;
    border: 1.5px solid #3B82F6;
    color: #2563EB !important;
  }
}
@media (max-width: 540px) {
  .other-book-card {
    padding: 16px 14px;
    border-radius: 22px;
    gap: 14px;
  }
  .other-book-cover-wrap {
    flex: 0 0 120px;
    width: 120px;
    max-width: 120px;
  }
  .other-book-name {
    font-size: 1.1rem;
    margin-bottom: 6px;
  }
  .other-book-summary {
    font-size: 0.84rem;
    margin-bottom: 12px;
  }
  .other-book-actions {
    gap: 8px;
  }
  .other-book-btn-wa,
  .other-book-btn-more {
    padding: 8px 14px;
    font-size: 0.84rem;
  }
}

.landing-section { padding: 80px 20px; }
.section-container { max-width: 1140px; margin: 0 auto; }
.section-header { text-align: center; max-width: 680px; margin: 0 auto 50px; }
.section-badge {
  display: inline-block; background: var(--primary-50); color: var(--primary);
  font-weight: 700; font-size: .84rem; padding: 4px 14px; border-radius: 999px;
  margin-bottom: 12px; border: 1px solid var(--primary-100);
}
.section-title { font-size: clamp(1.6rem, 3vw, 2.2rem); color: var(--text); font-weight: 700; margin-bottom: 10px; }
.section-desc { font-size: 1.05rem; color: var(--muted); line-height: 1.7; }

/* قسم الكتاب المميز */
.book-showcase-box {
  background: var(--surface); border: 1px solid var(--border); border-radius: 28px;
  box-shadow: 0 12px 35px rgba(30, 36, 64, .06); overflow: hidden;
  display: grid; grid-template-columns: 1fr 1.35fr; gap: 0;
}
.book-visual-col {
  background: linear-gradient(145deg, #EEF2FD, #E0E7FD);
  padding: 44px 30px; display: flex; flex-direction: column; align-items: center; justify-content: center;
  border-inline-end: 1px solid var(--border); text-align: center;
}
.book-3d-wrap {
  width: 210px; height: 300px; position: relative; margin-bottom: 24px;
  perspective: 1000px;
}
.book-cover {
  width: 100%; height: 100%; border-radius: 12px 18px 18px 12px;
  background: linear-gradient(135deg, #1A34C2, #102187);
  box-shadow: -12px 14px 28px rgba(18, 35, 154, .32), inset -4px 0 8px rgba(0,0,0,.25);
  display: flex; flex-direction: column; justify-content: space-between; padding: 24px 18px;
  color: #fff; text-align: start; border-inline-start: 6px solid #0B1765;
}
.book-cover-tag { font-size: .72rem; font-weight: 700; color: var(--mint); text-transform: uppercase; letter-spacing: .5px; }
.book-cover-title { font-size: 1.25rem; font-weight: 700; line-height: 1.35; margin: 12px 0 6px; }
.book-cover-sub { font-size: .8rem; opacity: .85; }
.book-cover-foot { font-size: .75rem; opacity: .7; border-top: 1px solid rgba(255,255,255,.2); padding-top: 10px; }
.book-info-col { padding: 44px 40px; display: flex; flex-direction: column; justify-content: space-between; }
.book-badge-row { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.book-tag { font-size: .8rem; font-weight: 600; padding: 3px 10px; border-radius: 8px; background: var(--primary-50); color: var(--primary); }
.book-features-list { list-style: none; padding: 0; margin: 20px 0 28px; display: grid; gap: 12px; }
.book-features-list li { display: flex; align-items: flex-start; gap: 12px; font-size: .96rem; color: var(--text); }
.book-features-list .check-ic { color: var(--teal); background: var(--success-50); border-radius: 50%; padding: 3px; width: 22px; height: 22px; flex-shrink: 0; margin-top: 2px; }
.book-order-card {
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 18px; padding: 20px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
}
.book-order-text strong { display: block; font-size: 1.05rem; color: var(--text); margin-bottom: 4px; }
.book-order-text p { margin: 0; font-size: .88rem; color: var(--muted); }

/* خطوات كيف تعمل */
.steps-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 22px; }
.step-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 20px;
  padding: 28px 22px; position: relative; display: flex; flex-direction: column;
  box-shadow: 0 4px 16px rgba(30,36,64,.04); transition: transform .2s, box-shadow .2s;
}
.step-card:hover { transform: translateY(-4px); box-shadow: 0 10px 28px rgba(30,36,64,.08); }
.step-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.step-num {
  width: 42px; height: 42px; border-radius: 14px; background: var(--primary); color: #fff;
  display: grid; place-items: center; font-family: var(--font-head); font-weight: 700; font-size: 1.15rem;
}
.step-icon { width: 36px; height: 36px; color: var(--primary); }
.step-card h3 { font-size: 1.12rem; margin-bottom: 8px; color: var(--text); }
.step-card p { font-size: .9rem; color: var(--muted); line-height: 1.65; margin: 0; }

/* بطاقات المميزات */
.features-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }
.feature-box {
  background: var(--surface); border: 1px solid var(--border); border-radius: 20px;
  padding: 30px 24px; display: flex; flex-direction: column; gap: 12px;
  box-shadow: 0 2px 10px rgba(30,36,64,.03); transition: transform .2s;
}
.feature-box:hover { transform: translateY(-3px); border-color: color-mix(in srgb, var(--primary) 35%, var(--border)); }
.feature-icon-wrap {
  width: 50px; height: 50px; border-radius: 16px; background: var(--primary-50);
  color: var(--primary); display: grid; place-items: center; margin-bottom: 6px;
}
.feature-icon-wrap .ic { width: 26px; height: 26px; }
.feature-box h3 { font-size: 1.15rem; color: var(--text); margin: 0; }
.feature-box p { font-size: .92rem; color: var(--muted); line-height: 1.65; margin: 0; }

/* الأسئلة الشائعة */
.faq-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.faq-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 18px;
  padding: 22px 24px; box-shadow: 0 2px 8px rgba(30,36,64,.02);
}
.faq-card h4 { font-size: 1.05rem; font-family: var(--font-head); font-weight: 700; color: var(--text); margin: 0 0 8px; display: flex; align-items: center; gap: 8px; }
.faq-card h4 .ic { color: var(--primary); width: 20px; height: 20px; flex-shrink: 0; }
.faq-card p { margin: 0; font-size: .92rem; color: var(--muted); line-height: 1.7; }

/* البانر الختامي CTA */
.landing-cta-banner {
  background: linear-gradient(145deg, #1A34C2, #0F1E85); color: #fff;
  border-radius: 28px; padding: 60px 30px; text-align: center;
  box-shadow: 0 20px 50px rgba(18, 35, 154, .25); position: relative; overflow: hidden;
}
.landing-cta-banner h2 { font-size: clamp(1.8rem, 3.5vw, 2.5rem); color: #fff; margin-bottom: 14px; }
.landing-cta-banner p { font-size: 1.1rem; color: rgba(255,255,255,.88); max-width: 600px; margin: 0 auto 30px; }

/* الفوتر العام */
.landing-footer {
  background: var(--surface); border-top: 1px solid var(--border); padding: 40px 20px 30px;
  margin-top: 60px;
}
.footer-inner {
  max-width: 1140px; margin: 0 auto; display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 20px;
}
.footer-brand { display: flex; align-items: center; gap: 12px; }
.footer-links { display: flex; gap: 20px; align-items: center; }
.footer-links a { color: var(--muted); font-size: .9rem; }
.footer-links a:hover { color: var(--primary); }
.footer-copy { width: 100%; border-top: 1px solid var(--border); padding-top: 20px; margin-top: 20px; text-align: center; font-size: .84rem; color: var(--muted); }

@media (max-width: 960px) {
  .book-showcase-box { grid-template-columns: 1fr; }
  .book-visual-col { border-inline-end: none; border-bottom: 1px solid var(--border); }
  .steps-grid { grid-template-columns: repeat(2, 1fr); }
  .features-grid { grid-template-columns: repeat(2, 1fr); }
  .faq-grid { grid-template-columns: 1fr; }
  .hero-stats { grid-template-columns: repeat(2, 1fr); gap: 24px; }
}

@media (max-width: 640px) {
  .landing-nav-inner {
    padding: 8px 16px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 12px !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }
  .landing-header .brand {
    display: flex !important;
    align-items: center !important;
    flex-shrink: 0 !important;
    order: 1 !important;
    margin: 0 !important;
  }
  .landing-header .brand-logo {
    height: 32px !important;
    width: auto !important;
    max-width: 110px !important;
    display: block !important;
  }
  .landing-header .brand-tag {
    display: none !important;
  }
  .landing-links { display: none !important; }
  .landing-actions {
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    flex-shrink: 0 !important;
    margin-inline-start: auto !important;
    order: 2 !important;
  }
  .landing-actions .btn {
    width: 38px !important;
    height: 38px !important;
    min-width: 38px !important;
    max-width: 38px !important;
    padding: 0 !important;
    border-radius: 50% !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    flex-shrink: 0 !important;
    box-sizing: border-box !important;
    transition: transform 0.15s ease, background-color 0.15s ease, box-shadow 0.15s ease;
  }
  .landing-actions .btn:active {
    transform: scale(0.92);
  }
  .landing-actions .btn span {
    display: none !important;
  }
  .landing-actions .btn .ic,
  .landing-actions .btn svg {
    width: 20px !important;
    height: 20px !important;
    margin: 0 !important;
    display: block !important;
  }
  .landing-actions .btn-wa {
    background: #25D366 !important;
    color: #FFFFFF !important;
    border: 1px solid rgba(0, 0, 0, 0.05) !important;
    box-shadow: 0 2px 8px rgba(37, 211, 102, 0.35) !important;
  }
  .landing-actions .btn-outline {
    background: #EEF2FD !important;
    color: #1A34C2 !important;
    border: 1.5px solid #D5E0FC !important;
  }
  .landing-actions .btn-primary {
    background: #1A34C2 !important;
    color: #FFFFFF !important;
  }
  .steps-grid { grid-template-columns: 1fr; }
  .features-grid { grid-template-columns: 1fr; }
  .book-info-col { padding: 28px 20px; }
  .book-order-card { flex-direction: column; align-items: stretch; text-align: center; }
  .hero-cta { flex-direction: column; width: 100%; }
  .hero-cta a { width: 100%; justify-content: center; }
  .hero-actions-group,
  .madark-cta-buttons {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    align-items: stretch !important;
    justify-content: center !important;
    gap: 10px !important;
    width: 100% !important;
    max-width: 400px !important;
    margin-inline: auto !important;
  }
  .hero-btn-primary,
  .hero-btn-secondary,
  .cta-btn-primary,
  .cta-btn-outline {
    flex: 1 1 0 !important;
    min-width: 0 !important;
    padding: 12px 8px !important;
    font-size: clamp(0.85rem, 3.4vw, 0.98rem) !important;
    font-weight: 700 !important;
    white-space: nowrap !important;
    justify-content: center !important;
    text-align: center !important;
    gap: 6px !important;
    box-sizing: border-box !important;
  }
  .hero-btn-primary,
  .hero-btn-secondary {
    border-radius: 12px !important;
  }
  .cta-btn-primary,
  .cta-btn-outline {
    border-radius: 999px !important;
  }
  .hero-btn-icon,
  .cta-btn-primary .cta-btn-icon {
    width: 18px !important;
    height: 18px !important;
    flex-shrink: 0 !important;
  }
  .hero-btn-icon .ic,
  .cta-btn-primary .cta-btn-icon svg {
    width: 16px !important;
    height: 16px !important;
  }
  .hero-arrow,
  .cta-arrow-left {
    font-size: 1.05rem !important;
    flex-shrink: 0 !important;
  }

  @media (max-width: 380px) {
    .hero-actions-group,
    .madark-cta-buttons {
      gap: 6px !important;
    }
    .hero-btn-primary,
    .hero-btn-secondary,
    .cta-btn-primary,
    .cta-btn-outline {
      padding: 11px 4px !important;
      font-size: 0.82rem !important;
      gap: 4px !important;
    }
    .hero-btn-icon,
    .cta-btn-primary .cta-btn-icon {
      width: 15px !important;
      height: 15px !important;
    }
    .hero-btn-icon .ic,
    .cta-btn-primary .cta-btn-icon svg {
      width: 14px !important;
      height: 14px !important;
    }
  }
  .hero-stats { grid-template-columns: 1fr 1fr; }
}

/* ============ لوحة الإدارة: شريط جانبي مستقل ============ */
body.role-admin,
body.role-owner,
body.role-content_manager,
body.is-admin-shell {
  --admin-sidebar-width: 272px;
  min-width: 0;
  overflow-x: hidden;
}
html.admin-sidebar-collapsed body.role-admin,
html.admin-sidebar-collapsed body.role-owner,
html.admin-sidebar-collapsed body.role-content_manager,
html.admin-sidebar-collapsed body.is-admin-shell { --admin-sidebar-width: 80px; }
.role-admin .admin-shell,
.role-owner .admin-shell,
.role-content_manager .admin-shell,
.is-admin-shell .admin-shell { min-height: 100dvh; }
.role-admin .admin-sidebar,
.role-owner .admin-sidebar,
.role-content_manager .admin-sidebar,
.is-admin-shell .admin-sidebar {
  position: fixed;
  inset-block: 0;
  inset-inline-start: 0;
  z-index: 60;
  display: flex;
  flex-direction: column;
  width: var(--admin-sidebar-width);
  min-height: 100dvh;
  padding: max(18px, env(safe-area-inset-top)) 14px max(16px, env(safe-area-inset-bottom));
  color: var(--text);
  background: var(--surface);
  border-inline-end: 1px solid var(--border);
  box-shadow: -8px 0 28px rgba(30, 36, 64, .05);
  overflow: hidden;
  transition: width .2s ease, transform .22s ease;
}
.role-admin .admin-main,
.role-owner .admin-main,
.role-content_manager .admin-main,
.is-admin-shell .admin-main {
  min-width: 0;
  min-height: 100dvh;
  margin-inline-start: var(--admin-sidebar-width);
  transition: margin-inline-start .2s ease;
}
.role-admin .admin-page,
.role-owner .admin-page,
.role-content_manager .admin-page,
.is-admin-shell .admin-page { padding: 24px 0 36px; }
.role-admin .admin-page > .container,
.role-owner .admin-page > .container,
.role-content_manager .admin-page > .container,
.is-admin-shell .admin-page > .container { max-width: 1240px; }
.admin-sidebar-brand {
  position: relative;
  display: flex;
  align-items: center;
  min-height: 44px;
  padding: 2px 4px 18px;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--border);
}
.admin-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  color: var(--text);
}
.admin-brand:hover { text-decoration: none; }
.admin-brand-logo { display: block; width: 102px; height: auto; }
.admin-brand-mark { display: none; width: 34px; height: 34px; object-fit: contain; }
.admin-brand-copy { display: flex; flex-direction: column; min-width: 0; line-height: 1.35; }
.admin-brand-copy strong { font-family: var(--font-head); font-size: .83rem; }
.admin-brand-copy small { color: var(--muted); font-size: .72rem; }
.admin-collapse-toggle,
.admin-drawer-close,
.admin-drawer-toggle {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  padding: 0;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
}
.admin-collapse-toggle { margin-inline-start: auto; }
.admin-collapse-toggle:hover,
.admin-drawer-close:hover,
.admin-drawer-toggle:hover { color: var(--primary); background: var(--primary-50); border-color: var(--primary-100); }
.admin-collapse-toggle .ic { transition: transform .2s ease; }
.admin-drawer-close { display: none; margin-inline-start: auto; }
.admin-sidebar-nav {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  gap: 4px;
  min-height: 0;
  padding-inline-end: 2px;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.admin-nav-heading {
  padding: 0 10px;
  margin: 4px 0 6px;
  color: var(--muted);
  font-family: var(--font-head);
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .04em;
}
.admin-nav-link {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 46px;
  padding: 6px 10px;
  color: var(--muted);
  border: 1px solid transparent;
  border-radius: 12px;
  font-family: var(--font-head);
  font-size: .88rem;
  font-weight: 600;
  text-decoration: none;
  transition: color .15s ease, background .15s ease, border-color .15s ease;
}
.admin-nav-link:hover { color: var(--text); background: var(--surface-2); text-decoration: none; }
.admin-nav-link.active { color: var(--primary); background: var(--primary-50); border-color: var(--primary-100); }
.admin-nav-link.active::before {
  position: absolute;
  inset-block: 12px;
  inset-inline-start: -1px;
  width: 3px;
  content: '';
  background: var(--primary);
  border-radius: 0 4px 4px 0;
}
.admin-nav-icon {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  color: inherit;
  background: var(--surface-2);
  border-radius: 9px;
  flex: 0 0 auto;
}
.admin-nav-link.active .admin-nav-icon { background: var(--primary-100); }
.admin-nav-icon .ic { width: 18px; height: 18px; }
.admin-nav-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.admin-nav-link .count { margin-inline-start: auto; }
.admin-sidebar-footer { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--border); }
.admin-profile { display: flex; align-items: center; gap: 10px; min-width: 0; padding: 0 6px 12px; }
.admin-profile-copy { display: flex; min-width: 0; flex-direction: column; line-height: 1.45; }
.admin-profile-copy strong { overflow: hidden; font-size: .82rem; text-overflow: ellipsis; white-space: nowrap; }
.admin-profile-copy small { color: var(--muted); font-size: .72rem; }
.admin-logout-form { margin: 0; }
.admin-logout {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 42px;
  gap: 10px;
  padding: 8px 10px;
  color: var(--muted);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 10px;
  cursor: pointer;
  font: 600 .84rem var(--font-head);
  text-align: start;
}
.admin-logout:hover { color: var(--danger); background: var(--danger-50); border-color: color-mix(in srgb, var(--danger) 18%, var(--border)); }
.admin-logout .ic { width: 19px; height: 19px; }
.admin-topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  min-height: 64px;
  padding: 10px 24px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  border-bottom: 1px solid color-mix(in srgb, var(--border) 84%, transparent);
  backdrop-filter: saturate(1.3) blur(10px);
}
.admin-topbar-title { display: flex; min-width: 0; align-items: baseline; gap: 9px; }
.admin-topbar-title span { color: var(--muted); font-size: .76rem; }
.admin-topbar-title strong { overflow: hidden; color: var(--text); font-family: var(--font-head); font-size: .95rem; text-overflow: ellipsis; white-space: nowrap; }
.admin-drawer-toggle,
.admin-sidebar-backdrop { display: none; }

@media (min-width: 901px) {
  html.admin-sidebar-collapsed .admin-sidebar-brand { justify-content: center; padding-inline: 0; }
  html.admin-sidebar-collapsed .admin-brand-logo,
  html.admin-sidebar-collapsed .admin-brand-copy,
  html.admin-sidebar-collapsed .admin-nav-heading,
  html.admin-sidebar-collapsed .admin-nav-label,
  html.admin-sidebar-collapsed .admin-profile-copy,
  html.admin-sidebar-collapsed .admin-logout span { display: none; }
  html.admin-sidebar-collapsed .admin-brand-mark { display: block; }
  html.admin-sidebar-collapsed .admin-collapse-toggle {
    position: absolute;
    inset-block-start: 54px;
    inset-inline-end: -14px;
    z-index: 1;
    width: 28px;
    height: 28px;
    background: var(--surface);
    border-radius: 50%;
    box-shadow: var(--shadow);
  }
  html.admin-sidebar-collapsed .admin-collapse-toggle .ic { transform: rotate(180deg); }
  html.admin-sidebar-collapsed .admin-sidebar-nav { align-items: center; padding-top: 8px; }
  html.admin-sidebar-collapsed .admin-nav-link,
  html.admin-sidebar-collapsed .admin-logout { justify-content: center; width: 46px; padding-inline: 0; }
  html.admin-sidebar-collapsed .admin-nav-link .count {
    position: absolute;
    inset-block-start: -5px;
    inset-inline-end: -5px;
    margin: 0;
  }
  html.admin-sidebar-collapsed .admin-sidebar-footer { display: flex; align-items: center; flex-direction: column; }
  html.admin-sidebar-collapsed .admin-profile { justify-content: center; padding-inline: 0; }
  html.admin-sidebar-collapsed .admin-logout::after,
  html.admin-sidebar-collapsed .admin-nav-link::after {
    position: absolute;
    inset-inline-end: calc(100% + 12px);
    z-index: 70;
    display: none;
    width: max-content;
    max-width: 190px;
    padding: 6px 9px;
    color: #fff;
    background: var(--text);
    border-radius: 8px;
    box-shadow: var(--shadow);
    content: attr(data-tooltip);
    font: 600 .76rem var(--font-head);
    pointer-events: none;
  }
  html.admin-sidebar-collapsed .admin-nav-link:hover::after,
  html.admin-sidebar-collapsed .admin-nav-link:focus-visible::after,
  html.admin-sidebar-collapsed .admin-logout:hover::after,
  html.admin-sidebar-collapsed .admin-logout:focus-visible::after { display: block; }
}

@media (max-width: 900px) {
  .role-admin .admin-sidebar,
  .role-owner .admin-sidebar,
  .role-content_manager .admin-sidebar,
  .is-admin-shell .admin-sidebar {
    width: min(88vw, 320px);
    padding-inline: max(14px, env(safe-area-inset-right)) 14px;
    transform: translateX(105%);
    box-shadow: -16px 0 34px rgba(30, 36, 64, .16);
  }
  .role-admin .admin-main,
  .role-owner .admin-main,
  .role-content_manager .admin-main,
  .is-admin-shell .admin-main { margin-inline-start: 0; }
  html.admin-drawer-open .admin-sidebar { transform: translateX(0); }
  .admin-sidebar-backdrop {
    position: fixed;
    inset: 0;
    z-index: 50;
    display: block;
    width: 100%;
    height: 100%;
    padding: 0;
    pointer-events: none;
    opacity: 0;
    background: rgba(17, 25, 64, .42);
    border: 0;
    transition: opacity .22s ease;
  }
  html.admin-drawer-open .admin-sidebar-backdrop { pointer-events: auto; opacity: 1; }
  .admin-collapse-toggle { display: none; }
  .admin-drawer-close { display: grid; }
  .admin-drawer-toggle { display: grid; flex: 0 0 auto; }
  .admin-topbar { gap: 12px; min-height: 58px; padding: 8px 16px; }
  .admin-topbar-title { gap: 7px; }
  .admin-topbar-title strong { font-size: .9rem; }
  .role-admin .admin-page,
  .role-owner .admin-page,
  .role-content_manager .admin-page,
  .is-admin-shell .admin-page { padding: 18px 0 28px; }
}

@media (prefers-reduced-motion: reduce) {
  .role-admin .admin-sidebar,
  .role-owner .admin-sidebar,
  .role-content_manager .admin-sidebar,
  .is-admin-shell .admin-sidebar,
  .role-admin .admin-main,
  .role-owner .admin-main,
  .role-content_manager .admin-main,
  .is-admin-shell .admin-main,
  .admin-sidebar-backdrop,
  .admin-collapse-toggle .ic { transition: none; }
}


/* ============ رابط الملف الشخصي في شريط الإدارة الجانبي ============ */
.admin-profile-link {
  text-decoration: none;
  color: inherit;
  border-radius: 8px;
  transition: background .15s ease, opacity .15s ease;
}
.admin-profile-link:hover {
  background: rgba(26, 52, 194, 0.08);
}


/* ============ القائمة الفرعية المتداخلة لإدارة الصفحة الرئيسية ============ */
.admin-nav-accordion {
  display: flex;
  flex-direction: column;
  width: 100%;
}
.admin-nav-parent-row {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}
.admin-nav-parent-row .admin-nav-link-parent {
  flex: 1 1 auto;
  min-width: 0;
  padding-inline-end: 40px;
}
.admin-nav-chevron-btn {
  position: absolute;
  inset-inline-end: 6px;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  padding: 0;
  color: var(--muted);
  background: transparent;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: background .15s ease, color .15s ease;
  z-index: 2;
}
.admin-nav-chevron-btn:hover {
  background: var(--surface-2);
  color: var(--text);
}
.admin-nav-parent-row.active .admin-nav-chevron-btn {
  color: var(--primary);
}
.admin-nav-chevron-btn .ic {
  width: 16px;
  height: 16px;
  transition: transform .25s ease;
}
.admin-nav-accordion.is-expanded .admin-nav-chevron-btn .ic {
  transform: rotate(180deg);
}

.admin-subnav-panel {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows .25s cubic-bezier(0.4, 0, 0.2, 1);
}
.admin-nav-accordion.is-expanded .admin-subnav-panel {
  grid-template-rows: 1fr;
}
.admin-subnav-inner {
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding-block: 4px 6px;
  padding-inline-start: 10px;
  margin-inline-start: 22px;
  border-inline-start: 2px solid var(--border-light, #e2e8f0);
}
.admin-subnav-link {
  position: relative;
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 36px;
  padding: 5px 10px;
  color: var(--muted);
  border: 1px solid transparent;
  border-radius: 8px;
  font-family: var(--font-head);
  font-size: .83rem;
  font-weight: 500;
  text-decoration: none;
  transition: color .15s ease, background .15s ease, border-color .15s ease;
}
.admin-subnav-link:hover {
  color: var(--text);
  background: var(--surface-2);
  text-decoration: none;
}
.admin-subnav-link.active {
  color: var(--primary);
  background: var(--primary-50);
  border-color: var(--primary-100);
  font-weight: 700;
}
.admin-subnav-icon {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  color: inherit;
  background: var(--surface-2);
  border-radius: 6px;
  flex: 0 0 auto;
  transition: background .15s ease, color .15s ease;
}
.admin-subnav-link.active .admin-subnav-icon {
  background: var(--primary-100);
  color: var(--primary);
}
.admin-subnav-icon .ic {
  width: 14px;
  height: 14px;
}
.admin-subnav-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (min-width: 901px) {
  html.admin-sidebar-collapsed .admin-nav-chevron-btn,
  html.admin-sidebar-collapsed .admin-subnav-panel {
    display: none !important;
  }
  html.admin-sidebar-collapsed .admin-nav-parent-row .admin-nav-link-parent {
    padding-inline-end: 0;
  }
}


/* ===================================================
   Multi-Track Challenge Management & Video Quick-Edit Styles
   =================================================== */

.modal-backdrop:not(#viewer .modal-backdrop),
.modal-overlay,
[data-modal-container] {
  position: fixed !important;
  inset: 0 !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  max-width: 100vw !important;
  max-height: 100vh !important;
  z-index: 99999 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  background: rgba(10, 15, 30, 0.72) !important;
  backdrop-filter: blur(4px);
  padding: 16px !important;
  margin: 0 !important;
  box-sizing: border-box !important;
  overflow-y: auto !important;
}
.modal-backdrop:not(#viewer .modal-backdrop)[hidden],
.modal-backdrop:not(#viewer .modal-backdrop).is-hidden,
.modal-backdrop[hidden],
.modal-overlay[hidden],
[data-modal-container][hidden],
.modal-backdrop.is-hidden,
.modal-overlay.is-hidden,
[data-modal-container].is-hidden {
  display: none !important;
}
.modal-dialog {
  background: var(--surface, #fff);
  border: 1px solid var(--border);
  border-radius: 16px;
  width: min(640px, 100%);
  max-height: calc(100vh - 40px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  animation: modalPop 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}
.modal-dialog.modal-lg {
  width: min(920px, 100%);
}
@keyframes modalPop {
  from { opacity: 0; transform: scale(0.96) translateY(8px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}
.modal-dialog .modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}
.modal-dialog .modal-head h3 {
  margin: 0;
  font-size: 1.15rem;
  display: flex;
  align-items: center;
  gap: 8px;
}
.modal-close {
  background: none;
  border: none;
  font-size: 1.6rem;
  line-height: 1;
  color: var(--muted);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  transition: color 0.15s;
}
.modal-close:hover {
  color: var(--text);
}
.modal-dialog .modal-body {
  padding: 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  background: var(--surface);
}
.modal-dialog .modal-foot {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  background: var(--surface-2, #fafafa);
}

/* Tracks Grid */
.tracks-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 20px;
  margin-bottom: 2rem;
}
.track-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  border-radius: 16px;
  border: 1px solid var(--border);
  transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
  padding: 20px;
  position: relative;
  background: var(--surface);
}
.track-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 24px -10px rgba(0, 0, 0, 0.1);
  border-color: color-mix(in srgb, var(--primary) 35%, var(--border));
}
.track-card.is-draft {
  opacity: 0.85;
  background: var(--surface-2, #fafafa);
}
.track-badge-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}
.track-card-title {
  font-size: 1.25rem;
  margin: 0 0 8px 0;
  line-height: 1.35;
}
.track-card-title a {
  color: inherit;
  text-decoration: none;
}
.track-card-title a:hover {
  color: var(--primary);
}
.track-card-desc {
  line-height: 1.5;
  margin: 0 0 16px 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.track-stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  padding: 12px 8px;
  background: var(--surface-2, #f8f9fa);
  border-radius: 12px;
  text-align: center;
  margin-bottom: 16px;
}
.track-stat .stat-num {
  display: block;
  font-size: 1.25rem;
  font-weight: 700;
  font-family: var(--font-head);
  color: var(--primary);
}
.track-stat .stat-lbl {
  font-size: 0.75rem;
  color: var(--muted);
}
.track-card-footer {
  border-top: 1px solid var(--border);
  padding-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.track-actions-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

/* Quick Video Button in table */
.btn-video-active {
  background: rgba(22, 163, 74, 0.1) !important;
  color: #15803d !important;
  border: 1px solid rgba(22, 163, 74, 0.3) !important;
  font-weight: 600;
  font-size: 0.8rem;
}
.btn-video-active:hover {
  background: rgba(22, 163, 74, 0.2) !important;
}
.small-select {
  padding: 4px 8px;
  font-size: 0.8rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
}

/* Student Track Switcher */
.track-switcher-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 1.5rem;
  overflow-x: auto;
  padding-bottom: 4px;
  -webkit-overflow-scrolling: touch;
}
.track-switcher-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--muted);
  white-space: nowrap;
}
.track-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 99px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 0.88rem;
  text-decoration: none;
  font-weight: 500;
  white-space: nowrap;
  transition: all 0.15s ease;
}
.track-pill:hover {
  border-color: var(--primary);
  color: var(--primary);
}
.track-pill.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
  font-weight: 600;
}
