@charset "UTF-8";
/* =====================================================================
   مدارس نور المصطفى الأهلية — نظام التصميم
   هوية: أزرق ملكي + أخضر + ذهبي + أبيض  |  RTL  |  Mobile First
   ===================================================================== */

/* ------------------------------------------------------------ tokens */
:root {
  /* الهوية */
  --royal-900: #062E5E;
  --royal-800: #083B77;
  --royal-700: #0A4789;
  --royal-600: #0D539B;
  --royal-500: #1264B4;
  --royal-300: #7FADDC;
  --royal-100: #DCE9F7;
  --royal-50:  #EFF5FC;

  --green-700: #17773A;
  --green-600: #1D8E45;
  --green-500: #26A455;
  --green-100: #DCF1E3;
  --green-50:  #EFF9F2;

  --gold-700:  #A9720B;
  --gold-600:  #C98A08;
  --gold-500:  #E3A50D;
  --gold-400:  #F2BC38;
  --gold-100:  #FBEFD2;
  --gold-50:   #FDF8EC;

  --red-600:   #C0392B;
  --red-500:   #D94F41;
  --red-100:   #FAE2DF;
  --red-50:    #FDF1EF;

  /* أدوار الألوان */
  --primary:        var(--royal-600);
  --primary-strong: var(--royal-800);
  --primary-soft:   var(--royal-50);
  --secondary:      var(--green-600);
  --secondary-soft: var(--green-50);
  --accent:         var(--gold-600);
  --accent-soft:    var(--gold-50);
  --danger:         var(--red-600);
  --danger-soft:    var(--red-50);

  /* الأسطح والنصوص */
  --canvas:   #F4F7FB;
  --surface:  #FFFFFF;
  --surface-2:#FAFBFD;
  --ink:      #0E1B2C;
  --ink-2:    #3D4C61;
  --muted:    #6B7A90;
  --faint:    #97A3B4;
  --line:     #E5EAF1;
  --line-2:   #EFF2F7;

  /* الظلال — خفيفة جداً */
  --sh-1: 0 1px 2px rgba(14, 27, 44, .04), 0 1px 3px rgba(14, 27, 44, .04);
  --sh-2: 0 2px 4px rgba(14, 27, 44, .04), 0 6px 16px rgba(14, 27, 44, .06);
  --sh-3: 0 8px 28px rgba(14, 27, 44, .10);
  --sh-brand: 0 6px 18px rgba(13, 83, 155, .18);

  /* الزوايا */
  --r-xs: 8px;
  --r-sm: 12px;
  --r-md: 16px;
  --r-lg: 20px;
  --r-xl: 26px;
  --r-full: 999px;

  /* المقاسات */
  --sidebar: 268px;
  --topbar: 64px;
  --bottomnav: 62px;
  --maxw: 1240px;

  --ease: cubic-bezier(.22, .61, .36, 1);
  --t-fast: .14s var(--ease);
  --t: .22s var(--ease);

  --font: "IBM Plex Sans Arabic", "Tajawal", "Segoe UI", system-ui, -apple-system, sans-serif;
}

/* ----------------------------------------------------------- dark */
:root[data-theme="dark"] {
  --canvas:   #0B1220;
  --surface:  #121C2D;
  --surface-2:#0F1829;
  --ink:      #EAF0F8;
  --ink-2:    #C3CEDD;
  --muted:    #93A2B7;
  --faint:    #6C7C92;
  --line:     #1E2C42;
  --line-2:   #182438;
  --primary:  #3D87D8;
  --primary-soft: #16283F;
  --secondary-soft: #10291C;
  --accent-soft: #2A2110;
  --danger-soft: #2C1614;
  --royal-50: #16283F;
  --royal-100:#1B3352;
  --green-100:#16351F;
  --gold-100: #3A2C10;
  --red-100:  #3A1D19;
  --sh-1: 0 1px 2px rgba(0,0,0,.28);
  --sh-2: 0 4px 16px rgba(0,0,0,.30);
  --sh-3: 0 10px 34px rgba(0,0,0,.42);
  --sh-brand: 0 6px 18px rgba(0,0,0,.4);
  color-scheme: dark;
}

/* ------------------------------------------------------------ reset */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; padding: 0; }

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font);
  background: var(--canvas);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.65;
  direction: rtl;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overscroll-behavior-y: none;
  min-height: 100dvh;
}

img, svg { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
button { background: none; border: 0; cursor: pointer; }
a { color: inherit; text-decoration: none; }
ul, ol { list-style: none; }

h1, h2, h3, h4 { line-height: 1.35; font-weight: 700; letter-spacing: -.01em; }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.2rem; }
h3 { font-size: 1.02rem; }

:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
  border-radius: 6px;
}

::selection { background: var(--royal-100); color: var(--royal-900); }

/* شريط تمرير أنيق */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--line); border-radius: 99px; border: 3px solid var(--canvas); }
::-webkit-scrollbar-thumb:hover { background: var(--faint); }

/* أرقام بعرض ثابت للجداول والمبالغ */
.num, .stat-value, .money, .kpi b { font-variant-numeric: tabular-nums; font-feature-settings: "tnum" 1; }

/* ================================================================
   1. الشاشة الافتتاحية (Splash)
   ================================================================ */
#splash {
  position: fixed; inset: 0; z-index: 9999;
  display: grid; place-items: center;
  background:
    radial-gradient(ellipse 80% 55% at 50% 18%, rgba(227,165,13,.22), transparent 58%),
    radial-gradient(ellipse 70% 50% at 80% 90%, rgba(38,164,85,.18), transparent 55%),
    linear-gradient(168deg, #083B77 0%, var(--royal-900) 48%, #031525 100%);
  overflow: hidden;
  transition: opacity .65s var(--ease), visibility .65s;
}
#splash.hide { opacity: 0; visibility: hidden; pointer-events: none; }

.splash-bg { position: absolute; inset: 0; pointer-events: none; }
.splash-bg .orb {
  position: absolute; border-radius: 50%;
  filter: blur(2px); opacity: .55;
  animation: orbFloat 7s ease-in-out infinite;
}
.splash-bg .orb-a {
  width: 280px; height: 280px; inset-inline-end: -60px; top: -40px;
  background: radial-gradient(circle, rgba(227,165,13,.35), transparent 68%);
}
.splash-bg .orb-b {
  width: 340px; height: 340px; inset-inline-start: -100px; bottom: -80px;
  background: radial-gradient(circle, rgba(29,142,69,.28), transparent 70%);
  animation-delay: -2.5s;
}
.splash-bg .orb-c {
  width: 160px; height: 160px; inset-inline-start: 42%; top: 58%;
  background: radial-gradient(circle, rgba(255,255,255,.12), transparent 70%);
  animation-delay: -4s;
}
.splash-bg .ray {
  position: absolute; left: 50%; top: 8%; width: 2px; height: 42%;
  transform-origin: top center; opacity: .18;
  background: linear-gradient(to bottom, rgba(227,165,13,.7), transparent);
}
.splash-bg .ray-1 { transform: translateX(-50%) rotate(-18deg); }
.splash-bg .ray-2 { transform: translateX(-50%) rotate(18deg); }

.splash-in {
  position: relative; z-index: 1;
  display: grid; justify-items: center; gap: 22px;
  padding: 28px 24px; text-align: center;
  animation: splashRise .9s var(--ease) both;
}

.splash-seal {
  position: relative; width: 148px; height: 148px;
  display: grid; place-items: center;
}
.splash-seal img {
  width: 118px; height: 118px; border-radius: 50%;
  box-shadow:
    0 0 0 3px rgba(227,165,13,.55),
    0 0 0 10px rgba(255,255,255,.08),
    0 18px 48px rgba(0,0,0,.35);
  animation: sealPulse 2.8s ease-in-out infinite;
  position: relative; z-index: 2;
}
.splash-seal .ring {
  position: absolute; inset: 0; border-radius: 50%;
  border: 1px solid rgba(227,165,13,.35);
}
.splash-seal .ring-a { animation: ringSpin 12s linear infinite; border-style: dashed; }
.splash-seal .ring-b {
  inset: 8px; border-color: rgba(255,255,255,.18);
  animation: ringSpin 18s linear infinite reverse;
}

.splash-copy { display: grid; gap: 10px; justify-items: center; max-width: 26rem; }
.splash-en {
  color: rgba(227,165,13,.85); font-size: .72rem; font-weight: 600;
  letter-spacing: .28em; margin: 0;
}
.splash-copy h1 {
  color: #fff; font-size: clamp(1.2rem, 4.2vw, 1.55rem);
  font-weight: 700; margin: 0; line-height: 1.45;
  text-shadow: 0 8px 28px rgba(0,0,0,.25);
}
.splash-motto {
  margin: 8px 0 0; padding: 12px 18px;
  display: inline-flex; align-items: center; gap: 12px;
  font-family: "Amiri", "IBM Plex Sans Arabic", serif;
  font-size: clamp(1.15rem, 4vw, 1.45rem); font-weight: 700;
  color: #F6E7B2; line-height: 1.5;
  background: linear-gradient(90deg, transparent, rgba(227,165,13,.12), transparent);
  border-block: 1px solid rgba(227,165,13,.28);
  animation: mottoGlow 2.4s ease-in-out infinite;
}
.splash-motto .motto-mark {
  color: var(--gold-400); font-size: .85rem; opacity: .9;
}

.splash-bar {
  width: 132px; height: 3px; border-radius: 99px;
  background: rgba(255,255,255,.14); overflow: hidden; margin-top: 6px;
}
.splash-bar i {
  display: block; width: 42%; height: 100%; border-radius: 99px;
  background: linear-gradient(90deg, var(--gold-400), #FFE9A4);
  animation: slide 1.25s var(--ease) infinite;
}

@keyframes slide { 0% { transform: translateX(140%); } 100% { transform: translateX(-280%); } }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } }
@keyframes splashRise {
  from { opacity: 0; transform: translateY(22px) scale(.96); }
  to { opacity: 1; transform: none; }
}
@keyframes sealPulse {
  0%, 100% { box-shadow: 0 0 0 3px rgba(227,165,13,.55), 0 0 0 10px rgba(255,255,255,.08), 0 18px 48px rgba(0,0,0,.35); }
  50% { box-shadow: 0 0 0 3px rgba(227,165,13,.85), 0 0 0 14px rgba(227,165,13,.12), 0 22px 56px rgba(0,0,0,.4); }
}
@keyframes ringSpin { to { transform: rotate(360deg); } }
@keyframes orbFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-18px); }
}
@keyframes mottoGlow {
  0%, 100% { filter: brightness(1); opacity: .92; }
  50% { filter: brightness(1.15); opacity: 1; }
}

/* ================================================================
   2. تسجيل الدخول
   ================================================================ */
.auth {
  min-height: 100dvh;
  display: grid;
  grid-template-columns: 1fr;
  background: var(--canvas);
}
.auth-brand {
  display: none;
  position: relative;
  padding: 56px 48px;
  background: linear-gradient(165deg, var(--royal-700), var(--royal-900));
  color: #fff;
  overflow: hidden;
  flex-direction: column;
  justify-content: space-between;
}
.auth-brand::after {
  content: ""; position: absolute; inset-inline-end: -140px; bottom: -160px;
  width: 420px; height: 420px; border-radius: 50%;
  background: radial-gradient(circle, rgba(38,164,85,.28), transparent 68%);
}
.auth-brand::before {
  content: ""; position: absolute; inset-inline-start: -90px; top: -110px;
  width: 300px; height: 300px; border-radius: 50%;
  background: radial-gradient(circle, rgba(227,165,13,.22), transparent 66%);
}
.auth-brand > * { position: relative; z-index: 1; }
.auth-brand img { width: 92px; height: 92px; border-radius: 50%; margin-bottom: 26px; }
.auth-brand h2 { font-size: 1.85rem; line-height: 1.4; margin-bottom: 12px; }
.auth-brand p { color: rgba(255,255,255,.72); max-width: 34ch; }
.auth-motto {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 9px 16px; border-radius: var(--r-full);
  background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.14);
  font-size: .85rem; color: var(--gold-400); align-self: flex-start;
}
.auth-panel {
  display: grid; place-items: center; padding: 28px 20px 40px;
}
.auth-card {
  width: 100%; max-width: 420px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
  padding: 30px 26px;
  box-shadow: var(--sh-2);
  animation: rise .4s var(--ease) both;
}
.auth-logo { width: 74px; height: 74px; border-radius: 50%; margin: 0 auto 16px; box-shadow: var(--sh-2); }
.auth-card h1 { text-align: center; font-size: 1.3rem; }
.auth-card .sub { text-align: center; color: var(--muted); font-size: .9rem; margin-top: 6px; margin-bottom: 22px; }
.auth-back { margin-bottom: 14px; }

.auth-role-tag {
  display: inline-flex; margin: 0 auto 10px; padding: 5px 12px;
  border-radius: var(--r-full); font-size: .76rem; font-weight: 700;
  background: var(--royal-50); color: var(--royal-700);
  border: 1px solid var(--royal-100);
}
.auth-role-tag.is-staff {
  background: #EEF8F1; color: var(--green-700);
  border-color: #CDEBD7;
}
.auth-card .auth-role-tag { display: flex; width: fit-content; }

.auth-gate { display: grid; gap: 12px; }
.gate-card {
  display: flex; align-items: center; gap: 14px; width: 100%;
  padding: 16px 14px; text-align: start;
  border-radius: var(--r-lg); border: 1.5px solid var(--line);
  background: var(--surface-2); color: var(--ink);
  transition: border-color var(--t), background var(--t), transform var(--t-fast), box-shadow var(--t);
}
.gate-card:hover {
  border-color: var(--royal-300); background: var(--royal-50);
  box-shadow: var(--sh-1); transform: translateY(-1px);
}
.gate-card.is-staff:hover {
  border-color: #8FCF9F; background: #F3FBF6;
}
.gate-card .gate-ic {
  width: 46px; height: 46px; border-radius: 14px; flex: none;
  display: grid; place-items: center;
  background: var(--royal-50); color: var(--royal-700);
}
.gate-card.is-staff .gate-ic {
  background: #EEF8F1; color: var(--green-700);
}
.gate-card .t { flex: 1; min-width: 0; }
.gate-card .t strong { display: block; font-size: .98rem; font-weight: 700; }
.gate-card .t span { display: block; font-size: .8rem; color: var(--muted); margin-top: 3px; line-height: 1.45; }

.tabs {
  display: grid; grid-auto-flow: column; gap: 4px;
  background: var(--surface-2); border: 1px solid var(--line);
  padding: 4px; border-radius: var(--r-full); margin-bottom: 22px;
}
.tabs button {
  padding: 9px 10px; border-radius: var(--r-full);
  font-size: .88rem; font-weight: 600; color: var(--muted);
  transition: background var(--t), color var(--t);
}
.tabs button.on { background: var(--surface); color: var(--primary); box-shadow: var(--sh-1); }

/* OTP */
.otp {
  display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px;
  direction: ltr; margin: 4px 0 6px;
}
.otp input {
  width: 100%; aspect-ratio: 1/1.15; text-align: center;
  font-size: 1.25rem; font-weight: 700;
  border: 1.5px solid var(--line); border-radius: var(--r-sm);
  background: var(--surface-2); color: var(--ink);
  transition: border-color var(--t-fast), background var(--t-fast);
}
.otp input:focus { outline: none; border-color: var(--primary); background: var(--surface); box-shadow: 0 0 0 3px var(--royal-50); }
.otp input.filled { border-color: var(--royal-300); background: var(--surface); }

.demo-hint {
  display: flex; align-items: center; gap: 10px;
  margin-top: 14px; padding: 11px 14px;
  background: var(--accent-soft); border: 1px dashed var(--gold-400);
  border-radius: var(--r-sm); font-size: .84rem; color: var(--gold-700);
}
.demo-hint b { font-size: 1.05rem; letter-spacing: .2em; direction: ltr; }

.hint-users { margin-top: 20px; padding-top: 18px; border-top: 1px solid var(--line-2); }
.hint-users p { font-size: .76rem; color: var(--faint); text-align: center; margin-bottom: 8px; }
.hint-chips { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.hint-chips button {
  font-size: .74rem; padding: 5px 11px; border-radius: var(--r-full);
  background: var(--surface-2); border: 1px solid var(--line); color: var(--muted);
  transition: all var(--t-fast);
}
.hint-chips button:hover { border-color: var(--royal-300); color: var(--primary); background: var(--royal-50); }

/* ================================================================
   3. هيكل التطبيق
   ================================================================ */
.shell { display: grid; grid-template-columns: 1fr; min-height: 100dvh; }

/* ------- الشريط الجانبي (سطح المكتب) */
.sidebar { display: none; }

.side-brand {
  display: flex; align-items: center; gap: 12px;
  padding: 18px 20px 20px;
}
.side-brand img { width: 42px; height: 42px; border-radius: 50%; flex: none; }
.side-brand .t { min-width: 0; }
.side-brand strong { display: block; font-size: .93rem; color: #fff; line-height: 1.3; }
.side-brand span { font-size: .68rem; color: rgba(255,255,255,.45); letter-spacing: .08em; }

.side-nav { padding: 6px 12px; display: grid; gap: 2px; overflow-y: auto; }
.side-nav .group {
  font-size: .68rem; color: rgba(255,255,255,.34); letter-spacing: .1em;
  padding: 16px 12px 7px; font-weight: 600;
}
.side-nav a {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: var(--r-sm);
  color: rgba(255,255,255,.72); font-size: .9rem; font-weight: 500;
  transition: background var(--t-fast), color var(--t-fast);
  position: relative;
}
.side-nav a svg { width: 19px; height: 19px; flex: none; opacity: .82; }
.side-nav a:hover { background: rgba(255,255,255,.07); color: #fff; }
.side-nav a.on { background: rgba(255,255,255,.12); color: #fff; }
.side-nav a.on svg { opacity: 1; color: var(--gold-400); }
.side-nav a.on::before {
  content: ""; position: absolute; inset-inline-start: 0; top: 22%; bottom: 22%;
  width: 3px; border-radius: 99px; background: var(--gold-400);
}
.side-nav a .badge-dot {
  margin-inline-start: auto; min-width: 20px; height: 20px; padding: 0 6px;
  border-radius: 99px; background: var(--gold-500); color: #3A2A00;
  font-size: .7rem; font-weight: 700; display: grid; place-items: center;
}

.side-foot { margin-top: auto; padding: 14px; }
.side-user {
  display: flex; align-items: center; gap: 11px;
  padding: 11px 12px; border-radius: var(--r-md);
  background: rgba(255,255,255,.07);
}
.side-user .av { flex: none; }
.side-user .t { min-width: 0; flex: 1; }
.side-user strong { display: block; font-size: .85rem; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-user span { font-size: .72rem; color: rgba(255,255,255,.5); }
.side-user button {
  color: rgba(255,255,255,.55); padding: 6px; border-radius: 8px;
  transition: color var(--t-fast), background var(--t-fast);
}
.side-user button:hover { color: #fff; background: rgba(255,255,255,.1); }

/* ------- الشريط العلوي */
.topbar {
  position: sticky; top: 0; z-index: 60;
  height: var(--topbar);
  display: flex; align-items: center; gap: 10px;
  padding: 0 14px;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: saturate(160%) blur(12px);
  border-bottom: 1px solid var(--line);
}
.topbar .tb-brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.topbar .tb-brand img { width: 34px; height: 34px; border-radius: 50%; flex: none; }
.topbar .tb-brand .t { min-width: 0; }
.topbar .tb-brand strong { display: block; font-size: .87rem; line-height: 1.25; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .tb-brand span { font-size: .68rem; color: var(--faint); }
.tb-title { font-size: 1rem; font-weight: 700; }
.tb-actions { margin-inline-start: auto; display: flex; align-items: center; gap: 4px; }

.icon-btn {
  position: relative; width: 40px; height: 40px;
  display: grid; place-items: center; border-radius: var(--r-sm);
  color: var(--ink-2); transition: background var(--t-fast), color var(--t-fast);
}
.icon-btn:hover { background: var(--surface-2); color: var(--primary); }
.icon-btn svg { width: 21px; height: 21px; }
.icon-btn .badge {
  position: absolute; top: 5px; inset-inline-end: 5px;
  min-width: 17px; height: 17px; padding: 0 4px;
  border-radius: 99px; background: var(--gold-500); color: #3A2A00;
  font-size: .66rem; font-weight: 700; display: grid; place-items: center;
  border: 2px solid var(--surface);
  animation: pop .3s var(--ease);
}
@keyframes pop { from { transform: scale(.4); opacity: 0; } }

/* ------- منطقة المحتوى */
.main { min-width: 0; display: flex; flex-direction: column; }
.page {
  flex: 1; width: 100%; max-width: var(--maxw); margin: 0 auto;
  padding: 18px 14px calc(var(--bottomnav) + 26px);
  animation: fadeUp .26s var(--ease) both;
}
@keyframes fadeUp { from { opacity: 0; transform: translateY(8px); } }

/* ------- التنقل السفلي (الهاتف) */
.bottomnav {
  position: fixed; inset-inline: 0; bottom: 0; z-index: 70;
  height: calc(var(--bottomnav) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  display: grid; grid-auto-flow: column; grid-auto-columns: 1fr;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: saturate(160%) blur(14px);
  border-top: 1px solid var(--line);
}
.bottomnav a {
  display: grid; place-items: center; gap: 3px;
  font-size: .68rem; font-weight: 600; color: var(--faint);
  transition: color var(--t-fast); position: relative;
}
.bottomnav a svg { width: 22px; height: 22px; transition: transform var(--t); }
.bottomnav a.on { color: var(--primary); }
.bottomnav a.on svg { transform: translateY(-1px); }
.bottomnav a.on::after {
  content: ""; position: absolute; top: 0; width: 26px; height: 3px;
  border-radius: 0 0 99px 99px; background: var(--primary);
}
.bottomnav a .dot {
  position: absolute; top: 7px; inset-inline-end: calc(50% - 16px);
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--gold-500); border: 2px solid var(--surface);
}

/* ================================================================
   4. المكوّنات
   ================================================================ */

/* ------- التحية */
.greet { margin-bottom: 18px; }
.greet h1 { font-size: 1.28rem; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.greet p { color: var(--muted); font-size: .88rem; margin-top: 3px; }
.greet .wave { display: inline-block; animation: wave 2.4s var(--ease) 1s 2; transform-origin: 70% 70%; }
@keyframes wave {
  0%,60%,100% { transform: rotate(0); }
  15% { transform: rotate(14deg); } 30% { transform: rotate(-8deg); } 45% { transform: rotate(12deg); }
}

/* ------- البطاقة */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-1);
}
.card-pad { padding: 18px; }
.card-head {
  display: flex; align-items: center; gap: 10px;
  padding: 16px 18px; border-bottom: 1px solid var(--line-2);
}
.card-head h3 { font-size: .98rem; }
.card-head .act { margin-inline-start: auto; display: flex; gap: 6px; align-items: center; }
.card-body { padding: 16px 18px; }
.card-body.tight { padding: 8px; }

/* ------- عناوين الأقسام */
.section-head {
  display: flex; align-items: center; gap: 10px;
  margin: 26px 0 12px;
}
.section-head h2 { font-size: 1.04rem; }
.section-head .act { margin-inline-start: auto; }
.link-more {
  font-size: .82rem; color: var(--primary); font-weight: 600;
  display: inline-flex; align-items: center; gap: 4px;
  transition: gap var(--t-fast);
}
.link-more:hover { gap: 8px; }
.link-more svg { width: 15px; height: 15px; }

/* ------- بطاقات الإحصائيات */
.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 11px; }
.stat {
  position: relative; overflow: hidden;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-lg); padding: 15px 16px;
  box-shadow: var(--sh-1);
  transition: transform var(--t), box-shadow var(--t), border-color var(--t);
}
.stat:hover { transform: translateY(-2px); box-shadow: var(--sh-2); }
.stat .ic {
  width: 38px; height: 38px; border-radius: 11px;
  display: grid; place-items: center; margin-bottom: 12px;
}
.stat .ic svg { width: 19px; height: 19px; }
.stat-value {
  font-size: 1.72rem; font-weight: 700; letter-spacing: -.02em;
  line-height: 1.15; color: var(--ink);
}
.stat-value small { font-size: .8rem; font-weight: 600; color: var(--muted); margin-inline-start: 3px; }
.stat-label { font-size: .8rem; color: var(--muted); margin-top: 2px; }
.stat .trend {
  display: inline-flex; align-items: center; gap: 3px;
  font-size: .74rem; font-weight: 600; margin-top: 8px;
  padding: 2px 8px; border-radius: var(--r-full);
}
.stat .trend svg { width: 13px; height: 13px; }
.stat.is-primary   .ic { background: var(--royal-50);  color: var(--royal-600); }
.stat.is-secondary .ic { background: var(--green-50);  color: var(--green-600); }
.stat.is-accent    .ic { background: var(--gold-50);   color: var(--gold-600); }
.stat.is-danger    .ic { background: var(--red-50);    color: var(--red-600); }
.stat.is-accent .stat-value { color: var(--gold-700); }
.stat.is-danger .stat-value { color: var(--red-600); }
.trend.up   { background: var(--green-50); color: var(--green-700); }
.trend.down { background: var(--red-50);   color: var(--red-600); }
.trend.flat { background: var(--surface-2); color: var(--muted); }

/* ------- الحضور */
.att-ring { display: flex; align-items: center; gap: 18px; }
.ring { position: relative; width: 108px; height: 108px; flex: none; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 10; stroke-linecap: round; }
.ring .bg { stroke: var(--line-2); }
.ring .fg { stroke: var(--green-500); transition: stroke-dashoffset .9s var(--ease); }
.ring .mid {
  position: absolute; inset: 0; display: grid; place-content: center; text-align: center;
}
.ring .mid b { font-size: 1.42rem; font-weight: 700; line-height: 1; }
.ring .mid span { font-size: .7rem; color: var(--muted); }

.att-legend { display: grid; gap: 9px; flex: 1; min-width: 0; }
.att-legend li { display: flex; align-items: center; gap: 9px; font-size: .86rem; }
.att-legend .sw { width: 9px; height: 9px; border-radius: 3px; flex: none; }
.att-legend .n { margin-inline-start: auto; font-weight: 700; font-variant-numeric: tabular-nums; }
.sw.present { background: var(--green-500); }
.sw.late    { background: var(--gold-500); }
.sw.absent  { background: var(--red-500); }
.sw.none    { background: var(--line); }

/* شريط تقدّم مقسّم */
.bar-split {
  display: flex; height: 9px; border-radius: 99px; overflow: hidden;
  background: var(--line-2); gap: 2px; margin-top: 4px;
}
.bar-split i { display: block; transition: width .7s var(--ease); min-width: 0; }
.bar-split i.present { background: var(--green-500); }
.bar-split i.late    { background: var(--gold-500); }
.bar-split i.absent  { background: var(--red-500); }

/* ------- الحالة المالية */
.fin-hero {
  padding: 20px; border-radius: var(--r-lg);
  background: linear-gradient(150deg, var(--royal-700), var(--royal-900));
  color: #fff; position: relative; overflow: hidden;
}
.fin-hero::after {
  content: ""; position: absolute; inset-inline-end: -70px; top: -70px;
  width: 190px; height: 190px; border-radius: 50%;
  background: radial-gradient(circle, rgba(227,165,13,.26), transparent 68%);
}
.fin-hero > * { position: relative; }
.fin-hero .lbl { font-size: .8rem; color: rgba(255,255,255,.62); }
.fin-hero .amt { font-size: 1.95rem; font-weight: 700; letter-spacing: -.02em; margin-top: 2px; }
.fin-hero .amt small { font-size: .82rem; font-weight: 600; color: var(--gold-400); margin-inline-start: 5px; }
.fin-hero .prog {
  height: 7px; border-radius: 99px; background: rgba(255,255,255,.16);
  margin: 16px 0 9px; overflow: hidden;
}
.fin-hero .prog i { display: block; height: 100%; border-radius: 99px; background: var(--gold-400); transition: width .8s var(--ease); }
.fin-hero .meta { display: flex; justify-content: space-between; font-size: .78rem; color: rgba(255,255,255,.7); }

.kpis { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-top: 12px; }
.kpi {
  padding: 13px 14px; border-radius: var(--r-md);
  background: var(--surface); border: 1px solid var(--line);
}
.kpi span { display: block; font-size: .76rem; color: var(--muted); }
.kpi b {
  display: block; font-size: 1.02rem; font-weight: 700; margin-top: 2px;
  overflow-wrap: anywhere; line-height: 1.25; font-variant-numeric: tabular-nums;
}
.kpi.gold b   { color: var(--gold-700); }
.kpi.green b  { color: var(--green-700); }
.kpi.blue b   { color: var(--royal-700); }
.kpi.red b    { color: var(--red-600); }
.kpi.red      { background: var(--red-50); border-color: var(--red-100); }

/* ------- بطاقات الفعاليات */
.events { display: grid; gap: 12px; grid-template-columns: 1fr; }
.event-card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-lg); overflow: hidden; box-shadow: var(--sh-1);
  transition: transform var(--t), box-shadow var(--t);
  display: flex; flex-direction: column;
}
.event-card:hover { transform: translateY(-3px); box-shadow: var(--sh-2); }
.event-img {
  aspect-ratio: 16/9; position: relative; overflow: hidden;
  background: linear-gradient(140deg, var(--royal-600), var(--royal-800));
}
.event-img img { width: 100%; height: 100%; object-fit: cover; transition: transform .5s var(--ease); }
.event-card:hover .event-img img { transform: scale(1.04); }
.event-img .glyph {
  position: absolute; inset: 0; display: grid; place-items: center;
  color: rgba(255,255,255,.28);
}
.event-img .glyph svg { width: 48px; height: 48px; }
.event-date {
  position: absolute; top: 10px; inset-inline-start: 10px;
  background: rgba(255,255,255,.96); border-radius: var(--r-sm);
  padding: 6px 10px; text-align: center; box-shadow: var(--sh-1);
  min-width: 52px;
}
.event-date b { display: block; font-size: 1.1rem; line-height: 1; color: var(--royal-700); }
.event-date span { font-size: .64rem; color: var(--muted); }
.event-body { padding: 13px 15px 15px; }
.event-body h4 { font-size: .96rem; font-weight: 700; }
.event-body p {
  font-size: .8rem; color: var(--muted); margin-top: 4px;
  display: flex; align-items: center; gap: 5px;
}
.event-body p svg { width: 14px; height: 14px; flex: none; }

/* ------- عناصر القوائم */
.list { display: grid; }
.list > li + li { border-top: 1px solid var(--line-2); }
.row {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px; border-radius: var(--r-md);
  transition: background var(--t-fast);
  width: 100%; text-align: start;
}
button.row, a.row { cursor: pointer; }
button.row:hover, a.row:hover { background: var(--surface-2); }
.row .t { flex: 1; min-width: 0; }
.row .t strong { display: block; font-size: .9rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .t span { display: block; font-size: .78rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .end { margin-inline-start: auto; display: flex; align-items: center; gap: 8px; flex: none; }

/* ------- الصورة الرمزية */
.av {
  width: 40px; height: 40px; border-radius: 50%; flex: none;
  display: grid; place-items: center; overflow: hidden;
  background: var(--royal-50); color: var(--royal-700);
  font-weight: 700; font-size: .85rem; letter-spacing: -.02em;
}
.av img { width: 100%; height: 100%; object-fit: cover; }
.av.sm { width: 32px; height: 32px; font-size: .73rem; }
.av.lg { width: 60px; height: 60px; font-size: 1.15rem; }
.av.xl { width: 78px; height: 78px; font-size: 1.5rem; }
.av.g { background: var(--green-50); color: var(--green-700); }
.av.o { background: var(--gold-50);  color: var(--gold-700); }

/* ------- الشارات */
.badge-s {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px; border-radius: var(--r-full);
  font-size: .74rem; font-weight: 600; white-space: nowrap;
}
.badge-s::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-s.no-dot::before { display: none; }
.b-present, .b-good, .b-paid, .b-done { background: var(--green-50); color: var(--green-700); }
.b-late, .b-partial, .b-follow_up, .b-pending { background: var(--gold-50); color: var(--gold-700); }
.b-absent, .b-critical, .b-overdue, .b-missing { background: var(--red-50); color: var(--red-600); }
.b-info, .b-unpaid { background: var(--royal-50); color: var(--royal-700); }
.b-muted { background: var(--surface-2); color: var(--muted); }

.pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px; border-radius: var(--r-xs);
  font-size: .72rem; font-weight: 600;
  background: var(--surface-2); color: var(--muted);
  border: 1px solid var(--line);
}

/* ------- الأزرار */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 10px 18px; border-radius: var(--r-sm);
  font-size: .88rem; font-weight: 600;
  border: 1px solid transparent;
  transition: background var(--t-fast), border-color var(--t-fast), color var(--t-fast), transform var(--t-fast), box-shadow var(--t-fast);
  white-space: nowrap; user-select: none;
}
.btn:active { transform: scale(.975); }
.btn svg { width: 17px; height: 17px; flex: none; }
.btn:disabled { opacity: .55; pointer-events: none; }

.btn-primary { background: var(--primary); color: #fff; box-shadow: var(--sh-brand); }
.btn-primary:hover { background: var(--royal-700); }
.btn-green { background: var(--green-600); color: #fff; box-shadow: 0 6px 18px rgba(29,142,69,.2); }
.btn-green:hover { background: var(--green-700); }
.btn-wa { background: #25D366; color: #fff; box-shadow: 0 6px 18px rgba(37,211,102,.25); }
.btn-wa:hover { background: #1ebe57; color: #fff; }
.btn-gold { background: var(--gold-500); color: #46330A; box-shadow: 0 6px 18px rgba(227,165,13,.24); }
.btn-gold:hover { background: var(--gold-600); color: #fff; }
.btn-ghost { background: var(--surface); border-color: var(--line); color: var(--ink-2); }
.btn-ghost:hover { border-color: var(--royal-300); color: var(--primary); background: var(--royal-50); }
.btn-soft { background: var(--royal-50); color: var(--royal-700); }
.btn-soft:hover { background: var(--royal-100); }
.btn-danger { background: var(--red-50); color: var(--red-600); border-color: var(--red-100); }
.btn-danger:hover { background: var(--red-600); color: #fff; border-color: var(--red-600); }
.btn-sm { padding: 6px 12px; font-size: .8rem; border-radius: var(--r-xs); }
.btn-lg { padding: 13px 22px; font-size: .95rem; border-radius: var(--r-md); }
.btn-block { width: 100%; }

/* ------- الحقول */
.field { margin-bottom: 15px; }
.field > label {
  display: block; font-size: .82rem; font-weight: 600;
  color: var(--ink-2); margin-bottom: 6px;
}
.field .help { font-size: .75rem; color: var(--faint); margin-top: 5px; }
.inp {
  width: 100%; padding: 11px 14px;
  border: 1.5px solid var(--line); border-radius: var(--r-sm);
  background: var(--surface); color: var(--ink);
  font-size: .9rem; transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
.inp::placeholder { color: var(--faint); }
.inp:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--royal-50); }
.inp:disabled { background: var(--surface-2); color: var(--muted); }
textarea.inp { resize: vertical; min-height: 88px; line-height: 1.6; }
select.inp {
  appearance: none; padding-inline-end: 38px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236B7A90' stroke-width='2.5' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: left 13px center;
}
.inp.ltr { direction: ltr; text-align: right; }
.field.err .inp { border-color: var(--red-500); }
.field.err .help { color: var(--red-600); }

/* ------- رفع صورة */
.upload-zone {
  border: 1.5px dashed var(--line);
  border-radius: var(--r-md);
  background: var(--surface-2);
  cursor: pointer;
  overflow: hidden;
  transition: border-color var(--t-fast), background var(--t-fast);
}
.upload-zone:hover, .upload-zone:focus-visible {
  border-color: var(--royal-300); background: var(--royal-50); outline: none;
}
.upload-zone.has-img { border-style: solid; padding: 0; }
.upload-empty {
  display: grid; justify-items: center; gap: 6px;
  padding: 22px 16px; text-align: center;
}
.upload-empty strong { font-size: .9rem; }
.upload-empty span { font-size: .76rem; color: var(--faint); }
.upload-preview { position: relative; aspect-ratio: 16/9; background: #0E1B2C; }
.upload-preview img { width: 100%; height: 100%; object-fit: cover; display: block; }
.upload-remove {
  position: absolute; top: 8px; inset-inline-start: 8px;
  width: 30px; height: 30px; border-radius: 50%;
  display: grid; place-items: center;
  background: rgba(14,27,44,.72); color: #fff;
  border: 1px solid rgba(255,255,255,.2);
}
.upload-remove:hover { background: var(--red-600); }

.search-wrap { position: relative; width: 100%; max-width: 100%; }
.search-wrap svg {
  position: absolute; inset-inline-start: 13px; top: 50%; transform: translateY(-50%);
  width: 17px; height: 17px; color: var(--faint); pointer-events: none;
}
.search-wrap .inp { padding-inline-start: 40px; width: 100%; min-width: 0; }

.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }

/* ------- شرائح الاختيار */
.chips { display: flex; gap: 7px; overflow-x: auto; padding-bottom: 3px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  padding: 7px 14px; border-radius: var(--r-full);
  background: var(--surface); border: 1px solid var(--line);
  font-size: .82rem; font-weight: 600; color: var(--muted);
  white-space: nowrap; flex: none;
  transition: all var(--t-fast);
}
.chip:hover { border-color: var(--royal-300); color: var(--primary); }
.chip.on { background: var(--primary); border-color: var(--primary); color: #fff; box-shadow: var(--sh-brand); }
.chip .c { opacity: .7; font-size: .76rem; margin-inline-start: 3px; }

/* ------- مفتاح الحضور / التسليم */
.att-toggle {
  display: grid; grid-auto-flow: column; grid-auto-columns: 1fr;
  gap: 3px; padding: 3px; border-radius: var(--r-full);
  background: var(--surface-2); border: 1px solid var(--line);
  width: min(100%, 236px); flex: none;
}
.att-toggle.cols-3 { width: min(100%, 200px); }
.att-toggle.cols-4 { width: min(100%, 268px); }
.att-toggle button {
  padding: 6px 2px; border-radius: var(--r-full);
  font-size: .72rem; font-weight: 700; color: var(--muted);
  transition: all var(--t-fast); white-space: nowrap;
}
.att-toggle button.on { box-shadow: var(--sh-1); }
.att-toggle button[data-v="present"].on,
.att-toggle button[data-v="done"].on { background: var(--green-500); color: #fff; }
.att-toggle button[data-v="late"].on { background: var(--gold-500); color: #40300A; }
.att-toggle button[data-v="absent"].on,
.att-toggle button[data-v="missing"].on { background: var(--red-500); color: #fff; }
.att-toggle button[data-v="excused"].on { background: var(--royal-600); color: #fff; }

.sw.excused { background: var(--royal-500); }
.b-excused { background: var(--royal-50); color: var(--royal-700); }

/* ------- شريط الحفظ العائم */
.savebar {
  position: fixed; inset-inline: 0; bottom: calc(var(--bottomnav) + env(safe-area-inset-bottom));
  z-index: 65; padding: 11px 14px calc(11px + env(safe-area-inset-bottom));
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  backdrop-filter: blur(12px); border-top: 1px solid var(--line);
  display: flex; align-items: center; gap: 12px;
  transform: translateY(130%); transition: transform .3s var(--ease);
}
.savebar.show { transform: translateY(0); }
.savebar .info { font-size: .82rem; color: var(--muted); flex: 1; min-width: 0; }
.savebar .info b { color: var(--ink); }

/* ------- الحالات الفارغة */
.empty {
  text-align: center; padding: 42px 22px;
  display: grid; justify-items: center; gap: 4px;
}
.empty .ic {
  width: 76px; height: 76px; border-radius: 50%;
  display: grid; place-items: center; margin-bottom: 12px;
  background: linear-gradient(160deg, var(--royal-50), var(--surface-2));
  color: var(--royal-300); position: relative;
}
.empty .ic::after {
  content: ""; position: absolute; inset: -6px; border-radius: 50%;
  border: 1px dashed var(--line);
}
.empty .ic svg { width: 32px; height: 32px; }
.empty h4 { font-size: .98rem; color: var(--ink-2); }
.empty p { font-size: .84rem; color: var(--faint); max-width: 34ch; }
.empty .btn { margin-top: 14px; }

/* ------- الهياكل العظمية */
.sk { background: var(--line-2); border-radius: var(--r-xs); position: relative; overflow: hidden; }
.sk::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--surface) 70%, transparent), transparent);
  animation: shimmer 1.3s infinite;
}
@keyframes shimmer { 100% { transform: translateX(-100%); } }
.sk-card { height: 104px; border-radius: var(--r-lg); }
.sk-row { height: 62px; border-radius: var(--r-md); margin-bottom: 8px; }
.sk-line { height: 12px; }

/* ------- الإشعارات (اللوحة) */
.sheet-back {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(8, 20, 36, .42);
  backdrop-filter: blur(2px);
  opacity: 0; transition: opacity var(--t);
}
.sheet-back.show { opacity: 1; }
.sheet {
  position: fixed; inset-inline: 0; bottom: 0; z-index: 201;
  max-height: 86dvh; display: flex; flex-direction: column;
  background: var(--surface);
  border-radius: var(--r-xl) var(--r-xl) 0 0;
  box-shadow: var(--sh-3);
  transform: translateY(100%); transition: transform .3s var(--ease);
  padding-bottom: env(safe-area-inset-bottom);
}
.sheet.show { transform: translateY(0); }
.sheet-grip {
  width: 38px; height: 4px; border-radius: 99px;
  background: var(--line); margin: 9px auto 0; flex: none;
}
.sheet-head {
  display: flex; align-items: center; gap: 10px;
  padding: 13px 18px; border-bottom: 1px solid var(--line-2); flex: none;
}
.sheet-head h3 { font-size: 1rem; }
.sheet-head .act { margin-inline-start: auto; display: flex; gap: 6px; align-items: center; }
.sheet-body { overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 6px 0 12px; }
.sheet.form .sheet-body { padding: 18px; }

.notif {
  display: flex; gap: 12px; padding: 13px 18px;
  transition: background var(--t-fast); width: 100%; text-align: start;
  position: relative;
}
.notif:hover { background: var(--surface-2); }
.notif + .notif { border-top: 1px solid var(--line-2); }
.notif.unread { background: var(--royal-50); }
.notif.unread::before {
  content: ""; position: absolute; inset-inline-start: 7px; top: 50%;
  transform: translateY(-50%); width: 5px; height: 5px; border-radius: 50%;
  background: var(--primary);
}
.notif .ic {
  width: 36px; height: 36px; border-radius: 11px; flex: none;
  display: grid; place-items: center;
}
.notif .ic svg { width: 18px; height: 18px; }
.notif .t { flex: 1; min-width: 0; }
.notif .t strong { display: block; font-size: .88rem; font-weight: 600; }
.notif .t p { font-size: .81rem; color: var(--muted); line-height: 1.55; }
.notif .t time { font-size: .72rem; color: var(--faint); margin-top: 3px; display: block; }
.ic-fee        { background: var(--gold-50);  color: var(--gold-600); }
.ic-attendance { background: var(--red-50);   color: var(--red-500); }
.ic-homework   { background: var(--royal-50); color: var(--royal-600); }
.ic-event      { background: var(--green-50); color: var(--green-600); }
.ic-behavior   { background: var(--gold-50);  color: var(--gold-700); }
.ic-general    { background: var(--surface-2);color: var(--muted); }

/* ------- التنبيهات المنبثقة */
#toasts {
  position: fixed; z-index: 500; inset-inline: 12px;
  top: calc(env(safe-area-inset-top) + 10px);
  display: grid; gap: 8px; justify-items: center; pointer-events: none;
}
.toast {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 16px; border-radius: var(--r-full);
  background: var(--ink); color: #fff;
  font-size: .86rem; font-weight: 500;
  box-shadow: var(--sh-3); max-width: 92vw;
  animation: toastIn .3s var(--ease) both;
}
.toast svg { width: 17px; height: 17px; flex: none; }
.toast.ok  { background: var(--green-600); }
.toast.err { background: var(--red-600); }
.toast.out { animation: toastOut .25s var(--ease) forwards; }
@keyframes toastIn  { from { opacity: 0; transform: translateY(-14px) scale(.96); } }
@keyframes toastOut { to   { opacity: 0; transform: translateY(-10px) scale(.96); } }

/* ------- مبدّل الأبناء */
.kids { display: grid; gap: 10px; }
.kid-card {
  display: flex; align-items: center; gap: 13px;
  padding: 14px; border-radius: var(--r-lg);
  background: var(--surface); border: 1.5px solid var(--line);
  transition: all var(--t); width: 100%; text-align: start;
}
.kid-card:hover { border-color: var(--royal-300); box-shadow: var(--sh-2); }
.kid-card.on { border-color: var(--primary); background: var(--royal-50); }
.kid-card .t { flex: 1; min-width: 0; }
.kid-card .t strong { display: block; font-size: .95rem; }
.kid-card .t span { font-size: .8rem; color: var(--muted); }
.kid-card .ck {
  width: 22px; height: 22px; border-radius: 50%; flex: none;
  border: 2px solid var(--line); display: grid; place-items: center;
}
.kid-card.on .ck { background: var(--primary); border-color: var(--primary); color: #fff; }
.kid-card .ck svg { width: 13px; height: 13px; opacity: 0; }
.kid-card.on .ck svg { opacity: 1; }

/* شريط تبديل سريع أعلى صفحة الطالب */
.kid-strip { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 6px; scrollbar-width: none; }
.kid-strip::-webkit-scrollbar { display: none; }
.kid-strip button {
  display: flex; align-items: center; gap: 8px; flex: none;
  padding: 5px 13px 5px 6px; border-radius: var(--r-full);
  background: var(--surface); border: 1.5px solid var(--line);
  font-size: .83rem; font-weight: 600; color: var(--muted);
  transition: all var(--t-fast);
}
.kid-strip button.on { border-color: var(--primary); color: var(--primary); background: var(--royal-50); }

/* ------- تنبيهات دفعات ولي الأمر */
.pay-alerts { display: grid; gap: 10px; }
.pay-alert {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 15px; border-radius: var(--r-lg);
  background: var(--surface); border: 1px solid var(--line);
  box-shadow: var(--sh-1); text-decoration: none; color: inherit;
  transition: transform var(--t-fast), box-shadow var(--t-fast);
}
a.pay-alert:hover { transform: translateY(-1px); box-shadow: var(--sh-2); }
.pay-alert .ic {
  width: 40px; height: 40px; border-radius: 12px; flex: none;
  display: grid; place-items: center;
}
.pay-alert .t { flex: 1; min-width: 0; }
.pay-alert .t strong { display: block; font-size: .9rem; font-weight: 700; }
.pay-alert .t p { font-size: .78rem; color: var(--muted); margin-top: 2px; }
.pay-alert .end { text-align: end; flex: none; }
.pay-alert .end b { display: block; font-size: .92rem; font-weight: 700; }
.pay-alert .end span { font-size: .72rem; color: var(--faint); }
.pay-alert.is-danger { border-color: var(--red-100); background: linear-gradient(90deg, var(--red-50), var(--surface) 42%); }
.pay-alert.is-danger .ic { background: var(--red-50); color: var(--red-600); }
.pay-alert.is-danger .end b { color: var(--red-600); }
.pay-alert.is-warn { border-color: #F2E0A8; background: linear-gradient(90deg, var(--gold-50), var(--surface) 42%); }
.pay-alert.is-warn .ic { background: var(--gold-50); color: var(--gold-700); }
.pay-alert.is-warn .end b { color: var(--gold-700); }
.pay-alert.is-info .ic { background: var(--royal-50); color: var(--royal-600); }
.pay-alert.is-info .end b { color: var(--royal-700); }
.pay-alert.is-ok { border-color: var(--green-100, #CDEBD7); background: linear-gradient(90deg, var(--green-50), var(--surface) 42%); }
.pay-alert.is-ok .ic { background: var(--green-50); color: var(--green-700); }
.pay-alert.is-ok .end b { color: var(--green-700); }

.stats-3 { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 520px) {
  .stats-3 { grid-template-columns: 1fr; }
}

/* بطاقة بيانات دخول ولي الأمر */
.cred-card {
  background: var(--surface-2); border: 1px solid var(--line);
  border-radius: var(--r-md); padding: 6px 4px; margin-bottom: 4px;
}
.cred-row {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 11px 12px;
}
.cred-row + .cred-row { border-top: 1px solid var(--line-2); }
.cred-row span { font-size: .82rem; color: var(--muted); }
.cred-row b { font-size: .95rem; }
.cred-row.pin b.pin-code {
  font-size: 1.25rem; letter-spacing: .22em; color: var(--royal-700);
  font-variant-numeric: tabular-nums;
}

/* ------- ترويسة ملف الطالب */
.profile-hero {
  display: flex; align-items: center; gap: 15px;
  padding: 20px; border-radius: var(--r-lg);
  background: linear-gradient(145deg, var(--royal-700), var(--royal-900));
  color: #fff; position: relative; overflow: hidden;
}
.profile-hero::after {
  content: ""; position: absolute; inset-inline-end: -60px; bottom: -80px;
  width: 200px; height: 200px; border-radius: 50%;
  background: radial-gradient(circle, rgba(38,164,85,.3), transparent 70%);
}
.profile-hero > * { position: relative; }
.profile-hero .av { border: 3px solid rgba(255,255,255,.22); background: rgba(255,255,255,.14); color: #fff; }
.profile-hero .t h2 { font-size: 1.16rem; }
.profile-hero .t p { font-size: .84rem; color: rgba(255,255,255,.72); margin-top: 3px; }
.profile-hero .tags { display: flex; gap: 6px; margin-top: 9px; flex-wrap: wrap; }
.profile-hero .tags span {
  font-size: .72rem; padding: 3px 10px; border-radius: var(--r-full);
  background: rgba(255,255,255,.15); border: 1px solid rgba(255,255,255,.12);
}

/* ------- شبكة الوصول السريع */
.quick { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.quick a, .quick button {
  display: grid; justify-items: center; gap: 7px;
  padding: 16px 8px; border-radius: var(--r-lg);
  background: var(--surface); border: 1px solid var(--line);
  font-size: .8rem; font-weight: 600; color: var(--ink-2);
  transition: all var(--t); box-shadow: var(--sh-1); text-align: center;
}
.quick a:hover, .quick button:hover { transform: translateY(-2px); box-shadow: var(--sh-2); color: var(--primary); }
.quick .ic { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; }
.quick .ic svg { width: 20px; height: 20px; }
.quick .n { font-size: .72rem; color: var(--faint); font-weight: 600; }

/* ------- الرسوم البيانية */
.chart { width: 100%; height: 170px; display: block; }
.chart-legend { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 12px; }
.chart-legend li { display: flex; align-items: center; gap: 6px; font-size: .78rem; color: var(--muted); }
.chart-legend .sw { width: 9px; height: 9px; border-radius: 3px; }

.hbars { display: grid; gap: 11px; }
.hbar { display: grid; grid-template-columns: 1fr; gap: 5px; }
.hbar .top { display: flex; justify-content: space-between; font-size: .82rem; }
.hbar .top b { font-variant-numeric: tabular-nums; }
.hbar .track { height: 8px; border-radius: 99px; background: var(--line-2); overflow: hidden; }
.hbar .track i { display: block; height: 100%; border-radius: 99px; background: var(--primary); transition: width .8s var(--ease); }
.hbar.g .track i { background: var(--green-500); }
.hbar.o .track i { background: var(--gold-500); }

/* ------- الجداول (سطح المكتب فقط) */
.tbl-wrap { overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; font-size: .86rem; }
.tbl th {
  text-align: start; padding: 10px 14px; font-size: .76rem; font-weight: 600;
  color: var(--muted); border-bottom: 1px solid var(--line);
  white-space: nowrap; background: var(--surface-2);
}
.tbl td { padding: 11px 14px; border-bottom: 1px solid var(--line-2); }
.tbl tbody tr { transition: background var(--t-fast); }
.tbl tbody tr:hover { background: var(--surface-2); }
.tbl .num { text-align: start; font-variant-numeric: tabular-nums; }

/* ------- متنوعات */
.muted { color: var(--muted); }
.small { font-size: .8rem; }
.center { text-align: center; }
.stack { display: grid; gap: 12px; }
.stack-lg { display: grid; gap: 20px; }
.flex { display: flex; align-items: center; gap: 10px; }
.between { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.mt-2 { margin-top: 8px; } .mt-3 { margin-top: 14px; } .mt-4 { margin-top: 20px; }
.hidden { display: none !important; }
.gold { color: var(--gold-700); }
.green { color: var(--green-700); }
.red { color: var(--red-600); }
.blue { color: var(--royal-700); }

.divider { height: 1px; background: var(--line-2); margin: 14px 0; }

.spin {
  width: 17px; height: 17px; border-radius: 50%;
  border: 2px solid currentColor; border-top-color: transparent;
  animation: spin .7s linear infinite; flex: none;
}
@keyframes spin { to { transform: rotate(360deg); } }

.page-loading { display: grid; place-items: center; padding: 60px 0; color: var(--faint); }

/* ================================================================
   5. نقاط التجاوب
   ================================================================ */
@media (min-width: 560px) {
  .stats { grid-template-columns: repeat(2, 1fr); gap: 13px; }
  .events { grid-template-columns: repeat(2, 1fr); }
  .quick { grid-template-columns: repeat(4, 1fr); }
  .page { padding: 22px 20px calc(var(--bottomnav) + 30px); }
}

@media (min-width: 900px) {
  body { font-size: 15px; }

  .auth { grid-template-columns: 1.05fr .95fr; }
  .auth-brand { display: flex; }

  .shell { grid-template-columns: var(--sidebar) 1fr; }

  .sidebar {
    display: flex; flex-direction: column;
    position: sticky; top: 0; height: 100dvh;
    background: linear-gradient(185deg, var(--royal-800), var(--royal-900) 78%);
    border-inline-end: 1px solid rgba(255,255,255,.06);
    overflow: hidden;
  }

  .topbar { padding: 0 24px; }
  .topbar .tb-brand { display: none; }
  .bottomnav { display: none; }

  .page { padding: 26px 24px 48px; max-width: var(--maxw); }
  .stats { grid-template-columns: repeat(4, 1fr); }
  .kpis { grid-template-columns: repeat(4, 1fr); }
  .events { grid-template-columns: repeat(3, 1fr); }
  .quick { grid-template-columns: repeat(6, 1fr); }

  .savebar {
    bottom: 20px; inset-inline: auto; inset-inline-end: 28px;
    width: min(460px, calc(100vw - 56px));
    border-radius: var(--r-lg); border: 1px solid var(--line);
    box-shadow: var(--sh-3); padding: 12px 16px;
  }

  /* الإشعارات كلوحة منسدلة على سطح المكتب */
  .sheet {
    inset-inline-start: auto; inset-inline-end: 22px;
    top: calc(var(--topbar) + 8px); bottom: auto;
    width: 400px; max-height: min(620px, 78dvh);
    border-radius: var(--r-lg);
    transform: translateY(-10px) scale(.97); opacity: 0;
    transition: transform .2s var(--ease), opacity .2s var(--ease);
  }
  .sheet.show { transform: translateY(0) scale(1); opacity: 1; }
  .sheet-grip { display: none; }
  .sheet.form {
    inset-inline: 0; margin: auto; top: 0; bottom: 0;
    width: min(560px, calc(100vw - 48px)); height: fit-content; max-height: 86dvh;
  }

  #toasts { inset-inline: auto; inset-inline-start: 50%; transform: translateX(50%); }
}

@media (min-width: 1200px) {
  .split-2 { display: grid; grid-template-columns: 1.6fr 1fr; gap: 18px; align-items: start; }
  .split-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; align-items: start; }
}

/* حركة أقل لمن يفضّل ذلك */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}

/* ================================================================
   أداء الجوال + PWA
   ================================================================ */
.page-toolbar {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 10px; margin-bottom: 14px; flex-wrap: wrap;
}
.page-toolbar h1 { font-size: 1.28rem; }
.page-toolbar .btn { flex: none; }

.fin-hero .amt {
  overflow-wrap: anywhere; word-break: break-word; line-height: 1.2;
}
.stat, .card, .kpi, .fin-hero {
  content-visibility: auto;
  contain-intrinsic-size: auto 120px;
}

/* بانر تثبيت التطبيق */
.pwa-banner {
  position: fixed; z-index: 90;
  inset-inline: 12px; bottom: calc(var(--bottomnav) + env(safe-area-inset-bottom) + 12px);
  display: flex; align-items: center; gap: 10px;
  padding: 10px 10px 10px 12px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 18px; box-shadow: var(--sh-3);
  transform: translateY(120%); opacity: 0;
  transition: transform .28s var(--ease), opacity .28s var(--ease);
  max-width: 520px; margin-inline: auto;
}
.pwa-banner.show { transform: translateY(0); opacity: 1; }
.pwa-banner img {
  width: 44px; height: 44px; border-radius: 12px; flex: none;
  background: var(--royal-50); object-fit: cover;
}
.pwa-banner .t { flex: 1; min-width: 0; }
.pwa-banner .t strong { display: block; font-size: .88rem; line-height: 1.3; }
.pwa-banner .t span { display: block; font-size: .72rem; color: var(--muted); margin-top: 2px; line-height: 1.35; }
.pwa-banner .icon-btn { width: 34px; height: 34px; flex: none; color: var(--muted); }

.push-card {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 12px 14px; margin-bottom: 14px;
  border-radius: var(--r-lg); border: 1px solid var(--royal-100);
  background: linear-gradient(120deg, var(--royal-50), var(--surface) 55%);
}
.push-card .ic {
  width: 38px; height: 38px; border-radius: 12px; flex: none;
  display: grid; place-items: center;
  background: var(--royal-600); color: #fff;
}
.push-card .t { flex: 1; min-width: 140px; }
.push-card .t strong { display: block; font-size: .9rem; }
.push-card .t span { display: block; font-size: .75rem; color: var(--muted); margin-top: 2px; }

@media (max-width: 899px) {
  .page { animation: none; padding: 14px 12px calc(var(--bottomnav) + 22px); }
  .bottomnav {
    backdrop-filter: blur(8px);
    background: color-mix(in srgb, var(--surface) 96%, transparent);
  }
  .stat { padding: 12px 12px; }
  .stat .ic { width: 34px; height: 34px; margin-bottom: 8px; border-radius: 10px; }
  .stat-value { font-size: 1.28rem; }
  .stat-label { font-size: .74rem; }
  .fin-hero { padding: 16px; }
  .fin-hero .amt { font-size: 1.45rem; }
  .kpis { gap: 8px; }
  .kpi { padding: 10px 11px; }
  .kpi b { font-size: .92rem; }
  .card-head { padding: 12px 14px; }
  .card-body { padding: 12px 14px; }
  .att-ring { gap: 12px; }
  .ring { width: 92px; height: 92px; }
  .page-toolbar .btn { width: 100%; justify-content: center; }

  /* تقليل كلفة الرسم على اللمس */
  .stat:hover,
  .quick a:hover,
  .quick button:hover,
  .event-card:hover,
  .pay-alert:hover,
  .kid-card:hover { transform: none; box-shadow: var(--sh-1); }

  .chart { height: 140px; }
}

@media (min-width: 900px) {
  .pwa-banner { bottom: 24px; inset-inline-end: 24px; inset-inline-start: auto; width: min(420px, calc(100vw - 48px)); }
  .page-toolbar .btn { width: auto; }
}

/* ================================================================
   6. الطباعة — وصل الاستلام
   ================================================================ */
@media print {
  .topbar, .sidebar, .bottomnav, .savebar, #toasts, .no-print, .pwa-banner, .push-card { display: none !important; }
  body { background: #fff; }
  .page { padding: 0; }
}
