/* =====================================================================
   منصة دار الذكر التعليمية — الهوية البصرية الموحّدة
   (دليل هوية مدارس دار الذكر: الأخضر والأصفر والبرتقالي والأزرق، خط GE Dinar One وPoppins — المتغيرات في brand.css)
   ===================================================================== */
:root {
  --bg: #f5f8f6; --card: #fff; --ink: #2f3133; --muted: #6b7470; --line: #e1e9e5;
  --brand: var(--dt-green); --brand-dark: var(--dt-green-dark); --brand2: var(--dt-mint); --brand-line: var(--dt-green-40);
  --primary: var(--brand); --accent: var(--dt-leaf); --gold: var(--dt-yellow); --orange: var(--dt-orange); --sky: var(--dt-blue); --pink: var(--dt-orange-dark);
  --ok: var(--dt-leaf-dark); --warn: var(--dt-orange-dark); --err: #c0392b;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(0, 60, 40, .04), 0 2px 8px rgba(0, 60, 40, .05);
  --font: var(--dt-font);
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body { font-family: var(--font); color: var(--ink); direction: rtl; font-size: 15px; line-height: 1.55; background: var(--bg); }
a { color: var(--brand); }
h1, h2, h3 { line-height: 1.3; margin: 0 0 .5em; }
button, input, select, textarea { font: inherit; }

/* بطاقة (الاسم القديم .glass باقٍ لتوافق الصفحات) */
.glass, .card-box { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }

/* الشريط العلوي الموحّد في assets/css/topbar.css */

/* ---------- عام ---------- */
.page { max-width: 1240px; margin: 0 auto; padding: 20px 18px 60px; }
.hero { padding: 20px 22px; margin-bottom: 18px; position: relative; overflow: hidden; border-inline-start: 5px solid var(--brand); }
.hero h1 { font-size: 1.45rem; color: var(--ink); }
.hero p { color: var(--muted); margin: 0; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.chip { padding: 3px 11px; border-radius: 999px; background: var(--brand2); color: var(--brand); font-weight: 600; font-size: .84rem; border: 1px solid var(--brand-line); }
.chip.teal { background: #E5F6EC; color: var(--accent); border-color: #99D9B8; }
.chip.pink { background: #FEF1E1; color: var(--warn); border-color: #FCD4A5; }
.chip.gray { background: #f1f3f5; color: var(--muted); border-color: var(--line); }
.chip.view-sw { cursor: pointer; font-family: inherit; opacity: .55; transition: .15s; }
.chip.view-sw:hover { opacity: .85; }
.chip.view-sw.on { opacity: 1; box-shadow: 0 0 0 2px currentColor inset; }

.section-title { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 24px 0 12px; }
.section-title h2 { font-size: 1.15rem; margin: 0; }

.grid { display: grid; gap: 12px; }
.grid.modules { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.grid.stats { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }

.module {
  padding: 16px; text-decoration: none; color: var(--ink); display: flex; flex-direction: column; gap: 6px;
  transition: border-color .15s, box-shadow .15s; position: relative; min-height: 124px;
}
a.module:hover { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand2); }
.module .ic { font-size: 1.7rem; }
.module b { font-size: 1rem; }
.module small { color: var(--muted); }
.module.soon { opacity: .7; }
.module .badge { position: absolute; top: 12px; inset-inline-start: 12px; font-size: .72rem; padding: 2px 9px; border-radius: 999px;
  background: #FEF1E1; color: var(--warn); border: 1px solid #FCD4A5; font-weight: 700; }

.stat { padding: 12px 14px; }
.stat .n { font-size: 1.7rem; font-weight: 700; color: var(--brand); }
.stat .l { color: var(--muted); font-weight: 600; font-size: .88rem; }

.card { padding: 16px; }

/* ---------- أزرار وحقول ---------- */
.btn { text-decoration: none; display: inline-flex; align-items: center; gap: 6px; justify-content: center;
  font-family: inherit; font-weight: 600; font-size: .93rem; cursor: pointer; border-radius: 10px; padding: 8px 14px;
  background: #fff; color: var(--ink); border: 1px solid var(--line); transition: border-color .15s, background .15s;
}
.btn:hover { border-color: var(--brand); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.primary { background: var(--brand); color: #fff; border-color: var(--brand); }
.btn.primary:hover { background: var(--brand-dark); }
.btn.danger { background: #fff; color: var(--err); border-color: #f0c4be; }
.btn.danger:hover { border-color: var(--err); background: #fdf0ee; }
.btn.ok { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn.ghost { background: transparent; }
.btn.sm { padding: 4px 10px; font-size: .84rem; }
.icon-btn { border: 0; background: transparent; font-size: 1.1rem; cursor: pointer; color: var(--muted); padding: 4px 8px; border-radius: 8px; }
.icon-btn:hover { background: rgba(0, 0, 0, .05); }

label.f { display: flex; flex-direction: column; gap: 4px; font-weight: 600; font-size: .88rem; color: var(--ink); }
input, select, textarea {
  font-family: inherit; font-size: .94rem; padding: 8px 10px; border-radius: 10px; border: 1px solid var(--line);
  background: #fff; color: var(--ink); outline: none; min-width: 0;
}
input:focus, select:focus, textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand2); }
input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--brand); }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 12px; }
.toolbar .grow { flex: 1; min-width: 180px; }
.hint { color: var(--muted); font-size: .86rem; }

/* ---------- جداول ---------- */
.table-wrap { overflow: auto; border-radius: var(--radius); border: 1px solid var(--line); background: #fff; max-height: 64vh; }
table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th, td { padding: 8px 12px; text-align: right; unicode-bidi: plaintext; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { position: sticky; top: 0; background: #fafbfc; font-weight: 700; color: var(--ink); z-index: 1; }
tr:hover td { background: #F6FAF8; }
td.actions { display: flex; gap: 4px; }
.empty { text-align: center; color: var(--muted); padding: 26px; }
.pill { padding: 1px 9px; border-radius: 999px; font-size: .78rem; font-weight: 700; }
.pill.on { background: #E5F6EC; color: var(--accent); } .pill.off { background: #fdecea; color: var(--err); }

/* ---------- تبويبات ---------- */
.tabs { display: flex; flex-wrap: wrap; gap: 4px; padding: 6px; margin-bottom: 16px; }
.tabs button { font-family: inherit; border: 0; background: transparent; padding: 8px 14px; border-radius: 10px; font-weight: 600; color: var(--muted); cursor: pointer; font-size: .92rem; }
.tabs button:hover { color: var(--brand); background: var(--brand2); }
.tabs button.on { background: var(--brand); color: #fff; }
.tab-pane { display: none; } .tab-pane.on { display: block; }

/* ---------- نافذة منبثقة ---------- */
.modal-wrap { position: fixed; inset: 0; background: rgba(47,49,51, .4); z-index: 100; display: grid; place-items: center; padding: 16px; animation: fade .15s; }
.modal { width: min(560px, 100%); max-height: 90vh; display: flex; flex-direction: column; background: #fff; }
.modal.wide { width: min(980px, 100%); }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; border-bottom: 1px solid var(--line); background: #fafbfc; border-radius: var(--radius) var(--radius) 0 0; }
.modal-head h3 { margin: 0; font-size: 1.05rem; }
.modal-body { padding: 16px; overflow: auto; }
.modal-foot { display: flex; gap: 8px; justify-content: flex-start; padding: 12px 16px; border-top: 1px solid var(--line); }
.confirm-msg { margin: 0; font-size: 1rem; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

/* ---------- رسائل ---------- */
#toasts { position: fixed; bottom: 20px; left: 20px; z-index: 200; display: flex; flex-direction: column; gap: 8px; }
.toast { padding: 10px 16px; border-radius: 12px; color: #fff; font-weight: 600; box-shadow: 0 8px 24px -8px rgba(0,0,0,.35); max-width: 420px; background: var(--brand); transition: .35s; }
.toast.err { background: var(--err); }
.toast.warn { background: var(--warn); }
.toast.out { opacity: 0; transform: translateY(10px); }

/* ---------- صفحة الدخول ---------- */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 20px;
  background: linear-gradient(180deg, var(--brand) 0 210px, var(--bg) 210px); }
.login { width: min(440px, 100%); padding: 30px 28px; text-align: center; }
.login .logo-full { width: 180px; max-width: 70%; margin: 0 auto 10px; display: block; }
.login h1 { font-size: 1.4rem; }
.login p { color: var(--muted); }
.gbtn { display: inline-flex; align-items: center; gap: 10px; justify-content: center; width: 100%; padding: 12px; font-size: 1rem; margin-top: 10px; }
.gbtn svg { width: 22px; height: 22px; background: #fff; border-radius: 50%; padding: 2px; }
.notice { margin-top: 14px; padding: 10px 12px; border-radius: 12px; font-weight: 600; text-align: right; background: #fff8e6; border: 1px solid #f1d58a; color: #6b4e00; }
.notice.err { background: #fdecea; border-color: #f0c4be; color: #8f2a1f; } .notice.warn { background: #fff8e6; border-color: #f1d58a; color: #6b4e00; }
.notice.info { background: var(--brand2); border-color: var(--brand-line); color: #00553A; }

.loader { display: grid; place-items: center; padding: 60px; color: var(--muted); font-weight: 600; }
.spin { width: 36px; height: 36px; border-radius: 50%; border: 4px solid var(--brand2); border-top-color: var(--brand); animation: sp 1s linear infinite; margin-bottom: 10px; }
@keyframes sp { to { transform: rotate(360deg); } }

.report { padding: 12px; border-radius: 12px; background: #fafbfc; border: 1px solid var(--line); margin-top: 12px; }
.report .row { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.errors-list { max-height: 260px; overflow: auto; font-size: .9rem; }
.errors-list div { padding: 4px 0; border-bottom: 1px dashed #f0c4be; color: #8f2a1f; }
.map-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }
.star { color: var(--err); }
.drop { display: block; border: 2px dashed var(--brand-line); border-radius: 14px; padding: 22px; text-align: center; cursor: pointer; background: #fff; }
.drop:hover { background: var(--brand2); }

footer.credit { text-align: center; color: var(--muted); font-size: .82rem; padding: 20px; }

@media (max-width: 720px) {
  html, body { overflow-x: hidden; }
  .hero h1 { font-size: 1.25rem; }
  .page { padding: 14px 10px 50px; }
}

/* ---------- الهجري بجانب حقول التاريخ + أدوات الجداول ---------- */
.hijri-hint { display: inline-block; margin-inline-start: 6px; color: var(--accent); font-size: .78rem; font-weight: 600; white-space: nowrap; }
.tbl-tools { display: flex; gap: 6px; justify-content: flex-end; margin: 4px 0 6px; }
.tbl-tools .btn { padding: 3px 10px; font-size: .8rem; }
@media print { #topbar, .tbl-tools, .no-print, .credit { display: none !important; } }

/* ---------- الرئيسية: وحدات خارجية + قسم «قيد الإنشاء» ---------- */
.module .ext { position: absolute; top: 10px; inset-inline-end: 12px; font-size: .9rem; color: var(--muted); font-weight: 700; }
.soon-box { margin-top: 22px; }
.soon-box > summary { cursor: pointer; list-style: none; display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.soon-box > summary::-webkit-details-marker { display: none; }
.soon-box > summary::before { content: '◂'; color: var(--muted); transition: transform .2s; }
.soon-box[open] > summary::before { transform: rotate(-90deg); }
.soon-box > summary h2 { margin: 0; font-size: 1.05rem; color: var(--muted); }

/* ---------- الرئيسية: لوحة «يومي» ---------- */
.today { padding: 16px 18px; margin-bottom: 16px; border-inline-start: 5px solid var(--gold); }
.today h3 { font-size: .95rem; margin: 0 0 8px; }
.today-grid { display: grid; grid-template-columns: 1fr auto; gap: 16px; align-items: start; }
.today-periods { display: flex; flex-wrap: wrap; gap: 8px; }
.today-periods .tp { display: grid; grid-template-columns: auto 1fr; column-gap: 8px; align-items: center; background: var(--brand2); border: 1px solid var(--brand-line); border-radius: 10px; padding: 6px 10px; min-width: 130px; }
.today-periods .tp i { grid-row: span 2; font-style: normal; font-weight: 700; color: #fff; background: var(--brand); border-radius: 8px; width: 28px; height: 28px; display: grid; place-items: center; }
.today-periods .tp b { font-size: .9rem; }
.today-periods .tp small { color: var(--muted); font-size: .78rem; }
.today-tiles { display: flex; gap: 8px; }
.today-tile { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-width: 104px; padding: 10px 8px; border: 1px solid var(--line); border-radius: 12px; text-decoration: none; color: var(--ink); background: #fff; text-align: center; }
.today-tile:hover { border-color: var(--brand); }
.today-tile span { font-size: 1.3rem; }
.today-tile b { font-size: 1.2rem; color: var(--muted); min-height: 1em; }
.today-tile.hot b { color: var(--pink); }
.today-tile small { font-size: .78rem; color: var(--muted); }
@media (max-width: 720px) {
  .today-grid { grid-template-columns: 1fr; }
  .today-tiles { justify-content: stretch; } .today-tile { flex: 1; min-width: 0; }
}
.today-periods .tp .att-ok { color: var(--ok); font-weight: 600; }
.today-periods .tp .att-no { color: var(--muted); }
.today-periods .tp.ok { background: #E5F6EC; border-color: #99D9B8; }
.today-periods .tp.ok i { background: var(--ok); }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }

/* ---------- الوضع التجريبي (ديمو) ---------- */
.demo-band{position:sticky;top:0;z-index:60;display:flex;flex-wrap:wrap;gap:6px 16px;align-items:center;justify-content:center;
  background:#00603F;color:#fff;font-size:13px;padding:6px 12px;line-height:1.5;text-align:center}
.demo-band a{color:#ffe08a;font-weight:600;text-decoration:none}
.demo-band a:hover{text-decoration:underline}
.demo-band .db-r{opacity:.95}
.demo-roles{display:grid;grid-template-columns:repeat(auto-fill,minmax(150px,1fr));gap:10px;margin:12px 0 6px}
.demo-roles button{display:flex;flex-direction:column;align-items:center;gap:4px;padding:14px 10px;border:1px solid var(--line,#dfe5ec);border-radius:14px;
  background:#fff;cursor:pointer;font:inherit;transition:transform .15s,box-shadow .15s,border-color .15s}
.demo-roles button:hover,.demo-roles button:focus-visible{transform:translateY(-2px);border-color:#00603F;box-shadow:0 6px 18px rgba(0,96,63,.15)}
.demo-roles button span{font-size:1.6rem}
.demo-roles button small{color:var(--muted,#667);font-size:12px}
.demo-link{display:inline-block;margin-top:16px;color:#00603F;font-weight:600;cursor:pointer;background:none;border:0;font:inherit;text-decoration:underline}

.today-periods .tp.clk { cursor: pointer; transition: box-shadow .15s, border-color .15s; } .today-periods .tp.clk:hover, .today-periods .tp.clk:focus-visible { border-color: var(--brand); box-shadow: 0 3px 10px rgba(0,123,81,.15); }
button.att-box { font: inherit; text-align: inherit; cursor: pointer; border: 1px solid var(--line); background: #fff; } button.att-box:hover { border-color: var(--brand); }

/* ---------- لمسات الهوية (عناصر دوائر دار الذكر) ---------- */
.hero { border-inline-start-color: var(--dt-green); }
.hero::after { content: ''; position: absolute; inset-inline-end: -14px; top: -14px; width: 92px; height: 92px; pointer-events: none;
  background: url('../img/brand/deco-top.svg') no-repeat center / contain; opacity: .9; }
[dir="rtl"] .hero::after { transform: scaleX(-1); }
.hero h1, .hero p { position: relative; z-index: 1; }
.hero h1 { color: var(--dt-green); }
::selection { background: var(--dt-yellow-40); }

/* شارة «تجريبي» على بطاقات الوحدات التجريبية */
.module { position: relative; }
.module .beta-badge { position: absolute; top: 10px; inset-inline-end: 12px; font-size: .72rem; font-weight: 700; color: #8a5a00; background: #fff4d6; border: 1px solid #f0d58a; padding: 1px 8px; border-radius: 999px; }

/* بطاقة وحدة بلا صلاحية: تظهر للتعريف بإمكانات المنصة وتعرض رسالة عند الضغط */
.module.locked { opacity: .62; filter: grayscale(.55); cursor: not-allowed; }
.module.locked:hover { opacity: .8; transform: none; }
.module.locked .lock { position: absolute; top: 10px; inset-inline-start: 12px; font-size: .95rem; }

/* «مهامي» في الرئيسية */
.my-tasks { padding: 12px 14px; } .my-tasks .mt-list { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.my-tasks .mt-list a { background: #F5F8F6; border: 1px solid var(--line); border-radius: 99px; padding: 4px 12px; text-decoration: none; color: inherit; font-size: .9rem; }
.my-tasks .mt-list a:hover { border-color: var(--brand); }

/* تنبيهات الجوال */
.push-card { padding: 12px 14px; margin-bottom: 14px; border: 1px solid #cfe9dc; background: #f3fbf7; }
.push-help { margin-top: 8px; font-size: .88rem; line-height: 1.9; background: #fff; border-radius: 10px; padding: 8px 10px; border: 1px solid var(--line); }
.push-mini { font-size: .85rem; color: var(--muted); margin: -4px 0 12px; } .push-mini a { color: var(--brand); }

/* بيانات منصة الموهبة في ملف الطالب ودليل الموظفين */
.tl-h { margin: 14px 0 6px; font-size: .95rem; }
.tag.win { background: #fff6d8; color: #8a6400; } .tag.fin { background: #e8f1fb; color: #2b5f8f; } .tag.q { background: #e6f6ee; color: #007B51; }
.tl-chip { display: block; width: 100%; text-align: start; margin-top: 6px; border: 1px dashed #e0c36a; background: #fffbea; color: #7a5a00; border-radius: 10px; padding: 4px 8px; font: inherit; font-size: .8rem; cursor: pointer; }
.tl-chip:hover { background: #fff3c4; }
.tl-chip.inline { display: inline-block; width: auto; margin: 0 4px; padding: 0 6px; }

/* ترحيل الطلاب */
.promo-card { border: 1px solid #cfe9dc; background: #f3fbf7; padding: 14px; }
.promo-res { max-height: 200px; overflow: auto; } .promo-res a { display: block; padding: 6px; border-bottom: 1px solid #f1f3f2; text-decoration: none; color: inherit; } .promo-res a:hover { background: #F5F8F6; }
.promo-kpi { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 8px 0; } .promo-kpi div { background: #F5F8F6; border-radius: 10px; padding: 8px; text-align: center; }
.promo-kpi b { display: block; font-size: 1.4rem; color: var(--brand); } .promo-kpi span { font-size: .8rem; color: var(--muted); }
.chk { display: flex; gap: 8px; align-items: center; margin: 6px 0; cursor: pointer; }
footer.credit .prod { opacity: .75; white-space: nowrap; }

/* ---------- صفحة التفاصيل الكاملة (بدل النافذة المنبثقة الكبيرة) ---------- */
html.pg-open, html.pg-open body { overflow: hidden; }
.modal-wrap.pgfull, body.lms-solo .modal-wrap.pgfull { display: block; padding: 0; background: var(--bg, #f5f8f6); overflow: auto; animation: pgin .18s ease-out; }
.modal-wrap.pgfull .modal, body.lms-solo .modal-wrap.pgfull .modal { width: 100%; max-width: none; max-height: none; min-height: 100%; border-radius: 0; border: 0; box-shadow: none; background: transparent; display: flex; flex-direction: column; }
.modal-wrap.pgfull .modal-head, body.lms-solo .modal-wrap.pgfull .modal-head { position: sticky; top: 0; z-index: 5; border-radius: 0; background: var(--brand, #007B51); color: #fff; padding: 10px max(16px, calc((100% - 1100px) / 2)); gap: 12px; justify-content: flex-start; box-shadow: 0 2px 10px rgba(0,0,0,.12); }
.modal-wrap.pgfull .modal-head h3 { color: #fff; font-size: 1.15rem; flex: 1; }
.modal-wrap.pgfull .pg-back, body.lms-solo .modal-wrap.pgfull .pg-back { background: rgba(255,255,255,.16); color: #fff; border: 1px solid rgba(255,255,255,.35); white-space: nowrap; }
.modal-wrap.pgfull .pg-back:hover { background: rgba(255,255,255,.28); }
.modal-wrap.pgfull .modal-body, body.lms-solo .modal-wrap.pgfull .modal-body { width: 100%; max-width: 1100px; margin: 0 auto; padding: 18px 16px 28px; overflow: visible; flex: 1; }
.modal-wrap.pgfull .modal-foot, body.lms-solo .modal-wrap.pgfull .modal-foot { position: sticky; bottom: 0; background: #fff; border-top: 1px solid var(--line, #e1e9e5); padding: 10px max(16px, calc((100% - 1100px) / 2)); }
@keyframes pgin { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
/* أقسام صفحة التفاصيل */
.pg-hero { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; padding: 16px 18px; background: #fff; border: 1px solid var(--line, #e1e9e5); border-inline-start: 5px solid var(--brand, #007B51); border-radius: 14px; margin-bottom: 14px; }
.pg-hero .ic { font-size: 2.4rem; line-height: 1; }
.pg-hero h2 { margin: 0; font-size: 1.35rem; }
.pg-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; margin-bottom: 14px; }
.pg-grid .kv { background: #fff; border: 1px solid var(--line, #e1e9e5); border-radius: 12px; padding: 10px 12px; }
.pg-grid .kv .k { color: var(--muted, #6b7470); font-size: .82rem; }
.pg-grid .kv .v { font-weight: 700; margin-top: 2px; }
.pg-sec { background: #fff; border: 1px solid var(--line, #e1e9e5); border-radius: 14px; padding: 14px 16px; margin-bottom: 14px; }
.pg-sec > h3 { margin: 0 0 10px; font-size: 1.05rem; }
/* اسم قابل للضغط يفتح صفحة التفاصيل */
.nm-link { background: none; border: 0; padding: 0; margin: 0; font: inherit; font-weight: 700; color: inherit; cursor: pointer; text-align: inherit; text-decoration: underline dotted rgba(0,123,81,.45); text-underline-offset: 5px; }
.nm-link:hover, .nm-link:focus-visible { color: var(--brand, #007B51); text-decoration-style: solid; }
