@import url(./fonts.css);

:root {
  --navy: #16244A; --teal: #0B7A75; --teal-soft: #E3F1F0; --amber: #F0A53A; --amber-soft: #FDF3E2;
  --bg: #F3F5F7; --ink: #1A2233; --muted: #5F6B7A; --line: #DCE1E7; --red: #B8412F; --red-soft: #F8E7E4;
  --accent: var(--teal);
  /* ألوان حالات الحضور (نفس ألوان أزرار الحضور الأصلية) */
  --amber-ink: #8A5A00; --violet: #6B5B95; --violet-soft: #EFEBF7; --navy-soft: #EAEEF6;
}
body.owner { --accent: var(--navy); }
body.teacher { --accent: #1F5FA8; }

* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: 'IBM Plex Sans Arabic', system-ui, sans-serif; background: var(--bg); color: var(--ink); line-height: 1.6; min-height: 100vh; display: flex; flex-direction: column; }
main { --gut: 16px; width: 100%; max-width: 960px; margin: 0 auto; padding: var(--gut); flex: 1; }
h1, h2, h3, .brand { font-family: 'IBM Plex Sans Arabic', system-ui, sans-serif; font-weight: 700; }
h2 { font-size: 19px; margin: 0 0 12px; color: var(--navy); }
a { color: var(--accent); }
:focus-visible { outline: 3px solid var(--amber); outline-offset: 2px; }

/* الشريط العلوي */
.topbar { background: var(--accent); color: #fff; }
.topbar .in { max-width: 960px; margin: 0 auto; padding: 12px 16px; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.topbar .who { display: flex; align-items: center; gap: 10px; min-width: 0; }
.topbar .brand { font-size: 20px; line-height: 1.1; }
.topbar small { display: block; opacity: .85; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-logo { height: 38px; width: auto; display: block; flex: none; }
.topbar .school { border-inline-start: 1px solid rgba(255,255,255,.35); padding-inline-start: 12px; min-width: 0; }
.topbar .school b { display: block; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .school.with-logo { display: flex; align-items: center; gap: 10px; }
.topbar .school-text { min-width: 0; }
.school-logo { width: 38px; height: 38px; flex: none; object-fit: contain; background: #fff; border-radius: 10px; padding: 3px; box-shadow: 0 1px 3px rgba(0,0,0,.15); }
@media (max-width: 480px) { .school-logo { width: 32px; height: 32px; } }
.hero-logo { height: 150px; width: auto; display: block; margin: 0 auto; }
@media (max-width: 719px) { .hero-logo { height: 126px; } }
.print-logo { height: 48px; }

/* عناصر */
.panel { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 16px; margin-bottom: 14px; }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.panel-head h2 { margin: 0; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
.row > * { flex: 1; min-width: 150px; }
.row > .btn, .row > .switch { flex: none; min-width: 0; }
/* على الجوال: أي صف فيه 3 حقول أو أكثر (اسم/رمز/رقم...) يتراص عموديًا بدل ما يتزاحم بعرض ضيق */
@media (max-width: 480px) {
  .row:has(> .f:nth-child(3)) { flex-direction: column; align-items: stretch; }
  .row:has(> .f:nth-child(3)) > .f { width: 100%; min-width: 0; }
}
label.f { display: block; margin-bottom: 12px; }
[hidden] { display: none !important; }
label.f > span { display: block; font-size: 13px; color: var(--muted); margin-bottom: 4px; }
label.f.remember-row { display: flex; align-items: center; gap: 8px; margin-bottom: 16px; cursor: pointer; }
label.f.remember-row input { margin: 0; width: 16px; height: 16px; flex: none; }
label.f.remember-row span { display: inline; margin-bottom: 0; font-size: 14px; color: var(--text, #1c1c1c); }
input, select, textarea { width: 100%; padding: 9px 11px; border: 1px solid var(--line); border-radius: 8px; font: inherit; font-size: 15px; background: #fff; color: var(--ink); }
input[type=checkbox] { width: auto; }
/* خانة اختيار مع نصها: الخانة بجانب النص مباشرة في سطر واحد (كانت تنفصل عنه لأن label.f كتلة) */
label.f.pill { display: flex; align-items: center; justify-content: flex-start; gap: 10px; cursor: pointer; }
label.f.pill > input[type=checkbox], label.f.pill > input[type=radio] { width: 20px; height: 20px; min-height: 0; flex: none; margin: 0; accent-color: var(--accent); }
.ltr { direction: ltr; text-align: left; }

/* ---------- نظام الأزرار الموحد ----------
   primary: الإجراء الرئيسي | secondary: إجراء ثانوي بإطار | ghost: محايد | soft: خفيف | danger: حذف وإلغاء
   whatsapp / contact: التواصل | open: فتح رابط | copy: نسخ | trial: التجربة المجانية
   كل زر له حالات: hover، pressed (active)، disabled، وتركيز لوحة المفاتيح (focus-visible). */
.btn { --b-bg: var(--accent); --b-fg: #fff; --b-bd: transparent; --b-hover: var(--b-bg);
  font: inherit; font-weight: 600; font-size: 14px; padding: 9px 16px; border-radius: 8px; border: 1px solid var(--b-bd);
  background: var(--b-bg); color: var(--b-fg); cursor: pointer; white-space: nowrap; text-decoration: none;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; transition: background .15s, border-color .15s, transform .05s; }
.btn:hover { background: var(--b-hover); filter: brightness(.96); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:focus-visible { outline: 3px solid rgba(11, 122, 117, .35); outline-offset: 2px; }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; transform: none; }
.btn svg { flex: none; }
.btn.primary { --b-bg: var(--accent); --b-fg: #fff; }
.btn.secondary { --b-bg: #fff; --b-fg: var(--accent); --b-bd: var(--accent); --b-hover: var(--teal-soft); }
.btn.ghost { --b-bg: #fff; --b-fg: var(--ink); --b-bd: var(--line); --b-hover: #F4F6F9; }
.btn.soft { --b-bg: var(--teal-soft); --b-fg: var(--teal); --b-hover: #D3EAE8; }
.btn.danger { --b-bg: #fff; --b-fg: var(--red); --b-bd: var(--red); --b-hover: #FDECEA; }
.btn.whatsapp { --b-bg: #1FA855; --b-fg: #fff; --b-hover: #188C46; }
.btn.contact { --b-bg: var(--navy); --b-fg: #fff; --b-hover: #0F1B38; }
.btn.open { --b-bg: #fff; --b-fg: var(--accent); --b-bd: var(--line); --b-hover: var(--teal-soft); }
.btn.copy { --b-bg: #F4F6F9; --b-fg: var(--ink); --b-bd: var(--line); --b-hover: #E8ECF2; }
.btn.copy.done { --b-bg: var(--teal-soft); --b-fg: var(--teal); --b-bd: var(--teal); }
.btn.trial { --b-bg: var(--amber); --b-fg: #fff; --b-hover: #D98F24; }
.btn.sm { padding: 5px 10px; font-size: 13px; }
.btn.wide { width: 100%; }

/* التنقل بين الأقسام — الجوال والشاشات المتوسطة: شريط أفقي مثبّت أعلى الشاشة عند التمرير،
   كل قسم أيقونة فوق اسمه، والقسم المفتوح يتوسط الشريط تلقائيًا */
.tabs {
  display: flex; gap: 4px; overflow-x: auto; overscroll-behavior-x: contain; scroll-snap-type: x proximity;
  scrollbar-width: none; -webkit-overflow-scrolling: touch;
  position: sticky; top: 0; z-index: 15;
  background: rgba(255, 255, 255, .96); backdrop-filter: saturate(1.4) blur(8px); -webkit-backdrop-filter: saturate(1.4) blur(8px);
  border-bottom: 1px solid var(--line); box-shadow: 0 2px 10px rgba(16, 38, 64, .05);
  margin: 0 calc(-1 * var(--gut, 16px)) 16px; padding: 8px calc(var(--gut, 16px) - 4px);
}
.tabs::-webkit-scrollbar { display: none; }
.tabs-layout:first-child > .tabs { margin-top: calc(-1 * var(--gut, 16px)); }
.tabs button {
  flex: none; scroll-snap-align: center; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  min-width: 70px; min-height: 54px; padding: 6px 10px; border: none; border-radius: 12px; background: none;
  font: inherit; font-size: 12px; line-height: 1.25; color: var(--muted); cursor: pointer; white-space: nowrap;
  transition: background .15s, color .15s;
}
.tabs button .icon { flex: none; opacity: .85; }
.tabs button:hover { background: var(--bg); color: var(--ink); }
.tabs button.on { background: var(--teal-soft); color: var(--accent); font-weight: 700; }
.tabs button.on .icon { opacity: 1; }
.tabs button:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }

.line { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 0; border-top: 1px solid var(--line); }
.sub { font-size: 13px; color: var(--muted); }
.empty { color: var(--muted); font-size: 14px; margin: 6px 0; }
.badge { display: inline-block; padding: 1px 9px; border-radius: 20px; font-size: 12px; font-weight: 700; color: var(--teal); background: var(--teal-soft); }
.badge.red { color: var(--red); background: var(--red-soft); }
.badge.amber { color: #8A5A00; background: var(--amber-soft); }
.badge.gray { color: var(--muted); background: var(--bg); }
.notice { padding: 10px 12px; border-radius: 8px; margin-bottom: 12px; font-size: 14px; background: var(--teal-soft); }
.notice.warn { background: var(--amber-soft); }
.notice.err { background: var(--red-soft); color: var(--red); }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; margin-bottom: 14px; }
.stat { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 14px; }
.stat b { display: block; font-size: 24px; color: var(--accent); }

.bar { height: 8px; background: var(--bg); border-radius: 4px; overflow: hidden; margin: 6px 0; }
.bar > i { display: block; height: 100%; background: var(--accent); }

.chips { display: flex; gap: 5px; flex-wrap: wrap; }
.chip { font: inherit; font-size: 13px; font-weight: 600; padding: 5px 11px; border-radius: 20px; background: #fff; cursor: pointer; border: 1.5px solid currentColor; }
.chip.on { color: #fff !important; }

.switch { position: relative; width: 44px; height: 24px; border-radius: 12px; border: none; background: var(--line); cursor: pointer; flex: none; }
.switch::after { content: ""; position: absolute; top: 3px; right: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: right .15s; }
.switch[aria-checked=true] { background: var(--teal); }
.switch[aria-checked=true]::after { right: 23px; }

.key { font-family: ui-monospace, Menlo, monospace; direction: ltr; display: inline-block; background: var(--amber-soft); border: 1px dashed var(--amber); padding: 2px 8px; border-radius: 6px; font-weight: 700; letter-spacing: 1px; }

table.grid { border-collapse: collapse; width: 100%; font-size: 14px; }
table.grid th, table.grid td { padding: 8px; border-bottom: 1px solid var(--line); text-align: right; }
table.grid th { color: var(--muted); font-weight: 600; }
.scroll { overflow-x: auto; }

/* تسجيل الدخول */
.auth-hero { background: var(--navy); color: #fff; padding: 36px 20px 70px; }
.auth-hero .in { max-width: 420px; margin: 0 auto; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.auth-hero .brand { font-size: 36px; }
.auth-card { max-width: 420px; width: calc(100% - 32px); margin: -40px auto 20px; background: #fff; border: 1px solid var(--line);
  border-radius: 14px; padding: 20px 18px; box-shadow: 0 12px 30px rgba(22, 36, 74, .08); }
.auth-card > h2 { text-align: center; margin-bottom: 6px; }
.auth-card > .sub { text-align: center; margin-bottom: 16px; }

/* النوافذ */
dialog { border: none; border-radius: 14px; padding: 0; width: min(440px, calc(100% - 32px)); }
dialog::backdrop { background: rgba(22, 36, 74, .45); }
dialog .d-in { padding: 18px; }
/* أزرار الحوار ثابتة أسفله: زر الإرسال ظاهر دائمًا حتى لو كان النموذج أطول من شاشة الجوال */
dialog:modal { max-height: calc(100dvh - 24px); overflow: auto; overscroll-behavior: contain; }
dialog .d-in > .row.spaced:last-child { position: sticky; bottom: -18px; background: #fff; margin: 0 -18px -18px; padding: 12px 18px 18px;
  border-top: 1px solid var(--line); z-index: 2; }

/* صفحة الطلاب */
.class-card { background: #fff; border: 1px solid var(--line); border-radius: 12px; margin-bottom: 12px; overflow: hidden; }
.class-card > h3 { margin: 0; padding: 12px 16px; background: var(--navy); color: #fff; font-size: 17px; display: flex; justify-content: space-between; }
.class-head { width: 100%; font: inherit; font-size: 17px; font-weight: 700; text-align: right; color: #fff; background: var(--navy);
  border: none; padding: 13px 16px; cursor: pointer; display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.class-head:hover { filter: brightness(1.12); }
.class-head .icon { transition: transform .15s ease; opacity: .85; transform: rotate(-90deg); }
.class-head.open .icon { transform: rotate(0); }
.teachers { padding: 10px 14px 4px; border-bottom: 1px solid var(--line); }
.teachers h4 { margin: 0 0 6px; font-size: 14px; color: var(--muted); }
.names button { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.linkish { font: inherit; background: none; border: none; color: var(--accent); font-weight: 600; cursor: pointer; padding: 0; }
.names { list-style: none; margin: 0; padding: 6px 8px; display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.names button { font: inherit; width: 100%; text-align: right; padding: 10px; background: none; border: none; border-radius: 8px; cursor: pointer; color: var(--ink); }
.names button:hover { background: var(--teal-soft); }

.profile-head { background: var(--navy); color: #fff; border-radius: 14px; padding: 18px; margin-bottom: 14px; }
.profile-head h1 { margin: 0; font-size: 26px; }
.profile-head .kpis { display: flex; gap: 24px; flex-wrap: wrap; margin-top: 12px; }
.profile-head .kpis b { display: block; font-size: 22px; color: var(--amber); }

.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--navy); color: #fff; padding: 10px 16px; border-radius: 10px; font-size: 14px; z-index: 50; max-width: calc(100% - 32px); }
.toast.err { background: var(--red); }

footer.dev { text-align: center; padding: 14px; font-size: 12px; color: var(--muted); }
.hidden { display: none !important; }

@media print {
  /* هامش الصفحة صفر: المتصفح لا يجد مكانًا لطباعة الرابط والتاريخ وعنوان الصفحة أعلى الورقة وأسفلها،
     والمسافة عن حافة الورقة تُعطى للمحتوى نفسه */
  @page { margin: 0; }
  body { padding: 12mm 12mm 14mm !important; box-decoration-break: clone; -webkit-box-decoration-break: clone; }
  .topbar, .tabs, .btn, footer.dev { display: none !important; }
  body { background: #fff; }
  /* القائمة الجانبية مخفية في الطباعة: المحتوى يأخذ عرض الورقة كاملًا */
  .tabs-layout { display: block !important; }
  main { max-width: none !important; padding: 0 !important; margin: 0 !important; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
.loading { text-align: center; padding: 40px; }
.notfound { text-align: center; padding-top: 80px; }

.auth-hero .role { font-size: 17px; margin: 10px 0 0; opacity: .92; letter-spacing: .3px; }
.version-conflict { outline: 2px solid var(--red); }
.muted-row { opacity: .6; }
.pill { display: inline-flex; align-items: center; gap: 6px; }
.small { font-size: 12px; }
.spaced { margin-top: 12px; }
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 10px; }
.toolbar > input, .toolbar > select { flex: 1; min-width: 160px; }
.danger-text { color: var(--red); }
.print-only { display: none; }
@media print { .print-only { display: block; } }

.sec-title { margin: 16px 0 6px; font-size: 16px; color: var(--navy); }
.bank-card { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin-bottom: 8px; background: #FBFCFD; }
.bank-card .line:first-of-type { border-top: none; }
.key { word-break: break-all; max-width: 100%; }
.key.plain { font-family: inherit; letter-spacing: 0; direction: rtl; }
.pill { flex-wrap: wrap; justify-content: flex-end; }

.blank-home { display: flex; align-items: center; justify-content: center; min-height: 72vh; }
.blank-home .hero-logo { height: 190px; }
.handover { line-height: 2; }
.handover .line { border-top: 1px dashed var(--line); }

table.timetable th, table.timetable td { text-align: center; vertical-align: middle; min-width: 92px; }
table.timetable tbody th { text-align: right; white-space: nowrap; background: var(--bg); }
table.timetable tr.today { background: var(--amber-soft); }
table.timetable select { padding: 4px; font-size: 12px; }
.muted { color: var(--muted); }
/* كشف الدرجات */
.report { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 20px; margin-bottom: 16px; }
.report header { display: flex; justify-content: space-between; align-items: center; gap: 12px; border-bottom: 2px solid var(--navy); padding-bottom: 10px; margin-bottom: 12px; }
.report h2 { margin: 0; }
.report .meta { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 6px 16px; margin-bottom: 12px; }
.report .total { display: flex; gap: 20px; flex-wrap: wrap; background: var(--teal-soft); padding: 12px; border-radius: 10px; margin-top: 12px; }
.report .total b { display: block; font-size: 20px; color: var(--navy); }
.report .sign { display: flex; justify-content: space-between; margin-top: 28px; color: var(--muted); font-size: 13px; }
@media print {
  .report { border: none; box-shadow: none; page-break-after: always; }
  .panel, .stats, .toolbar { box-shadow: none; }
}
/* الصفحة التسويقية */
.mk-hero { background: var(--navy); color: #fff; padding: 46px 20px 54px; text-align: center; }
.mk-hero h1 { font-size: 30px; margin: 18px 0 6px; }
.mk-hero p { opacity: .9; margin: 0 auto; max-width: 560px; }
.mk-cta { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 20px; }
.mk-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 12px; }
.mk-card { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 16px; }
.mk-card h3 { margin: 0 0 6px; font-size: 17px; color: var(--navy); }
.mk-card p { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.8; }
.mk-price { text-align: center; }
.mk-price .amount { font-size: 26px; font-weight: 800; color: var(--teal); }
.mk-price ul { list-style: none; padding: 0; margin: 10px 0 0; font-size: 14px; line-height: 2; }
.mk-section { max-width: 960px; margin: 0 auto; padding: 26px 16px; }
.mk-section > h2 { text-align: center; margin-bottom: 16px; }

/* تسجيل الحضور */
.att-head { display: grid; grid-template-columns: 1fr; gap: 0 12px; }
@media (min-width: 720px) { .att-head { grid-template-columns: 1fr 1fr; } }
.att-date .f { margin-bottom: 6px; }
.att-day-nav { display: flex; align-items: center; justify-content: space-between; gap: 6px; margin-bottom: 12px; }
.att-day { font-size: 13px; color: var(--muted); text-align: center; flex: 1; }
.att-summary { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.att-count { display: inline-flex; align-items: baseline; gap: 5px; padding: 5px 11px; border-radius: 999px; font-size: 13px; background: var(--bg); color: var(--muted); }
.att-count b { font-size: 15px; }
.att-count.s-present { background: var(--teal-soft); color: var(--teal); }
.att-count.s-absent { background: var(--red-soft); color: var(--red); }
.att-count.s-late { background: var(--amber-soft); color: var(--amber-ink); }
.att-count.s-excused { background: var(--violet-soft); color: var(--violet); }
.att-tools { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 8px; }
.att-tools input { flex: 1; min-width: 160px; }
.att-hint { margin: 0 0 8px; font-size: 13px; }
.att-list { display: flex; flex-direction: column; gap: 6px; }
.att-row { display: grid; grid-template-columns: 26px minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.att-row.dirty { border-color: var(--accent); box-shadow: 0 0 0 2px var(--teal-soft); }
.att-no { color: var(--muted); font-size: 12px; text-align: center; }
.att-name { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.att-name b { font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.att-name small { font-size: 12px; color: var(--muted); }
.att-seg { display: inline-grid; grid-template-columns: repeat(4, auto); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.att-seg .seg { font: inherit; font-size: 13px; font-weight: 600; padding: 8px 12px; min-width: 56px; background: #fff; border: none; border-inline-start: 1px solid var(--line); color: var(--muted); cursor: pointer; }
.att-seg .seg:first-child { border-inline-start: none; }
.att-seg .seg.on.s-present { background: var(--teal); color: #fff; }
.att-seg .seg.on.s-absent { background: var(--red); color: #fff; }
.att-seg .seg.on.s-late { background: var(--amber); color: #fff; }
.att-seg .seg.on.s-excused { background: var(--violet); color: #fff; }
.att-bar { position: sticky; bottom: 0; z-index: 5; margin: 12px -4px -4px; padding: 10px 12px; display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap;
  background: var(--navy); color: #fff; border-radius: 12px; box-shadow: 0 -4px 16px rgba(16,38,64,.15); font-weight: 600; }
.att-bar .btn.ghost { color: #fff; border-color: rgba(255,255,255,.4); background: transparent; }
@media (max-width: 719px) {
  .att-row { grid-template-columns: 22px minmax(0, 1fr); row-gap: 8px; }
  .att-seg { grid-column: 1 / -1; display: grid; width: 100%; }
  .att-seg .seg { min-width: 0; padding: 10px 4px; min-height: 42px; }
}
.quick-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; margin: 10px 0; }
.quick-name { font: inherit; font-size: 15px; font-weight: 600; padding: 14px 10px; border-radius: 10px; cursor: pointer;
  border: 2px solid var(--line); background: #fff; color: var(--ink); text-align: center; }
.quick-name[data-state="present"] { border-color: var(--teal); background: var(--teal-soft); color: var(--teal); }
.quick-name[data-state="absent"] { border-color: var(--red); background: var(--red-soft); color: var(--red); }
.quick-name[data-state="late"] { border-color: var(--amber); background: var(--amber-soft); color: var(--amber-ink); }
.quick-name[data-state="excused"] { border-color: var(--violet); background: var(--violet-soft); color: var(--violet); }

/* ===================== التجاوب: جوال وكمبيوتر ===================== */
/* مساحات آمنة في أجهزة iPhone وعند التثبيت كتطبيق */
body { padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left); }

/* --- الجوال: مساحات لمس مريحة --- */
@media (max-width: 719px) {
  main { --gut: 12px; }
  .btn { min-height: 44px; padding: 11px 16px; }
  .btn.sm { min-height: 38px; }
  input, select, textarea { min-height: 44px; font-size: 16px; }  /* 16px يمنع تكبير الشاشة في iOS */
  input[type=checkbox], input[type=radio] { min-height: 0; }
  .panel { padding: 14px; }
  .line { padding: 12px 0; }
  .row > * { min-width: 100%; }
  .row > .btn, .row > .switch { min-width: 0; }
  .stats { grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); }
  .topbar .in { padding: 10px 12px; }
  .brand-logo { height: 32px; }
  table.grid { font-size: 13px; }
}

/* --- اللوحي والكمبيوتر --- */
@media (min-width: 720px) {
  main { --gut: 20px; max-width: 1120px; }
  .topbar .in { max-width: 1120px; }
  .stats { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
}

/* --- الشاشات الكبيرة: التبويبات عمود جانبي ثابت --- */
@media (min-width: 1080px) {
  .tabs-layout { display: grid; grid-template-columns: 216px minmax(0, 1fr); gap: 18px; align-items: start; }
  /* الكمبيوتر: عمود جانبي ثابت، أيقونة بجانب اسم القسم */
  .tabs-layout > .tabs {
    flex-direction: column; gap: 2px; overflow: visible; padding: 8px; margin: 0;
    position: sticky; top: 16px; border: 1px solid var(--line); border-radius: 14px; background: #fff; box-shadow: none;
    max-height: calc(100vh - 32px); overflow-y: auto; scrollbar-width: thin;
  }
  .tabs-layout > .tabs button {
    width: 100%; min-width: 0; min-height: 0; flex-direction: row; justify-content: flex-start; gap: 10px;
    padding: 10px 12px; font-size: 14px; border-radius: 10px; text-align: start; position: relative;
  }
  .tabs-layout > .tabs button.on::before {
    content: ""; position: absolute; inset-inline-start: 0; top: 8px; bottom: 8px; width: 3px; border-radius: 3px; background: var(--accent);
  }
  /* الصفحة العامة وملف الطالب: عمودان على الشاشات الكبيرة */
  .cols-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; align-items: start; }
  .cols-2 > * { min-width: 0; }
}
@media (min-width: 1400px) {
  main { max-width: 1280px; }
  .topbar .in { max-width: 1280px; }
}

/* شريط عنوان التطبيق المثبّت على سطح المكتب */
@media (display-mode: window-controls-overlay) {
  .topbar { position: sticky; top: 0; z-index: 20; -webkit-app-region: drag; }
  .topbar .btn { -webkit-app-region: no-drag; }
}
@media (display-mode: standalone) {
  .install-hint { display: none !important; }
}

/* أيقونة تثبيت التطبيق: صغيرة في رأس الصفحة، تختفي بعد التثبيت */
.top-acts { display: flex; align-items: center; gap: 8px; flex: none; }
.install-ic { width: 38px; height: 38px; flex: none; display: inline-grid; place-items: center; border-radius: 12px; cursor: pointer;
  border: 1px solid var(--line); background: #fff; color: var(--navy); transition: transform .15s, background .15s; }
.install-ic:hover { background: var(--teal-soft); }
.install-ic:active { transform: scale(.94); }
.install-ic[hidden] { display: none; }
.install-ic.on-dark { background: rgba(255,255,255,.12); border-color: rgba(255,255,255,.28); color: #fff; }
.install-ic.on-dark:hover { background: rgba(255,255,255,.22); }
.install-ic.floating { position: fixed; top: calc(12px + env(safe-area-inset-top)); left: 12px; z-index: 50; box-shadow: 0 4px 14px rgba(16,38,64,.15); }
.icon { vertical-align: middle; flex: none; }
.install-steps ol { padding-inline-start: 18px; line-height: 2.1; }
@media print { .install-ic { display: none !important; } }

.chart { max-width: 100%; height: auto; display: block; }
.chart-value { font-size: 11px; fill: var(--ink); font-family: inherit; font-weight: 700; }
.chart-label { font-size: 11px; fill: var(--muted); font-family: inherit; }
.alert-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 10px; }
.alert-card { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 12px 14px;
  border: 1px solid var(--line); border-radius: 12px; background: #fff; font-weight: 600; }
.alert-card b { font-size: 22px; }
.alert-card.warn { border-color: var(--amber); background: var(--amber-soft); }
.alert-card.bad { border-color: var(--red); background: var(--red-soft); color: var(--red); }
.search-result { display: block; width: 100%; text-align: right; background: none; border: none; border-top: 1px solid var(--line); padding: 10px 0; font: inherit; cursor: pointer; }
.search-result:hover { background: var(--teal-soft); }
/* بطاقة الترحيب (بوابة المعلم) */
.welcome-card { display: flex; align-items: center; gap: 14px; padding: 14px 16px; margin-bottom: 14px; border-radius: 14px; background: var(--teal-soft); border: 1px solid rgba(15,118,110,.15); }
.welcome-card .t-info b { font-size: 17px; color: var(--navy); white-space: normal; }
.t-avatar.lg { width: 64px; height: 64px; font-size: 24px; border: 3px solid #fff; box-shadow: 0 1px 4px rgba(0,0,0,.1); }
/* بطاقات المعلمين */
.t-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px; }
.t-card { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: #fff; min-width: 0; }
.t-avatar { width: 48px; height: 48px; flex: none; border-radius: 50%; object-fit: cover; background: var(--teal-soft); }
.t-avatar.ph { display: grid; place-items: center; color: var(--accent); font-weight: 700; font-size: 18px; }
.t-info { min-width: 0; display: flex; flex-direction: column; }
.t-info b { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.t-info small { color: var(--muted); font-size: 12px; line-height: 1.5; }
@media print { .t-card { break-inside: avoid; } }
/* شعار المدرسة على الأوراق المطبوعة: بحجم شعار المنصة الذي يحل محله، بلا قص */
img.doc-school-logo { object-fit: contain; width: auto; max-width: 140px; }
/* شعار المدرسة في الإعدادات والمعالج */
.logo-edit { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.logo-preview { width: 120px; height: 120px; flex: none; border: 1px solid var(--line); border-radius: 16px; background: #fff; display: grid; place-items: center; padding: 10px; }
.logo-preview img { max-width: 100%; max-height: 100%; object-fit: contain; }
.logo-preview.empty { border-style: dashed; color: var(--muted); font-size: 13px; background: var(--bg); }
.logo-acts { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; min-width: 0; }
.lvl-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-inline-end: 8px; vertical-align: middle; background: var(--teal); }
.lvl-dot.urgent { background: var(--red); } .lvl-dot.action { background: var(--amber); }
/* رأس الرئيسية: شعار المدرسة واسمها واليوم */
.dash-hero { display: flex; align-items: center; gap: 14px; padding: 16px; margin-bottom: 14px; border-radius: 16px; background: linear-gradient(135deg, var(--accent), #0b5d59); color: #fff; }
.dash-logo { width: 60px; height: 60px; flex: none; border-radius: 14px; background: #fff; object-fit: contain; padding: 5px; }
.dash-logo.ph { display: grid; place-items: center; color: var(--accent); font-size: 26px; font-weight: 700; }
.dash-hero-text { min-width: 0; }
.dash-hero h2 { margin: 0 0 2px; font-size: 20px; line-height: 1.3; }
.dash-hero p { margin: 0; font-size: 13px; opacity: .9; }
@media (max-width: 480px) { .dash-hero { padding: 12px; } .dash-logo { width: 48px; height: 48px; } .dash-hero h2 { font-size: 17px; } }

.receipt { max-width: 520px; }
/* طباعة نافذة مفتوحة (إيصال، كشف حساب، بطاقة تسليم): النافذة وحدها. بدون نافذة مفتوحة تُطبع الصفحة نفسها
   (كشوف الدرجات، البطاقات، سجل الحضور…) — كانت القاعدة تخفي كل شيء فتخرج الورقة فارغة */
@media print {
  body:has(dialog[open]) > *:not(dialog) { display: none !important; }
  dialog[open] { position: static; display: block; border: none; width: 100%; max-width: none; }
  dialog::backdrop { display: none; }
  dialog[open] .row, dialog[open] .btn { display: none !important; }
}

/* حقل كلمة المرور */
.pw-wrap { position: relative; display: block; }
.pw-wrap input { width: 100%; padding-inline-start: 44px; }
.pw-toggle { position: absolute; inset-inline-start: 6px; top: 50%; transform: translateY(-50%);
  background: none; border: none; color: var(--muted); cursor: pointer; padding: 6px; border-radius: 8px; display: flex; }
.pw-toggle:hover { background: var(--bg); color: var(--ink); }
input[type="password"]::-ms-reveal, input[type="password"]::-ms-clear { display: none; }

/* صف الطالب: أعمدة مرتبة على الكمبيوتر، وبطاقة مرتبة على الجوال */
.student-row { display: grid; gap: 4px 12px; padding: 12px 0; border-top: 1px solid var(--line); align-items: center; }
.student-row:first-of-type { border-top: none; }
.student-row .s-name { font-size: 15px; }
.student-row .s-cell { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; font-size: 14px; }
.student-row .s-label { color: var(--muted); font-size: 12px; }
.student-row .s-actions { display: flex; gap: 8px; align-items: center; justify-content: flex-end; flex-wrap: wrap; }
@media (min-width: 900px) {
  .student-row { grid-template-columns: minmax(190px, 1.4fr) 130px minmax(170px, 1.2fr) 130px auto; }
  .student-row .s-label { display: none; }
  .student-row .s-actions .s-label { display: inline; }
}

/* قائمة الأقسام */
.menu-title { margin: 0 0 12px; }
.menu-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; }
.menu-card { display: flex; align-items: center; gap: 10px; text-align: right; font: inherit; cursor: pointer;
  background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; min-height: 64px; }
.menu-card:hover { border-color: var(--accent); background: var(--teal-soft); }
.menu-card .menu-text { flex: 1; display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.menu-card .menu-name { font-weight: 700; color: var(--navy); font-size: 15px; }
.menu-card .menu-note { color: var(--muted); font-size: 12.5px; line-height: 1.6; }
.menu-card .icon { color: var(--muted); }
.section-head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.section-head h2 { margin: 0; font-size: 19px; }

/* ثبات العرض مثل التطبيق: بلا تكبير أو تصغير بالإصبع، وبلا تمرير أفقي */
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; touch-action: manipulation; }
body { overflow-x: hidden; overscroll-behavior-y: contain; }

/* بطاقات معرّفات الطلاب */
.cards-sheet { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.id-card { border: 1px dashed var(--line); border-radius: 12px; padding: 14px; background: #fff; }
.id-card header { display: flex; justify-content: space-between; align-items: center; gap: 8px;
  border-bottom: 2px solid var(--navy); padding-bottom: 8px; margin-bottom: 10px; font-size: 14px; }
.id-card .card-logo { height: 26px; }
.id-card .id-name { font-size: 18px; font-weight: 800; color: var(--navy); }
.id-card .id-class { color: var(--muted); font-size: 13px; margin-bottom: 8px; }
.id-card .id-row { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; padding: 3px 0; }
.id-card .id-row.big b { font-family: ui-monospace, monospace; font-size: 17px; letter-spacing: 1px; color: var(--navy); }
.id-card .id-note { color: var(--muted); font-size: 11.5px; line-height: 1.7; margin: 8px 0 0; }

/* سجل الحضور الشهري */
.report.wide { max-width: none; }
table.month-sheet th, table.month-sheet td { padding: 4px 6px; text-align: center; font-size: 12px; }
table.month-sheet tbody th { text-align: right; white-space: nowrap; position: sticky; inset-inline-start: 0; background: #fff; }
table.month-sheet .mark-present { color: var(--teal); }
table.month-sheet .mark-absent { color: var(--red); font-weight: 700; }
table.month-sheet .mark-late { color: var(--amber-ink); font-weight: 700; }
table.month-sheet .mark-excused { color: var(--violet); font-weight: 700; }
@media print {
  .cards-sheet { grid-template-columns: repeat(2, 1fr); }
  .id-card { break-inside: avoid; }
  table.month-sheet { font-size: 10px; }
}

/* معالج الإعداد */
.steps { display: flex; gap: 8px; justify-content: center; margin-bottom: 14px; }
.steps .step { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center;
  background: #fff; border: 2px solid var(--line); color: var(--muted); font-weight: 700; }
.steps .step.on { border-color: var(--accent); color: var(--accent); background: var(--teal-soft); }
.steps .step.done { border-color: var(--teal); background: var(--teal); color: #fff; }
.subject-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 8px; margin: 10px 0; }
.subject-pick { display: flex; align-items: center; gap: 8px; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; background: #fff; cursor: pointer; }
.subject-pick:hover { border-color: var(--accent); }

/* الهيكل الأكاديمي */
.grade-block { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin: 8px 0; background: #FBFCFD; }
.grade-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 6px; }
.grade-head b { font-size: 15px; color: var(--navy); }
.grade-head .row { margin-inline-start: auto; }
.sections { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0 10px; }
.section-chip { display: inline-flex; align-items: center; gap: 4px; background: var(--teal-soft); color: var(--navy);
  border-radius: 999px; padding: 4px 10px; font-size: 13px; font-weight: 600; }

/* التحديد المتعدد والإجراءات الجماعية */
.student-row.head { padding: 8px 0; }
.student-row .s-pick { display: flex; align-items: center; }
.bulk-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; background: var(--teal-soft);
  border: 1px solid var(--accent); border-radius: 10px; padding: 10px 12px; margin: 8px 0; }
@media (min-width: 900px) {
  .student-row { grid-template-columns: 28px minmax(180px, 1.3fr) 120px minmax(160px, 1.1fr) 120px auto; }
}

/* مصفوفة توزيع المعلمين */
table.matrix th, table.matrix td { padding: 6px 8px; text-align: center; vertical-align: middle; }
table.matrix tbody th { text-align: right; white-space: nowrap; background: var(--bg); position: sticky; inset-inline-start: 0; }
table.matrix select { min-width: 130px; font-size: 12.5px; padding: 5px; }

.subject-group { margin-bottom: 10px; }
.subject-pick.suggested { border-color: var(--teal); background: var(--teal-soft); }

/* شعب قابلة للضغط في تبويب الطلاب */
button.section-chip { border: 1px solid transparent; cursor: pointer; font: inherit; }
button.section-chip.on { background: var(--navy); color: #fff; }
button.section-chip:hover { border-color: var(--accent); }

/* ملف الطالب: قائمة أقسام جانبية ومحتوى واسع */
.profile-page { max-width: 1180px; }
.profile-layout { display: grid; gap: 14px; grid-template-columns: minmax(0, 1fr); }
.profile-nav { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; }
.profile-nav button { display: flex; flex-direction: column; gap: 2px; align-items: flex-start; white-space: nowrap;
  background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px; cursor: pointer;
  font: inherit; color: var(--ink); min-width: 120px; }
.profile-nav button small { color: var(--muted); font-size: 11.5px; }
.profile-nav button.on { border-color: var(--accent); background: var(--teal-soft); color: var(--navy); font-weight: 700; }
.kpis.inline { display: flex; gap: 14px; flex-wrap: wrap; margin-bottom: 8px; }
.kpis.inline div { background: var(--bg); border-radius: 10px; padding: 8px 14px; text-align: center; font-size: 12px; color: var(--muted); }
.kpis.inline b { display: block; font-size: 18px; color: var(--navy); }
@media (min-width: 900px) {
  .profile-layout { grid-template-columns: 220px minmax(0, 1fr); align-items: start; }
  .profile-nav { flex-direction: column; overflow: visible; position: sticky; top: 16px; }
  .profile-nav button { width: 100%; }
}

/* ===== بوابات الدخول: خلفية تعليمية هادئة ونموذج مندمج ===== */
.gate { min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px;
  background:
    radial-gradient(1200px 600px at 85% 10%, rgba(19,124,118,.35), transparent 60%),
    radial-gradient(900px 500px at 10% 90%, rgba(201,162,77,.18), transparent 55%),
    linear-gradient(160deg, #0E2038 0%, #143354 45%, #0B1B2E 100%);
  position: relative; overflow: hidden; }
/* رموز تعليمية خفيفة: سبورة وكتب وتقويم — مرسومة بالـ CSS بلا صور ثقيلة */
.gate::before, .gate::after { content: ""; position: absolute; opacity: .08; pointer-events: none; }
.gate::before { inset-inline-start: -60px; top: 12%; width: 320px; height: 210px; border: 10px solid #fff; border-radius: 12px;
  box-shadow: 0 0 0 18px rgba(255,255,255,.06); transform: rotate(-6deg); }
.gate::after { inset-inline-end: -40px; bottom: 8%; width: 260px; height: 180px;
  background: repeating-linear-gradient(90deg, #fff 0 22px, transparent 22px 38px); border-radius: 8px; transform: rotate(5deg); }
.gate-wrap { width: min(980px, 100%); display: grid; gap: 22px; position: relative; z-index: 1; }
.gate-aside { color: #EAF2F6; }
.gate-aside h1 { font-size: 26px; margin: 10px 0 6px; }
.gate-aside p { color: rgba(234,242,246,.8); margin: 0 0 14px; line-height: 1.9; }
.gate-points { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.gate-points li { display: flex; gap: 8px; align-items: center; color: rgba(234,242,246,.9); font-size: 14px; }
.gate-points .icon { color: var(--gold, #C9A24D); }
.gate-card { background: rgba(255,255,255,.10); border: 1px solid rgba(255,255,255,.18); border-radius: 18px;
  padding: 22px; backdrop-filter: blur(14px); box-shadow: 0 24px 60px rgba(0,0,0,.28); }
.gate-card h2 { color: #fff; margin: 0 0 4px; font-size: 20px; }
.gate-card .gate-sub { color: rgba(255,255,255,.72); font-size: 13.5px; margin-bottom: 16px; }
.gate-card .f span { color: rgba(255,255,255,.8); }
.gate-card input, .gate-card select { background: rgba(255,255,255,.92); border-color: transparent; }
.gate-card .pw-toggle { color: #55636E; }
.gate-card .btn { width: 100%; justify-content: center; padding: 13px; font-size: 16px; }
.gate-card .btn.ghost, .gate-card .btn.link { background: transparent; color: rgba(255,255,255,.85); border-color: rgba(255,255,255,.25); }
.gate-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin: 6px 0 14px; flex-wrap: wrap; }
.gate-row label { color: rgba(255,255,255,.85); font-size: 13.5px; display: flex; align-items: center; gap: 6px; }
.gate-link { background: none; border: none; color: #8FD8D2; font: inherit; cursor: pointer; padding: 0; text-decoration: underline; }
.gate-roles { margin-top: 16px; border-top: 1px solid rgba(255,255,255,.14); padding-top: 14px; }
.gate-roles h3 { color: rgba(255,255,255,.85); font-size: 13.5px; margin: 0 0 8px; font-weight: 600; }
.role-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.role-card { background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.16); border-radius: 12px;
  padding: 10px 8px; text-align: center; color: #fff; font: inherit; font-size: 13px; cursor: pointer; transition: background .15s, border-color .15s; }
.role-card:hover { background: rgba(255,255,255,.14); }
.role-card.on { background: rgba(127,214,207,.18); border-color: #7FD6CF; box-shadow: inset 0 0 0 1px #7FD6CF; font-weight: 700; }
.role-card:focus-visible { outline: 2px solid #7FD6CF; outline-offset: 2px; }
.role-card small { display: block; color: rgba(255,255,255,.6); font-size: 11px; margin-top: 2px; }
.gate-foot { text-align: center; color: rgba(255,255,255,.6); font-size: 12.5px; margin-top: 14px; }
.gate-badge { display: inline-flex; align-items: center; gap: 6px; color: rgba(255,255,255,.75); font-size: 12.5px; }
@media (min-width: 900px) {
  .gate-wrap { grid-template-columns: 1fr 380px; align-items: center; gap: 40px; }
}
@media (prefers-reduced-motion: reduce) { .gate::before, .gate::after { display: none; } }
@media (max-width: 899px) { .hide-sm { display: none !important; } }
@media (min-width: 900px) { .show-sm { display: none !important; } }

/* العنوان والوصف تحت الشعار يكونان في الوسط */
.gate-card .hero-logo, .gate-aside .hero-logo { display: block; margin-inline: auto; }
.gate-card h2, .gate-card .gate-sub { text-align: center; }
.gate-aside { text-align: center; }
.gate-aside .gate-points { display: inline-grid; text-align: right; }
.gate-roles h3 { text-align: center; }
.gate-card .sub, .gate-card .empty { color: rgba(255,255,255,.62); text-align: center; }

/* أداة إسناد المعلم: صفوف مطوية تُفتح واحدًا واحدًا */
.assign-list { display: grid; gap: 6px; }
.assign-item { border: 1px solid var(--line); border-radius: 10px; background: #fff; overflow: hidden; }
.assign-item.open { border-color: var(--accent); }
.assign-head { width: 100%; display: flex; align-items: center; gap: 10px; padding: 10px 12px; cursor: pointer;
  background: none; border: none; font: inherit; text-align: right; color: var(--ink); }
.assign-head:hover { background: var(--bg); }
.assign-head .assign-name { font-weight: 700; color: var(--navy); min-width: 90px; }
.assign-head .assign-sum { flex: 1; color: var(--muted); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.assign-head.has .assign-sum { color: var(--ink); }
.assign-body { padding: 4px 12px 12px; border-top: 1px solid var(--line); background: #FBFCFD; }
.assign-subjects { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px; margin-bottom: 10px; }
.assign-subject { display: flex; align-items: center; gap: 6px; font-size: 13.5px; padding: 6px 8px;
  border: 1px solid var(--line); border-radius: 8px; background: #fff; cursor: pointer; }
.assign-subject:hover { border-color: var(--accent); }

/* مركز التنبيهات */
.notif-group { margin-bottom: 12px; }
.notif { display: flex; align-items: center; gap: 12px; width: 100%; text-align: right; cursor: pointer;
  background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px; margin-bottom: 6px; font: inherit; }
.notif:hover { border-color: var(--accent); background: var(--teal-soft); }
.notif .notif-count { min-width: 38px; height: 38px; display: grid; place-items: center; border-radius: 10px;
  background: var(--bg); color: var(--navy); font-weight: 800; font-size: 16px; }
.notif.warn { border-color: var(--amber); }
.notif.warn .notif-count { background: var(--amber-soft); color: var(--amber-ink); }
.notif.bad { border-color: var(--red); }
.notif.bad .notif-count { background: var(--red-soft); color: var(--red); }
.notif .notif-text b { display: block; color: var(--ink); }

/* ---------- الاشتراك داخل المدرسة ---------- */
.sub-banner { display: flex; gap: 12px; align-items: center; border-radius: 12px; padding: 12px 14px; margin-bottom: 12px;
  background: #EAF4FF; color: #1F4E8C; border: 1px solid #C9DFF7; }
.sub-banner.trial { background: #FFF6E6; color: #7A4B00; border-color: #F3D9A8; }
.sub-banner.warn { background: #FFEFE9; color: #8C2F18; border-color: #F5C8B8; }
.sub-banner > svg { flex: none; }
.sub-banner > div { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.sub-banner small { opacity: .85; }
.sub-lock { text-align: center; background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 28px 18px; margin-bottom: 14px; }
.sub-lock > svg { color: var(--red); }
.sub-lock h2 { margin: 10px 0 6px; }
.sub-lock p { max-width: 560px; margin: 6px auto; line-height: 1.8; }
.feat-row { display: flex; gap: 10px; align-items: center; padding: 7px 0; border-bottom: 1px solid var(--line); }
.feat-row > svg { flex: none; color: var(--teal); }
.feat-row.off { color: var(--muted); }
.feat-row.off > svg { color: var(--muted); }
.feat-row small { color: var(--muted); }
.sub-plans { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 10px; }
.sub-plan { border: 1px solid var(--line); border-radius: 12px; padding: 14px; display: flex; flex-direction: column; gap: 6px; }
.sub-plan.cur { border-color: var(--teal); background: var(--teal-soft); }
.sub-plan h3 { margin: 0; font-size: 17px; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.sub-plan .btn { margin-top: auto; }

/* ---------- الأداء: هيكل التحميل وشريط التحديث ---------- */
.skel { padding: 14px; background: #fff; border: 1px solid var(--line); border-radius: 12px; }
.skel-line { height: 14px; border-radius: 7px; margin: 12px 0; background: linear-gradient(90deg, var(--bg) 25%, #F7F9FB 37%, var(--bg) 63%);
  background-size: 400% 100%; animation: skel 1.3s ease infinite; }
.skel-line.w40 { width: 40%; height: 20px; } .skel-line.w90 { width: 90%; } .skel-line.w75 { width: 75%; } .skel-line.w85 { width: 85%; } .skel-line.w60 { width: 60%; }
@keyframes skel { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }
@media (prefers-reduced-motion: reduce) { .skel-line { animation: none; } }
.update-bar { position: fixed; bottom: 14px; inset-inline: 14px; z-index: 1000; display: flex; gap: 12px; align-items: center; justify-content: space-between;
  background: var(--navy); color: #fff; padding: 10px 14px; border-radius: 12px; box-shadow: 0 10px 30px rgba(0,0,0,.2); max-width: 520px; margin-inline: auto; }
.app-version { opacity: .6; font-size: 11px; }
img[loading="lazy"] { content-visibility: auto; }
/* صفوف القوائم على الجوال: أزرار الإجراءات تنزل لسطر مستقل بدل أن تدفع الصفحة للعرض */
@media (max-width: 700px) {
  .line { flex-wrap: wrap; }
  .line > .row { flex: 1 1 100% !important; flex-wrap: wrap; justify-content: flex-start; min-width: 0; }
  .line > .row > * { min-width: 0 !important; flex: 0 1 auto; }
}
.diag { padding: 8px 10px; border-radius: 8px; margin-bottom: 6px; }
.diag.ok { background: var(--teal-soft); color: var(--teal); }
.diag.bad { background: #FDECEA; color: var(--red); }

/* ---------- صف الرابط: الرابط ← نسخ ← فتح ---------- */
.link-row { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: #fff; margin-bottom: 8px; }
.link-row .lr-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.link-row .lr-text > b { display: flex; align-items: center; gap: 6px; font-size: 14px; }
.link-row .lr-text small { color: var(--muted); font-size: 12px; }
.link-row .lr-url, .link-row .lr-val { font-size: 13px; color: var(--accent); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; direction: ltr; text-align: left; }
.link-row .lr-val { color: var(--ink); font-family: ui-monospace, Menlo, Consolas, monospace; background: #F4F6F9; padding: 2px 6px; border-radius: 6px; align-self: flex-start; }
.link-row .lr-acts { display: flex; gap: 6px; flex: none; }
@media (max-width: 560px) { .link-row { flex-wrap: wrap; } .link-row .lr-acts { width: 100%; } .link-row .lr-acts .btn { flex: 1; } }
.school-row { font: inherit; width: 100%; text-align: start; display: flex; align-items: center; gap: 10px; background: #fff; border: 1px solid var(--line);
  border-radius: 10px; padding: 12px 14px; margin-bottom: 8px; cursor: pointer; color: var(--ink); }
.school-row:hover { border-color: var(--accent); }
.school-row > div { flex: 1; min-width: 0; }
.school-row .go { color: var(--accent); font-size: 20px; }
.sec-title { margin: 12px 0 6px; font-size: 13.5px; color: var(--muted); }

/* ---------- مؤشر الاتصال والمزامنة ---------- */
.sync-pill { font: inherit; font-size: 12.5px; font-weight: 600; border-radius: 999px; padding: 5px 12px; border: 1px solid transparent; cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; max-width: 60vw; overflow: hidden; text-overflow: ellipsis; }
.sync-pill::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; flex: none; }
.sync-pill.ok { background: rgba(255,255,255,.14); color: #CFF5E9; }
.sync-pill.busy { background: #FFF6E6; color: #8A5A10; }
.sync-pill.busy::before { animation: pulse 1s infinite; }
.sync-pill.off { background: var(--bg); color: #4A5568; }
.sync-pill.warn { background: #FDECEA; color: var(--red); }
@keyframes pulse { 50% { opacity: .3; } }
.pending-dot { display: inline-block; font-size: 11px; font-weight: 600; color: #8A5A10; background: #FFF6E6; border-radius: 999px; padding: 1px 8px; margin-inline-start: 6px; }
.topbar .in { gap: 10px; }
@media (max-width: 560px) { .sync-pill { font-size: 11.5px; padding: 4px 9px; } }
.sync-pill .short { display: none; }
@media (max-width: 560px) { .sync-pill .full { display: none; } .sync-pill .short { display: inline; } }

/* ---------- قفل المحاولات الخاطئة: عد تنازلي ---------- */
.lock-box { background: #FFF6E6; border: 1px solid #F3D9A8; color: #7A4B00; border-radius: 12px; padding: 14px; text-align: center; margin: 8px 0; }
.lock-title { font-weight: 700; font-size: 14.5px; margin-bottom: 6px; }
.lock-sub { font-size: 12.5px; opacity: .85; }
.lock-time { display: block; font-size: 34px; font-weight: 800; letter-spacing: 2px; margin: 4px 0 8px; font-variant-numeric: tabular-nums; color: #9A5B00; }
.lock-bar { height: 6px; background: #F3D9A8; border-radius: 3px; overflow: hidden; margin: 0 auto 8px; max-width: 260px; }
.lock-bar i { display: block; height: 100%; background: #E8A33D; border-radius: 3px; transition: width .25s linear; }

/* ---- معالج إعداد المدرسة: شريط تقدم وبطاقات اختيار كبيرة ---- */
.wiz-progress { margin-bottom: 14px; }
.wiz-bar { height: 8px; background: var(--line); border-radius: 99px; overflow: hidden; margin-bottom: 6px; }
.wiz-bar i { display: block; height: 100%; background: var(--accent); border-radius: 99px; transition: width .25s; }
.setup-steps { list-style: none; display: flex; gap: 4px; padding: 0; margin: 8px 0 0; overflow-x: auto; scrollbar-width: thin; }
.setup-steps li { flex: none; font-size: 12px; }
.setup-steps li > * { display: block; padding: 4px 10px; border-radius: 999px; border: 1px solid var(--line); background: #fff; color: var(--muted); font: inherit; white-space: nowrap; }
.setup-steps li.done > * { color: var(--teal); border-color: var(--teal); }
.setup-steps li.on > * { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 700; }
.setup-steps button { cursor: pointer; }
.custom-stages { border-top: 1px dashed var(--line); margin-top: 14px; padding-top: 6px; }
.ar-chips { position: sticky; top: 0; z-index: 3; background: var(--bg); padding: 6px 0; }
.pick-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin: 12px 0; }
.pick-card { display: flex; align-items: center; gap: 10px; padding: 14px; min-height: 56px; border: 2px solid var(--line); border-radius: 12px; background: #fff; cursor: pointer; }
.pick-card.on { border-color: var(--accent); background: var(--teal-soft); }
.pick-card input { width: 20px; height: 20px; min-height: 0; flex: none; }
.pick-card b { display: block; }
.pick-grid.one-col { grid-template-columns: 1fr; }
.prev-stage { margin: 10px 0; }
.prev-list { margin: 6px 0; padding-inline-start: 22px; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 4px 16px; }
.prev-list li { padding: 4px 0; }
.prev-edit { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 8px; }

/* ===== صفحة الطلاب الجديدة (v2.2): إحصائيات، بحث، بطاقات، نوافذ كبيرة ===== */
dialog.dialog-lg { width: min(880px, calc(100% - 24px)); }
@media (max-width: 640px) {
  dialog.dialog-lg { width: 100%; max-width: 100%; height: 100dvh; max-height: 100dvh; margin: 0; border-radius: 0; }
  dialog.dialog-lg .d-in { padding: 14px; }
  dialog.dialog-lg .d-in > .row.spaced:last-child { bottom: -14px; margin: 0 -14px -14px; padding: 12px 14px calc(14px + env(safe-area-inset-bottom, 0px)); }
}
.s-head .section-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.s-actions-top { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.s-actions-top .btn:first-child { flex: 1 1 140px; }
.more-stats { margin-top: 10px; }
.more-stats summary { cursor: pointer; font-weight: 700; font-size: 14px; color: var(--muted); }
.stat-chips, .chips { display: flex; gap: 6px; flex-wrap: wrap; margin: 6px 0 10px; }
.stat-chip { font: inherit; font-size: 13px; padding: 4px 10px; border-radius: 20px; border: 1px solid var(--line); background: #fff; cursor: pointer; display: inline-flex; gap: 6px; align-items: center; }
.stat-chip b { background: var(--teal-soft); color: var(--teal); border-radius: 10px; padding: 0 7px; }
.search-row { margin-bottom: 8px; }
.search-row input { width: 100%; font-size: 16px; padding: 12px 14px; }
.filters { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 8px; margin-bottom: 8px; }
.s-list { display: grid; gap: 8px; margin-top: 8px; }
.s-card { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: #fff; cursor: pointer; }
.s-card:hover, .s-card:focus-visible { border-color: var(--accent); outline: none; box-shadow: 0 0 0 2px var(--teal-soft); }
.s-card .s-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.s-card .s-title { font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.s-card .s-meta { font-size: 13px; color: var(--muted); }
.s-card .s-pick { display: flex; }
.s-photo { width: 46px; height: 46px; border-radius: 50%; object-fit: cover; flex: none; background: var(--teal-soft); }
.s-photo.lg { width: 84px; height: 84px; font-size: 32px; }
.s-photo.ph { display: inline-flex; align-items: center; justify-content: center; color: var(--teal); font-weight: 800; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 4px 12px; }
.student-form .sec-title { margin: 18px 0 6px; padding-bottom: 4px; border-bottom: 1px solid var(--line); }
.student-form .sec-title.first { margin-top: 0; }
.photo-row { display: flex; gap: 14px; align-items: center; margin-bottom: 10px; flex-wrap: wrap; }
.photo-row .btn { margin: 0 0 6px 6px; }
.file-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.file-actions .fees-switch { display: inline-flex; gap: 6px; align-items: center; }
.student-file .profile-head { margin-bottom: 12px; }
.student-file .ph-row { display: flex; gap: 14px; align-items: center; }
.student-file .ph-row h1 { margin: 0; }
.student-file .profile-layout { display: grid; gap: 12px; }
@media (min-width: 720px) { .student-file .profile-layout { grid-template-columns: 200px minmax(0, 1fr); align-items: start; } }
.student-file .profile-nav { display: flex; gap: 6px; overflow-x: auto; }
@media (min-width: 720px) { .student-file .profile-nav { flex-direction: column; overflow: visible; } }
.student-file .profile-nav button { text-align: start; padding: 9px 12px; border: 1px solid var(--line); border-radius: 10px; background: #fff; font: inherit; cursor: pointer; white-space: nowrap; display: flex; flex-direction: column; }
.student-file .profile-nav button.on { border-color: var(--accent); background: var(--teal-soft); font-weight: 700; }
.student-file .profile-nav small { color: var(--muted); font-weight: 400; }
.more-list { display: grid; gap: 8px; }
/* معالج الاستيراد */
.wiz-steps { display: flex; gap: 6px; list-style: none; padding: 0; margin: 0 0 14px; font-size: 13px; }
.wiz-steps li { flex: 1; text-align: center; padding: 6px 4px; border-radius: 8px; background: #EEF1F4; color: var(--muted); }
.wiz-steps li.on { background: var(--accent); color: #fff; font-weight: 700; }
.wiz-steps li.done { background: var(--teal-soft); color: var(--teal); }
.method-grid { display: grid; gap: 8px; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.kpis-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 8px; }
.kpis-row .kpi { border: 1px solid var(--line); border-radius: 10px; padding: 10px 6px; text-align: center; font-size: 13px; }
.kpis-row .kpi b { display: block; font-size: 22px; }
.kpis-row .kpi.ok b { color: var(--teal); } .kpis-row .kpi.warn b { color: #B7791F; } .kpis-row .kpi.bad b { color: var(--red); }
.amb { border: 1px solid var(--line); border-radius: 10px; padding: 10px; margin-bottom: 8px; display: grid; gap: 4px; }
.tpl-box { margin-top: 16px; padding-top: 6px; border-top: 1px solid var(--line); }
.tpl-ask, .tpl-picker { margin-top: 10px; padding: 10px; border: 1px dashed var(--line); border-radius: 10px; display: grid; gap: 8px; }
.tpl-ask[hidden], .tpl-picker[hidden] { display: none; }
.res-list { line-height: 2; font-size: 16px; }
.wiz-done { color: var(--teal); }
.wiz .scroll { overflow-x: auto; }
.wiz table.grid { min-width: 520px; }

/* المعلمون: تبويبات ملف المعلم */
.tab-chip { cursor: pointer; }
.chips .tab-chip { white-space: nowrap; border: 1px solid var(--line); border-radius: 20px; padding: 6px 14px; font-size: 14px; background: #fff; }
.chips .tab-chip.on { border-color: var(--accent); background: var(--teal-soft); font-weight: 700; }
.teacher-file .chips { margin: 12px 0; }
.tabs-scroll { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; -webkit-overflow-scrolling: touch; }
.tabs-scroll .tab-chip { flex: none; }

/* ---- منتقي المرحلة/الصف/الشعبة الموحّد ---- */
.picker-btn { font: inherit; font-size: 14px; text-align: right; background: #fff; border: 1px solid var(--line); border-radius: 8px;
  padding: 10px 12px; color: var(--ink); cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.picker-btn.has-value { border-color: var(--accent); color: var(--accent); font-weight: 700; }
.picker-list { display: grid; gap: 4px; }
.picker-row { display: flex; justify-content: space-between; align-items: center; width: 100%; text-align: right;
  background: none; border: none; border-top: 1px solid var(--line); padding: 12px 4px; font: inherit; font-size: 15px; cursor: pointer; }
.picker-row:first-child { border-top: none; }
.picker-row:hover { background: var(--teal-soft); }
.picker-row.on { color: var(--accent); font-weight: 700; }
.picker-row.back { color: var(--muted); justify-content: flex-start; gap: 6px; }

/* ملف المعلم في الإدارة */
.file-hero { display: flex; gap: 14px; align-items: center; padding: 14px; margin-bottom: 12px; border-radius: 14px;
  background: var(--teal-soft); border: 1px solid rgba(15,118,110,.15); }
.file-hero .s-photo.lg { width: 84px; height: 84px; }
.file-hero-text { min-width: 0; flex: 1; }
.file-hero-text h2 { margin: 0; font-size: 19px; color: var(--navy); }
.file-hero-text p { margin: 2px 0 6px; color: var(--muted); }
.file-hero-tags { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.cred-card { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; margin: 12px 0; background: #fff; }
.cred-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 6px; }
.cred-row { display: grid; grid-template-columns: 110px 1fr; gap: 8px; align-items: center; padding: 6px 0; border-top: 1px dashed var(--line); }
.cred-line, .cred-pw { display: flex; gap: 8px; align-items: center; justify-content: space-between; flex-wrap: wrap; min-width: 0; }
.cred-val { font-size: 1.05rem; font-weight: 700; letter-spacing: .5px; word-break: break-all; }
.cred-row a { word-break: break-all; }
.info-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 10px; margin: 10px 0; }
.info-block { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; }
.info-block h4 { margin: 0 0 4px; font-size: 15px; color: var(--navy); }
@media (max-width: 600px) {
  .file-hero { flex-direction: column; text-align: center; }
  .file-hero-tags, .file-hero-text .row { justify-content: center !important; }
  .cred-row { grid-template-columns: 1fr; gap: 2px; }
}

/* بوابة المعلم: الرئيسية وطلابي وحسابي */
.today-list { display: flex; flex-direction: column; gap: 8px; }
.today-item, .stu-row { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.today-no { flex: none; width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; font-weight: 700; color: var(--accent); background: var(--teal-soft); }
.stu-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.stu-main b { overflow: hidden; text-overflow: ellipsis; }
.stu-main small { color: var(--muted); font-size: 12px; }
.class-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }
.class-card { display: flex; flex-direction: column; gap: 8px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.class-card:hover { border-color: var(--accent); }
.class-card > b { font-size: 15px; color: var(--navy); }
.cc-subjects { display: flex; flex-wrap: wrap; gap: 4px; }
.cc-acts { display: flex; gap: 6px; margin-top: auto; }
.cc-acts .btn { flex: 1; }
.stu-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin: 10px 0; }
.stu-list { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.stu-stats { display: flex; gap: 4px; flex: none; }
.stu-stats .att-count { padding: 2px 8px; font-size: 12px; }
.stu-today { flex: none; font-size: 12px; font-weight: 700; padding: 3px 10px; border-radius: 20px; background: var(--bg); color: var(--muted); }
.stu-today.s-present { background: var(--teal-soft); color: var(--teal); }
.stu-today.s-absent { background: var(--red-soft); color: var(--red); }
.stu-today.s-late { background: var(--amber-soft); color: var(--amber-ink); }
.stu-today.s-excused { background: var(--violet-soft); color: var(--violet); }
.pw-rules { display: flex; flex-wrap: wrap; gap: 6px 14px; margin: -4px 0 10px; font-size: 13px; color: var(--muted); }
.pw-rules span { display: inline-flex; align-items: center; gap: 4px; }
.pw-rules .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--line); display: inline-block; }
.pw-rules .ok { color: var(--teal); font-weight: 700; }
.pw-rules .bad { color: var(--red); font-weight: 700; }
@media (max-width: 560px) {
  .stu-row { flex-wrap: wrap; }
  .stu-stats { order: 3; width: 100%; padding-inline-start: 34px; }
  .stu-stats:empty { display: none; }
}

/* الحضور: متابعة الإدارة والتقارير وملف الطالب */
.att-parts { margin-bottom: 12px; }
.att-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; margin: 0 0 14px; }
.att-kpis > div { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 14px; font-size: 14px; color: var(--ink); }
.att-kpis > div b { display: block; font-size: 24px; color: var(--accent); }
.att-kpis .s-present b { color: var(--teal); } .att-kpis .s-absent b { color: var(--red); }
.att-kpis .s-late b { color: var(--amber-ink); } .att-kpis .s-excused b { color: var(--violet); } .att-kpis .s-rate b { color: var(--navy); }
.att-classes { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; }
.att-class { display: flex; flex-direction: column; gap: 6px; text-align: start; font: inherit; color: inherit; cursor: pointer;
  background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.att-class:hover:not(:disabled), .att-class:focus-visible { border-color: var(--accent); box-shadow: 0 0 0 2px var(--teal-soft); outline: none; }
.att-class:disabled { cursor: default; opacity: .6; }
.ac-top { display: flex; justify-content: space-between; align-items: center; gap: 6px; }
.ac-bar { height: 6px; background: var(--bg); border-radius: 99px; overflow: hidden; }
.ac-bar span { display: block; height: 100%; background: var(--accent); border-radius: 99px; }
.att-class.partial .ac-bar span { background: var(--amber); }
.ac-counts { display: flex; flex-wrap: wrap; gap: 4px 10px; font-size: 12px; color: var(--muted); }
.ac-counts .s-absent { color: var(--red); font-weight: 700; } .ac-counts .s-late { color: var(--amber-ink); font-weight: 700; }
.ac-counts .s-excused { color: var(--violet); font-weight: 700; } .ac-counts .s-present { color: var(--teal); font-weight: 700; }
.att-class small { color: var(--muted); font-size: 11px; }
.att-people { display: flex; flex-direction: column; gap: 6px; }
.att-person { display: flex; align-items: center; gap: 10px; padding: 10px 12px; background: #fff; border: 1px solid var(--line); border-radius: 12px; }
.att-person-acts { display: flex; gap: 6px; flex-wrap: wrap; flex: none; }
.att-reason { color: var(--ink) !important; } .att-reason.pending { color: var(--amber-ink) !important; }
.excuse-text { margin: 4px 0 0; padding: 6px 10px; background: var(--bg); border-radius: 8px; font-size: 14px; }
.att-why { align-self: flex-start; margin-top: 4px; font: inherit; font-size: 12px; color: var(--accent); background: none; border: 1px dashed var(--line); border-radius: 8px; padding: 4px 8px; cursor: pointer; }
.att-why-box { display: flex; gap: 6px; margin-top: 6px; }
.att-why-box input { flex: 1; min-width: 0; padding: 6px 10px; border: 1px solid var(--line); border-radius: 8px; font: inherit; font-size: 14px; }
.rate-row { display: grid; grid-template-columns: minmax(90px, 160px) 1fr 52px; align-items: center; gap: 10px; padding: 6px 0; }
.rate-row small { grid-column: 2 / 4; color: var(--muted); font-size: 12px; margin-top: -4px; }
.rate-bar { height: 10px; background: var(--bg); border-radius: 99px; overflow: hidden; }
.rate-bar span { display: block; height: 100%; background: var(--teal); }
.rate-bar span.low, .day-bar span.low { background: var(--red); }
.day-bars { display: flex; align-items: flex-end; gap: 4px; height: 140px; overflow-x: auto; padding-bottom: 18px; }
.day-bar { flex: 1 0 18px; max-width: 34px; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; position: relative; }
.day-bar span { display: block; background: var(--teal); border-radius: 4px 4px 0 0; min-height: 2px; }
.day-bar small { position: absolute; bottom: -16px; inset-inline: 0; text-align: center; font-size: 10px; color: var(--muted); }
.att-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.att-table th, .att-table td { padding: 8px; border-bottom: 1px solid var(--line); text-align: start; white-space: nowrap; }
.att-table th { color: var(--muted); font-weight: 600; font-size: 12px; background: var(--bg); }
.att-table tr.low td:first-child { box-shadow: inset -3px 0 0 var(--red); }
.att-table .n-absent { color: var(--red); font-weight: 700; } .att-table .n-late { color: var(--amber-ink); font-weight: 700; }
.table-wrap { overflow-x: auto; }
/* ملف الطالب: أيام الحضور والتنبيهات */
.att-days { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; }
.att-day-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.att-day-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.att-day-main small { color: var(--muted); font-size: 13px; }
.att-day-side { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.sa-list { display: flex; flex-direction: column; gap: 8px; }
.sa-card { display: block; border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; background: #fff; }
.sa-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 4px; }
.sa-top small { margin-inline-start: auto; color: var(--muted); font-size: 12px; }
.sa-kind { font-size: 12px; font-weight: 700; color: var(--navy); background: var(--navy-soft); padding: 1px 9px; border-radius: 20px; }
.sa-level { font-size: 12px; font-weight: 700; padding: 1px 9px; border-radius: 20px; background: var(--amber-soft); color: var(--amber-ink); }
.lv-urgent .sa-level { background: var(--red-soft); color: var(--red); } .lv-positive .sa-level { background: var(--teal-soft); color: var(--teal); }
.sa-title { display: block; font-size: 15px; color: var(--navy); }
.sa-body { margin: 4px 0 0; color: var(--ink); white-space: pre-line; }
.sa-foot { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.sa-foot small { color: var(--muted); font-size: 12px; }
.ok-text { color: var(--teal) !important; font-weight: 700; }
.check-line { display: flex; align-items: center; gap: 8px; margin: 6px 0; cursor: pointer; }
.stu-acts { flex: none; }
@media (max-width: 600px) {
  .att-person { flex-wrap: wrap; }
  .att-person .stu-main { flex-basis: calc(100% - 90px); }
  .att-person-acts { width: 100%; }
  .att-person-acts > * { flex: 1; text-align: center; }
  .att-day-row { flex-direction: column; align-items: stretch; }
  .att-day-side { justify-content: flex-start; }
  .rate-row { grid-template-columns: 90px 1fr 46px; }
  .stu-acts { width: 100%; padding-inline-start: 34px; }
}
@media print {
  .att-parts, .att-person-acts, .att-table td:last-child, .att-table th:last-child { display: none !important; }
}

/* شرائح التصفية (مشتركة: الاختبارات والحضور وملف الطالب) */
.xb-chips { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.xb-chip { font: inherit; font-size: 13px; border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 4px 12px; cursor: pointer; color: var(--ink); }
.xb-chip.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.xb-chip .n { opacity: .7; margin-inline-start: 4px; }

/* منطقة الحذر — نفس مكونات المنصة: لوحات بيضاء، بطاقات مثل .menu-card، شريط .sub-banner، والخطورة بشارة فقط */
.dz { display: flex; flex-direction: column; gap: 12px; }
.dz-hero { margin: 0; align-items: flex-start; }
.dz-hero b { font-size: 16px; }
.dz-hero span { line-height: 1.8; font-size: 14px; }
.dz-tabs { margin: 0; }
.dz-wizard { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 16px; }
.dz-steps { list-style: none; margin: 0 0 16px; padding: 0 0 12px; display: flex; gap: 4px; overflow-x: auto; border-bottom: 1px solid var(--line); }
.dz-steps li { flex: 1; min-width: 86px; display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 12px; color: var(--muted); text-align: center; }
.dz-steps li span { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: var(--bg); border: 1px solid var(--line); font-weight: 700; font-size: 13px; }
.dz-steps li.on { color: var(--navy); font-weight: 700; } .dz-steps li.on span { background: var(--accent); color: #fff; border-color: var(--accent); }
.dz-steps li.done span { background: var(--teal-soft); color: var(--teal); border-color: var(--teal-soft); }
.dz-h { font-size: 15px; margin: 4px 0 8px; color: var(--navy); }
.dz-schools, .dz-ops { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 8px; }
.dz-schools { margin-top: 10px; }
.dz-school, .dz-op { font: inherit; text-align: start; display: flex; flex-direction: column; gap: 6px; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; cursor: pointer; color: var(--ink); }
.dz-school:hover, .dz-op:hover:not(:disabled) { border-color: var(--accent); background: var(--teal-soft); }
.dz-school b, .dz-op b { color: var(--navy); font-size: 15px; }
.dz-school small, .dz-op small { color: var(--muted); font-size: 12.5px; line-height: 1.6; }
.dz-op.on { border-color: var(--accent); box-shadow: 0 0 0 2px var(--teal-soft); background: #fff; }
.dz-op:disabled { opacity: .55; cursor: not-allowed; }
.dz-why { font-style: normal; font-size: 12px; color: var(--muted); font-weight: 600; }
.dz-school-tags { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.dz-school-bar { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; align-items: center; background: var(--bg); border-radius: 10px; padding: 10px 12px; margin-bottom: 12px; }
.dz-school-bar small { color: var(--muted); }
.dz-group { margin-bottom: 10px; }
.dz-op-top { display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.dz-op-top h3 { margin: 0; font-size: 17px; color: var(--navy); }
.dz-extra:not(:empty) { margin-top: 12px; }
.dz-param { background: var(--bg); border-radius: 12px; padding: 12px 14px; }
.dz-cats { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 6px; margin-top: 8px; }
.dz-cat { display: flex; gap: 8px; align-items: flex-start; background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; cursor: pointer; }
.dz-cat:hover { border-color: var(--accent); }
.dz-cat input { width: 18px; height: 18px; flex: none; margin-top: 2px; accent-color: var(--accent); }
.dz-cat span { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.dz-cat small { color: var(--muted); font-size: 12px; }
.dz-cat em { font-style: normal; font-weight: 700; color: var(--accent); font-size: 14px; }
.dz-cat.off { opacity: .5; cursor: default; }
.dz-nav { display: flex; justify-content: space-between; gap: 8px; margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.dz-card { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; margin-bottom: 12px; }
.dz-card h3 { margin: 0 0 6px; color: var(--navy); font-size: 16px; }
.dz-card p { margin: 6px 0; line-height: 1.8; }
.dz-impact { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.dz-affected, .dz-unaffected { border-radius: 12px; padding: 12px 14px; border: 1px solid var(--line); background: #fff; }
.dz-affected h4, .dz-unaffected h4 { margin: 0 0 8px; font-size: 14px; display: flex; align-items: center; gap: 6px; }
.dz-affected h4 { color: var(--red); } .dz-unaffected h4 { color: var(--teal); }
.dz-affected h4::before, .dz-unaffected h4::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.dz-unaffected ul { margin: 0; padding-inline-start: 18px; line-height: 1.9; font-size: 14px; }
.dz-total { font-weight: 700; margin: 8px 0 0; color: var(--navy); }
.dz-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.dz-table td, .dz-table th { padding: 7px 8px; border-bottom: 1px solid var(--line); text-align: start; }
.dz-table th { font-size: 12px; color: var(--muted); font-weight: 600; background: var(--bg); }
.dz-table td.n { text-align: end; font-weight: 700; white-space: nowrap; color: var(--navy); }
.dz-review { margin: 0; padding-inline-start: 18px; line-height: 2; }
.dz-ok { display: flex; flex-direction: column; gap: 4px; background: var(--teal-soft); color: var(--teal); border-radius: 12px; padding: 12px 14px; }
.dz-ok b { display: inline-flex; align-items: center; gap: 6px; }
.dz-ok small { color: var(--muted); }
.dz-ok.big b { font-size: 16px; }
@media (max-width: 640px) {
  .dz-impact { grid-template-columns: 1fr; }
  .dz-steps li { min-width: 64px; font-size: 11px; }
  .dz-wizard { padding: 12px; }
}
/* أرقام الحضور في ملف الطالب: شرائح مدمجة كما في بقية الملف */
.att-inline .s-present b { color: var(--teal); } .att-inline .s-absent b { color: var(--red); }
.att-inline .s-late b { color: var(--amber-ink); } .att-inline .s-excused b { color: var(--violet); }

/* نافذة تقدم العمليات الطويلة */
.job-row { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-top: 6px; }
.job-row b { color: var(--teal); font-variant-numeric: tabular-nums; }
.job-bar { height: 10px; border-radius: 6px; margin: 8px 0 12px; }
.job-bar > i { background: var(--teal); border-radius: 6px; transition: width .4s ease; }

.sub-banner.stack { flex-direction: column; align-items: stretch; }
.sub-banner.stack .btn { align-self: flex-start; }

/* المالية: شريط الأقسام، والبطاقات المختصرة، والموظفون، والرواتب */
.fin-parts { position: sticky; top: 0; z-index: 3; background: var(--bg); padding: 6px 0; }
.fin-range { align-items: end; margin-bottom: 10px; }
.fin-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; margin-bottom: 12px; }
.fin-card { margin: 0; display: flex; flex-direction: column; gap: 6px; }
.fin-card h3 { margin: 0 0 4px; font-size: 16px; }
.fin-card.amber { border-color: var(--amber); }
.fin-card .btn { align-self: flex-start; margin-top: auto; }
.fin-row { display: flex; justify-content: space-between; gap: 8px; }
.st-row { display: grid; grid-template-columns: minmax(180px, 1.4fr) minmax(260px, 1.6fr) auto; gap: 12px; align-items: center;
  padding: 12px 0; border-top: 1px solid var(--line); }
.st-who { min-width: 0; }
.st-pay { display: flex; gap: 8px; align-items: end; }
.st-pay .field { margin: 0; flex: 1; min-width: 90px; }
.st-total { display: flex; flex-direction: column; min-width: 90px; }
.st-acts { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.pay-list { border: 1px solid var(--line); border-radius: 12px; padding: 4px 12px; margin: 8px 0 12px; max-height: 420px; overflow: auto; }
.pay-line { display: flex; justify-content: space-between; gap: 8px; padding: 8px 0; border-top: 1px solid var(--line); }
.pay-line:first-child { border-top: 0; }
.pay-item { display: grid; grid-template-columns: minmax(170px, 1.2fr) 2fr minmax(110px, auto); gap: 12px; align-items: end;
  padding: 12px 0; border-top: 1px solid var(--line); }
.pay-fields { display: grid; grid-template-columns: repeat(4, minmax(70px, 1fr)); gap: 8px; }
.pay-fields .field { margin: 0; }
.pay-net { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }
@media (max-width: 760px) {
  .st-row, .pay-item { grid-template-columns: 1fr; }
  .st-acts { justify-content: flex-start; }
  .pay-fields { grid-template-columns: repeat(2, 1fr); }
  .pay-net { flex-direction: row; align-items: center; }
}
input.num { text-align: left; font-variant-numeric: tabular-nums; }

/* محتوى الأقسام لا يتمدد بعرض أعرض جدول فيه (عمود الشبكة الافتراضي يتمدد بحسب المحتوى):
   الجدول العريض يتمرر داخل لوحته بدل أن تتجاوز الصفحة عرض الشاشة */
.tabs-layout > [role="tabpanel"], .profile-layout > * { min-width: 0; }
.panel { min-width: 0; }
.panel > table, .panel > .grid, .panel > div > table.grid { display: block; overflow-x: auto; max-width: 100%; }

/* ===================== الإشعارات ===================== */
.bell-btn { position: relative; display: inline-flex; align-items: center; justify-content: center; width: 38px; height: 38px; flex: none;
  border-radius: 10px; border: 1px solid rgba(255,255,255,.35); background: transparent; color: #fff; cursor: pointer; -webkit-app-region: no-drag; }
.bell-btn:hover { background: rgba(255,255,255,.12); }
.bell-count { position: absolute; top: -6px; inset-inline-end: -6px; min-width: 19px; height: 19px; padding: 0 5px; border-radius: 10px;
  background: var(--amber); color: var(--navy); font-size: 11px; font-weight: 700; line-height: 19px; text-align: center; }
.inbox-dialog { display: grid; gap: 12px; min-width: min(460px, 86vw); }
.inbox-list { display: grid; gap: 6px; max-height: 60vh; overflow-y: auto; }
.inbox-item { display: flex; gap: 10px; align-items: flex-start; text-align: start; width: 100%; padding: 10px 12px; border-radius: 10px;
  border: 1px solid var(--line); background: #fff; color: var(--ink); font: inherit; cursor: pointer; }
.inbox-item.unread { border-color: var(--teal); background: var(--teal-soft); }
.inbox-item .ic { flex: none; width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: var(--navy-soft); color: var(--navy); }
.inbox-item .tx { display: grid; gap: 2px; min-width: 0; }
.inbox-item .tx small { color: var(--muted); font-size: 12.5px; overflow-wrap: anywhere; }
.inbox-item .tx small.muted { font-size: 11.5px; }
/* قائمة اختيار متعددة (الفئة المستهدفة للإعلان) */
.check-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 6px; max-height: 260px; overflow-y: auto;
  padding: 8px; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.check-grid .check { display: flex; align-items: center; gap: 8px; padding: 4px 6px; border-radius: 8px; cursor: pointer; font-size: 14px; }
.check-grid .check:hover { background: var(--bg); }
.check-grid .check input { width: 18px; height: 18px; accent-color: var(--accent); flex: none; }
/* مركز الإشعارات */
.ncenter { display: grid; gap: 10px; }
.ncenter-head { display: flex; gap: 8px; align-items: center; }
.ncenter-head input { flex: 1; min-width: 0; }
.nchips { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: thin; }
.nchip { flex: none; display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border-radius: 999px; border: 1px solid var(--line);
  background: #fff; color: var(--ink); font: inherit; font-size: 13px; cursor: pointer; }
.nchip.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.nchip .n { min-width: 18px; padding: 0 5px; border-radius: 9px; background: var(--red); color: #fff; font-size: 11px; line-height: 18px; text-align: center; }
.inbox-row { display: flex; align-items: stretch; gap: 4px; }
.inbox-row .inbox-item { flex: 1; min-width: 0; }
.inbox-row.unread .inbox-item { border-color: var(--teal); background: var(--teal-soft); }
.inbox-item.p1 .ic { background: var(--red-soft); color: var(--red); }
.inbox-item.p2 .ic { background: var(--amber-soft); color: var(--amber-ink); }
.inbox-item .tx b { overflow-wrap: anywhere; }
.inbox-item .prio { margin-inline-start: 8px; padding: 0 6px; border-radius: 6px; font-size: 11px; }
.inbox-item .prio.p1 { background: var(--red-soft); color: var(--red); }
.inbox-item .prio.p2 { background: var(--amber-soft); color: var(--amber-ink); }
.inbox-item .rep { margin-inline-start: 8px; color: var(--muted); }
.inbox-archive { flex: none; width: 34px; border: 1px solid transparent; border-radius: 10px; background: transparent; color: var(--muted); cursor: pointer;
  display: grid; place-items: center; }
.inbox-archive:hover { background: var(--bg); border-color: var(--line); color: var(--ink); }
.push-invite { display: grid; gap: 8px; padding: 14px; margin-bottom: 12px; border-radius: 12px; border: 1px solid var(--teal); background: var(--teal-soft); }
.push-invite .pi-head { display: flex; align-items: center; gap: 10px; color: var(--navy); }
.push-invite .pi-ic { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; background: #fff; color: var(--teal); flex: none; }
.push-invite .sub { margin: 0; }
.nprefs { display: grid; gap: 8px; margin-top: 10px; }
.nprefs-list { display: grid; gap: 4px; }
.nprefs-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 12px; border-radius: 10px; background: var(--bg); }
.nprefs-row .sub { margin: 0; display: inline-flex; align-items: center; gap: 4px; }
.nprefs-row .switch[aria-disabled="true"] { opacity: .55; cursor: not-allowed; }
.push-toggle { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 12px; border-radius: 10px; background: var(--bg); }
.push-toggle .sub { margin: 0; }
.rules-table { width: 100%; border-collapse: collapse; }
.rules-table th, .rules-table td { padding: 8px 6px; border-bottom: 1px solid var(--line); text-align: start; }
.rules-table td.c, .rules-table th.c { text-align: center; width: 92px; }
@media (max-width: 640px) { .bell-btn { width: 34px; height: 34px; } }

/* ===================== السلوك ===================== */
.beh-kpis .s-present b { color: var(--teal); } .beh-kpis .s-absent b { color: var(--red); }
.beh-list { display: grid; gap: 6px; }
.beh-row { display: flex; gap: 12px; align-items: flex-start; padding: 10px 12px; border-radius: 10px; background: #fff; border: 1px solid var(--line); }
.beh-row .pts { flex: none; min-width: 46px; text-align: center; font-weight: 700; border-radius: 8px; padding: 4px 6px; }
.beh-row.positive .pts { color: var(--teal); background: var(--teal-soft); }
.beh-row.negative .pts { color: var(--red); background: var(--red-soft); }
.beh-row small.muted { color: var(--muted); font-size: 12px; }
.beh-cats { display: flex; flex-wrap: wrap; gap: 6px; }
.beh-cat { border: 1px solid var(--line); background: #fff; border-radius: 20px; padding: 6px 12px; font: inherit; cursor: pointer; display: inline-flex; gap: 6px; align-items: center; }
.beh-cat.positive { border-color: var(--teal); color: var(--teal); }
.beh-cat.negative { border-color: var(--red); color: var(--red); }
.beh-cat.on.positive { background: var(--teal); color: #fff; }
.beh-cat.on.negative { background: var(--red); color: #fff; }
.beh-pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 6px; max-height: 320px; overflow-y: auto; }
.beh-pick label { display: flex; gap: 8px; align-items: center; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; background: #fff; cursor: pointer; }
.beh-pick label:has(input:checked) { border-color: var(--teal); background: var(--teal-soft); }
.score-pill { display: inline-block; min-width: 44px; text-align: center; padding: 2px 8px; border-radius: 12px; font-weight: 700; background: var(--teal-soft); color: var(--teal); }
.score-pill.low { background: var(--red-soft); color: var(--red); }

/* ===================== الشهادات ===================== */
.verify-card .verify-head { display: flex; gap: 14px; align-items: center; margin-bottom: 14px; }
.verify-card .verify-head h1 { margin: 0; font-size: 22px; }
.verify-card .verify-head p { margin: 2px 0 0; color: var(--muted); }
.verify-card.valid .verify-head { color: var(--teal); }
.verify-card.revoked .verify-head { color: var(--red); }
.cert-sheet { display: grid; gap: 18px; }
.cert { background: #fff; border: 3px double var(--navy); border-radius: 6px; padding: 26px 30px; position: relative; color: var(--ink); }
.cert .cert-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; border-bottom: 2px solid var(--navy); padding-bottom: 10px; }
.cert .cert-top .doc-school-logo, .cert .cert-top img { max-height: 64px; max-width: 120px; }
.cert .cert-school { font-weight: 700; font-size: 18px; color: var(--navy); }
.cert h2.cert-title { text-align: center; font-size: 24px; margin: 18px 0 6px; color: var(--navy); }
.cert .cert-scope { text-align: center; color: var(--muted); margin-bottom: 14px; }
.cert .cert-intro { text-align: center; font-size: 16px; line-height: 2; margin: 0 0 12px; }
.cert .cert-intro b { font-size: 19px; }
.cert table { width: 100%; border-collapse: collapse; margin: 8px 0 12px; font-size: 14px; }
.cert th, .cert td { border: 1px solid var(--line); padding: 6px 8px; text-align: center; }
.cert th { background: var(--navy-soft); color: var(--navy); }
.cert .cert-result { text-align: center; font-size: 18px; font-weight: 700; margin: 10px 0; }
.cert .cert-result.pass { color: var(--teal); } .cert .cert-result.fail { color: var(--red); }
.cert .cert-foot { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; margin-top: 18px; }
.cert .cert-qr { text-align: center; font-size: 11px; color: var(--muted); }
.cert .cert-qr img { width: 92px; height: 92px; display: block; margin: 0 auto 4px; }
.cert .cert-sign { text-align: center; min-width: 180px; }
.cert .cert-sign .line-sign { border-top: 1px solid var(--ink); margin-top: 38px; padding-top: 4px; }
.cert.revoked::after { content: "ملغاة"; position: absolute; inset: 0; display: grid; place-items: center; font-size: 80px; color: rgba(184,65,47,.18); transform: rotate(-20deg); pointer-events: none; }
@media print {
  .cert-sheet { gap: 0; }
  .cert { break-after: page; page-break-after: always; border-radius: 0; min-height: 26cm; }
  .cert:last-child { break-after: auto; page-break-after: auto; }
}
@media (max-width: 640px) { .cert { padding: 16px 12px; } .cert h2.cert-title { font-size: 19px; } .cert table { font-size: 12px; } }

/* ===================== الاختبار الإلكتروني ===================== */
.oe-take { display: grid; gap: 12px; }
.oe-bar { position: sticky; top: 0; z-index: 15; display: flex; justify-content: space-between; align-items: center; gap: 10px;
  background: var(--navy); color: #fff; padding: 10px 14px; border-radius: 12px; }
.oe-bar small { display: block; color: rgba(255,255,255,.8); }
.oe-bar-side { display: flex; align-items: center; gap: 12px; text-align: end; }
.oe-timer { font-size: 22px; font-variant-numeric: tabular-nums; direction: ltr; background: rgba(255,255,255,.12); padding: 2px 10px; border-radius: 8px; }
.oe-timer.low { background: var(--red); }
.oe-section h3 { margin: 6px 0 2px; color: var(--navy); }
.oe-question { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 14px; display: grid; gap: 10px; }
.oe-qhead { display: flex; justify-content: space-between; align-items: center; }
.oe-qtext { font-size: 16px; line-height: 1.9; overflow-wrap: anywhere; }
.oe-img { display: block; margin: 0 auto; height: auto; border-radius: 8px; max-height: 360px; }
.oe-choices { display: grid; gap: 8px; }
.oe-choices.tf { grid-template-columns: 1fr 1fr; }
.oe-choices label { display: flex; gap: 10px; align-items: center; padding: 12px; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; min-height: 48px; }
.oe-choices label:has(input:checked) { border-color: var(--teal); background: var(--teal-soft); }
.oe-choices input { width: 20px; height: 20px; flex: none; }
.oe-fill { display: grid; gap: 8px; }
.oe-match { display: grid; gap: 8px; }
.oe-match-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; align-items: center; }
.oe-match-row select { width: 100%; min-height: 44px; }
.oe-order { margin: 0; padding-inline-start: 22px; display: grid; gap: 6px; }
.oe-order li { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; }
.oe-order-btns { display: flex; gap: 4px; flex: none; }
.oe-table { border-collapse: collapse; width: 100%; } .oe-table td, .oe-table th { border: 1px solid var(--line); padding: 6px; text-align: center; }
.oe-submit { padding: 6px 0 20px; }
.oe-done { text-align: center; } .oe-score { font-size: 22px; font-weight: 700; color: var(--teal); }
.oe-review-list { display: grid; gap: 10px; max-height: 70vh; overflow-y: auto; min-width: min(560px, 86vw); }
.oe-review { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; display: grid; gap: 6px; background: #fff; }
.oe-opts { margin: 0; padding-inline-start: 18px; } .oe-opts li.right { color: var(--teal); font-weight: 700; } .oe-opts li.picked::after { content: " ← إجابته"; color: var(--muted); font-weight: 400; font-size: 12px; }
.oe-essay { white-space: pre-wrap; background: var(--bg); border-radius: 8px; padding: 8px 10px; }
@media (max-width: 640px) { .oe-match-row { grid-template-columns: 1fr; } }

/* ===================== شؤون الموظفين ===================== */
.sa-list { display: grid; gap: 6px; margin: 10px 0; }
.sa-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 10px; align-items: center; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.sa-btns { display: flex; flex-wrap: wrap; gap: 4px; }
.sa-st { border: 1px solid var(--line); background: #fff; border-radius: 8px; padding: 5px 10px; font: inherit; font-size: 13px; cursor: pointer; min-height: 34px; }
.sa-st.on.s-present { background: var(--teal); color: #fff; border-color: var(--teal); }
.sa-st.on.s-late { background: var(--amber); color: var(--navy); border-color: var(--amber); }
.sa-st.on.s-absent { background: var(--red); color: #fff; border-color: var(--red); }
.sa-st.on.s-leave, .sa-st.on.s-excused { background: var(--violet); color: #fff; border-color: var(--violet); }
.lp-view { display: grid; gap: 8px; min-width: min(560px, 86vw); }
.lp-block p { margin: 2px 0 0; white-space: pre-wrap; }
.lp-form textarea { min-height: 70px; }
.cal-month { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.cal-month .dow { text-align: center; font-size: 12px; color: var(--muted); font-weight: 700; }
.cal-day { min-height: 84px; background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 4px; display: grid; align-content: start; gap: 2px; min-width: 0; }
.cal-day.out { background: transparent; border-style: dashed; opacity: .55; }
.cal-day.today { border-color: var(--teal); box-shadow: inset 0 0 0 1px var(--teal); }
.cal-day .n { font-size: 12px; font-weight: 700; color: var(--navy); }
.cal-ev { font-size: 11px; line-height: 1.35; border-radius: 4px; padding: 1px 4px; background: var(--navy-soft); color: var(--navy); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; cursor: pointer; border: 0; text-align: start; font-family: inherit; }
.cal-ev.holiday { background: var(--amber-soft); color: var(--amber-ink); }
.cal-ev.exam { background: var(--red-soft); color: var(--red); }
.cal-ev.term { background: var(--teal-soft); color: var(--teal); }
.cal-list { display: grid; gap: 6px; }
.cal-item { display: flex; gap: 12px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; background: #fff; align-items: flex-start; }
.cal-item .d { flex: none; width: 54px; text-align: center; border-radius: 8px; background: var(--navy-soft); color: var(--navy); padding: 4px; font-weight: 700; line-height: 1.2; }
.cal-item .d small { display: block; font-weight: 400; font-size: 11px; }
@media (max-width: 640px) {
  .sa-row { grid-template-columns: 1fr; }
  .cal-month { display: none; }
}

/* ===================== الاستبيانات والمواعيد ===================== */
.sv-rating { display: flex; gap: 6px; }
.sv-rating label { flex: 1; text-align: center; border: 1px solid var(--line); border-radius: 10px; padding: 10px 0; cursor: pointer; }
.sv-rating input { display: none; }
.sv-rating label:has(input:checked) { background: var(--teal); color: #fff; border-color: var(--teal); }
.sv-bar { display: grid; grid-template-columns: minmax(80px, 30%) 1fr 40px; gap: 8px; align-items: center; font-size: 13px; }
.sv-bar i { display: block; height: 10px; border-radius: 6px; background: var(--teal); min-width: 2px; }
.mt-group { border: 1px solid var(--line); border-radius: 10px; padding: 10px; margin-bottom: 8px; background: #fff; }
.mt-slots { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.mt-slot { border: 1px solid var(--teal); color: var(--teal); background: #fff; border-radius: 8px; padding: 6px 12px; font: inherit; cursor: pointer; direction: ltr; min-height: 38px; }
.mt-slot:hover { background: var(--teal-soft); }

/* ---------- المساعد الذكي ---------- */
.ai-ask { display: flex; gap: 8px; align-items: flex-end; margin: 10px 0 4px; }
.ai-ask textarea { flex: 1; min-height: 48px; resize: vertical; }
.ai-suggest { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0; }
.ai-suggest .chip { color: var(--navy); font-weight: 500; text-align: right; }
.ai-privacy { display: block; margin-top: 6px; }
.ai-thread { display: flex; flex-direction: column; gap: 14px; }
.ai-turn { display: flex; flex-direction: column; gap: 6px; }
.ai-q { align-self: flex-start; max-width: 85%; background: var(--navy); color: #fff; padding: 8px 12px; border-radius: 14px 14px 14px 4px; white-space: pre-wrap; overflow-wrap: anywhere; }
.ai-a { position: relative; background: var(--bg); border: 1px solid var(--line); border-radius: 14px; padding: 10px 14px 10px 14px; padding-inline-start: 34px; overflow-wrap: anywhere; min-width: 0; }
.ai-mark { position: absolute; inset-inline-start: 10px; top: 12px; color: var(--teal); }
.ai-answer p { margin: 0 0 8px; line-height: 1.8; }
.ai-answer h4 { margin: 10px 0 6px; font-size: 15px; }
.ai-answer ul, .ai-answer ol { margin: 0 0 8px; padding-inline-start: 20px; line-height: 1.8; }
.ai-answer table { margin: 6px 0 10px; font-size: 13px; }
.ai-wait { display: flex; align-items: center; gap: 4px; color: var(--muted); }
.ai-wait span { width: 6px; height: 6px; border-radius: 50%; background: var(--teal); animation: ai-dot 1s infinite ease-in-out; }
.ai-wait span:nth-child(2) { animation-delay: .15s; } .ai-wait span:nth-child(3) { animation-delay: .3s; }
@keyframes ai-dot { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }
@media (max-width: 600px) { .ai-ask { flex-direction: column; align-items: stretch; } .ai-q { max-width: 100%; } }
.ai-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px; margin: 12px 0; }
.ai-card { display: flex; gap: 10px; align-items: flex-start; text-align: right; font: inherit; padding: 12px; border: 1.5px solid var(--line); border-radius: 14px; background: #fff; cursor: pointer; color: var(--ink); }
.ai-card:hover { border-color: var(--teal); }
.ai-card.on { border-color: var(--teal); background: var(--teal-soft); }
.ai-card b { display: block; font-size: 15px; }
.ai-card small { display: block; color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.ai-card-icon { flex: none; width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: var(--teal-soft); color: var(--teal); }
.ai-params { align-items: end; margin-bottom: 6px; }
.ai-report { border-top: 1px solid var(--line); padding-top: 12px; margin-top: 4px; }
.ai-tips { background: var(--amber-soft); border-radius: 12px; padding: 10px 14px; margin-top: 10px; }
.ai-tips ul { margin: 6px 0 0; }
@media (max-width: 600px) { .ai-cards { grid-template-columns: 1fr 1fr; } .ai-card { flex-direction: column; } }
/* قائمة واتساب وبوابة المدرسة */
.gw-steps { margin: 6px 0 10px; padding-inline-start: 20px; line-height: 1.9; }
.wa-vars { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 10px; }
.wa-vars .chip { color: var(--teal); }
.wa-progress { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; color: var(--muted); font-size: 13px; }
.wa-progress .bar { flex: 1; height: 8px; margin: 0; }
.wa-progress .bar > i { background: var(--teal); }
.wa-card { border: 1.5px solid var(--line); border-radius: 14px; padding: 12px 14px; background: var(--bg); }
.wa-body { white-space: pre-wrap; overflow-wrap: anywhere; margin: 8px 0 0; line-height: 1.8; }
.wa-actions { display: flex; gap: 8px; margin: 12px 0 6px; }
.wa-actions .wa-send { flex: 1; text-align: center; background: #1f9d55; border-color: #1f9d55; }
.wa-done { text-align: center; padding: 18px 0; }
.sw-line { display: inline-flex; align-items: center; gap: 8px; }

/* توزيع الدرجات */
.gc-rows { display: grid; gap: 8px; margin: 12px 0; }
.gc-row { display: grid; grid-template-columns: 28px minmax(0, 1fr) auto auto auto; gap: 10px; align-items: center; padding: 8px 10px; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.gc-row .gc-n { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--bg); font-weight: 700; font-size: 13px; }
.gc-row .gc-w, .gc-row .gc-d { display: flex; align-items: center; gap: 6px; white-space: nowrap; font-size: 13px; color: var(--muted); }
@media (max-width: 560px) {
  .gc-row { grid-template-columns: 28px minmax(0, 1fr); }
  .gc-row .gc-w, .gc-row .gc-d { grid-column: 2; }
}

/* بطاقة ولي الأمر */
.pc-sheet { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 430px), 1fr)); gap: 16px; }
.pc-wrap { display: grid; gap: 8px; align-content: start; }
.pc { background: #fff; border: 1px solid var(--line); border-radius: 18px; overflow: hidden; box-shadow: 0 6px 20px rgba(20, 33, 61, .06); break-inside: avoid; }
.pc-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 12px 16px; background: var(--teal, #0f5e5f); color: #fff; }
.pc-school { display: flex; align-items: center; gap: 10px; min-width: 0; }
.pc-school b { display: block; font-size: 15px; line-height: 1.3; }
.pc-school small { color: #cfe7e6; font-size: 12px; }
.pc-logo { height: 38px; width: 38px; object-fit: contain; background: #fff; border-radius: 10px; padding: 3px; flex: none; }
.pc-tag { font-weight: 800; color: var(--amber, #ffb703); font-size: 14px; }
.pc-body { display: grid; grid-template-columns: minmax(0, 1fr) 118px; gap: 14px; padding: 14px 16px 10px; align-items: start; }
.pc-name { font-size: 20px; font-weight: 800; color: var(--navy, #14213d); line-height: 1.35; margin-bottom: 8px; }
.pc-meta { display: grid; gap: 4px; margin-bottom: 10px; }
.pc-meta span { display: flex; gap: 8px; align-items: baseline; font-size: 13.5px; }
.pc-meta small { color: var(--muted); min-width: 68px; }
.pc-key { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 8px 12px; border: 1.5px dashed var(--amber, #ffb703); background: var(--amber-soft, #fff4d6); border-radius: 12px; }
.pc-key small { color: #7a5800; font-weight: 600; }
.pc-key b { font-family: ui-monospace, Menlo, monospace; font-size: 20px; letter-spacing: 1.5px; color: var(--navy, #14213d); }
.pc-qr { margin: 0; text-align: center; }
.pc-qr img { width: 118px; height: 118px; display: block; border: 1px solid var(--line); border-radius: 10px; padding: 4px; background: #fff; }
.pc-qr figcaption { font-size: 11px; color: var(--muted); margin-top: 4px; }
.pc-foot { display: grid; gap: 2px; padding: 8px 16px 12px; background: var(--bg); font-size: 11.5px; color: var(--muted); text-align: center; }
.pc-foot .ltr { color: var(--teal, #0f5e5f); font-weight: 700; font-size: 12.5px; }
.pc-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.pc-single { max-width: 520px; }
@media (max-width: 420px) { .pc-body { grid-template-columns: minmax(0, 1fr) 96px; } .pc-qr img { width: 96px; height: 96px; } }
@media print {
  .no-print, .pc-actions { display: none !important; }
  .pc-sheet { grid-template-columns: repeat(2, 1fr); gap: 8mm; }
  .pc { box-shadow: none; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  body.pc-print-one .pc:not(.pc-printing), body.pc-print-one .panel, body.pc-print-one .toolbar { display: none !important; }
  body.pc-print-one .pc-sheet { display: block; }
  body.pc-print-one .pc.pc-printing { max-width: 120mm; margin: 0 auto; }
}

/* شريط مدرسة العرض التجريبي (أسفل الشاشة، لا يغطي المحتوى) */
.demo-bar { position: fixed; inset-inline: 0; bottom: 0; z-index: 900; display: flex; align-items: center; justify-content: center; gap: 10px; flex-wrap: wrap;
  padding: 10px 14px calc(10px + env(safe-area-inset-bottom)); background: #16244A; color: #fff; font-size: 14px; font-weight: 600;
  box-shadow: 0 -6px 20px rgba(0,0,0,.18); }
.demo-bar .btn { background: #E8A33D; color: #16244A; border-color: transparent; }
.demo-bar .btn.ghost { background: transparent; color: #fff; border: 1px solid rgba(255,255,255,.4); }
html.demo-mode body { padding-bottom: 64px; }
@media (max-width: 600px) { .demo-bar { font-size: 13px; gap: 8px; } html.demo-mode body { padding-bottom: 96px; } }
@media print { .demo-bar { display: none !important; } html.demo-mode body { padding-bottom: 0; } }
html.demo-mode .att-bar { bottom: 58px; }
html.demo-mode .toast { bottom: 78px; z-index: 950; }

@media (max-width: 600px) { html.demo-mode .toast { bottom: 108px; }  }
/* بطاقة الحضور (QR للبوابة) */
.ac { width: 86mm; height: 54mm; box-sizing: border-box; border: 1px solid var(--line); border-radius: 3mm; background: #fff; color: var(--ink);
  display: flex; align-items: center; gap: 3mm; padding: 3.5mm 4mm; overflow: hidden; position: relative; border-top: 3mm solid var(--navy); }
.ac-info { flex: 1; min-width: 0; display: grid; gap: 1mm; align-content: center; }
.ac-school { font-size: 9pt; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ac-kind { font-size: 8pt; font-weight: 700; color: var(--teal); }
.ac-name { font-size: 12.5pt; line-height: 1.3; }
.ac-class { font-size: 10pt; color: var(--navy); font-weight: 600; }
.ac-foot { font-size: 6.5pt; color: var(--muted); margin-top: 1mm; }
.ac-qr { width: 38mm; height: 38mm; flex: none; image-rendering: pixelated; }
.ac-preview { display: grid; justify-items: center; gap: 10px; overflow-x: auto; }
.ac-sheet { display: none; }
@media print {
  body.ac-printing > :not(.ac-sheet) { display: none !important; }
  body.ac-printing .ac-sheet { display: grid; grid-template-columns: repeat(2, 86mm); gap: 5mm 6mm; justify-content: center; padding: 6mm 0; }
  body.ac-printing .ac { break-inside: avoid; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
/* صفحة رمز البطاقة (من يمسحه بجوال عادي) */
.gate-card-page { max-width: 460px; margin: 0 auto; padding: 48px 20px; text-align: center; }
.gate-card-page img { margin: 0 auto 12px; display: block; }
/* حالات الحضور الجديدة */
.stu-today.s-permitted, .gb-st.s-permitted { background: var(--navy-soft); color: var(--navy); }
.stu-today.s-trip, .stu-today.s-activity { background: var(--teal-soft); color: var(--teal); }
/* البوابة الذكية — شاشة الإدارة */
.gate-admin { display: grid; gap: 14px; }
.gate-phase { border-radius: 12px; padding: 10px 14px; font-weight: 600; font-size: 14px; }
.gate-phase.open { background: var(--teal-soft); color: var(--teal); }
.gate-phase.wait { background: var(--amber-soft); color: var(--amber-ink); }
.gate-phase.closed { background: var(--red-soft); color: var(--red); }
.gate-phase.done { background: var(--navy-soft); color: var(--navy); }
.gate-stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 8px; }
.gate-stats .gs { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; display: grid; }
.gate-stats .gs b { font-size: 24px; line-height: 1.2; color: var(--navy); }
.gate-stats .gs small { color: var(--muted); font-size: 12.5px; }
.gate-stats .gs.ok b { color: var(--teal); } .gate-stats .gs.late b { color: var(--amber-ink); }
.gate-stats .gs.warn { border-color: var(--amber); background: var(--amber-soft); } .gate-stats .gs.bad b { color: var(--red); }
.gate-rate { text-align: center; } .gate-rate b { display: block; font-size: 26px; color: var(--teal); } .gate-rate small { color: var(--muted); }
.gate-feed { display: grid; gap: 6px; max-height: 480px; overflow-y: auto; }
.gf-row { display: flex; justify-content: space-between; gap: 10px; align-items: center; padding: 8px 12px; border-radius: 10px; background: var(--bg);
  border-inline-start: 4px solid var(--line); }
.gf-row.r-present { border-color: var(--teal); } .gf-row.r-late { border-color: var(--amber); } .gf-row.r-rejected { border-color: var(--red); }
.gf-main { display: grid; min-width: 0; } .gf-main small { color: var(--muted); font-size: 12.5px; }
.gf-side { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; justify-content: flex-end; } .gf-side small { color: var(--muted); font-size: 12px; }
.gate-groups { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.gate-group { border: 1px solid var(--line); border-radius: 12px; padding: 8px 10px; background: #fff; display: grid; gap: 2px; align-content: start; }
.gg-head { display: flex; align-items: center; gap: 8px; } .gg-head small { color: var(--muted); flex: 1; }
.gate-un { display: flex; align-items: center; gap: 8px; padding: 3px 0; flex-wrap: wrap; }
.gate-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-end; } .gate-actions > input { flex: 1; min-width: 220px; }
.gate-devs { display: grid; gap: 8px; }
.gate-dev { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; background: #fff; display: flex; flex-wrap: wrap; gap: 10px; justify-content: space-between; }
.gate-dev.s-pending { border-color: var(--amber); background: var(--amber-soft); }
.gd-main { display: grid; gap: 4px; min-width: 0; flex: 1; }
.gd-actions { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.gate-link { display: grid; gap: 10px; justify-items: center; text-align: center; }
.gate-link-qr { width: 220px; height: 220px; image-rendering: pixelated; }
/* ربط جوال بالرمز */
.gj-hero { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; padding: 16px 18px; border-radius: 16px;
  background: linear-gradient(135deg, var(--navy), #0B4D4A); color: #fff; margin-bottom: 14px; }
.gj-hero b { font-size: 17px; }
.gj-hero p { margin: 4px 0 0; opacity: .85; line-height: 1.8; font-size: 14px; max-width: 560px; }
.gj-hero .btn { background: #F0A53A; color: #16244A; border-color: #F0A53A; font-weight: 700; padding-inline: 22px; }
.gj { display: grid; gap: 10px; justify-items: center; text-align: center; }
.gj-step { margin: 0; color: var(--muted); }
.gj-code { font: 800 46px/1.1 ui-monospace, Menlo, Consolas, monospace; letter-spacing: 8px; color: var(--navy); background: var(--teal-soft);
  border-radius: 16px; padding: 10px 18px; }
.gj-joined { display: grid; gap: 6px; width: 100%; }
.gj-dev { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 8px 12px; border-radius: 10px; background: var(--bg); }
.gj-wait { margin: 0; }
.gate-link-url { font-size: 12px; overflow-wrap: anywhere; background: var(--bg); padding: 6px 8px; border-radius: 8px; max-width: 100%; }
.gate-times { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; }
.ac-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 12px; margin-top: 10px; }
.ac-item { display: grid; gap: 6px; justify-items: start; overflow-x: auto; }
.att-name .att-gate { color: var(--teal); font-weight: 600; }
.att-monthly { margin: 8px 0; } .att-monthly td, .att-monthly th { text-align: center; white-space: nowrap; }
.gate-filters { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; align-items: end; margin-bottom: 8px; }
.gate-records td, .gate-records th { white-space: nowrap; }
.gate-stage { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; display: grid; gap: 6px; margin-bottom: 8px; background: #fff; }

/* محدد الأبناء في ملف الطالب */
.kid-switch { display: flex; gap: 6px; overflow-x: auto; padding: 2px 0 6px; scrollbar-width: none; }
.kid-switch::-webkit-scrollbar { display: none; }
.kid-switch a, .kid-switch span { flex: none; padding: 7px 14px; border-radius: 99px; border: 1px solid var(--line); background: #fff; color: var(--ink);
  text-decoration: none; font-weight: 600; font-size: 14px; white-space: nowrap; }
.kid-switch .on { background: var(--navy); color: #fff; border-color: var(--navy); }
button.link { background: none; border: 0; padding: 0; color: var(--teal); font: inherit; font-weight: 600; cursor: pointer; text-decoration: underline; }
.pa-list { display: grid; gap: 6px; margin-top: 8px; }
.pa-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; text-align: start; width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: #fff; font: inherit; color: inherit; cursor: pointer; }
.pa-row:hover { border-color: var(--teal); }
.pa-main { display: grid; min-width: 0; flex: 1; }
.pa-kids { display: flex; gap: 4px; flex-wrap: wrap; }
.pa-kid { font-size: 12.5px; padding: 2px 9px; border-radius: 99px; background: var(--teal-soft); color: var(--teal); font-weight: 600; }
.pa-kid.old { background: var(--bg); color: var(--muted); text-decoration: line-through; }
.pa-creds { display: grid; gap: 8px; max-height: 60vh; overflow-y: auto; }
.pa-cred { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: space-between; padding: 8px; border: 1px solid var(--line); border-radius: 10px; }
.pa-cred > div { display: grid; }
.pa-results { display: grid; gap: 4px; margin: 6px 0; }
.pa-pick { display: flex; justify-content: space-between; gap: 8px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; background: #fff; font: inherit; cursor: pointer; text-align: start; }
.pa-pick:hover { border-color: var(--teal); }
