/* ================= تحديث التصميم العام: خلفية وبطاقات وقوائم وتبويبات عصرية ================= */
:root:not([data-theme="dark"]) { --bg: #F2F4FA; }
:root { --radius: 18px; --shadow: 0 1px 2px rgba(20,26,51,.04), 0 8px 28px rgba(31,58,147,.07); }
[data-theme="dark"] { --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 28px rgba(0,0,0,.25); }
body { background:
  radial-gradient(1100px 520px at 100% -10%, color-mix(in srgb, var(--ink) 9%, transparent), transparent 70%),
  radial-gradient(900px 480px at -10% 110%, color-mix(in srgb, var(--green) 7%, transparent), transparent 70%),
  var(--bg); background-attachment: fixed; }
.card { border-color: color-mix(in srgb, var(--border) 65%, transparent); border-radius: var(--radius); }
.card-head h3 { font-size: 16.5px; font-weight: 800; }
.sidebar { border-left: 1px solid var(--border); box-shadow: none; }
.nav a { border-radius: 12px; padding: 9px 12px; transition: background .15s, color .15s; }
.nav a.active { background: var(--ink); color: #fff; box-shadow: 0 6px 16px color-mix(in srgb, var(--ink) 30%, transparent); }
[data-theme="dark"] .nav a.active { color: #122019; }
.nav a.active .tag { color: inherit; }
.btn { border-radius: 12px; }
.btn.primary { background: linear-gradient(135deg, var(--ink), color-mix(in srgb, var(--ink) 70%, #4f7be8)); box-shadow: 0 4px 14px color-mix(in srgb, var(--ink) 25%, transparent); }
.btn:not(.primary):not(.ghost):hover { border-color: var(--ink); color: var(--ink); }
.list-item { padding: 11px 12px; margin-inline: -12px; border-bottom: 0; border-radius: 12px; transition: background .15s; }
.list-item + .list-item { margin-top: 2px; }
.list-item:hover { background: var(--surface-2); }
.tabs { background: var(--surface); border-radius: 999px; padding: 4px; box-shadow: var(--shadow); }
.tabs button { border-radius: 999px; padding: 7px 16px; }
.tabs button.on { background: var(--ink); color: #fff; box-shadow: none; }
[data-theme="dark"] .tabs button.on { color: #122019; }
.t tbody tr { transition: background .12s; }
.t tbody tr:hover td { background: color-mix(in srgb, var(--ink-soft) 45%, transparent); }
.input { border-radius: 12px; }
/* تبويبات الاختيار (الفصول وغيرها) */
/* بطاقات الحصص: رقم بارز، وخلفية متدرجة */
.lsn { padding: 14px; border-radius: 18px; background: linear-gradient(160deg, var(--surface), color-mix(in srgb, var(--ink-soft) 55%, var(--surface))); border-color: color-mix(in srgb, var(--border) 70%, transparent); }
.lsn::before { display: none; }
.lsn-top { margin-bottom: 8px; }
.lsn-no { display: inline-flex; align-items: center; gap: 6px; }
.lsn-no b { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 11px; background: var(--ink); color: #fff; font-size: 17px; margin: 0; }
.lsn-time::before { content: "🕘 "; font-size: 11px; }
.lsn.on { box-shadow: 0 0 0 3px var(--ink-soft), var(--shadow); }
.lsn.now .lsn-no b { background: var(--green); }
/* لوحة المعلم: رأس مدمج وبطاقتان سريعتان في الأعلى */
.tq { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid color-mix(in srgb, var(--border) 65%, transparent); border-radius: 16px; background: var(--surface); box-shadow: var(--shadow); color: inherit; font: inherit; text-align: start; }
.tq .t1 { font-weight: 700; font-size: 14px; } .tq .t2 { font-size: 12.5px; color: var(--muted); }
.tq-ic { width: 42px; height: 42px; flex: none; display: grid; place-items: center; border-radius: 12px; background: var(--ink-soft); font-size: 20px; }
.tq-go { cursor: pointer; transition: .15s; } .tq-go:hover { border-color: var(--ink); transform: translateY(-1px); }
/* صف الطالب: الحالة بجانب الاسم */
.att-name { flex: 0 1 auto; min-width: 180px; }
/* إعداد سجل الدرجات */
.gb-h { margin: 0 0 4px; font-size: 15px; }
.gb-item { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 8px; border-radius: 12px; background: var(--surface-2); }
.gb-item > .input:not([type]), .gb-item > input.input:not(.num) { flex: 1; min-width: 140px; }
.gb-item select.input { width: auto; }
.gb-item > input.input[data-ci]:not([type]) { flex: none; width: 60px; min-width: 0; }

/* لوحة المعلم: الترحيب وبطاقة الحصة المدمجة بمؤقتها في سطر واحد */
.t-top { display: grid; grid-template-columns: minmax(0, 1fr) minmax(300px, 470px); gap: 16px; align-items: center; margin-bottom: 14px; }
.t-hello h1 { font-family: var(--display); font-size: 28px; font-weight: 800; }
.t-hello p { color: var(--muted); margin: 2px 0 0; }
.lh-mini { display: flex; align-items: stretch; gap: 12px; padding: 12px 14px; border-radius: 18px; color: #fff; background: linear-gradient(135deg, #1f3a93, #3657c9 60%, #4f7be8); box-shadow: 0 10px 26px rgba(31,58,147,.28); }
.lh-mini .lm-info { flex: 1; min-width: 0; display: flex; flex-direction: column; justify-content: center; gap: 2px; }
.lh-mini .lm-k { font-size: 12px; opacity: .8; }
.lh-mini .lm-t { font-weight: 800; font-size: 16px; line-height: 1.4; }
.lh-mini .lm-s { font-size: 13px; opacity: .9; }
.lh-mini .lm-go { align-self: flex-start; margin-top: 6px; border: 0; border-radius: 999px; padding: 5px 12px; background: #fff; color: #1f3a93; font: inherit; font-weight: 800; font-size: 13px; cursor: pointer; }
.lh-mini .lm-timer { flex: none; width: 172px; box-sizing: border-box; display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 2px; padding: 8px 12px; border-radius: 14px; background: rgba(255,255,255,.14); }
.lh-mini .lm-timer.now { background: rgba(255,255,255,.2); }
.lh-mini .lm-n { font-size: 26px; font-weight: 800; letter-spacing: 1px; line-height: 1.1; }
.lh-mini .lm-prog { display: block; width: 100%; height: 4px; margin-top: 4px; border-radius: 4px; background: rgba(255,255,255,.25); overflow: hidden; }
.lh-mini .lm-prog i { display: block; height: 100%; background: #fff; }
/* إجابة المساعد الذكي مع زر إخفاء */
.ai-ans { position: relative; margin-top: 10px; padding: 10px 40px 10px 12px; border-radius: 12px; background: var(--surface-2); }
.ai-x { position: absolute; top: 6px; inset-inline-start: 6px; width: 28px; height: 28px; border: 0; border-radius: 50%; background: var(--surface); color: var(--muted); cursor: pointer; }
.ai-x:hover { color: var(--red); }
/* اختيار أيقونة ملاحظة الحصة */
.ic-pick { position: relative; }
.ic-btn { width: 48px; height: 40px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); font-size: 20px; cursor: pointer; }
.ic-pop { position: absolute; z-index: 5; top: 44px; inset-inline-start: 0; display: grid; grid-template-columns: repeat(6, 36px); gap: 4px; padding: 8px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); box-shadow: var(--shadow-lg); }
.ic-pop button { width: 36px; height: 36px; border: 0; border-radius: 10px; background: transparent; font-size: 20px; cursor: pointer; }
.ic-pop button:hover, .ic-pop button.on { background: var(--ink-soft); }
.ic-pop input { grid-column: 1 / -1; }

/* لوحة المعلم: الترحيب والمساعد في الشريط العلوي، والصف الأول بطاقة الحصة والبطاقتان السريعتان */
body[data-role="teacher"][data-page="dashboard"] #openPalette { display: none; }
.t-bar.t-hello { display: flex; flex-direction: column; line-height: 1.35; min-width: 0; }
.t-bar.t-hello b { font-family: var(--display); font-size: 19px; font-weight: 800; white-space: nowrap; }
.t-bar.t-hello span { font-size: 12px; color: var(--muted); white-space: nowrap; }
.t-bar.t-ai { position: relative; flex: 1; max-width: 560px; margin-inline: auto; }
.t-ai form { display: flex; align-items: center; gap: 8px; padding: 5px 5px 5px 8px; padding-inline-start: 14px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); box-shadow: var(--shadow); }
.t-ai form:focus-within { border-color: var(--ink); }
.t-ai input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--text); font: inherit; font-size: 14px; }
.t-ai .btn { border-radius: 999px; }
.t-ai .ai-ans { position: absolute; top: calc(100% + 8px); inset-inline: 0; z-index: 30; margin: 0; max-height: 60vh; overflow: auto; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-lg); }
.t-ai .ai-x { background: var(--surface-2); }
.t-top { grid-template-columns: minmax(300px, 1.3fr) minmax(220px, 1fr) minmax(220px, 1fr); align-items: stretch; }
.t-top .tq { height: 100%; }
@media (max-width: 1100px) { .t-top { grid-template-columns: 1fr 1fr; } .t-top .lh-mini { grid-column: 1 / -1; } }
@media (max-width: 760px) { .t-bar.t-hello { display: none; } .t-top { grid-template-columns: 1fr; } }
.t-bar.t-hello { flex: 0 1 auto; max-width: 300px; overflow: hidden; }
.t-bar.t-hello b, .t-bar.t-hello span { overflow: hidden; text-overflow: ellipsis; }
.t-bar.t-ai { min-width: 260px; }

/* لجنتي: بطاقة اللجنة مع المسح، ثم الإبلاغ والطلبات جنبًا إلى جنب */
.cm-head { display: grid; grid-template-columns: minmax(0, 1fr) minmax(280px, 420px); gap: 18px; margin-bottom: 14px; }
.cm-info h2 { font-family: var(--display); font-size: 24px; font-weight: 800; }
.cm-tally { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.cm-tally span { display: inline-flex; align-items: baseline; gap: 6px; padding: 6px 12px; border-radius: 12px; background: var(--surface-2); font-size: 13px; color: var(--muted); }
.cm-tally b { font-size: 20px; }
.cm-tally .P b { color: var(--ink); } .cm-tally .A b { color: var(--red); } .cm-tally .L b { color: var(--amber-text); } .cm-tally .N b { color: var(--muted); }
.cm-scan { padding: 14px; border-radius: 14px; background: var(--surface-2); }
.cm-row { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(260px, 1fr); gap: 14px; margin-bottom: 14px; }
.cm-req { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 8px; }
.cm-req .btn { justify-content: center; white-space: normal; text-align: center; }
.cm-list { max-height: 260px; overflow: auto; }
@media (max-width: 900px) { .cm-head, .cm-row { grid-template-columns: 1fr; } }
/* الترحيب بعرضه الكامل دون تداخل، والمساعد يتقلّص */
.topbar { gap: 16px; }
.t-bar.t-hello { flex: none; max-width: none; overflow: visible; }
.t-bar.t-ai { flex: 1 1 240px; min-width: 200px; max-width: 480px; margin-inline: 0 auto; }
@media (max-width: 1200px) { .t-bar.t-hello span { display: none; } }
.att-btns { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; }

/* سجل الدرجات: البند التلقائي قابل للتعديل */
.gb-auto-cell { display: inline-flex; align-items: center; gap: 4px; }
.gb-in.auto { background: var(--ink-soft); color: var(--ink); font-weight: 700; border-color: transparent; }
.gb-in.edited { border-color: var(--amber); background: var(--amber-soft); color: var(--amber-text); font-weight: 700; }
.gb-reset { width: 26px; height: 26px; border: 0; border-radius: 50%; background: var(--surface-2); color: var(--muted); cursor: pointer; }
.gb-reset:hover { color: var(--ink); }
/* تحضير الحصص: آخر عودة للصف في سطر الملاحظات */
.att-back { font-size: 12.5px; color: var(--muted); padding: 4px 10px; border-radius: 999px; background: var(--surface-2); }
.brand span { display: block; line-height: 1.5; }

/* خارج الصف الآن: سطر صغير لكل طالب */
/* أزرار رأس الصفحة بمحاذاة العنوان */
.page-head { align-items: center; }
/* إذن الخروج والإحالة في طرف سطر الطالب */
.att-btns { margin-inline-start: auto; }

/* سجل الدرجات: صفحة الفصول، والملاحظة فوق الجدول */
.gb-classes { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px; }
.gb-class { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; padding: 16px; text-align: start; border: 1px solid var(--border); border-radius: 18px; background: var(--surface); box-shadow: var(--shadow); color: inherit; font: inherit; cursor: pointer; transition: .15s; }
.gb-class:hover { border-color: var(--ink); transform: translateY(-2px); }
.gb-class .gb-cn { font-size: 17px; font-weight: 800; }
.gb-class .gb-cp { margin-top: 6px; font-size: 12.5px; color: var(--muted); }
.gb-class .gb-cp b { font-size: 20px; color: var(--ink); }
.gb-class.new { background: var(--surface-2); }
.gb-note { margin: 0 0 10px; color: var(--red); font-size: 13px; font-weight: 600; }
.paper-mis { margin-top: 10px; padding: 10px 12px; border-radius: 12px; background: var(--red-soft); color: var(--red); font-size: 13.5px; }

/* استلام موادي من الكنترول */
.tab-n { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; margin-inline-start: 4px; border-radius: 999px; background: var(--red); color: #fff; font-size: 11px; }
.recv-card { border-inline-start: 4px solid var(--amber); }
.recv-card.done { border-inline-start-color: var(--green); }
.recv-sub { display: inline-block; font-size: 12px; font-weight: 700; color: var(--ink); background: var(--ink-soft); padding: 1px 10px; border-radius: 999px; margin-bottom: 4px; }
.recv-stats { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.recv-stats span { padding: 6px 12px; border-radius: 12px; background: var(--surface-2); font-size: 13px; color: var(--muted); }
.recv-stats b { font-size: 18px; color: var(--text); margin-inline-end: 4px; }
.recv-stats .r b { color: var(--red); }
.recv-reps { margin-top: 10px; padding-top: 6px; border-top: 1px dashed var(--border); }

/* شاشة الدخول: نقاط تسويقية، والكشف في أعلى جهته تحت عبارة «مدرستك بلا ورق» */
.lead-list { list-style: none; margin: 0 0 26px; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.lead-list li { display: flex; align-items: flex-start; gap: 10px; font-size: 15.5px; line-height: 1.6; color: var(--text); }
.lead-list li span { flex: none; width: 30px; height: 30px; display: grid; place-items: center; border-radius: 9px; background: var(--ink-soft); font-size: 15px; }
.login-art { flex-direction: column; align-items: center; justify-content: flex-start; gap: 22px; padding-top: 56px; }

/* شاشة الدخول: عرض التنبيهات الذكية */
.al-stack { width: min(520px, 100%); display: flex; flex-direction: column; gap: 12px; }
.al-label { font-size: 13px; font-weight: 700; color: var(--muted); letter-spacing: .2px; }
.al-card { display: flex; align-items: flex-start; gap: 14px; padding: 16px 18px; border-radius: 18px; background: var(--surface); border: 1px solid color-mix(in srgb, var(--border) 70%, transparent); border-inline-start: 4px solid var(--ink); box-shadow: 0 10px 30px rgba(20,26,51,.08); opacity: 0; transform: translateY(14px) scale(.98); animation: alIn .5s cubic-bezier(.2,.8,.2,1) forwards; }
.al-ic { flex: none; width: 44px; height: 44px; display: grid; place-items: center; border-radius: 13px; background: var(--ink-soft); font-size: 21px; }
.al-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.al-top { display: flex; align-items: baseline; gap: 10px; }
.al-top b { flex: 1; font-size: 15px; }
.al-top small { color: var(--faint); font-size: 12px; white-space: nowrap; }
.al-body > span { font-size: 13.5px; color: var(--muted); }
.al-out { border-inline-start-color: var(--red); } .al-out .al-ic { background: var(--red-soft); }
.al-smart { border-inline-start-color: var(--ink); }
.al-prep { border-inline-start-color: var(--amber); } .al-prep .al-ic { background: var(--amber-soft); }
.al-quiet { border-inline-start-color: var(--blue); } .al-quiet .al-ic { background: var(--blue-soft); }
@keyframes alIn { to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .al-card { opacity: 1; transform: none; animation: none; } }
.login .lead-list { margin-top: 0; }
.login h1 em { font-style: normal; color: var(--ink); }
.login h1 { font-size: clamp(26px, 2.8vw, 38px); }
.login h1 .h-l { display: block; white-space: nowrap; }
.login h1 { font-size: clamp(22px, 2.35vw, 32px); }
@media (max-width: 420px) { .login h1 .h-l { white-space: normal; } }
.al-top small { font-variant-numeric: tabular-nums; }
/* البحث يُخفى حين يحل المساعد الذكي مكانه في الشريط العلوي (لوحات القيادة) */
.topbar:has(.t-ai) #openPalette { display: none; }
/* إن لم تتسع الأدوات (المرحلة والدور والأنظمة) والمساعد في سطر واحد يلتف الشريط بدل تمرير الصفحة أفقيًا */
.topbar { flex-wrap: wrap; row-gap: 10px; }

/* استئذان الموظفين */
.leave-card { border-inline-start: 4px solid var(--amber); }
.leave-card.approved { border-inline-start-color: var(--green); }
.leave-card.rejected { border-inline-start-color: var(--red); }
.leave-card.cancelled { border-inline-start-color: var(--border); opacity: .75; }

