/* منصة أ. محمود البحيري — التصميم العام */
:root {
  --navy: #0B2350; --navy2: #13347A; --gold: #F6B31B; --gold-ink: #0B2350;
  --ink: #0B2350; --ink2: #33415E; --muted: #4A5A78; --card: #FFFFFF; --soft: #F4F7FC;
  --sel: #EEF3FE; --track: #E3E8F2; --line: #E3E8F2; --line2: #C9D3E6; --link: #1D4ED8;
  --note: #FFF7DB; --noteLine: #F6D66B; --ok-bg: #DDF4EA; --ok: #0E5A40; --err-bg: #FDE4E1; --err: #8A1C12;
  --warn-bg: #FEF1D2; --warn: #6B4100; --info-bg: #E1ECFD; --info: #1E3A8A; --green: #0E7A55; --red: #B42318;
  --shadow: 0 14px 40px rgba(11, 35, 80, .08);
  color-scheme: light;
}
html.dark {
  --ink: #E6ECF7; --ink2: #C3CDE0; --muted: #9AA8C3; --card: #131C2E; --soft: #0B1220;
  --sel: #1B2A4A; --track: #2A3754; --line: #24314A; --line2: #33425F; --link: #8EB1FF;
  --note: #2E2611; --noteLine: #6B5414; --ok-bg: #12382B; --ok: #8BE0B9; --err-bg: #3E1A17; --err: #F7A59B;
  --warn-bg: #3A2C0D; --warn: #F6CD72; --info-bg: #182A4D; --info: #A9C3FF; --green: #2FBF86; --red: #F4796B;
  --shadow: 0 14px 40px rgba(0, 0, 0, .35);
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: 'Cairo', system-ui, -apple-system, 'Segoe UI', Tahoma, sans-serif; background: var(--soft); color: var(--ink); line-height: 1.6; font-size: 15px; }
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }
h1, h2, h3 { line-height: 1.3; margin: 0; }
.ic { flex-shrink: 0; vertical-align: middle; }
.wrap { max-width: 1280px; margin: 0 auto; padding: 0 24px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.ltr { direction: ltr; unicode-bidi: plaintext; }
.mono { font-family: ui-monospace, Menlo, Consolas, monospace; }
.hidden { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.row { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.between { justify-content: space-between; }
.grow { flex: 1 1 auto; min-width: 0; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }

/* أزرار */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 18px; border-radius: 12px; border: 1px solid transparent; font: inherit; font-size: 14px; font-weight: 800; cursor: pointer; text-decoration: none !important; white-space: nowrap; }
.btn-primary { background: var(--navy); color: #fff; }
html.dark .btn-primary { background: #2A4A8A; }
.btn-gold { background: var(--gold); color: var(--gold-ink); }
.btn-ghost { background: var(--card); color: var(--ink); border-color: var(--line2); font-weight: 700; }
.btn-danger { background: var(--card); color: var(--red); border-color: var(--err-bg); font-weight: 700; }
.btn-ok { background: #16A34A; color: #fff; }
.btn-sm { min-height: 36px; padding: 0 12px; font-size: 13px; border-radius: 10px; }
.btn-icon { width: 38px; min-height: 38px; padding: 0; border-radius: 10px; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.pill { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 800; padding: 3px 10px; border-radius: 999px; background: var(--track); color: var(--ink2); white-space: nowrap; }
.pill-ok { background: var(--ok-bg); color: var(--ok); }
.pill-err { background: var(--err-bg); color: var(--err); }
.pill[hidden], .btn[hidden] { display: none; }
.pill-warn { background: var(--warn-bg); color: var(--warn); }
.pill-info { background: var(--info-bg); color: var(--info); }
.code-chip { font-family: ui-monospace, Menlo, monospace; font-size: 12px; font-weight: 800; padding: 3px 9px; border-radius: 8px; border: 1px solid var(--line2); background: var(--card); direction: ltr; }

/* كروت */
.card { background: var(--card); border: 1px solid var(--line); border-radius: 20px; padding: 20px; }
.card-tight { padding: 14px; }
.card h2 { font-size: 19px; font-weight: 900; }
.card h3 { font-size: 16px; font-weight: 900; }
.section-title { font-size: 28px; font-weight: 900; }
.stat { display: flex; flex-direction: column; gap: 2px; background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 14px 18px; }
.stat b { font-size: 26px; font-weight: 900; }

/* تنبيهات */
.alert { border-radius: 12px; padding: 12px 16px; font-weight: 700; margin-bottom: 12px; }
.alert-ok { background: var(--ok-bg); color: var(--ok); }
.alert-err { background: var(--err-bg); color: var(--err); }
.alert-warn { background: var(--warn-bg); color: var(--warn); }
.alert-info { background: var(--info-bg); color: var(--info); }

/* نماذج */
label.f, div.f { display: flex; flex-direction: column; gap: 4px; font-size: 13px; font-weight: 700; }
input[type=text], input[type=password], input[type=email], input[type=tel], input[type=number], input[type=url], input[type=search], input[type=date], input[type=datetime-local], select, textarea {
  font: inherit; font-size: 14px; min-height: 44px; padding: 0 14px; border: 1px solid var(--line2); border-radius: 12px; background: var(--card); color: var(--ink); width: 100%;
}
textarea { padding: 10px 14px; min-height: 90px; resize: vertical; }
input:focus, select:focus, textarea:focus, .btn:focus-visible, a:focus-visible, button:focus-visible { outline: 3px solid rgba(29, 78, 216, .35); outline-offset: 1px; }
input[type=checkbox], input[type=radio] { width: 18px; height: 18px; accent-color: var(--navy); }
html.dark input[type=checkbox], html.dark input[type=radio] { accent-color: var(--gold); }
.check { display: inline-flex; align-items: center; gap: 10px; min-height: 40px; font-weight: 700; cursor: pointer; }
.form-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.form-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: flex-end; }
fieldset { border: 1px solid var(--line); border-radius: 16px; padding: 12px 16px; margin: 0; }
legend { padding: 0 6px; font-weight: 900; }

/* جداول */
.table-wrap { overflow-x: auto; }
table.t { width: 100%; border-collapse: collapse; font-size: 14px; }
table.t th { background: var(--soft); text-align: right; padding: 11px 12px; font-weight: 800; white-space: nowrap; }
table.t td { padding: 11px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.t tr:hover td { background: var(--sel); }
.bar { flex: 1; height: 8px; border-radius: 999px; background: var(--track); overflow: hidden; display: flex; min-width: 60px; }
.bar > span { display: block; height: 100%; border-radius: 999px; background: var(--green); }
.bar.thin { height: 5px; }

/* شريط الإعلان وشريط الأدمن */
.announce { color: #0B2350; }
.announce .wrap { display: flex; align-items: center; gap: 12px; padding-top: 8px; padding-bottom: 8px; font-weight: 700; }
.announce.t-warn { background: #F6B31B; }
.announce.t-info { background: #BFD5FF; }
.announce.t-danger { background: #F8B4AB; color: #5A0F08; }
.announce button { width: 40px; height: 40px; border: 0; background: transparent; color: inherit; cursor: pointer; }
.adminbar { background: #111827; color: #E5E7EB; font-size: 13px; }
.adminbar .wrap { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; padding-top: 7px; padding-bottom: 7px; font-weight: 700; }
.adminbar a { color: #E5E7EB; }

/* الهيدر العام */
.site-header { background: var(--card); border-bottom: 1px solid var(--line); }
.site-header .wrap { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px; padding-top: 14px; padding-bottom: 14px; }
.brand { display: flex; align-items: center; gap: 12px; color: var(--ink); text-decoration: none !important; }
.brand-mark { width: 48px; height: 48px; border-radius: 14px; background: var(--navy); color: var(--gold); display: flex; align-items: center; justify-content: center; }
.brand b { display: block; font-size: 19px; font-weight: 800; }
.brand small { display: block; font-size: 14px; font-weight: 600; color: var(--muted); }
.nav { display: flex; flex-wrap: wrap; gap: 2px; }
.nav a { padding: 10px 14px; font-size: 15px; font-weight: 700; color: var(--ink); text-decoration: none; border-bottom: 3px solid transparent; }
.nav a.on { color: var(--link); border-bottom-color: var(--link); }
.round-btn { width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--line2); background: var(--soft); color: var(--ink); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; position: relative; }
.round-btn .badge { position: absolute; top: 2px; left: 2px; min-width: 18px; height: 18px; border-radius: 999px; background: var(--gold); color: #0B2350; font-size: 11px; font-weight: 900; display: flex; align-items: center; justify-content: center; padding: 0 4px; }

/* الهيرو */
.hero { background: var(--navy); position: relative; overflow: hidden; }
.hero .wrap { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 40px; align-items: end; padding-top: 56px; }
.hero-text { display: flex; flex-direction: column; gap: 22px; padding-bottom: 64px; color: #fff; }
.hero-tag { align-self: flex-start; background: rgba(246, 179, 27, .14); color: var(--gold); font-size: 14px; font-weight: 700; padding: 8px 16px; border-radius: 999px; }
.hero h1 { display: flex; flex-direction: column; gap: 4px; }
.hero h1 .l1 { font-size: 40px; font-weight: 800; }
.hero h1 .l2 { font-size: 68px; font-weight: 900; color: var(--gold); }
.hero p.tagline { font-size: 21px; font-weight: 600; color: #D6DEEE; margin: 0; }
.hero .btn-outline { border: 1.5px solid rgba(255, 255, 255, .6); color: #fff; background: transparent; border-radius: 999px; min-height: 52px; padding: 0 28px; font-size: 17px; }
.hero .btn-gold { border-radius: 999px; min-height: 52px; padding: 0 30px; font-size: 17px; }
.hero-stats { display: flex; flex-wrap: wrap; gap: 28px; }
.hero-stats b { display: block; font-size: 28px; font-weight: 900; }
.hero-stats span { font-size: 14px; color: #A9B7D3; }
.hero-photo { position: relative; display: flex; justify-content: center; align-items: flex-end; min-height: 460px; }
.hero-photo .arc1 { position: absolute; bottom: 0; width: 420px; max-width: 92%; height: 420px; border-radius: 210px 210px 0 0; background: var(--gold); }
.hero-photo .arc2 { position: absolute; bottom: 0; width: 380px; max-width: 84%; height: 400px; border-radius: 190px 190px 0 0; background: var(--navy2); }
.hero-photo img { position: relative; width: 380px; max-width: 84%; height: 440px; object-fit: cover; object-position: center top; border-radius: 190px 190px 0 0; }
@media (max-width: 640px) {
  .hero h1 .l1 { font-size: 28px; } .hero h1 .l2 { font-size: 44px; }
  .hero-photo { min-height: 340px; } .hero-photo img { height: 330px; } .hero-photo .arc1 { height: 320px; } .hero-photo .arc2 { height: 300px; }
}
.features { background: var(--card); border-radius: 0 0 24px 24px; box-shadow: var(--shadow); display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
.feature { padding: 30px 22px; display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; }
.feature .ico { width: 64px; height: 64px; border-radius: 50%; display: flex; align-items: center; justify-content: center; }
.feature h3 { font-size: 18px; font-weight: 800; }
.feature p { margin: 0; font-size: 14px; color: var(--muted); }
.home-sec { padding-top: 64px; }
.kicker { font-size: 14px; font-weight: 700; color: #B7791F; }
html.dark .kicker { color: var(--gold); }
.grade-card { background: var(--card); border: 1px solid var(--line); border-radius: 22px; padding: 24px; display: flex; flex-direction: column; gap: 14px; color: var(--ink); text-decoration: none !important; }
.grade-card:hover { border-color: var(--link); }
.num-badge { width: 56px; height: 56px; border-radius: 16px; background: var(--navy); color: var(--gold); font-size: 24px; font-weight: 900; display: flex; align-items: center; justify-content: center; }
.step-num { flex-shrink: 0; width: 40px; height: 40px; border-radius: 50%; background: var(--gold); color: #0B2350; font-weight: 900; font-size: 18px; display: flex; align-items: center; justify-content: center; }
.site-footer { background: var(--navy); color: #D6DEEE; margin-top: 64px; }
.site-footer .wrap { padding-top: 36px; padding-bottom: 36px; display: flex; flex-wrap: wrap; justify-content: space-between; gap: 20px; align-items: center; }
.site-footer a { color: #fff; }

/* البلوكات (ملصق/صورة/زر) */
.blk { display: flex; flex-direction: column; gap: 8px; }
.blk-text { background: var(--note); border: 1px solid var(--noteLine); border-radius: 18px; padding: 18px 20px; display: flex; gap: 14px; align-items: flex-start; }
.blk-text .ic { color: #A16207; margin-top: 4px; }
.blk-text h3 { font-size: 18px; font-weight: 900; }
.blk-text .body { color: var(--ink2); line-height: 1.9; white-space: pre-line; }
.blk-image img { width: 100%; max-height: 520px; object-fit: cover; border-radius: 18px; display: block; }
.blk-empty { height: 200px; border-radius: 18px; background: var(--track); border: 2px dashed var(--line2); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; color: var(--muted); font-weight: 700; }
.blk-tools { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
.blk-form { background: var(--card); border: 1px dashed var(--link); border-radius: 14px; padding: 14px; display: grid; gap: 10px; }
.add-bar { border: 2px dashed var(--link); border-radius: 14px; padding: 10px 12px; display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px; background: var(--sel); }
.add-bar span { font-size: 13px; font-weight: 800; color: var(--link); }
.edit-panel { background: var(--card); border: 2px dashed var(--link); border-radius: 18px; padding: 16px 18px; display: flex; flex-direction: column; gap: 12px; }

/* صفحة الطالب */
.student-header { background: var(--navy); position: relative; }
.student-header .wrap { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 14px; padding-top: 12px; padding-bottom: 12px; }
.student-header .brand { color: #fff; }
.student-header .brand-mark { background: var(--gold); color: var(--navy); width: 42px; height: 42px; border-radius: 12px; }
.student-header .brand b { font-size: 17px; }
.student-header .brand small { color: var(--gold); font-size: 12px; font-weight: 700; }
.student-header .round-btn { background: var(--navy2); border: 0; color: #fff; }
.student-header .who { display: flex; flex-direction: column; line-height: 1.3; color: #fff; font-weight: 700; font-size: 15px; }
.student-header .who small { color: #A9B7D3; font-size: 12px; font-weight: 600; }
.student-header a.out { color: #D6DEEE; font-weight: 600; padding: 10px 6px; }
.dropdown { position: absolute; top: 64px; left: 24px; z-index: 20; width: 360px; max-width: calc(100% - 48px); background: var(--card); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow); padding: 10px; max-height: 70vh; overflow: auto; }
.notif { display: flex; gap: 10px; padding: 10px; border-radius: 12px; }
.notif.unread { background: var(--sel); }
.notif .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--link); margin-top: 8px; flex-shrink: 0; }
.notif:not(.unread) .dot { background: transparent; }
.tabs-nav { display: flex; flex-wrap: wrap; gap: 6px; background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 8px; }
.tabs-nav a { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 8px 16px; border-radius: 12px; color: var(--ink2); font-weight: 700; text-decoration: none; }
.tabs-nav a.on { background: var(--navy); color: #fff; font-weight: 800; }
html.dark .tabs-nav a.on { background: #2A4A8A; }
.tabs-nav .sep { width: 1px; align-self: stretch; background: var(--line); margin: 6px 4px; }
.locked-box { background: var(--card); border: 1px dashed var(--line2); border-radius: 20px; padding: 56px 24px; display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center; }
.lesson-layout { display: flex; flex-wrap: wrap; gap: 22px; align-items: flex-start; }
.lesson-list { flex: 1 1 300px; background: var(--card); border: 1px solid var(--line); border-radius: 20px; padding: 16px; display: flex; flex-direction: column; gap: 8px; }
.lesson-main { flex: 999 1 560px; min-width: 0; display: flex; flex-direction: column; gap: 14px; }
.lesson-item { display: flex; align-items: center; gap: 12px; min-height: 64px; padding: 10px 12px; border: 1.5px solid transparent; border-radius: 14px; background: var(--soft); color: var(--ink); text-decoration: none !important; }
.lesson-item.on { border-color: var(--link); background: var(--sel); }
.lesson-item .st { flex-shrink: 0; width: 36px; height: 36px; border-radius: 50%; background: var(--track); color: var(--ink); display: flex; align-items: center; justify-content: center; }
.lesson-item .st.done { background: var(--green); color: #fff; }
.lesson-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.lesson-card { display: flex; flex-direction: column; gap: 10px; padding: 12px; border-radius: 18px; border: 1.5px solid var(--line); background: var(--card); color: var(--ink); text-decoration: none !important; }
.lesson-card.on { border-color: var(--link); }
.lesson-card .thumb { height: 110px; border-radius: 12px; background: var(--navy); display: flex; align-items: center; justify-content: center; }
.lesson-card .thumb span { width: 44px; height: 44px; border-radius: 50%; background: var(--gold); color: var(--navy); display: flex; align-items: center; justify-content: center; }
.live-card { background: var(--navy); color: #fff; border-radius: 18px; padding: 18px 20px; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 14px; }
.live-card .sub { color: #A9B7D3; font-size: 13px; }
.sq-ico { width: 48px; height: 48px; border-radius: 14px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.embed-box { position: relative; border-radius: 20px; overflow: hidden; background: #0A1630; }
.embed-box iframe { width: 100%; aspect-ratio: 16/9; border: 0; display: block; }
.no-video { aspect-ratio: 16/9; background: #0A1630; border-radius: 20px; color: #A9B7D3; display: flex; align-items: center; justify-content: center; flex-direction: column; gap: 10px; }
.progress-ring { width: 64px; height: 64px; border-radius: 50%; background: var(--navy); color: var(--gold); font-size: 17px; font-weight: 900; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }

/* البلاير */
.bplayer { position: relative; aspect-ratio: 16/9; background: #000; border-radius: 20px; overflow: hidden; direction: ltr; user-select: none; }
.bplayer video { width: 100%; height: 100%; display: block; background: #000; }
.bplayer:fullscreen { border-radius: 0; }
.bp-big { position: absolute; inset: 0; margin: auto; width: 84px; height: 84px; border-radius: 50%; border: 0; background: rgba(246, 179, 27, .95); color: #0B2350; display: flex; align-items: center; justify-content: center; cursor: pointer; transition: opacity .2s; }
.bplayer.playing .bp-big { opacity: 0; pointer-events: none; }
.bp-wm { position: absolute; color: rgba(255, 255, 255, .22); font: 700 15px ui-monospace, Menlo, monospace; pointer-events: none; transition: top 1.5s, left 1.5s; text-shadow: 0 0 2px rgba(0, 0, 0, .4); }
.bp-toast { position: absolute; top: 16px; left: 50%; transform: translateX(-50%); background: rgba(0, 0, 0, .72); color: #fff; font: 800 14px 'Cairo', sans-serif; padding: 6px 14px; border-radius: 999px; opacity: 0; transition: opacity .2s; pointer-events: none; }
.bp-toast.show { opacity: 1; }
.bp-bar { position: absolute; left: 0; right: 0; bottom: 0; padding: 10px 12px; background: linear-gradient(to top, rgba(0, 0, 0, .85), rgba(0, 0, 0, 0)); display: flex; flex-direction: column; gap: 6px; transition: opacity .25s; }
.bplayer.playing.idle .bp-bar { opacity: 0; }
.bplayer.playing.idle { cursor: none; }
.bp-seek { position: relative; height: 16px; cursor: pointer; display: flex; align-items: center; }
.bp-seek .track { position: absolute; left: 0; right: 0; height: 5px; border-radius: 999px; background: rgba(255, 255, 255, .25); }
.bp-seek .buf, .bp-seek .fill { position: absolute; left: 0; height: 5px; border-radius: 999px; }
.bp-seek .buf { background: rgba(255, 255, 255, .4); }
.bp-seek .fill { background: var(--gold); }
.bp-seek .knob { position: absolute; width: 14px; height: 14px; margin-left: -7px; border-radius: 50%; background: var(--gold); }
.bp-seek .tip { position: absolute; bottom: 20px; transform: translateX(-50%); background: rgba(0, 0, 0, .8); color: #fff; font-size: 12px; padding: 2px 6px; border-radius: 6px; display: none; }
.bp-seek:hover .tip { display: block; }
.bp-row { display: flex; align-items: center; gap: 2px; color: #fff; }
.bp-row button { min-width: 40px; height: 40px; border: 0; background: transparent; color: #fff; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; border-radius: 8px; font: 800 13px 'Cairo', sans-serif; }
.bp-row button:hover { background: rgba(255, 255, 255, .12); }
.bp-row .bp-chip { border: 1px solid rgba(255, 255, 255, .35); height: 32px; padding: 0 8px; }
.bp-time { margin: 0 8px; font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.bp-vol { width: 70px; accent-color: #fff; }
.bp-menu { position: absolute; bottom: 64px; right: 12px; background: rgba(17, 24, 39, .97); border-radius: 12px; padding: 6px; display: none; flex-direction: column; min-width: 140px; z-index: 3; }
.bp-menu.open { display: flex; }
.bp-menu .ttl { color: #9CA3AF; font: 700 12px 'Cairo', sans-serif; padding: 4px 10px; }
.bp-menu button { min-height: 34px; border: 0; border-radius: 8px; background: transparent; color: #fff; text-align: left; padding: 0 12px; font: 700 13px 'Cairo', sans-serif; cursor: pointer; }
.bp-menu button.on { background: rgba(246, 179, 27, .25); }
@media (max-width: 560px) { .bp-vol, .bp-pip { display: none !important; } .bp-time { font-size: 11px; margin: 0 4px; } }

/* لوحة التحكم */
.admin { display: flex; flex-wrap: wrap; min-height: 100vh; }
.side { flex: 1 1 240px; max-width: 100%; background: var(--navy); color: #D6DEEE; padding: 20px 14px; display: flex; flex-direction: column; gap: 4px; }
html.dark .side { background: #0E1A36; }
.side .brand { color: #fff; padding: 0 8px 12px; }
.side .brand-mark { background: var(--gold); color: var(--navy); width: 40px; height: 40px; border-radius: 12px; }
.side .brand b { font-size: 15px; }
.side .brand small { color: #D6DEEE; font-size: 12px; }
.side a.item { display: flex; align-items: center; gap: 10px; padding: 11px 14px; border-radius: 12px; color: #D6DEEE; text-decoration: none; font-weight: 600; }
.side a.item.on { background: var(--navy2); color: #fff; font-weight: 800; }
.side a.item:hover { background: rgba(255, 255, 255, .06); }
.side .sub a.item { padding-right: 38px; font-size: 14px; }
.side select { background: var(--navy2); color: #fff; border-color: #2A4A8A; }
.side .lbl { font-size: 12px; font-weight: 700; color: #A9B7D3; padding: 0 6px; }
.main { flex: 999 1 560px; min-width: 0; padding: 26px 28px 56px; display: flex; flex-direction: column; gap: 18px; }
.page-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 14px; }
.page-head h1 { font-size: 27px; font-weight: 900; }
.subnav { display: flex; flex-wrap: wrap; gap: 6px; background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 8px; }
.subnav a { min-height: 42px; padding: 0 18px; border-radius: 12px; color: var(--ink2); font-weight: 700; display: inline-flex; align-items: center; text-decoration: none; }
.subnav a.on { background: var(--navy); color: #fff; font-weight: 800; }
html.dark .subnav a.on { background: #2A4A8A; }
.list-item { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 14px; background: var(--soft); }
.list-item.on { background: var(--sel); outline: 1.5px solid var(--link); }
.dropzone { border: 2px dashed var(--line2); border-radius: 16px; padding: 24px; display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; background: var(--soft); cursor: pointer; }
.dropzone.over { border-color: var(--link); background: var(--sel); }
.kv { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.kv > div { border-radius: 12px; padding: 12px 14px; display: flex; flex-direction: column; }
.kv b { font-size: 22px; font-weight: 900; }
.codebox { border-radius: 14px; overflow: hidden; border: 1px solid #1F2937; }
.codebox .head { display: flex; justify-content: space-between; align-items: center; gap: 8px; background: #111827; color: #9CA3AF; padding: 6px 12px; font-size: 12px; font-weight: 700; }
.codebox textarea { border: 0; border-radius: 0; background: #0F172A; color: #E2E8F0; font-family: ui-monospace, Menlo, monospace; font-size: 13px; direction: ltr; text-align: left; min-height: 160px; }
.CodeMirror { height: auto; min-height: 170px; font-size: 13px; direction: ltr; }
.q-card { border: 1px solid var(--line); border-radius: 16px; padding: 16px; display: flex; flex-direction: column; gap: 10px; background: var(--card); }
.q-opt { display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 6px 12px; border-radius: 12px; border: 1px solid var(--line); cursor: pointer; }
.q-opt.right { border-color: var(--green); background: var(--ok-bg); }
.q-opt.wrong { border-color: var(--red); background: var(--err-bg); }
.timer { position: sticky; top: 8px; z-index: 5; align-self: flex-start; background: var(--navy); color: #fff; font-weight: 900; padding: 8px 16px; border-radius: 999px; font-variant-numeric: tabular-nums; }
.timer.low { background: var(--red); }
.switch { position: relative; width: 52px; height: 30px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; border-radius: 999px; background: var(--line2); transition: .2s; cursor: pointer; }
.switch span::after { content: ''; position: absolute; top: 3px; right: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; transition: .2s; }
.switch input:checked + span { background: var(--green); }
.switch input:checked + span::after { right: 25px; }
.setting-row { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 14px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.setting-row:last-child { border-bottom: 0; }
.pager { display: flex; gap: 6px; align-items: center; justify-content: space-between; flex-wrap: wrap; font-size: 13px; color: var(--muted); }
.login-box { max-width: 440px; margin: 56px auto; }
details.box { border: 1px solid var(--line); border-radius: 14px; padding: 10px 14px; background: var(--card); }
details.box summary { cursor: pointer; font-weight: 800; }
@media (max-width: 760px) { .main { padding: 18px 16px 48px; } .wrap { padding: 0 16px; } }
@media print { .side, .adminbar, .site-header, .student-header { display: none; } }

/* الأبواب كأيقونات */
.ch-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 18px; }
.ch-card { position: relative; display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; background: var(--card); color: var(--ink); text-decoration: none !important; box-shadow: 0 6px 18px rgba(11, 35, 80, .06); transition: transform .15s, box-shadow .15s; }
a.ch-card:hover { transform: translateY(-3px); box-shadow: 0 14px 30px rgba(11, 35, 80, .14); }
a.ch-card:focus-visible { outline: 3px solid rgba(29, 78, 216, .45); outline-offset: 2px; }
.ch-art { display: block; aspect-ratio: 1 / 1; background: #3E3D48; overflow: hidden; }
.ch-img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ch-ph { position: relative; width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; background: #3E3D48; }
.ch-ph-c { width: 74%; aspect-ratio: 1 / 1; border-radius: 50%; background: #C7E3E1; border: 5px solid #fff; color: #2C7A7B; display: flex; align-items: center; justify-content: center; }
.ch-ph-t { position: absolute; bottom: 15%; left: 14%; right: 14%; background: #E07B39; color: #fff; border: 3px solid #F3E2D3; border-radius: 6px; padding: 6px 8px; text-align: center; font-size: 20px; font-weight: 900; line-height: 1.3; }
.ch-ph.sm .ch-ph-c { border-width: 3px; }
.ch-body { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; padding: 14px 16px 18px; flex: 1; }
.ch-pill { background: #0E7490; color: #fff; font-size: 11px; font-weight: 800; padding: 3px 8px; border-radius: 4px; }
.ch-name { font-size: 19px; font-weight: 700; color: #1D5FB8; }
html.dark .ch-name { color: var(--link); }
.ch-lock { position: absolute; inset: 0; background: rgba(11, 35, 80, .58); color: #fff; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; }
.ch-lock > span { width: 56px; height: 56px; border-radius: 50%; background: rgba(255, 255, 255, .15); display: flex; align-items: center; justify-content: center; }
.ch-thumb { width: 92px; height: 92px; border-radius: 14px; overflow: hidden; flex-shrink: 0; background: #3E3D48; display: block; }
.ch-thumb.lg { width: 140px; height: 140px; border-radius: 16px; }

/* Swarmify smartvideo جوه الحصة */
.embed-box smartvideo, .embed-box video { display: block; width: 100% !important; height: auto !important; aspect-ratio: 16 / 9; background: #000; }
.embed-box .swarm-fluid { width: 100% !important; }

/* زرار العين للحصص (أدمن) */
.lesson-row { position: relative; display: flex; align-items: stretch; gap: 6px; }
.lesson-row > a { flex: 1; min-width: 0; }
.eye-btn { flex-shrink: 0; width: 44px; border-radius: 12px; border: 1px solid var(--line2); background: var(--card); color: var(--green); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.eye-btn:hover { background: var(--sel); }
.eye-btn .eye-off, .eye-btn.off .eye-on { display: none; }
.eye-btn.off .eye-off { display: inline-flex; }
.eye-btn.off { color: var(--red); border-color: var(--err-bg); background: var(--err-bg); }
.eye-btn[disabled] { opacity: .5; cursor: wait; }
.lesson-row.is-hidden > a { opacity: .55; border-style: dashed; border-color: var(--line2); }
.hidden-note { display: none; color: var(--red); font-weight: 800; }
.lesson-row.is-hidden .hidden-note { display: inline; }
.lesson-cards .lesson-row { flex-direction: column; }
.lesson-cards .eye-btn { width: 100%; min-height: 38px; }
.list-item .eye-btn { min-height: 38px; }

/* فحص النظام */
.sys-sum { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 14px; }
.sys-score { display: flex; align-items: center; gap: 14px; }
.sys-score > svg { width: 48px; height: 48px; padding: 11px; border-radius: 14px; flex-shrink: 0; }
.sys-score.ok > svg { background: var(--ok-bg); color: var(--ok); }
.sys-score.warn > svg { background: var(--warn-bg); color: var(--warn); }
.sys-score.err > svg { background: var(--err-bg); color: var(--err); }
.sys-score b { display: block; font-size: 18px; }
.sys-row { display: grid; grid-template-columns: 26px minmax(140px, 240px) 1fr; gap: 12px; align-items: start; padding: 11px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.sys-row:last-child { border-bottom: 0; }
.sys-ic { width: 26px; height: 26px; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center; }
.st-ok .sys-ic { background: var(--ok-bg); color: var(--ok); }
.st-warn .sys-ic { background: var(--warn-bg); color: var(--warn); }
.st-err .sys-ic { background: var(--err-bg); color: var(--err); }
.st-info .sys-ic { background: var(--info-bg); color: var(--info); }
.sys-k { font-weight: 800; padding-top: 3px; overflow-wrap: anywhere; }
.sys-v { padding-top: 3px; overflow-wrap: anywhere; }
.sys-hint { display: block; font-size: 13px; color: var(--muted); margin-top: 3px; }
.st-err .sys-hint { color: var(--err); }
.sys-log { margin: 12px 0 0; max-height: 360px; overflow: auto; background: var(--soft); border: 1px solid var(--line); border-radius: 12px; padding: 12px; font: 12px/1.6 ui-monospace, Consolas, monospace; white-space: pre-wrap; word-break: break-all; text-align: left; }
@media (max-width: 640px) { .sys-row { grid-template-columns: 26px 1fr; } .sys-v { grid-column: 2; padding-top: 0; } }

/* النسخ الاحتياطي */
.bk-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; }
.bk-card h2 { margin: 0; }
.bk-ic { width: 52px; height: 52px; border-radius: 14px; display: inline-flex; align-items: center; justify-content: center; background: var(--info-bg); color: var(--info); }
.bk-card .form-actions { margin-top: auto; }

/* شريط المعاينة بحساب طالب */
.preview-bar { background: #5B21B6; color: #fff; position: sticky; top: 0; z-index: 60; box-shadow: 0 4px 14px rgba(0,0,0,.18); }
.preview-bar .wrap { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; padding-top: 10px; padding-bottom: 10px; }
.pv-who { display: flex; align-items: flex-start; gap: 10px; font-size: 14px; }
.pv-who > svg { flex-shrink: 0; margin-top: 3px; }
.pv-un { opacity: .8; font-size: 13px; }
.pv-meta { display: block; font-size: 12.5px; opacity: .85; }
.pv-susp { color: #FECACA; }
.pv-switch { display: flex; gap: 6px; }
.pv-switch input { width: 150px; min-height: 36px; padding: 4px 10px; border-radius: 10px; border: 1px solid rgba(255,255,255,.35); background: rgba(255,255,255,.12); color: #fff; }
.pv-switch input::placeholder { color: rgba(255,255,255,.7); }
.preview-bar .btn:not(.btn-gold) { background: transparent; border: 1px solid rgba(255,255,255,.45); color: #fff; }

/* إعلان صفحة دروسي */
.dash-ann { --a: var(--navy); --a-bg: var(--card); position: relative; display: flex; align-items: stretch; background: var(--a-bg); border: 1px solid var(--line); border-inline-start: 6px solid var(--a); border-radius: 18px; overflow: hidden; box-shadow: var(--shadow); }
.dash-ann.t-info { --a: var(--info); }
.dash-ann.t-ok { --a: var(--ok); }
.dash-ann.t-warn { --a: var(--gold); }
.dash-ann.t-danger { --a: var(--err); }
.dash-ann-img { width: 240px; max-width: 34%; object-fit: cover; flex-shrink: 0; }
.dash-ann-body { display: flex; gap: 14px; padding: 18px 22px; padding-inline-end: 52px; flex: 1; min-width: 0; }
.dash-ann-ic { width: 44px; height: 44px; border-radius: 12px; flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center; background: var(--a); color: #fff; }
.dash-ann.t-warn .dash-ann-ic { color: var(--gold-ink); }
.dash-ann h2 { margin: 0 0 4px; font-size: 20px; font-weight: 900; }
.dash-ann p { margin: 0; color: var(--ink2); line-height: 1.9; overflow-wrap: anywhere; }
.dash-ann-btn { margin-top: 12px; background: var(--a); color: #fff; }
.dash-ann.t-warn .dash-ann-btn { color: var(--gold-ink); }
.dash-ann-admin { display: block; margin-top: 10px; font-size: 12.5px; color: var(--muted); }
.dash-ann-x { position: absolute; top: 10px; inset-inline-end: 10px; z-index: 1; width: 36px; height: 36px; border-radius: 10px; border: 0; background: var(--card); box-shadow: 0 1px 4px rgba(0,0,0,.12); color: var(--muted); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.dash-ann-x:hover { background: var(--sel); color: var(--ink); }
@media (max-width: 640px) { .dash-ann.has-img { flex-direction: column; } .dash-ann-img { width: 100%; max-width: none; max-height: 200px; } .dash-ann-body { padding: 16px; padding-inline-end: 46px; } }

/* حقوق البرمجة أسفل الفوتر */
.footer-credit { border-top: 1px solid rgba(255,255,255,.12); }
.site-footer .footer-credit .wrap { padding-top: 14px; padding-bottom: 14px; justify-content: center; gap: 6px; font-size: 13px; color: #AEBBD3; }
.footer-credit a { font-weight: 900; color: var(--gold); text-decoration: none; }
.footer-credit a:hover { text-decoration: underline; }

/* محرر النصوص */
.ed { border: 1px solid var(--line2); border-radius: 12px; background: var(--card); position: relative; font-size: 15px; font-weight: 400; color: var(--ink); min-width: 0; }
.ed.focus { border-color: var(--link); box-shadow: 0 0 0 3px rgba(37, 99, 235, .15); }
.ed-bar { display: flex; flex-wrap: wrap; gap: 2px; padding: 5px; border-bottom: 1px solid var(--line); background: var(--soft); border-radius: 12px 12px 0 0; position: relative; }
.ed-btn { direction: ltr; unicode-bidi: isolate; min-width: 32px; height: 32px; padding: 0 6px; border: 0; border-radius: 8px; background: transparent; color: var(--ink2); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; font: 700 14px/1 inherit; }
.ed-btn:hover { background: var(--sel); color: var(--ink); }
.ed-btn.on { background: var(--navy); color: #fff; }
html.dark .ed-btn.on { background: #2A4A8A; }
.ed-btn[disabled] { opacity: .35; cursor: default; }
.ed-btn sub, .ed-btn sup { font-size: 9px; }
.ed-sep { width: 1px; background: var(--line2); margin: 5px 3px; }
.ed-area { position: relative; padding: 10px 12px; outline: none; line-height: 1.9; overflow-wrap: anywhere; max-height: 520px; overflow-y: auto; }
.ed-area img { max-width: 100%; height: auto; border-radius: 6px; }
.ed-area ul, .ed-area ol { padding-inline-start: 22px; margin: 4px 0; }
.ed-area p { margin: 0 0 6px; }
.ed.empty .ed-area:not(:focus)::before { content: attr(data-ph); color: var(--muted); pointer-events: none; position: absolute; inset-inline-start: 12px; top: 10px; }
.ed-code { width: 100%; min-height: 140px; border: 0; border-radius: 0 0 12px 12px; padding: 10px; font: 13px/1.6 ui-monospace, Consolas, monospace; background: var(--soft); color: var(--ink); }
.ed-pop { position: absolute; z-index: 50; display: flex; flex-wrap: wrap; gap: 6px; padding: 8px; width: max-content; max-width: 260px; background: var(--card); border: 1px solid var(--line2); border-radius: 12px; box-shadow: var(--shadow); }
.ed-sw { width: 26px; height: 26px; border-radius: 8px; border: 1px solid var(--line2); cursor: pointer; font-size: 12px; color: var(--muted); }
.ed-chars button { width: 34px; height: 34px; border-radius: 8px; border: 1px solid var(--line); background: var(--soft); color: var(--ink); cursor: pointer; font-size: 17px; }
.ed-chars button:hover { background: var(--sel); }
.ed-mini .ed-bar { padding: 3px; }
.ed-mini .ed-btn { min-width: 28px; height: 28px; }
.ed-mini .ed-area { padding: 6px 10px; line-height: 1.7; }
.q-opt .ed { flex: 1; }
.q-opt.ed-label { cursor: default; }
/* عرض المحتوى المنسّق */
.dash-ann-text { color: var(--ink2); line-height: 1.9; overflow-wrap: anywhere; }
.dash-ann-text p { margin: 0 0 4px; }
.dash-ann-text img, .notif-body img, .block .body img { max-width: 100%; height: auto; border-radius: 8px; }
.notif-body p { margin: 0; }
.announce .grow p { display: inline; margin: 0; }
.q-missing-img { display: inline-block; padding: 2px 8px; border-radius: 6px; background: var(--warn-bg); color: var(--warn); font-size: 13px; }

/* معاينة الاختبار */
.exam-preview-bar { background: #5B21B6; color: #fff; position: sticky; top: 0; z-index: 55; }
.exam-preview-bar .wrap { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; padding-top: 10px; padding-bottom: 10px; font-size: 14px; }
.exam-preview-bar .wrap > span:first-child { display: inline-flex; align-items: center; gap: 8px; }
.exam-preview-bar .btn:not(.btn-gold) { background: transparent; border: 1px solid rgba(255,255,255,.45); color: #fff; }
.preview-bar ~ .exam-preview-bar { top: 64px; }
.q-text { font-size: 17px; font-weight: 700; line-height: 1.9; overflow-wrap: anywhere; }
.q-text img, .q-opt img { max-width: 100%; height: auto; border-radius: 8px; }
.q-text p { margin: 0 0 6px; }
.q-opt p { margin: 0; }

/* تنقل الاختبار (زي المودل) */
.exam-layout { display: grid; grid-template-columns: minmax(0, 1fr) 270px; gap: 22px; align-items: start; }
.exam-main { min-width: 0; }
.exam-nav { position: sticky; top: 12px; }
.preview-bar ~ * .exam-nav, .exam-preview-bar ~ * .exam-nav { top: 76px; }
.exam-nav-in { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 16px; display: flex; flex-direction: column; gap: 12px; box-shadow: var(--shadow); }
.exam-nav-title { font-size: 17px; font-weight: 900; }
.qnav-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(38px, 1fr)); gap: 7px; }
.qnav { position: relative; height: 46px; border: 1px solid var(--line2); border-radius: 6px; background: var(--card); color: var(--ink); text-decoration: none; display: flex; align-items: flex-start; justify-content: flex-start; padding: 3px 6px; font-size: 13px; font-weight: 700; overflow: hidden; }
.qnav::after { content: ""; position: absolute; inset-inline: 0; bottom: 0; height: 40%; background: transparent; transition: background .15s; }
.qnav.done { border: 2px solid var(--navy); }
.qnav.done::after { background: var(--navy); opacity: .85; }
html.dark .qnav.done { border-color: #6B8BD6; }
html.dark .qnav.done::after { background: #6B8BD6; }
.qnav.flag::before { content: ""; position: absolute; top: 0; left: 0; width: 0; height: 0; border-top: 13px solid var(--red); border-right: 13px solid transparent; }
.qnav.cur { outline: 3px solid var(--gold); outline-offset: 1px; }
.qnav:hover { border-color: var(--link); }
.qnav-legend { display: flex; flex-wrap: wrap; gap: 6px 12px; color: var(--muted); }
.qnav-legend span { display: inline-flex; align-items: center; gap: 5px; }
.lg { width: 14px; height: 14px; border: 1px solid var(--line2); border-radius: 3px; display: inline-block; }
.lg.done { background: var(--navy); border-color: var(--navy); }
.lg.flag { background: linear-gradient(225deg, var(--red) 45%, transparent 46%); }
.exam-nav-time { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.exam-nav .timer { position: static; padding: 6px 14px; font-size: 18px; }
.exam-nav [data-finish] { width: 100%; }
.q-card { scroll-margin-top: 90px; }
.q-legend { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; width: 100%; }
.q-flag { border: 1px solid var(--line2); background: transparent; color: var(--muted); border-radius: 999px; padding: 3px 12px; font: inherit; font-size: 12.5px; font-weight: 700; cursor: pointer; }
.q-flag:hover { color: var(--ink); border-color: var(--ink2); }
.q-flag.on { color: var(--red); border-color: var(--red); background: var(--err-bg); }
@media (max-width: 900px) {
  .exam-layout { grid-template-columns: 1fr; }
  .exam-nav { order: -1; top: 0; z-index: 30; margin: 0 -16px; }
  .exam-nav-in { border-radius: 0; border-inline: 0; padding: 10px 16px; gap: 8px; display: grid; grid-template-columns: 1fr auto; align-items: center; }
  .exam-nav-title, .qnav-legend, [data-qnav-count] { display: none; }
  .qnav-grid { grid-column: 1 / -1; display: flex; overflow-x: auto; gap: 6px; padding-bottom: 4px; scrollbar-width: thin; }
  .qnav { flex: 0 0 38px; height: 40px; }
  .exam-nav-time .small { display: none; }
  .exam-nav [data-finish] { width: auto; min-height: 38px; }
  .exam-nav .timer { font-size: 16px; }
}
.qnav, .qnav span { text-decoration: none !important; }
@media (max-width: 900px) { .q-card { scroll-margin-top: 130px; } }
.ed-mini .ed-area img { max-height: 220px; width: auto; vertical-align: middle; }

/* فاصل الباب في الحصص التعويضية / الواجب */
.lesson-sep { display: flex; align-items: center; gap: 10px; margin: 14px 2px 4px; padding: 8px 10px; border-radius: 12px; background: var(--soft); border-inline-start: 4px solid var(--gold); }
.lesson-list .lesson-sep:first-of-type, .lesson-list > .row + .lesson-sep, .lesson-list > .alert + .lesson-sep { margin-top: 6px; }
.lesson-sep b { font-size: 15px; font-weight: 900; color: var(--ink); flex: 1; min-width: 0; }
.lesson-sep-art { width: 34px; height: 34px; border-radius: 9px; overflow: hidden; flex-shrink: 0; display: inline-flex; background: var(--card); }
.lesson-sep-art .ch-img { width: 100%; height: 100%; object-fit: cover; }
.lesson-sep-art .ch-ph { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; }
.lesson-sep-art svg { width: 20px; height: 20px; }
.lesson-sep-n { font-size: 12px; color: var(--muted); font-weight: 700; white-space: nowrap; }
.lesson-cards .lesson-sep.wide { grid-column: 1 / -1; margin: 10px 0 0; }
.side-count { min-width: 22px; height: 22px; padding: 0 6px; border-radius: 99px; background: var(--red); color: #fff; font-size: 12px; font-weight: 800; display: inline-flex; align-items: center; justify-content: center; }

/* أنواع الأسئلة الجديدة */
.q-fill { width: 100%; min-height: 46px; border: 1px solid var(--line2); border-radius: 12px; padding: 8px 14px; font-size: 16px; background: var(--card); }
.q-order { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.q-order li { display: flex; align-items: center; gap: 10px; border: 1px solid var(--line); border-radius: 12px; padding: 6px 10px; background: var(--soft); }
.q-order-n { width: 28px; height: 28px; border-radius: 8px; background: var(--card); display: inline-flex; align-items: center; justify-content: center; font-weight: 800; flex-shrink: 0; border: 1px solid var(--line); }
.q-hot { position: relative; display: inline-block; max-width: 100%; border-radius: 12px; overflow: hidden; border: 1px solid var(--line); line-height: 0; user-select: none; }
.q-hot img { max-width: 100%; height: auto; display: block; }
.q-zone { position: absolute; border: 2px dashed transparent; background: transparent; border-radius: 8px; cursor: pointer; padding: 0; }
.q-hot:not([data-dis]) .q-zone:hover, .q-zone:focus-visible { border-color: var(--gold); background: rgba(244, 180, 26, .15); }
.q-zone.on { border: 3px solid var(--navy); background: rgba(11, 34, 83, .18); }
.q-zone.right { border: 3px solid var(--green); background: rgba(14, 122, 85, .2); }
.q-zone.wrong { border: 3px solid var(--red); background: rgba(180, 35, 24, .18); }
.q-hot.review .q-zone { cursor: default; }
.q-check { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.q-fb { border-radius: 12px; padding: 8px 12px; font-weight: 700; width: 100%; }
.q-fb.ok { background: var(--ok-bg); color: var(--ok); }
.q-fb.no { background: var(--err-bg); color: var(--err); }
.q-right { background: var(--ok-bg); color: var(--ink); border-radius: 10px; padding: 8px 12px; }

/* محرر الأسئلة: السحب من البنك + رتّب + مناطق الصورة */
.draw-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.draw-box { display: flex; flex-direction: column; align-items: center; gap: 6px; border: 1px solid var(--line); border-radius: 12px; padding: 10px; font-weight: 700; }
.draw-box input { width: 90px; text-align: center; }
.diff { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-inline-end: 5px; vertical-align: middle; }
.diff.d1 { background: #22C55E; } .diff.d2 { background: #F59E0B; } .diff.d3 { background: #EF4444; }
.ord-list { display: flex; flex-direction: column; gap: 8px; }
.ord-row { display: flex; align-items: center; gap: 8px; }
.hot-edit { position: relative; display: inline-block; max-width: 100%; line-height: 0; border: 1px solid var(--line2); border-radius: 12px; overflow: hidden; cursor: crosshair; user-select: none; touch-action: none; }
.hot-edit img { max-width: 100%; height: auto; display: block; pointer-events: none; }
.hot-edit .hz { position: absolute; border: 2px solid var(--red); background: rgba(180, 35, 24, .15); border-radius: 6px; line-height: 1.2; }
.hot-edit .hz.ok { border-color: var(--green); background: rgba(14, 122, 85, .2); }
.hot-edit .hz b { position: absolute; top: 2px; inset-inline-start: 4px; font-size: 12px; background: var(--card); color: var(--ink); border-radius: 4px; padding: 0 4px; }
.hot-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.hot-row input[type=text] { flex: 1; min-width: 140px; min-height: 36px; }
@media (max-width: 560px) { .draw-grid { grid-template-columns: 1fr; } }
.ia-row { display: grid; grid-template-columns: 110px minmax(0, 1fr) 170px 190px; gap: 12px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line); }
.ia-row:last-child { border-bottom: 0; }
.ia-q { font-weight: 700; overflow-wrap: anywhere; }
@media (max-width: 900px) { .ia-row { grid-template-columns: 1fr; gap: 6px; } }

/* تقرير ولي الأمر */
.pr-avatar { width: 54px; height: 54px; border-radius: 16px; background: var(--sel); color: var(--navy); display: inline-flex; align-items: center; justify-content: center; font-weight: 900; font-size: 22px; }
html.dark .pr-avatar { color: var(--gold); }
.pr-week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; align-items: end; }
.pr-day { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.pr-bar { height: 110px; width: 100%; max-width: 38px; background: var(--soft); border-radius: 8px; display: flex; align-items: flex-end; overflow: hidden; }
.pr-bar span { width: 100%; background: var(--navy2); border-radius: 8px; }
html.dark .pr-bar span { background: #6B8BD6; }

/* كروت أكواد الشحن للطباعة */
.print-bar { background: var(--card); border-bottom: 1px solid var(--line); padding: 10px 0; }
.print-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0; padding: 10mm; }
.pcard { border: 1px dashed #9AA6B8; padding: 10px 12px; display: flex; flex-direction: column; gap: 4px; align-items: center; text-align: center; break-inside: avoid; min-height: 42mm; justify-content: center; background: #fff; color: #0B1B3A; }
.pcard-h { font-weight: 900; font-size: 13px; }
.pcard-code { font-family: ui-monospace, Consolas, monospace; font-size: 20px; letter-spacing: 2px; direction: ltr; border: 1px solid #C9D3E3; border-radius: 8px; padding: 4px 10px; background: #F3F6FB; }
.pcard-t { font-size: 12px; font-weight: 700; }
.pcard-hint { font-size: 10px; color: #6A7892; }
@media (max-width: 700px) { .print-cards { grid-template-columns: 1fr 1fr; padding: 8px; } }
@media print { .no-print, .adminbar, .announce, .preview-bar { display: none !important; } body { background: #fff !important; } .print-cards { padding: 0; } @page { margin: 8mm; } }

/* صفحة دروسي: النقط والأوائل والشارات */
.sh-hero { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; justify-content: space-between; background: linear-gradient(135deg, #0B2253, #17398A); color: #fff; border-radius: 18px; padding: 18px 20px; }
.sh-next { font-size: 19px; font-weight: 900; text-wrap: balance; }
.sh-stat { background: rgba(255, 255, 255, .1); border-radius: 12px; padding: 8px 14px; text-align: center; min-width: 96px; display: flex; flex-direction: column; }
.sh-stat b { font-size: 22px; font-weight: 900; color: #F4B41A; font-variant-numeric: tabular-nums; }
.sh-stat span { font-size: 12.5px; color: #D6DEEE; }
.sh-rem { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px; background: var(--soft); color: inherit; text-decoration: none; }
.sh-rem:hover { background: var(--sel); }
.sh-rem.ok { background: var(--ok-bg); }
.sh-grid { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 16px; align-items: start; }
@media (max-width: 860px) { .sh-grid { grid-template-columns: 1fr; } }
.sh-lb { list-style: none; margin: 0; padding: 0; }
.sh-lb li { display: flex; align-items: center; gap: 10px; padding: 8px 6px; border-bottom: 1px solid var(--line); font-weight: 700; }
.sh-lb li.me { background: var(--sel); border-radius: 10px; font-weight: 900; }
.sh-lb .rk { width: 28px; height: 28px; border-radius: 8px; background: var(--soft); display: inline-flex; align-items: center; justify-content: center; font-weight: 900; font-size: 13px; flex-shrink: 0; }
.sh-lb li:nth-child(1) .rk { background: #F4B41A; color: #2B1F00; } .sh-lb li:nth-child(2) .rk { background: #CBD5E1; color: #1E293B; } .sh-lb li:nth-child(3) .rk { background: #E7B48A; color: #3A1F06; }
.sh-badges { display: grid; grid-template-columns: repeat(auto-fill, minmax(124px, 1fr)); gap: 10px; }
.sh-badge { border: 1px solid var(--line); border-radius: 14px; padding: 12px 8px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.sh-badge .ic { width: 46px; height: 46px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-weight: 900; background: var(--warn-bg); color: var(--warn); }
.sh-badge b { font-size: 13px; line-height: 1.4; }
.sh-badge.locked { opacity: .45; filter: grayscale(1); }
.sh-pwa { display: flex; gap: 12px; align-items: center; border: 1px dashed var(--line2); border-radius: 16px; padding: 12px 14px; background: var(--card); }
.sh-phone { width: 44px; height: 44px; border-radius: 12px; overflow: hidden; flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center; }
.sh-phone img { width: 100%; height: 100%; }
.sh-phone.bell { background: var(--info-bg); color: var(--info); }
.qa-item { border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; }
.qa-ans { background: var(--ok-bg); border-radius: 10px; padding: 8px 12px; }
.qa-ans b { color: var(--green); }

/* الشهادة */
.cert-page { padding: 24px 16px 60px; display: flex; justify-content: center; }
.cert { width: 100%; max-width: 980px; aspect-ratio: 1.414 / 1; background: #fff; color: #0B1B3A; border: 3px solid #F4B41A; border-radius: 18px; padding: 14px; box-shadow: var(--shadow); }
.cert-in { height: 100%; border: 1px solid #C9D3E3; border-radius: 12px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; text-align: center; padding: 20px; background: radial-gradient(circle at 50% 0%, #FFF8E6, #fff 60%); }
.cert-seal { width: 76px; height: 76px; border-radius: 50%; background: #0B2253; color: #F4B41A; display: inline-flex; align-items: center; justify-content: center; box-shadow: 0 0 0 5px #F4B41A; }
.cert-k { letter-spacing: 2px; font-weight: 800; color: #9A5B00; font-size: 14px; }
.cert-h { font-size: clamp(18px, 3vw, 28px); font-weight: 800; margin: 0; }
.cert-name { font-size: clamp(26px, 5vw, 48px); font-weight: 900; color: #0B2253; }
.cert-p { font-size: clamp(14px, 2vw, 19px); line-height: 1.9; margin: 0; color: #3B4A66; }
.cert-foot { display: flex; flex-wrap: wrap; justify-content: center; gap: 20px 44px; margin-top: 10px; font-size: 14px; }
.cert-foot .muted { color: #6A7892; }
.cert-verify { font-size: 11px; color: #8C9AB6; margin-top: 6px; }
@media print { .cert-page { padding: 0; } .cert { box-shadow: none; max-width: none; } @page { size: A4 landscape; margin: 8mm; } }

/* رسوم الإحصائيات */
.schart { width: 100%; height: auto; display: block; direction: ltr; }
.schart text { fill: var(--muted); font-size: 11px; font-family: inherit; }
.schart .g { stroke: var(--line); }
.schart .b1 { fill: #3A5CA6; } .schart .b2 { fill: #F4B41A; }
.schart .a { fill: rgba(58, 92, 166, .14); } .schart .l { fill: none; stroke: #3A5CA6; stroke-width: 2.5; }
.schart .dot { fill: #EF4444; } .schart .dt { fill: #EF4444; font-weight: 800; font-size: 12px; }
.wa-msg { white-space: normal; background: #DCF8C6; color: #111; border-radius: 12px 12px 2px 12px; padding: 10px 12px; font-size: 14px; line-height: 1.8; max-width: 440px; }
.wm-demo { background: #111827; border-radius: 10px; height: 90px; display: grid; place-items: center; color: #fff; font-weight: 700; direction: ltr; }
.linkbtn { background: none; border: 0; color: var(--link); cursor: pointer; padding: 0; font: inherit; }
.perm-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 6px 14px; }
.g-row { display: flex; align-items: center; gap: 8px; }
.g-row input[type=checkbox] { width: 18px; height: 18px; flex: none; }
.g-bulk { border-bottom: 1px solid var(--line); padding-bottom: 8px; margin-bottom: 4px; }
.f .f-err { color: var(--red); font-size: 13px; font-weight: 700; }
.f.has-err input, .f.has-err textarea { border-color: var(--red); }
.prof-head { display: flex; align-items: center; gap: 12px; padding-bottom: 6px; border-bottom: 1px solid var(--line); }
.prof-av { width: 52px; height: 52px; border-radius: 50%; background: var(--navy, #0B2350); color: #fff; display: grid; place-items: center; font-size: 22px; font-weight: 900; flex: none; }
.student-header a.who { color: #fff; text-decoration: none; }
.profile-nag { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.side-pv { display: flex; flex-direction: column; gap: 6px; margin: 6px 4px; padding: 10px; border-radius: 12px; background: rgba(255,255,255,.07); color: #DCE4F5; }
.side-pv input { min-height: 34px; padding: 4px 10px; font-size: 14px; min-width: 0; flex: 1; background: #fff; color: #111; }
.side-ver { color: #7F8DB0; font-size: 11px; text-align: center; padding-bottom: 6px; }
.dup-box { border: 1px solid #F3C4C4; }
.dup-grp { border-top: 1px solid var(--line); padding-top: 8px; display: flex; flex-direction: column; gap: 6px; }
.dup-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; background: var(--soft, #F4F6FB); border-radius: 10px; padding: 6px 10px; }
.perm-sub { margin-top: 8px; padding: 10px 12px; border: 1px dashed #cfd5df; border-radius: 10px; background: #f8fafc; }
.perm-sub[hidden] { display: none; }
.perm-sub > b { display: block; margin-bottom: 6px; }
/* أسئلة الطلبة: محادثة */
.qa-input { width: 100%; border: 1px solid var(--line2); border-radius: 12px; padding: 10px 12px; background: var(--card); color: var(--ink); font: inherit; resize: vertical; }
.qa-thread { display: flex; flex-direction: column; gap: 8px; border: 1px solid var(--line); border-radius: 14px; padding: 12px; background: var(--bg, transparent); }
.qa-msg { max-width: 85%; border-radius: 14px; padding: 8px 12px; display: flex; flex-direction: column; gap: 4px; word-break: break-word; }
.qa-msg .qa-meta { font-size: 12px; color: var(--muted); }
.qa-msg .qa-meta b { color: var(--ink); }
.qa-msg audio { width: 260px; max-width: 100%; height: 40px; }
.qa-dur { font-size: 11.5px; color: var(--muted); }
.qa-me { align-self: flex-start; background: var(--card); border: 1px solid var(--line2); border-start-start-radius: 4px; }
.qa-them { align-self: flex-end; background: var(--ok-bg); border-start-end-radius: 4px; }
.qa-them .qa-meta b { color: var(--green); }
.qa-admin .qa-me { background: var(--ok-bg); border: 0; }
.qa-admin .qa-me .qa-meta b { color: var(--green); }
.qa-admin .qa-them { background: var(--card); border: 1px solid var(--line2); }
.qa-admin .qa-them .qa-meta b { color: var(--ink); }
.qa-staff-wrap { align-self: flex-start; display: flex; align-items: flex-start; gap: 4px; max-width: 85%; }
.qa-staff-wrap .qa-msg { max-width: 100%; }
.qa-del { border: 0; background: none; color: var(--muted); cursor: pointer; font-size: 16px; line-height: 1; padding: 4px; opacity: .5; }
.qa-del:hover { opacity: 1; color: var(--bad, #B42318); }
.qa-reply { display: flex; gap: 8px; align-items: flex-end; margin-top: 4px; }
.qa-reply textarea { flex: 1; min-height: 40px; resize: none; }
.qa-compose { display: flex; flex-direction: column; gap: 8px; }
.qa-rec { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; background: var(--warn-bg); border-radius: 10px; padding: 6px 10px; font-weight: 700; }
.qa-rec-dot { width: 10px; height: 10px; border-radius: 50%; background: #B42318; opacity: .3; }
.qa-rec.on .qa-rec-dot { opacity: 1; animation: qaBlink 1s infinite; }
.qa-rec audio { height: 36px; max-width: 100%; }
@keyframes qaBlink { 50% { opacity: .2; } }
.qa-rec[hidden] { display: none; }
/* حماية المحتوى: رسالة لطالب + أماكن الدخول */
.msg-dlg { border: 0; border-radius: 16px; padding: 20px; width: min(480px, calc(100vw - 32px)); box-shadow: 0 20px 60px rgba(0,0,0,.25); background: var(--card, #fff); color: inherit; }
.msg-dlg::backdrop { background: rgba(15,23,42,.45); }
.msg-dlg textarea { width: 100%; }
.logins-row > td { background: var(--soft); }
.logins-row[hidden] { display: none; }
.logins-t { width: 100%; }
.logins-t td, .logins-t th { padding: 5px 8px; }

.lesson-chk { flex-wrap: wrap; padding: 10px 12px; border: 1px dashed var(--line); border-radius: 12px; }
