/* ============================================================
   بيئة التوأمة الرقمية — نظام تصميم احترافي
   IBM Plex Sans Arabic · Data-Dense Dashboard · RTL
   ============================================================ */
:root {
  --font: "IBM Plex Sans Arabic", system-ui, "Segoe UI", Tahoma, sans-serif;
  --font-head: "Cairo", "IBM Plex Sans Arabic", system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;

  --brand: #1d4ed8; --brand-600: #2563eb; --brand-700: #1e40af; --brand-50: #eef4ff;
  --twin: #0d9488; --twin-600: #0f766e; --twin-50: #ecfdf8;
  --accent: #d97706; --accent-50: #fff7ed;

  --ink: #0f172a; --ink-2: #334155; --muted: #64748b; --faint: #94a3b8;
  --bg: #f4f7fc; --surface: #ffffff; --surface-2: #f8fafc; --surface-3: #f1f5f9;
  --border: #e2e8f0; --border-2: #cbd5e1;

  --success: #16a34a; --success-50: #f0fdf4;
  --warning: #d97706; --warning-50: #fffbeb;
  --danger: #dc2626; --danger-50: #fef2f2;
  --info: #2563eb; --info-50: #eff6ff;

  --r-sm: 8px; --r: 12px; --r-lg: 16px; --r-xl: 22px;
  --sh-1: 0 1px 2px rgba(15,23,42,.06), 0 1px 3px rgba(15,23,42,.05);
  --sh-2: 0 4px 12px rgba(15,23,42,.07), 0 2px 4px rgba(15,23,42,.05);
  --sh-3: 0 12px 32px rgba(15,23,42,.12), 0 4px 10px rgba(15,23,42,.06);
  --ring: 0 0 0 3px rgba(37,99,235,.30);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  background-color: #f6f9fd;
  background-image:
    linear-gradient(to right, rgba(37, 99, 235, .06) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(37, 99, 235, .06) 1px, transparent 1px);
  background-size: 24px 24px;
  background-attachment: fixed;
  color: var(--ink);
  font-size: 15px; line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { margin: 0; font-family: var(--font-head); font-weight: 700; color: var(--ink); line-height: 1.4; }
h1 { font-size: 24px; } h2 { font-size: 19px; } h3 { font-size: 16px; }
p { margin: 0; }
a { color: var(--brand); text-decoration: none; cursor: pointer; }
code, .mono { font-family: var(--mono); font-size: .9em; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.center { text-align: center; }
.hidden { display: none !important; }
::selection { background: rgba(37,99,235,.18); }
:focus-visible { outline: none; box-shadow: var(--ring); border-radius: var(--r-sm); }

/* ---------- App shell ---------- */
.shell { min-height: 100dvh; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 40;
  background: rgba(255,255,255,.9); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 22px; gap: 16px;
}
.brand { display: flex; align-items: center; gap: 11px; }
.brand-mark {
  width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--brand), var(--twin)); color: #fff;
  box-shadow: var(--sh-2);
}
.brand-mark svg { width: 23px; height: 23px; }
.brand-txt b { font-size: 15px; font-weight: 600; display: block; line-height: 1.3; }
.brand-txt span { font-size: 11.5px; color: var(--muted); }
.topnav { display: flex; align-items: center; gap: 4px; }
.topnav a {
  display: flex; align-items: center; gap: 7px; padding: 8px 13px; border-radius: 9px;
  color: var(--ink-2); font-size: 14px; font-weight: 500; transition: background .15s;
}
.topnav a svg { width: 17px; height: 17px; opacity: .8; }
.topnav a:hover { background: var(--surface-3); }
.topnav a.active { background: var(--brand-50); color: var(--brand-700); }
.usermenu { display: flex; align-items: center; gap: 10px; }
.avatar {
  width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center;
  font-weight: 600; font-size: 14px; color: #fff; background: var(--brand-600);
}
.avatar.adm { background: var(--ink-2); }
.badge-group {
  font-size: 11px; font-weight: 600; padding: 3px 10px; border-radius: 20px;
  background: var(--twin-50); color: var(--twin-600);
}
.badge-group.ctrl { background: var(--surface-3); color: var(--ink-2); }
.badge-group.adm { background: var(--brand-50); color: var(--brand-700); }

.page { flex: 1; width: 100%; max-width: 1200px; margin: 0 auto; padding: 24px 22px 60px; }
.crumbs { font-size: 13px; color: var(--muted); margin-bottom: 14px; display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.crumbs a:hover { text-decoration: underline; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-family: inherit; font-size: 14px; font-weight: 600; cursor: pointer;
  padding: 10px 18px; border-radius: 10px; border: 1px solid var(--border-2);
  background: var(--surface); color: var(--ink); transition: all .15s; line-height: 1;
}
.btn svg { width: 17px; height: 17px; }
.btn:hover { background: var(--surface-3); border-color: var(--faint); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--brand-600); border-color: var(--brand-600); color: #fff; box-shadow: var(--sh-1); }
.btn-primary:hover { background: var(--brand-700); border-color: var(--brand-700); }
.btn-twin { background: var(--twin); border-color: var(--twin); color: #fff; box-shadow: var(--sh-1); }
.btn-twin:hover { background: var(--twin-600); border-color: var(--twin-600); }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-ghost:hover { background: var(--surface-3); }
.btn-block { width: 100%; }
.btn-sm { padding: 7px 13px; font-size: 13px; }

/* ---------- Cards ---------- */
.card {
  background: #e9f1fc; border: 2px solid #8fb6ea; border-radius: var(--r-lg);
  padding: 20px 22px; box-shadow: inset 0 3px 0 var(--brand), var(--sh-1);
}
.card-pad-0 { padding: 0; overflow: hidden; }
.grid { display: grid; gap: 16px; }
.section-title { display: flex; align-items: center; gap: 9px; font-size: 16px; font-weight: 600; margin: 4px 0 14px; }
.section-title svg { width: 19px; height: 19px; color: var(--muted); }

/* ---------- Hero (dashboard) ---------- */
.hero {
  position: relative; overflow: hidden; border-radius: var(--r-xl); color: #fff;
  background: linear-gradient(120deg, var(--brand-700), var(--brand-600) 45%, var(--twin) 120%);
  padding: 28px 30px; box-shadow: var(--sh-3); margin-bottom: 24px;
}
.hero::after {
  content: ""; position: absolute; inset-inline-start: -60px; top: -60px;
  width: 240px; height: 240px; border-radius: 50%; background: rgba(255,255,255,.08);
}
.hero h1 { color: #fff; font-size: 25px; }
.hero p { color: rgba(255,255,255,.85); font-size: 14px; margin-top: 6px; max-width: 60ch; }
.hero-row { display: flex; align-items: center; justify-content: space-between; gap: 20px; flex-wrap: wrap; position: relative; z-index: 1; }
.hero-stat { text-align: center; background: rgba(255,255,255,.14); border: 1px solid rgba(255,255,255,.2); border-radius: var(--r); padding: 12px 20px; backdrop-filter: blur(4px); }
.hero-stat b { font-size: 26px; font-weight: 700; display: block; }
.hero-stat span { font-size: 12px; color: rgba(255,255,255,.85); }

.statgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px,1fr)); gap: 14px; margin-bottom: 24px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); padding: 15px 17px; box-shadow: var(--sh-1); }
.stat .lbl { font-size: 12.5px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.stat .lbl svg { width: 15px; height: 15px; }
.stat .val { font-size: 23px; font-weight: 700; margin-top: 6px; font-variant-numeric: tabular-nums; }

/* ---------- Module cards ---------- */
.modgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(265px,1fr)); gap: 18px; }
.modcard {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg);
  overflow: hidden; box-shadow: var(--sh-1); transition: transform .15s, box-shadow .15s;
  display: flex; flex-direction: column;
}
.modcard.clickable { cursor: pointer; }
.modcard.clickable:hover { transform: translateY(-3px); box-shadow: var(--sh-3); }
.modcard.locked { opacity: .72; }
.modcover { height: 84px; position: relative; display: flex; align-items: center; padding: 0 18px; gap: 13px; color: #fff; }
.modcover .mnum { position: absolute; inset-inline-end: 14px; top: 10px; font-size: 38px; font-weight: 700; opacity: .25; line-height: 1; }
.modcover .micon { width: 44px; height: 44px; border-radius: 12px; background: rgba(255,255,255,.22); display: grid; place-items: center; }
.modcover .micon svg { width: 25px; height: 25px; }
.modcover h3 { color: #fff; font-size: 16px; }
.modcover .msub { font-size: 12px; color: rgba(255,255,255,.85); }
.modbody { padding: 14px 18px 16px; display: flex; flex-direction: column; gap: 12px; flex: 1; }
.modmeta { display: flex; gap: 14px; font-size: 12px; color: var(--muted); }
.modmeta span { display: flex; align-items: center; gap: 5px; }
.modmeta svg { width: 14px; height: 14px; }
.progress { height: 7px; background: var(--surface-3); border-radius: 20px; overflow: hidden; }
.progress > i { display: block; height: 100%; border-radius: 20px; background: var(--brand-600); transition: width .4s; }
.modfoot { display: flex; align-items: center; justify-content: space-between; margin-top: auto; }
.pill { font-size: 11.5px; font-weight: 600; padding: 4px 11px; border-radius: 20px; display: inline-flex; align-items: center; gap: 5px; }
.pill svg { width: 13px; height: 13px; }
.pill.done { background: var(--success-50); color: var(--success); }
.pill.active { background: var(--info-50); color: var(--info); }
.pill.lock { background: var(--surface-3); color: var(--muted); }

/* ---------- Module page ---------- */
.modhead { border-radius: var(--r-xl); padding: 24px 26px; color: #fff; margin-bottom: 20px; box-shadow: var(--sh-2); position: relative; overflow: hidden; }
.modhead .mnum2 { position: absolute; inset-inline-end: 18px; top: 10px; font-size: 70px; font-weight: 700; opacity: .16; }
.modhead h1 { color: #fff; }
.modhead p { color: rgba(255,255,255,.88); font-size: 14px; margin-top: 4px; }
.modhead .obj { margin-top: 14px; display: flex; flex-wrap: wrap; gap: 8px; }
.modhead .obj span { background: rgba(255,255,255,.16); border: 1px solid rgba(255,255,255,.22); font-size: 12px; padding: 5px 11px; border-radius: 20px; }

.modlayout { display: grid; grid-template-columns: 230px 1fr; gap: 22px; align-items: start; }
.lessonnav { position: sticky; top: 74px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 12px; box-shadow: var(--sh-1); }
.lessonnav .nv-h { font-size: 12px; color: var(--faint); padding: 4px 8px 8px; font-weight: 600; }
.lessonnav a { display: flex; gap: 9px; padding: 8px 10px; border-radius: 9px; color: var(--ink-2); font-size: 13.5px; font-weight: 500; }
.lessonnav a:hover { background: var(--surface-3); }
.lessonnav a .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--border-2); margin-top: 8px; flex: none; }
.lessonnav a.gate { margin-top: 6px; border: 1px dashed var(--border-2); color: var(--brand-700); }

.lesson { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 18px 22px; box-shadow: var(--sh-1); margin-bottom: 16px; }
.lesson h3 { display: flex; align-items: center; gap: 9px; }
.lesson h3 .ln { width: 25px; height: 25px; border-radius: 7px; background: var(--brand-50); color: var(--brand-700); display: grid; place-items: center; font-size: 13px; font-weight: 700; flex: none; }
.lesson p { color: var(--ink-2); margin-top: 8px; }

/* video grid */
.videogrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px,1fr)); gap: 16px; }
.video { border: 1px solid var(--border); border-radius: var(--r); overflow: hidden; background: var(--surface); box-shadow: var(--sh-1); }
.video .frame { position: relative; aspect-ratio: 16/9; background: #000; }
.video .frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.video .vtitle { padding: 10px 13px; font-size: 13.5px; font-weight: 500; display: flex; align-items: center; gap: 8px; }
.video .vtitle svg { width: 16px; height: 16px; color: var(--danger); flex: none; }

/* resources */
.reslist { display: grid; gap: 10px; }
.resitem { display: flex; align-items: center; gap: 13px; padding: 12px 15px; border: 1px solid var(--border); border-radius: var(--r); background: var(--surface); }
.resicon { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; flex: none; }
.resicon svg { width: 21px; height: 21px; }
.ri-pdf { background: var(--danger-50); color: var(--danger); }
.ri-doc { background: var(--info-50); color: var(--info); }
.ri-ppt { background: var(--accent-50); color: var(--accent); }
.ri-zip { background: var(--surface-3); color: var(--ink-2); }
.ri-code { background: #f3e8ff; color: #7c3aed; }
.ri-link { background: var(--twin-50); color: var(--twin-600); }
.resitem .rmeta { flex: 1; min-width: 0; }
.resitem .rmeta b { font-size: 14px; font-weight: 600; display: block; }
.resitem .rmeta span { font-size: 11.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }

.embed-wrap { border: 1px solid var(--border); border-radius: var(--r); overflow: hidden; }
.embed-wrap iframe { width: 100%; height: 460px; border: 0; display: block; background: var(--surface-3); }

/* activity / gate cards */
.callout { border: 1px solid var(--border); border-radius: var(--r-lg); padding: 18px 20px; display: flex; gap: 15px; align-items: flex-start; }
.callout .cicon { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; flex: none; }
.callout .cicon svg { width: 24px; height: 24px; }
.callout.activity { background: var(--twin-50); border-color: #99f6e4; }
.callout.activity .cicon { background: var(--twin); color: #fff; }
.callout.gate { background: var(--info-50); border-color: #bfdbfe; }
.callout.gate .cicon { background: var(--brand-600); color: #fff; }
.callout h3 { margin-bottom: 4px; }
.callout p { color: var(--ink-2); font-size: 13.5px; }
.callout .c-actions { margin-top: 12px; display: flex; gap: 10px; flex-wrap: wrap; }

/* ---------- Sim launcher (floating) ---------- */
.launcher { position: fixed; inset-inline-start: 22px; bottom: 22px; z-index: 50; display: flex; flex-direction: column; align-items: flex-start; gap: 10px; }
.launcher .tools { display: flex; flex-direction: column; gap: 8px; transition: opacity .2s, transform .2s; }
.launcher.closed .tools { opacity: 0; transform: translateY(8px); pointer-events: none; }
.launch-btn {
  display: inline-flex; align-items: center; gap: 9px; padding: 11px 16px; border-radius: 30px;
  border: none; cursor: pointer; font-family: inherit; font-size: 13.5px; font-weight: 600; color: #fff;
  box-shadow: var(--sh-3);
}
.launch-btn svg { width: 18px; height: 18px; }
.launch-btn.tk { background: linear-gradient(135deg, #06b6d4, #0e7490); box-shadow: 0 4px 14px rgba(8,145,178,.4); }
.launch-btn.cn { background: linear-gradient(135deg, #8b5cf6, #6d28d9); box-shadow: 0 4px 14px rgba(109,40,217,.4); }
.launch-fab { background: linear-gradient(135deg, #2563eb, #0d9488); box-shadow: 0 6px 18px rgba(37,99,235,.38); }
.launch-fab .lbl { font-size: 13.5px; }
/* زر واتساب الطائر (يسار-أسفل) */
.wa-fab { position: fixed; left: 20px; bottom: 20px; z-index: 50; width: 56px; height: 56px; border-radius: 50%;
  background: linear-gradient(135deg, #25d366, #128c4a); color: #fff; border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center; box-shadow: 0 6px 20px rgba(18,140,74,.42); transition: transform .15s; }
.wa-fab:hover { transform: scale(1.07); }
.wa-fab svg { width: 30px; height: 30px; }

/* ---------- Modal ---------- */
.modal-scrim { position: fixed; inset: 0; z-index: 60; background: rgba(15,23,42,.55); display: flex; align-items: center; justify-content: center; padding: 20px; }
.modal { background: var(--surface); border-radius: var(--r-lg); width: 100%; max-width: 1080px; max-height: 92dvh; display: flex; flex-direction: column; overflow: hidden; box-shadow: var(--sh-3); }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.modal-head b { font-size: 15px; display: flex; align-items: center; gap: 8px; }
.modal-body { flex: 1; min-height: 0; }
.modal-body iframe { width: 100%; height: 72dvh; border: 0; display: block; background: var(--surface-3); }
.modal-note { padding: 10px 16px; font-size: 12.5px; color: var(--muted); border-top: 1px solid var(--border); background: var(--surface-2); }

/* ---------- Auth ---------- */
.auth-wrap { min-height: 100dvh; display: grid; place-items: center; padding: 24px;
  background: radial-gradient(900px 500px at 80% -10%, rgba(13,148,136,.10), transparent), radial-gradient(800px 500px at 10% 110%, rgba(37,99,235,.10), transparent), var(--bg); }
.auth-card { width: 100%; max-width: 410px; box-shadow: var(--sh-3); border-radius: var(--r-xl); padding: 30px 28px; }
.seg { display: flex; background: var(--surface-3); border-radius: 11px; padding: 4px; gap: 4px; }
.seg .btn { flex: 1; border: none; background: transparent; box-shadow: none; }
.seg .btn.btn-primary { background: var(--surface); color: var(--brand-700); box-shadow: var(--sh-1); }
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; color: var(--ink-2); }
.input, select, textarea {
  width: 100%; font-family: inherit; font-size: 14px; color: var(--ink);
  padding: 11px 13px; border: 1px solid var(--border-2); border-radius: 10px; background: var(--surface);
  transition: border-color .15s, box-shadow .15s;
}
.input:focus, select:focus, textarea:focus { border-color: var(--brand-600); box-shadow: var(--ring); outline: none; }
.hint { font-size: 12px; color: var(--muted); margin-top: 5px; }
.hint b { color: var(--ink-2); font-family: var(--mono); }

/* ---------- Quiz ---------- */
.quizwrap { max-width: 760px; margin: 0 auto; }
.qprogress { position: sticky; top: 62px; z-index: 5; background: var(--bg); padding: 12px 0; }
.qprogress .bar { height: 8px; background: var(--surface-3); border-radius: 20px; overflow: hidden; }
.qprogress .bar > i { display: block; height: 100%; background: var(--brand-600); transition: width .3s; }
.qcard { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 22px 24px; box-shadow: var(--sh-1); margin-bottom: 14px; }
.qcard .qn { font-size: 12px; color: var(--brand-700); font-weight: 600; }
.qcard .qt { font-size: 16px; font-weight: 600; margin: 6px 0 16px; line-height: 1.7; }
.opt { display: flex; align-items: center; gap: 12px; padding: 13px 15px; border: 1px solid var(--border-2); border-radius: 11px; cursor: pointer; margin-bottom: 9px; transition: all .12s; font-size: 14.5px; }
.opt:hover { border-color: var(--brand-600); background: var(--brand-50); }
.opt.sel { border-color: var(--brand-600); background: var(--brand-50); box-shadow: var(--ring); }
.opt .mk { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--border-2); flex: none; display: grid; place-items: center; }
.opt.sel .mk { border-color: var(--brand-600); background: var(--brand-600); }
.opt.sel .mk::after { content: ""; width: 8px; height: 8px; border-radius: 50%; background: #fff; }
.result-ring { width: 130px; height: 130px; border-radius: 50%; display: grid; place-items: center; margin: 0 auto 14px; font-size: 30px; font-weight: 700; color: #fff; font-variant-numeric: tabular-nums; }

/* ---------- Admin ---------- */
.layout { display: grid; grid-template-columns: 210px 1fr; gap: 22px; align-items: start; }
.sidenav { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 10px; box-shadow: var(--sh-1); position: sticky; top: 74px; }
.sidenav a { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 9px; color: var(--ink-2); font-size: 14px; font-weight: 500; cursor: pointer; }
.sidenav a svg { width: 18px; height: 18px; opacity: .8; }
.sidenav a:hover { background: var(--surface-3); }
.sidenav a.active { background: var(--brand-50); color: var(--brand-700); }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.tbl th, table.tbl td { text-align: start; padding: 11px 12px; border-bottom: 1px solid #cdd9ef; }
table.tbl th { font-size: 12px; color: #334155; font-weight: 700; background: #dde8f8; font-family: var(--font-head); }
table.tbl tr:hover td { background: #ffffff; }
.tag { font-size: 11px; font-weight: 600; padding: 3px 9px; border-radius: 6px; }
.tag.exp { background: var(--twin-50); color: var(--twin-600); }
.tag.ctrl { background: var(--surface-3); color: var(--ink-2); }
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.switch { display: inline-flex; align-items: center; gap: 9px; font-size: 13.5px; cursor: pointer; }
.switch input { width: 40px; height: 22px; appearance: none; background: var(--border-2); border-radius: 20px; position: relative; cursor: pointer; transition: background .2s; }
.switch input:checked { background: var(--success); }
.switch input::after { content: ""; position: absolute; width: 18px; height: 18px; border-radius: 50%; background: #fff; top: 2px; inset-inline-start: 2px; transition: inset-inline-start .2s; box-shadow: var(--sh-1); }
.switch input:checked::after { inset-inline-start: 20px; }
.qrow { border: 1px solid var(--border); border-radius: var(--r); padding: 12px 15px; margin-bottom: 9px; background: var(--surface); }
.qrow .qhead { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.qbadge { font-size: 10.5px; font-weight: 600; padding: 2px 8px; border-radius: 5px; background: var(--surface-3); color: var(--ink-2); }

/* ---------- Toast ---------- */
.toast { position: fixed; inset-block-end: 22px; inset-inline-end: 22px; z-index: 80; display: flex; flex-direction: column; gap: 8px; }
.toast .t { background: var(--ink); color: #fff; padding: 12px 18px; border-radius: 11px; font-size: 14px; font-weight: 500; box-shadow: var(--sh-3); display: flex; align-items: center; gap: 9px; animation: tin .25s ease; max-width: 340px; }
.toast .t svg { width: 18px; height: 18px; flex: none; }
.toast .t.success { background: #14532d; } .toast .t.error { background: #7f1d1d; }
@keyframes tin { from { opacity: 0; transform: translateY(10px); } }

/* ---------- Responsive ---------- */
@media (max-width: 920px) {
  .modlayout, .layout { grid-template-columns: 1fr; }
  .lessonnav, .sidenav { position: static; }
  .topnav { display: none; }
}
@media (max-width: 560px) {
  .page { padding: 16px 14px 80px; }
  .hero { padding: 22px; } .hero h1 { font-size: 21px; }
  .topbar { padding: 9px 14px; } .brand-txt span { display: none; }
}
/* ============================================================
   الصفحة الرئيسية (Landing Page)
   ============================================================ */
.lp-header { position: sticky; top: 0; z-index: 50; display: flex; align-items: center; justify-content: space-between; gap: 18px;
  padding: 12px 30px; background: rgba(255,255,255,.92); backdrop-filter: blur(12px); border-bottom: 1px solid var(--border); }
.lp-logo { display: flex; align-items: center; gap: 11px; cursor: pointer; }
.lp-nav { display: flex; gap: 24px; }
.lp-nav a { color: var(--ink-2); font-size: 14px; font-weight: 500; }
.lp-nav a:hover { color: var(--brand); }
.lp-head-cta { display: flex; gap: 10px; }

.lp-hero { position: relative; overflow: hidden; color: #fff;
  background: linear-gradient(135deg, #1e3a8a 0%, #1e40af 38%, #5b21b6 100%); }
.lp-hero::after { content: ""; position: absolute; inset: 0; pointer-events: none; background:
  radial-gradient(720px 320px at 88% 8%, rgba(6,182,212,.30), transparent 60%),
  radial-gradient(620px 340px at 8% 95%, rgba(124,58,237,.32), transparent 60%); }
.lp-hero-inner { position: relative; z-index: 1; max-width: 1080px; margin: 0 auto; padding: 70px 30px 80px;
  display: grid; grid-template-columns: 1.1fr .9fr; gap: 42px; align-items: center; }
.lp-eyebrow { display: inline-flex; align-items: center; gap: 8px; font-size: 12.5px; font-weight: 500;
  background: rgba(255,255,255,.14); border: 1px solid rgba(255,255,255,.24); color: #e0e7ff; padding: 6px 14px; border-radius: 30px; margin-bottom: 18px; }
.lp-eyebrow svg { width: 16px; height: 16px; }
.lp-hero h1 { color: #fff; font-size: 35px; line-height: 1.3; letter-spacing: -.3px; }
.lp-hero p.sub { color: #dbe4ff; font-size: 16px; line-height: 1.85; margin-top: 16px; max-width: 48ch; }
.lp-cta { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 28px; }
.lp-cta .btn { height: 46px; padding: 0 22px; font-size: 14.5px; }
.btn-white { background: #fff; color: var(--brand-700); border: none; }
.btn-white:hover { background: #eef2ff; }
.btn-glass { background: rgba(255,255,255,.12); color: #fff; border: 1px solid rgba(255,255,255,.34); }
.btn-glass:hover { background: rgba(255,255,255,.22); }

.lp-visual { display: flex; flex-direction: column; gap: 14px; }
.lp-layer { display: flex; align-items: center; gap: 14px; padding: 16px 18px; border-radius: var(--r-lg);
  background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.2); }
.lp-layer span { width: 46px; height: 46px; border-radius: 13px; display: grid; place-items: center; color: #fff; flex: none; }
.lp-layer span svg { width: 24px; height: 24px; }
.lp-layer.phys span { background: rgba(6,182,212,.55); } .lp-layer.dig span { background: rgba(124,58,237,.6); }
.lp-layer b { display: block; font-size: 15px; color: #fff; } .lp-layer small { color: #c7d2fe; font-family: var(--mono); font-size: 11px; }
.lp-sync { display: flex; align-items: center; justify-content: center; gap: 8px; color: #a5b4fc; font-size: 12.5px; }
.lp-sync .dot { width: 7px; height: 7px; border-radius: 50%; background: #22d3ee; animation: lpflow 1.4s infinite; }
.lp-sync .dot:nth-child(2) { animation-delay: .2s; } .lp-sync .dot:nth-child(3) { animation-delay: .4s; }
@keyframes lpflow { 0%,100% { opacity: .3; transform: scale(.8); } 50% { opacity: 1; transform: scale(1.3); } }

.lp-stats { max-width: 1000px; margin: -40px auto 0; position: relative; z-index: 2; padding: 0 30px;
  display: grid; grid-template-columns: repeat(4,1fr); gap: 16px; }
.lp-stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 20px; text-align: center; box-shadow: var(--sh-2); }
.lp-num { font-size: 32px; font-weight: 600; color: var(--brand-700); font-family: var(--mono); }
.lp-stat-l { color: var(--muted); font-size: 13px; margin-top: 4px; }

.lp-section { max-width: 1080px; margin: 0 auto; padding: 64px 30px; }
.lp-alt { background: var(--surface-2); border-block: 1px solid var(--border); }
.lp-sec-head { text-align: center; margin-bottom: 38px; }
.lp-sec-head h2 { font-size: 26px; } .lp-sec-head p { color: var(--muted); margin-top: 8px; }
.lp-kicker { color: var(--twin-600); font-weight: 500; font-size: 13px; letter-spacing: .4px; }

.lp-about { display: grid; grid-template-columns: 1fr 1fr; gap: 36px; align-items: start; }
.lp-obj { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 12px; }
.lp-obj li { display: flex; gap: 11px; align-items: flex-start; font-size: 14.5px; color: var(--ink-2); }
.lp-obj .tick { color: var(--twin); flex: none; margin-top: 2px; } .lp-obj .tick svg { width: 16px; height: 16px; }
.lp-note { background: var(--brand-50); border: 1px solid #dbeafe; border-radius: var(--r); padding: 16px 18px; margin-top: 16px; font-size: 14px; color: var(--ink-2); }

.lp-features { display: grid; grid-template-columns: repeat(4,1fr); gap: 16px; }
.lp-feat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 20px; transition: .18s; }
.lp-feat:hover { box-shadow: var(--sh-2); transform: translateY(-2px); border-color: var(--border-2); }
.lp-feat .fi { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; background: var(--brand-50); color: var(--brand); margin-bottom: 13px; }
.lp-feat .fi svg { width: 21px; height: 21px; }
.lp-feat h3 { font-size: 15px; } .lp-feat p { color: var(--muted); font-size: 13px; margin-top: 5px; }

.lp-roadmap { display: grid; grid-template-columns: repeat(3,1fr); gap: 18px; }
.lp-mod { position: relative; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 22px; overflow: hidden; transition: .18s; }
.lp-mod::before { content: ""; position: absolute; inset-block: 0; inset-inline-start: 0; width: 4px; background: var(--ac); }
.lp-mod:hover { box-shadow: var(--sh-3); transform: translateY(-3px); }
.lp-mod-num { position: absolute; top: 14px; inset-inline-end: 18px; font-family: var(--mono); font-size: 30px; font-weight: 600; color: var(--surface-3); }
.lp-mod-ic { width: 46px; height: 46px; border-radius: 13px; display: grid; place-items: center; color: #fff; background: var(--ac); margin-bottom: 14px; }
.lp-mod-ic svg { width: 23px; height: 23px; }
.lp-mod h3 { font-size: 16.5px; } .lp-mod p { color: var(--muted); font-size: 13px; margin-top: 4px; }
.lp-mod-meta { margin-top: 14px; padding-top: 13px; border-top: 1px solid var(--border); color: var(--ink-2); font-size: 12.5px; display: flex; align-items: center; gap: 7px; }
.lp-mod-meta svg { width: 16px; height: 16px; color: var(--muted); }

.lp-tools { display: grid; grid-template-columns: repeat(3,1fr); gap: 18px; }
.lp-tool { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 26px; text-align: center; }
.lp-tool .ti { width: 56px; height: 56px; border-radius: 16px; display: grid; place-items: center; color: #fff; margin: 0 auto 15px; }
.lp-tool .ti svg { width: 28px; height: 28px; }
.lp-tool h3 { font-size: 17px; } .lp-tool .ts { color: var(--twin-600); font-size: 12.5px; font-weight: 500; margin-top: 3px; }
.lp-tool p { color: var(--muted); font-size: 13.5px; margin-top: 10px; line-height: 1.75; }

.lp-team { display: grid; grid-template-columns: repeat(3,1fr); gap: 18px; }
.lp-person { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 26px; text-align: center; }
.lp-ava { width: 74px; height: 74px; border-radius: 50%; margin: 0 auto 14px; display: grid; place-items: center; font-size: 27px; font-weight: 600; color: #fff; }
.lp-ava.res { background: linear-gradient(135deg, #2563eb, #7c3aed); } .lp-ava.sup { background: linear-gradient(135deg, #0d9488, #1d4ed8); }
.lp-person .role { color: var(--twin-600); font-size: 12px; font-weight: 500; }
.lp-person h3 { font-size: 16px; margin-top: 6px; } .lp-person p { color: var(--muted); font-size: 12.5px; margin-top: 6px; line-height: 1.65; }

.lp-footer { background: #0f172a; color: #cbd5e1; padding: 50px 30px; text-align: center; }
.lp-footer h3 { color: #fff; font-size: 21px; }
.lp-footer .fmeta { font-size: 13px; line-height: 1.9; } .lp-footer .fmeta b { color: #e2e8f0; }

@media (max-width: 860px) {
  .lp-hero-inner { grid-template-columns: 1fr; gap: 28px; padding: 48px 22px 58px; }
  .lp-hero h1 { font-size: 27px; } .lp-nav { display: none; }
  .lp-stats { grid-template-columns: repeat(2,1fr); margin-top: -30px; }
  .lp-features { grid-template-columns: repeat(2,1fr); }
  .lp-roadmap, .lp-tools, .lp-team, .lp-about { grid-template-columns: 1fr; }
  .lp-section { padding: 48px 22px; }
}
@media (max-width: 480px) { .lp-stats { grid-template-columns: 1fr; } .lp-features { grid-template-columns: 1fr; } .lp-head-cta .btn { padding: 0 12px; } }

/* ---------- قائمة المستخدم المنسدلة ---------- */
.usermenu-wrap { position: relative; }
.avatar-btn { background: none; border: none; padding: 0; cursor: pointer; border-radius: 50%; line-height: 0; }
.avatar-btn:focus-visible { box-shadow: var(--ring); }
.usermenu-pop { position: absolute; top: calc(100% + 8px); inset-inline-end: 0; width: 250px; max-width: calc(100vw - 16px); background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--r); box-shadow: var(--sh-3); padding: 6px; z-index: 60; }
.usermenu-pop.closed { display: none; }
.ump-head { display: flex; align-items: center; gap: 10px; padding: 10px 10px 12px; border-bottom: 1px solid var(--border); margin-bottom: 6px; }
.ump-head b { display: block; font-size: 14px; }
.ump-head span { display: block; font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 175px; }
.ump-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 11px; border: none; background: none; cursor: pointer;
  font: inherit; font-size: 14px; color: var(--ink-2); border-radius: var(--r-sm); text-align: start; }
.ump-item svg { width: 18px; height: 18px; color: var(--muted); flex: none; }
.ump-item:hover { background: var(--surface-3); }
.ump-item.danger { color: var(--danger); } .ump-item.danger svg { color: var(--danger); }
.ump-div { height: 1px; background: var(--border); margin: 6px 4px; }

/* ---------- نافذة نموذج صغيرة ---------- */
.modal.modal-sm { max-width: 460px; width: 92%; display: flex; flex-direction: column; max-height: 90vh; }
.modal-pad { padding: 18px; overflow-y: auto; }
.tbl tr.clickable-row { cursor: pointer; }
.tbl tr.clickable-row:hover td { background: var(--surface-3); }
.st-info { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 8px; }
.st-stat { background: var(--surface-3); border-radius: var(--r-sm); padding: 9px 11px; display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 13px; }
.st-stat span { color: var(--muted); }
.st-stat b { color: var(--ink); }

/* ---------- داش بورد الأدمن (بطاقات ملوّنة + رسوم) ---------- */
.dash-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(148px, 1fr)); gap: 13px; margin-bottom: 18px; }
.dstat { border-radius: var(--r-lg); padding: 15px 16px; color: #fff; position: relative; overflow: hidden; box-shadow: var(--sh-2); }
.dstat .ic { position: absolute; inset-inline-end: -8px; bottom: -12px; opacity: .2; }
.dstat .ic svg { width: 62px; height: 62px; }
.dstat .v { font-size: 26px; font-weight: 600; line-height: 1.1; position: relative; }
.dstat .l { font-size: 12.5px; opacity: .95; margin-top: 3px; position: relative; }
.dash-charts { display: grid; grid-template-columns: repeat(auto-fit, minmax(290px, 1fr)); gap: 14px; margin-bottom: 18px; }
.chart-card { background: #e9f1fc; border: 2px solid #8fb6ea; border-radius: var(--r-lg); padding: 14px 16px 12px; box-shadow: inset 0 3px 0 var(--twin), var(--sh-1); }
.chart-card .chart-wrap { background: #fff; border-radius: var(--r); padding: 6px; }
.chart-card.wide { grid-column: 1 / -1; }
.chart-card h4 { font-size: 13.5px; font-weight: 600; margin-bottom: 12px; display: flex; align-items: center; gap: 7px; }
.chart-card h4 svg { width: 17px; height: 17px; color: var(--muted); }
.chart-wrap { position: relative; height: 232px; }

/* ---------- نافذة التأكيد المصمّمة ---------- */
.modal.modal-confirm { max-width: 384px; }
.modal-confirm .cf-icon { width: 56px; height: 56px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; }
.modal-confirm .cf-icon svg { width: 26px; height: 26px; }
.modal-confirm .cf-icon.danger { background: var(--danger-50); color: var(--danger); }
.modal-confirm .cf-icon.info { background: var(--brand-50); color: var(--brand); }
.btn-danger { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-danger:hover { background: #b91c1c; border-color: #b91c1c; }

/* ---------- صفوف محرّر الموديول ---------- */
.ed-list { display: flex; flex-direction: column; gap: 10px; margin-top: 10px; }
.ed-row { display: flex; gap: 8px; align-items: flex-start; flex-wrap: wrap; }
.ed-row.col { flex-direction: column; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r); padding: 10px; }
.ed-row.col .ed-del { align-self: flex-start; }

/* ---------- بطاقة فريق العمل (إعداد / إشراف) ---------- */
.lp-team-card { max-width: 940px; margin: 0 auto; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-lg); box-shadow: var(--sh-2); display: flex; flex-wrap: wrap; justify-content: center;
  align-items: stretch; gap: 6px; padding: 26px 18px; }
.tm-group { padding: 6px 24px; }
.tm-label { text-align: center; font-size: 15px; font-weight: 600; color: var(--brand-700); margin-bottom: 18px; }
.tm-label::after { content: ""; display: block; width: 46px; height: 3px; border-radius: 2px; background: var(--twin); margin: 8px auto 0; }
.tm-people { display: flex; gap: 22px; flex-wrap: wrap; justify-content: center; }
.tm-divider { width: 1px; background: var(--border); align-self: stretch; margin: 4px 6px; }
.tm-person { width: 240px; margin: 0; text-align: center; }
.tm-photo { width: 148px; height: 148px; border-radius: 50%; object-fit: cover; object-position: top center;
  border: 6px solid #d4af37; box-shadow: 0 0 0 2px #a87f0a, 0 8px 22px rgba(168,127,10,.32); margin: 0 auto 18px; display: block; }
.tm-person figcaption b { display: block; font-family: var(--font-head); font-size: 19px; font-weight: 700; color: var(--ink); }
.tm-person figcaption span { display: block; font-size: 13.5px; color: var(--muted); line-height: 1.75; margin-top: 7px; }
@media (max-width: 640px) { .tm-divider { width: 100%; height: 1px; margin: 4px 0; } .tm-group { padding: 8px; } }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
